protocol.ts 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. /**
  2. * Protocol Mock Handlers
  3. * 协议相关的 mock 处理器
  4. */
  5. /**
  6. * 获取患者类型列表 - Human类型
  7. *
  8. * @description 获取启用的人医患者类型列表
  9. * @method GET
  10. * @url /dr/api/v1/auth/protocol/patient_type
  11. * @access 需要认证
  12. *
  13. * @param {boolean} [is_enabled] - 是否只返回启用的类型
  14. *
  15. * @returns {Object[]} data.patient_type_list - 患者类型列表
  16. * @returns {string} data.patient_type_list[].patient_type_id - 患者类型ID
  17. * @returns {string} data.patient_type_list[].patient_type_name - 患者类型名称
  18. * @returns {boolean} data.patient_type_list[].is_enabled - 是否启用
  19. * @returns {string} data.patient_type_list[].product - 产品类型(DROS/VETDROS)
  20. *
  21. * @example
  22. * mockGetPatientTypeHuman();
  23. * cy.wait('@getPatientTypeHuman');
  24. *
  25. * @see docs/DR.md - 章节12.1
  26. */
  27. export function mockGetPatientTypeHuman() {
  28. cy.intercept('GET', '/dr/api/v1/auth/protocol/patient_type*', {
  29. statusCode: 200,
  30. body: {
  31. code: "0x000000",
  32. description: "Success",
  33. solution: "",
  34. data: {
  35. patient_type_list: [
  36. {
  37. id: "1",
  38. patient_type_id: "Human",
  39. patient_type_name: "Human",
  40. patient_type_local: "Human",
  41. patient_type_description: "Human",
  42. sort: 1,
  43. is_enabled: true,
  44. product: "DROS",
  45. is_pre_install: true
  46. }
  47. ]
  48. }
  49. }
  50. }).as('getPatientTypeHuman');
  51. }
  52. /**
  53. * 获取患者类型列表 - 所有类型
  54. *
  55. * @description 获取所有患者类型列表(包括禁用的)
  56. * @method GET
  57. * @url /dr/api/v1/auth/protocol/patient_type
  58. * @access 需要认证
  59. *
  60. * @returns {Object[]} data.patient_type_list - 患者类型列表
  61. *
  62. * @example
  63. * mockGetPatientTypeAll();
  64. * cy.wait('@getPatientTypeAll');
  65. *
  66. * @see docs/DR.md - 章节12.1
  67. */
  68. export function mockGetPatientTypeAll() {
  69. cy.intercept('GET', '/dr/api/v1/auth/protocol/patient_type*', {
  70. statusCode: 200,
  71. body: {
  72. code: "0x000000",
  73. description: "Success",
  74. solution: "",
  75. data: {
  76. patient_type_list: [
  77. {
  78. id: "1",
  79. patient_type_id: "Human",
  80. patient_type_name: "Human",
  81. patient_type_local: "Human",
  82. patient_type_description: "Human",
  83. sort: 1,
  84. is_enabled: true,
  85. product: "DROS",
  86. is_pre_install: true
  87. },
  88. {
  89. id: "2",
  90. patient_type_id: "SpecialType",
  91. patient_type_name: "SpecialType",
  92. patient_type_local: "SpecialType",
  93. patient_type_description: "SpecialType",
  94. sort: 2,
  95. is_enabled: false,
  96. product: "DROS",
  97. is_pre_install: true
  98. }
  99. ]
  100. }
  101. }
  102. }).as('getPatientTypeAll');
  103. }
  104. /**
  105. * 获取身体部位列表 - Human
  106. *
  107. * @description 根据患者类型获取支持的身体部位(人医)
  108. * @method GET
  109. * @url /dr/api/v1/auth/protocol/body_part
  110. * @access 需要认证
  111. *
  112. * @param {string} patient_type - 患者类型
  113. * @param {string} modality - 模式(DX)
  114. * @param {boolean} [is_enabled] - 是否只返回启用的
  115. *
  116. * @returns {Object[]} data.body_part_list - 身体部位列表
  117. * @returns {string} data.body_part_list[].body_part_id - 身体部位ID
  118. * @returns {string} data.body_part_list[].body_part_name - 身体部位名称
  119. *
  120. * @example
  121. * mockGetBodyPartHuman();
  122. * cy.wait('@getBodyPartHuman');
  123. *
  124. * @see docs/DR.md - 章节12.2
  125. */
  126. export function mockGetBodyPartHuman() {
  127. cy.intercept('GET', '/dr/api/v1/auth/protocol/body_part*', {
  128. statusCode: 200,
  129. body: {
  130. code: "0x000000",
  131. description: "Success",
  132. solution: "",
  133. data: {
  134. body_part_list: [
  135. {
  136. id: "1",
  137. body_part_id: "Human_SKULL",
  138. body_part_name: "颅骨",
  139. body_part_local: "颅骨",
  140. body_part_description: "Skull",
  141. patient_type: "Human",
  142. category: "DX",
  143. sort: 1,
  144. is_enabled: true,
  145. product: "DROS",
  146. is_pre_install: true
  147. },
  148. {
  149. id: "2",
  150. body_part_id: "Human_NECK",
  151. body_part_name: "颈部",
  152. body_part_local: "颈部",
  153. body_part_description: "Neck",
  154. patient_type: "Human",
  155. category: "DX",
  156. sort: 2,
  157. is_enabled: true,
  158. product: "DROS",
  159. is_pre_install: true
  160. }
  161. ]
  162. }
  163. }
  164. }).as('getBodyPartHuman');
  165. }
  166. /**
  167. * 获取协议列表 - 成功场景
  168. *
  169. * @description 根据身体部位获取协议列表
  170. * @method GET
  171. * @url /dr/api/v1/auth/protocol/procedure
  172. * @access 需要认证
  173. *
  174. * @param {string} patient_type - 患者类型
  175. * @param {string} body_part - 身体部位
  176. * @param {string} [procedure_type] - 协议类型(NORMAL/EMERGENCY)
  177. * @param {boolean} [is_enabled] - 是否只返回启用的
  178. * @param {number} [page] - 页码
  179. * @param {number} [page_size] - 每页数量
  180. *
  181. * @returns {Object} data - 协议列表数据
  182. * @returns {number} data.count - 总数
  183. * @returns {Object[]} data.procedures - 协议列表
  184. *
  185. * @example
  186. * mockGetProcedureListSuccess();
  187. * cy.wait('@getProcedureListSuccess');
  188. *
  189. * @see docs/DR.md - 章节12.3
  190. */
  191. export function mockGetProcedureListSuccess() {
  192. cy.intercept('GET', '/dr/api/v1/auth/protocol/procedure*', {
  193. statusCode: 200,
  194. body: {
  195. code: "0x000000",
  196. description: "Success",
  197. solution: "",
  198. data: {
  199. "@type": "type.googleapis.com/dr.protocol.ProcedureList",
  200. count: 4,
  201. procedures: [
  202. {
  203. id: "2",
  204. procedure_id: "P0-0002",
  205. procedure_code: "P0-0002",
  206. procedure_name: "颅骨前后位 + 侧位",
  207. procedure_name_local: "颅骨前后位 + 侧位",
  208. procedure_other_name: "Skull AP + LAT",
  209. procedure_description: "颅骨前后位 + 侧位",
  210. procedure_description_local: "颅骨前后位 + 侧位",
  211. patient_type: "Human",
  212. body_part_id: "Human_SKULL",
  213. procedure_type: "NORMAL",
  214. fast_search: false,
  215. protocol_laterality: "U",
  216. procedure_category: "Adult",
  217. modality: "DX",
  218. sort: 1,
  219. is_enabled: true,
  220. product: "DROS",
  221. is_pre_install: true
  222. },
  223. {
  224. id: "3",
  225. procedure_id: "P0-0003",
  226. procedure_code: "P0-0003",
  227. procedure_name: "颅骨后前位 + 侧位",
  228. procedure_name_local: "颅骨后前位 + 侧位",
  229. procedure_other_name: "Skull PA + LAT",
  230. procedure_description: "颅骨后前位 + 侧位",
  231. procedure_description_local: "颅骨后前位 + 侧位",
  232. patient_type: "Human",
  233. body_part_id: "Human_SKULL",
  234. procedure_type: "NORMAL",
  235. fast_search: false,
  236. protocol_laterality: "U",
  237. procedure_category: "Adult",
  238. modality: "DX",
  239. sort: 1,
  240. is_enabled: true,
  241. product: "DROS",
  242. is_pre_install: true
  243. }
  244. ]
  245. }
  246. }
  247. }).as('getProcedureListSuccess');
  248. }
  249. /**
  250. * 获取体位列表 - 成功场景
  251. *
  252. * @description 获取体位列表
  253. * @method GET
  254. * @url /dr/api/v1/auth/protocol/view
  255. * @access 需要认证
  256. *
  257. * @param {string} patient_type - 患者类型
  258. * @param {string} body_part - 身体部位
  259. * @param {boolean} [is_enabled] - 是否只返回启用的
  260. * @param {number} [page] - 页码
  261. * @param {number} [page_size] - 每页数量
  262. *
  263. * @returns {Object} data - 体位列表数据
  264. * @returns {number} data.count - 总数
  265. * @returns {Object[]} data.views - 体位列表
  266. *
  267. * @example
  268. * mockGetViewListSuccess();
  269. * cy.wait('@getViewListSuccess');
  270. *
  271. * @see docs/DR.md - 章节12.4
  272. */
  273. export function mockGetViewListSuccess() {
  274. cy.intercept('GET', '/dr/api/v1/auth/protocol/view*', {
  275. statusCode: 200,
  276. body: {
  277. code: "0x000000",
  278. description: "Success",
  279. solution: "",
  280. data: {
  281. "@type": "type.googleapis.com/dr.protocol.ViewList",
  282. count: 2,
  283. views: [
  284. {
  285. internal_id: "View_DX_T_A_SK_AP_00",
  286. view_id: "View_DX_T_A_SK_AP_00",
  287. view_name: "颅骨前后位",
  288. view_name_local: "",
  289. view_other_name: "Skull AP",
  290. view_description: "颅骨前后位",
  291. view_position: "AP",
  292. application: "RAD",
  293. anatomic_region: "SKULL",
  294. patient_type: "Human",
  295. body_part_id: "Human_SKULL",
  296. view_icon_name: "/Image/Position/Human/skull.ap.table.x.png",
  297. modality: "DX",
  298. work_station_id: 0,
  299. apr_id: "View_DX_T_A_SK_AP_00",
  300. img_proc_id: "View_DX_T_A_SK_AP_00",
  301. sort: 1,
  302. is_enabled: true,
  303. product: "DROS",
  304. is_pre_install: true
  305. }
  306. ]
  307. }
  308. }
  309. }).as('getViewListSuccess');
  310. }
  311. /**
  312. * 获取体位详情 - 成功场景
  313. *
  314. * @description 根据ID获取体位详情
  315. * @method GET
  316. * @url /dr/api/v1/auth/protocol/view/{id}
  317. * @access 需要认证
  318. *
  319. * @param {string} id - 体位ID(路径参数)
  320. *
  321. * @returns {Object} data - 体位详情
  322. *
  323. * @example
  324. * mockGetViewDetailSuccess();
  325. * cy.wait('@getViewDetailSuccess');
  326. *
  327. * @see docs/DR.md - 章节12.6
  328. */
  329. export function mockGetViewDetailSuccess() {
  330. cy.intercept('GET', '/dr/api/v1/auth/protocol/view/*', {
  331. statusCode: 200,
  332. body: {
  333. code: "0x000000",
  334. description: "Success",
  335. solution: "",
  336. data: {
  337. "@type": "type.googleapis.com/dr.protocol.View",
  338. internal_id: "View_DX_T_A_SK_AP_00",
  339. view_id: "View_DX_T_A_SK_AP_00",
  340. view_name: "颅骨前后位",
  341. view_description: "颅骨前后位",
  342. patient_type: "Human",
  343. body_part_id: "Human_SKULL",
  344. modality: "DX",
  345. sort: 1,
  346. is_enabled: true,
  347. product: "DROS",
  348. is_pre_install: true
  349. }
  350. }
  351. }).as('getViewDetailSuccess');
  352. }
  353. /**
  354. * 获取APR详情(通过view_id)- 成功场景
  355. *
  356. * @description 根据体位ID获取APR详情
  357. * @method GET
  358. * @url /dr/api/v1/auth/protocol/view/{id}/apr
  359. * @access 需要认证
  360. *
  361. * @param {string} id - 体位ID(路径参数)
  362. *
  363. * @returns {Object} data - APR详情
  364. * @returns {Object[]} data.exposures - 曝光参数列表
  365. *
  366. * @example
  367. * mockGetAprByViewSuccess();
  368. * cy.wait('@getAprByViewSuccess');
  369. *
  370. * @see docs/DR.md - 章节12.7
  371. */
  372. export function mockGetAprByViewSuccess() {
  373. cy.intercept('GET', '/dr/api/v1/auth/protocol/view/*/apr*', {
  374. statusCode: 200,
  375. body: {
  376. code: "0x000000",
  377. description: "Success",
  378. solution: "",
  379. data: {
  380. "@type": "type.googleapis.com/dr.protocol.AprReply",
  381. apr_id: "View_DX_T_A_SK_AP_00",
  382. apr_name: "View_DX_T_A_SK_AP_00",
  383. apr_description: "颅骨前后位",
  384. patient_type: "Human",
  385. body_part_id: "Human_SKULL",
  386. modality: "DX",
  387. exposures: [
  388. {
  389. work_station_id: 0,
  390. patient_size: "Medium",
  391. config_object: {
  392. Common: {
  393. kV: 70,
  394. mA: 125,
  395. ms: 100,
  396. mAs: 12.5
  397. }
  398. }
  399. }
  400. ],
  401. sort: 0,
  402. is_enabled: true,
  403. product: "DROS",
  404. is_pre_install: true
  405. }
  406. }
  407. }).as('getAprByViewSuccess');
  408. }
  409. /**
  410. * 获取APR设备信息 - 成功场景
  411. *
  412. * @description 根据APR ID获取设备参数信息
  413. * @method GET
  414. * @url /dr/api/v1/auth/protocol/apr/{id}/device
  415. * @access 需要认证
  416. *
  417. * @param {string} id - APR ID(路径参数)
  418. * @param {number} [work_station_id] - 工作位ID(0或1)
  419. *
  420. * @returns {Object} data - 设备参数
  421. *
  422. * @example
  423. * mockGetAprDeviceSuccess();
  424. * cy.wait('@getAprDeviceSuccess');
  425. *
  426. * @see docs/DR.md - 章节12.9
  427. */
  428. export function mockGetAprDeviceSuccess() {
  429. cy.intercept('GET', '/dr/api/v1/auth/protocol/apr/*/device*', {
  430. statusCode: 200,
  431. body: {
  432. code: "0x000000",
  433. description: "Success",
  434. solution: "",
  435. data: {
  436. "@type": "type.googleapis.com/dr.protocol.AprDevice",
  437. work_station_id: 1,
  438. config_object: {
  439. Common: {
  440. APRNumber: "5",
  441. SID: 115,
  442. GridType: 2
  443. }
  444. }
  445. }
  446. }
  447. }).as('getAprDeviceSuccess');
  448. }
  449. /**
  450. * 获取APR默认曝光参数 - 成功场景
  451. *
  452. * @description 根据APR ID获取默认曝光技术参数
  453. * @method GET
  454. * @url /dr/api/v1/auth/protocol/apr/{id}/tech
  455. * @access 需要认证
  456. *
  457. * @param {string} id - APR ID(路径参数)
  458. * @param {number} [work_station_id] - 工作位ID
  459. * @param {string} [patient_size] - 患者体型(Large/Medium/Small)
  460. *
  461. * @returns {Object} data - 技术参数
  462. * @returns {Object} data.dp - 设备参数
  463. * @returns {Object} data.ep - 曝光参数
  464. *
  465. * @example
  466. * mockGetAprTechParamsSuccess();
  467. * cy.wait('@getAprTechParamsSuccess');
  468. *
  469. * @see docs/DR.md - 章节12.10
  470. */
  471. export function mockGetAprTechParamsSuccess() {
  472. cy.intercept('GET', '/dr/api/v1/auth/protocol/apr/*/tech*', {
  473. statusCode: 200,
  474. body: {
  475. code: "0x000000",
  476. description: "Success",
  477. solution: "",
  478. data: {
  479. "@type": "type.googleapis.com/dr.protocol.TechParam",
  480. dp: {
  481. SID: 115,
  482. GridType: 2,
  483. GridSpeed: 0
  484. },
  485. ep: {
  486. kV: 70,
  487. mA: 125,
  488. ms: 100,
  489. mAs: 12.5
  490. }
  491. }
  492. }
  493. }).as('getAprTechParamsSuccess');
  494. }