select sum(bls) 有病历数,sum(zs) 总就诊人次, DECODE(SUBSTR((round(sum(bls)/sum(zs),5)*100),1,1),'.','0'||(round(sum(bls)/sum(zs),5)*100),(round(sum(bls)/sum(zs),5)*100))||'%' 使用率, (select bmmc00 from bm_bmbm00 where bmbh00=jzks00) 就诊科室 from ( select 0 bls,COUNT(distinct (b.brid00||b.ghrq00||b.jzys00)) zs,b.jzks00 from yf_mzcf00 a,sf_brxxb0 b,ys_brzdxx c,bm_ygbm00 d where a.ghid00=b.ghid00 and b.ghid00=c.ghid00 and b.jzys00=d.ygbh00 and a.srrq00 between '20200816' and '20200816' and cfzt00 in ('1','2') and bccfh0 is null and a.ghks00 not in (select bmbh00 from bm_bmbm00 where bmmc00 in( '东二环肺功能室','东二环门急诊护理','东二环胃镜室','东二环放射科','急诊护理','护理专科门诊','东二环护理专科门诊', '康复治疗室','中医脾胃门诊外治室','影像科','胃肠动力室','静脉治疗护理','体检中心放射科','病区手术室','腹膜透析专科护理', '胃镜室','肺功能室','检验科','病理科','超声科','计生工作室','门诊换药室','体检中心胃镜室','心电图室' )) and c.zdmc00 not in ('健康查体') And b.thrq00 is null and MRGHLB in( select lbbh00 from BM_GHLBB0 d where d.LBMC00 LIKE'%住院医师%' OR d.LBMC00 LIKE'%主治医师%') group by b.jzks00 union all select COUNT(distinct (b.brid00||b.ghrq00||b.jzys00)) bls,0 zs,b.jzks00 from yf_mzcf00 a,sf_brxxb0 b,ys_brzdxx c,bm_ygbm00 d,ys_mzblws e where a.ghid00=b.ghid00 and b.ghid00=c.ghid00 and b.jzys00=d.ygbh00 and trim(b.ghh000)=trim(e.ghh000) and a.srrq00 between '20200816' and '20200816' and cfzt00 in ('1','2') and bccfh0 is null and a.ghks00 not in (select bmbh00 from bm_bmbm00 where bmmc00 in( '东二环肺功能室','东二环门急诊护理','东二环胃镜室','东二环放射科','急诊护理','护理专科门诊','东二环护理专科门诊', '康复治疗室','中医脾胃门诊外治室','影像科','胃肠动力室','静脉治疗护理','体检中心放射科','病区手术室','腹膜透析专科护理', '胃镜室','肺功能室','检验科','病理科','超声科','计生工作室','门诊换药室','体检中心胃镜室','心电图室' )) and c.zdmc00 not in ('健康查体') And b.thrq00 is null and MRGHLB in( select lbbh00 from BM_GHLBB0 d where d.LBMC00 LIKE'%住院医师%' OR d.LBMC00 LIKE'%主治医师%') and ( mbid00 not in('1065','1066') or( mbid00 in('1065','1066') and (zjtjbz='Y' OR exists(select 1 from ys_bldyjl where wsid00=e.wsid00) or sqtjsj is not null) ) ) group by b.jzks00 )group by jzks00