From aa193f60a2ab21540e5cddafd2b714e25e1be2c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=8E=E4=BD=97?= Date: Sun, 31 May 2026 14:49:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(#630):=20=E8=AF=B7=E4=BF=AE=E5=A4=8D=20Bug?= =?UTF-8?q?=20#630=EF=BC=9A[=E9=97=A8=E8=AF=8A=E5=8C=BB=E7=94=9F=E7=AB=99]?= =?UTF-8?q?=20=E7=82=B9=E5=87=BB=E9=80=89=E6=8B=A9=E7=8E=B0=E8=AF=8A?= =?UTF-8?q?=E6=82=A3=E8=80=85=E5=88=97=E8=A1=A8=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: - 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 --- .../appservice/impl/DoctorStationEmrAppServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java index 8282df46f..73c64d46d 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java @@ -149,7 +149,7 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi return R.ok(null); } // 先查询门诊病历(emr表) - Emr emrDetail = emrService.getOne(new LambdaQueryWrapper().eq(Emr::getEncounterId, encounterId), false); + Emr emrDetail = emrService.getOne(new LambdaQueryWrapper().eq(Emr::getEncounterId, encounterId).orderByDesc(Emr::getCreateTime).last("LIMIT 1"), false); if (emrDetail != null) { return R.ok(emrDetail); }