| | |
| | | <select id="selectServiceSubtaskList" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity" |
| | | resultMap="ServiceSubtaskResult"> |
| | | <include refid="selectServiceSubtaskVo"/> |
| | | where del_flag = 0 |
| | | where 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> |
| | | </if> |
| | | <if test="deptOrDistrict==2"> |
| | | AND (1=1 |
| | | <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0"> |
| | | AND (leavehospitaldistrictcode IN |
| | | AND leavehospitaldistrictcode IN |
| | | <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | |
| | | <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0"> |
| | | OR deptcode IN |
| | | <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator="," |
| | | close="))"> |
| | | close=")"> |
| | | #{leaveldeptcode} |
| | | </foreach> |
| | | </if> |
| | | </if>) |
| | | </if> |
| | | <if test="deptOrDistrict==3"> |
| | | AND (1=1 |
| | | <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0"> |
| | | AND (leavehospitaldistrictcode IN |
| | | AND leavehospitaldistrictcode IN |
| | | <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | |
| | | </foreach> |
| | | </if> |
| | | <if test=" visitDeptCodes != null and visitDeptCodes.size()>0"> |
| | | and visit_dept_code IN |
| | | AND visit_dept_code IN |
| | | <foreach collection="visitDeptCodes" item="visitDeptCode" open="(" separator="," |
| | | close="))"> |
| | | close=")"> |
| | | #{visitDeptCode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </if> |
| | | |
| | | <if test="deptOrDistrict==4"> |
| | | AND (1=1 |
| | | <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0"> |
| | | AND (leavehospitaldistrictcode IN |
| | | AND leavehospitaldistrictcode IN |
| | | <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | |
| | | <if test=" visitDeptCodes != null and visitDeptCodes.size()>0"> |
| | | OR visit_dept_code IN |
| | | <foreach collection="visitDeptCodes" item="visitDeptCode" open="(" separator="," |
| | | close="))"> |
| | | close=")"> |
| | | #{visitDeptCode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </if> |
| | | |
| | | <if test="visitTime != null"> |
| | |
| | | AND date_format(visit_time,'%y%m%d') <= date_format(#{endtime},'%y%m%d') |
| | | </if> |
| | | <if test="orgid != null and orgid != ''">and orgid = #{orgid}</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="isabnormal != null">and isabnormal = #{isabnormal}</if> |
| | |
| | | ) a |
| | | </select> |
| | | |
| | | <select id="selectTimelyRateBatch" parameterType="com.smartor.domain.ServiceSubtask" resultType="map"> |
| | | <select id="selectTimelyRateBatch" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity" resultType="map"> |
| | | SELECT |
| | | <if test="groupKey != null and groupKey != ''"> |
| | | ${groupKey} as groupKey, |
| | | </if> |
| | | SUM(CASE WHEN DATE(visit_time) < DATE(IFNULL(finishtime, NOW())) THEN 1 ELSE 0 END) / COUNT(*) as rate |
| | | SUM(CASE WHEN finishtime IS NOT NULL AND DATE(visit_time) <= DATE(finishtime) THEN 1 ELSE 0 END) / COUNT(*) AS finishRate, |
| | | <if test="rateDay != null"> |
| | | SUM(CASE WHEN finishtime IS NOT NULL AND DATEDIFF(finishtime, endtime) <= #{rateDay} THEN 1 ELSE 0 END) / COUNT(*) AS rate |
| | | </if> |
| | | <if test="rateDay == null"> |
| | | NULL AS rate |
| | | </if> |
| | | 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() |
| | | AND DATE(visit_time) < DATE(NOW()) |
| | | </if> |
| | | <if test="starttime != null and endtime!=null"> |
| | | AND visit_time >= #{starttime} |
| | | AND visit_time < DATE_ADD(#{endtime}, INTERVAL 1 DAY) |
| | | </if> |
| | | <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if> |
| | | <if test="orgid != null and orgid != ''">AND orgid = #{orgid}</if> |
| | | <if test="deptcode != null and deptcode != ''">and deptcode = #{deptcode}</if> |
| | | <if test="deptname != null and deptname != ''">and deptname = #{deptname}</if> |
| | | <if test="isabnormal != null">and isabnormal = #{isabnormal}</if> |
| | |
| | | </if> |
| | | <if test="visitCount != null and visitCount > 1"> |
| | | AND visit_count > 1 |
| | | </if> |
| | | <if test="serviceTypeList != null"> |
| | | AND service_type IN |
| | | <foreach collection="serviceTypeList" item="serviceType" open="(" separator="," |
| | | close=")"> |
| | | #{serviceType} |
| | | </foreach> |
| | | </if> |
| | | <if test="groupKey != null and groupKey != ''"> |
| | | AND ${groupKey} IN |
| | |
| | | AND date_format(visit_time,'%y%m%d') <= date_format(#{endtime},'%y%m%d') |
| | | </if> |
| | | <if test="orgid != null and orgid != ''">and orgid = #{orgid}</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="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="continueContent != null ">continue_content = #{continueContent},</if> |
| | | </trim> |
| | | where patid = #{patid} and taskid = #{taskid} |
| | | <if test="id != null "> |
| | | and id = #{id} |
| | | </if> |
| | | </update> |
| | | |
| | | <update id="updateServiceSubtaskByTaskGuid" parameterType="com.smartor.domain.ServiceSubtask"> |
| | |
| | | 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 = '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 |
| | | SUM(CASE WHEN excep IS NOT NULL AND excep = '2' THEN 1 ELSE 0 END) AS jg, |
| | | COUNT(1) as total |
| | | FROM service_subtask |
| | | where 1=1 |
| | | and del_flag = 0 |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- |
| | | 按病区或科室分组统计 continue_flag 数量 |
| | | 传了 leavehospitaldistrictcodes → 按病区维度 |
| | | 传了 deptcodes → 按科室维度 |
| | | 都不传 → 按病区维度统计全量 |
| | | --> |
| | | <!-- 按病区分组统计延续护理数量 --> |
| | | <select id="getContinueNurseCount" |
| | | parameterType="com.smartor.domain.VO.ServiceSubtaskCotinueCountVO" |
| | | resultType="java.util.Map"> |
| | | SELECT |
| | | leavehospitaldistrictcode AS groupCode, |
| | | leavehospitaldistrictname 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 leavehospitaldistrictcode IS NOT NULL AND leavehospitaldistrictcode != '' |
| | | <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="code" open="(" separator="," close=")"> |
| | | #{code} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY leavehospitaldistrictcode, leavehospitaldistrictname |
| | | ORDER BY groupCode |
| | | </select> |
| | | |
| | | <!-- 按科室分组统计延续护理数量 --> |
| | | <select id="getContinueNurseCountByDept" |
| | | parameterType="com.smartor.domain.VO.ServiceSubtaskCotinueCountVO" |
| | | resultType="java.util.Map"> |
| | | SELECT |
| | | deptcode AS groupCode, |
| | | deptname 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 != '' |
| | | <if test="orgid != null and orgid != ''"> |
| | | AND orgid = #{orgid} |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | AND deptcode IN |
| | | <foreach collection="deptcodes" item="code" open="(" separator="," close=")"> |
| | | #{code} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY deptcode, deptname |
| | | ORDER BY groupCode |
| | | </select> |
| | | |
| | | </mapper> |