| | |
| | | pat_archive a ON a.id = b.patid |
| | | LEFT JOIN |
| | | pat_archivetag c ON c.patid = a.id AND (c.del_flag = 0 OR c.del_flag IS NULL) |
| | | <where> |
| | | a.del_flag = 0 |
| | | where 1=1 |
| | | AND a.del_flag = 0 |
| | | AND b.del_flag = 0 |
| | | AND a.idcardno IS NOT NULL |
| | | <if test="startOutHospTime != null ">and date_format(b.endtime,'%y%m%d') >= |
| | |
| | | #{leaveldeptcode} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | b.inhospid, |
| | | a.age, |
| | |
| | | b.fuspecialadvice |
| | | FROM |
| | | pat_med_inhosp b |
| | | |
| | | <where> |
| | | <if test="serialnum != null ">and b.serialnum = #{serialnum}</if> |
| | | |
| | | </where> |
| | | where 1=1 |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="serialnum != null "> |
| | | and b.serialnum = #{serialnum} |
| | | </if> |
| | | order by b.inhospid desc |
| | | </select> |
| | | |
| | |
| | | FROM |
| | | pat_med_inhosp b, |
| | | pat_archive a |
| | | <where> |
| | | a.del_flag=0 |
| | | where 1=1 |
| | | and a.del_flag=0 |
| | | and b.del_flag=0 |
| | | and a.id = b.patid |
| | | AND a.idcardno != '' |
| | | <if test="orgid != null and orgid != ''"> |
| | | and a.orgid = #{orgid} |
| | | </if> |
| | | <if test="hospitalname != null and hospitalname != ''">and hospitalname like concat('%', #{hospitalname}, |
| | | '%') |
| | | </if> |
| | |
| | | #{leaveldeptcode} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | order by b.inhospid desc |
| | | </select> |
| | | |
| | |
| | | <if test="mz != null"> |
| | | SELECT deptname |
| | | FROM pat_med_outhosp |
| | | <where> |
| | | del_flag=0 |
| | | where 1=1 |
| | | and del_flag=0 |
| | | <if test="deptcodeList != null and deptcodeList.size() > 0"> |
| | | and deptcode in |
| | | <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | </if> |
| | | <if test="mz != null and zy != null"> |
| | | UNION ALL |
| | |
| | | <if test="zy != null"> |
| | | SELECT deptname |
| | | FROM pat_med_inhosp |
| | | <where> |
| | | del_flag=0 |
| | | where 1=1 |
| | | and del_flag=0 |
| | | and inhospstate=0 |
| | | <if test="deptcodeList != null and deptcodeList.size() > 0"> |
| | | and deptcode in |
| | |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | </if> |
| | | <if test="cy != null and zy != null"> |
| | | UNION ALL |
| | | SELECT deptname |
| | | FROM pat_med_inhosp |
| | | <where> |
| | | del_flag=0 |
| | | where 1=1 |
| | | and del_flag=0 |
| | | and inhospstate=1 |
| | | <if test="deptcodeList != null and deptcodeList.size() > 0"> |
| | | and deptcode in |
| | |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | </if> |
| | | <if test="mz != null and zy != null and cy==null"> |
| | | UNION ALL |
| | | SELECT deptname |
| | | FROM pat_med_inhosp |
| | | <where> |
| | | del_flag=0 |
| | | where 1=1 |
| | | and del_flag=0 |
| | | and inhospstate=1 |
| | | <if test="deptcodeList != null and deptcodeList.size() > 0"> |
| | | and deptcode in |
| | |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | </if> |
| | | ) AS combined |
| | | GROUP BY deptname; |
| | |
| | | 0 AS zbsf |
| | | FROM |
| | | pat_med_inhosp |
| | | <where> |
| | | del_flag=0 |
| | | <if test="orgid != null"> |
| | | AND orgid = #{orgid} |
| | | where 1=1 |
| | | and del_flag=0 |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="zy != null"> |
| | | and inhospstate=0 |
| | |
| | | </foreach> |
| | | </if> |
| | | </if> |
| | | </where> |
| | | <!-- 随访服务人数 --> |
| | | union all |
| | | select |
| | |
| | | 0 AS zbsf |
| | | FROM |
| | | service_subtask |
| | | <where> |
| | | del_flag = 0 |
| | | where 1=1 |
| | | and del_flag = 0 |
| | | and service_type=2 |
| | | <if test="orgid != null"> |
| | | AND orgid = #{orgid} |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="startDate != null"> |
| | | AND date_format( visit_time, '%y%m%d' ) >= date_format( #{startDate}, '%y%m%d' ) |
| | |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | <!-- 首次随访人数 --> |
| | | union all |
| | | select |
| | |
| | | 0 AS zbsf |
| | | FROM |
| | | service_subtask |
| | | <where> |
| | | del_flag = 0 |
| | | where 1=1 |
| | | and del_flag = 0 |
| | | and service_type=2 |
| | | and is_visit_again = 0 |
| | | <if test="orgid != null"> |
| | | AND orgid = #{orgid} |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="startDate != null"> |
| | | AND date_format( visit_time, '%y%m%d' ) >= date_format( #{startDate}, '%y%m%d' ) |
| | |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | <!-- 再次随访人数 --> |
| | | union all |
| | | select |
| | |
| | | 0 AS zbsf |
| | | FROM |
| | | service_subtask |
| | | <where> |
| | | del_flag = 0 |
| | | where 1=1 |
| | | and del_flag = 0 |
| | | and service_type=2 |
| | | and is_visit_again = 1 |
| | | <if test="orgid != null"> |
| | | AND orgid = #{orgid} |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="startDate != null"> |
| | | AND date_format( visit_time, '%y%m%d' ) >= date_format( #{startDate}, '%y%m%d' ) |
| | |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | <!-- 专病随访人数 --> |
| | | union all |
| | | select |
| | |
| | | count(1) AS zbsf |
| | | FROM |
| | | service_subtask |
| | | <where> |
| | | del_flag = 0 |
| | | where 1=1 |
| | | and del_flag = 0 |
| | | and service_type=13 |
| | | <if test="orgid != null"> |
| | | AND orgid = #{orgid} |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="startDate != null"> |
| | | AND date_format( visit_time, '%y%m%d' ) >= date_format( #{startDate}, '%y%m%d' ) |
| | |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | ) AS combined_data |
| | | </select> |
| | | |