select '' 日期,'' 处方人次,'' 抗菌药物人次,'' 注射药物人次,'' 抗菌注射药物人次,'' 静脉给药人次,'' 抗菌静脉给药人次,'' 处方张数,'' 处方金额,'' 处方药品种数,'' 处方用药天数,'' 抗菌药物处方张数,'' 抗菌药物处方金额,'' 抗菌处方用药品种数,'' 抗菌处方用药天数,'' 抗菌注射药物金额,'' 注射剂处方张数,'' 注射药物金额,'' 抗菌静脉药物金额,'' 中草药处方张数,'' 中草药处方金额,'' 药占比,'' 药占比警戒线 from dual where 1=2
select '' 日期,'' 处方张数人次,'' 处方金额人次,'' 处方平均金额,'' 处方平均用药品种数,'' 处方平均用药天数,'' 抗菌处方平均金额,'' 抗菌处方平均用药品种数,'' 抗菌处方平均用药天数,'' 抗菌药物使用率,'' 抗菌处方张数占比,'' 抗菌处方金额占比,'' 抗菌注射剂使用率,'' 抗菌注射药物金额占比,'' 注射剂使用率,'' 抗菌静脉给药率,'' 注射剂金额占比,'' 门诊静脉给药率,'' 抗菌药占比警戒线,'' 门诊抗菌药物处方人次使用率 from dual where 1=2
=? and c.SFRQ <= ? and (a.JZLX='M' or a.JZLX='J' ) and c.SFZT = 1 and a.JZZT='J' group by to_char(c.SFRQ,'yyyy-mm'),a.pkey order by to_char(c.SFRQ,'yyyy-mm')) group by tjrq order by tjrq
]]>
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 group by b.cfh,to_char(b.FYRQ,'yyyy-mm') order by to_char(b.FYRQ,'yyyy-mm')) group by fyrq order by fyrq
]]>
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 group by to_char(b.FYRQ,'yyyy-mm'),a.yzx order by to_char(b.FYRQ,'yyyy-mm')) group by fyrq order by fyrq
]]>
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 ) group by fyrq,cfh order by fyrq,cfh) group by fyrq order by fyrq
]]>
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and d.ISJMGY=1 group by b.JZPKEY,to_char(b.FYRQ,'yyyy-mm') order by to_char(b.FYRQ,'yyyy-mm')) group by fyrq order by fyrq
]]>
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (d.ISZSGY=1 or d.ISJMGY=1) group by b.JZPKEY,to_char(b.FYRQ,'yyyy-mm') order by to_char(b.FYRQ,'yyyy-mm')) group by fyrq order by fyrq
]]>
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by b.JZPKEY,to_char(b.FYRQ,'yyyy-mm') order by to_char(b.FYRQ,'yyyy-mm')) group by fyrq order by fyrq
]]>
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by b.cfh,to_char(b.FYRQ,'yyyy-mm') order by to_char(b.FYRQ,'yyyy-mm')) group by fyrq order by fyrq
]]>
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by to_char(b.FYRQ,'yyyy-mm'),a.yzx order by to_char(b.FYRQ,'yyyy-mm')) group by fyrq order by fyrq
]]>
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2')) group by fyrq,cfh order by fyrq,cfh) group by fyrq order by fyrq
]]>
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (d.ISZSGY=1 or d.ISJMGY=1) group by b.cfh,to_char(b.FYRQ,'yyyy-mm') order by to_char(b.FYRQ,'yyyy-mm')) group by fyrq order by fyrq
]]>
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (d.ISZSGY=1 or d.ISJMGY=1) and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by b.JZPKEY,to_char(b.FYRQ,'yyyy-mm') order by to_char(b.FYRQ,'yyyy-mm')) group by fyrq order by fyrq
]]>
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and d.ISJMGY=1 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by b.JZPKEY,to_char(b.FYRQ,'yyyy-mm') order by to_char(b.FYRQ,'yyyy-mm')) group by fyrq order by fyrq
]]>
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and c.YZLB='03' and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 group by b.cfh,to_char(b.FYRQ,'yyyy-mm') order by to_char(b.FYRQ,'yyyy-mm')) group by fyrq order by fyrq
]]>
12
93
93
select '' 排名,'' 科室,'' 处方张数,'' 处方金额,'' 处方金额张数,'' 处方药品种数,'' 处方药品种数张数,'' 处方用药天数,'' 处方用药天数张数 from dual where 1=2
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 group by c.jjks,b.cfh) group by jjks )order by cfje desc
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 group by c.jjks,a.yzx) group by jjks
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 ) group by jjks,cfh order by jjks,cfh) group by jjks
]]>
12
12
93
93
select '' 排名,'' 医生,'' 处方张数,'' 处方金额,'' 处方金额张数,'' 处方药品种数,'' 处方药品种数张数,'' 处方用药天数,'' 处方用药天数张数 from dual where 1=2
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 group by c.JJYS,b.cfh) group by JJYS )order by cfje desc
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 group by c.JJYS,a.yzx) group by JJYS
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 ) group by JJYS,cfh order by JJYS,cfh) group by JJYS
]]>
12
12
93
93
select '' 科室,'' 就诊人次,'' 使用抗菌药物人次,'' 门诊抗菌药物使用率,'' 门诊抗菌药物使用率警戒,'' 处方张数,'' 处方金额,'' 处方药品种数,'' 处方用药天数,'' 抗菌药物处方张数,'' 抗菌药物处方金额,'' 抗菌处方用药品种数,'' 抗菌处方用药天数,'' 抗菌注射药物金额,'' 注射剂处方张数,'' 注射药物金额,'' 处方平均金额,'' 处方平均用药品种数,'' 平均用药天数,'' 抗菌处方占比,'' 抗菌处方金额占比,'' 抗菌处方平均用药品种数,'' 抗菌处方平均用药天数,'' 抗菌注射药物金额比例,'' 注射药物金额比例,'' 抗菌药占比警戒,'' 中草药处方张数,'' 中草药处方金额,'' 抗菌注射药物人次,'' 注射药物人次 from dual where 1=2
=? and c.SFRQ <= ? and (a.JZLX='M' or a.JZLX='J' ) and c.SFZT = 1 and a.JZZT='J' group by a.jjks,a.pkey order by a.jjks) group by jjks order by jjks
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 group by b.cfh,c.jjks order by c.jjks) group by jjks order by jjks
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 group by c.jjks,a.yzx order by c.jjks ) group by jjks order by jjks
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 ) group by jjks,cfh order by jjks,cfh) group by jjks order by jjks
]]>
12
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and d.ISJMGY=1 group by b.JZPKEY,e.jjks order by e.jjks) group by jjks order by jjks
]]>
12
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (d.ISZSGY=1 or d.ISJMGY=1) group by b.JZPKEY,e.jjks order by e.jjks) group by jjks order by jjks
]]>
12
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by b.JZPKEY,c.jjks order by c.jjks) group by jjks order by jjks
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by b.cfh,c.jjks order by c.jjks) group by jjks order by jjks
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by c.jjks,a.yzx order by c.jjks) group by jjks order by jjks
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2')) group by jjks,cfh order by jjks,cfh) group by jjks order by jjks
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (d.ISZSGY=1 or d.ISJMGY=1) group by b.cfh,e.jjks order by e.jjks) group by jjks order by jjks
]]>
12
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (d.ISZSGY=1 or d.ISJMGY=1) and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by b.JZPKEY,f.jjks order by f.jjks) group by jjks order by jjks
]]>
12
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and d.ISJMGY=1 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by b.JZPKEY,f.jjks order by f.jjks) group by jjks order by jjks
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and c.YZLB='03' and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 group by b.cfh,f.jjks order by f.jjks) group by jjks order by jjks
]]>
12
12
93
93
select '' 医生,'' 就诊人次,'' 使用抗菌药物人次,'' 门诊抗菌药物使用率,'' 门诊抗菌药物使用率警戒,'' 处方张数,'' 处方金额,'' 处方药品种数,'' 处方用药天数,'' 抗菌药物处方张数,'' 抗菌药物处方金额,'' 抗菌处方用药品种数,'' 抗菌处方用药天数,'' 抗菌注射药物金额,'' 注射剂处方张数,'' 注射药物金额,'' 处方平均金额,'' 处方平均用药品种数,'' 平均用药天数,'' 抗菌处方占比,'' 抗菌处方金额占比,'' 抗菌处方平均用药品种数,'' 抗菌处方平均用药天数,'' 抗菌注射药物金额比例,'' 注射药物金额比例,'' 抗菌药占比警戒,'' 中草药处方张数,'' 中草药处方金额,'' 抗菌注射药物人次,'' 注射药物人次 from dual where 1=2
=? and c.SFRQ <= ? and (a.JZLX='M' or a.JZLX='J' ) and c.SFZT = 1 and a.JZZT='J' group by a.jjys,a.pkey order by a.jjys) group by jjys order by jjys
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 group by b.cfh,c.jjys order by c.jjys) group by jjys order by jjys
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 group by c.jjys,a.yzx order by c.jjys ) group by jjys order by jjys
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 ) group by jjys,cfh order by jjys,cfh) group by jjys order by jjys
]]>
12
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and d.ISJMGY=1 group by b.JZPKEY,e.jjys order by e.jjys) group by jjys order by jjys
]]>
12
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (d.ISZSGY=1 or d.ISJMGY=1) group by b.JZPKEY,e.jjys order by e.jjys) group by jjys order by jjys
]]>
12
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by b.JZPKEY,c.jjys order by c.jjys) group by jjys order by jjys
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by b.cfh,c.jjys order by c.jjys) group by jjys order by jjys
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by c.jjys,a.yzx order by c.jjys) group by jjys order by jjys
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2')) group by jjys,cfh order by jjys,cfh) group by jjys order by jjys
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (d.ISZSGY=1 or d.ISJMGY=1) group by b.cfh,e.jjys order by e.jjys) group by jjys order by jjys
]]>
12
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and (d.ISZSGY=1 or d.ISJMGY=1) and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by b.JZPKEY,f.jjys order by f.jjys) group by jjys order by jjys
]]>
12
12
93
93
=? and b.FYRQ <= ? and b.FYZT=1 and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 and d.ISJMGY=1 and (e.GZFL='KSS1' or e.GZFL='KZL1' or e.GZFL='KSS2') group by b.JZPKEY,f.jjys order by f.jjys) group by jjys order by jjys
]]>
12
12
93
93
=? and b.FYRQ<=? and b.FYZT=1 and c.YZLB='03' and (nvl(a.YZSL,0)-nvl(a.TYSL,0)) > 0 group by b.cfh,f.jjys order by f.jjys) group by jjys order by jjys
]]>
12
12
93
93
=? and g.FYRQ <=? order by d.JJYS
]]>
12
93
93
=? and g.FYTIME <=? order by d.JJYS
]]>
12
93
93
=? and g.FYRQ <=?
union all
select b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,g.FYTIME FYRQ,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS from HIS_YFFY_ZYFYMXB a left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and g.FYTIME >=? and g.FYTIME <=?
) ORDER BY JJYS
]]>
12
93
93
12
93
93
select '' 编码, '' 药品名称, '' 规格, '' 单位数量,'' 单位, '' 成本单价, '' 成本金额, '' 零售单价 ,'' 零售金额, '' 单价差额, '' 总金额差, '' 医生,'' 科室, '' 费用类别,'' 有效期,'' 批次,'' 批准文号,'' 生产厂家,'' 供应商,'' 发药主键,'' 医嘱,'' 发票,'' 收费日期, '' 发药日期, '' 退药数量,'' 患者姓名,'' 性别,'' 就诊年龄,'' 诊断,'' 下嘱时间,'' 用法,'' 用量,'' 处方号 from dual where 1=2
select '' 编码, '' 药品名称, '' 规格, '' 单位数量,'' 单位,'' 成本金额, '' 零售金额, '' 总金额差, '' 组织结构,'' 费用类别,'' 有效期,'' 批次,'' 批准文号,'' 生产厂家,'' 供应商,'' 退药数量 from dual where 1=2
=? and g.FYRQ <=?
union all
select b.yzxpkey,b.yzmc,c.gg,a.yzsl,a.tysl,(nvl(a.YZSL,0)-nvl(a.TYSL,0)) fysl,(nvl(a.YZSL,0)-nvl(a.TYSL,0))*e.jbdj cbje,(nvl(a.YZSL,0)-nvl(a.TYSL,0))* b.YPYZJBJG xsje,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,f.FYZL,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS from HIS_YFFY_ZYFYMXB a left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and g.FYTIME >=? and g.FYTIME <=?
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJYS,FYZL,dwview,yxq,ph,ZCZH,CSXX,GYS ORDER BY JJYS
]]>
12
93
93
12
93
93
=? and g.FYTIME <=?
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJYS,FYZL,dwview,yxq,ph,ZCZH,CSXX,GYS ORDER BY JJYS
]]>
12
93
93
=? and g.FYRQ <=?
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJYS,FYZL,dwview,YXQ,PH,ZCZH,CSXX,GYS ORDER BY JJYS
]]>
12
93
93
=? and g.FYRQ <=?
union all
select b.yzxpkey,b.yzmc,c.gg,a.yzsl,a.tysl,(nvl(a.YZSL,0)-nvl(a.TYSL,0)) fysl,(nvl(a.YZSL,0)-nvl(a.TYSL,0))*e.jbdj cbje,(nvl(a.YZSL,0)-nvl(a.TYSL,0))* b.YPYZJBJG xsje,f.ZHXS,c.JBDW,f.RKDW,d.JJKS,f.FYZL,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS from HIS_YFFY_ZYFYMXB a left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and g.FYTIME >=? and g.FYTIME <=?
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJKS,FYZL,dwview,YXQ,PH,ZCZH,CSXX,GYS ORDER BY JJKS
]]>
12
93
93
12
93
93
=? and g.FYTIME <=?
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJKS,FYZL,dwview,YXQ,PH,ZCZH,CSXX,GYS ORDER BY JJKS
]]>
12
93
93
=? and g.FYRQ <=?
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJKS,FYZL,dwview,YXQ,PH,ZCZH,CSXX,GYS ORDER BY JJKS
]]>
12
93
93
= ? and rkd.ZDRQ <=? order by a.djh,a.pkey
]]>
12
93
93
select '' 科室,'' 采购日期, '' 编码, '' 药品名称, '' 规格, '' 单位数量,'' 包装,'' 进价, '' 进货金额, '' 有效期,'' 批次,'' 批准文号,'' 生产厂家,'' 供应商,'' 单据号,'' 售价, '' 售价金额,'' 差额,'' 入库单位,'' 制单人 from dual where 1=2
select '' 编码, '' 药品名称, '' 规格, '' 单位数量,'' 包装,'' 批准文号,'' 生产厂家,'' 供应商,'' 单据号 from dual where 1=2
? and a.CJRQ <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.FYTIME fyrq,a.SFSL,a.FYDW,a.FYJE,a.TYJE,a.STSL,a.FYJJJE,a.TYJJJE from HIS_YFFY_ZYFYMXB a left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID right join HIS_SFZD_YZMXB h on b.pkey=h.yzmx and b.JGID=h.JGID left join HIS_MZJS_MZFPZB fpb on h.ZDZBPKEY=fpb.GLZDBPKEY and h.JGID=fpb.JGID where a.JGID=? #ypbm# and fpb.SFZT != '0' and fpb.pjzt=1 and a.CJRQ >? and a.CJRQ <=?
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJYS,FYZL,dwview,ZCZH,CSXX,GYS,FYDW ORDER BY JJYS
]]>
12
93
93
12
93
93
? and g.fyrq <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_MZFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZX=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzx=f.bm and a.JGID=f.JGID left join HIS_YFFY_MZFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and tymxb.CJRQ >? and tymxb.CJRQ <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.FYTIME fyrq,a.SFSL,a.FYDW,a.FYJE,0 TYJE,'' STSL,a.FYJJJE,0 TYJJJE from HIS_YFFY_ZYFYMXB a left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and g.FYTIME >? and g.FYTIME <=? and a.sfsl > 0
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.FYTIME fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_ZYFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and tymxb.CJRQ >? and tymxb.CJRQ <=? and tymxb.stsl > 0
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJYS,FYZL,dwview,ZCZH,CSXX,GYS,FYDW ORDER BY JJYS
]]>
12
93
93
12
93
93
12
93
93
12
93
93
? and fpb.SFRQ <=? order by d.JJYS
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJYS,FYZL,dwview,ZCZH,CSXX,GYS,FYDW ORDER BY JJYS
]]>
12
93
93
? and fpb.SFRQ <=? and a.sfsl > 0
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.FYTIME fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_ZYFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID right join HIS_SFZD_YZMXB h on b.pkey=h.yzmx and b.JGID=h.JGID left join HIS_MZJS_MZFPZB fpb on h.ZDZBPKEY=fpb.GLZDBPKEY and h.JGID=fpb.JGID where a.JGID=? #ypbm# and fpb.pjzt=1 and fpb.SFRQ >? and fpb.SFRQ <=? and tymxb.stsl > 0
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJYS,FYZL,dwview,ZCZH,CSXX,GYS,FYDW ORDER BY JJYS
]]>
12
93
93
12
93
93
? and a.CJRQ <=? order by d.JJYS
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJYS,FYZL,dwview,ZCZH,CSXX,GYS,FYDW ORDER BY JJYS
]]>
12
93
93
? and g.fyrq <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_MZFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZX=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzx=f.bm and a.JGID=f.JGID left join HIS_YFFY_MZFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and tymxb.CJRQ >? and tymxb.CJRQ <=?
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJYS,FYZL,dwview,ZCZH,CSXX,GYS,FYDW ORDER BY JJYS
]]>
12
93
93
12
93
93
? and fpb.SFRQ <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.FYTIME fyrq,a.SFSL,a.FYDW,a.FYJE,a.TYJE,a.STSL,a.FYJJJE,a.TYJJJE from HIS_YFFY_ZYFYMXB a left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID right join HIS_SFZD_YZMXB h on b.pkey=h.yzmx and b.JGID=h.JGID left join HIS_MZJS_MZFPZB fpb on h.ZDZBPKEY=fpb.GLZDBPKEY and h.JGID=fpb.JGID where a.JGID=? #ypbm# and fpb.SFZT != '0' and fpb.pjzt=1 and fpb.SFRQ >? and fpb.SFRQ <=?
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJKS,FYZL,dwview,YXQ,PH,ZCZH,CSXX,GYS,FYDW ORDER BY JJKS
]]>
12
93
93
12
93
93
? and g.fyrq <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_MZFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZX=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzx=f.bm and a.JGID=f.JGID left join HIS_YFFY_MZFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and tymxb.CJRQ >? and tymxb.CJRQ <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.FYTIME fyrq,a.SFSL,a.FYDW,a.FYJE,0 TYJE,'' STSL,a.FYJJJE,0 TYJJJE from HIS_YFFY_ZYFYMXB a left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and g.FYTIME >? and g.FYTIME <=? and a.sfsl > 0
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.FYTIME fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_ZYFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and tymxb.CJRQ >? and tymxb.CJRQ <=? and tymxb.stsl > 0
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJKS,FYZL,dwview,ZCZH,CSXX,GYS,FYDW ORDER BY JJKS
]]>
12
93
93
12
93
93
12
93
93
12
93
93
? and g.fyrq <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_MZFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZX=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzx=f.bm and a.JGID=f.JGID left join HIS_YFFY_MZFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and tymxb.CJRQ >? and tymxb.CJRQ <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.FYTIME fyrq,a.SFSL,a.FYDW,a.FYJE,0 TYJE,'' STSL,a.FYJJJE,0 TYJJJE from HIS_YFFY_ZYFYMXB a left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and g.FYTIME >? and g.FYTIME <=? and a.sfsl > 0
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.FYTIME fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_ZYFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and tymxb.CJRQ >? and tymxb.CJRQ <=? and tymxb.stsl > 0
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,FYZL,dwview,ZCZH,CSXX,GYS,FYDW ORDER BY yzxpkey
]]>
12
93
93
12
93
93
12
93
93
12
93
93
? and fpb.SFRQ <=? order by d.JJKS
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJKS,FYZL,dwview,YXQ,PH,ZCZH,CSXX,GYS,FYDW ORDER BY JJKS
]]>
12
93
93
? and g.FYTIME <=? and a.sfsl > 0
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.FYTIME fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_ZYFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and tymxb.CJRQ >? and tymxb.CJRQ <=? and tymxb.stsl > 0
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJKS,FYZL,dwview,ZCZH,CSXX,GYS,FYDW ORDER BY JJKS
]]>
12
93
93
12
93
93
? and g.FYTIME <=? and a.sfsl > 0
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.FYTIME fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_ZYFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and tymxb.CJRQ >? and tymxb.CJRQ <=? and tymxb.stsl > 0
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,FYZL,dwview,ZCZH,CSXX,GYS,FYDW ORDER BY JJKS
]]>
12
93
93
12
93
93
? and fpb.SFRQ <=? order by d.JJKS
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJKS,FYZL,dwview,YXQ,PH,ZCZH,CSXX,GYS,FYDW ORDER BY JJKS
]]>
12
93
93
? and g.fyrq <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_MZFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZX=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzx=f.bm and a.JGID=f.JGID left join HIS_YFFY_MZFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and tymxb.CJRQ >? and tymxb.CJRQ <=?
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,JJKS,FYZL,dwview,ZCZH,CSXX,GYS,FYDW ORDER BY JJKS
]]>
12
93
93
12
93
93
? and g.fyrq <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_MZFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZX=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzx=f.bm and a.JGID=f.JGID left join HIS_YFFY_MZFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and tymxb.CJRQ >? and tymxb.CJRQ <=?
) group by yzxpkey,yzmc,gg,ZHXS,JBDW,RKDW,FYZL,dwview,ZCZH,CSXX,GYS,FYDW ORDER BY yzxpkey
]]>
12
93
93
12
93
93
? and fpb.SFRQ <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,g.FYTIME FYRQ,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,a.SFSL,a.FYDW,a.FYJE,a.TYJE,a.STSL,a.FYJJJE,a.TYJJJE from HIS_YFFY_ZYFYMXB a left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID right join HIS_SFZD_YZMXB h on b.pkey=h.yzmx and b.JGID=h.JGID left join HIS_MZJS_MZFPZB fpb on h.ZDZBPKEY=fpb.GLZDBPKEY and h.JGID=fpb.JGID where a.JGID=? #ypbm# and fpb.SFZT !='0' and fpb.pjzt=1 and fpb.SFRQ >? and fpb.SFRQ <=?
) ORDER BY JJYS
]]>
12
93
93
12
93
93
? and g.fyrq <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE,tymxb.CJRQ rq,b.YPYZBZJG,a.PCSJ,a.PCJBSJ,a.SFBZDWFY,a.YPYZZHXS,a.PCDJ,a.PCJBDJ,a.YPFYSJMS from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_MZFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZX=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzx=f.bm and a.JGID=f.JGID left join HIS_YFFY_MZFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and tymxb.CJRQ >? and tymxb.CJRQ <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.FYTIME fyrq,a.SFSL,a.FYDW,a.FYJE,0 TYJE,'' STSL,a.FYJJJE,0 TYJJJE,g.FYTIME rq,b.YPYZBZJG,a.PCSJ,a.PCJBSJ,a.SFBZDWFY,a.YPYZZHXS,a.PCDJ,a.PCJBDJ,a.YPFYSJMS from HIS_YFFY_ZYFYMXB a left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and g.FYTIME >? and g.FYTIME <=? and a.sfsl>0
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.FYTIME fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE,tymxb.CJRQ rq,b.YPYZBZJG,a.PCSJ,a.PCJBSJ,a.SFBZDWFY,a.YPYZZHXS,a.PCDJ,a.PCJBDJ,a.YPFYSJMS from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_ZYFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and tymxb.CJRQ >? and tymxb.CJRQ <=? and tymxb.stsl >0
) ORDER BY rq
]]>
12
93
93
12
93
93
12
93
93
12
93
93
? and fpb.SFRQ <=? order by d.JJYS
]]>
12
93
93
? and fpb.SFRQ <=? and a.sfsl>0
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.FYTIME fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE,tymxb.CJRQ rq,b.YPYZBZJG,a.PCSJ,a.PCJBSJ,a.SFBZDWFY,a.YPYZZHXS,a.PCDJ,a.PCJBDJ,a.YPFYSJMS from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_ZYFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZXPKEY=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzxpkey=f.bm and a.JGID=f.JGID left join HIS_YFFY_ZYFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID right join HIS_SFZD_YZMXB h on b.pkey=h.yzmx and b.JGID=h.JGID left join HIS_MZJS_MZFPZB fpb on h.ZDZBPKEY=fpb.GLZDBPKEY and h.JGID=fpb.JGID where a.JGID=? #ypbm# and fpb.SFZT != '0' and fpb.pjzt=1 and fpb.SFRQ >? and fpb.SFRQ <=? and tymxb.stsl >0
) ORDER BY rq
]]>
12
93
93
12
93
93
? and fpb.SFRQ <=? order by d.JJYS
]]>
12
93
93
? and g.fyrq <=?
union all
select distinct a.pkey,b.pkey yzmx,b.yzxpkey,b.yzmc,c.gg,a.YZSL,a.TYSL,f.ZHXS,c.JBDW,f.RKDW,d.JJYS,d.JJKS,f.FYZL,e.jbdj,b.YPYZJBJG,f.dwview,e.YXQ,e.PH,c.ZCZH,c.CSXX,rkd.GYS,g.fyrq,'' SFSL,a.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE,tymxb.CJRQ rq,b.YPYZBZJG,a.PCSJ,a.PCJBSJ,a.SFBZDWFY,a.YPYZZHXS,a.PCDJ,a.PCJBDJ,a.YPFYSJMS from HIS_YFFY_MZTYMXB tymxb left join HIS_YFFY_MZFYMXB a on tymxb.MZFYMXBPKEY=a.pkey and tymxb.JGID=a.JGID left join HIS_YZ_MXB b on a.YZMX=b.PKEY and a.JGID=b.JGID left join HIS_YPXX c on a.YZX=c.BM left join HIS_JZ_BASEINFO d on a.JZPKEY=d.pkey and a.JGID=d.JGID left join HIS_KSKC_PC e on a.KSKCPCPKEY=e.pkey and a.JGID=e.JGID left join HIS_SFX f on a.yzx=f.bm and a.JGID=f.JGID left join HIS_YFFY_MZFYZB g on a.FYBPKEY=g.pkey and a.JGID=g.JGID left join HIS_YFYK_RKD_MX rkmx on e.pkey=rkmx.KSKC_PC_PKEY and e.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and tymxb.CJRQ >? and tymxb.CJRQ <=?
) ORDER BY rq
]]>
12
93
93
12
93
93
? and c.SFRQ <= ? and c.PJZT = 1 and f.sfsl > 0 and b.TFHSFZDPKEY is null
union all
select distinct '2' type,tymxb.pkey,e.pkey yzmx,e.yzxpkey,e.yzmc,ypxx.gg,f.YZSL,f.TYSL,sfx.ZHXS,ypxx.JBDW,sfx.RKDW,a.JJYS,a.JJKS,sfx.FYZL,pc.jbdj,e.YPYZJBJG,sfx.dwview,pc.YXQ,pc.PH,ypxx.ZCZH,ypxx.CSXX,rkd.GYS,g.fyrq,'' SFSL,f.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE,g.fyrq rq,e.YPYZBZJG,f.PCSJ,f.PCJBSJ,f.SFBZDWFY,f.YPYZZHXS,f.PCDJ,f.PCJBDJ,f.YPFYSJMS,hz.XM,hz.XB,e.YZXZSJ,e.YZJL,e.YZJLDW,e.YZYF ,a.PKEY as JZPKEY,hz.PKEY as HZPKEY,a.JZNL,e.CFH from HIS_JZ_BASEINFO a left join HIS_SFZD_ZB b on a.pkey=b.jzpkey and a.JGID=b.JGID left join HIS_MZJS_MZFPZB c on b.pkey=c.GLZDBPKEY and b.JGID=c.JGID left join HIS_SFZD_SFXMXB d on b.pkey=d.ZDZBPKEY and b.JGID=d.JGID left join HIS_YZ_MXB e on d.YZMX=e.pkey and d.JGID=e.JGID left join HIS_SFX sfx on d.sfx=sfx.bm and d.JGID=sfx.JGID left join HIS_YFFY_MZTYMXB tymxb on tymxb.yzmx=e.pkey and tymxb.JGID = e.JGID left join HIS_YFFY_MZFYMXB f on tymxb.MZFYMXBPKEY=f.PKEY and tymxb.JGID=f.JGID left join HIS_YPXX ypxx on f.YZX=ypxx.BM left join HIS_YFFY_MZFYZB g on f.FYBPKEY=g.pkey and f.JGID=g.JGID left join HIS_KSKC_PC pc on f.KSKCPCPKEY=pc.pkey and f.JGID=pc.JGID left join HIS_YFYK_RKD_MX rkmx on pc.pkey=rkmx.KSKC_PC_PKEY and pc.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID LEFT JOIN HIS_HZINFO hz on a.JGID = hz.JGID AND a.HZPKEY = hz.PKEY where a.JGID=? #ypbm# and c.PJLX='MS' and sfx.GLLX='Y' and c.SFRQ > ? and c.SFRQ <= ? and c.pjzt=2 and c.SFZT != 0 and tymxb.stsl > 0
)
]]>
12
93
93
12
93
93
? and c.SFRQ <= ? and c.PJZT = 1 and f.sfsl > 0 and b.TFHSFZDPKEY is null
union all
select distinct '2' type,tymxb.pkey,e.pkey yzmx,e.yzxpkey,e.yzmc,ypxx.gg,f.YZSL,f.TYSL,sfx.ZHXS,ypxx.JBDW,sfx.RKDW,a.JJYS,a.JJKS,sfx.FYZL,pc.jbdj,e.YPYZJBJG,sfx.dwview,pc.YXQ,pc.PH,ypxx.ZCZH,ypxx.CSXX,rkd.GYS,g.fyrq,'' SFSL,f.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE,g.fyrq rq,e.YPYZBZJG,f.PCSJ,f.PCJBSJ,f.SFBZDWFY,f.YPYZZHXS,f.PCDJ,f.PCJBDJ,f.YPFYSJMS from HIS_JZ_BASEINFO a left join HIS_SFZD_ZB b on a.pkey=b.jzpkey and a.JGID=b.JGID left join HIS_MZJS_MZFPZB c on b.pkey=c.GLZDBPKEY and b.JGID=c.JGID left join HIS_YFFY_MZTYMXB tymxb on tymxb.jzpkey=b.jzpkey and tymxb.JGID = b.JGID left join HIS_YZ_MXB e on tymxb.YZMX=e.pkey and tymxb.JGID=e.JGID left join HIS_SFX sfx on tymxb.yzx=sfx.bm and tymxb.JGID=sfx.JGID
left join HIS_YFFY_MZFYMXB f on tymxb.MZFYMXBPKEY=f.PKEY and tymxb.JGID=f.JGID left join HIS_YPXX ypxx on tymxb.YZX=ypxx.BM left join HIS_YFFY_MZFYZB g on f.FYBPKEY=g.pkey and f.JGID=g.JGID left join HIS_KSKC_PC pc on f.KSKCPCPKEY=pc.pkey and f.JGID=pc.JGID left join HIS_YFYK_RKD_MX rkmx on pc.pkey=rkmx.KSKC_PC_PKEY and pc.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and c.PJLX='MS' and sfx.GLLX='Y' and c.SFRQ > ? and c.SFRQ <= ? and c.pjzt=2 and c.SFZT != 0 and tymxb.stsl > 0
)
]]>
12
93
93
12
93
93
? and c.SFRQ <= ? and c.PJZT = 1 and c.sfzt!=0 and f.sfsl > 0 and b.TFHSFZDPKEY is null
union all
select distinct '2' type,tymxb.pkey,e.pkey yzmx,e.yzxpkey,e.yzmc,ypxx.gg,f.YZSL,f.TYSL,sfx.ZHXS,ypxx.JBDW,sfx.RKDW,a.JJYS,a.JJKS,sfx.FYZL,pc.jbdj,e.YPYZJBJG,sfx.dwview,pc.YXQ,pc.PH,ypxx.ZCZH,ypxx.CSXX,rkd.GYS,g.FYTIME,'' SFSL,f.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE,g.FYTIME rq,e.YPYZBZJG,f.PCSJ,f.PCJBSJ,f.SFBZDWFY,f.YPYZZHXS,f.PCDJ,f.PCJBDJ,f.YPFYSJMS,hz.XM,hz.XB,e.YZXZSJ,e.YZJL,e.YZJLDW,e.YZYF ,a.PKEY as JZPKEY,hz.PKEY as HZPKEY,a.JZNL,e.CFH from HIS_JZ_BASEINFO a left join HIS_SFZD_ZB b on a.pkey=b.jzpkey and a.JGID=b.JGID left join HIS_MZJS_MZFPZB c on b.pkey=c.GLZDBPKEY and b.JGID=c.JGID left join HIS_YZ_MXB e on e.jzpkey=b.pkey and e.JGID=b.JGID left join HIS_SFZD_SFXMXB d on d.yzx=e.pkey and d.JGID=e.JGID left join HIS_SFX sfx on d.sfx=sfx.bm and d.JGID=sfx.JGID left join HIS_YFFY_MZTYMXB tymxb on tymxb.yzmx=e.pkey and tymxb.JGID = e.JGID left join HIS_YFFY_ZYFYMXB f on tymxb.MZFYMXBPKEY=f.PKEY and tymxb.JGID=f.JGID left join HIS_YPXX ypxx on f.YZXPKEY=ypxx.BM left join HIS_YFFY_ZYFYZB g on f.FYBPKEY=g.pkey and f.JGID=g.JGID left join HIS_KSKC_PC pc on f.KSKCPCPKEY=pc.pkey and f.JGID=pc.JGID left join HIS_YFYK_RKD_MX rkmx on pc.pkey=rkmx.KSKC_PC_PKEY and pc.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID LEFT JOIN HIS_HZINFO hz on a.JGID = hz.JGID AND a.HZPKEY = hz.PKEY where a.JGID=? #ypbm# and c.PJLX='ZS' and sfx.GLLX='Y' and c.SFRQ > ? and c.SFRQ <= ? and ((c.pjzt=1 and c.sfzt != 0) or c.PJZT='2' ) and tymxb.stsl > 0
)
]]>
12
93
93
12
93
93
? and c.SFRQ <= ? and c.PJZT = 1 and f.sfsl > 0 and b.TFHSFZDPKEY is null
union all
select distinct '2' type,tymxb.pkey,e.pkey yzmx,e.yzxpkey,e.yzmc,ypxx.gg,f.YZSL,f.TYSL,sfx.ZHXS,ypxx.JBDW,sfx.RKDW,a.JJYS,a.JJKS,sfx.FYZL,pc.jbdj,e.YPYZJBJG,sfx.dwview,pc.YXQ,pc.PH,ypxx.ZCZH,ypxx.CSXX,rkd.GYS,g.fyrq,'' SFSL,f.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE,g.fyrq rq,e.YPYZBZJG,f.PCSJ,f.PCJBSJ,f.SFBZDWFY,f.YPYZZHXS,f.PCDJ,f.PCJBDJ,f.YPFYSJMS,hz.XM,hz.XB,e.YZXZSJ,e.YZJL,e.YZJLDW,e.YZYF ,a.PKEY as JZPKEY,hz.PKEY as HZPKEY,a.JZNL,e.CFH from HIS_JZ_BASEINFO a left join HIS_SFZD_ZB b on a.pkey=b.jzpkey and a.JGID=b.JGID left join HIS_MZJS_MZFPZB c on b.pkey=c.GLZDBPKEY and b.JGID=c.JGID left join HIS_SFZD_SFXMXB d on b.pkey=d.ZDZBPKEY and b.JGID=d.JGID left join HIS_YZ_MXB e on d.YZMX=e.pkey and d.JGID=e.JGID left join HIS_SFX sfx on d.sfx=sfx.bm and d.JGID=sfx.JGID left join HIS_YFFY_MZTYMXB tymxb on tymxb.yzmx=e.pkey and tymxb.JGID = e.JGID left join HIS_YFFY_MZFYMXB f on tymxb.MZFYMXBPKEY=f.PKEY and tymxb.JGID=f.JGID left join HIS_YPXX ypxx on f.YZX=ypxx.BM left join HIS_YFFY_MZFYZB g on f.FYBPKEY=g.pkey and f.JGID=g.JGID left join HIS_KSKC_PC pc on f.KSKCPCPKEY=pc.pkey and f.JGID=pc.JGID left join HIS_YFYK_RKD_MX rkmx on pc.pkey=rkmx.KSKC_PC_PKEY and pc.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID LEFT JOIN HIS_HZINFO hz on a.JGID = hz.JGID AND a.HZPKEY = hz.PKEY where a.JGID=? #ypbm# and c.PJLX='MS' and sfx.GLLX='Y' and c.SFRQ > ? and c.SFRQ <= ? and c.pjzt=2 and c.SFZT != 0 and tymxb.stsl > 0
union all
select distinct '1' type,f.pkey,e.pkey yzmx,e.yzxpkey,e.yzmc,ypxx.gg,f.YZSL,f.TYSL,sfx.ZHXS,ypxx.JBDW,sfx.RKDW,a.JJYS,a.JJKS,sfx.FYZL,pc.jbdj,e.YPYZJBJG,sfx.dwview,pc.YXQ,pc.PH,ypxx.ZCZH,ypxx.CSXX,rkd.GYS,g.FYTIME fyrq,f.SFSL,f.FYDW,f.FYJE,0 TYJE,'' STSL,f.FYJJJE,0 TYJJJE,g.FYTIME rq,e.YPYZBZJG,f.PCSJ,f.PCJBSJ,f.SFBZDWFY,f.YPYZZHXS,f.PCDJ,f.PCJBDJ,f.YPFYSJMS,hz.XM,hz.XB,e.YZXZSJ,e.YZJL,e.YZJLDW,e.YZYF ,a.PKEY as JZPKEY,hz.PKEY as HZPKEY,a.JZNL,e.CFH from HIS_JZ_BASEINFO a left join HIS_SFZD_ZB b on a.pkey=b.jzpkey and a.JGID=b.JGID left join HIS_MZJS_MZFPZB c on b.pkey=c.GLZDBPKEY and b.JGID=c.JGID left join HIS_SFZD_SFXMXB d on b.pkey=d.ZDZBPKEY and b.JGID=d.JGID left join HIS_YZ_MXB e on d.YZMX=e.pkey and d.JGID=e.JGID left join HIS_SFX sfx on d.sfx=sfx.bm and d.JGID=sfx.JGID left join HIS_YFFY_ZYFYMXB f on f.YZMX=e.PKEY and f.JGID=e.JGID left join HIS_YPXX ypxx on f.YZXPKEY=ypxx.BM left join HIS_YFFY_ZYFYZB g on f.FYBPKEY=g.pkey and f.JGID=g.JGID left join HIS_KSKC_PC pc on f.KSKCPCPKEY=pc.pkey and f.JGID=pc.JGID left join HIS_YFYK_RKD_MX rkmx on pc.pkey=rkmx.KSKC_PC_PKEY and pc.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID LEFT JOIN HIS_HZINFO hz on a.JGID = hz.JGID AND a.HZPKEY = hz.PKEY where a.JGID=? #ypbm# and c.PJLX='ZS' and sfx.GLLX='Y' and c.SFRQ > ? and c.SFRQ <= ? and c.PJZT = 1 and f.sfsl > 0 and b.TFHSFZDPKEY is null
union all
select distinct '2' type,tymxb.pkey,e.pkey yzmx,e.yzxpkey,e.yzmc,ypxx.gg,f.YZSL,f.TYSL,sfx.ZHXS,ypxx.JBDW,sfx.RKDW,a.JJYS,a.JJKS,sfx.FYZL,pc.jbdj,e.YPYZJBJG,sfx.dwview,pc.YXQ,pc.PH,ypxx.ZCZH,ypxx.CSXX,rkd.GYS,g.FYTIME,'' SFSL,f.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE,g.FYTIME rq,e.YPYZBZJG,f.PCSJ,f.PCJBSJ,f.SFBZDWFY,f.YPYZZHXS,f.PCDJ,f.PCJBDJ,f.YPFYSJMS,hz.XM,hz.XM,e.YZXZSJ,e.YZJL,e.YZJLDW,e.YZYF ,a.PKEY as JZPKEY,hz.PKEY as HZPKEY,a.JZNL,e.CFH from HIS_JZ_BASEINFO a left join HIS_SFZD_ZB b on a.pkey=b.jzpkey and a.JGID=b.JGID left join HIS_MZJS_MZFPZB c on b.pkey=c.GLZDBPKEY and b.JGID=c.JGID left join HIS_SFZD_SFXMXB d on b.pkey=d.ZDZBPKEY and b.JGID=d.JGID left join HIS_YZ_MXB e on d.YZMX=e.pkey and d.JGID=e.JGID left join HIS_SFX sfx on d.sfx=sfx.bm and d.JGID=sfx.JGID left join HIS_YFFY_MZTYMXB tymxb on tymxb.yzmx=e.pkey and tymxb.JGID = e.JGID left join HIS_YFFY_ZYFYMXB f on tymxb.MZFYMXBPKEY=f.PKEY and tymxb.JGID=f.JGID left join HIS_YPXX ypxx on f.YZXPKEY=ypxx.BM left join HIS_YFFY_ZYFYZB g on f.FYBPKEY=g.pkey and f.JGID=g.JGID left join HIS_KSKC_PC pc on f.KSKCPCPKEY=pc.pkey and f.JGID=pc.JGID left join HIS_YFYK_RKD_MX rkmx on pc.pkey=rkmx.KSKC_PC_PKEY and pc.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID LEFT JOIN HIS_HZINFO hz on a.JGID = hz.JGID AND a.HZPKEY = hz.PKEY where a.JGID=? #ypbm# and c.PJLX='ZS' and sfx.GLLX='Y' and c.SFRQ > ? and c.SFRQ <= ? and c.pjzt=1 and tymxb.stsl > 0
) ORDER BY rq
]]>
12
93
93
12
93
93
12
93
93
12
93
93
? and c.SFRQ <= ? and c.PJZT = 1 and f.sfsl > 0 and b.TFHSFZDPKEY is null
union all
select distinct '2' type,tymxb.pkey,e.pkey yzmx,e.yzxpkey,e.yzmc,ypxx.gg,f.YZSL,f.TYSL,sfx.ZHXS,ypxx.JBDW,sfx.RKDW,a.JJYS,a.JJKS,sfx.FYZL,pc.jbdj,e.YPYZJBJG,sfx.dwview,pc.YXQ,pc.PH,ypxx.ZCZH,ypxx.CSXX,rkd.GYS,g.FYTIME fyrq,'' SFSL,f.FYDW,0 FYJE,tymxb.TYJE,tymxb.STSL,0 FYJJJE,tymxb.TYJJJE,g.FYTIME rq,e.YPYZBZJG,f.PCSJ,f.PCJBSJ,f.SFBZDWFY,f.YPYZZHXS,f.PCDJ,f.PCJBDJ,f.YPFYSJMS from HIS_JZ_BASEINFO a left join HIS_SFZD_ZB b on a.pkey=b.jzpkey and a.JGID=b.JGID left join HIS_MZJS_MZFPZB c on b.pkey=c.GLZDBPKEY and b.JGID=c.JGID left join HIS_YFFY_MZTYMXB tymxb on tymxb.jzpkey=b.jzpkey and tymxb.JGID = b.JGID left join HIS_YZ_MXB e on tymxb.YZMX=e.pkey and tymxb.JGID=e.JGID left join HIS_SFX sfx on tymxb.yzx=sfx.bm and tymxb.JGID=sfx.JGID
left join HIS_YFFY_ZYFYMXB f on tymxb.MZFYMXBPKEY=f.PKEY and tymxb.JGID=f.JGID left join HIS_YPXX ypxx on tymxb.YZX=ypxx.BM left join HIS_YFFY_ZYFYZB g on f.FYBPKEY=g.pkey and f.JGID=g.JGID left join HIS_KSKC_PC pc on f.KSKCPCPKEY=pc.pkey and f.JGID=pc.JGID left join HIS_YFYK_RKD_MX rkmx on pc.pkey=rkmx.KSKC_PC_PKEY and pc.JGID=rkmx.JGID left join HIS_YFYK_RKD rkd on rkmx.djh=rkd.djh and rkmx.JGID=rkd.JGID where a.JGID=? #ypbm# and c.PJLX='ZS' and sfx.GLLX='Y' and c.SFRQ > ? and c.SFRQ <= ? and c.pjzt=1 and tymxb.stsl > 0
)
]]>
12
93
93
12
93
93
SELECT
a.YZXZYS 医生,
a.YZLB,
a.YZXPKEY,
b.MC 药品名称,
d.GG 规格,
sum( a.YZSL ) 发药数量,
sum( YZJE ) AS 总金额,
c.JZLX
FROM
his_yz_mxb a
LEFT JOIN HIS_YZX b ON b.JGID = a.JGID
AND b.BM = a.YZXPKEY
LEFT JOIN HIS_JZ_BASEINFO c ON c.hzpkey = a.hzpkey
LEFT JOIN HIS_YPXX d ON b.bm = d.BM
WHERE
YZXZYS IS NOT NULL
AND ( a.YZLB = '01' OR a.YZLB = '02' OR a.YZLB = '03' )
AND YZSHZT = '1'
GROUP BY
a.YZXZYS,
a.YZLB,
a.YZXPKEY,
b.MC,d.GG,
c.JZLX
ORDER BY
YZXZYS DESC
//医生,YZLB,YZXPKEY,药品名称,规格,发药数量,总金额,JZLX