liusheng
5 天以前 42fb200e5c378ab7090e3aa4627faee8912eb67d
Merge remote-tracking branch 'origin/master'
已添加1个文件
已修改2个文件
已重命名2个文件
152 ■■■■ 文件已修改
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/CollectHISController.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ICollectHISService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/CollectHISController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,69 @@
package com.ruoyi.quartz.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.quartz.service.ICollectHISService;
import com.smartor.domain.HnDataGatherVO;
import com.smartor.domain.Icd10;
import com.smartor.service.IHNGatherPatArchiveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/monitor/his")
@Api(description = "采集患者信息接口")
public class CollectHISController extends BaseController {
    @Autowired
    private ICollectHISService ichService;
    /**
     * æ²³å—数据采集
     */
    @PostMapping("/collect")
    @ApiOperation("同步病人相关数据")
    public AjaxResult hnDataGather(@RequestBody HnDataGatherVO hnDataGatherVO) {
        log.info("开始按天同步用户数据,时间范围: {} åˆ° {}", hnDataGatherVO.getStartTime(), hnDataGatherVO.getEndTime());
        Boolean aBoolean = ichService.hnDataGather(hnDataGatherVO);
        return AjaxResult.success(aBoolean);
    }
    /**
     * æŸ¥è¯¢ç–¾ç—…列表数据采集
     */
    @PostMapping("/collectIcd10")
    @ApiOperation("同步标准诊断")
    public AjaxResult selectIcd10List(@RequestBody Icd10 icd10) {
        Integer integer = ichService.selectIcd10List(icd10);
        return AjaxResult.success(integer);
    }
    /**
     * ç”¨æˆ·ä¿¡æ¯é›†åˆä¿¡æ¯æ•°æ®é‡‡é›†
     */
    @PostMapping("/collectUser")
    @ApiOperation("同步用户信息")
    public AjaxResult selectUserList(@RequestBody SysUser sysUser) {
        Integer integer = ichService.selectUserList(sysUser);
        return AjaxResult.success(integer);
    }
    /**
     * éƒ¨é—¨ä¿¡æ¯é›†åˆä¿¡æ¯æ•°æ®é‡‡é›†
     */
    @PostMapping("/collectDept")
    @ApiOperation("同步科室信息")
    public AjaxResult selectDeptList(@RequestBody SysDept sysDept) {
        Integer integer = ichService.selectDeptList(sysDept);
        return AjaxResult.success(integer);
    }
}
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ICollectHISService.java
ÎļþÃû´Ó ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ICollectHISMapperService.java ÐÞ¸Ä
@@ -6,7 +6,7 @@
import java.util.List;
public interface ICollectHISMapperService {
public interface ICollectHISService {
    /**
     * æŸ¥è¯¢æ‚£è€…档案列表
     *
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java
ÎļþÃû´Ó ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISMapperServiceImpl.java ÐÞ¸Ä
@@ -1,21 +1,16 @@
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;
@@ -27,9 +22,9 @@
@Slf4j
@Service
public class CollectHISMapperServiceImpl implements ICollectHISMapperService {
public class CollectHISServiceImpl implements ICollectHISService {
    @Autowired
    private HNGatherPatArchiveMapper hnGatherPatArchiveMapper;
    private CollectHISMapper chMapper;
    @Autowired
    private SysUser2Mapper sysUser2Mapper;
@@ -68,7 +63,7 @@
    @Override
    public List<PatArchive> selectPatArchiveList(PatArchive patArchive) {
        return hnGatherPatArchiveMapper.selectPatArchiveList(patArchive);
        return chMapper.selectPatArchiveList(patArchive);
    }
//    @Override
@@ -86,11 +81,11 @@
    @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;
@@ -104,7 +99,27 @@
                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;
    }
@@ -119,16 +134,25 @@
        // å¾ªçŽ¯å¤„ç†æ¯ä¸€å¤©
        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;
    }
@@ -136,14 +160,14 @@
    @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();
@@ -166,7 +190,7 @@
    @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;
@@ -174,14 +198,14 @@
    @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<>();
@@ -190,7 +214,7 @@
            //新增用户与部门
            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());
@@ -209,7 +233,7 @@
    @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;
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -14,8 +14,7 @@
import com.ruoyi.common.utils.RSAPublicKeyExample;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.quartz.service.ICollectHISMapperService;
import com.ruoyi.quartz.service.impl.CollectHISMapperServiceImpl;
import com.ruoyi.quartz.service.ICollectHISService;
import com.smartor.common.LSHospTokenUtil;
import com.smartor.domain.*;
import com.smartor.mapper.HeLibraryMapper;
@@ -87,6 +86,10 @@
    @Autowired
    private HeLibraryMapper heLibraryMapper;
    @Autowired
    private ICollectHISService ichService;
    @Value("${localIP}")
    private String localIP;
@@ -134,7 +137,7 @@
    IXHGatherPatArchiveService ixhGatherPatArchiveService;
    @Autowired
    ICollectHISMapperService icollectHis;
    ICollectHISService icollectHis;
    @Value("${appid}")
@@ -770,7 +773,7 @@
            // HIS数据采集
            HnDataGatherVO hnDataGatherVO = new HnDataGatherVO();
            log.info("【dealHisData】HIS开始采集数据");
            ihnGatherPatArchiveService.hnDataGather(hnDataGatherVO);
            ichService.hnDataGather(hnDataGatherVO);
            log.info("【dealHisData】HIS结束采集数据");
        } catch (Exception e) {
            log.error("【dealHisData】HIS数据采集异常", e);
smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
@@ -54,6 +54,7 @@
        <result property="patid" column="patid"/>
        <result property="guid" column="guid"/>
        <result property="extemplateText" column="extemplate_text"/>
        <result property="answerps" column="answerps"/>
    </resultMap>
    <resultMap type="com.smartor.domain.ServiceSubtaskDetailTarget" id="ServiceSubtaskDetailTargetResult">
        <result property="targetid" column="targetid"/>
@@ -111,7 +112,8 @@
               update_by,
               update_time,
               value_type,
               create_by
               create_by,
               answerps
        from service_subtask_detail
    </sql>