Browse Source

修改领域模型,添加dview数据结构等;修改注册进检查的实现,因领域模型有变动

dengdx 2 weeks ago
parent
commit
a1eacb8c79

+ 51 - 118
src/API/patient/workActions.ts

@@ -1,42 +1,11 @@
+import { Series } from '@/domain/series';
 import axiosInstance from '../interceptor';
 import axiosInstance from '../interceptor';
-import { View as ViewDetail } from './viewActions';
+import { Task } from '@/domain/work';
 
 
 interface View {
 interface View {
   view_id: string;
   view_id: string;
   procedure_id: string;
   procedure_id: string;
 }
 }
-interface Image {
-  sop_instance_id: string;
-  series_instance_uid: string;
-  study_instance_uid: string;
-  secondary_sop_uid: string;
-  study_id: string;
-  view_id: string;
-  view_description: string;
-  image_status: string;
-  image_file_path: string;
-  acquisition_mode: string;
-  acquisition_context: string | null;
-  img_proc_context: string | null;
-  sort: number;
-  product: string;
-  is_pre_install: boolean;
-}
-
-interface Series {
-  series_instance_uid: string;
-  study_instance_uid: string;
-  study_id: string;
-  procedure_id: string;
-  body_part: string;
-  performed_datetime: string | null;
-  performed_protocol_code_meaning: string;
-  performed_protocol_code_value: string;
-  sort: number;
-  product: string;
-  is_pre_install: boolean;
-  images: Image[];
-}
 
 
 export interface RegisterInfo {
 export interface RegisterInfo {
   accession_number: string;
   accession_number: string;
@@ -62,57 +31,59 @@ export interface RegisterInfo {
   views: View[];
   views: View[];
 }
 }
 
 
+export interface RegisterWorkResponseData {
+  study_instance_uid: string;
+  study_id: string;
+  public_study_id: string;
+  specific_character_set: string;
+  accession_number: string;
+  ref_physician: string;
+  patient_id: string;
+  patient_name: string;
+  patient_size: string;
+  other_patient_ids: string;
+  other_patient_names: string;
+  owner_name: string;
+  patient_age: string;
+  patient_dob: string;
+  patient_sex: string;
+  patient_state: string;
+  admitting_time: string | null;
+  priority: string;
+  reg_source: string;
+  study_status: string;
+  study_description: string;
+  study_start_datetime: string | null;
+  study_end_datetime: string | null;
+  scheduled_procedure_step_start_date: string | null;
+  performed_physician: string;
+  study_lock: string;
+  folder_path: string;
+  operator_name: string;
+  modality: string;
+  weight: number;
+  thickness: number;
+  length: number;
+  patient_type: string;
+  study_type: string;
+  mwl: string;
+  is_exported: boolean;
+  is_edited: boolean;
+  is_appended: boolean;
+  department: string;
+  mapped_status: boolean;
+  qc_result: boolean;
+  comment: string;
+  sort: number;
+  product: string;
+  series: Series[];
+}
+
 export interface RegisterWorkResponse {
 export interface RegisterWorkResponse {
   code: string;
   code: string;
   description: string;
   description: string;
   solution: string;
   solution: string;
-  data: {
-    study_instance_uid: string;
-    study_id: string;
-    public_study_id: string;
-    specific_character_set: string;
-    accession_number: string;
-    ref_physician: string;
-    patient_id: string;
-    patient_name: string;
-    patient_size: string;
-    other_patient_ids: string;
-    other_patient_names: string;
-    owner_name: string;
-    patient_age: string;
-    patient_dob: string;
-    patient_sex: string;
-    patient_state: string;
-    admitting_time: string | null;
-    priority: string;
-    reg_source: string;
-    study_status: string;
-    study_description: string;
-    study_start_datetime: string | null;
-    study_end_datetime: string | null;
-    scheduled_procedure_step_start_date: string | null;
-    performed_physician: string;
-    study_lock: string;
-    folder_path: string;
-    operator_name: string;
-    modality: string;
-    weight: number;
-    thickness: number;
-    length: number;
-    patient_type: string;
-    study_type: string;
-    mwl: string;
-    is_exported: boolean;
-    is_edited: boolean;
-    is_appended: boolean;
-    department: string;
-    mapped_status: boolean;
-    qc_result: boolean;
-    comment: string;
-    sort: number;
-    product: string;
-    series: Series[];
-  };
+  data: RegisterWorkResponseData;
 }
 }
 // 充当列表框架的filter
 // 充当列表框架的filter
 export interface TaskListQuery {
 export interface TaskListQuery {
@@ -125,44 +96,6 @@ export interface TaskListQuery {
   page?: number;
   page?: number;
   page_size?: number;
   page_size?: number;
 }
 }
-// 作为展示数据的基础,本质是个work
-export interface Task {
-  StudyInstanceUID: string;
-  StudyID: string;
-  SpecificCharacterSet: string;
-  AccessionNumber: string;
-  PatientID: string;
-  PatientName: string;
-  DisplayPatientName: string;
-  PatientSize: string;
-  PatientAge: string;
-  PatientSex: string;
-  AdmittingTime: string;
-  RegSource: string;
-  StudyStatus: string;
-  RequestedProcedureID: string;
-  PerformedProtocolCodeValue: string;
-  PerformedProtocolCodeMeaning: string;
-  PerformedProcedureStepID: string;
-  StudyDescription: string;
-  StudyStartDatetime: string;
-  ScheduledProcedureStepStartDate: string;
-  StudyLock: string;
-  OperatorID: string;
-  Modality: string;
-  Views: ViewDetail[];
-  Thickness: number;
-  PatientType: string;
-  StudyType: string;
-  QRCode: string;
-  IsExported: boolean;
-  IsEdited: boolean;
-  WorkRef: string;
-  IsAppended: boolean;
-  CreationTime: string;
-  MappedStatus: boolean;
-  IsDelete: boolean;
-}
 
 
 const registerWork = async (
 const registerWork = async (
   work: RegisterInfo
   work: RegisterInfo

+ 12 - 0
src/domain/dview.ts

@@ -0,0 +1,12 @@
+/**
+ * 这里体位实例
+ */
+export interface dview {
+  view_id: string;
+  series_instance_uid: string;
+  study_instance_uid: string;
+  study_id: string;
+  procedure_id: string;
+  view_description: string;
+  view_type: string;
+}

+ 3 - 2
src/domain/patient/mapToTask.ts

@@ -1,6 +1,7 @@
-import { Task, RegisterWorkResponse } from '../../API/patient/workActions';
+import { RegisterWorkResponseData } from '../../API/patient/workActions';
+import { Task } from '../work';
 
 
-const mapToTask = (data: RegisterWorkResponse['data']): Task => {
+const mapToTask = (data: RegisterWorkResponseData): Task => {
   return {
   return {
     StudyInstanceUID: data.study_instance_uid,
     StudyInstanceUID: data.study_instance_uid,
     StudyID: data.study_id,
     StudyID: data.study_id,

+ 15 - 4
src/domain/patient/registerToExam.ts

@@ -2,16 +2,27 @@ import { addWork } from '../../states/exam/examWorksCacheSlice';
 import { setBusinessFlow } from '../../states/BusinessFlowSlice';
 import { setBusinessFlow } from '../../states/BusinessFlowSlice';
 import mapToTask from './mapToTask';
 import mapToTask from './mapToTask';
 import store from '@/states/store';
 import store from '@/states/store';
-import { View } from '@/API/patient/viewActions';
+import { RegisterWorkResponseData } from '@/API/patient/workActions';
+import { Series } from '@/domain/series';
+import { XImage } from '@/domain/xImage';
 
 
-const registerToExam = async (registerData:any,views?:View[]) => {
+const registerToExam = async (registerData: RegisterWorkResponseData) => {
   const dispatch = store.dispatch;
   const dispatch = store.dispatch;
 
 
   try {
   try {
-
     // Save registration result to cache
     // Save registration result to cache
     const task = mapToTask(registerData);
     const task = mapToTask(registerData);
-    task.Views=views || [];
+    task.Views = registerData.series.flatMap((series: Series) =>
+      series.images.map((image: XImage) => ({
+        view_id: image.view_id,
+        series_instance_uid: series.series_instance_uid,
+        study_instance_uid: registerData.study_instance_uid,
+        study_id: registerData.study_id,
+        procedure_id: series.procedure_id,
+        view_description: image.view_description,
+        view_type: '',
+      }))
+    );
     dispatch(addWork(task));
     dispatch(addWork(task));
 
 
     // Step 3: Proceed to Examination
     // Step 3: Proceed to Examination

+ 40 - 0
src/domain/work.ts

@@ -0,0 +1,40 @@
+import { dview } from './dview';
+
+// 作为展示数据的基础,本质是个work
+export interface Task {
+  StudyInstanceUID: string;
+  StudyID: string;
+  SpecificCharacterSet: string;
+  AccessionNumber: string;
+  PatientID: string;
+  PatientName: string;
+  DisplayPatientName: string;
+  PatientSize: string;
+  PatientAge: string;
+  PatientSex: string;
+  AdmittingTime: string;
+  RegSource: string;
+  StudyStatus: string;
+  RequestedProcedureID: string;
+  PerformedProtocolCodeValue: string;
+  PerformedProtocolCodeMeaning: string;
+  PerformedProcedureStepID: string;
+  StudyDescription: string;
+  StudyStartDatetime: string;
+  ScheduledProcedureStepStartDate: string;
+  StudyLock: string;
+  OperatorID: string;
+  Modality: string;
+  Views: dview[];
+  Thickness: number;
+  PatientType: string;
+  StudyType: string;
+  QRCode: string;
+  IsExported: boolean;
+  IsEdited: boolean;
+  WorkRef: string;
+  IsAppended: boolean;
+  CreationTime: string;
+  MappedStatus: boolean;
+  IsDelete: boolean;
+}

+ 9 - 5
src/pages/patient/register.tsx

@@ -14,7 +14,11 @@ import { FormattedMessage } from 'react-intl';
 import BasicInfoForm from './components/register.form';
 import BasicInfoForm from './components/register.form';
 import SelectedProtocolList from './components/register.selected.view.list';
 import SelectedProtocolList from './components/register.selected.view.list';
 import RegisterAvailableList from './components/register.available.list';
 import RegisterAvailableList from './components/register.available.list';
-import { RegisterInfo, registerWork } from '@/API/patient/workActions';
+import {
+  RegisterInfo,
+  registerWork,
+  RegisterWorkResponseData,
+} from '@/API/patient/workActions';
 import useRegisterState from '@/hooks/useRegisterState';
 import useRegisterState from '@/hooks/useRegisterState';
 import registerformSchema from '@/validation/patient/registerSchema';
 import registerformSchema from '@/validation/patient/registerSchema';
 import registerToExam from '@/domain/patient/registerToExam';
 import registerToExam from '@/domain/patient/registerToExam';
@@ -33,8 +37,8 @@ const RegisterPage: React.FC = () => {
 
 
   const handleRegister = async (): Promise<{
   const handleRegister = async (): Promise<{
     success: boolean;
     success: boolean;
-    // eslint-disable-next-line @typescript-eslint/no-explicit-any
-    data?: any;
+
+    data?: RegisterWorkResponseData;
     views?: View[];
     views?: View[];
   }> => {
   }> => {
     try {
     try {
@@ -187,8 +191,8 @@ const RegisterPage: React.FC = () => {
           type="default"
           type="default"
           onClick={async () => {
           onClick={async () => {
             const registerResult = await handleRegister();
             const registerResult = await handleRegister();
-            if (registerResult.success) {
-              await registerToExam(registerResult.data, registerResult.views);
+            if (registerResult.success && registerResult.data) {
+              await registerToExam(registerResult.data);
             }
             }
           }}
           }}
         >
         >