|
|
@@ -0,0 +1,503 @@
|
|
|
+/**
|
|
|
+ * Protocol Mock Handlers
|
|
|
+ * 协议相关的 mock 处理器
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取患者类型列表 - Human类型
|
|
|
+ *
|
|
|
+ * @description 获取启用的人医患者类型列表
|
|
|
+ * @method GET
|
|
|
+ * @url /dr/api/v1/auth/protocol/patient_type
|
|
|
+ * @access 需要认证
|
|
|
+ *
|
|
|
+ * @param {boolean} [is_enabled] - 是否只返回启用的类型
|
|
|
+ *
|
|
|
+ * @returns {Object[]} data.patient_type_list - 患者类型列表
|
|
|
+ * @returns {string} data.patient_type_list[].patient_type_id - 患者类型ID
|
|
|
+ * @returns {string} data.patient_type_list[].patient_type_name - 患者类型名称
|
|
|
+ * @returns {boolean} data.patient_type_list[].is_enabled - 是否启用
|
|
|
+ * @returns {string} data.patient_type_list[].product - 产品类型(DROS/VETDROS)
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * mockGetPatientTypeHuman();
|
|
|
+ * cy.wait('@getPatientTypeHuman');
|
|
|
+ *
|
|
|
+ * @see docs/DR.md - 章节12.1
|
|
|
+ */
|
|
|
+export function mockGetPatientTypeHuman() {
|
|
|
+ cy.intercept('GET', '/dr/api/v1/auth/protocol/patient_type*', {
|
|
|
+ statusCode: 200,
|
|
|
+ body: {
|
|
|
+ code: "0x000000",
|
|
|
+ description: "Success",
|
|
|
+ solution: "",
|
|
|
+ data: {
|
|
|
+ patient_type_list: [
|
|
|
+ {
|
|
|
+ id: "1",
|
|
|
+ patient_type_id: "Human",
|
|
|
+ patient_type_name: "Human",
|
|
|
+ patient_type_local: "Human",
|
|
|
+ patient_type_description: "Human",
|
|
|
+ sort: 1,
|
|
|
+ is_enabled: true,
|
|
|
+ product: "DROS",
|
|
|
+ is_pre_install: true
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).as('getPatientTypeHuman');
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取患者类型列表 - 所有类型
|
|
|
+ *
|
|
|
+ * @description 获取所有患者类型列表(包括禁用的)
|
|
|
+ * @method GET
|
|
|
+ * @url /dr/api/v1/auth/protocol/patient_type
|
|
|
+ * @access 需要认证
|
|
|
+ *
|
|
|
+ * @returns {Object[]} data.patient_type_list - 患者类型列表
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * mockGetPatientTypeAll();
|
|
|
+ * cy.wait('@getPatientTypeAll');
|
|
|
+ *
|
|
|
+ * @see docs/DR.md - 章节12.1
|
|
|
+ */
|
|
|
+export function mockGetPatientTypeAll() {
|
|
|
+ cy.intercept('GET', '/dr/api/v1/auth/protocol/patient_type*', {
|
|
|
+ statusCode: 200,
|
|
|
+ body: {
|
|
|
+ code: "0x000000",
|
|
|
+ description: "Success",
|
|
|
+ solution: "",
|
|
|
+ data: {
|
|
|
+ patient_type_list: [
|
|
|
+ {
|
|
|
+ id: "1",
|
|
|
+ patient_type_id: "Human",
|
|
|
+ patient_type_name: "Human",
|
|
|
+ patient_type_local: "Human",
|
|
|
+ patient_type_description: "Human",
|
|
|
+ sort: 1,
|
|
|
+ is_enabled: true,
|
|
|
+ product: "DROS",
|
|
|
+ is_pre_install: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "2",
|
|
|
+ patient_type_id: "SpecialType",
|
|
|
+ patient_type_name: "SpecialType",
|
|
|
+ patient_type_local: "SpecialType",
|
|
|
+ patient_type_description: "SpecialType",
|
|
|
+ sort: 2,
|
|
|
+ is_enabled: false,
|
|
|
+ product: "DROS",
|
|
|
+ is_pre_install: true
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).as('getPatientTypeAll');
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取身体部位列表 - Human
|
|
|
+ *
|
|
|
+ * @description 根据患者类型获取支持的身体部位(人医)
|
|
|
+ * @method GET
|
|
|
+ * @url /dr/api/v1/auth/protocol/body_part
|
|
|
+ * @access 需要认证
|
|
|
+ *
|
|
|
+ * @param {string} patient_type - 患者类型
|
|
|
+ * @param {string} modality - 模式(DX)
|
|
|
+ * @param {boolean} [is_enabled] - 是否只返回启用的
|
|
|
+ *
|
|
|
+ * @returns {Object[]} data.body_part_list - 身体部位列表
|
|
|
+ * @returns {string} data.body_part_list[].body_part_id - 身体部位ID
|
|
|
+ * @returns {string} data.body_part_list[].body_part_name - 身体部位名称
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * mockGetBodyPartHuman();
|
|
|
+ * cy.wait('@getBodyPartHuman');
|
|
|
+ *
|
|
|
+ * @see docs/DR.md - 章节12.2
|
|
|
+ */
|
|
|
+export function mockGetBodyPartHuman() {
|
|
|
+ cy.intercept('GET', '/dr/api/v1/auth/protocol/body_part*', {
|
|
|
+ statusCode: 200,
|
|
|
+ body: {
|
|
|
+ code: "0x000000",
|
|
|
+ description: "Success",
|
|
|
+ solution: "",
|
|
|
+ data: {
|
|
|
+ body_part_list: [
|
|
|
+ {
|
|
|
+ id: "1",
|
|
|
+ body_part_id: "Human_SKULL",
|
|
|
+ body_part_name: "颅骨",
|
|
|
+ body_part_local: "颅骨",
|
|
|
+ body_part_description: "Skull",
|
|
|
+ patient_type: "Human",
|
|
|
+ category: "DX",
|
|
|
+ sort: 1,
|
|
|
+ is_enabled: true,
|
|
|
+ product: "DROS",
|
|
|
+ is_pre_install: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "2",
|
|
|
+ body_part_id: "Human_NECK",
|
|
|
+ body_part_name: "颈部",
|
|
|
+ body_part_local: "颈部",
|
|
|
+ body_part_description: "Neck",
|
|
|
+ patient_type: "Human",
|
|
|
+ category: "DX",
|
|
|
+ sort: 2,
|
|
|
+ is_enabled: true,
|
|
|
+ product: "DROS",
|
|
|
+ is_pre_install: true
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).as('getBodyPartHuman');
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取协议列表 - 成功场景
|
|
|
+ *
|
|
|
+ * @description 根据身体部位获取协议列表
|
|
|
+ * @method GET
|
|
|
+ * @url /dr/api/v1/auth/protocol/procedure
|
|
|
+ * @access 需要认证
|
|
|
+ *
|
|
|
+ * @param {string} patient_type - 患者类型
|
|
|
+ * @param {string} body_part - 身体部位
|
|
|
+ * @param {string} [procedure_type] - 协议类型(NORMAL/EMERGENCY)
|
|
|
+ * @param {boolean} [is_enabled] - 是否只返回启用的
|
|
|
+ * @param {number} [page] - 页码
|
|
|
+ * @param {number} [page_size] - 每页数量
|
|
|
+ *
|
|
|
+ * @returns {Object} data - 协议列表数据
|
|
|
+ * @returns {number} data.count - 总数
|
|
|
+ * @returns {Object[]} data.procedures - 协议列表
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * mockGetProcedureListSuccess();
|
|
|
+ * cy.wait('@getProcedureListSuccess');
|
|
|
+ *
|
|
|
+ * @see docs/DR.md - 章节12.3
|
|
|
+ */
|
|
|
+export function mockGetProcedureListSuccess() {
|
|
|
+ cy.intercept('GET', '/dr/api/v1/auth/protocol/procedure*', {
|
|
|
+ statusCode: 200,
|
|
|
+ body: {
|
|
|
+ code: "0x000000",
|
|
|
+ description: "Success",
|
|
|
+ solution: "",
|
|
|
+ data: {
|
|
|
+ "@type": "type.googleapis.com/dr.protocol.ProcedureList",
|
|
|
+ count: 4,
|
|
|
+ procedures: [
|
|
|
+ {
|
|
|
+ id: "2",
|
|
|
+ procedure_id: "P0-0002",
|
|
|
+ procedure_code: "P0-0002",
|
|
|
+ procedure_name: "颅骨前后位 + 侧位",
|
|
|
+ procedure_name_local: "颅骨前后位 + 侧位",
|
|
|
+ procedure_other_name: "Skull AP + LAT",
|
|
|
+ procedure_description: "颅骨前后位 + 侧位",
|
|
|
+ procedure_description_local: "颅骨前后位 + 侧位",
|
|
|
+ patient_type: "Human",
|
|
|
+ body_part_id: "Human_SKULL",
|
|
|
+ procedure_type: "NORMAL",
|
|
|
+ fast_search: false,
|
|
|
+ protocol_laterality: "U",
|
|
|
+ procedure_category: "Adult",
|
|
|
+ modality: "DX",
|
|
|
+ sort: 1,
|
|
|
+ is_enabled: true,
|
|
|
+ product: "DROS",
|
|
|
+ is_pre_install: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "3",
|
|
|
+ procedure_id: "P0-0003",
|
|
|
+ procedure_code: "P0-0003",
|
|
|
+ procedure_name: "颅骨后前位 + 侧位",
|
|
|
+ procedure_name_local: "颅骨后前位 + 侧位",
|
|
|
+ procedure_other_name: "Skull PA + LAT",
|
|
|
+ procedure_description: "颅骨后前位 + 侧位",
|
|
|
+ procedure_description_local: "颅骨后前位 + 侧位",
|
|
|
+ patient_type: "Human",
|
|
|
+ body_part_id: "Human_SKULL",
|
|
|
+ procedure_type: "NORMAL",
|
|
|
+ fast_search: false,
|
|
|
+ protocol_laterality: "U",
|
|
|
+ procedure_category: "Adult",
|
|
|
+ modality: "DX",
|
|
|
+ sort: 1,
|
|
|
+ is_enabled: true,
|
|
|
+ product: "DROS",
|
|
|
+ is_pre_install: true
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).as('getProcedureListSuccess');
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取体位列表 - 成功场景
|
|
|
+ *
|
|
|
+ * @description 获取体位列表
|
|
|
+ * @method GET
|
|
|
+ * @url /dr/api/v1/auth/protocol/view
|
|
|
+ * @access 需要认证
|
|
|
+ *
|
|
|
+ * @param {string} patient_type - 患者类型
|
|
|
+ * @param {string} body_part - 身体部位
|
|
|
+ * @param {boolean} [is_enabled] - 是否只返回启用的
|
|
|
+ * @param {number} [page] - 页码
|
|
|
+ * @param {number} [page_size] - 每页数量
|
|
|
+ *
|
|
|
+ * @returns {Object} data - 体位列表数据
|
|
|
+ * @returns {number} data.count - 总数
|
|
|
+ * @returns {Object[]} data.views - 体位列表
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * mockGetViewListSuccess();
|
|
|
+ * cy.wait('@getViewListSuccess');
|
|
|
+ *
|
|
|
+ * @see docs/DR.md - 章节12.4
|
|
|
+ */
|
|
|
+export function mockGetViewListSuccess() {
|
|
|
+ cy.intercept('GET', '/dr/api/v1/auth/protocol/view*', {
|
|
|
+ statusCode: 200,
|
|
|
+ body: {
|
|
|
+ code: "0x000000",
|
|
|
+ description: "Success",
|
|
|
+ solution: "",
|
|
|
+ data: {
|
|
|
+ "@type": "type.googleapis.com/dr.protocol.ViewList",
|
|
|
+ count: 2,
|
|
|
+ views: [
|
|
|
+ {
|
|
|
+ internal_id: "View_DX_T_A_SK_AP_00",
|
|
|
+ view_id: "View_DX_T_A_SK_AP_00",
|
|
|
+ view_name: "颅骨前后位",
|
|
|
+ view_name_local: "",
|
|
|
+ view_other_name: "Skull AP",
|
|
|
+ view_description: "颅骨前后位",
|
|
|
+ view_position: "AP",
|
|
|
+ application: "RAD",
|
|
|
+ anatomic_region: "SKULL",
|
|
|
+ patient_type: "Human",
|
|
|
+ body_part_id: "Human_SKULL",
|
|
|
+ view_icon_name: "/Image/Position/Human/skull.ap.table.x.png",
|
|
|
+ modality: "DX",
|
|
|
+ work_station_id: 0,
|
|
|
+ apr_id: "View_DX_T_A_SK_AP_00",
|
|
|
+ img_proc_id: "View_DX_T_A_SK_AP_00",
|
|
|
+ sort: 1,
|
|
|
+ is_enabled: true,
|
|
|
+ product: "DROS",
|
|
|
+ is_pre_install: true
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).as('getViewListSuccess');
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取体位详情 - 成功场景
|
|
|
+ *
|
|
|
+ * @description 根据ID获取体位详情
|
|
|
+ * @method GET
|
|
|
+ * @url /dr/api/v1/auth/protocol/view/{id}
|
|
|
+ * @access 需要认证
|
|
|
+ *
|
|
|
+ * @param {string} id - 体位ID(路径参数)
|
|
|
+ *
|
|
|
+ * @returns {Object} data - 体位详情
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * mockGetViewDetailSuccess();
|
|
|
+ * cy.wait('@getViewDetailSuccess');
|
|
|
+ *
|
|
|
+ * @see docs/DR.md - 章节12.6
|
|
|
+ */
|
|
|
+export function mockGetViewDetailSuccess() {
|
|
|
+ cy.intercept('GET', '/dr/api/v1/auth/protocol/view/*', {
|
|
|
+ statusCode: 200,
|
|
|
+ body: {
|
|
|
+ code: "0x000000",
|
|
|
+ description: "Success",
|
|
|
+ solution: "",
|
|
|
+ data: {
|
|
|
+ "@type": "type.googleapis.com/dr.protocol.View",
|
|
|
+ internal_id: "View_DX_T_A_SK_AP_00",
|
|
|
+ view_id: "View_DX_T_A_SK_AP_00",
|
|
|
+ view_name: "颅骨前后位",
|
|
|
+ view_description: "颅骨前后位",
|
|
|
+ patient_type: "Human",
|
|
|
+ body_part_id: "Human_SKULL",
|
|
|
+ modality: "DX",
|
|
|
+ sort: 1,
|
|
|
+ is_enabled: true,
|
|
|
+ product: "DROS",
|
|
|
+ is_pre_install: true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).as('getViewDetailSuccess');
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取APR详情(通过view_id)- 成功场景
|
|
|
+ *
|
|
|
+ * @description 根据体位ID获取APR详情
|
|
|
+ * @method GET
|
|
|
+ * @url /dr/api/v1/auth/protocol/view/{id}/apr
|
|
|
+ * @access 需要认证
|
|
|
+ *
|
|
|
+ * @param {string} id - 体位ID(路径参数)
|
|
|
+ *
|
|
|
+ * @returns {Object} data - APR详情
|
|
|
+ * @returns {Object[]} data.exposures - 曝光参数列表
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * mockGetAprByViewSuccess();
|
|
|
+ * cy.wait('@getAprByViewSuccess');
|
|
|
+ *
|
|
|
+ * @see docs/DR.md - 章节12.7
|
|
|
+ */
|
|
|
+export function mockGetAprByViewSuccess() {
|
|
|
+ cy.intercept('GET', '/dr/api/v1/auth/protocol/view/*/apr*', {
|
|
|
+ statusCode: 200,
|
|
|
+ body: {
|
|
|
+ code: "0x000000",
|
|
|
+ description: "Success",
|
|
|
+ solution: "",
|
|
|
+ data: {
|
|
|
+ "@type": "type.googleapis.com/dr.protocol.AprReply",
|
|
|
+ apr_id: "View_DX_T_A_SK_AP_00",
|
|
|
+ apr_name: "View_DX_T_A_SK_AP_00",
|
|
|
+ apr_description: "颅骨前后位",
|
|
|
+ patient_type: "Human",
|
|
|
+ body_part_id: "Human_SKULL",
|
|
|
+ modality: "DX",
|
|
|
+ exposures: [
|
|
|
+ {
|
|
|
+ work_station_id: 0,
|
|
|
+ patient_size: "Medium",
|
|
|
+ config_object: {
|
|
|
+ Common: {
|
|
|
+ kV: 70,
|
|
|
+ mA: 125,
|
|
|
+ ms: 100,
|
|
|
+ mAs: 12.5
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ sort: 0,
|
|
|
+ is_enabled: true,
|
|
|
+ product: "DROS",
|
|
|
+ is_pre_install: true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).as('getAprByViewSuccess');
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取APR设备信息 - 成功场景
|
|
|
+ *
|
|
|
+ * @description 根据APR ID获取设备参数信息
|
|
|
+ * @method GET
|
|
|
+ * @url /dr/api/v1/auth/protocol/apr/{id}/device
|
|
|
+ * @access 需要认证
|
|
|
+ *
|
|
|
+ * @param {string} id - APR ID(路径参数)
|
|
|
+ * @param {number} [work_station_id] - 工作位ID(0或1)
|
|
|
+ *
|
|
|
+ * @returns {Object} data - 设备参数
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * mockGetAprDeviceSuccess();
|
|
|
+ * cy.wait('@getAprDeviceSuccess');
|
|
|
+ *
|
|
|
+ * @see docs/DR.md - 章节12.9
|
|
|
+ */
|
|
|
+export function mockGetAprDeviceSuccess() {
|
|
|
+ cy.intercept('GET', '/dr/api/v1/auth/protocol/apr/*/device*', {
|
|
|
+ statusCode: 200,
|
|
|
+ body: {
|
|
|
+ code: "0x000000",
|
|
|
+ description: "Success",
|
|
|
+ solution: "",
|
|
|
+ data: {
|
|
|
+ "@type": "type.googleapis.com/dr.protocol.AprDevice",
|
|
|
+ work_station_id: 1,
|
|
|
+ config_object: {
|
|
|
+ Common: {
|
|
|
+ APRNumber: "5",
|
|
|
+ SID: 115,
|
|
|
+ GridType: 2
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).as('getAprDeviceSuccess');
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取APR默认曝光参数 - 成功场景
|
|
|
+ *
|
|
|
+ * @description 根据APR ID获取默认曝光技术参数
|
|
|
+ * @method GET
|
|
|
+ * @url /dr/api/v1/auth/protocol/apr/{id}/tech
|
|
|
+ * @access 需要认证
|
|
|
+ *
|
|
|
+ * @param {string} id - APR ID(路径参数)
|
|
|
+ * @param {number} [work_station_id] - 工作位ID
|
|
|
+ * @param {string} [patient_size] - 患者体型(Large/Medium/Small)
|
|
|
+ *
|
|
|
+ * @returns {Object} data - 技术参数
|
|
|
+ * @returns {Object} data.dp - 设备参数
|
|
|
+ * @returns {Object} data.ep - 曝光参数
|
|
|
+ *
|
|
|
+ * @example
|
|
|
+ * mockGetAprTechParamsSuccess();
|
|
|
+ * cy.wait('@getAprTechParamsSuccess');
|
|
|
+ *
|
|
|
+ * @see docs/DR.md - 章节12.10
|
|
|
+ */
|
|
|
+export function mockGetAprTechParamsSuccess() {
|
|
|
+ cy.intercept('GET', '/dr/api/v1/auth/protocol/apr/*/tech*', {
|
|
|
+ statusCode: 200,
|
|
|
+ body: {
|
|
|
+ code: "0x000000",
|
|
|
+ description: "Success",
|
|
|
+ solution: "",
|
|
|
+ data: {
|
|
|
+ "@type": "type.googleapis.com/dr.protocol.TechParam",
|
|
|
+ dp: {
|
|
|
+ SID: 115,
|
|
|
+ GridType: 2,
|
|
|
+ GridSpeed: 0
|
|
|
+ },
|
|
|
+ ep: {
|
|
|
+ kV: 70,
|
|
|
+ mA: 125,
|
|
|
+ ms: 100,
|
|
|
+ mAs: 12.5
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).as('getAprTechParamsSuccess');
|
|
|
+}
|