From 2a84c2668423b49aa8a53d5a090c96f93a90b96c Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期五, 23 一月 2026 10:47:16 +0800
Subject: [PATCH] 【丽水】门诊数据同步增加院区id
---
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 104 +++++++++++++++++++++++++++------------------------
1 files changed, 55 insertions(+), 49 deletions(-)
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
index c1605f2..068d985 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -2228,33 +2228,43 @@
@Override
@Cacheable(value = "sfStatistics", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()")
public List<ServiceSubtaskStatistic> getSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq) {
- //todo
log.info("getSfStatistics鐨勫叆鍙備负锛歿}", serviceSubtaskCountReq);
- List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>();
- List<ServiceSubtask> rawData = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
-
- // 鏍规嵁鏉′欢杩涜鍒嗙粍
- Map<String, List<ServiceSubtask>> collect = new HashMap<>();
-
- String groupKeyType = "";
+ String groupKey = "drcode";
if (serviceSubtaskCountReq.getLeavehospitaldistrictcodes() != null && !serviceSubtaskCountReq.getLeavehospitaldistrictcodes().isEmpty()) {
if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
- groupKeyType = "drCode";
- collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrcode()).orElse("Unknown")));
+ groupKey = "drcode";
} else {
- groupKeyType = "leaveHospitalDistrictCode";
- collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictcode()).orElse("Unknown")));
+ groupKey = "leavehospitaldistrictcode";
}
} else if (serviceSubtaskCountReq.getDeptcodes() != null && !serviceSubtaskCountReq.getDeptcodes().isEmpty()) {
if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
- groupKeyType = "drCode";
- collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrcode()).orElse("Unknown")));
+ groupKey = "drcode";
} else {
- groupKeyType = "deptCode";
- collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptcode()).orElse("Unknown")));
+ groupKey = "deptcode";
}
}
- serviceSubtaskCountReq.setGroupKeyType(groupKeyType);
+ List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>();
+ // 鏍规嵁鏉′欢杩涜鍒嗙粍
+ Map<String, List<ServiceSubtask>> collect = new HashMap<>();
+ serviceSubtaskCountReq.setGroupKey(groupKey);
+ List<String> groupKeyList = serviceSubtaskMapper.getSfStatisticsGroupKey(serviceSubtaskCountReq);
+ serviceSubtaskCountReq.setGroupKeyList(groupKeyList);
+ List<ServiceSubtask> rawData = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
+ switch (groupKey)
+ {
+ case "deptcode":
+ collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptcode()).orElse("Unknown")));
+ break;
+ case "drcode":
+ collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrcode()).orElse("Unknown")));
+ break;
+ case "leavehospitaldistrictcode":
+ collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictcode()).orElse("Unknown")));
+ break;
+ default:
+ collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrcode()).orElse("Unknown")));
+ break;
+ }
//鑾峰彇鍙婃椂鐜囩粺璁″悎闆�
Map<String, Map<String, Object>> jsRates = getSsRateForSfStatistics(serviceSubtaskCountReq, collect);
for (String collectKey : collect.keySet()) {
@@ -2290,8 +2300,8 @@
if(ObjectUtils.isEmpty(serviceSubtaskCountReq)){
return null;
}
- String groupKeyType = serviceSubtaskCountReq.getGroupKeyType();
- if(StringUtils.isEmpty(groupKeyType)){
+ String groupKey = serviceSubtaskCountReq.getGroupKey();
+ if(StringUtils.isEmpty(groupKey)){
return null;
}
List<String> groupKeyList = new ArrayList<>(collect.keySet());
@@ -2306,25 +2316,8 @@
if (serviceSubtaskCountReq.getEndTime() != null && new Date().before(serviceSubtaskCountReq.getEndTime())) {
ssRate.setEndtime(new Date());
}
- switch (groupKeyType)
- {
- case "deptCode":
- ssRate.setGroupKey("deptcode");
- ssRate.setGroupKeyList(groupKeyList);
- break;
- case "drCode":
- ssRate.setGroupKey("drcode");
- ssRate.setGroupKeyList(groupKeyList);
- break;
- case "leaveHospitalDistrictCode":
- ssRate.setGroupKey("leavehospitaldistrictcode");
- ssRate.setGroupKeyList(groupKeyList);
- break;
- default:
- ssRate.setGroupKey("drcode");
- ssRate.setGroupKeyList(groupKeyList);
- break;
- }
+ ssRate.setGroupKey(groupKey);
+ ssRate.setGroupKeyList(groupKeyList);
Map<String, Map<String, Object>> jsRates = new HashMap<>();
if(!collect.isEmpty()){
jsRates = serviceSubtaskMapper.selectTimelyRateBatch(ssRate);
@@ -3131,29 +3124,42 @@
public List<ServiceSubtaskStatistic> getSfStatisticsScript(ServiceSubtaskCountReq serviceSubtaskCountReq) {
log.info("getSfStatisticsScript鐨勫叆鍙備负锛歿}", serviceSubtaskCountReq);
List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>();
- List<ServiceSubtask> rawData = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
// 鏍规嵁鏉′欢杩涜鍒嗙粍
Map<String, List<ServiceSubtask>> collect = new HashMap<>();
- String groupKeyType = "";
+ String groupKey = "drcode";
if (serviceSubtaskCountReq.getLeavehospitaldistrictcodes() != null && !serviceSubtaskCountReq.getLeavehospitaldistrictcodes().isEmpty()) {
if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
- groupKeyType = "drCode";
- collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrcode()).orElse("Unknown")));
+ groupKey = "drcode";
} else {
- groupKeyType = "leaveHospitalDistrictCode";
- collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictcode()).orElse("Unknown")));
+ groupKey = "leavehospitaldistrictcode";
}
} else if (serviceSubtaskCountReq.getDeptcodes() != null && !serviceSubtaskCountReq.getDeptcodes().isEmpty()) {
if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
- groupKeyType = "drCode";
- collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrcode()).orElse("Unknown")));
+ groupKey = "drcode";
} else {
- groupKeyType = "deptCode";
- collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptcode()).orElse("Unknown")));
+ groupKey = "deptcode";
}
}
- serviceSubtaskCountReq.setGroupKeyType(groupKeyType);
+ serviceSubtaskCountReq.setGroupKey(groupKey);
+ List<String> groupKeyList = serviceSubtaskMapper.getSfStatisticsGroupKey(serviceSubtaskCountReq);
+ serviceSubtaskCountReq.setGroupKeyList(groupKeyList);
+ List<ServiceSubtask> rawData = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
+ switch (groupKey)
+ {
+ case "deptcode":
+ collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptcode()).orElse("Unknown")));
+ break;
+ case "drcode":
+ collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrcode()).orElse("Unknown")));
+ break;
+ case "leavehospitaldistrictcode":
+ collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictcode()).orElse("Unknown")));
+ break;
+ default:
+ collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrcode()).orElse("Unknown")));
+ break;
+ }
//鑾峰彇鍙婃椂鐜囩粺璁″悎闆�
Map<String, Map<String, Object>> jsRates = getSsRateForSfStatistics(serviceSubtaskCountReq, collect);
for (String collectKey : collect.keySet()) {
--
Gitblit v1.9.3