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()