/** * Report Mock Handlers * 报告相关的 mock 处理器 */ /** * 报告预览 - 成功场景 * * @description 预览报告,返回PDF文件 * @method POST * @url /dr/api/v1/auth/report/preview * @access 需要认证 * * @param {Object} requestBody - 请求体 * @param {Object} requestBody.headers - 报告头信息 * @param {string} requestBody.findings - 影像所见 * @param {string} requestBody.impression - 诊断意见 * @param {string} requestBody.radiologist - 报告医师 * @param {string} requestBody.review_physician - 审核医师 * * @returns {File} PDF报告文件 * * @example * mockReportPreviewSuccess(); * cy.wait('@reportPreviewSuccess'); * * @see docs/DR.md - 章节25 */ export function mockReportPreviewSuccess() { cy.intercept('POST', '/dr/api/v1/auth/report/preview', { statusCode: 200, headers: { 'content-type': 'application/pdf' }, body: '' // 空PDF数据 }).as('reportPreviewSuccess'); } /** * 保存报告 - 成功场景 * * @description 保存检查报告 * @method POST * @url /dr/api/v1/auth/study/{id}/report * @access 需要认证 * * @param {string} id - 检查ID(路径参数) * @param {Object} requestBody - 请求体 * @param {Object} requestBody.headers - 报告头信息 * @param {string} requestBody.findings - 影像所见 * @param {string} requestBody.impression - 诊断意见 * @param {string} requestBody.radiologist - 报告医师 * @param {string} requestBody.review_physician - 审核医师 * * @returns {Object} 成功响应 * * @example * mockSaveReportSuccess(); * cy.wait('@saveReportSuccess'); * * @see docs/DR.md - 章节26 */ export function mockSaveReportSuccess() { cy.intercept('POST', '/dr/api/v1/auth/study/*/report', { statusCode: 200, body: { code: "0x000000", description: "Success", solution: "", data: {} } }).as('saveReportSuccess'); } /** * 获取报告 - 成功场景 * * @description 获取已保存的检查报告 * @method GET * @url /dr/api/v1/auth/study/{id}/report * @access 需要认证 * * @param {string} id - 检查ID(路径参数) * * @returns {File} PDF报告文件 * * @example * mockGetReportSuccess(); * cy.wait('@getReportSuccess'); * * @see docs/DR.md - 章节27 */ export function mockGetReportSuccess() { cy.intercept('GET', '/dr/api/v1/auth/study/*/report', { statusCode: 200, headers: { 'content-type': 'application/pdf' }, body: '' // 空PDF数据 }).as('getReportSuccess'); } /** * 获取报告 - 报告不存在 * * @description 获取报告失败,报告未创建 * @method GET * @url /dr/api/v1/auth/study/{id}/report * @access 需要认证 * * @param {string} id - 检查ID(路径参数) * * @returns {Object} 404错误响应 * * @example * mockGetReportNotFound(); * cy.wait('@getReportNotFound'); * * @see docs/DR.md - 章节27 */ export function mockGetReportNotFound() { cy.intercept('GET', '/dr/api/v1/auth/study/*/report', { statusCode: 404, body: { code: "0x000001", description: "Report not found", solution: "Please create the report first" } }).as('getReportNotFound'); }