From ecbb6791ae00a8a4076715b87a941c0a8557fa03 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期二, 13 一月 2026 11:31:34 +0800
Subject: [PATCH] 【市一】采集出入院增加院区id

---
 ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml                  |    2 +-
 ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java |   24 ++++++++++++++++++++++++
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml                  |   18 ++++++++++++++----
 3 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java
index 444d91d..c0c38f9 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java
@@ -12,6 +12,7 @@
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Service;
 
@@ -67,6 +68,9 @@
     private static final long SHARDING_THRESHOLD = 5_000_000L;
     private static final String PAT_ARCHIVE_TABLE = "pat_archive";
     private static final String PAT_MED_INHOSP_TABLE = "pat_med_inhosp";
+
+    @Value("${spring.profiles.active}")
+    private String active;
 
 
     @Override
@@ -213,10 +217,20 @@
                 List<PatMedInhosp> patMedInhospList1 = patMedInhospMapper.selectPatMedInhospListBySerialnum(pmi);
                 if (patMedInhospList1.size() == 0) {
                     pm.setCreateTime(new Date());
+                    //甯備竴 闄㈠尯id瀵瑰簲orgid锛屾満鏋刬d涓洪粯璁ょ殑1
+                    if(active.equals("hzszlyy")) {
+                        pm.setCampusid(pm.getOrgid());
+                        pm.setOrgid("1");
+                    }
                     count += patMedInhospMapper.insertPatMedInhosp(pm);
                 } else {
                     pm.setInhospid(patMedInhospList1.get(0).getInhospid());
                     pm.setUpdateTime(new Date());
+                    //甯備竴 闄㈠尯id瀵瑰簲orgid锛屾満鏋刬d涓洪粯璁ょ殑1
+                    if(active.equals("hzszlyy")) {
+                        pm.setCampusid(pm.getOrgid());
+                        pm.setOrgid("1");
+                    }
                     count += patMedInhospMapper.updatePatMedInhosp(pm);
                 }
             } catch (Exception ex) {
@@ -270,9 +284,19 @@
                 if (patMedOuthospsTemp.size() > 0) {
                     patMedOuthosp1.setUpdateTime(new Date());
                     patMedOuthosp1.setId(patMedOuthospsTemp.get(0).getId());
+                    //甯備竴 闄㈠尯id瀵瑰簲orgid锛屾満鏋刬d涓洪粯璁ょ殑1
+                    if(active.equals("hzszlyy")) {
+                        patMedOuthosp1.setCampusid(patMedOuthosp1.getOrgid());
+                        patMedOuthosp1.setOrgid("1");
+                    }
                     count += patMedOuthospMapper.updatePatMedOuthosp(patMedOuthosp1);
                 } else {
                     patMedOuthosp1.setCreateTime(new Date());
+                    //甯備竴 闄㈠尯id瀵瑰簲orgid锛屾満鏋刬d涓洪粯璁ょ殑1
+                    if(active.equals("hzszlyy")) {
+                        patMedOuthosp1.setCampusid(patMedOuthosp1.getOrgid());
+                        patMedOuthosp1.setOrgid("1");
+                    }
                     count += patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp1);
                 }
             } catch (Exception ex) {
diff --git a/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml b/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml
index db2f651..dd3ebe6 100644
--- a/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml
+++ b/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml
@@ -630,7 +630,7 @@
         from healthy_user u
         where 1=1
             <if test="orgid != null and orgid != ''">
-                AND orgid = #{orgid}
+                AND u.orgid = #{orgid}
             </if>
             <if test="userId != null and userId != 0">
                 AND u.user_id = #{userId}
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index f75750b..6385d61 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -1203,8 +1203,12 @@
                 AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
             </if>
             <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
-            <if test="visitDeptName != null">abd visit_dept_name = #{visitDeptName}</if>
-            <if test="isabnormal != null">abd isabnormal = #{isabnormal}</if>
+            <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>
+            <if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
+            <!-- 鐩墠鍙粺璁¤闊冲拰闂嵎 -->
+            <if test="type != null">
+                and type = #{type}
+            </if>
     </select>
 
     <select id="getSfStatisticsJoy" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
@@ -1330,12 +1334,18 @@
 
     <select id="getSfStatisticsCategory" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
             resultMap="ServiceSubtaskResult2">
-        SELECT a.sub_id as subTaskId,
+        SELECT
         <if test="configValue != null and configValue != ''">
             SUM(CASE WHEN a.categoryid IN(${configValue})
             THEN 1 ELSE 0 END) AS joyAllCount,
         </if>
-        COUNT(sub_id) joyCount
+        <if test="configValue != null and configValue != ''">
+            SUM(CASE WHEN a.categoryid IN(${configValue})
+                AND a.matchedtext is not null
+                AND a.matchedtext != ''
+            THEN 1 ELSE 0 END) AS joyCount,
+        </if>
+        a.sub_id as subTaskId
         FROM service_subtask_detail a
         INNER JOIN service_subtask t ON a.sub_id = t.id
         where 1=1

--
Gitblit v1.9.3