patientRegistration.ts 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. /**
  2. * Patient Registration Mock Handlers
  3. * 患者注册相关的 mock 处理器
  4. */
  5. /**
  6. * 获取患者类型列表 - 包含多个类型
  7. *
  8. * @description 用于测试切换患者类型的场景
  9. * @method GET
  10. * @url /dr/api/v1/auth/protocol/patient_type
  11. * @access 需要认证
  12. *
  13. * @returns {Object[]} data.patient_type_list - 患者类型列表
  14. *
  15. * @example
  16. * mockGetMultiplePatientTypes();
  17. * cy.wait('@getMultiplePatientTypes');
  18. */
  19. export function mockGetMultiplePatientTypes() {
  20. cy.intercept('GET', '/dr/api/v1/auth/protocol/patient_type*', {
  21. statusCode: 200,
  22. body: {
  23. code: "0x000000",
  24. description: "Success",
  25. solution: "",
  26. data: {
  27. patient_type_list: [
  28. {
  29. id: "1",
  30. patient_type_id: "Human",
  31. patient_type_name: "Human",
  32. patient_type_local: "Human",
  33. patient_type_description: "Human Patient Type",
  34. sort: 1,
  35. is_enabled: true,
  36. product: "DROS",
  37. is_pre_install: true
  38. },
  39. {
  40. id: "2",
  41. patient_type_id: "SpecialType",
  42. patient_type_name: "SpecialType",
  43. patient_type_local: "特殊类型",
  44. patient_type_description: "Special Patient Type",
  45. sort: 2,
  46. is_enabled: true,
  47. product: "DROS",
  48. is_pre_install: true
  49. }
  50. ]
  51. }
  52. }
  53. }).as('getMultiplePatientTypes');
  54. }
  55. /**
  56. * 获取身体部位列表 - Human患者类型
  57. *
  58. * @description 根据患者类型获取身体部位列表
  59. * @method GET
  60. * @url /dr/api/v1/auth/protocol/body_part
  61. *
  62. * @returns {Object[]} data.body_part_list - 身体部位列表
  63. *
  64. * @example
  65. * mockGetBodyPartForHuman();
  66. * cy.wait('@getBodyPartForHuman');
  67. */
  68. export function mockGetBodyPartForHuman() {
  69. cy.intercept('GET', '/dr/api/v1/auth/protocol/body_part*patient_type=Human*', {
  70. statusCode: 200,
  71. body: {
  72. code: "0x000000",
  73. description: "Success",
  74. solution: "",
  75. data: {
  76. body_part_list: [
  77. {
  78. id: "1",
  79. body_part_id: "Human_SKULL",
  80. body_part_name: "颅骨",
  81. body_part_local: "颅骨",
  82. body_part_description: "Skull",
  83. patient_type: "Human",
  84. category: "DX",
  85. sort: 1,
  86. is_enabled: true,
  87. product: "DROS",
  88. is_pre_install: true
  89. },
  90. {
  91. id: "2",
  92. body_part_id: "Human_NECK",
  93. body_part_name: "颈部",
  94. body_part_local: "颈部",
  95. body_part_description: "Neck",
  96. patient_type: "Human",
  97. category: "DX",
  98. sort: 2,
  99. is_enabled: true,
  100. product: "DROS",
  101. is_pre_install: true
  102. }
  103. ]
  104. }
  105. }
  106. }).as('getBodyPartForHuman');
  107. }
  108. /**
  109. * 获取身体部位列表 - SpecialType患者类型
  110. *
  111. * @description 根据患者类型获取身体部位列表
  112. * @method GET
  113. * @url /dr/api/v1/auth/protocol/body_part
  114. *
  115. * @returns {Object[]} data.body_part_list - 身体部位列表
  116. *
  117. * @example
  118. * mockGetBodyPartForSpecialType();
  119. * cy.wait('@getBodyPartForSpecialType');
  120. */
  121. export function mockGetBodyPartForSpecialType() {
  122. cy.intercept('GET', '/dr/api/v1/auth/protocol/body_part*patient_type=SpecialType*', {
  123. statusCode: 200,
  124. body: {
  125. code: "0x000000",
  126. description: "Success",
  127. solution: "",
  128. data: {
  129. body_part_list: [
  130. {
  131. id: "3",
  132. body_part_id: "Special_HEAD",
  133. body_part_name: "头部",
  134. body_part_local: "头部",
  135. body_part_description: "Head",
  136. patient_type: "SpecialType",
  137. category: "DX",
  138. sort: 1,
  139. is_enabled: true,
  140. product: "DROS",
  141. is_pre_install: true
  142. }
  143. ]
  144. }
  145. }
  146. }).as('getBodyPartForSpecialType');
  147. }
  148. /**
  149. * 获取体位列表 - Human/颅骨
  150. *
  151. * @description 获取指定患者类型和身体部位的体位列表
  152. * @method GET
  153. * @url /dr/api/v1/auth/protocol/view
  154. *
  155. * @returns {Object[]} data.views - 体位列表
  156. *
  157. * @example
  158. * mockGetViewsForHumanSkull();
  159. * cy.wait('@getViewsForHumanSkull');
  160. */
  161. export function mockGetViewsForHumanSkull() {
  162. cy.intercept('GET', '/dr/api/v1/auth/protocol/view*patient_type=Human*body_part=Human_SKULL*', {
  163. statusCode: 200,
  164. body: {
  165. code: "0x000000",
  166. description: "Success",
  167. solution: "",
  168. data: {
  169. "@type": "type.googleapis.com/dr.protocol.ViewList",
  170. count: 2,
  171. views: [
  172. {
  173. internal_id: "View_DX_H_SKULL_AP",
  174. view_id: "View_DX_H_SKULL_AP",
  175. view_name: "颅骨前后位",
  176. view_name_local: "颅骨前后位",
  177. view_other_name: "Skull AP",
  178. view_description: "颅骨前后位",
  179. view_position: "AP",
  180. application: "RAD",
  181. anatomic_region: "SKULL",
  182. patient_type: "Human",
  183. body_part_id: "Human_SKULL",
  184. view_icon_name: "/Image/Position/Human/skull.ap.table.x.png",
  185. modality: "DX",
  186. work_station_id: 0,
  187. apr_id: "View_DX_H_SKULL_AP",
  188. img_proc_id: "View_DX_H_SKULL_AP",
  189. sort: 1,
  190. is_enabled: true,
  191. product: "DROS",
  192. is_pre_install: true
  193. },
  194. {
  195. internal_id: "View_DX_H_SKULL_LAT",
  196. view_id: "View_DX_H_SKULL_LAT",
  197. view_name: "颅骨侧位",
  198. view_name_local: "颅骨侧位",
  199. view_other_name: "Skull LAT",
  200. view_description: "颅骨侧位",
  201. view_position: "LAT",
  202. application: "RAD",
  203. anatomic_region: "SKULL",
  204. patient_type: "Human",
  205. body_part_id: "Human_SKULL",
  206. view_icon_name: "/Image/Position/Human/skull.lat.table.x.png",
  207. modality: "DX",
  208. work_station_id: 0,
  209. apr_id: "View_DX_H_SKULL_LAT",
  210. img_proc_id: "View_DX_H_SKULL_LAT",
  211. sort: 2,
  212. is_enabled: true,
  213. product: "DROS",
  214. is_pre_install: true
  215. }
  216. ]
  217. }
  218. }
  219. }).as('getViewsForHumanSkull');
  220. }
  221. /**
  222. * 获取协议列表 - Human/颅骨
  223. *
  224. * @description 获取指定患者类型和身体部位的协议列表
  225. * @method GET
  226. * @url /dr/api/v1/auth/protocol/procedure
  227. *
  228. * @returns {Object[]} data.procedures - 协议列表
  229. *
  230. * @example
  231. * mockGetProceduresForHumanSkull();
  232. * cy.wait('@getProceduresForHumanSkull');
  233. */
  234. export function mockGetProceduresForHumanSkull() {
  235. cy.intercept('GET', '/dr/api/v1/auth/protocol/procedure*patient_type=Human*body_part=Human_SKULL*', {
  236. statusCode: 200,
  237. body: {
  238. code: "0x000000",
  239. description: "Success",
  240. solution: "",
  241. data: {
  242. "@type": "type.googleapis.com/dr.protocol.ProcedureList",
  243. count: 1,
  244. procedures: [
  245. {
  246. id: "1",
  247. procedure_id: "P_SKULL_AP_LAT",
  248. procedure_code: "P_SKULL_AP_LAT",
  249. procedure_name: "颅骨前后位+侧位",
  250. procedure_name_local: "颅骨前后位+侧位",
  251. procedure_other_name: "Skull AP + LAT",
  252. procedure_description: "颅骨前后位+侧位",
  253. procedure_description_local: "颅骨前后位+侧位",
  254. patient_type: "Human",
  255. body_part_id: "Human_SKULL",
  256. procedure_type: "NORMAL",
  257. fast_search: false,
  258. protocol_laterality: "U",
  259. procedure_category: "Adult",
  260. modality: "DX",
  261. sort: 1,
  262. is_enabled: true,
  263. product: "DROS",
  264. is_pre_install: true
  265. }
  266. ]
  267. }
  268. }
  269. }).as('getProceduresForHumanSkull');
  270. }
  271. /**
  272. * 获取协议下的体位列表
  273. *
  274. * @description 根据协议ID获取该协议下的体位列表
  275. * @method GET
  276. * @url /dr/api/v1/auth/protocol/procedure/{procedure_id}/view
  277. *
  278. * @returns {Object[]} data.views - 体位列表
  279. *
  280. * @example
  281. * mockGetViewsByProcedure();
  282. * cy.wait('@getViewsByProcedure');
  283. */
  284. export function mockGetViewsByProcedure() {
  285. cy.intercept('GET', '/dr/api/v1/auth/protocol/procedure/*/view*', {
  286. statusCode: 200,
  287. body: {
  288. code: "0x000000",
  289. description: "Success",
  290. solution: "",
  291. data: {
  292. "@type": "type.googleapis.com/dr.protocol.ViewList",
  293. count: 2,
  294. views: [
  295. {
  296. internal_id: "View_DX_H_SKULL_AP",
  297. view_id: "View_DX_H_SKULL_AP",
  298. view_name: "颅骨前后位",
  299. view_name_local: "颅骨前后位",
  300. view_other_name: "Skull AP",
  301. view_description: "颅骨前后位",
  302. view_position: "AP",
  303. application: "RAD",
  304. anatomic_region: "SKULL",
  305. patient_type: "Human",
  306. body_part_id: "Human_SKULL",
  307. modality: "DX",
  308. sort: 1,
  309. is_enabled: true,
  310. product: "DROS",
  311. is_pre_install: true
  312. },
  313. {
  314. internal_id: "View_DX_H_SKULL_LAT",
  315. view_id: "View_DX_H_SKULL_LAT",
  316. view_name: "颅骨侧位",
  317. view_name_local: "颅骨侧位",
  318. view_other_name: "Skull LAT",
  319. view_description: "颅骨侧位",
  320. view_position: "LAT",
  321. application: "RAD",
  322. anatomic_region: "SKULL",
  323. patient_type: "Human",
  324. body_part_id: "Human_SKULL",
  325. modality: "DX",
  326. sort: 2,
  327. is_enabled: true,
  328. product: "DROS",
  329. is_pre_install: true
  330. }
  331. ]
  332. }
  333. }
  334. }).as('getViewsByProcedure');
  335. }