| | |
| | | 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.getStartOutHospTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | LocalDate endDate = hnDataGatherVO.getEndOutHospTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | 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())); |
| | | Integer pi = selectPatMedInhospList(dailyCondition); |
| | | selectPatMedInhospList(dailyCondition); |
| | | |
| | | //处理门诊 |
| | | PatMedOuthosp patMedOuthosp = new PatMedOuthosp(); |
| | | patMedOuthosp.setBeginTime(Date.from(dayStart.atZone(ZoneId.systemDefault()).toInstant())); |
| | | patMedOuthosp.setEndTime(Date.from(dayEnd.atZone(ZoneId.systemDefault()).toInstant())); |
| | | po = selectPatMedOuthospList(patMedOuthosp); |
| | | selectPatMedOuthospList(patMedOuthosp); |
| | | } |
| | | return true; |
| | | } |