From a1e256f64930865ae2d170e333ee3f1a773c6c49 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 16 十月 2026 11:04:29 +0800
Subject: [PATCH] 出入院模块、门急诊模块、模块模块、宣教模块
---
smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java | 75 +++++++++++++++++++++++++++++++++++--
1 files changed, 70 insertions(+), 5 deletions(-)
diff --git a/smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java
index 2cb62f0..5699c5b 100644
--- a/smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java
@@ -6,14 +6,22 @@
import com.ruoyi.common.core.domain.entity.SysUserRole;
import com.ruoyi.common.utils.StringUtils;
import com.smartor.domain.*;
+import com.ruoyi.outpatientvisit.domain.PatMedOuthosp;
+import com.ruoyi.inhospvisit.api.InhospVisitFacade;
+import com.ruoyi.inhospvisit.domain.PatMedInhosp;
import com.smartor.mapper.*;
+import com.ruoyi.outpatientvisit.mapper.PatMedOuthospMapper;
import com.smartor.service.IHNGatherPatArchiveService;
+import com.smartor.service.IPatMedOuthospService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
import java.util.*;
/**
@@ -47,13 +55,13 @@
private PatMedOuthospMapper patMedOuthospMapper;
@Autowired
- private PatMedInhospMapper patMedInhospMapper;
+ private InhospVisitFacade inhospVisitFacade;
@Autowired
private PatArchiveMapper patArchiveMapper;
@Autowired
- private ThreadPoolTaskExecutor taskExecutor;
+ private IPatMedOuthospService patMedOuthospService;
@Autowired
private ShardingMapper shardingMapper;
@@ -101,9 +109,62 @@
patArchiveMapper.insertPatArchiveSingle(patArchives.get(0));
pm.setPatid(patArchives.get(0).getId());
}
- patMedInhospMapper.insertPatMedInhosp(pm);
+ if (!Objects.isNull(patMedInhosp.getStartInHospTime()) && !Objects.isNull(patMedInhosp.getEndInHospTime())) {
+ //鍏ラ櫌
+ pm.setInhospstate("0");
+ pm.setCreateTime(new Date());
+ inhospVisitFacade.insertPatMedInhosp(pm);
+ } else if (!Objects.isNull(patMedInhosp.getStartOutHospTime()) && !Objects.isNull(patMedInhosp.getEndOutHospTime())) {
+ //鍑洪櫌
+ pm.setInhospstate("1");
+ pm.setUpdateTime(new Date());
+ PatMedInhosp pmi = new PatMedInhosp();
+ pmi.setSerialnum(pm.getSerialnum());
+ List<PatMedInhosp> patMedInhospList1 = inhospVisitFacade.selectPatMedInhospList(pmi);
+ if (CollectionUtils.isEmpty(patMedInhospList1)) {
+ pm.setCreateTime(new Date());
+ inhospVisitFacade.insertPatMedInhosp(pm);
+ } else {
+ pm.setInhospid(patMedInhospList1.get(0).getInhospid());
+ inhospVisitFacade.updatePatMedInhosp(pm);
+ }
+
+ }
}
return 0;
+ }
+
+ @Override
+ public Boolean hnDataGather(HnDataGatherVO hnDataGatherVO) {
+
+ LocalDate startDate = hnDataGatherVO.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
+ LocalDate endDate = hnDataGatherVO.getEndTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
+
+ Integer po = null;
+ // 寰幆澶勭悊姣忎竴澶�
+ for (LocalDate currentDate = startDate; !currentDate.isAfter(endDate); currentDate = currentDate.plusDays(1)) {
+ PatMedInhosp dailyCondition = new PatMedInhosp();
+ //澶勭悊鍏ラ櫌
+ LocalDateTime dayStart = currentDate.atStartOfDay();
+ LocalDateTime dayEnd = currentDate.atTime(23, 59, 59);
+ dailyCondition.setStartInHospTime(Date.from(dayStart.atZone(ZoneId.systemDefault()).toInstant()));
+ dailyCondition.setEndInHospTime(Date.from(dayEnd.atZone(ZoneId.systemDefault()).toInstant()));
+ selectPatMedInhospList(dailyCondition);
+
+ //澶勭悊鍑洪櫌
+ dailyCondition.setStartInHospTime(null);
+ dailyCondition.setEndInHospTime(null);
+ dailyCondition.setStartOutHospTime(Date.from(dayStart.atZone(ZoneId.systemDefault()).toInstant()));
+ dailyCondition.setEndOutHospTime(Date.from(dayEnd.atZone(ZoneId.systemDefault()).toInstant()));
+ selectPatMedInhospList(dailyCondition);
+
+ //澶勭悊闂ㄨ瘖
+ PatMedOuthosp patMedOuthosp = new PatMedOuthosp();
+ patMedOuthosp.setBeginTime(Date.from(dayStart.atZone(ZoneId.systemDefault()).toInstant()));
+ patMedOuthosp.setEndTime(Date.from(dayEnd.atZone(ZoneId.systemDefault()).toInstant()));
+ selectPatMedOuthospList(patMedOuthosp);
+ }
+ return true;
}
@@ -131,7 +192,7 @@
patArchiveMapper.insertPatArchiveSingle(patArchives.get(0));
patMedOuthosp1.setPatid(patArchives.get(0).getId());
}
- i = patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp1);
+ i = patMedOuthospService.insertPatMedOuthosp(patMedOuthosp1);
}
return i;
@@ -148,6 +209,9 @@
@Override
public Integer selectUserList(SysUser sysUser) {
List<SysUser> sysUserList = hnGatherPatArchiveMapper.selectUserList(sysUser);
+ if (CollectionUtils.isEmpty(sysUserList)) return null;
+
+
log.info("sysUserList鐨勯噰闆嗗埌鐨勬暟閲忎负锛歿}", sysUserList.size());
int i = sysUser2Mapper.batchUser(sysUserList);
for (SysUser sysUser1 : sysUserList) {
@@ -184,7 +248,8 @@
public Integer selectDeptList(SysDept dept) {
List<SysDept> sysDepts = hnGatherPatArchiveMapper.selectDeptList(dept);
log.info("selectDeptList鐨勯噰闆嗗埌鐨勬暟閲忎负锛歿}", sysDepts.size());
- int i = sysDept2Mapper.batchDept(sysDepts);
+ int i = 0;
+ if (CollectionUtils.isNotEmpty(sysDepts)) i = sysDept2Mapper.batchDept(sysDepts);
return i;
}
--
Gitblit v1.9.3