package com.smartor.service.impl; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.exception.base.BaseException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DtoConversionUtils; import com.ruoyi.common.utils.StringUtils; import com.smartor.domain.*; import com.smartor.mapper.*; import com.smartor.service.IHNGatherPatArchiveService; import com.smartor.service.IPatArchiveService; import com.smartor.service.IPatMedInhospService; import com.smartor.service.IPatMedPhysicalService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.poi.hssf.usermodel.HSSFDateUtil; import org.apache.poi.ss.usermodel.DataFormatter; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import java.io.FileOutputStream; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.stream.Collectors; /** * 患者档案Service业务层处理 * * @author smartor * @date 2023-03-04 */ @Slf4j @Service public class HNGatherPatArchiveServiceImpl implements IHNGatherPatArchiveService { @Autowired private HNGatherPatArchiveMapper hnGatherPatArchiveMapper; @Autowired private SysUser2Mapper sysUser2Mapper; @Autowired private SysDept2Mapper sysDept2Mapper; @Autowired private Icd10Mapper icd10Mapper; @Autowired private PatMedOuthospMapper patMedOuthospMapper; @Autowired private PatMedInhospMapper patMedInhospMapper; @Override public List selectPatArchiveList(PatArchive patArchive) { return hnGatherPatArchiveMapper.selectPatArchiveList(patArchive); } @Override public Integer selectPatMedInhospList(PatMedInhosp patMedInhosp) { Long count = hnGatherPatArchiveMapper.selectPatMedInhospListCount(null); Long aa = (count + 1000 - 1) / 1000; //进行分页查询 for (int i = 0; i <= aa; i++) { patMedInhosp.setPs(1000); patMedInhosp.setPn(1000 * i); List patMedInhospList = hnGatherPatArchiveMapper.selectPatMedInhospList(patMedInhosp); if (patMedInhospList != null && !patMedInhospList.isEmpty()) { patMedInhospMapper.insertPatMedInhospBatch(patMedInhospList); } } return null; } @Override public Integer selectPatMedOuthospList(PatMedOuthosp patMedOuthosp) { List patMedOuthosps = hnGatherPatArchiveMapper.selectPatMedOuthospList(patMedOuthosp); log.info("selectPatMedOuthospList的采集到的数量为:{}", patMedOuthosps.size()); int i = patMedOuthospMapper.batchPatMedOuthosp(patMedOuthosps); return i; } @Override public Integer selectIcd10List(Icd10 icd10) { List icd10s = hnGatherPatArchiveMapper.selectIcd10List(icd10); log.info("selectIcd10List的采集到的数量为:{}", icd10s.size()); int i = icd10Mapper.batchIcd10(icd10s); return i; } @Override public Integer selectUserList(SysUser sysUser) { List sysUserList = hnGatherPatArchiveMapper.selectUserList(sysUser); log.info("sysUserList的采集到的数量为:{}", sysUserList.size()); int i = sysUser2Mapper.batchUser(sysUserList); return i; } @Override public Integer selectDeptList(SysDept dept) { List sysDepts = hnGatherPatArchiveMapper.selectDeptList(dept); log.info("selectDeptList的采集到的数量为:{}", sysDepts.size()); int i = sysDept2Mapper.batchDept(sysDepts); return i; } }