9a6ae1d105033b057f58586723c78ae86ad3cfc9..bd0634ddee19487b1f82e782ff1fa9f18cb88a3d
2026-06-09 陈昶聿
【市一】手术随访对接
bd0634 对比 | 目录
2026-06-09 陈昶聿
【市一】手术随访对接
2f684b 对比 | 目录
2026-06-09 陈昶聿
【市一】手术随访对接
6e397c 对比 | 目录
2026-06-09 陈昶聿
【市一】手术随访对接
a0fb49 对比 | 目录
已修改15个文件
296 ■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedInhospController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/BaseDictOperation.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatMedOperation.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatMedOperationItem.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceTaskoper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/PatMedOperationItemMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IPatMedInhospService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedInhospController.java
@@ -246,4 +246,14 @@
            }
        }
    }
    /**
     * 处理患者信息,进入子任务表
     */
    @ApiOperation("addOperationSubTask")
    @PostMapping("/addOperationSubTask")
    public void addOperationSubTask() {
        String config = configService.selectConfigByKey("visit.early.day");
        iPatMedInhospService.addOperationSubTask(config);
    }
}
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java
@@ -334,9 +334,22 @@
        patMedOperation.setLastStartTime(startTime);
        patMedOperation.setLastEndTime(endTime);
        List<PatMedOperation> patMedOperations = chMapper.selectOperList(patMedOperation);
        Map<String, Long> patIdHisMap = buildOperationPatIdHisMap(patMedOperations);
        log.info("同步手术信息数量" + patMedOperations.size());
        for (PatMedOperation operation : patMedOperations) {
            try {
                Long patId = patIdHisMap.get(operation.getPatidHis());
                if (patId == null) {
                    patId = syncSinglePatient(operation.getPatidHis());
                    if (patId != null) {
                        patIdHisMap.put(operation.getPatidHis(), patId);
                    }
                }
                if (patId != null) {
                    operation.setPatid(patId);
                }
                PatMedOperation oper = new PatMedOperation();
                oper.setOpid(operation.getOpid());
                List<PatMedOperation> patMedOperations1 = patMedOperationMapper.selectPatMedOperationList(oper);
@@ -368,7 +381,9 @@
        PatMedOperationItem patMedOperationItem = new PatMedOperationItem();
        patMedOperationItem.setOrgid(operation.getOrgid());
        if(StringUtils.isNotEmpty(operation.getOpid())){
            patMedOperationItem.setOpid(Long.valueOf(operation.getOpid()));
            patMedOperationItem.setOpid(operation.getOpid());
            patMedOperationItem.setLastStartTime(operation.getLastStartTime());
            patMedOperationItem.setLastEndTime(operation.getLastEndTime());
            List<PatMedOperationItem> patMedOperationItems = chMapper.selectOperItemList(patMedOperationItem);
            log.info("同步手术详情信息数量" + patMedOperationItems.size());
            for (PatMedOperationItem operationItem : patMedOperationItems) {
@@ -389,9 +404,68 @@
                    log.info("同步手术详情信息:" + ex.getMessage());
                }
            }
//            try {
//                patMedOperationItemMapper.deleteHardPatMedOperationItemByOpId(operation.getOpid());
//                count += patMedOperationItemMapper.insertPatMedOperationItems(patMedOperationItems);
//            }catch (Exception ex) {
//                log.info("同步手术详情信息:" + ex.getMessage());
//            }
        }
        return count;
    }
    private Map<String, Long> buildOperationPatIdHisMap(List<PatMedOperation> operations) {
        List<String> patidHiss = operations.stream()
                .map(PatMedOperation::getPatidHis)
                .filter(StringUtils::isNotEmpty)
                .distinct()
                .collect(Collectors.toList());
        if (CollectionUtils.isEmpty(patidHiss)) {
            return new HashMap<>();
        }
        return patArchiveMapper.selectPatArchiveByPatidHiss(patidHiss).stream()
                .filter(item -> StringUtils.isNotEmpty(item.getPatidHis()) && item.getId() !=
                        null)
                .collect(Collectors.toMap(
                        PatArchive::getPatidHis,
                        PatArchive::getId,
                        (a, b) -> a
                ));
    }
    private Long syncSinglePatient(String patidHis) {
        if (StringUtils.isEmpty(patidHis)) {
            return null;
        }
        PatArchive hisQuery = new PatArchive();
        hisQuery.setPatidHis(patidHis);
        hisQuery.setPageSize(5);
        List<PatArchive> hisArchives = chMapper.selectPatArchiveList(hisQuery);
        if (CollectionUtils.isEmpty(hisArchives)) {
            return null;
        }
        PatArchive localQuery = new PatArchive();
        localQuery.setPatidHis(patidHis);
        List<PatArchive> localArchives = patArchiveMapper.selectPatArchiveList(localQuery);
        PatArchive hisArchive = hisArchives.get(0);
        if (CollectionUtils.isNotEmpty(localArchives)) {
            hisArchive.setId(localArchives.get(0).getId());
            hisArchive.setUpdateTime(new Date());
            patArchiveMapper.updatePatArchive(hisArchive);
            return localArchives.get(0).getId();
        } else {
            hisArchive.setCreateTime(new Date());
            patArchiveMapper.insertPatArchiveSingle(hisArchive);
            return hisArchive.getId();
        }
    }
    @Override
    public Integer selectPatMedInhospList(PatMedInhosp patMedInhosp) {
        List<PatMedInhosp> patMedInhospList = chMapper.selectPatMedInhospList(patMedInhosp);
ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml
@@ -226,7 +226,7 @@
    <resultMap type="com.smartor.domain.PatMedOuthosp" id="PatMedOuthospResult">
        <result property="id" column="id"/>
        <result property="serialnum" column="serialnum"/>
        <result property="patid" column="patid"/>
        <result property="patidHis" column="patid"/>
        <result property="hospitalname" column="hospitalname"/>
        <result property="hospitalcode" column="hospitalcode"/>
        <result property="icd10code" column="icd10code"/>
@@ -338,7 +338,7 @@
    <resultMap type="com.smartor.domain.PatMedOperation" id="PatMedOperationResult">
        <result property="id" column="id"/>
        <result property="patid" column="patid"/>
        <result property="patidHis" column="patid_his"/>
        <result property="patcode" column="patcode"/>
        <result property="paname" column="paname"/>
        <result property="opreqid" column="opreqid"/>
@@ -626,9 +626,7 @@
        b.patname,
        b.out_way_id,
        b.out_way_name,
        (CASE WHEN b.inhospstate = '1' THEN '1'
            WHEN b.inhospstate = '3' THEN '1'
            ELSE b.inhospstate END) AS inhospstate,
        b.inhospstate,
        b.patno,
        b.inhospno,
        b.serialnum,
@@ -819,7 +817,7 @@
    <select id="selectOperList" parameterType="com.smartor.domain.PatMedOperation"
            resultMap="PatMedOperationResult">
        select
        o.patid,
        o.patid_his,
        o.patcode,
        o.paname,
        o.opreqid,
@@ -885,17 +883,18 @@
        o.vopcode ,
        o.opdesc,
        o.oplevelcode ,
        o.opleveldesc
        o.opleveldesc,
        o.last_Update_Time
        from HEALTHY_PAT_MED_OPERATION o
        where 1=1
        <if test="orgid != null and orgid != ''">
            AND o.orgid = #{orgid}
        </if>
        <if test="lastStartTime != null and lastStartTime != ''">
            and to_char(o.opreqtime, 'YYYY-MM-DD HH24:MI:SS') >= #{lastStartTime}
            and to_char(o.last_Update_Time, 'YYYY-MM-DD HH24:MI:SS') >= #{lastStartTime}
        </if>
        <if test="lastEndTime != null and lastEndTime != ''">
            and to_char(o.opreqtime, 'YYYY-MM-DD HH24:MI:SS') &lt;= #{lastEndTime}
            and to_char(o.last_Update_Time, 'YYYY-MM-DD HH24:MI:SS') &lt;= #{lastEndTime}
        </if>
    </select>
@@ -924,7 +923,8 @@
               oi.guid,
               oi.pid,
               oi.opercheck_flag,
               oi.long_task_reason
               oi.long_task_reason,
               oi.last_Update_Time
        from HEALTHY_PAT_MED_OPERATION_ITEM oi
        where 1=1
        <if test="orgid != null and orgid != ''">
@@ -933,5 +933,11 @@
        <if test="opid != null and opid != ''">
            AND oi.opid = #{opid}
        </if>
        <if test="lastStartTime != null and lastStartTime != ''">
            and oi.last_Update_Time &gt;= to_date(#{lastStartTime}, 'YYYY-MM-DD HH24:MI:SS')
        </if>
        <if test="lastEndTime != null and lastEndTime != ''">
            and oi.last_Update_Time &lt;= to_date(#{lastEndTime}, 'YYYY-MM-DD HH24:MI:SS')
        </if>
    </select>
</mapper>
smartor/src/main/java/com/smartor/domain/BaseDictOperation.java
@@ -32,7 +32,7 @@
     */
    @ApiModelProperty("his手术id")
    @Excel(name = "his手术id")
    private Long opid;
    private String opid;
    /**
     * 手术名称ID
smartor/src/main/java/com/smartor/domain/PatMedOperation.java
@@ -35,6 +35,12 @@
    private Long patid;
    /**
     * his系统ID
     */
    @ApiModelProperty("his系统ID")
    private String patidHis;
    /**
     * 病人编号
     */
    @ApiModelProperty("病人编号")
smartor/src/main/java/com/smartor/domain/PatMedOperationItem.java
@@ -39,7 +39,7 @@
     */
    @ApiModelProperty("手术id")
    @Excel(name = "手术id")
    private Long opid;
    private String opid;
    /**
     * 手术名称ID
smartor/src/main/java/com/smartor/domain/ServiceTaskoper.java
@@ -57,7 +57,7 @@
     */
    @ApiModelProperty("手术id")
    @Excel(name = "手术id")
    private Long opid;
    private String opid;
    /**
     * 手术编码
smartor/src/main/java/com/smartor/mapper/PatArchiveMapper.java
@@ -26,6 +26,8 @@
    List<PatArchive> selectPatArchiveByPatnos(@Param("patnos") List<String> patnos);
    List<PatArchive> selectPatArchiveByPatidHiss(@Param("patidHiss") List<String> patidHiss);
    /**
     * 查询患者档案列表
     *
smartor/src/main/java/com/smartor/mapper/PatMedOperationItemMapper.java
@@ -38,6 +38,13 @@
    public int insertPatMedOperationItem(PatMedOperationItem patMedOperationItem);
    /**
     * 新增患者检查检验记录子
     *
     * @param patMedOperationItems 患者检查检验记录子
     * @return 结果
     */
    public int insertPatMedOperationItems(List<PatMedOperationItem> patMedOperationItems);
    /**
     * 修改患者检查检验记录子
     *
     * @param patMedOperationItem 患者检查检验记录子
@@ -60,4 +67,12 @@
     * @return 结果
     */
    public int deletePatMedOperationItemByIds(Long[] ids);
    /**
     * 删除患者检查检验记录子
     *
     * @param opid 患者检查检验记录子主键
     * @return 结果
     */
    public int deleteHardPatMedOperationItemByOpId(String opid);
}
smartor/src/main/java/com/smartor/service/IPatMedInhospService.java
@@ -115,4 +115,12 @@
     * @return
     */
    public List<PatMedInhosp> getDocAndPat(PatMedInhosp patMedInhosp);
    /**
     * 处理从his取来的手术信息
     *
     * @param
     * @return 结果
     */
    public void addOperationSubTask(String config);
}
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -788,9 +788,14 @@
        if (Objects.isNull(patMedOperationItem.getOplevelcode())) {
            return;
        }
        PatMedOperation patMedOperation = patMedOperationMapper.selectPatMedOperationById(patMedOperationItem.getOpid());
        if (Objects.isNull(patMedOperation)) {
        PatMedOperation patMedOperationVo = new PatMedOperation();
        PatMedOperation patMedOperation = new PatMedOperation();
        patMedOperationVo.setOpid(patMedOperationItem.getOpid());
        List<PatMedOperation> patMedOperationList = patMedOperationMapper.selectPatMedOperationList(patMedOperationVo);
        if (CollectionUtils.isEmpty(patMedOperationList)) {
            return;
        }else {
            patMedOperation = patMedOperationList.get(0);
        }
        PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOperation.getPatid());
        if (Objects.isNull(patArchive)) {
@@ -1167,7 +1172,8 @@
        }
    }
    private void addOperationSubTask(String config) {
    @Override
    public void addOperationSubTask(String config) {
        //            手术随访
        PatMedOperationItem pmoi = new PatMedOperationItem();
        //获取需要出院疾病随访,未处理的数据
smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -1423,7 +1423,7 @@
            Boolean addMianTableFalg = true;
            for (ExternalOperationDetail externalOperationDetail : externalOperationDetails) {
                PatMedOperationItem patMedOperationItem = new PatMedOperationItem();
                patMedOperationItem.setOpid(patMedOperation.getId());
                patMedOperationItem.setOpid(patMedOperation.getOpid());
                patMedOperationItem.setOpcode(externalOperationDetail.getShouShuMCID());
                patMedOperationItem.setOpdesc(externalOperationDetail.getShouShuMC());
                patMedOperationItem.setMainFlag(externalOperationDetail.getZhuShouSBZ());
smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -283,6 +283,15 @@
        </foreach>
    </select>
    <select id="selectPatArchiveByPatidHiss" resultMap="PatArchiveResult">
        SELECT id, patid_his
        FROM pat_archive
        WHERE patid_his IN
        <foreach item="patidHis" collection="patidHiss" open="(" separator="," close=")">
            #{patidHis}
        </foreach>
    </select>
    <insert id="insertPatArchiveSingle" parameterType="com.smartor.domain.PatArchive" useGeneratedKeys="true"
            keyProperty="id">
        insert into pat_archive
smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml
@@ -96,11 +96,9 @@
            where id = #{id}
    </select>
    <insert id="insertPatMedOperationItem" parameterType="com.smartor.domain.PatMedOperationItem">
    <insert id="insertPatMedOperationItem" parameterType="com.smartor.domain.PatMedOperationItem" useGeneratedKeys="true" keyProperty="id">
        insert into pat_med_operation_item
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test="id != null">id,
                    </if>
                    <if test="operationid != null">operationid,
                    </if>
                    <if test="opid != null">opid,
@@ -149,8 +147,6 @@
                    </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                    <if test="id != null">#{id},
                    </if>
                    <if test="operationid != null">#{operationid},
                    </if>
                    <if test="opid != null">#{opid},
@@ -276,7 +272,110 @@
        where id = #{id}
    </update>
                <update id="deletePatMedOperationItemById" parameterType="Long">
    <insert id="insertPatMedOperationItems">
        insert into pat_med_operation_item
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="operationid != null">operationid,
            </if>
            <if test="opid != null">opid,
            </if>
            <if test="opcode != null">opcode,
            </if>
            <if test="opdesc != null">opdesc,
            </if>
            <if test="mainFlag != null">main_flag,
            </if>
            <if test="incitypecode != null">incitypecode,
            </if>
            <if test="incitypedesc != null">incitypedesc,
            </if>
            <if test="oplevelcode != null">oplevelcode,
            </if>
            <if test="opleveldesc != null">opleveldesc,
            </if>
            <if test="opposition != null">opposition,
            </if>
            <if test="delFlag != null">del_flag,
            </if>
            <if test="updateBy != null">update_by,
            </if>
            <if test="updateTime != null">update_time,
            </if>
            <if test="createBy != null">create_by,
            </if>
            <if test="createTime != null">create_time,
            </if>
            <if test="isupload != null">isupload,
            </if>
            <if test="uploadTime != null">upload_time,
            </if>
            <if test="orgid != null">orgid,
            </if>
            <if test="pguid != null">pguid,
            </if>
            <if test="guid != null">guid,
            </if>
            <if test="pid != null">pid,
            </if>
            <if test="opercheckFlag != null">opercheck_flag,
            </if>
            <if test="longTaskReason != null">long_task_reason,
            </if>
        </trim>
        values
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=")" suffixOverrides=",">
                <if test="operationid != null">#{item.operationid},
                </if>
                <if test="opid != null">#{item.opid},
                </if>
                <if test="opcode != null">#{item.opcode},
                </if>
                <if test="opdesc != null">#{item.opdesc},
                </if>
                <if test="mainFlag != null">#{item.mainFlag},
                </if>
                <if test="incitypecode != null">#{item.incitypecode},
                </if>
                <if test="incitypedesc != null">#{item.incitypedesc},
                </if>
                <if test="oplevelcode != null">#{item.oplevelcode},
                </if>
                <if test="opleveldesc != null">#{item.opleveldesc},
                </if>
                <if test="opposition != null">#{item.opposition},
                </if>
                <if test="delFlag != null">#{item.delFlag},
                </if>
                <if test="updateBy != null">#{item.updateBy},
                </if>
                <if test="updateTime != null">#{item.updateTime},
                </if>
                <if test="createBy != null">#{item.createBy},
                </if>
                <if test="createTime != null">#{item.createTime},
                </if>
                <if test="isupload != null">#{item.isupload},
                </if>
                <if test="uploadTime != null">#{item.uploadTime},
                </if>
                <if test="orgid != null">#{item.orgid},
                </if>
                <if test="pguid != null">#{item.pguid},
                </if>
                <if test="guid != null">#{item.guid},
                </if>
                <if test="pid != null">#{item.pid},
                </if>
                <if test="opercheckFlag != null">#{item.opercheckFlag},
                </if>
                <if test="longTaskReason != null">#{item.longTaskReason},
                </if>
            </trim>
        </foreach>
    </insert>
    <update id="deletePatMedOperationItemById" parameterType="Long">
        update pat_med_operation_item
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
@@ -284,7 +383,7 @@
        where  id = #{id}
    </update>
                            <update id="deletePatMedOperationItemByIds" parameterType="String">
    <update id="deletePatMedOperationItemByIds" parameterType="String">
        update  pat_med_operation_item
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
@@ -295,7 +394,10 @@
        </foreach>
    </update>
    <delete id="deleteHardPatMedOperationItemByOpId" parameterType="String">
        delete from pat_med_operation_item
               where opid = #{opid}
    </delete>
</mapper>
smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml
@@ -364,11 +364,9 @@
        where id = #{id}
    </select>
    <insert id="insertPatMedOperation" parameterType="com.smartor.domain.PatMedOperation">
    <insert id="insertPatMedOperation" parameterType="com.smartor.domain.PatMedOperation" useGeneratedKeys="true" keyProperty="id">
        insert into pat_med_operation
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,
            </if>
            <if test="patid != null">patid,
            </if>
            <if test="patcode != null">patcode,
@@ -511,8 +509,6 @@
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},
            </if>
            <if test="patid != null">#{patid},
            </if>
            <if test="patcode != null">#{patcode},