From a688a1dbee3df0d8640dbdca84f9092481ebc5e0 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期一, 29 十二月 2025 16:24:09 +0800
Subject: [PATCH] 【景宁】获取随访比例接口数量对不上
---
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml | 54 +++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index affb4b5..4a7b06d 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -1630,25 +1630,12 @@
<!-- 浼樺寲鐨勭粺璁℃煡璇細鐩存帴鍦ㄦ暟鎹簱灞傚畬鎴愯仛鍚堣绠� -->
<select id="countByCondition" parameterType="com.smartor.domain.ServiceSubtaskVO" resultType="map">
SELECT
- -- 鏈墽琛屾暟閲� (sendstate = 4)
SUM(CASE WHEN sendstate = 4 THEN 1 ELSE 0 END) AS wzx,
-
- -- 宸查殢璁挎暟閲� (sendstate != 4 AND sendstate != 2)
SUM(CASE WHEN sendstate != 4 AND sendstate != 2 THEN 1 ELSE 0 END) AS ysf,
-
- -- 鍙戦�佸け璐ユ暟閲� (sendstate = 5)
SUM(CASE WHEN sendstate = 5 THEN 1 ELSE 0 END) AS fssb,
-
- -- 宸插彂閫佹暟閲� (sendstate >= 3 OR sendstate = 1)
SUM(CASE WHEN sendstate >= 3 OR sendstate = 1 THEN 1 ELSE 0 END) AS yfs,
-
- -- 寰呴殢璁挎暟閲� (sendstate = 2)
SUM(CASE WHEN sendstate = 2 THEN 1 ELSE 0 END) AS dsf,
-
- -- 涓嶇悊鐫暟閲� (sendstate = 1)
SUM(CASE WHEN sendstate = 1 THEN 1 ELSE 0 END) AS blq,
-
- -- 寮傚父鏁伴噺 (excep IS NOT NULL AND excep != '0')
SUM(CASE WHEN excep IS NOT NULL AND excep != '0' THEN 1 ELSE 0 END) AS yc
FROM service_subtask
<where>
@@ -1659,8 +1646,39 @@
<if test="phone != null and phone != ''">
AND phone = #{phone}
</if>
- <if test="leavehospitaldistrictcode != null and leavehospitaldistrictcode != ''">
- AND leavehospitaldistrictcode = #{leavehospitaldistrictcode}
+ <if test="deptOrDistrict==1">
+ <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
+ AND leavehospitaldistrictcode IN
+ <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
+ separator=","
+ close=")">
+ #{leavehospitaldistrictcode}
+ </foreach>
+ </if>
+ <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
+ AND deptcode IN
+ <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
+ close=")">
+ #{leaveldeptcode}
+ </foreach>
+ </if>
+ </if>
+ <if test="deptOrDistrict==2">
+ <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
+ AND (leavehospitaldistrictcode IN
+ <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
+ separator=","
+ close=")">
+ #{leavehospitaldistrictcode}
+ </foreach>
+ </if>
+ <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
+ OR deptcode IN
+ <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
+ close="))">
+ #{leaveldeptcode}
+ </foreach>
+ </if>
</if>
<if test="leavehospitaldistrictname != null and leavehospitaldistrictname != ''">
AND leavehospitaldistrictname = #{leavehospitaldistrictname}
@@ -1772,6 +1790,12 @@
<if test="guid != null and guid != ''">
AND guid = #{guid}
</if>
+ <if test="visitCount != null and visitCount == 1">
+ AND visit_count = 1
+ </if>
+ <if test="visitCount != null and visitCount > 1">
+ AND visit_count > 1
+ </if>
</where>
</select>
--
Gitblit v1.9.3