123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- /**
- * Study Mock Handlers
- * 检查信息管理相关的 mock 处理器
- */
- /**
- * 登记检查信息 - 成功场景
- *
- * @description 登记新的检查信息
- * @method POST
- * @url /dr/api/v1/auth/study
- * @access 需要认证
- *
- * @param {Object} requestBody - 请求体(包含患者信息、体位列表等)
- *
- * @returns {Object} data - 新创建的检查信息
- * @returns {string} data.study_id - 检查ID
- * @returns {Object[]} data.series - 序列列表
- *
- * @example
- * mockRegisterStudySuccess();
- * cy.wait('@registerStudySuccess');
- *
- * @see docs/DR.md - 章节13
- */
- export function mockRegisterStudySuccess() {
- cy.intercept('POST', '/dr/api/v1/auth/study', {
- statusCode: 200,
- body: {
- code: "0x000000",
- description: "Success",
- solution: "",
- data: {
- "@type": "type.googleapis.com/dr.study.Study",
- study_instance_uid: "1.2.276.0.1000000.5.1.2.701601461.33458.1750833219.482097",
- study_id: "20250625143339389",
- patient_name: "Test Patient",
- patient_id: "PET007",
- study_status: "Arrived",
- series: []
- }
- }
- }).as('registerStudySuccess');
- }
- /**
- * 获取检查信息 - Arrived状态
- *
- * @description 根据study_id获取检查详细信息(已到达状态)
- * @method GET
- * @url /dr/api/v1/auth/study/{id}
- * @access 需要认证
- *
- * @param {string} id - 检查ID(study_id),路径参数
- *
- * @returns {Object} data - 检查详细信息
- * @returns {string} data.study_status - 检查状态(Arrived/InProgress/Completed)
- *
- * @example
- * mockGetStudyArrived();
- * cy.wait('@getStudyArrived');
- *
- * @see docs/DR.md - 章节16
- */
- export function mockGetStudyArrived() {
- cy.intercept('GET', '/dr/api/v1/auth/study/*', {
- statusCode: 200,
- body: {
- code: "0x000000",
- description: "Success",
- solution: "",
- data: {
- study_id: "250929163817805",
- patient_name: "Test Patient",
- study_status: "Arrived",
- series: []
- }
- }
- }).as('getStudyArrived');
- }
- /**
- * 获取检查信息状态 - 成功场景
- *
- * @description 获取检查的统计信息(总数、已曝光数)
- * @method GET
- * @url /dr/api/v1/auth/study/{id}/stat
- * @access 需要认证
- *
- * @param {string} id - 检查ID(study_id),路径参数
- *
- * @returns {Object} data - 统计信息
- * @returns {number} data.total - 总体位数
- * @returns {number} data.exposed - 已曝光数
- *
- * @example
- * mockGetStudyStatSuccess();
- * cy.wait('@getStudyStatSuccess');
- *
- * @see docs/DR.md - 章节17
- */
- export function mockGetStudyStatSuccess() {
- cy.intercept('GET', '/dr/api/v1/auth/study/*/stat', {
- statusCode: 200,
- body: {
- code: "0x000000",
- description: "Success",
- solution: "",
- data: {
- "@type": "type.googleapis.com/dr.study.Stat",
- total: 3,
- exposed: 1
- }
- }
- }).as('getStudyStatSuccess');
- }
- /**
- * 变更登记信息 - 成功场景
- *
- * @description 更新已登记的检查信息
- * @method PUT
- * @url /dr/api/v1/auth/study/{id}
- * @access 需要认证
- *
- * @param {string} id - 检查ID(study_id),路径参数
- * @param {Object} requestBody - 更新的患者信息
- *
- * @returns {Object} data - 更新后的检查信息
- *
- * @example
- * mockUpdateStudySuccess();
- * cy.wait('@updateStudySuccess');
- *
- * @see docs/DR.md - 章节14
- */
- export function mockUpdateStudySuccess() {
- cy.intercept('PUT', '/dr/api/v1/auth/study/*', {
- statusCode: 200,
- body: {
- code: "0x000000",
- description: "Success",
- solution: "",
- data: {
- study_id: "20250625140057649",
- patient_name: "Updated Patient",
- study_status: "Arrived"
- }
- }
- }).as('updateStudySuccess');
- }
- /**
- * 删除检查信息(批量)- 成功场景
- *
- * @description 批量删除检查信息
- * @method DELETE
- * @url /dr/api/v1/auth/study
- * @access 需要认证
- *
- * @param {string[]} requestBody - 检查ID列表
- *
- * @returns {Object} 成功响应
- *
- * @example
- * mockDeleteStudyBatchSuccess();
- * cy.wait('@deleteStudyBatchSuccess');
- *
- * @see docs/DR.md - 章节18
- */
- export function mockDeleteStudyBatchSuccess() {
- cy.intercept('DELETE', '/dr/api/v1/auth/study', {
- statusCode: 200,
- body: {
- code: "0x000000",
- description: "Success",
- solution: "",
- data: {}
- }
- }).as('deleteStudyBatchSuccess');
- }
- /**
- * 存储急诊患者影像 - 成功场景
- *
- * @description 存储拍摄的急诊患者影像
- * @method POST
- * @url /api/v1/auth/study/portrait
- * @access 需要认证
- *
- * @param {Object} formData - 表单数据
- * @param {string} formData.instance_uid - study实例UID
- * @param {File} formData.data - PNG图片文件
- *
- * @returns {Object} data - DCM文件路径
- * @returns {string} data.path - 文件路径
- *
- * @example
- * mockStorePortraitSuccess();
- * cy.wait('@storePortraitSuccess');
- *
- * @see docs/DR.md - 章节19
- */
- export function mockStorePortraitSuccess() {
- cy.intercept('POST', '/api/v1/auth/study/portrait', {
- statusCode: 200,
- body: {
- code: "0x000000",
- description: "Success",
- solution: "",
- data: {
- "@type": "type.googleapis.com/dr.task.DcmPath",
- path: "1.2.276.0.1000000.5.1.5.701601461.33458.1750830395.482043.dcm"
- }
- }
- }).as('storePortraitSuccess');
- }
- /**
- * 挂起检查 - 成功场景
- *
- * @description 挂起当前检查(状态设为InProgress)
- * @method POST
- * @url /api/v1/auth/task/inspection/leave
- * @access 需要认证
- *
- * @param {Object} requestBody - 请求体
- * @param {string} requestBody.study_id - 检查ID
- * @param {string} requestBody.study_status - 检查状态(InProgress)
- *
- * @returns {Object} 成功响应
- *
- * @example
- * mockLeaveStudyInProgress();
- * cy.wait('@leaveStudyInProgress');
- *
- * @see docs/DR.md - 章节35
- */
- export function mockLeaveStudyInProgress() {
- cy.intercept('POST', '/api/v1/auth/task/inspection/leave', (req) => {
- if (req.body.study_status === 'InProgress') {
- req.reply({
- statusCode: 200,
- body: {
- code: "0x000000",
- description: "Success",
- solution: "",
- data: {}
- }
- });
- }
- }).as('leaveStudyInProgress');
- }
- /**
- * 完成检查 - 成功场景
- *
- * @description 完成当前检查(状态设为Completed)
- * @method POST
- * @url /api/v1/auth/task/inspection/leave
- * @access 需要认证
- *
- * @param {Object} requestBody - 请求体
- * @param {string} requestBody.study_id - 检查ID
- * @param {string} requestBody.study_status - 检查状态(Completed)
- *
- * @returns {Object} 成功响应
- *
- * @example
- * mockLeaveStudyCompleted();
- * cy.wait('@leaveStudyCompleted');
- *
- * @see docs/DR.md - 章节35
- */
- export function mockLeaveStudyCompleted() {
- cy.intercept('POST', '/api/v1/auth/task/inspection/leave', (req) => {
- if (req.body.study_status === 'Completed') {
- req.reply({
- statusCode: 200,
- body: {
- code: "0x000000",
- description: "Success",
- solution: "",
- data: {}
- }
- });
- }
- }).as('leaveStudyCompleted');
- }
|