| | |
| | | </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 |
| | | |
| | | -- 出院人次数据 |
| | |
| | | </foreach> |
| | | </if> |
| | | |
| | | <!-- GROUP BY--> |
| | | <!-- UNION ALL--> |
| | | |
| | | <!-- -- 门诊人次数据--> |
| | | <!-- SELECT--> |
| | | <!-- <choose>--> |
| | | <!-- <when test="timeType == 'day'">--> |
| | | <!-- DATE_FORMAT(endtime, '%Y-%m-%d')--> |
| | | <!-- DATE_FORMAT(admitdate, '%Y-%m-%d') AS timePeriod,--> |
| | | <!-- </when>--> |
| | | <!-- <when test="timeType == 'month'">--> |
| | | <!-- DATE_FORMAT(endtime, '%Y-%m')--> |
| | | <!-- DATE_FORMAT(admitdate, '%Y-%m') AS timePeriod,--> |
| | | <!-- </when>--> |
| | | <!-- <when test="timeType == 'year'">--> |
| | | <!-- DATE_FORMAT(endtime, '%Y')--> |
| | | <!-- DATE_FORMAT(admitdate, '%Y') AS timePeriod,--> |
| | | <!-- </when>--> |
| | | <!-- <when test="timeType == 'week'">--> |
| | | <!-- CONCAT(YEAR(endtime), '-W', LPAD(WEEK(endtime, 1), 2, '0'))--> |
| | | <!-- CONCAT(YEAR(admitdate), '-W', LPAD(WEEK(admitdate, 1), 2, '0')) AS timePeriod,--> |
| | | <!-- </when>--> |
| | | <!-- <otherwise>--> |
| | | <!-- DATE_FORMAT(endtime, '%Y-%m-%d')--> |
| | | <!-- 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>--> |
| | | |
| | | UNION ALL |
| | | <!-- <if test="deptcodes != null and deptcodes.size() > 0">--> |
| | | <!-- AND deptcode IN--> |
| | | <!-- <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">--> |
| | | <!-- #{deptcode}--> |
| | | <!-- </foreach>--> |
| | | <!-- </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> |
| | | |
| | | <!-- 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 |
| | |
| | | </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, |