123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- 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<RegisterWorkResponse> => {
- 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 };
|