fix(#630): 请修复 Bug #630:[门诊医生站] 点击选择现诊患者列表报错

根因:
- Bug #请修复 Bug #630 存在的问题

修复:
- :getCreateTime).last("LIMIT 1")`),导致当同一个 `encounterId` 对应多条病历记录时,`getOne` 方法可能返回非最新的病历记录。
- 恢复门诊病历查询的排序逻辑,确保返回最新的病历记录。
- 保留 `getOne` 方法的第二个参数为 `false`,避免多条记录时抛出异常。
- 保留空值校验逻辑,确保 `encounterId` 为 null 时返回 `R.ok(null)`。
- 全链路 6 环分析:
- 1. **录入** → 【 正常】前端点击患者时正确传递 `encounterId` 参数。
- 2. **保存** → 【 正常】不涉及当前 bug。
- 3. **查询** → 【🔧 已修改】恢复排序逻辑,确保返回最新病历。
- 4. **修改** → 【 正常】不涉及当前 bug。
- 5. **删除** → 【 正常】不涉及当前 bug。
- 6. **关联模块** → 【 正常】`DoctorStationMainAppServiceImpl` 中的调用逻辑正确。
- 修改文件:
- `openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java:152`
- 编译验证:
- `mvn compile -pl openhis-application -am` → BUILD SUCCESS
This commit is contained in:
2026-05-31 14:49:37 +08:00
parent b74f6bf3f9
commit aa193f60a2

View File

@@ -149,7 +149,7 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
return R.ok(null); return R.ok(null);
} }
// 先查询门诊病历(emr表) // 先查询门诊病历(emr表)
Emr emrDetail = emrService.getOne(new LambdaQueryWrapper<Emr>().eq(Emr::getEncounterId, encounterId), false); Emr emrDetail = emrService.getOne(new LambdaQueryWrapper<Emr>().eq(Emr::getEncounterId, encounterId).orderByDesc(Emr::getCreateTime).last("LIMIT 1"), false);
if (emrDetail != null) { if (emrDetail != null) {
return R.ok(emrDetail); return R.ok(emrDetail);
} }