From fe47ff909096722ba8e9172c3e1f0f7910b16909 Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期二, 21 十月 2025 14:49:18 +0800
Subject: [PATCH] 结束出院日期格式
---
smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java | 61 ++++++++++++++++++++++++++++++
1 files changed, 60 insertions(+), 1 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 2b4c671..3ae6888 100644
--- a/smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java
@@ -14,6 +14,9 @@
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.*;
/**
@@ -101,9 +104,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());
+ patMedInhospMapper.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 = patMedInhospMapper.selectPatMedInhospList(pmi);
+ if (CollectionUtils.isEmpty(patMedInhospList1)) {
+ pm.setCreateTime(new Date());
+ patMedInhospMapper.insertPatMedInhosp(pm);
+ } else {
+ pm.setInhospid(patMedInhospList1.get(0).getInhospid());
+ patMedInhospMapper.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;
}
@@ -125,6 +181,9 @@
if (CollectionUtils.isNotEmpty(patArchives1)) {
patMedOuthosp1.setPatid(patArchives1.get(0).getId());
} else {
+ if (CollectionUtils.isEmpty(patArchives)) {
+ continue;
+ }
patArchiveMapper.insertPatArchiveSingle(patArchives.get(0));
patMedOuthosp1.setPatid(patArchives.get(0).getId());
}
--
Gitblit v1.9.3