ÎļþÃû´Ó ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISMapperServiceImpl.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.quartz.service.impl; |
| | | |
| | | import com.ruoyi.common.annotation.DataSource; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.entity.SysUserDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUserRole; |
| | | import com.ruoyi.common.enums.DataSourceType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.quartz.mapper.CollectHISMapper; |
| | | import com.ruoyi.quartz.service.ICollectHISMapperService; |
| | | import com.ruoyi.quartz.service.ICollectHISService; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.*; |
| | | import com.smartor.service.impl.PatArchiveServiceImpl; |
| | | import com.smartor.service.impl.PatMedInhospServiceImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class CollectHISMapperServiceImpl implements ICollectHISMapperService { |
| | | public class CollectHISServiceImpl implements ICollectHISService { |
| | | @Autowired |
| | | private HNGatherPatArchiveMapper hnGatherPatArchiveMapper; |
| | | private CollectHISMapper chMapper; |
| | | |
| | | @Autowired |
| | | private SysUser2Mapper sysUser2Mapper; |
| | |
| | | |
| | | @Override |
| | | public List<PatArchive> selectPatArchiveList(PatArchive patArchive) { |
| | | return hnGatherPatArchiveMapper.selectPatArchiveList(patArchive); |
| | | return chMapper.selectPatArchiveList(patArchive); |
| | | } |
| | | |
| | | // @Override |
| | |
| | | |
| | | @Override |
| | | public Integer selectPatMedInhospList(PatMedInhosp patMedInhosp) { |
| | | List<PatMedInhosp> patMedInhospList = hnGatherPatArchiveMapper.selectPatMedInhospList(patMedInhosp); |
| | | List<PatMedInhosp> patMedInhospList = chMapper.selectPatMedInhospList(patMedInhosp); |
| | | for (PatMedInhosp pm : patMedInhospList) { |
| | | PatArchive patArchive = new PatArchive(); |
| | | patArchive.setPatientno(pm.getPatno()); |
| | | List<PatArchive> patArchives = hnGatherPatArchiveMapper.selectPatArchiveList(patArchive); |
| | | List<PatArchive> patArchives = chMapper.selectPatArchiveList(patArchive); |
| | | if (CollectionUtils.isEmpty(patArchives)) { |
| | | //空äºç´æ¥ä¸¢æ |
| | | continue; |
| | |
| | | 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; |
| | | } |
| | |
| | | // 循ç¯å¤çæ¯ä¸å¤© |
| | | 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; |
| | | } |
| | |
| | | |
| | | @Override |
| | | public Integer selectPatMedOuthospList(PatMedOuthosp patMedOuthosp) { |
| | | List<PatMedOuthosp> patMedOuthosps = hnGatherPatArchiveMapper.selectPatMedOuthospList(patMedOuthosp); |
| | | List<PatMedOuthosp> patMedOuthosps = chMapper.selectPatMedOuthospList(patMedOuthosp); |
| | | log.info("selectPatMedOuthospListçééå°çæ°é为ï¼{}", patMedOuthosps.size()); |
| | | Integer i = null; |
| | | for (PatMedOuthosp patMedOuthosp1 : patMedOuthosps) { |
| | | //è·åæ£è
åºæ¬ä¿¡æ¯ |
| | | PatArchive patArchive = new PatArchive(); |
| | | patArchive.setPatientno(patMedOuthosp1.getPatno()); |
| | | List<PatArchive> patArchives = hnGatherPatArchiveMapper.selectPatArchiveList(patArchive); |
| | | List<PatArchive> patArchives = chMapper.selectPatArchiveList(patArchive); |
| | | |
| | | //æ ¹æ®patno夿æ¬å°æ£è
åºæ¬ä¿¡æ¯æ¯å¦åå¨ |
| | | PatArchive pa = new PatArchive(); |
| | |
| | | |
| | | @Override |
| | | public Integer selectIcd10List(Icd10 icd10) { |
| | | List<Icd10> icd10s = hnGatherPatArchiveMapper.selectIcd10List(icd10); |
| | | List<Icd10> icd10s = chMapper.selectIcd10List(icd10); |
| | | log.info("selectIcd10Listçééå°çæ°é为ï¼{}", icd10s.size()); |
| | | int i = icd10Mapper.batchIcd10(icd10s); |
| | | return i; |
| | |
| | | |
| | | @Override |
| | | public Integer selectUserList(SysUser sysUser) { |
| | | List<SysUser> sysUserList = hnGatherPatArchiveMapper.selectUserList(sysUser); |
| | | List<SysUser> sysUserList = chMapper.selectUserList(sysUser); |
| | | log.info("sysUserListçééå°çæ°é为ï¼{}", sysUserList.size()); |
| | | int i = sysUser2Mapper.batchUser(sysUserList); |
| | | for (SysUser sysUser1 : sysUserList) { |
| | | log.info("sysUser1çID为ï¼{}", sysUser1.getUserId()); |
| | | log.info("sysUser1çHISUSERID为ï¼{}", sysUser1.getHisUserId()); |
| | | //æ°å¢ç¨æ·ä¸è§è² |
| | | SysUserRole yhyjsxx = hnGatherPatArchiveMapper.yhyjsxx(sysUser1); |
| | | SysUserRole yhyjsxx = chMapper.yhyjsxx(sysUser1); |
| | | if (yhyjsxx == null) continue; |
| | | yhyjsxx.setUserId(sysUser1.getUserId()); |
| | | List<SysUserRole> userRoleList = new ArrayList<>(); |
| | |
| | | |
| | | //æ°å¢ç¨æ·ä¸é¨é¨ |
| | | if (StringUtils.isEmpty(sysUser1.getHisUserId())) continue; |
| | | SysUserDept sysUserDept = hnGatherPatArchiveMapper.yhyksxx(sysUser1); |
| | | SysUserDept sysUserDept = chMapper.yhyksxx(sysUser1); |
| | | if (Objects.isNull(sysUserDept) || sysUserDept.getDeptId() == null) continue; |
| | | SysDept dept = new SysDept(); |
| | | dept.setHisDeptId(sysUserDept.getDeptId().toString()); |
| | |
| | | |
| | | @Override |
| | | public Integer selectDeptList(SysDept dept) { |
| | | List<SysDept> sysDepts = hnGatherPatArchiveMapper.selectDeptList(dept); |
| | | List<SysDept> sysDepts = chMapper.selectDeptList(dept); |
| | | log.info("selectDeptListçééå°çæ°é为ï¼{}", sysDepts.size()); |
| | | int i = sysDept2Mapper.batchDept(sysDepts); |
| | | return i; |