123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375 |
- import React from 'react';
- import { useSelector, useDispatch } from 'react-redux';
- import { useEffect } from 'react';
- import {
- fetchWorkThunk,
- workSelectionSlice,
- } from '../../../states/patient/worklist/slices/workSlice';
- import { Table } from 'antd';
- import { FormattedMessage } from 'react-intl';
- import { RootState, AppDispatch } from '../../../states/store';
- import { Task } from '@/domain/work';
- const columns = [
- {
- title: (
- <FormattedMessage
- id="worklistTable.StudyInstanceUID"
- defaultMessage="worklistTable.StudyInstanceUID"
- />
- ),
- dataIndex: 'StudyInstanceUID',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.StudyID"
- defaultMessage="worklistTable.StudyID"
- />
- ),
- dataIndex: 'StudyID',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.SpecificCharacterSet"
- defaultMessage="worklistTable.SpecificCharacterSet"
- />
- ),
- dataIndex: 'SpecificCharacterSet',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.AccessionNumber"
- defaultMessage="worklistTable.AccessionNumber"
- />
- ),
- dataIndex: 'AccessionNumber',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.PatientID"
- defaultMessage="worklistTable.PatientID"
- />
- ),
- dataIndex: 'PatientID',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.PatientName"
- defaultMessage="worklistTable.PatientName"
- />
- ),
- dataIndex: 'PatientName',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.DisplayPatientName"
- defaultMessage="worklistTable.DisplayPatientName"
- />
- ),
- dataIndex: 'DisplayPatientName',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.PatientSize"
- defaultMessage="worklistTable.PatientSize"
- />
- ),
- dataIndex: 'PatientSize',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.PatientAge"
- defaultMessage="worklistTable.PatientAge"
- />
- ),
- dataIndex: 'PatientAge',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.PatientSex"
- defaultMessage="worklistTable.PatientSex"
- />
- ),
- dataIndex: 'PatientSex',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.AdmittingTime"
- defaultMessage="worklistTable.AdmittingTime"
- />
- ),
- dataIndex: 'AdmittingTime',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.RegSource"
- defaultMessage="worklistTable.RegSource"
- />
- ),
- dataIndex: 'RegSource',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.StudyStatus"
- defaultMessage="worklistTable.StudyStatus"
- />
- ),
- dataIndex: 'StudyStatus',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.RequestedProcedureID"
- defaultMessage="worklistTable.RequestedProcedureID"
- />
- ),
- dataIndex: 'RequestedProcedureID',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.PerformedProtocolCodeValue"
- defaultMessage="worklistTable.PerformedProtocolCodeValue"
- />
- ),
- dataIndex: 'PerformedProtocolCodeValue',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.PerformedProtocolCodeMeaning"
- defaultMessage="worklistTable.PerformedProtocolCodeMeaning"
- />
- ),
- dataIndex: 'PerformedProtocolCodeMeaning',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.PerformedProcedureStepID"
- defaultMessage="worklistTable.PerformedProcedureStepID"
- />
- ),
- dataIndex: 'PerformedProcedureStepID',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.StudyDescription"
- defaultMessage="worklistTable.StudyDescription"
- />
- ),
- dataIndex: 'StudyDescription',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.StudyStartDatetime"
- defaultMessage="worklistTable.StudyStartDatetime"
- />
- ),
- dataIndex: 'StudyStartDatetime',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.ScheduledProcedureStepStartDate"
- defaultMessage="worklistTable.ScheduledProcedureStepStartDate"
- />
- ),
- dataIndex: 'ScheduledProcedureStepStartDate',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.StudyLock"
- defaultMessage="worklistTable.StudyLock"
- />
- ),
- dataIndex: 'StudyLock',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.OperatorID"
- defaultMessage="worklistTable.OperatorID"
- />
- ),
- dataIndex: 'OperatorID',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.Modality"
- defaultMessage="worklistTable.Modality"
- />
- ),
- dataIndex: 'Modality',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.Views"
- defaultMessage="worklistTable.Views"
- />
- ),
- dataIndex: 'Views',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.Thickness"
- defaultMessage="worklistTable.Thickness"
- />
- ),
- dataIndex: 'Thickness',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.PatientType"
- defaultMessage="worklistTable.PatientType"
- />
- ),
- dataIndex: 'PatientType',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.StudyType"
- defaultMessage="worklistTable.StudyType"
- />
- ),
- dataIndex: 'StudyType',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.QRCode"
- defaultMessage="worklistTable.QRCode"
- />
- ),
- dataIndex: 'QRCode',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.IsExported"
- defaultMessage="worklistTable.IsExported"
- />
- ),
- dataIndex: 'IsExported',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.IsEdited"
- defaultMessage="worklistTable.IsEdited"
- />
- ),
- dataIndex: 'IsEdited',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.WorkRef"
- defaultMessage="worklistTable.WorkRef"
- />
- ),
- dataIndex: 'WorkRef',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.IsAppended"
- defaultMessage="worklistTable.IsAppended"
- />
- ),
- dataIndex: 'IsAppended',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.CreationTime"
- defaultMessage="worklistTable.CreationTime"
- />
- ),
- dataIndex: 'CreationTime',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.MappedStatus"
- defaultMessage="worklistTable.MappedStatus"
- />
- ),
- dataIndex: 'MappedStatus',
- },
- {
- title: (
- <FormattedMessage
- id="worklistTable.IsDelete"
- defaultMessage="worklistTable.IsDelete"
- />
- ),
- dataIndex: 'IsDelete',
- },
- ];
- const WorklistTable: React.FC = () => {
- const dispatch: AppDispatch = useDispatch();
- const worklistData = useSelector(
- (state: RootState) => state.workEntities.data
- );
- const filters = useSelector((state: RootState) => state.search);
- const page = useSelector((state: RootState) => state.workPagination.page);
- const pageSize = useSelector(
- (state: RootState) => state.workPagination.pageSize
- );
- const selectedIds = useSelector(
- (state: RootState) => state.workSelection.selectedIds
- );
- useEffect(() => {
- dispatch(fetchWorkThunk({ page, pageSize, filters }));
- }, [dispatch, filters, page, pageSize]);
- const handleRowClick = (record: Task) => {
- console.log('Row clicked:', JSON.stringify(record, null, 2));
- console.log('Selected IDs before:', record.StudyInstanceUID);
- dispatch(
- workSelectionSlice.actions.setSelectedIds([record.StudyInstanceUID])
- );
- };
- return (
- <Table
- columns={columns}
- dataSource={worklistData}
- rowKey="StudyInstanceUID"
- onRow={(record) => ({
- onClick: () => handleRowClick(record),
- })}
- rowHoverable={false}
- rowClassName={(record) =>
- selectedIds.includes(record.StudyInstanceUID)
- ? 'bg-yellow-500 hover:bg-yellow-800'
- : ''
- }
- />
- );
- };
- export default WorklistTable;
|