CREATE OR REPLACE VIEW SD_HOSPITAL.VW_YF_JYGHXX_DSQL
 (
 CKDH00, YPMC00, YPGG00, CKDW00, GJDJ00, LSDJ00, CKSL00, BMMC00, SRRQ00, 
QRRQ00, C_LSJE, C_GJJE, C_JXCJ, JYR000, GHSL00

 )
 AS 
SELECT X.CKDH00,X.YPMC00,X.YPGG00,X.CKDW00,X.GJDJ00,X.LSDJ00,X.CKSL00,
  G.BMMC00,R.SRRQ00,R.QRRQ00,
  ROUND(decode(X.JYSYSL,0,NVL(ZHGHSL,0))*X.LSDJ00,2) AS C_LSJE,
  ROUND(decode(X.JYSYSL,0,NVL(ZHGHSL,0))*X.GJDJ00,2) AS C_GJJE,
  ROUND(decode(X.JYSYSL,0,NVL(ZHGHSL,0))*X.LSDJ00,2)-ROUND(X.JYSYSL*X.GJDJ00,2) AS C_JXCJ,
  (SELECT ZWXM00 FROM BM_YGBM00 WHERE YGBH00=R.JYR000) JYR000,
  decode(X.JYSYSL,0,NVL(ZHGHSL,0)) GHSL00
 FROM YF_YPCKMX X,YF_YPCKD0 R,VW_YF_YPCKFX G,yf_ypkcxx p
 WHERE  R.CKDH00=X.CKDH00 AND R.CKBMBH=G.BMBH00 and x.ypnm00 =p.ypnm00 order by p.pdxh00
/
