|
@@ -107,6 +107,10 @@ public class HandleData {
|
|
|
log.info("ready to analyse UnControl report");
|
|
log.info("ready to analyse UnControl report");
|
|
|
HandleUnControlReport(retList);
|
|
HandleUnControlReport(retList);
|
|
|
}
|
|
}
|
|
|
|
|
+ if (lisTable.equals("V_JT_InfectiousReport")){
|
|
|
|
|
+ log.info("ready to analyse infectious report");
|
|
|
|
|
+ HandleInfectiousReport(retList);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public List<Map<String, Object>> cleanExistData(String lisTable, List<Map<String, Object>> lisList, List<Map<String, Object>> existList) {
|
|
public List<Map<String, Object>> cleanExistData(String lisTable, List<Map<String, Object>> lisList, List<Map<String, Object>> existList) {
|
|
@@ -167,6 +171,27 @@ public class HandleData {
|
|
|
}
|
|
}
|
|
|
return resultList;
|
|
return resultList;
|
|
|
}
|
|
}
|
|
|
|
|
+ if (lisTable.equals("V_JT_InfectiousReport")) {
|
|
|
|
|
+ // 1. 创建Set存储existList中所有 tiao_ma_hao_ 的值(转换为字符串形式)
|
|
|
|
|
+ Set<String> existIdSet = new HashSet<>();
|
|
|
|
|
+// log.info("existList:"+existList);
|
|
|
|
|
+// log.info("lisList:"+lisList);
|
|
|
|
|
+ for (Map<String, Object> existMap : existList) {
|
|
|
|
|
+ Object idObj = existMap.get("tiao_ma_hao_");
|
|
|
|
|
+ existIdSet.add(idObj == null ? null : idObj.toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 2. 过滤lisList:只保留 SampleCode 不在 existIdSet 中的元素
|
|
|
|
|
+ List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
|
|
+ for (Map<String, Object> testMap : lisList) {
|
|
|
|
|
+ Object idObj = testMap.get("SAMPLECODE");
|
|
|
|
|
+ String idStr = idObj == null ? null : idObj.toString();
|
|
|
|
|
+ if (!existIdSet.contains(idStr)) {
|
|
|
|
|
+ resultList.add(testMap);
|
|
|
|
|
+// log.info("not exist,add:"+testMap);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return resultList;
|
|
|
|
|
+ }
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -441,6 +466,63 @@ public class HandleData {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public void HandleInfectiousReport(List<Map<String, Object>> retList){
|
|
|
|
|
+ if (retList.size() > 0) {
|
|
|
|
|
+ Timestamp currentTimestamp = getCurTime("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ long sequenceCounter = 0;
|
|
|
|
|
+ List<Map<String, Object>> insertList = new ArrayList<>();
|
|
|
|
|
+ for (Map<String, Object> retMap : retList) {
|
|
|
|
|
+ Map<String, Object> insertMap = new HashMap<>();
|
|
|
|
|
+ // 生成有序ID:时间戳+自增序列号
|
|
|
|
|
+ String orderedId = String.format("%d-%06d",
|
|
|
|
|
+ currentTimestamp.getTime(), // 使用时间戳
|
|
|
|
|
+ sequenceCounter++ // 自增序列号
|
|
|
|
|
+ );
|
|
|
|
|
+ insertMap.put("id_", orderedId);
|
|
|
|
|
+ insertMap.put("create_time_", currentTimestamp); // 直接使用Timestamp,避免字符串转换
|
|
|
|
|
+ String createUserInfo = ibpsRepository.getUserInfoByName(String.valueOf(retMap.get("REGISTERUSER")));
|
|
|
|
|
+ if(createUserInfo.contains("未找到")){
|
|
|
|
|
+ log.warn("createUserInfo:"+createUserInfo);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ String workGroupID = ibpsRepository.getPosiByCode(retMap.get("GROUPID").toString());
|
|
|
|
|
+ if(workGroupID.contains("-1")){
|
|
|
|
|
+ log.warn("workGroupID:"+workGroupID);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ insertMap.put("create_by_", createUserInfo.split("@")[0]);
|
|
|
|
|
+ insertMap.put("bian_zhi_ren_", createUserInfo.split("@")[0]);
|
|
|
|
|
+ insertMap.put("bian_zhi_shi_jian", String.valueOf(retMap.get("REGISTERDATE")));
|
|
|
|
|
+ insertMap.put("bian_zhi_bu_men_", workGroupID);
|
|
|
|
|
+ insertMap.put("di_dian_", ibpsRepository.getPosiByCode("LOCAL"));
|
|
|
|
|
+ insertMap.put("shi_fou_guo_shen_", "已完成");
|
|
|
|
|
+ insertMap.put("song_jian_ke_shi_", retMap.get("DEPARTMENT"));
|
|
|
|
|
+ insertMap.put("song_jian_yi_shen", retMap.get("DOCTOR"));
|
|
|
|
|
+ insertMap.put("bing_ren_xing_min", retMap.get("PATNAME"));
|
|
|
|
|
+ insertMap.put("xing_bie_", retMap.get("GENDER"));
|
|
|
|
|
+ insertMap.put("nian_ling_", retMap.get("AGE").toString().replace("岁",""));
|
|
|
|
|
+ insertMap.put("jian_yan_jie_guo_", retMap.get("REPORTRESULT"));
|
|
|
|
|
+ insertMap.put("bao_gao_ri_qi_", retMap.get("REPORTDATE"));
|
|
|
|
|
+ insertMap.put("feed_back_dr_time", retMap.get("FEEDBACKDOCTOR"));
|
|
|
|
|
+ insertMap.put("feed_back_hosp_ti", retMap.get("FEEDBACKDPHM"));
|
|
|
|
|
+ insertMap.put("tiao_ma_hao_", retMap.get("SAMPLECODE"));
|
|
|
|
|
+ insertList.add(insertMap);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!insertList.isEmpty()) {
|
|
|
|
|
+ String res = ibpsRepository.saveToTable(insertList, "t_crbbgdjb", "1");
|
|
|
|
|
+// String res = "success";
|
|
|
|
|
+ if ("success".equals(res)) {
|
|
|
|
|
+ log.info("table:t_crbbgdjb success insert: {} datas", insertList.size());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.error("fail insert t_crbbgdjb");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ log.info("No New Infectious Report exist!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// 辅助方法:安全获取字符串值,避免空指针异常
|
|
// 辅助方法:安全获取字符串值,避免空指针异常
|
|
|
private String getStringValue(Map<String, Object> map, String key) {
|
|
private String getStringValue(Map<String, Object> map, String key) {
|
|
|
Object value = map.get(key);
|
|
Object value = map.get(key);
|
|
@@ -582,4 +664,13 @@ public class HandleData {
|
|
|
}
|
|
}
|
|
|
return matchList;
|
|
return matchList;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public Timestamp getCurTime(String formartterStr){
|
|
|
|
|
+ LocalDateTime currentDateTime = LocalDateTime.now();
|
|
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern(formartterStr);
|
|
|
|
|
+ String formattedDateTime = currentDateTime.format(formatter);
|
|
|
|
|
+ Timestamp currentTimestamp = Timestamp.valueOf(formattedDateTime);
|
|
|
|
|
+ return currentTimestamp;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|