( select distinct '0' isyzt,A.JGID,A.BM,#yzmc#,A.YZDL,A.YZZL,A.ISDDYZ,A.ISXSYZ,A.ISMZSY,A.ISJZSY,A.ISZYSY,A.DCZDJL,A.MTZDJL,A.ZDL,A.SZSYTS,A.YF,A.LC,A.PC,A.ISMZPSYY,A.ISZYPSYY,A.ISMZSJL,A.ISZYSJL,A.JE,A.BZ,A.ZT,A.YZDW JBDW,A.YZDW RKDW,1 ZHXS,A.YZDW MZFYDW,A.YZDW ZYFYDW,A.JE JBJG,'' GG,A.YZDW,1 DXSL,A.YZDW DXDW,A.MC TYM,'0' ISKJY,'0' ISJK,'0' ISGJJBYW,'0' ISPS,0 SL,0 DJSL,0 KYSL,'' GZFL,'' DDD,'' WHONET,'' JX,'' TYMPKEY,A.GLLX,A.LMT_USED_FLAG,A.XZSYFW,A.CHRGITM_LV,A.YBBM,A.YBMC,0 DXRL,sysdate CGSHRQ,'' ph,'' YPMRPC,'' dptid,A.ZJM from HIS_YZX A left join HIS_YZX_ZJM B on A.BM=B.YZX_BM and A.JGID=B.JGID WHERE A.JGID=? AND A.ISDDYZ = '1' AND A.ISJZSY != '1' AND A.ISMZSY !='1' AND A.ZT='1' AND (A.GLLX != 'W' or A.GLLX is null) AND (A.YZDL !='01' and A.YZDL !='02' and A.YZDL !='03') AND (B.PYM LIKE ? OR A.BM LIKE ? OR A.BM LIKE ? OR A.MC LIKE ?) )
union all
( select distinct '0' isyzt,A.JGID,A.BM,#yzmc#||'['||F.WZGG||']' MC,A.YZDL,A.YZZL,A.ISDDYZ,A.ISXSYZ,A.ISMZSY,A.ISJZSY,A.ISZYSY,A.DCZDJL,A.MTZDJL,A.ZDL,A.SZSYTS,A.YF,A.LC,A.PC,A.ISMZPSYY,A.ISZYPSYY,A.ISMZSJL,A.ISZYSJL,C.JG JE,A.BZ,A.ZT,A.YZDW JBDW,A.YZDW RKDW,1 ZHXS,A.YZDW MZFYDW,A.YZDW ZYFYDW,A.JE JBJG,F.WZGG GG,A.YZDW,1 DXSL,A.YZDW DXDW,A.MC TYM,'0' ISKJY,'0' ISJK,'0' ISGJJBYW,'0' ISPS,nvl(E.SL,0) SL,nvl(E.DJSL,0) DJSL,nvl(E.KYSL,0) KYSL,'' GZFL,'' DDD,'' WHONET,'' JX,'' TYMPKEY,A.GLLX,A.LMT_USED_FLAG,A.XZSYFW,A.CHRGITM_LV,A.YBBM,A.YBMC,0 DXRL,sysdate CGSHRQ,'' ph,'' YPMRPC,'' dptid,A.ZJM from HIS_YZX A left join HIS_YZX_ZJM B on A.BM=B.YZX_BM and A.JGID=B.JGID LEFT JOIN HIS_SFX C ON A.JGID=C.JGID AND A.BM=C.BM LEFT JOIN HIS_KSKC E ON A.JGID=E.JGID AND A.BM=E.SFX_BM left join HIS_MMS_WZZD F on C.GLBM=F.WZBM AND C.JGID=F.JGID WHERE A.JGID=? AND A.ISDDYZ = '1' AND A.ISJZSY != '1' AND ISZYSY !='1' AND A.ZT='1' AND A.GLLX = 'W' and (A.YZDL !='01' and A.YZDL !='02' and A.YZDL !='03') AND (B.PYM LIKE ? OR A.BM LIKE ? OR A.BM LIKE ? OR A.MC LIKE ?) )
( select distinct '0' isyzt,A.JGID,A.BM,#yzmc#||'['||F.WZGG||']' MC,A.YZDL,A.YZZL,A.ISDDYZ,A.ISXSYZ,A.ISMZSY,A.ISJZSY,A.ISZYSY,A.DCZDJL,A.MTZDJL,A.ZDL,A.SZSYTS,A.YF,A.LC,A.PC,A.ISMZPSYY,A.ISZYPSYY,A.ISMZSJL,A.ISZYSJL,C.JG JE,A.BZ,A.ZT,A.YZDW JBDW,A.YZDW RKDW,1 ZHXS,A.YZDW MZFYDW,A.YZDW ZYFYDW,A.JE JBJG,F.WZGG GG,A.YZDW,1 DXSL,A.YZDW DXDW,A.MC TYM,'0' ISKJY,'0' ISJK,'0' ISGJJBYW,'0' ISPS,nvl(E.SL,0) SL,nvl(E.DJSL,0) DJSL,nvl(E.KYSL,0) KYSL,'' GZFL,'' DDD,'' WHONET,'' JX,'' TYMPKEY,A.GLLX,A.LMT_USED_FLAG,A.XZSYFW,A.CHRGITM_LV,A.YBBM,A.YBMC,0 DXRL,sysdate CGSHRQ,'' ph,'' YPMRPC,E.dptid,A.ZJM from HIS_YZX A left join HIS_YZX_ZJM B on A.BM=B.YZX_BM and A.JGID=B.JGID LEFT JOIN HIS_SFX C ON A.JGID=C.JGID AND A.BM=C.BM LEFT JOIN HIS_KSKC E ON A.JGID=E.JGID AND A.BM=E.SFX_BM left join HIS_MMS_WZZD F on C.GLBM=F.WZBM AND C.JGID=F.JGID WHERE A.JGID=? AND A.ISDDYZ = '1' AND A.ISJZSY != '1' AND ISZYSY !='1' AND A.ZT='1' AND A.GLLX = 'W' and (A.YZDL !='01' and A.YZDL !='02' and A.YZDL !='03') AND (B.PYM LIKE ? OR A.BM LIKE ? OR A.BM LIKE ? OR A.MC LIKE ?) )
union all
( select distinct '1' isyzt,A.JGID,A.PKEY BM,A.YZTNAME MC,'' YZDL,'' YZZL,'' ISDDYZ,'' ISXSYZ,'' ISMZSY,'' ISJZSY,'' ISZYSY,0 DCZDJL,0 MTZDJL,0 ZDL,0 SZSYTS,'' YF,'' LC,'' PC,'' ISMZPSYY,'' ISZYPSYY,'' ISMZSJL,'' ISZYSJL,0 JE,'' BZ,'' ZT,'' JBDW,'' RKDW,1 ZHXS,'' MZFYDW,'' ZYFYDW,0 JBJG,'' GG,'' YZDW,1 DXSL,'' DXDW,A.YZTNAME TYM,'0' ISKJY,'0' ISJK,'0' ISGJJBYW,'0' ISPS,0 SL,0 DJSL,0 KYSL,'' GZFL,'' DDD,'' WHONET,'' JX,'' TYMPKEY,'' GLLX,'' LMT_USED_FLAG,'' XZSYFW,'' CHRGITM_LV,'' YBBM,'' YBMC,0 DXRL,sysdate CGSHRQ,'' ph,'' YPMRPC,'' dptid,A.YZTPYM ZJM from HIS_YZT_MAIN A WHERE A.JGID=? AND A.SFZCY = '0' AND A.SFQY = '1' AND (A.YZTWBM LIKE ? OR A.YZTPYM LIKE ? OR A.YZTBM LIKE ? OR A.YZTNAME LIKE ?) )
( select distinct '0' isyzt,A.JGID,A.BM,#yzmc#,A.YZDL,A.YZZL,A.ISDDYZ,A.ISXSYZ,A.ISMZSY,A.ISJZSY,A.ISZYSY,A.DCZDJL,A.MTZDJL,A.ZDL,A.SZSYTS,A.YF,A.LC,A.PC,A.ISMZPSYY,A.ISZYPSYY,A.ISMZSJL,A.ISZYSJL,A.JE,A.BZ,A.ZT,A.YZDW JBDW,A.YZDW RKDW,1 ZHXS,A.YZDW MZFYDW,A.YZDW ZYFYDW,A.JE JBJG,'' GG,A.YZDW,1 DXSL,A.YZDW DXDW,A.MC TYM,'0' ISKJY,'0' ISJK,'0' ISGJJBYW,'0' ISPS,0 SL,0 DJSL,0 KYSL,'' GZFL,'' DDD,'' WHONET,'' JX,'' TYMPKEY,A.GLLX,A.LMT_USED_FLAG,A.XZSYFW,A.CHRGITM_LV,A.YBBM,A.YBMC,0 DXRL,sysdate YXQ,'' ph,'' YPMRPC,'' dptid,A.ZJM from HIS_YZX A left join HIS_YZX_ZJM B on A.BM=B.YZX_BM and A.JGID=B.JGID WHERE A.JGID=? AND A.ISDDYZ = '1' AND A.ISJZSY != '1' AND A.ISMZSY !='1' AND A.ZT='1' AND (A.GLLX != 'W' or A.GLLX is null) AND (A.YZDL !='01' and A.YZDL !='02' and A.YZDL !='03') AND (B.PYM LIKE ? OR A.BM LIKE ? OR A.BM LIKE ? OR A.MC LIKE ?) )
union all
( select distinct '0' isyzt,A.JGID,A.BM,#yzmc#||'['||F.WZGG||']' MC,A.YZDL,A.YZZL,A.ISDDYZ,A.ISXSYZ,A.ISMZSY,A.ISJZSY,A.ISZYSY,A.DCZDJL,A.MTZDJL,A.ZDL,A.SZSYTS,A.YF,A.LC,A.PC,A.ISMZPSYY,A.ISZYPSYY,A.ISMZSJL,A.ISZYSJL,C.JG JE,A.BZ,A.ZT,A.YZDW JBDW,A.YZDW RKDW,1 ZHXS,A.YZDW MZFYDW,A.YZDW ZYFYDW,A.JE JBJG,F.WZGG GG,A.YZDW,1 DXSL,A.YZDW DXDW,A.MC TYM,'0' ISKJY,'0' ISJK,'0' ISGJJBYW,'0' ISPS,nvl(E.SL,0) SL,nvl(E.DJSL,0) DJSL,nvl(E.KYSL,0) KYSL,'' GZFL,'' DDD,'' WHONET,'' JX,'' TYMPKEY,A.GLLX,A.LMT_USED_FLAG,A.XZSYFW,A.CHRGITM_LV,A.YBBM,A.YBMC,0 DXRL,sysdate YXQ,'' ph,'' YPMRPC,'' dptid,A.ZJM from HIS_YZX A left join HIS_YZX_ZJM B on A.BM=B.YZX_BM and A.JGID=B.JGID LEFT JOIN HIS_SFX C ON A.JGID=C.JGID AND A.BM=C.BM LEFT JOIN HIS_KSKC E ON A.JGID=E.JGID AND A.BM=E.SFX_BM left join HIS_MMS_WZZD F on C.GLBM=F.WZBM AND C.JGID=F.JGID WHERE A.JGID=? AND A.ISDDYZ = '1' AND A.ISJZSY != '1' AND ISZYSY !='1' AND A.ZT='1' AND A.GLLX = 'W' and (A.YZDL !='01' and A.YZDL !='02' and A.YZDL !='03') AND (B.PYM LIKE ? OR A.BM LIKE ? OR A.BM LIKE ? OR A.MC LIKE ?) )
( select distinct '0' isyzt,A.JGID,A.BM,#yzmc#||'['||F.WZGG||']' MC,A.YZDL,A.YZZL,A.ISDDYZ,A.ISXSYZ,A.ISMZSY,A.ISJZSY,A.ISZYSY,A.DCZDJL,A.MTZDJL,A.ZDL,A.SZSYTS,A.YF,A.LC,A.PC,A.ISMZPSYY,A.ISZYPSYY,A.ISMZSJL,A.ISZYSJL,C.JG JE,A.BZ,A.ZT,A.YZDW JBDW,A.YZDW RKDW,1 ZHXS,A.YZDW MZFYDW,A.YZDW ZYFYDW,A.JE JBJG,F.WZGG GG,A.YZDW,1 DXSL,A.YZDW DXDW,A.MC TYM,'0' ISKJY,'0' ISJK,'0' ISGJJBYW,'0' ISPS,nvl(E.SL,0) SL,nvl(E.DJSL,0) DJSL,nvl(E.KYSL,0) KYSL,'' GZFL,'' DDD,'' WHONET,'' JX,'' TYMPKEY,A.GLLX,A.LMT_USED_FLAG,A.XZSYFW,A.CHRGITM_LV,A.YBBM,A.YBMC,0 DXRL,sysdate YXQ,'' ph,'' YPMRPC,E.dptid,A.ZJM from HIS_YZX A left join HIS_YZX_ZJM B on A.BM=B.YZX_BM and A.JGID=B.JGID LEFT JOIN HIS_SFX C ON A.JGID=C.JGID AND A.BM=C.BM LEFT JOIN HIS_KSKC E ON A.JGID=E.JGID AND A.BM=E.SFX_BM left join HIS_MMS_WZZD F on C.GLBM=F.WZBM AND C.JGID=F.JGID WHERE A.JGID=? AND A.ISDDYZ = '1' AND A.ISJZSY != '1' AND ISZYSY !='1' AND A.ZT='1' AND A.GLLX = 'W' and (A.YZDL !='01' and A.YZDL !='02' and A.YZDL !='03') AND (B.PYM LIKE ? OR A.BM LIKE ? OR A.BM LIKE ? OR A.MC LIKE ?) )
union all
( select distinct '1' isyzt,A.JGID,A.PKEY BM,A.YZTNAME MC,'' YZDL,'' YZZL,'' ISDDYZ,'' ISXSYZ,'' ISMZSY,'' ISJZSY,'' ISZYSY,0 DCZDJL,0 MTZDJL,0 ZDL,0 SZSYTS,'' YF,'' LC,'' PC,'' ISMZPSYY,'' ISZYPSYY,'' ISMZSJL,'' ISZYSJL,0 JE,'' BZ,'' ZT,'' JBDW,'' RKDW,1 ZHXS,'' MZFYDW,'' ZYFYDW,0 JBJG,'' GG,'' YZDW,1 DXSL,'' DXDW,A.YZTNAME TYM,'0' ISKJY,'0' ISJK,'0' ISGJJBYW,'0' ISPS,0 SL,0 DJSL,0 KYSL,'' GZFL,'' DDD,'' WHONET,'' JX,'' TYMPKEY,'' GLLX,'' LMT_USED_FLAG,'' XZSYFW,'' CHRGITM_LV,'' YBBM,'' YBMC,0 DXRL,sysdate CGSHRQ,'' ph,'' YPMRPC,'' dptid,A.YZTPYM ZJM from HIS_YZT_MAIN A WHERE A.JGID=? AND A.SFZCY = '0' AND A.SFQY = '1' AND (A.YZTWBM LIKE ? OR A.YZTPYM LIKE ? OR A.YZTBM LIKE ? OR A.YZTNAME LIKE ?) )
( select distinct A.JGID,A.BM,A.MC||'['||F.WZGG||']' MC,A.YZDL,A.YZZL,A.ISDDYZ,A.ISXSYZ,A.ISMZSY,A.ISJZSY,A.ISZYSY,A.DCZDJL,A.MTZDJL,A.ZDL,A.SZSYTS,A.YF,A.LC,A.PC,A.ISMZPSYY,A.ISZYPSYY,A.ISMZSJL,A.ISZYSJL,C.JG JE,A.BZ,A.ZT,A.YZDW JBDW,A.YZDW RKDW,1 ZHXS,A.YZDW MZFYDW,A.YZDW ZYFYDW,A.JE JBJG,F.WZGG GG,A.YZDW,1 DXSL,A.YZDW DXDW,A.MC TYM,'0' ISKJY,'0' ISJK,'0' ISGJJBYW,'0' ISPS,nvl(E.SL,0) SL,nvl(E.DJSL,0) DJSL,nvl(E.KYSL,0) KYSL,'' GZFL,'' DDD,'' WHONET,'' JX,'' TYMPKEY,A.GLLX,A.LMT_USED_FLAG,A.XZSYFW,A.CHRGITM_LV,A.YBBM,A.YBMC,0 DXRL,sysdate CGSHRQ,'' ph,'' YPMRPC,'' dptid from HIS_YZX A left join HIS_YZX_ZJM B on A.BM=B.YZX_BM and A.JGID=B.JGID LEFT JOIN HIS_SFX C ON A.JGID=C.JGID AND A.BM=C.BM LEFT JOIN HIS_KSKC E ON A.JGID=E.JGID AND A.BM=E.SFX_BM left join HIS_MMS_WZZD F on C.GLBM=F.WZBM AND C.JGID=F.JGID WHERE A.JGID=? AND A.ISDDYZ = '1' AND A.ISJZSY != '1' AND ISZYSY !='1' AND A.ZT='1' AND A.GLLX = 'W' and (A.YZDL !='01' and A.YZDL !='02' and A.YZDL !='03') AND (B.PYM LIKE ? OR A.BM LIKE ? OR A.MC LIKE ?) )
( select distinct A.JGID,A.BM,A.MC||'['||F.WZGG||']' MC,A.YZDL,A.YZZL,A.ISDDYZ,A.ISXSYZ,A.ISMZSY,A.ISJZSY,A.ISZYSY,A.DCZDJL,A.MTZDJL,A.ZDL,A.SZSYTS,A.YF,A.LC,A.PC,A.ISMZPSYY,A.ISZYPSYY,A.ISMZSJL,A.ISZYSJL,C.JG JE,A.BZ,A.ZT,A.YZDW JBDW,A.YZDW RKDW,1 ZHXS,A.YZDW MZFYDW,A.YZDW ZYFYDW,A.JE JBJG,F.WZGG GG,A.YZDW,1 DXSL,A.YZDW DXDW,A.MC TYM,'0' ISKJY,'0' ISJK,'0' ISGJJBYW,'0' ISPS,nvl(E.SL,0) SL,nvl(E.DJSL,0) DJSL,nvl(E.KYSL,0) KYSL,'' GZFL,'' DDD,'' WHONET,'' JX,'' TYMPKEY,A.GLLX,A.LMT_USED_FLAG,A.XZSYFW,A.CHRGITM_LV,A.YBBM,A.YBMC,0 DXRL,sysdate CGSHRQ,'' ph,'' YPMRPC,E.dptid from HIS_YZX A left join HIS_YZX_ZJM B on A.BM=B.YZX_BM and A.JGID=B.JGID LEFT JOIN HIS_SFX C ON A.JGID=C.JGID AND A.BM=C.BM LEFT JOIN HIS_KSKC E ON A.JGID=E.JGID AND A.BM=E.SFX_BM left join HIS_MMS_WZZD F on C.GLBM=F.WZBM AND C.JGID=F.JGID WHERE A.JGID=? AND A.ISDDYZ = '1' AND A.ISJZSY != '1' AND ISZYSY !='1' AND A.ZT='1' AND A.GLLX = 'W' and (A.YZDL !='01' and A.YZDL !='02' and A.YZDL !='03') AND (B.PYM LIKE ? OR A.BM LIKE ? OR A.MC LIKE ?) )
( select distinct A.JGID,A.BM,A.MC||'['||F.WZGG||']' MC,A.YZDL,A.YZZL,A.ISDDYZ,A.ISXSYZ,A.ISMZSY,A.ISJZSY,A.ISZYSY,A.DCZDJL,A.MTZDJL,A.ZDL,A.SZSYTS,A.YF,A.LC,A.PC,A.ISMZPSYY,A.ISZYPSYY,A.ISMZSJL,A.ISZYSJL,C.JG JE,A.BZ,A.ZT,A.YZDW JBDW,A.YZDW RKDW,1 ZHXS,A.YZDW MZFYDW,A.YZDW ZYFYDW,A.JE JBJG,F.WZGG GG,A.YZDW,1 DXSL,A.YZDW DXDW,A.MC TYM,'0' ISKJY,'0' ISJK,'0' ISGJJBYW,'0' ISPS,nvl(E.SL,0) SL,nvl(E.DJSL,0) DJSL,nvl(E.KYSL,0) KYSL,'' GZFL,'' DDD,'' WHONET,'' JX,'' TYMPKEY,A.GLLX,A.LMT_USED_FLAG,A.XZSYFW,A.CHRGITM_LV,A.YBBM,A.YBMC,0 DXRL,sysdate YXQ,'' ph,'' YPMRPC,'' dptid from HIS_YZX A left join HIS_YZX_ZJM B on A.BM=B.YZX_BM and A.JGID=B.JGID LEFT JOIN HIS_SFX C ON A.JGID=C.JGID AND A.BM=C.BM LEFT JOIN HIS_KSKC E ON A.JGID=E.JGID AND A.BM=E.SFX_BM left join HIS_MMS_WZZD F on C.GLBM=F.WZBM AND C.JGID=F.JGID WHERE A.JGID=? AND A.ISDDYZ = '1' AND A.ISJZSY != '1' AND ISZYSY !='1' AND A.ZT='1' AND A.GLLX = 'W' and (A.YZDL !='01' and A.YZDL !='02' and A.YZDL !='03') AND (B.PYM LIKE ? OR A.BM LIKE ? OR A.MC LIKE ?) )
( select distinct A.JGID,A.BM,A.MC||'['||F.WZGG||']' MC,A.YZDL,A.YZZL,A.ISDDYZ,A.ISXSYZ,A.ISMZSY,A.ISJZSY,A.ISZYSY,A.DCZDJL,A.MTZDJL,A.ZDL,A.SZSYTS,A.YF,A.LC,A.PC,A.ISMZPSYY,A.ISZYPSYY,A.ISMZSJL,A.ISZYSJL,C.JG JE,A.BZ,A.ZT,A.YZDW JBDW,A.YZDW RKDW,1 ZHXS,A.YZDW MZFYDW,A.YZDW ZYFYDW,A.JE JBJG,F.WZGG GG,A.YZDW,1 DXSL,A.YZDW DXDW,A.MC TYM,'0' ISKJY,'0' ISJK,'0' ISGJJBYW,'0' ISPS,nvl(E.SL,0) SL,nvl(E.DJSL,0) DJSL,nvl(E.KYSL,0) KYSL,'' GZFL,'' DDD,'' WHONET,'' JX,'' TYMPKEY,A.GLLX,A.LMT_USED_FLAG,A.XZSYFW,A.CHRGITM_LV,A.YBBM,A.YBMC,0 DXRL,sysdate YXQ,'' ph,'' YPMRPC,E.dptid from HIS_YZX A left join HIS_YZX_ZJM B on A.BM=B.YZX_BM and A.JGID=B.JGID LEFT JOIN HIS_SFX C ON A.JGID=C.JGID AND A.BM=C.BM LEFT JOIN HIS_KSKC E ON A.JGID=E.JGID AND A.BM=E.SFX_BM left join HIS_MMS_WZZD F on C.GLBM=F.WZBM AND C.JGID=F.JGID WHERE A.JGID=? AND A.ISDDYZ = '1' AND A.ISJZSY != '1' AND ISZYSY !='1' AND A.ZT='1' AND A.GLLX = 'W' and (A.YZDL !='01' and A.YZDL !='02' and A.YZDL !='03') AND (B.PYM LIKE ? OR A.BM LIKE ? OR A.MC LIKE ?) )