ReportActions.ts 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /* eslint-disable */
  2. import { extend } from 'cypress/types/lodash';
  3. import axiosInstance from '../interceptor';
  4. // 报告查询参数
  5. export interface ReportQueryParams {
  6. start_time?: string;
  7. end_time?: string;
  8. page?: number;
  9. page_size?: number;
  10. }
  11. // 报告列表项
  12. export interface ReportItem extends ReportContent {
  13. study_instance_uid: string;
  14. study_id: string;
  15. headers: {
  16. age: string;
  17. bed_number: string;
  18. hospitalization_number: string;
  19. inspection_method: string;
  20. inspection_number: string;
  21. medical_record_number: string;
  22. name: string;
  23. requesting_department: string;
  24. sex: string;
  25. };
  26. findings: string;
  27. impression: string;
  28. radiologist: string;
  29. review_physician: string;
  30. create_time: string;
  31. }
  32. export interface ReportResponse extends ReportContent {
  33. '@type': string;
  34. study_instance_uid: string;
  35. study_id: string;
  36. create_time: string;
  37. }
  38. export type ReportContentValue =
  39. | string
  40. | string[]
  41. | ReportContent['headers']
  42. | Partial<ReportContent>
  43. | boolean // 如果将来添加布尔类型的字段
  44. | number;
  45. // 报告内容详情
  46. export interface ReportContent {
  47. headers: {
  48. age: string;
  49. bed_number: string;
  50. hospitalization_number: string;
  51. inspection_method: string;
  52. inspection_number: string;
  53. medical_record_number: string;
  54. name: string;
  55. requesting_department: string;
  56. sex: string;
  57. patient_type?: string
  58. };
  59. findings: string;
  60. impression: string;
  61. radiologist: string;
  62. review_physician: string;
  63. images: string[];
  64. }
  65. // 报告内容响应
  66. export interface ReportContentResponse {
  67. code: string;
  68. description: string;
  69. solution: string;
  70. data: ReportContent;
  71. }
  72. // 报告列表响应
  73. export interface ReportListResponse {
  74. code: string;
  75. description: string;
  76. solution: string;
  77. data: {
  78. '@type': string;
  79. count: number;
  80. reports: ReportItem[];
  81. };
  82. }
  83. // 报告预览请求
  84. export interface ReportPreviewRequest {
  85. headers: {
  86. name: string;
  87. sex: string;
  88. age: string;
  89. medical_record_number?: string;
  90. hospitalization_number?: string;
  91. bed_number?: string;
  92. requesting_department: string;
  93. inspection_number: string;
  94. inspection_method: string;
  95. patient_type?: string;
  96. owner_name?: string;
  97. };
  98. findings: string;
  99. impression: string;
  100. radiologist: string;
  101. review_physician: string;
  102. images: string[];
  103. }
  104. export interface DepartmentItem {
  105. id: number;
  106. department: string;
  107. user_id: number;
  108. }
  109. // 申请科室列表
  110. export interface createdDepartmentResponse {
  111. code: string;
  112. description: string;
  113. solution: string;
  114. data: {
  115. '@type': string;
  116. count: number;
  117. departments: DepartmentItem[];
  118. };
  119. }
  120. // 报告模板响应
  121. export interface DepartmentResponse {
  122. code: string;
  123. description: string;
  124. solution: string;
  125. data: any;
  126. }
  127. // 报告预览响应
  128. export interface ReportPreviewResponse extends Blob { }
  129. /**
  130. * 获取报告列表
  131. * POST /dr/api/v1/auth/report
  132. */
  133. export const getReportList = async (
  134. params: ReportQueryParams
  135. ): Promise<ReportListResponse> => {
  136. const response = await axiosInstance.post('/auth/report', params);
  137. return response.data;
  138. };
  139. /**
  140. * 批量下载报告(xlsx)
  141. * GET /dr/api/v1/auth/report/xls
  142. */
  143. export const downloadReportXlsx = async (
  144. params: Pick<ReportQueryParams, 'start_time' | 'end_time'>
  145. ): Promise<Blob> => {
  146. const response = await axiosInstance.get('/auth/report/xls', {
  147. params,
  148. responseType: 'blob'
  149. });
  150. return response.data;
  151. };
  152. /**
  153. * 报告预览
  154. * POST /dr/api/v1/auth/report/preview
  155. */
  156. export const previewReport = async (
  157. reportData: ReportPreviewRequest
  158. ): Promise<Blob> => {
  159. const response = await axiosInstance.post('/auth/report/preview', reportData, {
  160. responseType: 'blob'
  161. });
  162. return response.data;
  163. };
  164. // 获取申请科室列表
  165. export const getDepartment = async (
  166. params: { scope?: 'all' | 'mine' }
  167. ): Promise<createdDepartmentResponse> => {
  168. const response = await axiosInstance.get('/auth/report/department', {
  169. params,
  170. });
  171. return response.data;
  172. };
  173. // 新建申请科室
  174. export const createdDepartment = async (
  175. params: { departments: string[] }
  176. ): Promise<DepartmentResponse> => {
  177. const response = await axiosInstance.post('/auth/report/department', params);
  178. return response.data;
  179. };