From 138f31f7ed04842abca552dc8eaa912b3191e059 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 28 九月 2026 10:56:49 +0800
Subject: [PATCH] 处理患者再入院状态代码提交
---
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml | 44 ++++++++++++++++++++++++++++----------------
1 files changed, 28 insertions(+), 16 deletions(-)
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index e5ae35f..71d8a36 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -2584,6 +2584,8 @@
SUM(CASE WHEN sendstate != 4 THEN 1 ELSE 0 END) AS xsf,
SUM(CASE WHEN (sendstate = 1 OR sendstate = 2 OR sendstate = 3 OR sendstate = 5 OR sendstate = 7 ) THEN 1 ELSE 0
END) AS dsf,
+ SUM(CASE WHEN sendstate != 2 THEN 1 ELSE 0 END) AS yfs,
+ SUM(CASE WHEN sendstate = 2 THEN 1 ELSE 0 END) AS wfs,
SUM(CASE WHEN sendstate = 6 THEN 1 ELSE 0 END) AS ywc,
SUM(CASE WHEN excep IS NOT NULL AND excep = '1' THEN 1 ELSE 0 END) AS yc,
SUM(CASE WHEN excep IS NOT NULL AND excep = '2' THEN 1 ELSE 0 END) AS jg,
@@ -3397,14 +3399,15 @@
<select id="statQuestionOptionBySubtaskIds" resultType="com.smartor.domain.ServiceSubtaskDetailRatioExport">
SELECT
d.questiontext AS questiontext,
- t.taskid AS taskid,
- t.task_name AS taskName,
+ <!-- 鏄庣粏宸叉寜銆岄鐩� + 閫夐」銆嶆眹鎬伙紝浠诲姟/绉戝/鐥呭尯鍙槸闄勫甫淇℃伅锛屽繀椤荤敤鑱氬悎鍑芥暟鍙栧�硷紙MySQL ONLY_FULL_GROUP_BY锛� -->
+ MAX(t.taskid) AS taskid,
+ MAX(t.task_name) AS taskName,
d.asrtext AS optionresult,
d.score AS score,
- s.deptcode AS deptcode,
- s.deptname AS deptname,
- s.leavehospitaldistrictcode AS leavehospitaldistrictcode,
- s.leavehospitaldistrictname AS leavehospitaldistrictname,
+ MAX(s.deptcode) AS deptcode,
+ MAX(s.deptname) AS deptname,
+ MAX(s.leavehospitaldistrictcode) AS leavehospitaldistrictcode,
+ MAX(s.leavehospitaldistrictname) AS leavehospitaldistrictname,
d.targetvalue AS targetvalue,
d.value_type AS valueType,
COUNT(*) AS count,
@@ -3422,9 +3425,15 @@
AND d2.del_flag = '0'
)
INNER JOIN (
+ <!-- 鍒嗘瘝 = 璇ラ鍚勯�夐」椤规暟涔嬪拰锛堟湭浣滅瓟鐨勭┖ asrtext 涓嶈繘鍒嗘瘝锛夛紝杩欐牱涓�閬撻鍚勯�夐」姣斾緥鍚堣鎵嶆槸 100% -->
+ SELECT
+ x.questiontext AS questiontext,
+ SUM(x.option_count) AS total_count
+ FROM (
SELECT
d.questiontext,
- COUNT(*) AS total_count
+ d.asrtext,
+ COUNT(*) AS option_count
FROM
service_task t
INNER JOIN service_subtask s ON s.taskid = t.taskid
@@ -3465,7 +3474,11 @@
<if test="endFinishTime != null">
AND date_format(s.finishtime,'%y%m%d') <= date_format(#{endFinishTime},'%y%m%d')
</if>
- GROUP BY d.questiontext
+ <!-- 鏈綔绛旓紙asrtext 涓虹┖锛夌殑鏄庣粏涓嶈鍏ュ垎姣� -->
+ AND d.asrtext IS NOT NULL AND TRIM(d.asrtext) <> ''
+ GROUP BY d.questiontext, d.asrtext
+ ) x
+ GROUP BY x.questiontext
) t2 ON t2.questiontext = d.questiontext
WHERE 1=1
<!-- 鍘婚噸锛氭槑缁嗚鍚屼竴瀛愪换鍔″悓涓�棰樼洰鍙繚鐣欐渶鏂颁竴鏉★紝閲嶇瓟涓嶉噸澶嶈鍏ラ」鏁� -->
@@ -3484,6 +3497,8 @@
</if>
AND s.sendstate = 6
AND d.del_flag=0
+ <!-- 鏈綔绛旓紙asrtext 涓虹┖锛変笉绠椾换浣曢�夐」锛屾槑缁嗛噷鐩存帴鎺掗櫎锛岄伩鍏嶅嚭鐜扮┖閫夐」琛� -->
+ AND d.asrtext IS NOT NULL AND TRIM(d.asrtext) <> ''
<if test="valueType != null">AND d.value_type >= #{valueType}</if>
<if test="scoreStart != null">AND d.score >= #{scoreStart}</if>
<if test="scoreEnd != null">AND d.score <= #{scoreEnd}</if>
@@ -3502,21 +3517,17 @@
<if test="endFinishTime != null">
AND date_format(s.finishtime,'%y%m%d') <= date_format(#{endFinishTime},'%y%m%d')
</if>
+ <!-- 鍙寜銆岄鐩� + 閫夐」銆嶆眹鎬伙細鍘熸潵 GROUP BY 甯︿笂 taskid/绉戝/鐥呭尯锛屽悓涓�涓�夐」琚媶鎴愬琛屻�佹瘡琛屾暟閲忛兘鏄� 1锛�
+ 鍓嶇/瀵煎嚭鎷垮埌鐨勩�屾暟閲忋�嶅氨姘歌繙鍋氫笉浜嗙疮鍔� -->
GROUP BY
- t.taskid,
d.questiontext,
+ d.asrtext,
d.score,
d.targetvalue,
- d.asrtext,
- t.task_name,
- s.deptcode,
- s.deptname,
- s.leavehospitaldistrictcode,
- s.leavehospitaldistrictname,
d.value_type
ORDER BY
d.questiontext,
- t.taskid
+ MIN(t.taskid)
</select>
<select id="statQuestionOptionByKsOrBq" resultType="com.smartor.domain.DTO.QuestionCountKsOrBqDTO"
@@ -3677,5 +3688,6 @@
</select>
+
</mapper>
--
Gitblit v1.9.3