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;
|
|
@Autowired
|
private PatArchiveMapper patArchiveMapper;
|
|
|
@Override
|
public List<PatArchive> 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<PatMedInhosp> patMedInhospList = hnGatherPatArchiveMapper.selectPatMedInhospList(patMedInhosp);
|
for (PatMedInhosp pm : patMedInhospList) {
|
String patno = pm.getPatno();
|
PatArchive patArchive = new PatArchive();
|
//先去我们自己的表里通过patno查询该患者是否存在
|
patArchive.setPatientno(patno);
|
List<PatArchive> patArchives = patArchiveMapper.selectPatArchiveList(patArchive);
|
if (CollectionUtils.isEmpty(patArchives)) {
|
//不存在,则通过patno去HIS表hzjbxx查询
|
List<PatArchive> patArchives1 = hnGatherPatArchiveMapper.selectPatArchiveList(patArchive);
|
//把查询出来的数据存到pat_archive表
|
PatArchive pa = patArchives1.get(0);
|
pa.setId(null);
|
patArchiveMapper.insertPatArchiveSingle(pa);
|
pm.setPatid(pa.getId());
|
} else {
|
//直接将patid放到出入院表中
|
pm.setPatid(patArchives.get(0).getId());
|
}
|
}
|
if (patMedInhospList != null && !patMedInhospList.isEmpty()) {
|
patMedInhospMapper.insertPatMedInhospBatch(patMedInhospList);
|
}
|
}
|
|
return null;
|
}
|
|
@Override
|
public Integer selectPatMedOuthospList(PatMedOuthosp patMedOuthosp) {
|
List<PatMedOuthosp> patMedOuthosps = hnGatherPatArchiveMapper.selectPatMedOuthospList(patMedOuthosp);
|
log.info("selectPatMedOuthospList的采集到的数量为:{}", patMedOuthosps.size());
|
int i = patMedOuthospMapper.batchPatMedOuthosp(patMedOuthosps);
|
|
return i;
|
}
|
|
@Override
|
public Integer selectIcd10List(Icd10 icd10) {
|
List<Icd10> icd10s = hnGatherPatArchiveMapper.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);
|
log.info("sysUserList的采集到的数量为:{}", sysUserList.size());
|
int i = sysUser2Mapper.batchUser(sysUserList);
|
return i;
|
}
|
|
@Override
|
public Integer selectDeptList(SysDept dept) {
|
List<SysDept> sysDepts = hnGatherPatArchiveMapper.selectDeptList(dept);
|
log.info("selectDeptList的采集到的数量为:{}", sysDepts.size());
|
int i = sysDept2Mapper.batchDept(sysDepts);
|
return i;
|
}
|
}
|