feat: 广东省中医预住院病历合并

master
wyb 10 months ago
parent 157d4e8a39
commit b846e821db

@ -0,0 +1,26 @@
package com.docus.server.archive.entity;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author jersey
* @since 2023-11-28
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="TBasicExtend对象", description="病案额外信息")
public class BasicExtend implements Serializable {
private static final long serialVersionUID = 1L;
private String patientId;
private String preJzh;
}

@ -2,6 +2,7 @@ package com.docus.server.archive.mapper;
import com.docus.server.archive.entity.AfCollectTask;
import com.docus.server.archive.entity.BasicExtend;
import com.docus.server.archive.entity.TBasic;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -32,4 +33,10 @@ public interface TBasicMapper {
int updateTaskById(@Param("task") AfCollectTask task);
List<String> findFailedTaskPatId(@Param("collectorId") String collectorId,@Param("startDate") String startDateStr);
List<BasicExtend> getZyPatientIdsByYzyJzh(@Param("preJzhs") List<String> preJzhs);
int mergeYzyFile(@Param("yzhPatientId") String yzhPatientId, @Param("zyPatientId") String zyPatientId);
List<String> getYzyPatientIdFromScanAssort();
}

@ -0,0 +1,35 @@
package com.docus.server.gdszy.controller;
import com.docus.core.util.Func;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.gdszy.service.GdSzyFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;
import java.util.List;
/**
* @author YongBin Wen
* @date 2024/9/26 9:18
*/
@RestController
@RequestMapping("/gdszyy")
@Api(tags = "广东省中医文件接口")
public class GdSzyFileController {
@Autowired
private GdSzyFileService gdSzyFileService;
@PostMapping("/yzyreport/merge")
@ApiOperation("预住院报告合并,传预住院的患者主键")
public CommonResult<String> yzyReportMerge(@RequestBody List<String> patientIds) {
if(Func.isNotEmpty(patientIds)){
gdSzyFileService.yzyReportMerge(patientIds);
}
return CommonResult.success("合并完成!");
}
}

@ -0,0 +1,48 @@
package com.docus.server.gdszy.job;
import com.docus.core.util.Func;
import com.docus.server.archive.mapper.TBasicMapper;
import com.docus.server.gdszy.service.GdSzyFileService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author YongBin Wen
* @date 2024/7/12 15:22
*/
@Component
@Slf4j
public class YzyMergeJob {
@Autowired
private TBasicMapper tBasicMapper;
@Autowired
private GdSzyFileService gdSzyFileService;
/**
* 广 job
*
* @date 2024/9/26 9:49
* @author YongBin Wen
*/
@XxlJob("GdSzyYzyMergeJob")
public void gdSzyYzyMergeJob() {
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>广东省中医院,预住院患者文件合并,开始任务!");
try {
List<String> yzyPatientIds = tBasicMapper.getYzyPatientIdFromScanAssort();
log.info("文件表 查询到:{} 个预住院患者!", yzyPatientIds.size());
if (Func.isNotEmpty(yzyPatientIds)) {
gdSzyFileService.yzyReportMerge(yzyPatientIds);
}
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>广东省中医院,预住院患者文件合并,结束任务!");
} catch (Exception ex) {
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>广东省中医院,预住院患者文件合并,任务异常!" + ex.getMessage(), ex);
}
}
}

@ -0,0 +1,16 @@
package com.docus.server.gdszy.service;
import java.util.List;
/**
* @author YongBin Wen
* @date 2024/9/26 9:22
*/
public interface GdSzyFileService {
/**
*
*
* @param patientIds
*/
void yzyReportMerge(List<String> patientIds);
}

@ -0,0 +1,47 @@
package com.docus.server.gdszy.service.impl;
import com.docus.core.util.Func;
import com.docus.server.archive.entity.BasicExtend;
import com.docus.server.archive.entity.TBasic;
import com.docus.server.archive.mapper.TBasicMapper;
import com.docus.server.gdszy.service.GdSzyFileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author YongBin Wen
* @date 2024/9/26 9:22
*/
@Service
@Slf4j
public class GdSzyFileServiceImpl implements GdSzyFileService {
@Autowired
private TBasicMapper tBasicMapper;
@Override
public void yzyReportMerge(List<String> patientIds) {
List<TBasic> yzyBasic = tBasicMapper.getTbasicByPatientIds(patientIds);
if (Func.isEmpty(yzyBasic)) {
return;
}
// 预住院患者信息的 jzh 关联额外表 preJzh查出对应住院的 patientId,根据预住院和住院的patientId进行文件合并文件表预住院的 patientId修改为住院 patientId
List<String> yzyJzh = yzyBasic.stream().map(TBasic::getJzh).collect(Collectors.toList());
List<BasicExtend> zyBasicExtend = tBasicMapper.getZyPatientIdsByYzyJzh(yzyJzh);
if (Func.isEmpty(zyBasicExtend)) {
return;
}
Map<String, String> yzyBasicJzhPatientIdMap = yzyBasic.stream().collect(Collectors.toMap(TBasic::getJzh, TBasic::getPatientId));
for (BasicExtend zyExtend : zyBasicExtend) {
String preJzh = zyExtend.getPreJzh();
String yzhPatientId = yzyBasicJzhPatientIdMap.get(preJzh);
String zyPatientId = zyExtend.getPatientId();
int number = tBasicMapper.mergeYzyFile(yzhPatientId, zyPatientId);
log.info("预住院文件patientId{} 合并到住院patientId: {} ,影响文件数量:{} 个", yzhPatientId, zyPatientId, number);
}
}
}

@ -126,7 +126,7 @@ xxl:
appname: docus-collect-file-data
address:
ip:
port: 19000
port: 19010
logretentiondays: 30
logpath: D:/xxl-job/docus-collect-file-data

@ -24,6 +24,10 @@
update docus_archivefile.af_collect_task set end_time=#{dateTime} where patient_id=#{patientId}
</update>
<update id="mergeYzyFile">
update docus_archivefile.t_scan_assort set patient_id=#{zyPatientId},assort_id = 'Wiw213woq412awqe42' where patient_id=#{yzhPatientId}
</update>
<delete id="deleteTaskByPatAndSource">
delete from docus_archivefile.af_collect_task where patient_id=#{patientId} and sysflag=#{collectorId}
</delete>
@ -72,5 +76,26 @@
and state not in('3','4')
group by patient_id
</select>
<select id="getZyPatientIdsByYzyJzh" resultType="com.docus.server.archive.entity.BasicExtend">
select patient_id,pre_jzh
from docus_medicalrecord.t_basic_extend
where pre_jzh in
<foreach collection="preJzhs" open="(" close=")" separator="," item="preJzh">
#{preJzh}
</foreach>
</select>
<select id="getYzyPatientIdFromScanAssort" resultType="java.lang.String">
select distinct patient_id
from docus_archivefile.t_scan_assort
where patient_id in (
select patient_id
from docus_medicalrecord.t_basic
where jzh in (
select pre_jzh
from docus_medicalrecord.t_basic_extend
where pre_jzh is not null
)
)
</select>
</mapper>

Loading…
Cancel
Save