医共体定时任务新增死亡数据处理

This commit is contained in:
zhangheng 2026-04-01 17:42:58 +08:00
parent 63806418b6
commit f5f6751551
2 changed files with 21 additions and 4 deletions

View File

@ -20,6 +20,17 @@ public class TbFollowUp {
private String SFSJ; private String SFSJ;
private String MBID; private String MBID;
private String JZZDSM; private String JZZDSM;
/**
* 治疗结果
*/
private String ZLJG; private String ZLJG;
/**
*离院方式
*/
private String LYFS; private String LYFS;
/**
* death 死亡标志: 0 正常 1 死亡
*/
private String death;
private String death_date;
} }

View File

@ -75,6 +75,7 @@ public class MedicalConsortiumPlatformTask {
private GenerateSystemCodeUtil generateSystemCodeUtil; private GenerateSystemCodeUtil generateSystemCodeUtil;
@Value("${xinyilu-database.main_hospital}") @Value("${xinyilu-database.main_hospital}")
private Long mainHospitalId; private Long mainHospitalId;
static String sql = "SELECT * FROM tb_follow_up";
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void medicalConsortiumPlatformTask() { public void medicalConsortiumPlatformTask() {
@ -88,7 +89,7 @@ public class MedicalConsortiumPlatformTask {
// 2.获取连接 // 2.获取连接
Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@//172.19.116.212:1521/ORCL", "HK_ZJK", "DYWJWhkzjk5169"); Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@//172.19.116.212:1521/ORCL", "HK_ZJK", "DYWJWhkzjk5169");
// 3.创建Statement对象可以执行sql的对象 // 3.创建Statement对象可以执行sql的对象
PreparedStatement preparedStatement = connection.prepareStatement("select * from tb_follow_up"); PreparedStatement preparedStatement = connection.prepareStatement(sql);
// 4.获取结果集 // 4.获取结果集
ResultSet resultSet = preparedStatement.executeQuery(); ResultSet resultSet = preparedStatement.executeQuery();
// 5.对数据进行处理 // 5.对数据进行处理
@ -111,6 +112,7 @@ public class MedicalConsortiumPlatformTask {
followUp.setJZZDSM(resultSet.getString("JZZDSM")); followUp.setJZZDSM(resultSet.getString("JZZDSM"));
followUp.setZLJG(resultSet.getString("ZLJG")); followUp.setZLJG(resultSet.getString("ZLJG"));
followUp.setLYFS(resultSet.getString("LYFS")); followUp.setLYFS(resultSet.getString("LYFS"));
followUp.setDeath(resultSet.getString("DEATH"));
list.add(followUp); list.add(followUp);
} }
// 6.关闭连接 先调用的最后关闭 关闭前判断是否存在 // 6.关闭连接 先调用的最后关闭 关闭前判断是否存在
@ -125,12 +127,12 @@ public class MedicalConsortiumPlatformTask {
log.info("获取医共体数据" + list.size() + ""); log.info("获取医共体数据" + list.size() + "");
return; return;
} }
//筛选就诊号并根据就诊号查询数据库
List<String> collect = list.stream().filter(Objects::nonNull).map(TbFollowUp::getJZLSH).collect(Collectors.toList());
List<ExternalImport> dataExternalImports = externalImportMapper.selectExternalByPhone(collect);
//ExternalImport表 过滤姓名为空和就诊号为空的数据 //ExternalImport表 过滤姓名为空和就诊号为空的数据
list = list.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getJZLSH()) list = list.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getJZLSH())
&& StringUtils.isNotBlank(item.getXM()) && StringUtils.isNotBlank(item.getLXDH()) && StringUtils.isNotBlank(item.getZJHM())).collect(Collectors.toList()); && StringUtils.isNotBlank(item.getXM()) && StringUtils.isNotBlank(item.getLXDH()) && StringUtils.isNotBlank(item.getZJHM())).collect(Collectors.toList());
List<String> collect = list.stream().filter(Objects::nonNull).map(TbFollowUp::getJZLSH).collect(Collectors.toList());
//筛选就诊号并根据就诊号查询数据库
List<ExternalImport> dataExternalImports = externalImportMapper.selectExternalByPhone(collect);
List<ExternalImport> externalImports = new ArrayList<>(); List<ExternalImport> externalImports = new ArrayList<>();
//科室信息组装-新增不存在科室 //科室信息组装-新增不存在科室
Agency agency = agencyMapper.selectAgencyById(mainHospitalId); Agency agency = agencyMapper.selectAgencyById(mainHospitalId);
@ -178,6 +180,10 @@ public class MedicalConsortiumPlatformTask {
//遍历塞数据 //遍历塞数据
for (TbFollowUp tbFollowUp : list) { for (TbFollowUp tbFollowUp : list) {
//去除与数据库重复项 //去除与数据库重复项
if ((StringUtils.isNotBlank(tbFollowUp.getDeath()) && tbFollowUp.getDeath().equals("1")) || (StringUtils.isNotBlank(tbFollowUp.getLYFS()) && tbFollowUp.getLYFS().equals("死亡"))
|| (StringUtils.isNotBlank(tbFollowUp.getZLJG()) && tbFollowUp.getZLJG().equals("死亡"))) {
continue;
}
ExternalImport identicalVisitCode = dataExternalImports.stream().filter(item -> tbFollowUp.getJZLSH().equals(item.getVisitCode())).findFirst().orElse(new ExternalImport()); ExternalImport identicalVisitCode = dataExternalImports.stream().filter(item -> tbFollowUp.getJZLSH().equals(item.getVisitCode())).findFirst().orElse(new ExternalImport());
if (StringUtils.isNotBlank(identicalVisitCode.getPhone())) { if (StringUtils.isNotBlank(identicalVisitCode.getPhone())) {
continue; continue;