diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java index d18d54b66..957313188 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java @@ -341,7 +341,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService { && (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType()))) .collect(Collectors.toList()); - // 防重复保存:对新增医嘱进行去重,避免签发单条长期医嘱时产生重复记录 + // 防重复保存:对所有医嘱进行去重(包括 INSERT 和 UPDATE 混合场景),避免签发单条医嘱时产生重复记录 Set longUniqueKeySet = new HashSet<>(); List longUniqueList = new ArrayList<>(); for (RegAdviceSaveDto adviceSaveDto : longInsertOrUpdateList) { @@ -351,10 +351,10 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService { + adviceSaveDto.getDose() + "_" + adviceSaveDto.getMethodCode() + "_" + adviceSaveDto.getRateCode(); - if (DbOpType.INSERT.getCode().equals(adviceSaveDto.getDbOpType()) && longUniqueKeySet.contains(uniqueKey)) { - log.warn("防重复保存:检测到重复长期医嘱,跳过保存 - patientId={}, encounterId={}, adviceDefinitionId={}, dose={}", + if (longUniqueKeySet.contains(uniqueKey)) { + log.warn("防重复保存:检测到重复长期医嘱(跨操作类型),跳过 - patientId={}, encounterId={}, adviceDefinitionId={}, dbOpType={}", adviceSaveDto.getPatientId(), adviceSaveDto.getEncounterId(), - adviceSaveDto.getAdviceDefinitionId(), adviceSaveDto.getDose()); + adviceSaveDto.getAdviceDefinitionId(), adviceSaveDto.getDbOpType()); continue; } longUniqueKeySet.add(uniqueKey); @@ -429,7 +429,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService { && (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType()))) .collect(Collectors.toList()); - // 防重复保存:对新增医嘱进行去重 + // 防重复保存:对所有医嘱进行去重(包括 INSERT 和 UPDATE 混合场景),避免签发时产生重复记录 Set tempUniqueKeySet = new HashSet<>(); List tempUniqueList = new ArrayList<>(); for (RegAdviceSaveDto adviceSaveDto : tempInsertOrUpdateList) { @@ -439,10 +439,10 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService { + adviceSaveDto.getDose() + "_" + adviceSaveDto.getMethodCode() + "_" + adviceSaveDto.getRateCode(); - if (DbOpType.INSERT.getCode().equals(adviceSaveDto.getDbOpType()) && tempUniqueKeySet.contains(uniqueKey)) { - log.warn("防重复保存:检测到重复临时医嘱,跳过保存 - patientId={}, encounterId={}, adviceDefinitionId={}, dose={}", + if (tempUniqueKeySet.contains(uniqueKey)) { + log.warn("防重复保存:检测到重复临时医嘱(跨操作类型),跳过 - patientId={}, encounterId={}, adviceDefinitionId={}, dbOpType={}", adviceSaveDto.getPatientId(), adviceSaveDto.getEncounterId(), - adviceSaveDto.getAdviceDefinitionId(), adviceSaveDto.getDose()); + adviceSaveDto.getAdviceDefinitionId(), adviceSaveDto.getDbOpType()); continue; } tempUniqueKeySet.add(uniqueKey); diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml index 3aa27ecbd..dbd2b1cd9 100755 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml @@ -155,7 +155,7 @@ ii.performer_check_id, ii.category_code, ii.dispense_status - FROM (( SELECT T1.encounter_id, + FROM (( SELECT DISTINCT T1.encounter_id, T1.tenant_id, #{medMedicationRequest} AS advice_table, T1.id AS request_id, @@ -293,7 +293,7 @@ T1.sort_number, T1.group_id ) UNION - ( SELECT T1.encounter_id, + ( SELECT DISTINCT T1.encounter_id, T1.tenant_id, #{worServiceRequest} AS advice_table, T1.id AS request_id,