From e6456d2196b3e57bd06be0fbc74dd3e0fc28fdeb Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 22 七月 2025 19:17:55 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java |  143 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 143 insertions(+), 0 deletions(-)

diff --git a/smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java
new file mode 100644
index 0000000..78f7303
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/service/impl/HNGatherPatArchiveServiceImpl.java
@@ -0,0 +1,143 @@
+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;
+
+/**
+ * 鎮h�呮。妗圫ervice涓氬姟灞傚鐞�
+ *
+ * @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鍘籋IS琛╤zjbxx鏌ヨ
+                    List<PatArchive> patArchives1 = hnGatherPatArchiveMapper.selectPatArchiveList(patArchive);
+                    //鎶婃煡璇㈠嚭鏉ョ殑鏁版嵁瀛樺埌pat_archive琛�
+                    PatArchive pa = patArchives1.get(0);
+                    pa.setId(null);
+                    patArchiveMapper.insertPatArchiveSingle(pa);
+                    pm.setPatid(pa.getId());
+                } else {
+                    //鐩存帴灏唒atid鏀惧埌鍑哄叆闄㈣〃涓�
+                    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;
+    }
+}
+

--
Gitblit v1.9.3