瀏覽代碼

feat: 优化患者注册到检查流程和业务流程控制

- 完善 src/domain/patient/mapToTask.ts 中患者数据映射逻辑
- 优化 src/domain/patient/registerToExam.ts 注册到检查流程
- 增强 src/states/businessFlowMiddlewareLogic.ts 业务流程中间件
- 添加配额检查和流程控制逻辑

Closes #37
sw 2 周之前
父節點
當前提交
2ef84c65ac
共有 3 個文件被更改,包括 31 次插入20 次删除
  1. 17 10
      src/domain/patient/mapToTask.ts
  2. 5 1
      src/domain/patient/registerToExam.ts
  3. 9 9
      src/states/businessFlowMiddlewareLogic.ts

+ 17 - 10
src/domain/patient/mapToTask.ts

@@ -33,16 +33,23 @@ const mapToTask = (data: RegisterWorkResponseData): Task => {
     Modality: data.modality,
     Views: data.series.flatMap<dview>(
       (series: Series) =>
-        series.images.map<dview>((image: XImage) => ({
-          view_id: image.view_id,
-          series_instance_uid: series.series_instance_uid,
-          study_instance_uid: data.study_instance_uid,
-          study_id: data.study_id,
-          procedure_id: series.procedure_id,
-          view_description: image.view_description,
-          view_type: '',
-          PrimarySopUID: image.sop_instance_uid ?? '4444',
-        })) as dview[]
+        series.images.map<dview>(
+          (image: XImage) =>
+            ({
+              view_id: image.view_id,
+              series_instance_uid: series.series_instance_uid,
+              study_instance_uid: data.study_instance_uid,
+              study_id: data.study_id,
+              procedure_id: series.procedure_id,
+              view_description: image.view_description,
+              view_type: '',
+              PrimarySopUID: image.sop_instance_uid,
+              expose_status: image.expose_status,
+              image_file_path: image.image_file_path,
+              image_file: image.image_file_path, // Assuming image_file is the same as image_file
+              thumbnail_file: image.thumbnail_file || '', // Assuming thumbnail_file is optional
+            }) satisfies dview
+        ) as dview[]
     ),
     Thickness: data.thickness,
     PatientType: data.patient_type,

+ 5 - 1
src/domain/patient/registerToExam.ts

@@ -1,4 +1,4 @@
-import { addWork } from '../../states/exam/examWorksCacheSlice';
+import { addWork, clearWorks } from '../../states/exam/examWorksCacheSlice';
 import { setBusinessFlow } from '../../states/BusinessFlowSlice';
 import mapToTask from './mapToTask';
 import store from '@/states/store';
@@ -26,6 +26,10 @@ const registerToExam = async (registerData: RegisterWorkResponseData) => {
     //   }))
     // );
     console.log(`注册进入检查,task详情:${JSON.stringify(task)}`);
+    // Clear existing works in the cache
+    dispatch(clearWorks());
+
+    // Save the updated task to the cache
     dispatch(addWork(task));
 
     // Step 3: Proceed to Examination

+ 9 - 9
src/states/businessFlowMiddlewareLogic.ts

@@ -6,7 +6,6 @@ import { suspendOrCompleteStudy } from '@/API/patient/workActions';
 import { RootState } from './store';
 import { getQuota } from '@/API/security/quotaActions';
 import { showQuotaAlert } from './security/quotaModalSlice';
-import useRegisterLogic from '@/domain/patient/registerLogic';
 
 let continueBusinessFlow = '';
 
@@ -43,14 +42,15 @@ const businessFlowMiddlewareLogic: Middleware =
         store.dispatch(showQuotaAlert());
         return;
       }
-      // 进入检查前,如果是从register来的,则判断数据合法性,执行注册等逻辑
-      if (currentKey === 'register') {
-        const { handleRegister } = useRegisterLogic();
-        const { success } = await handleRegister();
-        if (success === false) {
-          return;
-        }
-      }
+      //判断逻辑和注册逻辑已经在注册时做过了
+      // // 进入检查前,如果是从register来的,则判断数据合法性,执行注册等逻辑
+      // if (currentKey === 'register') {
+      //   const { handleRegister } = useRegisterLogic();
+      //   const { success } = await handleRegister();
+      //   if (success === false) {
+      //     return;
+      //   }
+      // }
       prepare();
       return next(action);
     }