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 480402f04..e2a76a5e5 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 @@ -343,19 +343,24 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer } // 写入 div_log 审计日志(独立于队列项,确保每次完诊都生成记录) - try { - LoginUser loginUser = SecurityUtils.getLoginUser(); - DivLog divLog = new DivLog() - .setPoolId(divPoolId) - .setSlotId(divSlotId) - .setOpUserId(loginUser != null ? loginUser.getUserId() : null) - .setAction("COMPLETE") - .setCreateTime(LocalDateTime.now()) - .setUpdateAt(LocalDateTime.now()) - .setCreatedAt(LocalDateTime.now()); - divLogService.save(divLog); - } catch (Exception e) { - log.error("写入div_log审计日志失败", e); + // 防重复:若队列项已是 COMPLETED 状态,说明护士站已处理过并写过分诊日志,不再重复写入 + boolean queueAlreadyCompleted = queueItem != null + && TriageQueueStatus.COMPLETED.getValue().equals(queueItem.getStatus()); + if (!queueAlreadyCompleted) { + try { + LoginUser loginUser = SecurityUtils.getLoginUser(); + DivLog divLog = new DivLog() + .setPoolId(divPoolId) + .setSlotId(divSlotId) + .setOpUserId(loginUser != null ? loginUser.getUserId() : null) + .setAction("COMPLETE") + .setCreateTime(LocalDateTime.now()) + .setUpdateAt(LocalDateTime.now()) + .setCreatedAt(LocalDateTime.now()); + divLogService.save(divLog); + } catch (Exception e) { + log.error("写入div_log审计日志失败", e); + } } // 4. 更新状态、完成时间以及初复诊标识 diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/dto/CurrentDayEncounterTencentDto.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/dto/CurrentDayEncounterTencentDto.java index c5df33d69..3cae9d7ea 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/dto/CurrentDayEncounterTencentDto.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/dto/CurrentDayEncounterTencentDto.java @@ -138,4 +138,12 @@ public class CurrentDayEncounterTencentDto { */ private String englishName; + /** 号源池ID(用于分诊队列 div_log 审计日志) */ + @JsonSerialize(using = ToStringSerializer.class) + private Long poolId; + + /** 号源槽位ID(用于分诊队列 div_log 审计日志) */ + @JsonSerialize(using = ToStringSerializer.class) + private Long slotId; + } diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/tencentJH/TencentAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/tencentJH/TencentAppMapper.xml index d180d84c4..3b19750d6 100755 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/tencentJH/TencentAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/tencentJH/TencentAppMapper.xml @@ -27,7 +27,9 @@ T9.payment_id, T9.picture_url, T9.birth_date, - t9.english_name + t9.english_name, + t9.slot_id, + t9.pool_id from ( SELECT T1.tenant_id AS tenant_id, T1.id AS encounter_id, @@ -51,7 +53,9 @@ T13.id AS payment_id, ai.picture_url AS picture_url, T8.birth_date AS birth_date, - tx.staff_english_name AS english_name + tx.staff_english_name AS english_name, + om_slot.slot_id AS slot_id, + om_slot.pool_id AS pool_id FROM adm_encounter AS T1 LEFT JOIN adm_organization AS T2 ON T1.organization_id = T2.ID AND T2.delete_flag = '0' LEFT JOIN adm_healthcare_service AS T3 ON T1.service_type_id = T3.ID AND T3.delete_flag = '0' @@ -91,6 +95,8 @@ AND T13.status_enum = ${paymentStatus} LEFT JOIN adm_invoice AS ai ON ai.reconciliation_id = T13.id AND ai.delete_flag = '0' + LEFT JOIN order_main AS om ON T1.order_id = om.id AND om.delete_flag = '0' + LEFT JOIN adm_schedule_slot AS om_slot ON om.slot_id = om_slot.id WHERE T1.delete_flag = '0' AND T1.class_enum = #{classEnum} AND T10.context_enum = #{register}