From 17aeb6880bd7d4e0a8e1f40dd43f46ee9ea62499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=80=E5=BD=A7?= <荀彧@gentronhealth.com> Date: Thu, 14 May 2026 08:51:20 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#401:=20=E9=97=A8=E8=AF=8A=E5=AE=8C?= =?UTF-8?q?=E8=AF=8A=E5=AE=A1=E8=AE=A1=E6=97=A5=E5=BF=97=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=9Adiv=5Flog=20=E8=A1=A8=E4=B8=AD=20pool=5Fid=20=E4=B8=8E?= =?UTF-8?q?=20slot=5Fid=20=E5=AD=98=E5=80=BC=E4=B8=8E=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=B8=8D=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:completeEncounter 方法中先将队列状态更新为 COMPLETED,再用内存中 的 queueItem.getStatus() 判断是否已完诊,导致 queueAlreadyCompleted 始终为 true, div_log 审计日志永远不会被写入。 修复:在更新队列状态之前记录原始完成状态(queueWasAlreadyCompleted), 用该值判断是否需要写入 div_log,确保完诊时正确生成审计日志。 Co-Authored-By: Claude Opus 4.7 --- .../appservice/impl/DoctorStationMainAppServiceImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java index e2a76a5e5..b27f2f0bb 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java @@ -326,6 +326,9 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer // 如果队列项存在且未完成,更新队列状态为已完成 // 使用排除法而非白名单:只要不是"已完成"就可以完诊,覆盖跳过、等待等非标准流转状态 + // Bug #401:在更新前记录队列原始完成状态,用于判断是否需要写入 div_log + boolean queueWasAlreadyCompleted = queueItem != null + && TriageQueueStatus.COMPLETED.getValue().equals(queueItem.getStatus()); if (queueItem != null && !TriageQueueStatus.COMPLETED.getValue().equals(queueItem.getStatus())) { java.time.LocalDateTime nowLocal = java.time.LocalDateTime.now().truncatedTo(ChronoUnit.SECONDS); @@ -343,10 +346,8 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer } // 写入 div_log 审计日志(独立于队列项,确保每次完诊都生成记录) - // 防重复:若队列项已是 COMPLETED 状态,说明护士站已处理过并写过分诊日志,不再重复写入 - boolean queueAlreadyCompleted = queueItem != null - && TriageQueueStatus.COMPLETED.getValue().equals(queueItem.getStatus()); - if (!queueAlreadyCompleted) { + // Bug #401:使用更新前记录的原始状态判断,避免自身更新后将状态改为 COMPLETED 导致误判为"已完成" + if (!queueWasAlreadyCompleted) { try { LoginUser loginUser = SecurityUtils.getLoginUser(); DivLog divLog = new DivLog()