From 43e7dc349b8bc1515911e64fb12ea820afd1b0d2 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 23 三月 2026 17:07:34 +0800
Subject: [PATCH] 门急诊分表代码(增、改、查)提交
---
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml | 352 ++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 221 insertions(+), 131 deletions(-)
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index cf129d9..c28555d 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -87,6 +87,11 @@
<result property="currentPreachform" column="current_preachform"/>
<result property="taskSituation" column="task_situation"/>
<result property="isabnormal" column="isabnormal"/>
+ <result property="continueFlag" column="continue_flag"/>
+ <result property="continueTimeNow" column="continue_time_now"/>
+ <result property="continueContent" column="continue_content"/>
+ <result property="continueCount" column="continue_count"/>
+ <result property="continueTimeNext" column="continue_time_next"/>
</resultMap>
<resultMap type="com.smartor.domain.ServiceSubtaskCount" id="ServiceSubtaskResult2">
@@ -202,11 +207,16 @@
visit_type,
management_doctor,
management_doctor_code,
+ continue_flag,
+ continue_time_now,
+ continue_content,
+ continue_count,
+ continue_time_next,
task_situation
from service_subtask
</sql>
- <select id="selectServiceSubtaskBySendstate" parameterType="com.smartor.domain.ServiceSubtaskVO"
+ <select id="selectServiceSubtaskBySendstate" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
resultMap="ServiceSubtaskResult">
<include refid="selectServiceSubtaskVo"/>
where 1=1
@@ -215,6 +225,10 @@
and orgid = #{orgid}
</if>
<if test="taskid != null ">and taskid = #{taskid}</if>
+ <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
+ <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
+ <if test="continueCount != null ">and continue_count = #{continueCount}</if>
+ <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext}</if>
<if test="serviceType != null ">and service_type = #{serviceType}</if>
<if test="patid != null ">and patid = #{patid}</if>
<if test="sendstates!=null">
@@ -226,28 +240,35 @@
</if>
</select>
- <select id="queryServiceSubtaskList" parameterType="com.smartor.domain.ServiceSubtaskVO"
- resultMap="ServiceSubtaskResult">
- <include refid="selectServiceSubtaskVo"/>
- where 1=1
- and del_flag = 0
- <if test="orgid != null and orgid != ''">
- and orgid = #{orgid}
- </if>
- <if test="taskid != null ">and taskid = #{taskid}</if>
- <if test="visitTime != null">
- AND date_format(visit_time,'%y%m%d') <= date_format(#{visitTime},'%y%m%d')
- </if>
- <if test="sendstate != null ">and sendstate = #{sendstate}</if>
-
- </select>
-
-
- <select id="selectServiceSubtaskList" parameterType="com.smartor.domain.ServiceSubtaskVO"
+ <select id="queryServiceSubtaskList" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
resultMap="ServiceSubtaskResult">
<include refid="selectServiceSubtaskVo"/>
where 1=1
and del_flag = 0
+ <if test="orgid != null and orgid != ''">
+ and orgid = #{orgid}
+ </if>
+ <if test="taskid != null ">and taskid = #{taskid}</if>
+ <if test="visitTime != null">
+ AND date_format(visit_time,'%y%m%d') <= date_format(#{visitTime},'%y%m%d')
+ </if>
+ <if test="sendstate != null ">and sendstate = #{sendstate}</if>
+ <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
+ <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
+ <if test="continueCount != null ">and continue_count = #{continueCount}</if>
+ <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext}</if>
+ </select>
+
+
+ <select id="selectServiceSubtaskList" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
+ resultMap="ServiceSubtaskResult">
+ <include refid="selectServiceSubtaskVo"/>
+ where 1=1
+ and del_flag = 0
+ <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
+ <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
+ <if test="continueCount != null ">and continue_count = #{continueCount}</if>
+ <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext}</if>
<if test="sendname != null and sendname != ''">and sendname like concat('%', #{sendname}, '%')</if>
<if test="phone != null and phone != ''">and phone = #{phone}</if>
<if test="leavehospitaldistrictcode != null and leavehospitaldistrictcode != ''">and
@@ -297,10 +318,10 @@
AND date_format(endtime,'%y%m%d') <= date_format(#{endOutHospTime},'%y%m%d')
</if>
<if test="startSendDateTime != null">
- AND date_format(long_send_time,'%y%m%d') >= date_format(#{startSendDateTime},'%y%m%d')
+ AND date_format(visit_time,'%y%m%d') >= date_format(#{startSendDateTime},'%y%m%d')
</if>
<if test="endSendDateTime != null">
- AND date_format(long_send_time,'%y%m%d') <= date_format(#{endSendDateTime},'%y%m%d')
+ AND date_format(visit_time,'%y%m%d') <= date_format(#{endSendDateTime},'%y%m%d')
</if>
<if test="longSendTime != null">
@@ -382,7 +403,6 @@
<if test="excep != null ">and excep = #{excep}</if>
<if test="nurseName != null ">and nurse_name = #{nurseName}</if>
<if test="score != null">and score = #{score}</if>
- <!-- <if test="visitCount != null">and visit_count = #{visitCount}</if>-->
<if test="visitCount != null and visitCount == 1">
AND visit_count = 1
</if>
@@ -395,10 +415,6 @@
<if test="taskGuid != null">and task_guid = #{taskGuid}</if>
<if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
<if test="isVisitAgain != null">and is_visit_again = #{isVisitAgain}</if>
- <!-- <if test="dateLimit != null and dateLimit = '1'"> and CURDATE() + 1 > long_send_time</if>-->
- <!-- <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="visitCount != null and visitCount > 1 and visitDeptCodes != null and visitDeptCodes.size() > 0">
AND visit_dept_code IN
<foreach collection="visitDeptCodes" item="visitDeptCodes" open="("
@@ -415,10 +431,9 @@
<if test="sort != null and sort==6">order by admindate desc</if>
<if test="sort != null and sort==7">order by visit_time asc</if>
<if test="sort != null and sort==8">order by visit_time desc</if>
-
- <!-- order by update_time desc,id desc -->
+ <if test="pageSize != null and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
</select>
- <select id="getCompensateServiceSubtaskList" parameterType="com.smartor.domain.ServiceSubtaskVO"
+ <select id="getCompensateServiceSubtaskList" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
resultMap="ServiceSubtaskResult">
<include refid="selectServiceSubtaskVo"/>
where del_flag = 0
@@ -429,9 +444,13 @@
AND date_format(visit_time,'%y%m%d') <= date_format(#{visitTime},'%y%m%d')
</if>
<if test="sendstate != null ">and sendstate = #{sendstate}</if>
+ <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
+ <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
+ <if test="continueCount != null ">and continue_count = #{continueCount}</if>
+ <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext}</if>
</select>
- <select id="selectServiceSubtaskListByCreateTime" parameterType="com.smartor.domain.ServiceSubtaskVO"
+ <select id="selectServiceSubtaskListByCreateTime" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
resultMap="ServiceSubtaskResult">
<include refid="selectServiceSubtaskVo"/>
where del_flag = 0
@@ -454,11 +473,15 @@
<if test="managementDoctor != null">and management_doctor = #{managementDoctor}</if>
<if test="currentPreachform != null">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>
+ <if test="continueCount != null ">and continue_count = #{continueCount}</if>
+ <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext}</if>
</select>
- <select id="selectServiceSubtaskListAgain" parameterType="com.smartor.domain.ServiceSubtaskVO"
+ <select id="selectServiceSubtaskListAgain" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
resultMap="ServiceSubtaskResult">
<include refid="selectServiceSubtaskVo"/>
where 1=1
@@ -511,7 +534,10 @@
<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>
-
+ <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
+ <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
+ <if test="continueCount != null ">and continue_count = #{continueCount}</if>
+ <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext}</if>
</select>
<select id="selectSendstateByCondition" parameterType="com.smartor.domain.ServiceSubtask" resultType="Integer">
@@ -567,6 +593,8 @@
SUM(CASE WHEN DATE(visit_time) < DATE(IFNULL(finishtime, NOW())) THEN 1 ELSE 0 END) / COUNT(*) as rate
FROM service_subtask
WHERE del_flag = 0
+ AND visit_time IS NOT NULL
+ AND finishtime IS NOT NULL
<if test="orgid != null">AND orgid = #{orgid}</if>
<if test="starttime == null and endtime==null">
AND visit_time < NOW()
@@ -644,6 +672,10 @@
<if test="taskName != null">and task_name like concat('%',#{taskName}, '%')</if>
<if test="sendstate != null">and sendstate = #{sendstate}</if>
<if test="orgid != null">and orgid =#{orgid}</if>
+ <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
+ <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
+ <if test="continueCount != null ">and continue_count = #{continueCount}</if>
+ <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext}</if>
GROUP BY sendname,sendstate,starttime,endtime,nurse_name,phone,sex,task_name,leavediagname,visit_time ORDER BY
visit_time
<if test="pageSize != null and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
@@ -737,6 +769,11 @@
<if test="currentPreachform != null">current_preachform,</if>
<if test="taskSituation != null">task_situation,</if>
<if test="isabnormal != null">isabnormal,</if>
+ <if test="continueFlag != null ">continue_flag,</if>
+ <if test="continueTimeNow != null ">continue_time_now,</if>
+ <if test="continueCount != null ">continue_count,</if>
+ <if test="continueTimeNext != null ">continue_time_next,</if>
+ <if test="continueContent != null ">continue_content,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sendname != null">#{sendname},</if>
@@ -823,6 +860,11 @@
<if test="currentPreachform != null">#{currentPreachform},</if>
<if test="taskSituation != null">#{taskSituation},</if>
<if test="isabnormal != null">#{isabnormal},</if>
+ <if test="continueFlag != null ">#{continueFlag},</if>
+ <if test="continueTimeNow != null ">#{continueTimeNow,jdbcType=TIMESTAMP},</if>
+ <if test="continueCount != null ">#{continueCount},</if>
+ <if test="continueTimeNext != null ">#{continueTimeNext,jdbcType=TIMESTAMP},</if>
+ <if test="continueContent != null ">#{continueContent},</if>
</trim>
</insert>
@@ -914,6 +956,11 @@
<if test="currentPreachform != null">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>
+ <if test="continueTimeNow != null ">continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP},</if>
+ <if test="continueCount != null ">continue_count = #{continueCount},</if>
+ <if test="continueTimeNext != null ">continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP},</if>
+ <if test="continueContent != null ">continue_content = #{continueContent},</if>
</trim>
where id = #{id}
</update>
@@ -1006,6 +1053,11 @@
<if test="currentPreachform != null">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>
+ <if test="continueTimeNow != null ">continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP},</if>
+ <if test="continueCount != null ">continue_count = #{continueCount},</if>
+ <if test="continueTimeNext != null ">continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP},</if>
+ <if test="continueContent != null ">continue_content = #{continueContent},</if>
</trim>
where 1=1
<if test="patid != null ">and patid = #{patid}</if>
@@ -1102,6 +1154,11 @@
<if test="currentPreachform != null">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>
+ <if test="continueTimeNow != null ">continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP},</if>
+ <if test="continueCount != null ">continue_count = #{continueCount},</if>
+ <if test="continueTimeNext != null ">continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP},</if>
+ <if test="continueContent != null ">continue_content = #{continueContent},</if>
</trim>
where patid = #{patid} and taskid = #{taskid}
</update>
@@ -1193,6 +1250,11 @@
<if test="currentPreachform != null">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>
+ <if test="continueTimeNow != null ">continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP},</if>
+ <if test="continueCount != null ">continue_count = #{continueCount},</if>
+ <if test="continueTimeNext != null ">continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP},</if>
+ <if test="continueContent != null ">continue_content = #{continueContent},</if>
</trim>
where task_guid = #{taskGuid} and task_name = #{taskName}
</update>
@@ -1247,6 +1309,11 @@
send_type,
recordid,
exrecallcount,
+ continue_flag,
+ continue_time_now,
+ continue_content,
+ continue_count,
+ continue_time_next,
task_situation
from service_subtask
where 1=1
@@ -1282,6 +1349,10 @@
<if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
<if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</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>
+ <if test="continueCount != null ">and continue_count = #{continueCount}</if>
+ <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP}</if>
<!-- 鐩墠鍙粺璁¤闊冲拰闂嵎 -->
<if test="type != null">
and type = #{type}
@@ -1334,6 +1405,10 @@
<if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
<if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</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>
+ <if test="continueCount != null ">and continue_count = #{continueCount}</if>
+ <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP}</if>
<!-- 鐩墠鍙粺璁¤闊冲拰闂嵎 -->
<if test="type != null">
and type = #{type}
@@ -1852,25 +1927,6 @@
</foreach>
</if>
- <!-- GROUP BY-->
- <!-- <choose>-->
- <!-- <when test="timeType == 'day'">-->
- <!-- DATE_FORMAT(visit_time, '%Y-%m-%d')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'month'">-->
- <!-- DATE_FORMAT(visit_time, '%Y-%m')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'year'">-->
- <!-- DATE_FORMAT(visit_time, '%Y')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'week'">-->
- <!-- CONCAT(YEAR(visit_time), '-W', LPAD(WEEK(visit_time, 1), 2, '0'))-->
- <!-- </when>-->
- <!-- <otherwise>-->
- <!-- DATE_FORMAT(visit_time, '%Y-%m-%d')-->
- <!-- </otherwise>-->
- <!-- </choose>-->
-
UNION ALL
-- 鍑洪櫌浜烘鏁版嵁
@@ -1922,92 +1978,55 @@
</foreach>
</if>
- <!-- GROUP BY-->
- <!-- <choose>-->
- <!-- <when test="timeType == 'day'">-->
- <!-- DATE_FORMAT(endtime, '%Y-%m-%d')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'month'">-->
- <!-- DATE_FORMAT(endtime, '%Y-%m')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'year'">-->
- <!-- DATE_FORMAT(endtime, '%Y')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'week'">-->
- <!-- CONCAT(YEAR(endtime), '-W', LPAD(WEEK(endtime, 1), 2, '0'))-->
- <!-- </when>-->
- <!-- <otherwise>-->
- <!-- DATE_FORMAT(endtime, '%Y-%m-%d')-->
- <!-- </otherwise>-->
- <!-- </choose>-->
+<!-- UNION ALL-->
- UNION ALL
+<!-- -- 闂ㄨ瘖浜烘鏁版嵁-->
+<!-- SELECT-->
+<!-- <choose>-->
+<!-- <when test="timeType == 'day'">-->
+<!-- DATE_FORMAT(admitdate, '%Y-%m-%d') AS timePeriod,-->
+<!-- </when>-->
+<!-- <when test="timeType == 'month'">-->
+<!-- DATE_FORMAT(admitdate, '%Y-%m') AS timePeriod,-->
+<!-- </when>-->
+<!-- <when test="timeType == 'year'">-->
+<!-- DATE_FORMAT(admitdate, '%Y') AS timePeriod,-->
+<!-- </when>-->
+<!-- <when test="timeType == 'week'">-->
+<!-- CONCAT(YEAR(admitdate), '-W', LPAD(WEEK(admitdate, 1), 2, '0')) AS timePeriod,-->
+<!-- </when>-->
+<!-- <otherwise>-->
+<!-- DATE_FORMAT(admitdate, '%Y-%m-%d') AS timePeriod,-->
+<!-- </otherwise>-->
+<!-- </choose>-->
+<!-- 0 AS dischargeFollowCount,-->
+<!-- 0 AS outpatientFollowCount,-->
+<!-- 0 AS pmiCount,-->
+<!-- 1 AS pmoCount-->
+<!-- FROM pat_med_outhosp-->
+<!-- WHERE del_flag = '0'-->
+<!-- <if test="startDate != null and endDate != null">-->
+<!-- AND admitdate >= #{startDate}-->
+<!-- AND admitdate <= DATE_ADD(#{endDate}, INTERVAL 1 DAY)-->
+<!-- </if>-->
+<!-- <if test="orgid != null">-->
+<!-- AND orgid = #{orgid}-->
+<!-- </if>-->
- -- 闂ㄨ瘖浜烘鏁版嵁
- SELECT
- <choose>
- <when test="timeType == 'day'">
- DATE_FORMAT(admitdate, '%Y-%m-%d') AS timePeriod,
- </when>
- <when test="timeType == 'month'">
- DATE_FORMAT(admitdate, '%Y-%m') AS timePeriod,
- </when>
- <when test="timeType == 'year'">
- DATE_FORMAT(admitdate, '%Y') AS timePeriod,
- </when>
- <when test="timeType == 'week'">
- CONCAT(YEAR(admitdate), '-W', LPAD(WEEK(admitdate, 1), 2, '0')) AS timePeriod,
- </when>
- <otherwise>
- DATE_FORMAT(admitdate, '%Y-%m-%d') AS timePeriod,
- </otherwise>
- </choose>
- 0 AS dischargeFollowCount,
- 0 AS outpatientFollowCount,
- 0 AS pmiCount,
- 1 AS pmoCount
- FROM pat_med_outhosp
- WHERE del_flag = '0'
- <if test="startDate != null and endDate != null">
- AND admitdate >= #{startDate}
- AND admitdate <= DATE_ADD(#{endDate}, INTERVAL 1 DAY)
- </if>
- <if test="orgid != null">
- AND orgid = #{orgid}
- </if>
+<!-- <if test="deptcodes != null and deptcodes.size() > 0">-->
+<!-- AND deptcode IN-->
+<!-- <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">-->
+<!-- #{deptcode}-->
+<!-- </foreach>-->
+<!-- </if>-->
- <if test="deptcodes != null and deptcodes.size() > 0">
- AND deptcode IN
- <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
- #{deptcode}
- </foreach>
- </if>
-
- <!-- GROUP BY-->
- <!-- <choose>-->
- <!-- <when test="timeType == 'day'">-->
- <!-- DATE_FORMAT(admitdate, '%Y-%m-%d')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'month'">-->
- <!-- DATE_FORMAT(admitdate, '%Y-%m')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'year'">-->
- <!-- DATE_FORMAT(admitdate, '%Y')-->
- <!-- </when>-->
- <!-- <when test="timeType == 'week'">-->
- <!-- CONCAT(YEAR(admitdate), '-W', LPAD(WEEK(admitdate, 1), 2, '0'))-->
- <!-- </when>-->
- <!-- <otherwise>-->
- <!-- DATE_FORMAT(admitdate, '%Y-%m-%d')-->
- <!-- </otherwise>-->
- <!-- </choose>-->
) AS combined_data
GROUP BY timePeriod
ORDER BY timePeriod DESC
</select>
<!-- 浼樺寲鐨勭粺璁℃煡璇細鐩存帴鍦ㄦ暟鎹簱灞傚畬鎴愯仛鍚堣绠� -->
- <select id="countByCondition" parameterType="com.smartor.domain.ServiceSubtaskVO" resultType="map">
+ <select id="countByCondition" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity" resultType="map">
SELECT
SUM(CASE WHEN sendstate = 4 THEN 1 ELSE 0 END) AS wzx,
SUM(CASE WHEN sendstate != 4 AND sendstate != 2 THEN 1 ELSE 0 END) AS ysf,
@@ -2015,7 +2034,8 @@
SUM(CASE WHEN sendstate >= 3 OR sendstate = 1 THEN 1 ELSE 0 END) AS yfs,
SUM(CASE WHEN sendstate = 2 THEN 1 ELSE 0 END) AS dsf,
SUM(CASE WHEN sendstate = 1 THEN 1 ELSE 0 END) AS blq,
- SUM(CASE WHEN excep IS NOT NULL AND excep != '0' THEN 1 ELSE 0 END) AS yc
+ 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
FROM service_subtask
where 1=1
and del_flag = 0
@@ -2058,6 +2078,14 @@
#{leaveldeptcode}
</foreach>
</if>
+ </if>
+ <if test="visitCount != null and visitCount > 1 and visitDeptCodes != null and visitDeptCodes.size() > 0">
+ AND visit_dept_code IN
+ <foreach collection="visitDeptCodes" item="visitDeptCodes" open="("
+ separator=","
+ close=")">
+ #{visitDeptCodes}
+ </foreach>
</if>
<if test="leavehospitaldistrictname != null and leavehospitaldistrictname != ''">
AND leavehospitaldistrictname = #{leavehospitaldistrictname}
@@ -2129,10 +2157,10 @@
AND DATE_FORMAT(endtime,'%y%m%d') <= DATE_FORMAT(#{endOutHospTime},'%y%m%d')
</if>
<if test="startSendDateTime != null">
- AND DATE_FORMAT(long_send_time,'%y%m%d') >= DATE_FORMAT(#{startSendDateTime},'%y%m%d')
+ AND DATE_FORMAT(visit_time,'%y%m%d') >= DATE_FORMAT(#{startSendDateTime},'%y%m%d')
</if>
<if test="endSendDateTime != null">
- AND DATE_FORMAT(long_send_time,'%y%m%d') <= DATE_FORMAT(#{endSendDateTime},'%y%m%d')
+ AND DATE_FORMAT(visit_time,'%y%m%d') <= DATE_FORMAT(#{endSendDateTime},'%y%m%d')
</if>
<if test="longSendTime != null">
AND DATE_FORMAT(long_send_time,'%y%m%d') <= DATE_FORMAT(#{longSendTime},'%y%m%d')
@@ -2170,6 +2198,9 @@
<if test="guid != null and guid != ''">
AND guid = #{guid}
</if>
+ <if test="excep != null ">
+ AND excep = #{excep}
+ </if>
<if test="visitCount != null and visitCount == 1">
AND visit_count = 1
</if>
@@ -2178,4 +2209,63 @@
</if>
</select>
+
+ <select id="selectVisitCount" parameterType="com.smartor.domain.PatMedReq"
+ resultType="com.smartor.domain.PatMedRes">
+ select
+ 0 AS rc,
+ count(1) AS rs
+ FROM
+ service_subtask
+ where 1=1
+ and del_flag = 0
+ and service_type=3
+ <if test="orgid != null">
+ and orgid = #{orgid}
+ </if>
+ <if test="startDate != null">
+ AND date_format( visit_time, '%y%m%d' ) >= date_format( #{startDate}, '%y%m%d' )
+ </if>
+ <if test="endDate != null">
+ 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
+ <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
+ #{deptcode}
+ </foreach>
+ </if>
+ </select>
+
+ <select id="getCurrentUserServiceSubtaskCount" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity" resultType="map">
+ SELECT
+ COUNT(CASE WHEN sendstate = 2 AND date_format(visit_time,'%y%m%d') <= date_format(CURDATE(),'%y%m%d') THEN 1 END) AS pendingVisitCount,
+ COUNT(CASE WHEN sendstate = 5 THEN 1 END) AS failedVisitCount,
+ SUM(CASE WHEN excep IS NOT NULL AND excep = '1' THEN 1 ELSE 0 END) AS abnormalVisitCount,
+ SUM(CASE WHEN excep IS NOT NULL AND excep = '2' THEN 1 ELSE 0 END) AS warnningVisitCount,
+ COUNT(*) AS allVisitCount
+ FROM service_subtask
+ WHERE del_flag = '0'
+ AND service_type = '2'
+ AND visit_count = 1
+ <if test="orgid != null and orgid != ''">
+ AND orgid = #{orgid}
+ </if>
+ <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>
+ </select>
+
</mapper>
--
Gitblit v1.9.3