From 21ce122193e2fb57d206dbfca59e8d2ab2114fd0 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 23 三月 2026 17:12:56 +0800
Subject: [PATCH] 新增病区与科室组合
---
smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java | 27 +++++++++++++++------------
1 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
index 1d3a0a4..936fd83 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
@@ -10,10 +10,12 @@
import com.ruoyi.common.core.domain.entity.SysUserRole;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
+import com.smartor.common.DistinctByProperty;
import com.smartor.domain.*;
import com.smartor.mapper.*;
import com.smartor.service.IPatArchiveService;
import com.smartor.service.IPatMedInhospService;
+import com.smartor.service.IPatMedOuthospService;
import com.smartor.service.IServiceSLTDHealthcareRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@@ -30,6 +32,8 @@
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
+import java.util.stream.Collectors;
@Slf4j
@Service
@@ -45,7 +49,7 @@
private IPatMedInhospService patMedInhospService;
@Autowired
- private PatMedOuthospMapper patMedOuthospMapper;
+ private IPatMedOuthospService patMedOuthospService;
@Autowired
private SysUser2Mapper sysUser2Mapper;
@@ -484,7 +488,7 @@
private Boolean outHospitalDate(List<ServiceSLTDInhospResDTO> resultList) {
List<PatMedOuthosp> batchList = new ArrayList<>();
-
+
for (ServiceSLTDInhospResDTO dto : resultList) {
if (Objects.isNull(dto)) {
continue;
@@ -493,22 +497,21 @@
PatMedOuthosp patMedOuthosp = buildPatMedOuthosp(dto, patArchive);
batchList.add(patMedOuthosp);
}
-
+
// 鎵归噺鎻掑叆锛岃嚜鍔ㄥ拷鐣ラ噸澶�
if (CollectionUtils.isNotEmpty(batchList)) {
try {
- int insertCount = patMedOuthospMapper.batchInsertIgnore(batchList);
+ //杩欓噷鐢ㄨ嚜鍔ㄥ拷鐣ラ噸澶嶄細鏈夐棶棰橈紝濡傛灉琛ㄩ噸鏂板缓锛宻erialnum绱㈠紩浼氫涪澶便�傚氨鏃犳硶鍘婚噸锛屾墍浠ヨ繕鏄渶瑕佸唴瀛橀噷鍘婚噸
+ batchList = DistinctByProperty.distinctByProperty(batchList, PatMedOuthosp::getSerialnum);
+ Integer insertCount = 0;
+ for (PatMedOuthosp patMedOuthosp : batchList) {
+ insertCount += patMedOuthospService.insertPatMedOuthosp(patMedOuthosp);
+ }
+
log.info("鎵归噺鎻掑叆闂ㄦ�ヨ瘖璁板綍锛屾�绘暟锛歿}, 瀹為檯鎻掑叆锛歿}", batchList.size(), insertCount);
+
} catch (Exception e) {
log.error("鎵归噺鎻掑叆闂ㄦ�ヨ瘖璁板綍澶辫触", e);
- // 闄嶇骇涓洪�愭潯鎻掑叆
- for (PatMedOuthosp patMedOuthosp : batchList) {
- try {
- patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp);
- } catch (Exception ex) {
- log.warn("鍗曟潯鎻掑叆澶辫触锛歴erialnum={}", patMedOuthosp.getSerialnum());
- }
- }
}
}
return true;
--
Gitblit v1.9.3