| | |
| | | <select id="selectPatMedInhospCount" parameterType="com.smartor.domain.PatMedReq" |
| | | resultType="com.smartor.domain.PatMedRes"> |
| | | SELECT SUM( rs ) AS rs, |
| | | SUM( rc ) AS rc |
| | | SUM( rc ) AS rc, |
| | | SUM( scsf ) AS scsf, |
| | | SUM( zcsf ) AS zcsf, |
| | | SUM( zbsf ) AS zbsf |
| | | FROM ( |
| | | <!-- 出院人次--> |
| | | SELECT |
| | | COUNT(1) AS rc, |
| | | 0 AS rs |
| | | 0 AS rs, |
| | | 0 AS scsf, |
| | | 0 AS zcsf, |
| | | 0 AS zbsf |
| | | FROM |
| | | pat_med_inhosp |
| | | <where> |
| | |
| | | </foreach> |
| | | </if> |
| | | </if> |
| | | |
| | | </where> |
| | | <!-- 随访服务人数 --> |
| | | union all |
| | | select |
| | | 0 AS rc, |
| | | count(1) AS rs |
| | | count(1) AS rs, |
| | | 0 AS scsf, |
| | | 0 AS zcsf, |
| | | 0 AS zbsf |
| | | FROM |
| | | service_subtask |
| | | <where> |
| | |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | <!-- 首次随访人数 --> |
| | | union all |
| | | select |
| | | 0 AS rc, |
| | | 0 AS rs, |
| | | count(1) AS scsf, |
| | | 0 AS zcsf, |
| | | 0 AS zbsf |
| | | FROM |
| | | service_subtask |
| | | <where> |
| | | del_flag = 0 |
| | | and service_type=2 |
| | | and is_visit_again = 0 |
| | | <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> |
| | | </where> |
| | | <!-- 再次随访人数 --> |
| | | union all |
| | | select |
| | | 0 AS rc, |
| | | 0 AS rs, |
| | | 0 AS scsf, |
| | | count(1) AS zcsf, |
| | | 0 AS zbsf |
| | | FROM |
| | | service_subtask |
| | | <where> |
| | | del_flag = 0 |
| | | and service_type=2 |
| | | and is_visit_again = 1 |
| | | <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> |
| | | </where> |
| | | <!-- 专病随访人数 --> |
| | | union all |
| | | select |
| | | 0 AS rc, |
| | | 0 AS rs, |
| | | 0 AS scsf, |
| | | 0 AS zcsf, |
| | | count(1) AS zbsf |
| | | FROM |
| | | service_subtask |
| | | <where> |
| | | del_flag = 0 |
| | | and service_type=13 |
| | | <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> |
| | | </where> |
| | | ) AS combined_data |
| | | </select> |
| | | |
| | | </mapper> |