From 04d04154d9041535342736bd1c924ade5d818614 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期一, 09 十一月 2026 16:45:07 +0800
Subject: [PATCH] 合并修改com/ruoyi/quartz/task/RyTacom/ruoyi/quartz/task/RyTask.java:3sk.java:3com/ruoyi/quart/task/RyTask.java:3

---
 ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java b/ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java
index 33aa4c3..9f570dc 100644
--- a/ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java
+++ b/ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java
@@ -2459,7 +2459,10 @@
             if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
                 groupKey = drcode;
             } else {
-                groupKey = "deptcode";
+                // 2026-11 瀛楁閲嶅懡鍚嶅悗锛歞eptcode 鏄湪闄㈢瀹わ紙鍘嗗彶鏁版嵁涓虹┖锛夛紝
+                // 鍑洪櫌绉戝宸叉敼鍚嶄负 leaveldeptcode锛屽垎缁勫繀椤荤敤鍚庤�咃紝
+                // 鍚﹀垯 getSfStatisticsGroupKey 浼氳繑鍥� NULL锛屾嫾鎴� IN (NULL) 瀵艰嚧鏁磋〃鏌ョ┖銆�
+                groupKey = "leaveldeptcode";
             }
         } else if (serviceSubtaskCountReq.getStatisticaltype() != null && serviceSubtaskCountReq.getStatisticaltype() == 3) {
             // 鐥呯缁熻锛氭寜浠诲姟ID鍒嗙粍锛屾瘡涓换鍔″嵆涓�涓梾绉嶉殢璁夸换鍔�
@@ -2470,6 +2473,17 @@
         Map<String, List<ServiceSubtask>> collect = new HashMap<>();
         serviceSubtaskCountReq.setGroupKey(groupKey);
         List<String> groupKeyList = serviceSubtaskMapper.getSfStatisticsGroupKey(serviceSubtaskCountReq);
+        /*
+         * 鍒嗙粍閿彲鑳戒负 NULL锛堝巻鍙叉暟鎹�佹垨閲嶅懡鍚嶅悗灏氭湭鍥炲~鐨勫湪闄㈢淮搴﹀垪锛夛紝
+         * 鐩存帴鎷艰繘 SQL 浼氬彉鎴� `AND IFNULL(鍒�,'Unknown') IN (NULL)`锛屾亽涓嶆垚绔嬶紝鏁村紶缁熻琛ㄤ负绌恒��
+         * 杩欓噷缁熶竴鎴� 'Unknown'锛屼笌鑱氬悎 SQL 鐨� IFNULL(鍒�,'Unknown') 鍙e緞瀵归綈銆�
+         */
+        if (groupKeyList != null) {
+            groupKeyList = groupKeyList.stream()
+                    .map(key -> key == null ? "Unknown" : key)
+                    .distinct()
+                    .collect(Collectors.toList());
+        }
         serviceSubtaskCountReq.setGroupKeyList(groupKeyList);
         List<ServiceSubtask> rawData = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
         switch (groupKey) {
@@ -2484,6 +2498,7 @@
                 collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getManagementDoctorCode()).orElse("Unknown")));
                 break;
             case "deptcode":
+            case "leaveldeptcode":
                 collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeaveldeptcode()).orElse("Unknown")));
                 break;
             case "leavehospitaldistrictcode":

--
Gitblit v1.9.3