| | |
| | | ) a |
| | | </select> |
| | | |
| | | <select id="selectTimelyRateBatch" parameterType="com.smartor.domain.ServiceSubtask" resultType="map"> |
| | | SELECT |
| | | <if test="deptcode != null">deptcode as groupKey,</if> |
| | | <if test="leavehospitaldistrictcode != null">leavehospitaldistrictcode as groupKey,</if> |
| | | <if test="drcode != null">drcode as groupKey,</if> |
| | | 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 >= #{starttime} |
| | | AND visit_time < DATE_ADD(#{endtime}, INTERVAL 1 DAY) |
| | | <if test="orgid != null">AND orgid = #{orgid}</if> |
| | | GROUP BY groupKey |
| | | </select> |
| | | |
| | | |
| | | <select id="selectTimelyRateDetail" parameterType="com.smartor.domain.ServiceSubtask" |
| | | resultMap="ServiceSubtaskResult"> |
| | | <include refid="selectServiceSubtaskVo"/> |
| | |
| | | </foreach> |
| | | </if> |
| | | <if test="startTime != null and endTime!=null"> |
| | | AND date_format(visit_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d') |
| | | AND date_format(visit_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') |
| | | AND visit_time >= DATE(#{startTime}) |
| | | AND visit_time < DATE_ADD(DATE(#{endTime}), INTERVAL 1 DAY) |
| | | </if> |
| | | <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if> |
| | | <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if> |