study.ts 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  1. /**
  2. * Study Mock Handlers
  3. * 检查信息管理相关的 mock 处理器
  4. */
  5. /**
  6. * 登记检查信息 - 成功场景
  7. *
  8. * @description 登记新的检查信息
  9. * @method POST
  10. * @url /dr/api/v1/auth/study
  11. * @access 需要认证
  12. *
  13. * @param {Object} requestBody - 请求体(包含患者信息、体位列表等)
  14. *
  15. * @returns {Object} data - 新创建的检查信息
  16. * @returns {string} data.study_id - 检查ID
  17. * @returns {Object[]} data.series - 序列列表
  18. *
  19. * @example
  20. * mockRegisterStudySuccess();
  21. * cy.wait('@registerStudySuccess');
  22. *
  23. * @see docs/DR.md - 章节13
  24. */
  25. export function mockRegisterStudySuccess() {
  26. cy.intercept('POST', '/dr/api/v1/auth/study', {
  27. statusCode: 200,
  28. body: {
  29. code: "0x000000",
  30. description: "Success",
  31. solution: "",
  32. data: {
  33. "@type": "type.googleapis.com/dr.study.Study",
  34. study_instance_uid: "1.2.276.0.1000000.5.1.2.701601461.33458.1750833219.482097",
  35. study_id: "20250625143339389",
  36. patient_name: "Test Patient",
  37. patient_id: "PET007",
  38. study_status: "Arrived",
  39. series: []
  40. }
  41. }
  42. }).as('registerStudySuccess');
  43. }
  44. /**
  45. * 获取检查信息 - Arrived状态(简化版)
  46. *
  47. * @description 根据study_id获取检查详细信息(已到达状态)
  48. * @method GET
  49. * @url /dr/api/v1/auth/study/{id}
  50. * @access 需要认证
  51. *
  52. * @param {string} id - 检查ID(study_id),路径参数
  53. *
  54. * @returns {Object} data - 检查详细信息
  55. * @returns {string} data.study_status - 检查状态(Arrived/InProgress/Completed)
  56. *
  57. * @example
  58. * mockGetStudyArrived();
  59. * cy.wait('@getStudyArrived');
  60. *
  61. * @see docs/DR.md - 章节16
  62. */
  63. export function mockGetStudyArrived() {
  64. cy.intercept('GET', '/dr/api/v1/auth/study/*', {
  65. statusCode: 200,
  66. body: {
  67. code: "0x000000",
  68. description: "Success",
  69. solution: "",
  70. data: {
  71. study_id: "250929163817805",
  72. patient_name: "Test Patient",
  73. study_status: "Arrived",
  74. series: []
  75. }
  76. }
  77. }).as('getStudyArrived');
  78. }
  79. /**
  80. * 获取检查信息 - 完整详情(未曝光)
  81. *
  82. * @description 根据study_id获取完整的检查详细信息,所有images为未曝光状态
  83. * @method GET
  84. * @url /dr/api/v1/auth/study/{id}
  85. * @access 需要认证
  86. *
  87. * @param {string} studyId - 检查ID(study_id),路径参数
  88. *
  89. * @returns {Object} data - 完整的检查详细信息,包含未曝光的series和images
  90. *
  91. * @example
  92. * mockGetStudyDetailsUnexposed('250929163817805');
  93. * cy.wait('@getStudyDetailsUnexposed');
  94. *
  95. * @see docs/测试/进入检查功能测试方案.md
  96. */
  97. export function mockGetStudyDetailsUnexposed(studyId: string) {
  98. cy.intercept('GET', `/dr/api/v1/auth/study/${studyId}`, {
  99. statusCode: 200,
  100. body: {
  101. code: "0x000000",
  102. description: "成功",
  103. solution: "",
  104. data: {
  105. "@type": "type.googleapis.com/dr.study.Study",
  106. study_instance_uid: "2.25.156.999999.0000.1.2.8323328.269954.1759135097.323784",
  107. study_id: studyId,
  108. public_study_id: "",
  109. specific_character_set: "ISO_IR 192",
  110. accession_number: "ACC0012345",
  111. ref_physician: "Dr. Smith (Vet)",
  112. patient_id: "PET007",
  113. patient_name: "Buddy (Dog)",
  114. patient_english_name: "Buddy en",
  115. patient_former_name: "Buddy f",
  116. patient_size: "Large",
  117. other_patient_ids: "",
  118. other_patient_names: "",
  119. patient_age: "008Y",
  120. patient_dob: "2025-06-10T03:12:36.181739Z",
  121. patient_sex: "M",
  122. sex_neutered: "",
  123. pregnancy_status: "",
  124. patient_state: "",
  125. admitting_time: null,
  126. priority: "",
  127. reg_source: "",
  128. study_description: "",
  129. study_start_datetime: "2025-09-29T08:38:17.283651Z",
  130. study_end_datetime: null,
  131. scheduled_procedure_step_start_date: null,
  132. performed_physician: "",
  133. study_lock: "Unlocked",
  134. folder_path: "",
  135. operator_name: "OP987",
  136. modality: "DX",
  137. weight: 25,
  138. thickness: 15,
  139. length: 60,
  140. patient_type: "Human",
  141. study_type: "Normal",
  142. owner_name: "owner1",
  143. chip_number: "CHIP123456789",
  144. variety: "Golden Retriever",
  145. is_anaesthesia: true,
  146. is_sedation: true,
  147. mwl: "",
  148. is_exported: false,
  149. is_edited: false,
  150. is_appended: false,
  151. department: "",
  152. mapped_status: false,
  153. qc_result: false,
  154. comment: "未曝光测试数据",
  155. study_status: "Arrived",
  156. sort: 0,
  157. product: "DROS",
  158. create_time: "2025-09-29T08:38:17.353598Z",
  159. series: [
  160. {
  161. series_instance_uid: "2.25.156.999999.0000.1.3.8323328.269954.1759135097.323785",
  162. study_instance_uid: "2.25.156.999999.0000.1.2.8323328.269954.1759135097.323784",
  163. study_id: studyId,
  164. procedure_id: "P0-0002",
  165. patient_type: "Human",
  166. body_part: "Human_SKULL",
  167. performed_datetime: null,
  168. performed_protocol_code_meaning: "颅骨前后位 + 侧位",
  169. performed_protocol_code_value: "P0-0002",
  170. sort: 1,
  171. product: "DROS",
  172. is_pre_install: true,
  173. create_time: "2025-09-29T08:38:17.359308Z",
  174. images: [
  175. {
  176. sop_instance_uid: "2.25.156.999999.0000.1.4.8323328.269954.1759135097.323786",
  177. series_instance_uid: "2.25.156.999999.0000.1.3.8323328.269954.1759135097.323785",
  178. study_instance_uid: "2.25.156.999999.0000.1.2.8323328.269954.1759135097.323784",
  179. secondary_sop_uid: "",
  180. study_id: studyId,
  181. view_id: "View_DX_T_A_SK_AP_00",
  182. view_description: "颅骨前后位",
  183. patient_type: "Human",
  184. body_part_id: "Human_SKULL",
  185. anatomic_region: "Skull",
  186. image_type: "expose",
  187. image_file_path: "",
  188. image_file: "",
  189. thumbnail_file: "",
  190. acquisition_mode: "RAD",
  191. acquisition_context: null,
  192. img_proc_context: null,
  193. comment: "",
  194. expose_status: "Unexposed",
  195. expose_time: null,
  196. judged_status: "NotJudged",
  197. send_status: "Unsent",
  198. export_status: "NotExported",
  199. storage_status: "NotSaved",
  200. ticket: "",
  201. sort: 1,
  202. product: "DROS",
  203. is_pre_install: true,
  204. create_time: "2025-09-29T08:38:17.361002Z"
  205. },
  206. {
  207. sop_instance_uid: "2.25.156.999999.0000.1.4.8323328.269954.1759135097.323787",
  208. series_instance_uid: "2.25.156.999999.0000.1.3.8323328.269954.1759135097.323785",
  209. study_instance_uid: "2.25.156.999999.0000.1.2.8323328.269954.1759135097.323784",
  210. secondary_sop_uid: "",
  211. study_id: studyId,
  212. view_id: "View_DX_T_A_SK_LAT_00",
  213. view_description: "颅骨左侧位",
  214. patient_type: "Human",
  215. body_part_id: "Human_SKULL",
  216. anatomic_region: "Skull",
  217. image_type: "expose",
  218. image_file_path: "",
  219. image_file: "",
  220. thumbnail_file: "",
  221. acquisition_mode: "RAD",
  222. acquisition_context: null,
  223. img_proc_context: null,
  224. comment: "",
  225. expose_status: "Unexposed",
  226. expose_time: null,
  227. judged_status: "NotJudged",
  228. send_status: "Unsent",
  229. export_status: "NotExported",
  230. storage_status: "NotSaved",
  231. ticket: "",
  232. sort: 2,
  233. product: "DROS",
  234. is_pre_install: true,
  235. create_time: "2025-09-29T08:38:17.362195Z"
  236. }
  237. ]
  238. }
  239. ]
  240. }
  241. }
  242. }).as('getStudyDetailsUnexposed');
  243. }
  244. /**
  245. * 获取检查信息 - 完整详情(已曝光)
  246. *
  247. * @description 根据study_id获取完整的检查详细信息,所有images为已曝光状态
  248. * @method GET
  249. * @url /dr/api/v1/auth/study/{id}
  250. * @access 需要认证
  251. *
  252. * @param {string} studyId - 检查ID(study_id),路径参数
  253. *
  254. * @returns {Object} data - 完整的检查详细信息,包含已曝光的series和images
  255. *
  256. * @example
  257. * mockGetStudyDetailsExposed('250929163817805');
  258. * cy.wait('@getStudyDetailsExposed');
  259. *
  260. * @see docs/测试/进入检查功能测试方案.md
  261. */
  262. export function mockGetStudyDetailsExposed(studyId: string) {
  263. cy.intercept('GET', `/dr/api/v1/auth/study/${studyId}`, {
  264. statusCode: 200,
  265. body: {
  266. code: "0x000000",
  267. description: "成功",
  268. solution: "",
  269. data: {
  270. "@type": "type.googleapis.com/dr.study.Study",
  271. study_instance_uid: "2.25.156.999999.0000.1.2.8323328.269954.1759135097.323784",
  272. study_id: studyId,
  273. public_study_id: "",
  274. specific_character_set: "ISO_IR 192",
  275. accession_number: "ACC0012345",
  276. ref_physician: "Dr. Smith (Vet)",
  277. patient_id: "PET007",
  278. patient_name: "Buddy (Dog)",
  279. patient_english_name: "Buddy en",
  280. patient_former_name: "Buddy f",
  281. patient_size: "Large",
  282. other_patient_ids: "",
  283. other_patient_names: "",
  284. patient_age: "008Y",
  285. patient_dob: "2025-06-10T03:12:36.181739Z",
  286. patient_sex: "M",
  287. sex_neutered: "",
  288. pregnancy_status: "",
  289. patient_state: "",
  290. admitting_time: null,
  291. priority: "",
  292. reg_source: "",
  293. study_description: "",
  294. study_start_datetime: "2025-09-29T08:38:17.283651Z",
  295. study_end_datetime: null,
  296. scheduled_procedure_step_start_date: null,
  297. performed_physician: "",
  298. study_lock: "Unlocked",
  299. folder_path: "",
  300. operator_name: "OP987",
  301. modality: "DX",
  302. weight: 25,
  303. thickness: 15,
  304. length: 60,
  305. patient_type: "Human",
  306. study_type: "Normal",
  307. owner_name: "owner1",
  308. chip_number: "CHIP123456789",
  309. variety: "Golden Retriever",
  310. is_anaesthesia: true,
  311. is_sedation: true,
  312. mwl: "",
  313. is_exported: false,
  314. is_edited: false,
  315. is_appended: false,
  316. department: "",
  317. mapped_status: false,
  318. qc_result: false,
  319. comment: "已曝光测试数据",
  320. study_status: "Completed",
  321. sort: 0,
  322. product: "DROS",
  323. create_time: "2025-09-29T08:38:17.353598Z",
  324. series: [
  325. {
  326. series_instance_uid: "2.25.156.999999.0000.1.3.8323328.269954.1759135097.323785",
  327. study_instance_uid: "2.25.156.999999.0000.1.2.8323328.269954.1759135097.323784",
  328. study_id: studyId,
  329. procedure_id: "P0-0002",
  330. patient_type: "Human",
  331. body_part: "Human_SKULL",
  332. performed_datetime: "2025-09-29T09:00:00.000000Z",
  333. performed_protocol_code_meaning: "颅骨前后位 + 侧位",
  334. performed_protocol_code_value: "P0-0002",
  335. sort: 1,
  336. product: "DROS",
  337. is_pre_install: true,
  338. create_time: "2025-09-29T08:38:17.359308Z",
  339. images: [
  340. {
  341. sop_instance_uid: "2.25.156.999999.0000.1.4.8323328.269954.1759135097.323786",
  342. series_instance_uid: "2.25.156.999999.0000.1.3.8323328.269954.1759135097.323785",
  343. study_instance_uid: "2.25.156.999999.0000.1.2.8323328.269954.1759135097.323784",
  344. secondary_sop_uid: "",
  345. study_id: studyId,
  346. view_id: "View_DX_T_A_SK_AP_00",
  347. view_description: "颅骨前后位",
  348. patient_type: "Human",
  349. body_part_id: "Human_SKULL",
  350. anatomic_region: "Skull",
  351. image_type: "expose",
  352. image_file_path: "/path/to/image1.dcm",
  353. image_file: "/path/to/image1.dcm",
  354. thumbnail_file: "/path/to/image1_thumb.jpg",
  355. acquisition_mode: "RAD",
  356. acquisition_context: null,
  357. img_proc_context: null,
  358. comment: "",
  359. expose_status: "Exposed",
  360. expose_time: "2025-09-29T09:00:00.000000Z",
  361. judged_status: "NotJudged",
  362. send_status: "Unsent",
  363. export_status: "NotExported",
  364. storage_status: "Saved",
  365. ticket: "",
  366. sort: 1,
  367. product: "DROS",
  368. is_pre_install: true,
  369. create_time: "2025-09-29T08:38:17.361002Z"
  370. },
  371. {
  372. sop_instance_uid: "2.25.156.999999.0000.1.4.8323328.269954.1759135097.323787",
  373. series_instance_uid: "2.25.156.999999.0000.1.3.8323328.269954.1759135097.323785",
  374. study_instance_uid: "2.25.156.999999.0000.1.2.8323328.269954.1759135097.323784",
  375. secondary_sop_uid: "",
  376. study_id: studyId,
  377. view_id: "View_DX_T_A_SK_LAT_00",
  378. view_description: "颅骨左侧位",
  379. patient_type: "Human",
  380. body_part_id: "Human_SKULL",
  381. anatomic_region: "Skull",
  382. image_type: "expose",
  383. image_file_path: "/path/to/image2.dcm",
  384. image_file: "/path/to/image2.dcm",
  385. thumbnail_file: "/path/to/image2_thumb.jpg",
  386. acquisition_mode: "RAD",
  387. acquisition_context: null,
  388. img_proc_context: null,
  389. comment: "",
  390. expose_status: "Exposed",
  391. expose_time: "2025-09-29T09:00:30.000000Z",
  392. judged_status: "NotJudged",
  393. send_status: "Unsent",
  394. export_status: "NotExported",
  395. storage_status: "Saved",
  396. ticket: "",
  397. sort: 2,
  398. product: "DROS",
  399. is_pre_install: true,
  400. create_time: "2025-09-29T08:38:17.362195Z"
  401. }
  402. ]
  403. }
  404. ]
  405. }
  406. }
  407. }).as('getStudyDetailsExposed');
  408. }
  409. /**
  410. * 获取检查信息 - 完整详情(通用,保持向后兼容)
  411. *
  412. * @description 根据study_id获取完整的检查详细信息,包含series和images
  413. * @method GET
  414. * @url /dr/api/v1/auth/study/{id}
  415. * @access 需要认证
  416. *
  417. * @param {string} id - 检查ID(study_id),路径参数
  418. *
  419. * @returns {Object} data - 完整的检查详细信息,包含series和images
  420. *
  421. * @example
  422. * mockGetStudyDetails();
  423. * cy.wait('@getStudyDetails');
  424. *
  425. * @see docs/DR.md - 章节19
  426. */
  427. export function mockGetStudyDetails(studyId:string) {
  428. cy.intercept('GET', `/dr/api/v1/auth/study/${studyId}`, {
  429. statusCode: 200,
  430. body: {
  431. code: "0x000000",
  432. description: "成功",
  433. solution: "",
  434. data: {
  435. "@type": "type.googleapis.com/dr.study.Study",
  436. study_instance_uid: "2.25.156.999999.0000.1.2.8323328.269954.1759135097.323784",
  437. study_id: studyId,
  438. public_study_id: "",
  439. specific_character_set: "ISO_IR 192",
  440. accession_number: "ACC0012345",
  441. ref_physician: "Dr. Smith (Vet)",
  442. patient_id: "PET007",
  443. patient_name: "Buddy (Dog)",
  444. patient_english_name: "Buddy en",
  445. patient_former_name: "Buddy f",
  446. patient_size: "Large",
  447. other_patient_ids: "",
  448. other_patient_names: "",
  449. patient_age: "008Y",
  450. patient_dob: "2025-06-10T03:12:36.181739Z",
  451. patient_sex: "M",
  452. sex_neutered: "",
  453. pregnancy_status: "",
  454. patient_state: "",
  455. admitting_time: null,
  456. priority: "",
  457. reg_source: "",
  458. study_description: "",
  459. study_start_datetime: "2025-09-29T08:38:17.283651Z",
  460. study_end_datetime: null,
  461. scheduled_procedure_step_start_date: null,
  462. performed_physician: "",
  463. study_lock: "Unlocked",
  464. folder_path: "",
  465. operator_name: "OP987",
  466. modality: "DX",
  467. weight: 25,
  468. thickness: 15,
  469. length: 60,
  470. patient_type: "Human",
  471. study_type: "Normal",
  472. owner_name: "owner1",
  473. chip_number: "CHIP123456789",
  474. variety: "Golden Retriever",
  475. is_anaesthesia: true,
  476. is_sedation: true,
  477. mwl: "",
  478. is_exported: false,
  479. is_edited: false,
  480. is_appended: false,
  481. department: "",
  482. mapped_status: false,
  483. qc_result: false,
  484. comment: "一二三四五六七八九十",
  485. study_status: "Arrived",
  486. sort: 0,
  487. product: "DROS",
  488. create_time: "2025-09-29T08:38:17.353598Z",
  489. series: [
  490. {
  491. series_instance_uid: "2.25.156.999999.0000.1.3.8323328.269954.1759135097.323785",
  492. study_instance_uid: "2.25.156.999999.0000.1.2.8323328.269954.1759135097.323784",
  493. study_id: studyId,
  494. procedure_id: "P0-0002",
  495. patient_type: "Human",
  496. body_part: "Human_SKULL",
  497. performed_datetime: null,
  498. performed_protocol_code_meaning: "颅骨前后位 + 侧位",
  499. performed_protocol_code_value: "P0-0002",
  500. sort: 1,
  501. product: "DROS",
  502. is_pre_install: true,
  503. create_time: "2025-09-29T08:38:17.359308Z",
  504. images: [
  505. {
  506. sop_instance_uid: "2.25.156.999999.0000.1.4.8323328.269954.1759135097.323786",
  507. series_instance_uid: "2.25.156.999999.0000.1.3.8323328.269954.1759135097.323785",
  508. study_instance_uid: "2.25.156.999999.0000.1.2.8323328.269954.1759135097.323784",
  509. secondary_sop_uid: "",
  510. study_id: studyId,
  511. view_id: "View_DX_T_A_SK_AP_00",
  512. view_description: "颅骨前后位",
  513. patient_type: "Human",
  514. body_part_id: "Human_SKULL",
  515. anatomic_region: "Skull",
  516. image_type: "expose",
  517. image_file_path: "",
  518. image_file: "",
  519. thumbnail_file: "",
  520. acquisition_mode: "RAD",
  521. acquisition_context: null,
  522. img_proc_context: null,
  523. comment: "",
  524. expose_status: "Unexposed",
  525. expose_time: null,
  526. judged_status: "NotJudged",
  527. send_status: "Unsent",
  528. export_status: "NotExported",
  529. storage_status: "NotSaved",
  530. ticket: "",
  531. sort: 1,
  532. product: "DROS",
  533. is_pre_install: true,
  534. create_time: "2025-09-29T08:38:17.361002Z"
  535. },
  536. {
  537. sop_instance_uid: "2.25.156.999999.0000.1.4.8323328.269954.1759135097.323787",
  538. series_instance_uid: "2.25.156.999999.0000.1.3.8323328.269954.1759135097.323785",
  539. study_instance_uid: "2.25.156.999999.0000.1.2.8323328.269954.1759135097.323784",
  540. secondary_sop_uid: "",
  541. study_id: studyId,
  542. view_id: "View_DX_T_A_SK_LAT_00",
  543. view_description: "颅骨左侧位",
  544. patient_type: "Human",
  545. body_part_id: "Human_SKULL",
  546. anatomic_region: "Skull",
  547. image_type: "expose",
  548. image_file_path: "",
  549. image_file: "",
  550. thumbnail_file: "",
  551. acquisition_mode: "RAD",
  552. acquisition_context: null,
  553. img_proc_context: null,
  554. comment: "",
  555. expose_status: "Unexposed",
  556. expose_time: null,
  557. judged_status: "NotJudged",
  558. send_status: "Unsent",
  559. export_status: "NotExported",
  560. storage_status: "NotSaved",
  561. ticket: "",
  562. sort: 2,
  563. product: "DROS",
  564. is_pre_install: true,
  565. create_time: "2025-09-29T08:38:17.362195Z"
  566. }
  567. ]
  568. }
  569. ]
  570. }
  571. }
  572. }).as('getStudyDetails');
  573. }
  574. /**
  575. * 获取检查信息状态 - 成功场景
  576. *
  577. * @description 获取检查的统计信息(总数、已曝光数)
  578. * @method GET
  579. * @url /dr/api/v1/auth/study/{id}/stat
  580. * @access 需要认证
  581. *
  582. * @param {string} id - 检查ID(study_id),路径参数
  583. *
  584. * @returns {Object} data - 统计信息
  585. * @returns {number} data.total - 总体位数
  586. * @returns {number} data.exposed - 已曝光数
  587. *
  588. * @example
  589. * mockGetStudyStatSuccess();
  590. * cy.wait('@getStudyStatSuccess');
  591. *
  592. * @see docs/DR.md - 章节17
  593. */
  594. export function mockGetStudyStatSuccess() {
  595. cy.intercept('GET', '/dr/api/v1/auth/study/*/stat', {
  596. statusCode: 200,
  597. body: {
  598. code: "0x000000",
  599. description: "Success",
  600. solution: "",
  601. data: {
  602. "@type": "type.googleapis.com/dr.study.Stat",
  603. total: 3,
  604. exposed: 1
  605. }
  606. }
  607. }).as('getStudyStatSuccess');
  608. }
  609. /**
  610. * 变更登记信息 - 成功场景
  611. *
  612. * @description 更新已登记的检查信息
  613. * @method PUT
  614. * @url /dr/api/v1/auth/study/{id}
  615. * @access 需要认证
  616. *
  617. * @param {string} id - 检查ID(study_id),路径参数
  618. * @param {Object} requestBody - 更新的患者信息
  619. *
  620. * @returns {Object} data - 更新后的检查信息
  621. *
  622. * @example
  623. * mockUpdateStudySuccess();
  624. * cy.wait('@updateStudySuccess');
  625. *
  626. * @see docs/DR.md - 章节14
  627. */
  628. export function mockUpdateStudySuccess() {
  629. cy.intercept('PUT', '/dr/api/v1/auth/study/*', {
  630. statusCode: 200,
  631. body: {
  632. code: "0x000000",
  633. description: "Success",
  634. solution: "",
  635. data: {
  636. study_id: "20250625140057649",
  637. patient_name: "Updated Patient",
  638. study_status: "Arrived"
  639. }
  640. }
  641. }).as('updateStudySuccess');
  642. }
  643. /**
  644. * 删除检查信息(批量)- 成功场景
  645. *
  646. * @description 批量删除检查信息
  647. * @method DELETE
  648. * @url /dr/api/v1/auth/study
  649. * @access 需要认证
  650. *
  651. * @param {string[]} requestBody - 检查ID列表
  652. *
  653. * @returns {Object} 成功响应
  654. *
  655. * @example
  656. * mockDeleteStudyBatchSuccess();
  657. * cy.wait('@deleteStudyBatchSuccess');
  658. *
  659. * @see docs/DR.md - 章节18
  660. */
  661. export function mockDeleteStudyBatchSuccess() {
  662. cy.intercept('DELETE', '/dr/api/v1/auth/study', {
  663. statusCode: 200,
  664. body: {
  665. code: "0x000000",
  666. description: "Success",
  667. solution: "",
  668. data: {}
  669. }
  670. }).as('deleteStudyBatchSuccess');
  671. }
  672. /**
  673. * 存储急诊患者影像 - 成功场景
  674. *
  675. * @description 存储拍摄的急诊患者影像
  676. * @method POST
  677. * @url /api/v1/auth/study/portrait
  678. * @access 需要认证
  679. *
  680. * @param {Object} formData - 表单数据
  681. * @param {string} formData.instance_uid - study实例UID
  682. * @param {File} formData.data - PNG图片文件
  683. *
  684. * @returns {Object} data - DCM文件路径
  685. * @returns {string} data.path - 文件路径
  686. *
  687. * @example
  688. * mockStorePortraitSuccess();
  689. * cy.wait('@storePortraitSuccess');
  690. *
  691. * @see docs/DR.md - 章节19
  692. */
  693. export function mockStorePortraitSuccess() {
  694. cy.intercept('POST', '/api/v1/auth/study/portrait', {
  695. statusCode: 200,
  696. body: {
  697. code: "0x000000",
  698. description: "Success",
  699. solution: "",
  700. data: {
  701. "@type": "type.googleapis.com/dr.task.DcmPath",
  702. path: "1.2.276.0.1000000.5.1.5.701601461.33458.1750830395.482043.dcm"
  703. }
  704. }
  705. }).as('storePortraitSuccess');
  706. }
  707. /**
  708. * 挂起检查 - 成功场景
  709. *
  710. * @description 挂起当前检查(状态设为InProgress)
  711. * @method POST
  712. * @url /api/v1/auth/task/inspection/leave
  713. * @access 需要认证
  714. *
  715. * @param {Object} requestBody - 请求体
  716. * @param {string} requestBody.study_id - 检查ID
  717. * @param {string} requestBody.study_status - 检查状态(InProgress)
  718. *
  719. * @returns {Object} 成功响应
  720. *
  721. * @example
  722. * mockLeaveStudyInProgress();
  723. * cy.wait('@leaveStudyInProgress');
  724. *
  725. * @see docs/DR.md - 章节35
  726. */
  727. export function mockLeaveStudyInProgress() {
  728. cy.intercept('POST', '/api/v1/auth/task/inspection/leave', (req) => {
  729. if (req.body.study_status === 'InProgress') {
  730. req.reply({
  731. statusCode: 200,
  732. body: {
  733. code: "0x000000",
  734. description: "Success",
  735. solution: "",
  736. data: {}
  737. }
  738. });
  739. }
  740. }).as('leaveStudyInProgress');
  741. }
  742. /**
  743. * 完成检查 - 成功场景
  744. *
  745. * @description 完成当前检查(状态设为Completed)
  746. * @method POST
  747. * @url /api/v1/auth/task/inspection/leave
  748. * @access 需要认证
  749. *
  750. * @param {Object} requestBody - 请求体
  751. * @param {string} requestBody.study_id - 检查ID
  752. * @param {string} requestBody.study_status - 检查状态(Completed)
  753. *
  754. * @returns {Object} 成功响应
  755. *
  756. * @example
  757. * mockLeaveStudyCompleted();
  758. * cy.wait('@leaveStudyCompleted');
  759. *
  760. * @see docs/DR.md - 章节35
  761. */
  762. export function mockLeaveStudyCompleted() {
  763. cy.intercept('POST', '/api/v1/auth/task/inspection/leave', (req) => {
  764. if (req.body.study_status === 'Completed') {
  765. req.reply({
  766. statusCode: 200,
  767. body: {
  768. code: "0x000000",
  769. description: "Success",
  770. solution: "",
  771. data: {}
  772. }
  773. });
  774. }
  775. }).as('leaveStudyCompleted');
  776. }