---------挂号页签跟踪------- select a.CZRQ00 GHRQ00 , a.GHKSMC BMMC00, a.ghks00 ghks00, null ZWXM00, a.JBMC00 JBMC00, GHLB00 GHLB00, a.GHLBMC LBMC00,sum(GHCS00) GHCS00 from VW_SF_GHLSXX_MZDZBL a where rownum <= 2000 and 1=1 and a.CZRQ00 >= '20200103' and a.CZRQ00 <= '20210106' and a.JZYS00 = '1913' group by sign(a.GHCS00), a.CZRQ00, a.GHKSMC, a.GHKS00, a.GHLBMC, a.GHLB00, a.JBMC00 order by ghrq00 desc ------------接诊明细跟踪------------ select ghid00, brblh0, ghh000, ghlb00, brid00, sfcz00, xm0000, xb0000, csrq00, fbbh00, lbbh00, gfzh00, ghrq00, ghsj00, ghy000, ghyxm0, ghks00, jzrq00, jzsj00, jzks00, jzys00, jzysxm, thbz00, decode(thbz00,'0','退号','1','未诊','2','已诊') thbz00,substr(brnl00,1,10) brnl00, brjtdz, brdh00, brzy00, yqbgbz,lbmc00, fbmc00, ghksmc ,jzksmc,fbrq00,JBMC00,zdrq00 from vw_ys_brjbdj where rownum <= 2000 and 1=1 and THBZ00 <> '0' and GHRQ00 >= '20200102' and GHRQ00 <= '20210106' and JZYS00= '1913' order by jzrq00,jzsj00 ----------收费项目页签跟踪--------- select d.fpxmmc fpxm00,decode(SIGN(a.XMBH00-9000000000),-1,a.xmmc00,decode(c.lbbh00,'0','西药费','1','成药费','2','草药费','其他')) xmmc00,decode(SIGN(a.XMBH00-9000000000),-1,a.xmgg00,null) xmgg00, decode(SIGN(a.XMBH00-9000000000),-1,a.xmdw00,null) xmdw00,decode(SIGN(a.XMBH00-9000000000),-1,a.gjbm00,null) gjbm00,decode(SIGN(a.XMBH00-9000000000),-1,a.XMDJ00,NULL) XMDJ00,sum(a.xmsl00) xmsl00,sum(a.hjje00) hjje00, a.CZRQ00, null BMMC00, null ZWXM00 from SF_FYMX00 a,BM_YGBM00 b,BM_BMBM00 e ,BM_YD0000 c,vw_bm_yyfpxm_mzdzbl d where rownum <= 2000 and a.xmbh00=c.ypnm00(+) and a.xmbh00 = d.sfxmid(+) and a.KDKS00 = e.BMBH00 and a.KDYS00 = b.YGBH00 and a.CZRQ00 >= '20210106' and a.CZRQ00 <= '20210106' group by d.fpxmmc,decode(SIGN(a.XMBH00-9000000000),-1,a.xmmc00,decode(c.lbbh00,'0','西药费','1','成药费','2','草药费','其他')), decode(SIGN(a.XMBH00-9000000000),-1,a.gjbm00,null),decode(SIGN(a.XMBH00-9000000000),-1,a.xmgg00,null), decode(SIGN(a.XMBH00-9000000000),-1,a.xmdw00,null),DECODE(SIGN(a.XMBH00-9000000000),-1,a.XMDJ00,NULL) ,a.CZRQ00