From 55d724ddd52b2acb6e7ee2d291e04e4b6d96ad19 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期一, 09 十一月 2026 16:06:47 +0800
Subject: [PATCH] sync: service_subtask 科室病区字段重命名对齐
---
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml | 533 +++++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 388 insertions(+), 145 deletions(-)
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 33fef15..69624cd 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -27,7 +27,7 @@
<result property="recordid" column="recordid"/>
<result property="exrecallcount" column="exrecallcount"/>
<result property="pulltime" column="pulltime"/>
- <result property="deptcode" column="deptcode"/>
+ <result property="leaveldeptcode" column="leaveldeptcode"/>
<result property="labelstatus" column="labelstatus"/>
<result property="delFlag" column="del_flag"/>
<result property="updateBy" column="update_by"/>
@@ -54,6 +54,11 @@
<result property="leaveicd10code" column="leaveicd10code"/>
<result property="leavediagname" column="leavediagname"/>
<result property="diagname" column="diagname"/>
+ <result property="leaveldeptname" column="leaveldeptname"/>
+ <!-- 2026-11锛氬師 sendlimit* 鍥涗釜绌洪棽鍒楀鐢ㄤ负銆屽湪闄㈢淮搴︺�嶏紙hospitaldistrict* = 鍦ㄩ櫌鐥呭尯锛宒eptcode/name = 鍦ㄩ櫌绉戝锛� -->
+ <result property="hospitaldistrictcode" column="hospitaldistrictcode"/>
+ <result property="hospitaldistrictname" column="hospitaldistrictname"/>
+ <result property="deptcode" column="deptcode"/>
<result property="deptname" column="deptname"/>
<result property="admindate" column="admindate"/>
<result property="roomno" column="roomno"/>
@@ -103,6 +108,7 @@
<result property="loopCount" column="loop_count"/>
<result property="isManuallyCalled" column="is_manually_called"/>
<result property="campusid" column="campusid"/>
+ <result property="diagType" column="diag_type"/>
</resultMap>
<resultMap type="com.smartor.domain.ServiceSubtaskCount" id="ServiceSubtaskResult2">
@@ -210,7 +216,7 @@
recordid,
exrecallcount,
pulltime,
- deptcode,
+ leaveldeptcode,
labelstatus,
del_flag,
update_by,
@@ -233,6 +239,10 @@
sendname,
roomno,
admindate,
+ leaveldeptname,
+ hospitaldistrictcode,
+ hospitaldistrictname,
+ deptcode,
deptname,
stop_state,
leavehospitaldistrictcode,
@@ -257,50 +267,61 @@
</sql>
<!-- 瓒呮椂瀹屾垚銆佸欢鏈熷畬鎴愰�昏緫 瀹屾垚鏃剁姸鎬�(finish_state)璁$畻锛氫粎褰撴湰娆℃洿鏂版妸 sendstate 缃负 6锛堥殢璁垮畬鎴愶級鏃朵娇鐢ㄣ��
- 鍩哄噯鎴鏃堕棿 base = endtime + send_day(缂虹渷1) + (危 service_subtask_preachform.compensate_time + 1) 澶╋紝
- 涓� RyTask/RedisMqReceiver 鐨� isSubtaskDeadline 鍙e緞淇濇寔涓�鑷达紱
+ 鍩哄噯鎴鏃堕棿 base锛�
+ 闈炰换鍔$粍(appltype != 5)锛歟ndtime + send_day(缂虹渷1) + (危 service_subtask_preachform.compensate_time + 1) 澶╋紱
+ 浠诲姟缁�(appltype = 5)锛氭寜 schedule_benchmark 瑙f瀽鍩哄噯鏃堕棿
+ (1-鍏ラ櫌 2-鍑洪櫌 3-灏辫瘖 4-鍏ョ粍 0/鍏跺畠-鑷畾涔夋椂闂�)
+ + day_offset + (危 compensate_time + 1) 澶╋紙涓嶅彔鍔� send_day锛夛紱
+ 涓� RyTask/RedisMqReceiver 鐨� isSubtaskDeadline銆乻electTimelyRateBatch 鍙e緞淇濇寔涓�鑷达紱
delay = COALESCE(service_task.delay_finish_days, 0)锛�
finish_time = COALESCE(鍏ュ弬 finishtime, 搴撲腑 finishtime, NOW())锛�
finish_time <= base -> 1 姝e父瀹屾垚
delay > 0 涓� finish_time <= base + delay -> 2 寤舵湡瀹屾垚
鍏朵綑锛堝惈 delay 涓� 0 鎴� NULL銆佹垨宸茶秴鍑哄欢鏈熺獥鍙o級 -> 3 瓒呮椂瀹屾垚
finishtime 涓虹┖鏃剁敤 NOW() 鍏滃簳锛屼繚璇佸畬鎴愭椂涓�瀹氬啓鍏ョ姸鎬侊紱
- 浠呭綋 endtime 涓虹┖瀵艰嚧鏃犳硶璁$畻鏃舵墠淇濇寔鍘熷�间笉瑕嗙洊銆� -->
- <sql id="finishStateExpr">
+ base 涓虹┖锛坋ndtime / schedule / day_offset 缂哄け锛夋椂淇濇寔鍘熷�间笉瑕嗙洊銆� -->
+ <sql id="finishDeadlineExpr">
+ DATE_ADD(
CASE
- WHEN service_subtask.endtime IS NULL THEN finish_state
+ WHEN COALESCE(st.appltype, '') = '5' THEN
+ DATE_ADD(
+ CASE sts.schedule_benchmark
+ WHEN 1 THEN service_subtask.starttime
+ WHEN 2 THEN service_subtask.endtime
+ WHEN 3 THEN service_subtask.admindate
+ WHEN 4 THEN service_subtask.create_time
+ ELSE sts.schedule_benchmark_custom_time
+ END,
+ INTERVAL std.day_offset DAY)
+ ELSE
+ DATE_ADD(service_subtask.endtime, INTERVAL COALESCE(st.send_day, 1) DAY)
+ END,
+ INTERVAL (COALESCE((SELECT SUM(CAST(COALESCE(NULLIF(TRIM(pf.compensate_time), ''), '0') AS SIGNED))
+ FROM service_subtask_preachform pf
+ WHERE pf.subid = service_subtask.id AND pf.del_flag = 0), 0) + 1) DAY)
+ </sql>
+
+ <sql id="finishStateExpr">
+ COALESCE((
+ SELECT
+ CASE
+ WHEN <include refid="finishDeadlineExpr"/> IS NULL THEN NULL
WHEN COALESCE(#{finishtime,jdbcType=TIMESTAMP}, service_subtask.finishtime, NOW())
- <= DATE_ADD(
- DATE_ADD(
- service_subtask.endtime,
- INTERVAL COALESCE((SELECT st.send_day FROM service_task st
- WHERE st.taskid = service_subtask.taskid AND st.del_flag = '0' LIMIT 1), 1) DAY
- ),
- INTERVAL (COALESCE((SELECT SUM(CAST(COALESCE(NULLIF(TRIM(pf.compensate_time), ''), '0') AS SIGNED))
- FROM service_subtask_preachform pf
- WHERE pf.subid = service_subtask.id AND pf.del_flag = 0), 0) + 1) DAY
- )
+ <= <include refid="finishDeadlineExpr"/>
THEN 1
- WHEN COALESCE((SELECT st.delay_finish_days FROM service_task st
- WHERE st.taskid = service_subtask.taskid AND st.del_flag = '0' LIMIT 1), 0) > 0
+ WHEN COALESCE(st.delay_finish_days, 0) > 0
AND COALESCE(#{finishtime,jdbcType=TIMESTAMP}, service_subtask.finishtime, NOW())
- <= DATE_ADD(
- DATE_ADD(
- DATE_ADD(
- service_subtask.endtime,
- INTERVAL COALESCE((SELECT st.send_day FROM service_task st
- WHERE st.taskid = service_subtask.taskid AND st.del_flag = '0' LIMIT 1), 1) DAY
- ),
- INTERVAL (COALESCE((SELECT SUM(CAST(COALESCE(NULLIF(TRIM(pf.compensate_time), ''), '0') AS SIGNED))
- FROM service_subtask_preachform pf
- WHERE pf.subid = service_subtask.id AND pf.del_flag = 0), 0) + 1) DAY
- ),
- INTERVAL COALESCE((SELECT st.delay_finish_days FROM service_task st
- WHERE st.taskid = service_subtask.taskid AND st.del_flag = '0' LIMIT 1), 0) DAY
- )
+ <= DATE_ADD(<include refid="finishDeadlineExpr"/>,
+ INTERVAL COALESCE(st.delay_finish_days, 0) DAY)
THEN 2
ELSE 3
END
+ FROM (SELECT 1) dummy
+ LEFT JOIN service_task st ON st.taskid = service_subtask.taskid
+ LEFT JOIN service_task_schedule sts ON sts.id = service_subtask.schedule_id
+ LEFT JOIN service_task_schedule_detail std ON std.id = service_subtask.schedule_detail_id
+ LIMIT 1
+ ), finish_state)
</sql>
<!-- 褰撳墠鎵ц鏂瑰紡锛氶娆¢殢璁� current_preachform 涓虹┖鏃讹紝鍙� preachform 鐨勭涓�涓墽琛屾柟寮忓厹搴� -->
@@ -410,7 +431,6 @@
<if test="managementDoctorCode != null ">and management_doctor_code = #{managementDoctorCode}</if>
<if test="submit != null ">and submit = #{submit}</if>
<if test="upid != null ">and upid = #{upid}</if>
- <if test="visitCount != null ">and visit_count = #{visitCount}</if>
<if test="patfrom != null ">and patfrom = #{patfrom}</if>
<if test="serviceType != null ">and service_type = #{serviceType}</if>
<if test="patid != null ">and patid = #{patid}</if>
@@ -486,7 +506,7 @@
</foreach>
</if>
<if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
close=")">
#{leaveldeptcode}
@@ -508,7 +528,7 @@
OR
</if>
<if test=" leaveldeptcodes != null and leaveldeptcodes.size() > 0">
- deptcode IN
+ leaveldeptcode IN
<foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
close=")">
#{leaveldeptcode}
@@ -564,8 +584,8 @@
<if test="recordid != null ">and recordid = #{recordid}</if>
<if test="exrecallcount != null ">and exrecallcount = #{exrecallcount}</if>
<if test="pulltime != null ">and pulltime = #{pulltime}</if>
- <if test="deptcode != null and deptcode != ''">and deptcode = #{deptcode}</if>
- <if test="deptname != null and deptname != ''">and deptname = #{deptname}</if>
+ <if test="leaveldeptcode != null and leaveldeptcode != ''">and leaveldeptcode = #{leaveldeptcode}</if>
+ <if test="leaveldeptname != null and leaveldeptname != ''">and leaveldeptname = #{leaveldeptname}</if>
<if test="labelstatus != null ">and labelstatus = #{labelstatus}</if>
<if test="isupload != null ">and isupload = #{isupload}</if>
<if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
@@ -573,7 +593,7 @@
<if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
<if test="pid != null ">and pid = #{pid}</if>
<if test="preachform != null ">and preachform = #{preachform}</if>
- <if test="currentPreachform != null ">and current_preachform = #{currentPreachform}</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">and current_preachform = #{currentPreachform}</if>
<if test="currentPreachforms != null and currentPreachforms != ''">
and FIND_IN_SET(<include refid="effectiveCurrentPreachformExpr"/>, #{currentPreachforms})
</if>
@@ -651,7 +671,7 @@
</foreach>
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator=","
close=")">
#{deptcode}
@@ -723,7 +743,7 @@
<if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>
<if test="managementDoctorCode != null">and management_doctor_code = #{managementDoctorCode}</if>
<if test="managementDoctor != null">and management_doctor = #{managementDoctor}</if>
- <if test="currentPreachform != null">and current_preachform = #{currentPreachform}</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">and current_preachform = #{currentPreachform}</if>
<if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
<if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
<if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
@@ -750,8 +770,8 @@
<if test="recordid != null ">and recordid = #{recordid}</if>
<if test="exrecallcount != null ">and exrecallcount = #{exrecallcount}</if>
<if test="pulltime != null ">and pulltime = #{pulltime}</if>
- <if test="deptcode != null and deptcode != ''">and deptcode = #{deptcode}</if>
- <if test="deptname != null and deptname != ''">and deptname = #{deptname}</if>
+ <if test="leaveldeptcode != null and leaveldeptcode != ''">and leaveldeptcode = #{leaveldeptcode}</if>
+ <if test="leaveldeptname != null and leaveldeptname != ''">and leaveldeptname = #{leaveldeptname}</if>
<if test="labelstatus != null ">and labelstatus = #{labelstatus}</if>
<if test="isupload != null ">and isupload = #{isupload}</if>
<if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
@@ -783,7 +803,7 @@
<if test="visitTime != null ">and visit_time = #{visitTime}</if>
<if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
<if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>
- <if test="currentPreachform != null">and current_preachform = #{currentPreachform}</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">and current_preachform = #{currentPreachform}</if>
<if test="managementDoctorCode != null">and management_doctor_code = #{managementDoctorCode}</if>
<if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
<if test="managementDoctor != null">and management_doctor like concat('%',#{managementDoctor}, '%')</if>
@@ -827,8 +847,8 @@
<if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
<if test="serviceType != null and serviceType != ''">and service_type = #{serviceType}</if>
<if test="serviceTypes != null and serviceTypes != ''">and service_type IN (#{serviceTypes})</if>
- <if test="deptcode != null and deptcode != ''">and deptcode = #{deptcode}</if>
- <if test="deptname != null and deptname != ''">and deptname = #{deptname}</if>
+ <if test="leaveldeptcode != null and leaveldeptcode != ''">and leaveldeptcode = #{leaveldeptcode}</if>
+ <if test="leaveldeptname != null and leaveldeptname != ''">and leaveldeptname = #{leaveldeptname}</if>
<if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
<if test="leavehospitaldistrictcode != null and leavehospitaldistrictcode != ''">and
leavehospitaldistrictcode = #{leavehospitaldistrictcode}
@@ -854,26 +874,57 @@
</if>
SUM(CASE WHEN ss.finishtime IS NOT NULL AND DATE(ss.visit_time) <= DATE(ss.finishtime) THEN 1 ELSE 0 END) /
COUNT(*) AS finishRate,
- <if test="rateDay != null">
- SUM(CASE WHEN ss.finishtime IS NOT NULL
- AND DATEDIFF(ss.finishtime, ss.endtime) <= #{rateDay} + COALESCE(cp.compensate_days, 0)
- THEN 1 ELSE 0 END) / COUNT(*) AS rate
- </if>
- <if test="rateDay == null">
- NULL AS rate
- </if>
+ <!-- 鍙婃椂鐜囧熀鍑嗭細
+ 1) 闈炰换鍔$粍(appltype != 5)锛歟ndtime + send_day(缂虹渷1) + 危琛ュ伩澶╂暟 + 1 澶╋紱
+ 2) 浠诲姟缁�(appltype = 5)锛氭寜 schedule_benchmark 瑙f瀽鍩哄噯鏃堕棿
+ (1-鍏ラ櫌鏃堕棿 2-鍑洪櫌鏃堕棿 3-灏辫瘖鏃堕棿 4-鍏ョ粍鏃堕棿 0/鍏跺畠-鑷畾涔夋椂闂�)
+ + day_offset + 危琛ュ伩澶╂暟 + 1 澶╋紙涓嶅啀鍙犲姞 send_day锛夛紱
+ 瀹屾垚鏃堕棿 finishtime <= 鍩哄噯鏃堕棿璁′负鍙婃椂锛屽垎姣嶄粛涓哄簲闅忚鏁般��
+ 琛ュ伩澶╂暟鍙彇 service_subtask_preachform.compensate_time 鐨勬眹鎬诲�间竴娆★紝
+ 閬垮厤涓庤ˉ鍋挎槑缁嗙浉鍔犻�犳垚閲嶅琛ュ伩鎴栦竴瀵瑰鏀惧ぇ鍒嗘瘝銆� -->
+ SUM(CASE
+ WHEN ss.finishtime IS NOT NULL
+ AND COALESCE(st.appltype, '') != '5'
+ AND ss.endtime IS NOT NULL
+ AND ss.finishtime <= DATE_ADD(
+ DATE_ADD(ss.endtime, INTERVAL COALESCE(st.send_day, 1) DAY),
+ INTERVAL (COALESCE(cp.compensate_days, 0) + 1) DAY)
+ THEN 1
+ WHEN ss.finishtime IS NOT NULL
+ AND st.appltype = '5'
+ AND std.day_offset IS NOT NULL
+ AND ss.finishtime <= DATE_ADD(
+ DATE_ADD(
+ CASE sts.schedule_benchmark
+ WHEN 1 THEN ss.starttime
+ WHEN 2 THEN ss.endtime
+ WHEN 3 THEN ss.admindate
+ WHEN 4 THEN ss.create_time
+ ELSE sts.schedule_benchmark_custom_time
+ END, INTERVAL std.day_offset DAY),
+ INTERVAL (COALESCE(cp.compensate_days, 0) + 1) DAY)
+ THEN 1
+ ELSE 0
+ END) / COUNT(*) AS rate
FROM service_subtask ss
- <if test="rateDay != null">
- <!-- 琛ュ伩鏃堕棿锛氬厛鎸夊瓙浠诲姟鑱氬悎鎴愪竴琛屽啀鍏宠仈锛岄伩鍏嶄竴瀵瑰鏀惧ぇ COUNT(*) 鍒嗘瘝銆�
- compensate_time 鏄� varchar 涓斿彲鑳藉瓨鎴愮┖涓诧紝闇�鍏堢疆绌哄啀杞暟瀛� -->
- LEFT JOIN (
- SELECT subid,
- SUM(CAST(COALESCE(NULLIF(TRIM(compensate_time), ''), '0') AS SIGNED)) AS compensate_days
- FROM service_subtask_preachform
- WHERE del_flag = 0
- GROUP BY subid
- ) cp ON cp.subid = ss.id
- </if>
+ <!-- 杩欓噷鎸� taskid / 鍘嗗彶 schedule 蹇収鍏宠仈锛屼笉鎸� del_flag 杩囨护锛�
+ 浠诲姟鎴栬鍒掕缂栬緫鍚庢棫 schedule/detail 浼氱疆涓� del_flag=1锛�
+ 浣嗗巻鍙� subtask 浠嶅紩鐢ㄦ棫 ID锛岃繃婊や細涓㈠け鍘嗗彶鍙婃椂鐜囧熀鍑嗐�� -->
+ LEFT JOIN service_task st
+ ON st.taskid = ss.taskid
+ LEFT JOIN service_task_schedule sts
+ ON sts.id = ss.schedule_id
+ LEFT JOIN service_task_schedule_detail std
+ ON std.id = ss.schedule_detail_id
+ <!-- 琛ュ伩鏃堕棿锛氬厛鎸夊瓙浠诲姟鑱氬悎鎴愪竴琛屽啀鍏宠仈锛岄伩鍏嶄竴瀵瑰鏀惧ぇ COUNT(*) 鍒嗘瘝銆�
+ compensate_time 鏄� varchar 涓斿彲鑳藉瓨鎴愮┖涓诧紝闇�鍏堢疆绌哄啀杞暟瀛� -->
+ LEFT JOIN (
+ SELECT subid,
+ SUM(CAST(COALESCE(NULLIF(TRIM(compensate_time), ''), '0') AS SIGNED)) AS compensate_days
+ FROM service_subtask_preachform
+ WHERE del_flag = 0
+ GROUP BY subid
+ ) cp ON cp.subid = ss.id
WHERE ss.del_flag = 0
AND ss.visit_time IS NOT NULL
AND ss.sendstate != 4
@@ -886,8 +937,8 @@
</if>
<if test="orgid != null and orgid != ''">AND ss.orgid = #{orgid}</if>
<if test="campusid != null and campusid != ''">and ss.campusid = #{campusid}</if>
- <if test="deptcode != null and deptcode != ''">and ss.deptcode = #{deptcode}</if>
- <if test="deptname != null and deptname != ''">and ss.deptname = #{deptname}</if>
+ <if test="leaveldeptcode != null and leaveldeptcode != ''">and ss.leaveldeptcode = #{leaveldeptcode}</if>
+ <if test="leaveldeptname != null and leaveldeptname != ''">and ss.leaveldeptname = #{leaveldeptname}</if>
<if test="isabnormal != null">and ss.isabnormal = #{isabnormal}</if>
<if test="leavehospitaldistrictcode != null and leavehospitaldistrictcode != ''">and
ss.leavehospitaldistrictcode = #{leavehospitaldistrictcode}
@@ -949,8 +1000,8 @@
<if test="serviceType != null and serviceType != ''">and service_type = #{serviceType}</if>
<if test="serviceTypes != null and serviceTypes != ''">and service_type IN (#{serviceTypes})</if>
<if test="isabnormal != null ">and isabnormal = #{isabnormal}</if>
- <if test="deptcode != null and deptcode != ''">and deptcode = #{deptcode}</if>
- <if test="deptname != null and deptname != ''">and deptname = #{deptname}</if>
+ <if test="leaveldeptcode != null and leaveldeptcode != ''">and leaveldeptcode = #{leaveldeptcode}</if>
+ <if test="leaveldeptname != null and leaveldeptname != ''">and leaveldeptname = #{leaveldeptname}</if>
<if test="leavehospitaldistrictcode != null and leavehospitaldistrictcode != ''">and
leavehospitaldistrictcode = #{leavehospitaldistrictcode}
</if>
@@ -1022,7 +1073,11 @@
<if test="recordid != null">recordid,</if>
<if test="exrecallcount != null">exrecallcount,</if>
<if test="pulltime != null">pulltime,</if>
- <if test="deptcode != null">deptcode,</if>
+ <if test="leaveldeptcode != null">leaveldeptcode,</if>
+ <if test="hospitaldistrictcode != null and hospitaldistrictcode != ''">hospitaldistrictcode,</if>
+ <if test="hospitaldistrictname != null and hospitaldistrictname != ''">hospitaldistrictname,</if>
+ <if test="deptcode != null and deptcode != ''">deptcode,</if>
+ <if test="deptname != null and deptname != ''">deptname,</if>
<if test="labelstatus != null">labelstatus,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
@@ -1047,7 +1102,7 @@
<if test="wechat != null and wechat != ''">wechat,</if>
<if test="roomno != null and roomno != ''">roomno,</if>
<if test="admindate != null">admindate,</if>
- <if test="deptname != null and deptname != ''">deptname,</if>
+ <if test="leaveldeptname != null and leaveldeptname != ''">leaveldeptname,</if>
<if test="leaveicd10code != null and leaveicd10code != ''">leaveicd10code,</if>
<if test="leavediagname != null and leavediagname != ''">leavediagname,</if>
<if test="libtemplateid != null ">libtemplateid,</if>
@@ -1087,7 +1142,7 @@
<if test="visitDeptName != null">visit_dept_name,</if>
<if test="managementDoctorCode != null">management_doctor_code,</if>
<if test="managementDoctor != null">management_doctor,</if>
- <if test="currentPreachform != null">current_preachform,</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">current_preachform,</if>
<if test="taskSituation != null">task_situation,</if>
<if test="isabnormal != null">isabnormal,</if>
<if test="continueFlag != null ">continue_flag,</if>
@@ -1122,7 +1177,11 @@
<if test="recordid != null">#{recordid},</if>
<if test="exrecallcount != null">#{exrecallcount},</if>
<if test="pulltime != null">#{pulltime},</if>
- <if test="deptcode != null">#{deptcode},</if>
+ <if test="leaveldeptcode != null">#{leaveldeptcode},</if>
+ <if test="hospitaldistrictcode != null and hospitaldistrictcode != ''">#{hospitaldistrictcode},</if>
+ <if test="hospitaldistrictname != null and hospitaldistrictname != ''">#{hospitaldistrictname},</if>
+ <if test="deptcode != null and deptcode != ''">#{deptcode},</if>
+ <if test="deptname != null and deptname != ''">#{deptname},</if>
<if test="labelstatus != null">#{labelstatus},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
@@ -1147,7 +1206,7 @@
<if test="wechat != null and wechat != ''">#{wechat},</if>
<if test="roomno != null and roomno != ''">#{roomno},</if>
<if test="admindate != null ">#{admindate},</if>
- <if test="deptname != null and deptname != ''">#{deptname},</if>
+ <if test="leaveldeptname != null and leaveldeptname != ''">#{leaveldeptname},</if>
<if test="leaveicd10code != null and leaveicd10code != ''">#{leaveicd10code},</if>
<if test="leavediagname != null and leavediagname != ''">#{leavediagname},</if>
<if test="libtemplateid != null ">#{libtemplateid},</if>
@@ -1187,7 +1246,7 @@
<if test="visitDeptName != null">#{visitDeptName},</if>
<if test="managementDoctorCode != null">#{managementDoctorCode},</if>
<if test="managementDoctor != null">#{managementDoctor},</if>
- <if test="currentPreachform != null">#{currentPreachform},</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">#{currentPreachform},</if>
<if test="taskSituation != null">#{taskSituation},</if>
<if test="isabnormal != null">#{isabnormal},</if>
<if test="continueFlag != null ">#{continueFlag},</if>
@@ -1235,7 +1294,7 @@
<if test="recordid != null">recordid = #{recordid},</if>
<if test="exrecallcount != null">exrecallcount = #{exrecallcount},</if>
<if test="pulltime != null">pulltime = #{pulltime},</if>
- <if test="deptcode != null">deptcode = #{deptcode},</if>
+ <if test="leaveldeptcode != null">leaveldeptcode = #{leaveldeptcode},</if>
<if test="labelstatus != null">labelstatus = #{labelstatus},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
@@ -1260,7 +1319,7 @@
<if test="wechat != null and wechat != ''">wechat = #{wechat},</if>
<if test="roomno != null and roomno != ''">roomno = #{roomno},</if>
<if test="admindate != null ">admindate = #{admindate},</if>
- <if test="deptname != null and deptname != ''">deptname = #{deptname},</if>
+ <if test="leaveldeptname != null and leaveldeptname != ''">leaveldeptname = #{leaveldeptname},</if>
<if test="leaveicd10code != null and leaveicd10code != ''">leaveicd10code = #{leaveicd10code},</if>
<if test="leavediagname != null and leavediagname != ''">leavediagname = #{leavediagname},</if>
<if test="libtemplateid != null ">libtemplateid = #{libtemplateid},</if>
@@ -1301,7 +1360,7 @@
<if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if>
<if test="managementDoctorCode != null">management_doctor_code = #{managementDoctorCode},</if>
<if test="managementDoctor != null">management_doctor=#{managementDoctor},</if>
- <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">current_preachform=#{currentPreachform},</if>
<if test="taskSituation != null">task_situation=#{taskSituation},</if>
<if test="isabnormal != null">isabnormal=#{isabnormal},</if>
<if test="continueFlag != null ">continue_flag = #{continueFlag},</if>
@@ -1317,6 +1376,25 @@
<if test="isManuallyCalled != null ">is_manually_called = #{isManuallyCalled},</if>
</trim>
where id = #{id}
+ </update>
+
+ <!-- 寰俊鍏紬鍙峰凡棰嗗彇鏈~鍐欐寜榛樿閫夐」瀹屾垚锛氬彧鏇存柊褰撳墠瀛愪换鍔°��
+ 鏉′欢 sendstate=1 + 鏈彁浜わ紝淇濊瘉鍙鐞嗗綋鍓嶈棰嗗彇涓旀湭濉啓鐨勫瓙浠诲姟锛屼笉娉㈠強鍏朵粬浠诲姟銆� -->
+ <update id="updateWechatDefaultComplete" parameterType="com.smartor.domain.ServiceSubtask">
+ update service_subtask
+ set sendstate = 6,
+ finishtime = #{finishtime},
+ result = #{result},
+ remark = case
+ when remark is null or remark = '' then #{remark}
+ else concat(remark, ',', #{remark})
+ end,
+ update_time = now(),
+ finish_state = <include refid="finishStateExpr"/>
+ where id = #{id}
+ and orgid = #{orgid}
+ and sendstate = 1
+ and (submit is null or submit != 1)
</update>
<update id="updateServiceSubtaskByPatId" parameterType="com.smartor.domain.ServiceSubtask">
@@ -1341,7 +1419,7 @@
<if test="recordid != null">recordid = #{recordid},</if>
<if test="exrecallcount != null">exrecallcount = #{exrecallcount},</if>
<if test="pulltime != null">pulltime = #{pulltime},</if>
- <if test="deptcode != null">deptcode = #{deptcode},</if>
+ <if test="leaveldeptcode != null">leaveldeptcode = #{leaveldeptcode},</if>
<if test="labelstatus != null">labelstatus = #{labelstatus},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
@@ -1366,7 +1444,7 @@
<if test="wechat != null and wechat != ''">wechat = #{wechat},</if>
<if test="roomno != null and roomno != ''">roomno = #{roomno},</if>
<if test="admindate != null">admindate = #{admindate},</if>
- <if test="deptname != null and deptname != ''">deptname = #{deptname},</if>
+ <if test="leaveldeptname != null and leaveldeptname != ''">leaveldeptname = #{leaveldeptname},</if>
<if test="leaveicd10code != null and leaveicd10code != ''">leaveicd10code = #{leaveicd10code},</if>
<if test="leavediagname != null and leavediagname != ''">leavediagname = #{leavediagname},</if>
<if test="libtemplateid != null ">libtemplateid = #{libtemplateid},</if>
@@ -1407,7 +1485,7 @@
<if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if>
<if test="managementDoctorCode != null">management_doctor_code = #{managementDoctorCode},</if>
<if test="managementDoctor != null">management_doctor=#{managementDoctor},</if>
- <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">current_preachform=#{currentPreachform},</if>
<if test="taskSituation != null">task_situation=#{taskSituation},</if>
<if test="isabnormal != null">isabnormal=#{isabnormal},</if>
<if test="continueFlag != null ">continue_flag = #{continueFlag},</if>
@@ -1448,7 +1526,7 @@
<if test="recordid != null">recordid = #{recordid},</if>
<if test="exrecallcount != null">exrecallcount = #{exrecallcount},</if>
<if test="pulltime != null">pulltime = #{pulltime},</if>
- <if test="deptcode != null">deptcode = #{deptcode},</if>
+ <if test="leaveldeptcode != null">leaveldeptcode = #{leaveldeptcode},</if>
<if test="labelstatus != null">labelstatus = #{labelstatus},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
@@ -1475,7 +1553,7 @@
<if test="wechat != null and wechat != ''">wechat = #{wechat},</if>
<if test="roomno != null and roomno != ''">roomno = #{roomno},</if>
<if test="admindate != null">admindate = #{admindate},</if>
- <if test="deptname != null and deptname != ''">deptname = #{deptname},</if>
+ <if test="leaveldeptname != null and leaveldeptname != ''">leaveldeptname = #{leaveldeptname},</if>
<if test="leaveicd10code != null and leaveicd10code != ''">leaveicd10code = #{leaveicd10code},</if>
<if test="leavediagname != null and leavediagname != ''">leavediagname = #{leavediagname},</if>
<if test="libtemplateid != null ">libtemplateid = #{libtemplateid},</if>
@@ -1512,7 +1590,7 @@
<if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if>
<if test="managementDoctorCode != null">management_doctor_code = #{managementDoctorCode},</if>
<if test="managementDoctor != null">management_doctor=#{managementDoctor},</if>
- <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">current_preachform=#{currentPreachform},</if>
<if test="taskSituation != null">task_situation=#{taskSituation},</if>
<if test="isabnormal != null">isabnormal=#{isabnormal},</if>
<if test="continueFlag != null ">continue_flag = #{continueFlag},</if>
@@ -1561,7 +1639,7 @@
<if test="recordid != null">recordid = #{recordid},</if>
<if test="exrecallcount != null">exrecallcount = #{exrecallcount},</if>
<if test="pulltime != null">pulltime = #{pulltime},</if>
- <if test="deptcode != null">deptcode = #{deptcode},</if>
+ <if test="leaveldeptcode != null">leaveldeptcode = #{leaveldeptcode},</if>
<if test="labelstatus != null">labelstatus = #{labelstatus},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
@@ -1588,7 +1666,7 @@
<if test="admindate != null ">admindate = #{admindate},</if>
<if test="visitCount != null ">visit_count = #{visitCount},</if>
<if test="isVisitAgain != null ">is_visit_again = #{isVisitAgain},</if>
- <if test="deptname != null and deptname != ''">deptname = #{deptname},</if>
+ <if test="leaveldeptname != null and leaveldeptname != ''">leaveldeptname = #{leaveldeptname},</if>
<if test="leaveicd10code != null and leaveicd10code != ''">leaveicd10code = #{leaveicd10code},</if>
<if test="leavediagname != null and leavediagname != ''">leavediagname = #{leavediagname},</if>
<if test="libtemplateid != null ">libtemplateid = #{libtemplateid},</if>
@@ -1625,7 +1703,7 @@
<if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if>
<if test="managementDoctorCode != null">management_doctor_code = #{managementDoctorCode},</if>
<if test="managementDoctor != null">management_doctor=#{managementDoctor},</if>
- <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">current_preachform=#{currentPreachform},</if>
<if test="taskSituation != null">task_situation=#{taskSituation},</if>
<if test="isabnormal != null">isabnormal=#{isabnormal},</if>
<if test="continueFlag != null ">continue_flag = #{continueFlag},</if>
@@ -1671,6 +1749,19 @@
</foreach>
</update>
+ <!-- 浜哄伐闅忚閲嶅鏍¢獙锛氬悓涓�鎮h�呭悓涓�浠诲姟涓嬫槸鍚﹀凡鏈夋湭瀹屾垚闅忚浠诲姟 -->
+ <select id="countUnfinishedServiceSubtaskByPatidAndTaskid" resultType="int">
+ select count(1)
+ from service_subtask
+ where del_flag = 0
+ and patid = #{patid}
+ and taskid = #{taskid}
+ and sendstate in
+ <foreach collection="sendstates" item="sendstate" open="(" separator="," close=")">
+ #{sendstate}
+ </foreach>
+ </select>
+
<select id="getSfStatistics" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
resultMap="ServiceSubtaskResult">
select id,
@@ -1684,8 +1775,8 @@
management_doctor,
leavehospitaldistrictcode,
leavehospitaldistrictname,
- deptcode,
- deptname,
+ leaveldeptcode,
+ leaveldeptname,
sendstate,
preachform,
<include refid="effectiveCurrentPreachformExpr"/> AS current_preachform,
@@ -1694,6 +1785,9 @@
nurse_name,
taskid,
task_name,
+ <if test="groupKey != null and groupKey == 'taskid'">
+ (SELECT st.diag_type FROM service_task st WHERE st.taskid = service_subtask.taskid LIMIT 1) AS diag_type,
+ </if>
visit_time,
visit_dept_code,
finishtime,
@@ -1733,10 +1827,17 @@
</foreach>
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator=","
close=")">
#{deptcode}
+ </foreach>
+ </if>
+ <if test="taskIds != null and taskIds.size() > 0">
+ AND taskid IN
+ <foreach collection="taskIds" item="taskId" open="(" separator=","
+ close=")">
+ #{taskId}
</foreach>
</if>
<if test="serviceType != null and serviceType.size() > 0">
@@ -1851,7 +1952,7 @@
</foreach>
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND b.deptcode IN
+ AND b.leaveldeptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator=","
close=")">
#{deptcode}
@@ -1916,10 +2017,17 @@
</foreach>
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator=","
close=")">
#{deptcode}
+ </foreach>
+ </if>
+ <if test="taskIds != null and taskIds.size() > 0">
+ AND taskid IN
+ <foreach collection="taskIds" item="taskId" open="(" separator=","
+ close=")">
+ #{taskId}
</foreach>
</if>
<if test="serviceType != null and serviceType.size() > 0">
@@ -1957,9 +2065,6 @@
<if test="groupKey != null and groupKey != ''">
group by ${groupKey}
</if>
- <if test="pageSize != null and pageNum != null">
- limit ${pageSize} OFFSET ${pageNum}
- </if>
</select>
<select id="getSfStatisticsHyperlink" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
@@ -1973,8 +2078,8 @@
drname,
leavehospitaldistrictcode,
leavehospitaldistrictname,
- deptcode,
- deptname,
+ leaveldeptcode,
+ leaveldeptname,
sendstate,
preachform,
<include refid="effectiveCurrentPreachformExpr"/> AS current_preachform,
@@ -2025,7 +2130,7 @@
</foreach>
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator=","
close=")">
#{deptcode}
@@ -2057,10 +2162,15 @@
<if test="type != null">
and type = #{type}
</if>
- <if test="visitCount != null and visitCount == 1">
+ <!-- 棣栦釜鍐嶆闅忚锛氱簿纭煡 visit_count = 2锛屼笌缁熻鍙e緞涓�鑷� -->
+ <if test="hyperLinkInfoType == 'againFollowUpPushCountInfo'">
+ AND visit_count = 2
+ </if>
+ <!-- 鍏朵粬绫诲瀷淇濇寔鍘熻涔夛細1 棣栨锛�>1 鍐嶆 -->
+ <if test="hyperLinkInfoType != 'againFollowUpPushCountInfo' and visitCount != null and visitCount == 1">
AND visit_count = 1
</if>
- <if test="visitCount != null and visitCount > 1">
+ <if test="hyperLinkInfoType != 'againFollowUpPushCountInfo' and visitCount != null and visitCount > 1">
AND visit_count > 1
</if>
<if test="groupKey != null and groupKey != '' and groupKeyList != null and groupKeyList.size>0">
@@ -2077,7 +2187,7 @@
#{state}
</foreach>
</if>
- <if test="currentPreachform != null">
+ <if test="currentPreachform != null and currentPreachform != '' ">
AND <include refid="effectiveCurrentPreachformExpr"/> = #{currentPreachform}
<if test="followUpCountStyle != null and followUpCountStyle = '1'">
AND sendstate != 4
@@ -2099,10 +2209,13 @@
AND leavehospitaldistrictcode = #{leavehospitaldistrictcode}
</if>
<if test="deptcode != null and deptcode != ''">
- AND deptcode = #{deptcode}
+ AND leaveldeptcode = #{deptcode}
</if>
<if test="isManuallyCalled != null">
AND is_manually_called = #{isManuallyCalled}
+ </if>
+ <if test="suggest != null and suggest != ''">
+ AND TRIM(suggest) = #{suggest}
</if>
order by endtime desc
<if test="pageSize != null and pageNum != null">
@@ -2133,7 +2246,7 @@
</foreach>
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator=","
close=")">
#{deptcode}
@@ -2180,7 +2293,7 @@
</foreach>
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator=","
close=")">
#{deptcode}
@@ -2216,7 +2329,7 @@
</foreach>
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator=","
close=")">
#{deptcode}
@@ -2273,7 +2386,7 @@
</foreach>
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND t.deptcode IN
+ AND t.leaveldeptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator=","
close=")">
#{deptcode}
@@ -2359,7 +2472,7 @@
</foreach>
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND ss.deptcode IN
+ AND ss.leaveldeptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator=","
close=")">
#{deptcode}
@@ -2431,7 +2544,7 @@
</foreach>
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND ss.deptcode IN
+ AND ss.leaveldeptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator=","
close=")">
#{deptcode}
@@ -2456,6 +2569,136 @@
AND ssd.categoryid IN (${configValue})
</if>
group by a.script_content, ss.type, IFNULL(ssd.matchedtext,ssd.asrtext)
+ </select>
+
+ <!--
+ 闂閫夐」鏁板瓧涓嬮捇锛氳繑鍥為�夋嫨浜嗘寚瀹氶�夐」鐨� service_subtask 鍒楄〃銆�
+ 杩囨护鍙e緞涓� getSfStatisticsScriptDetails / getSfStatisticsScriptItemDetails 淇濇寔涓�鑷达紝
+ 棰濆鏀寔 statisticaltype锛�1-鐥呭尯銆�2-绉戝銆�3-鐥呯銆�
+ -->
+ <select id="getSfStatisticsScriptDetailsHyperlink" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
+ resultMap="ServiceSubtaskResult">
+ SELECT ss.*
+ FROM service_subtask ss
+ WHERE ss.del_flag = 0
+ <if test="orgid != null and orgid != ''">
+ AND ss.orgid = #{orgid}
+ </if>
+ <if test="campusid != null and campusid != ''">
+ AND ss.campusid = #{campusid}
+ </if>
+ <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
+ AND ss.leavehospitaldistrictcode IN
+ <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
+ close=")">
+ #{leavehospitaldistrictcode}
+ </foreach>
+ </if>
+ <if test="deptcodes != null and deptcodes.size() > 0">
+ AND ss.leaveldeptcode IN
+ <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
+ #{deptcode}
+ </foreach>
+ </if>
+ <if test="serviceType != null and serviceType.size() > 0">
+ AND ss.service_type IN
+ <foreach collection="serviceType" item="serviceType" open="(" separator="," close=")">
+ #{serviceType}
+ </foreach>
+ </if>
+ <if test="startTime != null and endTime != null">
+ AND ss.visit_time >= DATE(#{startTime})
+ AND ss.visit_time < DATE_ADD(DATE(#{endTime}), INTERVAL 1 DAY)
+ </if>
+ <if test="type != null and type != ''">
+ AND ss.type = #{type}
+ </if>
+
+ <!-- 缁熻缁村害锛�1-鎸夌梾鍖� 2-鎸夌瀹� 3-鎸塼askid -->
+ <if test="statisticaltype != null and statisticaltype == 1">
+ <choose>
+ <when test="deptcode != null and deptcode != ''">
+ AND ss.leavehospitaldistrictcode = #{deptcode}
+ </when>
+ <when test="leavehospitaldistrictcode != null and leavehospitaldistrictcode != ''">
+ AND ss.leavehospitaldistrictcode = #{leavehospitaldistrictcode}
+ </when>
+ </choose>
+ </if>
+ <if test="statisticaltype != null and statisticaltype == 2 and deptcode != null and deptcode != ''">
+ AND ss.leaveldeptcode = #{deptcode}
+ </if>
+ <if test="statisticaltype != null and statisticaltype == 3 and taskId != null">
+ AND ss.taskid = #{taskId}
+ </if>
+ <!-- 鍏煎涓嶄紶 statisticaltype 鏃舵寜鍗曞�兼潯浠惰繃婊� -->
+ <if test="statisticaltype == null">
+ <if test="leavehospitaldistrictcode != null and leavehospitaldistrictcode != ''">
+ AND ss.leavehospitaldistrictcode = #{leavehospitaldistrictcode}
+ </if>
+ <if test="deptcode != null and deptcode != ''">
+ AND ss.leaveldeptcode = #{deptcode}
+ </if>
+ <if test="taskId != null">
+ AND ss.taskid = #{taskId}
+ </if>
+ </if>
+
+ <!-- 棰樼洰 + 閫夐」鍖归厤锛氬彧淇濈暀鍥炵瓟涓�夋嫨浜嗚閫夐」鐨勫瓙浠诲姟 -->
+ AND EXISTS (
+ SELECT 1
+ FROM service_subtask_detail ssd
+ WHERE ssd.sub_id = ss.id
+ AND ssd.del_flag = 0
+ <if test="configValue != null and configValue != ''">
+ AND ssd.categoryid IN (${configValue})
+ </if>
+ <choose>
+ <when test="optionText != null">
+ AND IFNULL(ssd.matchedtext, ssd.asrtext) = #{optionText}
+ </when>
+ <otherwise>
+ AND 1 = 0
+ </otherwise>
+ </choose>
+ <choose>
+ <!-- 浼樺厛鎸夐鐩唴瀹瑰尮閰嶏細鍚屼竴閬撻澶嶅埗鍒板涓换鍔℃ā鏉挎椂 scriptid 涓嶅悓锛屼絾 script_content 鐩稿悓 -->
+ <when test="scriptContent != null and scriptContent != ''">
+ AND ssd.scriptid IN (
+ <choose>
+ <when test="type == '1'">
+ SELECT its.id FROM ivr_task_template_script its
+ WHERE its.script_content = #{scriptContent}
+ </when>
+ <when test="type == '2'">
+ SELECT sts.id FROM svy_task_template_script sts
+ WHERE sts.script_content = #{scriptContent}
+ </when>
+ <otherwise>
+ SELECT its.id FROM ivr_task_template_script its
+ WHERE its.script_content = #{scriptContent}
+ UNION
+ SELECT sts.id FROM svy_task_template_script sts
+ WHERE sts.script_content = #{scriptContent}
+ </otherwise>
+ </choose>
+ )
+ </when>
+ <when test="scriptid != null">
+ AND ssd.scriptid = #{scriptid}
+ </when>
+ <otherwise>
+ AND 1 = 0
+ </otherwise>
+ </choose>
+ )
+ ORDER BY ss.endtime DESC, ss.id DESC
+ <if test="pageSize != null and pageSize > 0">
+ LIMIT #{pageSize}
+ <if test="pageNum != null and pageNum >= 0">
+ OFFSET #{pageNum}
+ </if>
+ </if>
</select>
<select id="getDataByTime" resultMap="ServiceSubtaskResult">
@@ -2484,7 +2727,7 @@
recordid,
exrecallcount,
pulltime,
- deptcode,
+ leaveldeptcode,
labelstatus,
del_flag,
upid,
@@ -2514,7 +2757,7 @@
admindate,
patid,
service_type,
- deptname,
+ leaveldeptname,
score,
drname,
drcode,
@@ -2574,7 +2817,7 @@
</select>
<select id="getDeptRanking" parameterType="com.smartor.domain.PatMedReq" resultType="com.smartor.domain.PatMedRes">
- SELECT deptname,
+ SELECT leaveldeptname AS deptname,
count(1) AS rc
FROM service_subtask
WHERE DATE_FORMAT(visit_time, '%Y-%m-%d') >= #{startDate}
@@ -2587,7 +2830,7 @@
<if test="campusid != null and campusid != ''">
AND campusid = #{campusid}
</if>
- GROUP BY deptname
+ GROUP BY leaveldeptname
</select>
<!-- 鏈嶅姟缁熻鏌ヨ - 鎸夋椂闂寸淮搴︾粺璁″嚭闄�/闂ㄨ瘖闅忚鏁版嵁 -->
@@ -2638,7 +2881,7 @@
AND campusid = #{campusid}
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
#{deptcode}
</foreach>
@@ -2803,7 +3046,7 @@
</foreach>
</if>
<if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
close=")">
#{leaveldeptcode}
@@ -2825,7 +3068,7 @@
OR
</if>
<if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
- deptcode IN
+ leaveldeptcode IN
<foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
close=")">
#{leaveldeptcode}
@@ -2928,14 +3171,14 @@
</foreach>
</if>
<if test="leaveldeptcodes != null and leaveldeptcodes.size() > 0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator="," close=")">
#{leaveldeptcode}
</foreach>
</if>
</if>
- <if test="deptcode != null and deptcode != ''">
- AND deptcode = #{deptcode}
+ <if test="leaveldeptcode != null and leaveldeptcode != ''">
+ AND leaveldeptcode = #{leaveldeptcode}
</if>
<if test="sendstate != null">
AND sendstate = #{sendstate}
@@ -2999,7 +3242,7 @@
AND date_format( visit_time, '%y%m%d' ) <= date_format(#{endDate},'%y%m%d')
</if>
<if test="deptcodeList != null and deptcodeList.size()>0">
- and deptcode in
+ and leaveldeptcode in
<foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
#{deptcode}
</foreach>
@@ -3073,7 +3316,7 @@
OR
</if>
<if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
- ss.deptcode IN
+ ss.leaveldeptcode IN
<foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
close=")">
#{leaveldeptcode}
@@ -3121,7 +3364,7 @@
OR
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- deptcode IN
+ leaveldeptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator=","
close=")">
#{deptcode}
@@ -3171,14 +3414,14 @@
parameterType="com.smartor.domain.VO.ServiceSubtaskCotinueCountVO"
resultType="java.util.Map">
SELECT
- deptcode AS groupCode,
- deptname AS groupName,
+ leaveldeptcode AS groupCode,
+ leaveldeptname AS groupName,
SUM(CASE WHEN continue_flag = 1 THEN 1 ELSE 0 END) AS noContinueCnt,
SUM(CASE WHEN continue_flag = 2 THEN 1 ELSE 0 END) AS continueCnt
FROM service_subtask
WHERE del_flag = 0
AND continue_flag IN (1, 2)
- AND deptcode IS NOT NULL AND deptcode != ''
+ AND leaveldeptcode IS NOT NULL AND leaveldeptcode != ''
<if test="orgid != null and orgid != ''">
AND orgid = #{orgid}
</if>
@@ -3186,12 +3429,12 @@
AND campusid = #{campusid}
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="deptcodes" item="code" open="(" separator="," close=")">
#{code}
</foreach>
</if>
- GROUP BY deptcode, deptname
+ GROUP BY leaveldeptcode, leaveldeptname
ORDER BY groupCode
</select>
@@ -3204,8 +3447,8 @@
leavehospitaldistrictname AS groupName,
</when>
<otherwise>
- deptcode AS groupCode,
- deptname AS groupName,
+ leaveldeptcode AS groupCode,
+ leaveldeptname AS groupName,
</otherwise>
</choose>
COUNT(*) AS totalCount,
@@ -3242,12 +3485,12 @@
</when>
<otherwise>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="deptcodes" item="code" open="(" separator="," close=")">
#{code}
</foreach>
</if>
- GROUP BY deptcode, deptname
+ GROUP BY leaveldeptcode, leaveldeptname
ORDER BY groupCode
</otherwise>
</choose>
@@ -3394,8 +3637,8 @@
drname,
leavehospitaldistrictcode,
leavehospitaldistrictname,
- deptcode,
- deptname,
+ leaveldeptcode,
+ leaveldeptname,
sendstate,
preachform,
current_preachform,
@@ -3449,7 +3692,7 @@
</foreach>
</if>
<if test="deptcodes != null and deptcodes.size() > 0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="deptcodes" item="deptcode" open="(" separator=","
close=")">
#{deptcode}
@@ -3640,8 +3883,8 @@
t.task_name AS taskName,
d.asrtext AS optionresult,
d.score AS score,
- s.deptcode AS deptcode,
- s.deptname AS deptname,
+ s.leaveldeptcode AS deptcode,
+ s.leaveldeptname AS deptname,
s.leavehospitaldistrictcode AS leavehospitaldistrictcode,
s.leavehospitaldistrictname AS leavehospitaldistrictname,
d.targetvalue AS targetvalue,
@@ -3748,8 +3991,8 @@
d.targetvalue,
d.asrtext,
t.task_name,
- s.deptcode,
- s.deptname,
+ s.leaveldeptcode,
+ s.leaveldeptname,
s.leavehospitaldistrictcode,
s.leavehospitaldistrictname,
d.value_type
@@ -3761,7 +4004,7 @@
<select id="statQuestionOptionByKsOrBq" resultType="com.smartor.domain.DTO.QuestionCountKsOrBqDTO"
parameterType="com.smartor.domain.VO.QuestionCountKsOrBqVO">
SELECT
- s.deptname AS deptname,
+ IFNULL(s.leaveldeptname, s.deptname) AS deptname,
s.leavehospitaldistrictname AS leavehospitaldistrictname,
d.questiontext AS questionText,
d.targetvalue AS targetvalue, -- 鎵�鏈夐�夐」鎷兼帴
@@ -3791,7 +4034,7 @@
</foreach>
</if>
<if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
- AND deptcode IN
+ AND leaveldeptcode IN
<foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
close=")">
#{leaveldeptcode}
@@ -3808,7 +4051,7 @@
</foreach>
</if>
<if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
- OR deptcode IN
+ OR leaveldeptcode IN
<foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
close=")">
#{leaveldeptcode}
@@ -3843,8 +4086,8 @@
s.leavehospitaldistrictname AS name,
</when>
<otherwise>
- s.deptcode AS code,
- s.deptname AS name,
+ s.leaveldeptcode AS code,
+ s.leaveldeptname AS name,
</otherwise>
</choose>
CAST(d.score AS DECIMAL(10,4)) AS w
@@ -3897,10 +4140,10 @@
</if>
</when>
<otherwise>
- AND s.deptcode IS NOT NULL AND s.deptcode <> ''
- AND s.deptname IS NOT NULL AND s.deptname <> ''
+ AND s.leaveldeptcode IS NOT NULL AND s.leaveldeptcode <> ''
+ AND s.leaveldeptname IS NOT NULL AND s.leaveldeptname <> ''
<if test="deptCodes != null and deptCodes.size() > 0">
- AND s.deptcode IN
+ AND s.leaveldeptcode IN
<foreach collection="deptCodes" item="deptCode" open="(" separator="," close=")">
#{deptCode}
</foreach>
--
Gitblit v1.9.3