Files
his/docs/bug498_analysis.md
2026-05-16 20:17:20 +08:00

79 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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) | ❌ 参数名不匹配 |
## 修复结果:✅ 成功commit 3a928afb2行改动
### 修复内容
`examineApplication.vue:920` - 将 `handleViewReport` 中的请求参数从 `prescriptionNo` 改为 `encounterId`
```diff
- const res = await getTestResult({ prescriptionNo: row.prescriptionNo });
+ const res = await getTestResult({ encounterId: row.encounterId || patientInfo.value?.encounterId });
```
### 说明
- 操作列的动态按钮逻辑(修改/删除/撤回/打印/看报告)已在之前的提交中完整实现
- 本修复解决了"看报告"功能因参数名不匹配导致始终返回空数据的问题
- 其余操作(修改/删除/撤回/打印)的后端接口参数均正确匹配