|
@@ -14,6 +14,7 @@ import java.time.LocalDateTime;
|
|
|
import java.time.YearMonth;
|
|
import java.time.YearMonth;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@Component
|
|
@Component
|
|
|
public class HandleData {
|
|
public class HandleData {
|
|
@@ -34,12 +35,17 @@ public class HandleData {
|
|
|
@Value("${resultWithUnit}")
|
|
@Value("${resultWithUnit}")
|
|
|
private String resultWithUnit;
|
|
private String resultWithUnit;
|
|
|
|
|
|
|
|
|
|
+ @Value("${pushDate}")
|
|
|
|
|
+ private String pushDate;
|
|
|
|
|
+
|
|
|
public static final Map<String, String> RerunSampleField = new HashMap<>();
|
|
public static final Map<String, String> RerunSampleField = new HashMap<>();
|
|
|
|
|
|
|
|
public static final Map<String, String> UnControlReportField = new HashMap<>();
|
|
public static final Map<String, String> UnControlReportField = new HashMap<>();
|
|
|
|
|
|
|
|
public static final Map<String, String> PositionTransferField = new HashMap<>();
|
|
public static final Map<String, String> PositionTransferField = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
+ public static final Map<String, String> DepartmentLeaderField = new HashMap<>();
|
|
|
|
|
+
|
|
|
static {
|
|
static {
|
|
|
// 静态初始化块中填充数据
|
|
// 静态初始化块中填充数据
|
|
|
RerunSampleField.put("CREATEBY", "bian_zhi_ren_");
|
|
RerunSampleField.put("CREATEBY", "bian_zhi_ren_");
|
|
@@ -87,7 +93,12 @@ public class HandleData {
|
|
|
PositionTransferField.put("Y009",""); //茂源急诊(夜班)
|
|
PositionTransferField.put("Y009",""); //茂源急诊(夜班)
|
|
|
PositionTransferField.put("Y036","文化路院区"); //文化大检验(夜班)
|
|
PositionTransferField.put("Y036","文化路院区"); //文化大检验(夜班)
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ DepartmentLeaderField.put("1353738806028664832","1353762416025927680"); //生化免疫组 刘文
|
|
|
|
|
+ DepartmentLeaderField.put("1353739566586003456","1353762457495011328"); //临检组 梁骑
|
|
|
|
|
+ DepartmentLeaderField.put("1353739652615372800","1353762484493746176"); //微生物组 张红
|
|
|
|
|
+ DepartmentLeaderField.put("1353739725613039616","1353762508984287232"); //分子组 许媛
|
|
|
|
|
+ DepartmentLeaderField.put("1353739809322958848","1353762523634991104"); //文化路院区 马强
|
|
|
|
|
+ DepartmentLeaderField.put("1353739909701042176","1353762541930545152"); //医疗助理组 杨珣
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -664,6 +675,121 @@ public class HandleData {
|
|
|
}
|
|
}
|
|
|
return matchList;
|
|
return matchList;
|
|
|
}
|
|
}
|
|
|
|
|
+ public void AbilityMonitor(){
|
|
|
|
|
+ // 1. 转为 Set 便于 O(1) 查询
|
|
|
|
|
+ Set<String> pushDates = new HashSet<>(Arrays.asList(pushDate.split(",")));
|
|
|
|
|
+ // 2. 获取当前日期的 MMdd 格式
|
|
|
|
|
+ String todayMMDD = LocalDate.now().format(DateTimeFormatter.ofPattern("MMdd"));
|
|
|
|
|
+ // 3. 判断是否匹配
|
|
|
|
|
+ if (pushDates.contains(todayMMDD)) {
|
|
|
|
|
+ log.info("in abilitymonitor day!");
|
|
|
|
|
+// Timestamp currentTimestamp = getCurTime("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ //先取全部监督内容,后面不用再多次去数据库获取
|
|
|
|
|
+ List<Map<String, Object>> contentList = ibpsRepository.getMonitorContent();
|
|
|
|
|
+ List<Map<String, Object>> employeeList = ibpsRepository.getAllUser();
|
|
|
|
|
+ for (Map<String, Object> employeeMap : employeeList) {
|
|
|
|
|
+ String userID = (String) employeeMap.get("ID_");
|
|
|
|
|
+ String userName = (String) employeeMap.get("NAME_");
|
|
|
|
|
+ String depIDStr = (String) employeeMap.get("POSITIONS_");
|
|
|
|
|
+ if (depIDStr == null || depIDStr.trim().isEmpty()) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 按逗号分割,去除前后空格(防御性编程)
|
|
|
|
|
+ String[] depIDs = depIDStr.split(",");
|
|
|
|
|
+ for (String depID : depIDs) {
|
|
|
|
|
+ depID = depID.trim(); // 去除可能的空格,如 "dept1, dept2"
|
|
|
|
|
+ if (depID.isEmpty()) {
|
|
|
|
|
+ continue; // 跳过空片段(例如末尾多逗号:"a,b,")
|
|
|
|
|
+ }
|
|
|
|
|
+ // 每条数据:userID, userName, depID
|
|
|
|
|
+ String monitorUser = DepartmentLeaderField.get(depID);
|
|
|
|
|
+ if (monitorUser != null) {
|
|
|
|
|
+ List<Map<String, Object>> insertList = new ArrayList<Map<String, Object>>();
|
|
|
|
|
+ Map<String, Object> insertMap = new HashMap<>();
|
|
|
|
|
+ List<Map<String, Object>> monitorItemList = getMonitorItem(contentList, depID);
|
|
|
|
|
+ if (monitorItemList != null) {
|
|
|
|
|
+ //先插主表 t_lhryjdjlb
|
|
|
|
|
+ String mainID = UUID.randomUUID().toString();
|
|
|
|
|
+ insertMap.put("id_", mainID);
|
|
|
|
|
+ insertMap.put("create_by_",monitorUser);
|
|
|
|
|
+ insertMap.put("bian_zhi_ren_",monitorUser);
|
|
|
|
|
+ insertMap.put("create_time_",getCurTime("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ insertMap.put("shi_fou_guo_shen_","待推送");
|
|
|
|
|
+ insertMap.put("bian_zhi_bu_men_",depID);
|
|
|
|
|
+ insertMap.put("bian_zhi_shi_jian",String.valueOf(getCurTime("yyyy-MM-dd HH:mm:ss")));
|
|
|
|
|
+ insertMap.put("bei_jian_du_ren_y",userID);
|
|
|
|
|
+ insertMap.put("zhi_liang_jian_du","检验员");
|
|
|
|
|
+ insertMap.put("jian_du_gang_wei_","1382414549667282944"); //固定岗位:检验员id
|
|
|
|
|
+ String curDay = String.valueOf(getCurTime("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ insertMap.put("jian_ce_shi_jian_",curDay.split(" ")[0]);
|
|
|
|
|
+ insertMap.put("jian_du_kai_shi_s",curDay.split(" ")[0]);
|
|
|
|
|
+ insertMap.put("jian_du_jie_shu_s",curDay.split(" ")[0]);
|
|
|
|
|
+ insertMap.put("shi_wu_shuo_ming_","被监督人员:"+userName+",监督事由:在岗检验人员每季度定期监督,监督岗位:检验员");
|
|
|
|
|
+ insertMap.put("yi_jian_","该人员能力符合相关要求。");
|
|
|
|
|
+ insertMap.put("jian_du_fang_shi_","观察操作");
|
|
|
|
|
+ insertMap.put("jian_du_shi_you_","在岗检验人员每季度定期监督");
|
|
|
|
|
+ insertList.add(insertMap);
|
|
|
|
|
+// log.info(insertList.toString());
|
|
|
|
|
+// String retValue = "success";
|
|
|
|
|
+ String retValue = ibpsRepository.saveToTable(insertList,"t_lhryjdjlb","1");
|
|
|
|
|
+ if(retValue.equals("success")){
|
|
|
|
|
+ log.info("success insert into lhryjdjlb:"+insertList.size()+" datas");
|
|
|
|
|
+ //再插子表 t_lhryjdjlzb
|
|
|
|
|
+ List<Map<String, Object>> insertChildList = new ArrayList<Map<String, Object>>();
|
|
|
|
|
+ Integer sequenceCounter = 0;
|
|
|
|
|
+ String orderedId = "";
|
|
|
|
|
+ Timestamp createTime = getCurTime("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ for (Map<String, Object> monitorItem : monitorItemList) {
|
|
|
|
|
+ Map<String, Object> insertChildMap = new HashMap<>();
|
|
|
|
|
+ orderedId = mainID+"@"+String.valueOf(sequenceCounter); // 自增序列号
|
|
|
|
|
+ sequenceCounter++;
|
|
|
|
|
+ insertChildMap.put("id_", orderedId);
|
|
|
|
|
+ insertChildMap.put("jian_du_xiang_mu_", monitorItem.get("DIR"));
|
|
|
|
|
+ insertChildMap.put("jian_du_nei_rong_", monitorItem.get("DESCs"));
|
|
|
|
|
+ insertChildMap.put("jian_du_jie_guo_", "是");
|
|
|
|
|
+ insertChildMap.put("parent_id_", mainID);
|
|
|
|
|
+ insertChildMap.put("create_time_", createTime);
|
|
|
|
|
+ insertChildList.add(insertChildMap);
|
|
|
|
|
+ }
|
|
|
|
|
+// log.info(insertChildList.toString());
|
|
|
|
|
+// String retChildValue = "success";
|
|
|
|
|
+ String retChildValue = ibpsRepository.saveToTable(insertChildList,"t_lhryjdjlzb","1");
|
|
|
|
|
+ if(retValue.equals("success")){
|
|
|
|
|
+ log.info("success insert into lhryjdjlzb:"+insertChildList.size()+" datas");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.info("fail insert");
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.info("fail insert");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.info("not in abilitymonitor day");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public List<Map<String, Object>> getMonitorItem(List<Map<String, Object>> contentList, String depID) {
|
|
|
|
|
+ return contentList.stream()
|
|
|
|
|
+ .filter(map -> Objects.equals(depID, map.get("DEPID")))
|
|
|
|
|
+ .sorted(Comparator.comparingInt((Map<String, Object> map) -> {
|
|
|
|
|
+ Object xuHaoObj = map.get("SEQ");
|
|
|
|
|
+ if (xuHaoObj instanceof Number) {
|
|
|
|
|
+ return ((Number) xuHaoObj).intValue();
|
|
|
|
|
+ } else if (xuHaoObj instanceof String) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ return Integer.parseInt((String) xuHaoObj);
|
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
|
+ return Integer.MAX_VALUE;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return Integer.MAX_VALUE;
|
|
|
|
|
+ }
|
|
|
|
|
+ }).reversed())
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
public Timestamp getCurTime(String formartterStr){
|
|
public Timestamp getCurTime(String formartterStr){
|
|
|
LocalDateTime currentDateTime = LocalDateTime.now();
|
|
LocalDateTime currentDateTime = LocalDateTime.now();
|