| | |
| | | pat_med_inhosp b |
| | | JOIN |
| | | 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 1=1 |
| | | AND a.del_flag = 0 |
| | | AND b.del_flag = 0 |
| | |
| | | 0 AS zbsf |
| | | FROM |
| | | pat_med_inhosp |
| | | JOIN |
| | | pat_archive ON pat_archive.id = pat_med_inhosp.patid |
| | | where 1=1 |
| | | and del_flag=0 |
| | | and pat_med_inhosp.del_flag=0 |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | and pat_med_inhosp.orgid = #{orgid} |
| | | </if> |
| | | AND pat_archive.idcardno IS NOT NULL |
| | | <if test="zy != null"> |
| | | and inhospstate=0 |
| | | and date_format(starttime,'%y%m%d') >= date_format(#{startDate},'%y%m%d') |
| | | and date_format(starttime,'%y%m%d') <= date_format(#{endDate},'%y%m%d') |
| | | and pat_med_inhosp.inhospstate=0 |
| | | and date_format(pat_med_inhosp.starttime,'%y%m%d') >= date_format(#{startDate},'%y%m%d') |
| | | and date_format(pat_med_inhosp.starttime,'%y%m%d') <= date_format(#{endDate},'%y%m%d') |
| | | <if test="deptcodeList != null and deptcodeList.size() > 0"> |
| | | and deptcode in |
| | | and pat_med_inhosp.deptcode in |
| | | <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | </if> |
| | | <if test="cy != null"> |
| | | and inhospstate=1 |
| | | and date_format(endtime,'%y%m%d') >= date_format(#{startDate},'%y%m%d') |
| | | and date_format(endtime,'%y%m%d') <= date_format(#{endDate},'%y%m%d') |
| | | and pat_med_inhosp.inhospstate=1 |
| | | and date_format(pat_med_inhosp.endtime,'%y%m%d') >= date_format(#{startDate},'%y%m%d') |
| | | and date_format(pat_med_inhosp.endtime,'%y%m%d') <= date_format(#{endDate},'%y%m%d') |
| | | <if test="deptcodeList != null and deptcodeList.size() > 0"> |
| | | and leaveldeptcode in |
| | | and pat_med_inhosp.leaveldeptcode in |
| | | <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |