From 3a928afbc76cc8fd232939afd2da960a8f2cc35a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=BA=91?= <赵云@gentronhealth.com> Date: Sat, 16 May 2026 20:16:43 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#498:=20=E7=9C=8B=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=8F=82=E6=95=B0=E5=90=8D=E4=B8=8D=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=EF=BC=88prescriptionNo=E2=86=92encounterId=EF=BC=89?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96=E6=AD=A3=E7=A1=AE=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=AF=BC=E8=87=B4=E6=8A=A5=E5=91=8A=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E7=A9=BA=E5=88=97=E8=A1=A8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- docs/bug498_analysis.md | 64 +++++++++++++++++++ .../applicationShow/examineApplication.vue | 2 +- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 docs/bug498_analysis.md diff --git a/docs/bug498_analysis.md b/docs/bug498_analysis.md new file mode 100644 index 000000000..d8f0dee2d --- /dev/null +++ b/docs/bug498_analysis.md @@ -0,0 +1,64 @@ +# Bug #498 分析报告 + +## Bug 描述 +【住院医生工作站-检查申请】检查申请列表操作项过于单一,缺失修改/作废/打印/看报告等核心临床操作 + +## 阶段1:深度分析 + +### 当前代码状态 +`examineApplication.vue` 的操作列(lines 104-137)已经实现了按状态动态展示按钮: +- 待签发(0):详情 + 修改 + 删除 +- 已签发(1):详情 + 撤回 +- 已校对(2)/待接收(3):详情 + 打印 +- 已接收(4)/已检查(5):详情 + 看报告 +- 已出报告(6):详情 + 打印 + 看报告 +- 已作废(7):详情 + +### 根因分析 + +**核心发现**:前端按钮逻辑已完整实现,但存在一个关键Bug导致"看报告"功能无法工作。 + +#### Bug:`handleViewReport` 传递错误的参数 + +前端代码 (examineApplication.vue:920): +```js +const res = await getTestResult({ prescriptionNo: row.prescriptionNo }); +``` + +后端接口 (DoctorStationAdviceController.java:190-192): +```java +@GetMapping(value = "/test-result") +public R getTestResult(@RequestParam(value = "encounterId") Long encounterId) { + return iDoctorStationAdviceAppService.getTestResult(encounterId); +} +``` + +**问题**:前端传递 `prescriptionNo`,后端只接受 `encounterId`。Spring 忽略未知参数,`encounterId` 为 null,后端直接返回空列表。 + +后端服务实现 (DoctorStationAdviceAppServiceImpl.java:2357-2376): +```java +public R getTestResult(Long encounterId) { + if (encounterId == null) { + return R.ok(new ArrayList<>()); // encounterId为空时直接返回空列表 + } + // ... 查询逻辑 ... +} +``` + +#### 数据流追踪 +1. 前端 `handleViewReport(row)` → 获取 `row.prescriptionNo` +2. 调用 `getTestResult({ prescriptionNo: "JCZ26051600001" })` +3. 后端接收:`encounterId = null`(参数名不匹配,被忽略) +4. 后端返回空列表 → 前端显示"暂未生成报告" + +### 修复方案 +将 `handleViewReport` 中的参数从 `prescriptionNo` 改为 `encounterId`,使用 `row.encounterId` 或 `patientInfo.value.encounterId`。 + +### 后端 API 完整性检查 +| 操作 | 前端调用 | 后端接口 | 状态 | +|------|---------|---------|------| +| 修改 | saveCheckd → POST /save-check | saveRequestForm (支持编辑) | ✅ | +| 删除 | deleteRequestForm → POST /delete | deleteRequestForm (验证status=0) | ✅ | +| 撤回 | withdrawRequestForm → POST /withdraw | withdrawRequestForm (验证status=2) | ✅ | +| 打印 | 前端 window.open 打印 | 无后端依赖 | ✅ | +| 看报告 | getTestResult → GET /test-result | getTestResult(encounterId) | ❌ 参数名不匹配 | diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue index bb498a019..348168711 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue @@ -917,7 +917,7 @@ const handleViewReport = async (row) => { reportLoading.value = true; reportData.value = null; try { - const res = await getTestResult({ prescriptionNo: row.prescriptionNo }); + const res = await getTestResult({ encounterId: row.encounterId || patientInfo.value?.encounterId }); if (res.code === 200) { if (res.data) { // 支持两种返回格式: