workActions.ts 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. import axiosInstance from '../interceptor';
  2. import { View as ViewDetail } from './viewActions';
  3. interface View {
  4. view_id: string;
  5. procedure_id: string;
  6. }
  7. interface Image {
  8. sop_instance_id: string;
  9. series_instance_uid: string;
  10. study_instance_uid: string;
  11. secondary_sop_uid: string;
  12. study_id: string;
  13. view_id: string;
  14. view_description: string;
  15. image_status: string;
  16. image_file_path: string;
  17. acquisition_mode: string;
  18. acquisition_context: string | null;
  19. img_proc_context: string | null;
  20. sort: number;
  21. product: string;
  22. is_pre_install: boolean;
  23. }
  24. interface Series {
  25. series_instance_uid: string;
  26. study_instance_uid: string;
  27. study_id: string;
  28. procedure_id: string;
  29. body_part: string;
  30. performed_datetime: string | null;
  31. performed_protocol_code_meaning: string;
  32. performed_protocol_code_value: string;
  33. sort: number;
  34. product: string;
  35. is_pre_install: boolean;
  36. images: Image[];
  37. }
  38. export interface RegisterInfo {
  39. accession_number: string;
  40. patient_id: string;
  41. patient_name: string;
  42. patient_size: string;
  43. patient_age: string;
  44. patient_dob: string;
  45. patient_sex: string;
  46. sex_neutered: string;
  47. pregnancy_status: string;
  48. chip_number: string;
  49. variety: string;
  50. patient_type: string;
  51. ref_physician: string;
  52. operator_id: string;
  53. modality: string;
  54. weight: number;
  55. thickness: number;
  56. length: number;
  57. study_type: 'Normal' | 'Emergency';
  58. comment: string;
  59. views: View[];
  60. }
  61. export interface RegisterWorkResponse {
  62. code: string;
  63. description: string;
  64. solution: string;
  65. data: {
  66. study_instance_uid: string;
  67. study_id: string;
  68. public_study_id: string;
  69. specific_character_set: string;
  70. accession_number: string;
  71. ref_physician: string;
  72. patient_id: string;
  73. patient_name: string;
  74. patient_size: string;
  75. other_patient_ids: string;
  76. other_patient_names: string;
  77. owner_name: string;
  78. patient_age: string;
  79. patient_dob: string;
  80. patient_sex: string;
  81. patient_state: string;
  82. admitting_time: string | null;
  83. priority: string;
  84. reg_source: string;
  85. study_status: string;
  86. study_description: string;
  87. study_start_datetime: string | null;
  88. study_end_datetime: string | null;
  89. scheduled_procedure_step_start_date: string | null;
  90. performed_physician: string;
  91. study_lock: string;
  92. folder_path: string;
  93. operator_name: string;
  94. modality: string;
  95. weight: number;
  96. thickness: number;
  97. length: number;
  98. patient_type: string;
  99. study_type: string;
  100. mwl: string;
  101. is_exported: boolean;
  102. is_edited: boolean;
  103. is_appended: boolean;
  104. department: string;
  105. mapped_status: boolean;
  106. qc_result: boolean;
  107. comment: string;
  108. sort: number;
  109. product: string;
  110. series: Series[];
  111. };
  112. }
  113. // 充当列表框架的filter
  114. export interface TaskListQuery {
  115. patient_id?: string;
  116. patient_name?: string;
  117. start_date?: string;
  118. end_date?: string;
  119. access_number?: string;
  120. }
  121. // 作为展示数据的基础,本质是个work
  122. export interface Task {
  123. StudyInstanceUID: string;
  124. StudyID: string;
  125. SpecificCharacterSet: string;
  126. AccessionNumber: string;
  127. PatientID: string;
  128. PatientName: string;
  129. DisplayPatientName: string;
  130. PatientSize: string;
  131. PatientAge: string;
  132. PatientSex: string;
  133. AdmittingTime: string;
  134. RegSource: string;
  135. StudyStatus: string;
  136. RequestedProcedureID: string;
  137. PerformedProtocolCodeValue: string;
  138. PerformedProtocolCodeMeaning: string;
  139. PerformedProcedureStepID: string;
  140. StudyDescription: string;
  141. StudyStartDatetime: string;
  142. ScheduledProcedureStepStartDate: string;
  143. StudyLock: string;
  144. OperatorID: string;
  145. Modality: string;
  146. Views: ViewDetail[];
  147. Thickness: number;
  148. PatientType: string;
  149. StudyType: string;
  150. QRCode: string;
  151. IsExported: boolean;
  152. IsEdited: boolean;
  153. WorkRef: string;
  154. IsAppended: boolean;
  155. CreationTime: string;
  156. MappedStatus: boolean;
  157. IsDelete: boolean;
  158. }
  159. const registerWork = async (
  160. work: RegisterInfo
  161. ): Promise<RegisterWorkResponse> => {
  162. console.log('Work object:', JSON.stringify(work, null, 2));
  163. try {
  164. const response = await axiosInstance.post('/auth/study', work);
  165. // response.data.code
  166. console.log(`0000${JSON.stringify(response)}`);
  167. return response.data;
  168. } catch (error) {
  169. console.warn(`注册出错:${error}`);
  170. throw error;
  171. }
  172. };
  173. const fetchTaskList = async (
  174. page,
  175. pageSize,
  176. filter: TaskListQuery
  177. ): Promise<{ items: Task[]; total: number }> => {
  178. const response = await axiosInstance.get('/auth/study', {
  179. params: {
  180. page: page,
  181. pageSize: pageSize,
  182. ...filter,
  183. },
  184. });
  185. const { studies } = response.data.data;
  186. return { items: studies, total: studies.length };
  187. };
  188. export { registerWork, fetchTaskList };