Browse Source

补充拉取任务清单的实现

dengdx 2 months ago
parent
commit
4fb92ef2aa

+ 15 - 8
src/API/patient/workActions.ts

@@ -114,7 +114,7 @@ interface RegisterWorkResponse {
     series: Series[];
   };
 }
-
+// 充当列表框架的filter
 export interface TaskListQuery {
   patient_id?: string;
   patient_name?: string;
@@ -122,8 +122,8 @@ export interface TaskListQuery {
   end_date?: string;
   access_number?: string;
 }
-
-export interface TaskListResponse {
+// 作为展示数据的基础,本质是个work
+export interface Task {
   StudyInstanceUID: string;
   StudyID: string;
   SpecificCharacterSet: string;
@@ -171,12 +171,19 @@ const registerWork = async (
 };
 
 const fetchTaskList = async (
-  query: TaskListQuery
-): Promise<TaskListResponse[]> => {
-  const response = await axiosInstance.get('/auth/studys', {
-    params: query,
+  page,
+  pageSize,
+  filter: TaskListQuery
+): Promise<{ items: Task[]; total: number }> => {
+  const response = await axiosInstance.get('/auth/study', {
+    params: {
+      page: page,
+      pageSize: pageSize,
+      ...filter,
+    },
   });
-  return response.data;
+  const { studies } = response.data.data;
+  return { items: studies, total: studies.length };
 };
 
 export { registerWork, fetchTaskList };

+ 19 - 11
src/pages/patient/components/WorklistTable.tsx

@@ -1,6 +1,8 @@
 import React from 'react';
+import { useSelector } from 'react-redux';
 import { Table } from 'antd';
 import { FormattedMessage } from 'react-intl';
+import { RootState } from '../../../states/store';
 
 const columns = [
   {
@@ -10,7 +12,7 @@ const columns = [
         defaultMessage="worklistTable.patientId"
       />
     ),
-    dataIndex: 'patientId',
+    dataIndex: 'patient_id',
   },
   {
     title: (
@@ -19,7 +21,7 @@ const columns = [
         defaultMessage="worklistTable.name"
       />
     ),
-    dataIndex: 'name',
+    dataIndex: 'patient_name',
   },
   {
     title: (
@@ -46,7 +48,7 @@ const columns = [
         defaultMessage="worklistTable.registrationId"
       />
     ),
-    dataIndex: 'registrationId',
+    dataIndex: 'accession_number',
   },
   {
     title: (
@@ -55,7 +57,7 @@ const columns = [
         defaultMessage="worklistTable.birthDate"
       />
     ),
-    dataIndex: 'birthDate',
+    dataIndex: 'patient_dob',
   },
   {
     title: (
@@ -64,7 +66,7 @@ const columns = [
         defaultMessage="worklistTable.age"
       />
     ),
-    dataIndex: 'age',
+    dataIndex: 'patient_age',
   },
   {
     title: (
@@ -73,7 +75,7 @@ const columns = [
         defaultMessage="worklistTable.gender"
       />
     ),
-    dataIndex: 'gender',
+    dataIndex: 'patient_sex',
   },
   {
     title: (
@@ -82,7 +84,7 @@ const columns = [
         defaultMessage="worklistTable.bodyType"
       />
     ),
-    dataIndex: 'bodyType',
+    dataIndex: 'patient_type',
   },
   {
     title: (
@@ -100,7 +102,7 @@ const columns = [
         defaultMessage="worklistTable.height"
       />
     ),
-    dataIndex: 'height',
+    dataIndex: 'length',
   },
   {
     title: (
@@ -109,7 +111,7 @@ const columns = [
         defaultMessage="worklistTable.pregnancyStatus"
       />
     ),
-    dataIndex: 'pregnancyStatus',
+    dataIndex: 'pregnancy_status',
   },
   {
     title: (
@@ -118,12 +120,18 @@ const columns = [
         defaultMessage="worklistTable.referringDoctor"
       />
     ),
-    dataIndex: 'referringDoctor',
+    dataIndex: 'ref_physician',
   },
 ];
 
 const WorklistTable: React.FC = () => {
-  return <Table columns={columns} dataSource={[]} rowKey="patientId" />;
+  const worklistData = useSelector(
+    (state: RootState) => state.workEntities.data
+  );
+
+  return (
+    <Table columns={columns} dataSource={worklistData} rowKey="patient_id" />
+  );
 };
 
 export default WorklistTable;

+ 2 - 4
src/states/patient/worklist/slices/workSlice.ts

@@ -11,11 +11,9 @@ import { fetchTaskList } from '../../../../API/patient/workActions';
 
 const fetchWorkThunk = createFetchThunk<WorkFilter, work>(
   'worklist',
-  // 暂时不使用分页
-  // eslint-disable-next-line
   async ({ page, pageSize, filters }) => {
-    const data = await fetchTaskList(filters);
-    return { data, total: data.length };
+    const { items, total } = await fetchTaskList(page, pageSize, filters);
+    return { data: items, total };
   }
 );
 

+ 1 - 1
src/states/patient/worklist/types/worklist.ts

@@ -1 +1 @@
-export { TaskListResponse as work } from '@/API/patient/workActions';
+export { Task as work } from '@/API/patient/workActions';