report.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /**
  2. * Report Mock Handlers
  3. * 报告相关的 mock 处理器
  4. */
  5. /**
  6. * 报告预览 - 成功场景
  7. *
  8. * @description 预览报告,返回PDF文件
  9. * @method POST
  10. * @url /dr/api/v1/auth/report/preview
  11. * @access 需要认证
  12. *
  13. * @param {Object} requestBody - 请求体
  14. * @param {Object} requestBody.headers - 报告头信息
  15. * @param {string} requestBody.findings - 影像所见
  16. * @param {string} requestBody.impression - 诊断意见
  17. * @param {string} requestBody.radiologist - 报告医师
  18. * @param {string} requestBody.review_physician - 审核医师
  19. *
  20. * @returns {File} PDF报告文件
  21. *
  22. * @example
  23. * mockReportPreviewSuccess();
  24. * cy.wait('@reportPreviewSuccess');
  25. *
  26. * @see docs/DR.md - 章节25
  27. */
  28. export function mockReportPreviewSuccess() {
  29. cy.intercept('POST', '/dr/api/v1/auth/report/preview', {
  30. statusCode: 200,
  31. headers: {
  32. 'content-type': 'application/pdf'
  33. },
  34. body: '' // 空PDF数据
  35. }).as('reportPreviewSuccess');
  36. }
  37. /**
  38. * 保存报告 - 成功场景
  39. *
  40. * @description 保存检查报告
  41. * @method POST
  42. * @url /dr/api/v1/auth/study/{id}/report
  43. * @access 需要认证
  44. *
  45. * @param {string} id - 检查ID(路径参数)
  46. * @param {Object} requestBody - 请求体
  47. * @param {Object} requestBody.headers - 报告头信息
  48. * @param {string} requestBody.findings - 影像所见
  49. * @param {string} requestBody.impression - 诊断意见
  50. * @param {string} requestBody.radiologist - 报告医师
  51. * @param {string} requestBody.review_physician - 审核医师
  52. *
  53. * @returns {Object} 成功响应
  54. *
  55. * @example
  56. * mockSaveReportSuccess();
  57. * cy.wait('@saveReportSuccess');
  58. *
  59. * @see docs/DR.md - 章节26
  60. */
  61. export function mockSaveReportSuccess() {
  62. cy.intercept('POST', '/dr/api/v1/auth/study/*/report', {
  63. statusCode: 200,
  64. body: {
  65. code: "0x000000",
  66. description: "Success",
  67. solution: "",
  68. data: {}
  69. }
  70. }).as('saveReportSuccess');
  71. }
  72. /**
  73. * 获取报告 - 成功场景
  74. *
  75. * @description 获取已保存的检查报告
  76. * @method GET
  77. * @url /dr/api/v1/auth/study/{id}/report
  78. * @access 需要认证
  79. *
  80. * @param {string} id - 检查ID(路径参数)
  81. *
  82. * @returns {File} PDF报告文件
  83. *
  84. * @example
  85. * mockGetReportSuccess();
  86. * cy.wait('@getReportSuccess');
  87. *
  88. * @see docs/DR.md - 章节27
  89. */
  90. export function mockGetReportSuccess() {
  91. cy.intercept('GET', '/dr/api/v1/auth/study/*/report', {
  92. statusCode: 200,
  93. headers: {
  94. 'content-type': 'application/pdf'
  95. },
  96. body: '' // 空PDF数据
  97. }).as('getReportSuccess');
  98. }
  99. /**
  100. * 获取报告 - 报告不存在
  101. *
  102. * @description 获取报告失败,报告未创建
  103. * @method GET
  104. * @url /dr/api/v1/auth/study/{id}/report
  105. * @access 需要认证
  106. *
  107. * @param {string} id - 检查ID(路径参数)
  108. *
  109. * @returns {Object} 404错误响应
  110. *
  111. * @example
  112. * mockGetReportNotFound();
  113. * cy.wait('@getReportNotFound');
  114. *
  115. * @see docs/DR.md - 章节27
  116. */
  117. export function mockGetReportNotFound() {
  118. cy.intercept('GET', '/dr/api/v1/auth/study/*/report', {
  119. statusCode: 404,
  120. body: {
  121. code: "0x000001",
  122. description: "Report not found",
  123. solution: "Please create the report first"
  124. }
  125. }).as('getReportNotFound');
  126. }