liusheng
2 天以前 1e1814178edf84090b28492bbad340ab13e5c169
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
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<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);
            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;
    }
}