标签:row rhs from group 名称 xib kff bst upper
ayqy:
--市医保
select xx.shbzhm from zyxx xx where xx.shbzhm is not null;
select * from ybjsxx;
--铁路医保
select * from tielyb_ZYBRXX where xx.yibbh is not null ;
--农合
select * from PKYB_ZYBRXX xx where xx.gerbh is not null;
---------------------------------------------------------NH------------------------------------------------------
select ‘医院名称‘ username, ‘02‘ ylfkfs, ‘‘ jkkh,c.住院次数 zycs,ab.BINGLH bah,ab.XINGM xm ,decode(ab.XINGB,‘男‘,‘1‘,‘2‘) xb,substr(b.shenfzh,7,8) CSRQ
,ab.NIANLN nl,‘CHN‘ GJ,0 BZYZSNL ,0 XSECSTZ ,0 XSERYTZ ,ab.JIG CSD ,ab.JIG GG ,decode(ab.MINGZ,‘回族‘,‘03‘,‘01‘) MZ ,upper(b.shenfzh) SFZH
,decode(ab.ZHIY, ‘干部‘,‘11‘,‘教师‘,‘11‘,‘农民‘,‘27‘,‘工人‘,‘24‘,‘学生‘,‘31‘,‘90‘) ZY ,decode(ab.HUIF ,‘未婚‘,‘1‘,‘已婚‘,‘2‘,‘离婚‘,‘3‘,‘丧偶‘,‘4‘,‘9‘) HY
,ab.ZHUZ XZZ , ab.LIANXRDH DH ,ab.Zhuzyb YB1 ,ab.ZHUZ HKDZ ,‘‘ YB2 ,ab.GONGZDWDZ GZDWJDZ ,‘‘ DWDH , ‘‘ YB3 ,ab.LIANXR LXRXM
,decode(ab.LIANXGX ,‘配偶‘,‘1‘,‘儿子‘,‘2‘,‘女儿‘,‘3‘,‘孙子‘,‘4‘,‘父母‘,‘5‘,‘外祖父母‘,‘6‘,‘姐妹‘,‘7‘,‘兄弟‘,‘7‘,‘兄弟‘,‘4‘,‘孙女‘,‘4‘,‘外孙子‘,‘4‘,‘祖父母‘, ‘6‘,‘8‘) GX
,ab.ZHUZ DZ ,‘‘ DH2 , decode(ab.RUYTJ ,‘1‘,‘1‘,‘2‘,‘2‘,‘3‘,‘3‘,‘9‘) RYTJ , substr(ab.RUYSJ,1,4)||substr(ab.RUYSJ,6,2)||substr(ab.RUYSJ,9,2) RYSJ
, ‘‘ RYSJS , ab.RUYKB RYKB ,ab.BINGF RYBF , ‘‘ ZKKB , substr(ab.CHUYRQ,1,4)||substr(ab.CHUYRQ,6,2)||substr(ab.CHUYRQ,9,2) CYSJ , ‘‘ CYSJS
, ab.chuyks CYKB ,ab.CHUYBF CYBF ,ab.ZHUYTS SJZYTS ,ab.ZHENDMC MZZD ,ab.ZHENDBM JBBM , z.ZHENDMC_Z ZYZD ,z.JIBDM_Z JBDM ,z.RUYBQ_Z RYBQ
, ‘‘ QTZD8 ,‘‘ JBDM8 ,‘‘ RYBQ8
, c1.ZHENDMC_c1 QTZD1 ,c1.JIBDM_c1 JBDM1 ,c1.RUYBQ_c1 RYBQ1
, ‘‘ QTZD9 ,‘‘ JBDM9 ,‘‘ RYBQ9
, ‘‘ QTZD2 ,‘‘ JBDM2 ,‘‘ RYBQ2
, ‘‘ QTZD10 ,‘‘ JBDM10 ,‘‘ RYBQ10
, ‘‘ QTZD3 ,‘‘ JBDM3 ,‘‘ RYBQ3
, ‘‘ QTZD11 ,‘‘ JBDM11 ,‘‘ RYBQ11
, ‘‘ QTZD4 ,‘‘ JBDM4 ,‘‘ RYBQ4
, ‘‘ QTZD12 ,‘‘ JBDM12 ,‘‘ RYBQ12
, ‘‘ QTZD5 ,‘‘ JBDM5 ,‘‘ RYBQ5
, ‘‘ QTZD13 ,‘‘ JBDM13 ,‘‘ RYBQ13
, ‘‘ QTZD6 ,‘‘ JBDM6 ,‘‘ RYBQ6
, ‘‘ QTZD14 ,‘‘ JBDM14 ,‘‘ RYBQ14
, ‘‘ QTZD7 ,‘‘ JBDM7 ,‘‘ RYBQ7
, ‘‘ QTZD15 ,‘‘ JBDM15 ,‘‘ RYBQ15
,‘‘ WBYY , ‘‘ H23 , ‘‘ BLZD ,‘‘ JBMM ,‘‘ BLH ,ab.YAOWGM YWGM ,‘‘ GMYW ,ab.SIWSJ SWHZSJ ,ab.XUEX xx ,ab.XUEX_RH RH
,ab.KEZR KZR ,ab.ZHUGYSXM ZRYS ,ab.ZHUZYSXM ZZYS ,ab.ZHUGYSXM ZYYS ,ab.CANYHS ZRHS ,ab.JINXYS JXYS ,ab.SHIXYS SXYS
,ab.ZHIKYS BMY ,ab.BINGAZL BAZL ,ab.ZHIKYS ZKYS ,ab.ZHIKHS ZKHS ,substr(ab.ZHIKRQ,1,4)||substr(ab.ZHIKRQ,6,2)||substr(ab.ZHIKRQ,9,2) ZKRQ
, s1.shousbm1 SSJCZBM1 ,substr(s1.SHOUSRQ1,1,4)||substr(s1.SHOUSRQ1,6,2)||substr(s1.SHOUSRQ1,9,2) SSJCZRQ1
,s1.shousjb1 SSJB1 ,s1.shousmc1 SSJCZMC1 ,s1.shuz1 SZ1 ,s1.zhus11 YZ1 ,s1.zhus21 EZ1
,decode(s1.qiekdj1,‘I‘,‘1‘,‘II‘,‘2‘,‘III‘,‘3‘,‘0‘) QKDJ1
,decode(s1.yuhcd1,‘甲‘,‘1‘,‘乙‘,‘2‘,‘丙‘,‘3‘,‘4‘) QKYHLB1
,s1.mazfs1 MZFS1 ,s1.mazys1 MZYS1
,s2.shousjb2 SSJCZBM2 ,substr(s2.shousrq2,1,4)||substr(s2.shousrq2,6,2)||substr(s2.shousrq2,9,2) SSJCZRQ2
,s2.shousjb2 SSJB2 ,s2.shousmc2 SSJCZMC2 ,s2.shuz2 SZ2 ,s2.zhus12 YZ2 ,s2.zhus22 EZ2
,decode(s2.qiekdj2,‘I‘,‘1‘,‘II‘,‘2‘,‘III‘,‘3‘,‘0‘) QKDJ2
,decode(s2.yuhcd2,‘甲‘,‘1‘,‘乙‘,‘2‘,‘丙‘,‘3‘,‘4‘) QKYHLB2
,s2.mazfs2 MZFS2 ,s2.mazys2 MZYS2
,‘‘ SSJCZBM3 ,‘‘ SSJCZRQ3 ,‘‘ SSJB3 ,‘‘ SSJCZMC3 ,‘‘ SZ3 ,‘‘ YZ3 , ‘‘ EZ3 ,‘‘ Q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UYBQ FROM
(SELECT * FROM JIBZD WHERE ZHUC = 1 AND ZHENDLB = ‘西医出院诊断‘ ORDER BY ZHUYH, XUH) J1,
(SELECT ZHUYH, MIN(ROWNUM) MIN_SNO FROM (SELECT * FROM JIBZD WHERE ZHUC = 1 AND ZHENDLB = ‘西医出院诊断‘ ORDER BY ZHUYH, XUH) GROUP BY ZHUYH) J2 WHERE J1.ZHUYH =J2.ZHUYH) WHERE SNO = 1) Z,
(SELECT ZHUYH, ZHENDMC ZHENDMC_C1, JIBDM JIBDM_C1, RUYBQ RUYBQ_C1 FROM (SELECT J1.ZHUYH, DECODE(ROWNUM-MIN_SNO, 0, 1, ROWNUM + 1 - MIN_SNO) SNO, J1.ZHENDMC, J1.JIBDM, J1.RUYBQ FROM
(SELECT * FROM JIBZD WHERE ZHUC = 0 AND ZHENDLB = ‘西医出院诊断‘ ORDER BY ZHUYH, XUH) J1,
(SELECT ZHUYH, MIN(ROWNUM) MIN_SNO FROM (SELECT * FROM JIBZD WHERE ZHUC = 0 AND ZHENDLB = ‘西医出院诊断‘ ORDER BY ZHUYH, XUH) GROUP BY ZHUYH) J2 WHERE J1.ZHUYH =J2.ZHUYH) WHERE SNO = 1) C1
WHERE ab.ZHUYH = S1.ZHUYH(+) AND ab.ZHUYH = S2.ZHUYH(+)
AND ab.ZHUYH = Z.ZHUYH(+) AND ab.ZHUYH = C1.ZHUYH(+)
and ab.ZHUYH = b.zhuyh and b.zhuyh = c.hisbh and ab.ZHUYH = zyfy.ZhuYH
and b.chuy = 1
and ab.CHUYRQ between ‘2018-01-01,00:00:01‘ and ‘2018-12-31,23:59:59‘;
--------------------------------------------------------DRYB--------------------------------------------------------
select ‘医院名称‘ username,
‘02‘ ylfkfs,
‘‘ jkkh,
YBJSXX.Bnzycs zycs,
ab.BINGLH bah,
ab.XINGM xm,
decode(ab.XINGB, ‘男‘, ‘1‘, ‘2‘) xb,
substr(YBBRXX.Shehbzh, 7, 8) CSRQ,
ab.NIANLN nl,
‘CHN‘ GJ,
0 BZYZSNL,
0 XSECSTZ,
0 XSERYTZ,
ab.JIG CSD,
ab.JIG GG,
decode(ab.MINGZ, ‘回族‘, ‘03‘, ‘01‘) MZ,
upper(YBBRXX.Shehbzh) SFZH,
decode(ab.ZHIY,
‘干部‘,
‘11‘,
‘教师‘,
‘11‘,
‘农民‘,
‘27‘,
‘工人‘,
‘24‘,
‘学生‘,
‘31‘,
‘90‘) ZY,
decode(ab.HUIF,
‘未婚‘,
‘1‘,
‘已婚‘,
‘2‘,
‘离婚‘,
‘3‘,
‘丧偶‘,
‘4‘,
‘9‘) HY,
ab.ZHUZ XZZ,
ab.LIANXRDH DH,
ab.Zhuzyb YB1,
ab.ZHUZ HKDZ,
‘‘ YB2,
ab.GONGZDWDZ GZDWJDZ,
‘‘ DWDH,
‘‘ YB3,
ab.LIANXR LXRXM,
decode(ab.LIANXGX,
‘配偶‘,
‘1‘,
‘儿子‘,
‘2‘,
‘女儿‘,
‘3‘,
‘孙子‘,
‘4‘,
‘父母‘,
‘5‘,
‘外祖父母‘,
‘6‘,
‘姐妹‘,
‘7‘,
‘兄弟‘,
‘7‘,
‘兄弟‘,
‘4‘,
‘孙女‘,
‘4‘,
‘外孙子‘,
‘4‘,
‘祖父母‘,
‘6‘,
‘8‘) GX,
ab.ZHUZ DZ,
‘‘ DH2,
decode(ab.RUYTJ, ‘1‘, ‘1‘, ‘2‘, ‘2‘, ‘3‘, ‘3‘, ‘9‘) RYTJ,
substr(ab.RUYSJ, 1, 4) || substr(ab.RUYSJ, 6, 2) ||
substr(ab.RUYSJ, 9, 2) RYSJ,
‘‘ RYSJS,
ab.RUYKB RYKB,
ab.BINGF RYBF,
‘‘ ZKKB,
substr(ab.CHUYRQ, 1, 4) || substr(ab.CHUYRQ, 6, 2) ||
substr(ab.CHUYRQ, 9, 2) CYSJ,
‘‘ CYSJS,
ab.chuyks CYKB,
ab.CHUYBF CYBF,
ab.ZHUYTS SJZYTS,
ab.ZHENDMC MZZD,
ab.ZHENDBM JBBM,
z.ZHENDMC_Z ZYZD,
z.JIBDM_Z JBDM,
z.RUYBQ_Z RYBQ,
‘‘ QTZD8,
‘‘ JBDM8,
‘‘ RYBQ8,
c1.ZHENDMC_c1 QTZD1,
c1.JIBDM_c1 JBDM1,
c1.RUYBQ_c1 RYBQ1,
‘‘ QTZD9,
‘‘ JBDM9,
‘‘ RYBQ9,
‘‘ QTZD2,
‘‘ JBDM2,
‘‘ RYBQ2,
‘‘ QTZD10,
‘‘ JBDM10,
‘‘ RYBQ10,
‘‘ QTZD3,
‘‘ JBDM3,
‘‘ RYBQ3,
‘‘ QTZD11,
‘‘ JBDM11,
‘‘ RYBQ11,
‘‘ QTZD4,
‘‘ JBDM4,
‘‘ RYBQ4,
‘‘ QTZD12,
‘‘ JBDM12,
‘‘ RYBQ12,
‘‘ QTZD5,
‘‘ JBDM5,
‘‘ RYBQ5,
‘‘ QTZD13,
‘‘ JBDM13,
‘‘ RYBQ13,
‘‘ QTZD6,
‘‘ JBDM6,
‘‘ RYBQ6,
‘‘ QTZD14,
‘‘ JBDM14,
‘‘ RYBQ14,
‘‘ QTZD7,
‘‘ JBDM7,
‘‘ RYBQ7,
‘‘ QTZD15,
‘‘ JBDM15,
‘‘ RYBQ15,
‘‘ WBYY,
‘‘ H23,
‘‘ BLZD,
‘‘ JBMM,
‘‘ BLH,
ab.YAOWGM YWGM,
‘‘ GMYW,
ab.SIWSJ SWHZSJ,
ab.XUEX xx,
ab.XUEX_RH RH,
ab.KEZR KZR,
ab.ZHUGYSXM ZRYS,
ab.ZHUZYSXM ZZYS,
ab.ZHUGYSXM ZYYS,
ab.CANYHS ZRHS,
ab.JINXYS JXYS,
ab.SHIXYS SXYS,
ab.ZHIKYS BMY,
ab.BINGAZL BAZL,
ab.ZHIKYS ZKYS,
ab.ZHIKHS ZKHS,
substr(ab.ZHIKRQ, 1, 4) || substr(ab.ZHIKRQ, 6, 2) ||
substr(ab.ZHIKRQ, 9, 2) ZKRQ
,
s1.shousbm1 SSJCZBM1,
substr(s1.SHOUSRQ1, 1, 4) || substr(s1.SHOUSRQ1, 6, 2) ||
substr(s1.SHOUSRQ1, 9, 2) SSJCZRQ1,
s1.shousjb1 SSJB1,
s1.shousmc1 SSJCZMC1,
s1.shuz1 SZ1,
s1.zhus11 YZ1,
s1.zhus21 EZ1,
decode(s1.qiekdj1, ‘I‘, ‘1‘, ‘II‘, ‘2‘, ‘III‘, ‘3‘, ‘0‘) QKDJ1,
decode(s1.yuhcd1, ‘甲‘, ‘1‘, ‘乙‘, ‘2‘, ‘丙‘, ‘3‘, ‘4‘) QKYHLB1,
s1.mazfs1 MZFS1,
s1.mazys1 MZYS1,
s2.shousjb2 SSJCZBM2,
substr(s2.shousrq2, 1, 4) || substr(s2.shousrq2, 6, 2) ||
substr(s2.shousrq2, 9, 2) SSJCZRQ2,
s2.shousjb2 SSJB2,
s2.shousmc2 SSJCZMC2,
s2.shuz2 SZ2,
s2.zhus12 YZ2,
s2.zhus22 EZ2,
decode(s2.qiekdj2, ‘I‘, ‘1‘, ‘II‘, ‘2‘, ‘III‘, ‘3‘, ‘0‘) QKDJ2,
decode(s2.yuhcd2, ‘甲‘, ‘1‘, ‘乙‘, ‘2‘, ‘丙‘, ‘3‘, ‘4‘) QKYHLB2,
s2.mazfs2 MZFS2,
s2.mazys2 MZYS2,
‘‘ SSJCZBM3,
‘‘ SSJCZRQ3,
‘‘ SSJB3,
‘‘ SSJCZMC3,
‘‘ SZ3,
‘‘ YZ3,
‘‘ EZ3,
‘‘ QKDJ3,
‘‘ QKYHLB3,
‘‘ MZFS3,
‘‘ MZYS3,
‘‘ SSJCZBM4,
‘‘ SSJCZRQ4,
‘‘ SSJB4,
‘‘ SSJCZMC4,
‘‘ SZ4,
‘‘ YZ4,
‘‘ EZ4,
‘‘ QKDJ4,
‘‘ QKYHLB4,
‘‘ MZFS4,
‘‘ MZYS4,
‘‘ SSJCZBM5,
‘‘ SSJCZRQ5,
‘‘ SSJB5,
‘‘ SSJCZMC5,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IUDBLZPF QDBLZPF,
zyfy.FY8_NINGXYZLZPF NXYZLZPF,
zyfy.FY8_XIBYZLZPF XBYZLZPF,
0 HCYYCLF,
zyfy.FY9_ZHILYYCXYYCLF YYCLF,
zyfy.FY9_SHOUSYYCXYYCLF YCXYYCLF,
zyfy.FY10_QITF QTF
from bingrxx ab,
yb_zybrxx YBBRXX,
ybjs YBJSXX,
zyfyhz zyfy ,(SELECT ZHUYH,
SHOUSBM SHOUSBM1,
SHOUSRQ SHOUSRQ1,
SHOUSJB SHOUSJB1,
SHOUSMC SHOUSMC1,
SHUZ SHUZ1,
ZHUS1 ZHUS11,
ZHUS2 ZHUS21,
QIEKDJ QIEKDJ1,
YUHCD YUHCD1,
MAZFS MAZFS1,
MAZYS MAZYS1
FROM SHOUSDJ
WHERE XUH = 1) S1,
(SELECT ZHUYH,
SHOUSBM SHOUSBM2,
SHOUSRQ SHOUSRQ2,
SHOUSJB SHOUSJB2,
SHOUSMC SHOUSMC2,
SHUZ SHUZ2,
ZHUS1 ZHUS12,
ZHUS2 ZHUS22,
QIEKDJ QIEKDJ2,
YUHCD YUHCD2,
MAZFS MAZFS2,
MAZYS MAZYS2
FROM SHOUSDJ
WHERE XUH = 2) S2,
(SELECT ZHUYH, ZHENDMC ZHENDMC_Z, JIBDM JIBDM_Z, RUYBQ RUYBQ_Z
FROM (SELECT J1.ZHUYH,
DECODE(ROWNUM - MIN_SNO, 0, 1, ROWNUM + 1 - MIN_SNO) SNO,
J1.ZHENDMC,
J1.JIBDM,
J1.RUYBQ
FROM (SELECT *
FROM JIBZD
WHERE ZHUC = 1
AND ZHENDLB = ‘西医出院诊断‘
ORDER BY ZHUYH, XUH) J1,
(SELECT ZHUYH, MIN(ROWNUM) MIN_SNO
FROM (SELECT *
FROM JIBZD
WHERE ZHUC = 1
AND ZHENDLB = ‘西医出院诊断‘
ORDER BY ZHUYH, XUH)
GROUP BY ZHUYH) J2
WHERE J1.ZHUYH = J2.ZHUYH)
WHERE SNO = 1) Z,
(SELECT ZHUYH, ZHENDMC ZHENDMC_C1, JIBDM JIBDM_C1, RUYBQ RUYBQ_C1
FROM (SELECT J1.ZHUYH,
DECODE(ROWNUM - MIN_SNO, 0, 1, ROWNUM + 1 - MIN_SNO) SNO,
J1.ZHENDMC,
J1.JIBDM,
J1.RUYBQ
FROM (SELECT *
FROM JIBZD
WHERE ZHUC = 0
AND ZHENDLB = ‘西医出院诊断‘
ORDER BY ZHUYH, XUH) J1,
(SELECT ZHUYH, MIN(ROWNUM) MIN_SNO
FROM (SELECT *
FROM JIBZD
WHERE ZHUC = 0
AND ZHENDLB = ‘西医出院诊断‘
ORDER BY ZHUYH, XUH)
GROUP BY ZHUYH) J2
WHERE J1.ZHUYH = J2.ZHUYH)
WHERE SNO = 1) C1
WHERE ab.ZHUYH = S1.ZHUYH(+)
AND ab.ZHUYH = S2.ZHUYH(+)
AND ab.ZHUYH = Z.ZHUYH(+)
AND ab.ZHUYH = C1.ZHUYH(+)
and ab.ZHUYH = YBBRXX.zhuyh
and YBBRXX.zhuyh = YBJSXX.Liush
and ab.ZHUYH = zyfy.ZhuYH
and YBBRXX.chuy = 1
and ab.CHUYRQ between ‘2016-01-01,00:00:01‘ and ‘2016-12-31,23:59:59‘;
标签:row rhs from group 名称 xib kff bst upper
原文地址:https://www.cnblogs.com/maweiwei/p/10947832.html