import axiosInstance from '../interceptor'; import { View as ViewDetail } from './viewActions'; interface View { view_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 { accession_number: string; patient_id: string; patient_name: string; patient_size: string; patient_age: string; patient_dob: string; patient_sex: string; sex_neutered: string; pregnancy_status: string; chip_number: string; variety: string; patient_type: string; ref_physician: string; operator_id: string; modality: string; weight: number; thickness: number; length: number; study_type: 'Normal' | 'Emergency'; comment: string; views: View[]; } export interface RegisterWorkResponse { code: string; description: 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[]; }; } // 充当列表框架的filter export interface TaskListQuery { patient_id?: string; patient_name?: string; start_date?: string; end_date?: string; access_number?: string; } // 作为展示数据的基础,本质是个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 ( work: RegisterInfo ): Promise => { console.log('Work object:', JSON.stringify(work, null, 2)); try { const response = await axiosInstance.post('/auth/study', work); // response.data.code console.log(`0000${JSON.stringify(response)}`); return response.data; } catch (error) { console.warn(`注册出错:${error}`); throw error; } }; const fetchTaskList = async ( page, pageSize, filter: TaskListQuery ): Promise<{ items: Task[]; total: number }> => { const response = await axiosInstance.get('/auth/study', { params: { page: page, pageSize: pageSize, ...filter, }, }); const { studies } = response.data.data; return { items: studies, total: studies.length }; }; export { registerWork, fetchTaskList };