From 2ed0ca8b57481a2c647d163380a3ff4997fd2f35 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期三, 17 十二月 2025 10:17:48 +0800
Subject: [PATCH] 【丽水】首页查询出、入院看病人次和人数,出院服务量分为首次服务、再次服务、专病服务

---
 smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml |  108 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 104 insertions(+), 4 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
index f873005..540e215 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -920,11 +920,18 @@
     <select id="selectPatMedInhospCount" parameterType="com.smartor.domain.PatMedReq"
             resultType="com.smartor.domain.PatMedRes">
         SELECT SUM( rs ) AS rs,
-        SUM( rc ) AS rc
+        SUM( rc ) AS rc,
+        SUM( scsf ) AS scsf,
+        SUM( zcsf ) AS zcsf,
+        SUM( zbsf ) AS zbsf
         FROM (
+        <!-- 鍑洪櫌浜烘-->
         SELECT
         COUNT(1) AS rc,
-        0 AS rs
+        0 AS rs,
+        0 AS scsf,
+        0 AS zcsf,
+        0 AS zbsf
         FROM
         pat_med_inhosp
         <where>
@@ -954,12 +961,15 @@
                     </foreach>
                 </if>
             </if>
-
         </where>
+        <!-- 闅忚鏈嶅姟浜烘暟 -->
         union all
         select
         0 AS rc,
-        count(1) AS rs
+        count(1) AS rs,
+        0 AS scsf,
+        0 AS zcsf,
+        0 AS zbsf
         FROM
         service_subtask
         <where>
@@ -981,6 +991,96 @@
                 </foreach>
             </if>
         </where>
+        <!-- 棣栨闅忚浜烘暟 -->
+        union all
+        select
+        0 AS rc,
+        0 AS rs,
+        count(1) AS scsf,
+        0 AS zcsf,
+        0 AS zbsf
+        FROM
+        service_subtask
+        <where>
+            del_flag = 0
+            and service_type=2
+            and is_visit_again = 0
+            <if test="orgid != null">
+                AND orgid = #{orgid}
+            </if>
+            <if test="startDate != null">
+                AND date_format( visit_time, '%y%m%d' ) &gt;= date_format( #{startDate}, '%y%m%d' )
+            </if>
+            <if test="endDate != null">
+                AND date_format( visit_time, '%y%m%d' ) &lt;= date_format(#{endDate},'%y%m%d')
+            </if>
+            <if test="deptcodeList != null   and deptcodeList.size() > 0">
+                and deptcode in
+                <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
+                    #{deptcode}
+                </foreach>
+            </if>
+        </where>
+        <!-- 鍐嶆闅忚浜烘暟 -->
+        union all
+        select
+        0 AS rc,
+        0 AS rs,
+        0 AS scsf,
+        count(1) AS zcsf,
+        0 AS zbsf
+        FROM
+        service_subtask
+        <where>
+            del_flag = 0
+            and service_type=2
+            and is_visit_again = 1
+            <if test="orgid != null">
+                AND orgid = #{orgid}
+            </if>
+            <if test="startDate != null">
+                AND date_format( visit_time, '%y%m%d' ) &gt;= date_format( #{startDate}, '%y%m%d' )
+            </if>
+            <if test="endDate != null">
+                AND date_format( visit_time, '%y%m%d' ) &lt;= date_format(#{endDate},'%y%m%d')
+            </if>
+            <if test="deptcodeList != null   and deptcodeList.size() > 0">
+                and deptcode in
+                <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
+                    #{deptcode}
+                </foreach>
+            </if>
+        </where>
+        <!-- 涓撶梾闅忚浜烘暟 -->
+        union all
+        select
+        0 AS rc,
+        0 AS rs,
+        0 AS scsf,
+        0 AS zcsf,
+        count(1) AS zbsf
+        FROM
+        service_subtask
+        <where>
+            del_flag = 0
+            and service_type=13
+            <if test="orgid != null">
+                AND orgid = #{orgid}
+            </if>
+            <if test="startDate != null">
+                AND date_format( visit_time, '%y%m%d' ) &gt;= date_format( #{startDate}, '%y%m%d' )
+            </if>
+            <if test="endDate != null">
+                AND date_format( visit_time, '%y%m%d' ) &lt;= date_format(#{endDate},'%y%m%d')
+            </if>
+            <if test="deptcodeList != null   and deptcodeList.size() > 0">
+                and deptcode in
+                <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
+                    #{deptcode}
+                </foreach>
+            </if>
+        </where>
         ) AS combined_data
     </select>
+
 </mapper>

--
Gitblit v1.9.3