create or replace procedure SP_BA_BASSJZKXY -- MODIFICATION HISTORY -- Person Date Comments -- xuxq 2019.09.03 Create 病案室三级质控西医 BAGL-20190906-001 -- xuxq 2019.11.27 新增损伤不在编码范围内校验 ( as_ksrq00 in char, as_jsrq00 in char, as_cjr000 in varchar2 ) as cursor CUR_BRZYXX is select * from VW_BA_SJJXBASSJ VW where VW.CYRQ00>=as_ksrq00 and VW.CYRQ00<=as_jsrq00; LS_BRZYXX CUR_BRZYXX%rowtype; zdmCount1 number(4); zdmCount2 number(4); zdmCount3 number(4); zdmCount4 number(4); mzCount number(4); qtzdmCount number(4); cytzCount number(4); v_zlxg VARCHAR(100); tempFlag VARCHAR(8); begin delete from BA_ZKJL00; open CUR_BRZYXX; loop fetch CUR_BRZYXX into LS_BRZYXX; exit when CUR_BRZYXX%notfound; select count(1) into qtzdmCount from BQ_BASZDB ZD where ZD.ZYID00=LS_BRZYXX.LSH000 and substr(ZD.ZDM000,1,3) ='Z37' and ZDLB00='4'; select count(1) into cytzCount from BQ_BASZDB ZD where ZD.ZYID00=LS_BRZYXX.LSH000 and (ZD.ZDM000 ='Z37.000' or ZD.ZDM000 ='Z37.000X001' or ZD.ZDM000 ='Z37.000x001' ); /* select count(1) into zdmCount1 from XT_CM3000 where CM3000=LS_BRZYXX.SSJCZBM1; select count(1) into zdmCount2 from XT_CM3000 where CM3000=LS_BRZYXX.SSJCZBM2; select count(1) into zdmCount3 from XT_CM3000 where CM3000=LS_BRZYXX.SSJCZBM3; select count(1) into zdmCount4 from XT_CM3000 where CM3000=LS_BRZYXX.SSJCZBM4;*/ if(LS_BRZYXX.Zkrq00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'质控日期不得为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.RYRQ00>LS_BRZYXX.CYRQ00) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'入院时间应小于等于出院日期','2','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(to_date(LS_BRZYXX.RYRQ00,'yyyy-mm-dd')-to_date(LS_BRZYXX.BRCSRQ,'yyyy-mm-dd')<=28 and LS_BRZYXX.YERYTZ is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'新生儿入院体重不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.BRNL00>0 and floor((to_date(LS_BRZYXX.RYRQ00,'yyyy-mm-dd')-to_date(LS_BRZYXX.BRCSRQ,'yyyy-mm-dd'))/365)-LS_BRZYXX.BRNL00>2) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'年龄不正确','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(cytzCount>0 and LS_BRZYXX.YECSTZ is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断为Z37.000或Z37.000X001时, 新生儿出生体重不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(to_date(LS_BRZYXX.RYRQ00,'yyyy-mm-dd')-to_date(LS_BRZYXX.BRCSRQ,'yyyy-mm-dd')<=28 and LS_BRZYXX.YECSTZ is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'新生儿出生体重不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZKRQ00 to_char(sysdate,'yyyymmdd')) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'质控日期不能晚于当前时间','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.SFYWGM='有' and LS_BRZYXX.GMYW00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'有药物过敏,则过敏药物名称必填','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.LYFS00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'离院方式不能为空;','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.LYFS00='医嘱转院' and LS_BRZYXX.ZYYLJG is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'离院方式为医嘱转院或医嘱转社区卫生服务机构/乡镇卫生院的患者必填','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.LYFS00='死亡' and LS_BRZYXX.SFSJ00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'出院情况为死亡,尸检不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZZYJH0 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'是否有31天再住院计划值不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZZYJH0='有' and LS_BRZYXX.ZZYMD0 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'有出院31日内再住院计划,出院31天再住院计划目的不能为空','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.BAH000 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'病案号不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZYCS00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'住院次数不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.BRCSRQ is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'出生日期不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.RYSJ00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'入院时间不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.RYKB00='0') then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'入院科别不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if (LS_BRZYXX.CYRQ00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'出院时间不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZYTS00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'实际住院天数不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZYTS00=0 or ISNUMBER(LS_BRZYXX.ZYTS00)=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'实际住院天数字段值错误,值域范围参考[1-999999]','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.RYBF00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'入院病房不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.CYBF00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'出院病房不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.CSDS00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'出生地不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if (LS_BRZYXX.SFZH00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'身份证号不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; /* if(LS_BRZYXX.SFZH00<>'-' and SP_SF_CHECKSFZH(upper(LS_BRZYXX.SFZH00))<>1) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'身份证号码不符合国家规范','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if;*/ if(LS_BRZYXX.XZZXC0 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'现住址不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.XZZDH0 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'现住址电话不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.XZZYB0 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'现住址邮政编码不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if((LS_BRZYXX.BRNL00 is null or LS_BRZYXX.BRNL00=0) and LS_BRZYXX.BRNLDD>365) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'病人年龄有无,值域范围参考[0-365]','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if((LS_BRZYXX.BRNL00 is null or LS_BRZYXX.BRNL00 <=0) and LS_BRZYXX.BRNLDD is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'当病人小于1岁时,不足1周岁不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if( ISNUMBER(LS_BRZYXX.XZZYB0)=0 and ls_brzyxx.xzzyb0 <> '-') then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'现住址邮政编码应为数字类型','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(length(LS_BRZYXX.XZZYB0)>6) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'现住址邮编长度不能大于6','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.JTDZ00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'户口地址不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.JTYB00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'户口住址邮政编码不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if( ISNUMBER(LS_BRZYXX.JTYB00)=0 and ls_brzyxx.jtyb00 <> '-') then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'户口邮政编码应为数字类型','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(length(LS_BRZYXX.JTYB00)>6) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'户口邮编长度不能大于6','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.GZDW00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'工作单位及地址不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.GZDH00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'工作单位电话不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.GZYB00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'工作单位邮政编码不能为空; ','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(ISNUMBER(LS_BRZYXX.GZYB00)=0 and ls_brzyxx.gzyb00 <> '-') then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'工作邮政编码应为数字类型','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(length(LS_BRZYXX.GZYB00)>6) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'工作邮编长度不能大于6','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.LXRXM0 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'联系人姓名不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.LXRDZ0 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'联系人地址不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.LXRDH0 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'联系人电话不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.LXRGX0 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'联系人关系不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.JFFS00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'医疗付款方式不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.BRXM00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'性别不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.GJ0000 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'国籍不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.JGSF00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'籍贯不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.MZ0000 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'民族不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into mzCount from XT_MZ0000 MZ where MZ.MC0000=LS_BRZYXX.MZ0000; if(mzCount =0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'民族值不在字典范围内','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZY0000 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'职业不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.HYZK00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'婚姻状况不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.RYTJ00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'入院途径不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.XX0000 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'ABO血型,不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.RH0000 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'Rh血型,不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.KZR000 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'科主任不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.FZR000 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'主任不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZZYS00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'主治医师不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZYYS00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'住院医师不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZRHS00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'责任护士不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into zdmCount1 from XT_ZD0000 where VALUE0=LS_BRZYXX.JGSF00 and ZDBM00='JG0000'; if(LS_BRZYXX.JGSF00 <>'-' and zdmCount1=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'籍贯不在字典范围内','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.SHRXM0 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'编码员不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(to_date(LS_BRZYXX.CYRQ00,'yyyyMMdd')-to_date(LS_BRZYXX.RYRQ00,'yyyyMMdd')<>0 and to_date(LS_BRZYXX.CYRQ00,'yyyyMMdd')-to_date(LS_BRZYXX.RYRQ00,'yyyyMMdd')<>LS_BRZYXX.ZYTS00) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'实际住院天数(SJZY)填写不正确','2','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into zdmCount1 from BA_BASSSB SS where SS.LSH000=LS_BRZYXX.LSH000 and SS.SSRQ00 >LS_BRZYXX.CYRQ00; if(zdmCount1>0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'手术日期应小于出院日期','2','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into zdmCount1 from BA_BASSSB SS where SS.LSH000=LS_BRZYXX.LSH000 and SS.SSRQ00 0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'手术日期应大于入院日期','2','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into zdmCount1 from BA_BASSSB SS where SS.LSH000=LS_BRZYXX.LSH000 and SS.SSRQ00 <>'-' and isdate(SSRQ00,'yyyy-mm-dd')=0; if(zdmCount1>0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'手术日期格式不正确','2','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.SSJCZMC1 <> '-' and LS_BRZYXX.SSJCZBM1 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'第一条手术编码不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.SSJCZMC2 <> '-' and LS_BRZYXX.SSJCZBM2 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'第二条手术编码不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.SSJCZMC3 <> '-' and LS_BRZYXX.SSJCZBM3 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'第三条手术编码不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.SSJCZMC4 <> '-' and LS_BRZYXX.SSJCZBM4 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'第四条手术编码不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; -- select count(1) into zdmCount1 from BA_BASSSB SS where SS.LSH000 =LS_BRZYXX.LSH000 and ss.ssm000 not in (select cm3000 from XT_CM3000); select count(1) into zdmCount1 from BA_BASSSB SS where SS.LSH000 =LS_BRZYXX.LSH000 and ss.ssm000 not in (select cm3000 from xt_cm3dyb); if(zdmCount1>0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'手术编码不在编码范围内','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; /* if(LS_BRZYXX.SSJCZBM1 <> '-' and zdmCount1=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'第一条手术编码不在编码范围内','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.SSJCZBM2 <> '-' and zdmCount2=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'第二条手术编码不在编码范围内','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.SSJCZBM3 <> '-' and zdmCount3=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'第三条手术编码不在编码范围内','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.SSJCZBM4 <> '-' and zdmCount4=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'第四条手术编码不在编码范围内','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if;*/ tempFlag :='f'; if(LS_BRZYXX.ZYZFY0 < (LS_BRZYXX.Ybylfw+LS_BRZYXX.Ybzlcz+LS_BRZYXX.Hlf000+LS_BRZYXX.QTFY00+LS_BRZYXX.Blzdf0+LS_BRZYXX.Syszdf+LS_BRZYXX.Yxxzdf+LS_BRZYXX.Lczdxm +LS_BRZYXX.Fsszlf+LS_BRZYXX.Sszlf0+LS_BRZYXX.Kff000+LS_BRZYXX.Zyzl00+LS_BRZYXX.Xyf000+LS_BRZYXX.Zcyf00+LS_BRZYXX.Zcyf10+LS_BRZYXX.Xf0000+LS_BRZYXX.Bdblzp +LS_BRZYXX.Qdblzp+LS_BRZYXX.Nxyzzp+LS_BRZYXX.Xbyzzp+LS_BRZYXX.Jcyclf+LS_BRZYXX.Zlyclf+LS_BRZYXX.Ssyclf)) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'总费用大于或等于分项费用之和D01≥(D11+D12+D13+D14+D15+D16+D17+D18+D19+D20+D21+D22+D23+D24+D25+D26+D27+D28+D29+D30+D31+D32+D33+D34)','3','2',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); tempFlag :='t'; end if; if(LS_BRZYXX.ZFJE00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'自付金额不能为空','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); tempFlag :='t'; end if; if(LS_BRZYXX.ZYZFY0 28) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断码为P10~P15时,入院时间减出生日期必须≤28天','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(substr(LS_BRZYXX.ZYZD_JBBM2,1,3) between 'P10' and 'P16' and (to_date(LS_BRZYXX.RYRQ00,'yyyy-mm-dd')-to_date(LS_BRZYXX.BRCSRQ,'yyyy-mm-dd'))>28) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断码为P10~P15时,入院时间减出生日期必须≤28天','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(substr(LS_BRZYXX.ZYZD_JBBM3,1,3) between 'P10' and 'P16' and (to_date(LS_BRZYXX.RYRQ00,'yyyy-mm-dd')-to_date(LS_BRZYXX.BRCSRQ,'yyyy-mm-dd'))>28) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断码为P10~P15时,入院时间减出生日期必须≤28天','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(substr(LS_BRZYXX.ZYZD_JBBM4,1,3) between 'P10' and 'P16' and (to_date(LS_BRZYXX.RYRQ00,'yyyy-mm-dd')-to_date(LS_BRZYXX.BRCSRQ,'yyyy-mm-dd'))>28) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断码为P10~P15时,入院时间减出生日期必须≤28天','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(substr(LS_BRZYXX.ZYZD_JBBM5,1,3) between 'P10' and 'P16' and (to_date(LS_BRZYXX.RYRQ00,'yyyy-mm-dd')-to_date(LS_BRZYXX.BRCSRQ,'yyyy-mm-dd'))>28) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断码为P10~P15时,入院时间减出生日期必须≤28天','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(substr(LS_BRZYXX.ZYZD_JBBM6,1,3) between 'P10' and 'P16' and (to_date(LS_BRZYXX.RYRQ00,'yyyy-mm-dd')-to_date(LS_BRZYXX.BRCSRQ,'yyyy-mm-dd'))>28) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断码为P10~P15时,入院时间减出生日期必须≤28天','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(substr(LS_BRZYXX.ZYZD_JBBM7,1,3) between 'P10' and 'P16' and (to_date(LS_BRZYXX.RYRQ00,'yyyy-mm-dd')-to_date(LS_BRZYXX.BRCSRQ,'yyyy-mm-dd'))>28) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断码为P10~P15时,入院时间减出生日期必须≤28天','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(substr(LS_BRZYXX.ZYZD_JBBM,1,3) between 'O80' and 'O84' and qtzdmCount=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断编码出现O80-O84编码,出院其他诊断编码必须有分娩结局编码Z37','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(substr(LS_BRZYXX.ZYZD_JBBM1,1,3) between 'O80' and 'O84' and qtzdmCount=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断编码出现O80-O84编码,出院其他诊断编码必须有分娩结局编码Z37','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(substr(LS_BRZYXX.ZYZD_JBBM2,1,3) between 'O80' and 'O84' and qtzdmCount=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断编码出现O80-O84编码,出院其他诊断编码必须有分娩结局编码Z37','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(substr(LS_BRZYXX.ZYZD_JBBM3,1,3) between 'O80' and 'O84' and qtzdmCount=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断编码出现O80-O84编码,出院其他诊断编码必须有分娩结局编码Z37','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(substr(LS_BRZYXX.ZYZD_JBBM4,1,3) between 'O80' and 'O84' and qtzdmCount=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断编码出现O80-O84编码,出院其他诊断编码必须有分娩结局编码Z37','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(substr(LS_BRZYXX.ZYZD_JBBM5,1,3) between 'O80' and 'O84' and qtzdmCount=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断编码出现O80-O84编码,出院其他诊断编码必须有分娩结局编码Z37','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(substr(LS_BRZYXX.ZYZD_JBBM6,1,3) between 'O80' and 'O84' and qtzdmCount=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断编码出现O80-O84编码,出院其他诊断编码必须有分娩结局编码Z37','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(substr(LS_BRZYXX.ZYZD_JBBM7,1,3) between 'O80' and 'O84' and qtzdmCount=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断编码出现O80-O84编码,出院其他诊断编码必须有分娩结局编码Z37','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if((substr(LS_BRZYXX.ZYZD_JBBM,1,5)='Z37.0' or substr(LS_BRZYXX.ZYZD_JBBM,1,5)='Z37.2' or substr(LS_BRZYXX.ZYZD_JBBM,1,5)='Z37.3' or substr(LS_BRZYXX.ZYZD_JBBM,1,5)='Z37.5' or substr(LS_BRZYXX.ZYZD_JBBM,1,5)='Z37.6') and LS_BRZYXX.YECSTZ is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'产妇的新生儿体重不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZYZD_JBBM1 is not null and (substr(LS_BRZYXX.ZYZD_JBBM1,1,5)='Z37.0' or substr(LS_BRZYXX.ZYZD_JBBM1,1,5)='Z37.2' or substr(LS_BRZYXX.ZYZD_JBBM1,1,5)='Z37.3' or substr(LS_BRZYXX.ZYZD_JBBM1,1,5)='Z37.5' or substr(LS_BRZYXX.ZYZD_JBBM1,1,5)='Z37.6') and LS_BRZYXX.YECSTZ is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'产妇的新生儿体重不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZYZD_JBBM2 is not null and (substr(LS_BRZYXX.ZYZD_JBBM2,1,5)='Z37.0' or substr(LS_BRZYXX.ZYZD_JBBM2,1,5)='Z37.2' or substr(LS_BRZYXX.ZYZD_JBBM2,1,5)='Z37.3' or substr(LS_BRZYXX.ZYZD_JBBM2,1,5)='Z37.5' or substr(LS_BRZYXX.ZYZD_JBBM2,1,5)='Z37.6') and LS_BRZYXX.YECSTZ is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'产妇的新生儿体重不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZYZD_JBBM2 is not null and (substr(LS_BRZYXX.ZYZD_JBBM3,1,5)='Z37.0' or substr(LS_BRZYXX.ZYZD_JBBM3,1,5)='Z37.2' or substr(LS_BRZYXX.ZYZD_JBBM3,1,5)='Z37.3' or substr(LS_BRZYXX.ZYZD_JBBM3,1,5)='Z37.5' or substr(LS_BRZYXX.ZYZD_JBBM3,1,5)='Z37.6') and LS_BRZYXX.YECSTZ is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'产妇的新生儿体重不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZYZD_JBBM2 is not null and (substr(LS_BRZYXX.ZYZD_JBBM4,1,5)='Z37.0' or substr(LS_BRZYXX.ZYZD_JBBM4,1,5)='Z37.2' or substr(LS_BRZYXX.ZYZD_JBBM4,1,5)='Z37.3' or substr(LS_BRZYXX.ZYZD_JBBM4,1,5)='Z37.5' or substr(LS_BRZYXX.ZYZD_JBBM4,1,5)='Z37.6') and LS_BRZYXX.YECSTZ is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'产妇的新生儿体重不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZYZD_JBBM is null or LS_BRZYXX.ZYZD_JBBM='-') then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'主要诊断疾病编码不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.ZYZD is null or LS_BRZYXX.ZYZD='-') then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'主要诊断名称不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into zdmCount1 from BA_BASZYB where LSH000=LS_BRZYXX.LSH000 and SSZDWY is null; if((LS_BRZYXX.ZYZD_JBBM like 'S%' or LS_BRZYXX.ZYZD_JBBM like 'T%') and zdmCount1>0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'损伤中毒原因不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into zdmCount1 from BA_BASZYB where LSH000=LS_BRZYXX.LSH000 and SSZDBM is null; if((LS_BRZYXX.ZYZD_JBBM like 'S%' or LS_BRZYXX.ZYZD_JBBM like 'T%') and zdmCount1>0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'损伤中毒编码不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into zdmCount1 from BA_BASZYB A ,VW_ZS_SSZDYW_DZBL B where LSH000=LS_BRZYXX.LSH000 and A.SSZDBM=B.ICD900; if((LS_BRZYXX.ZYZD_JBBM like 'S%' or LS_BRZYXX.ZYZD_JBBM like 'T%') and zdmCount1=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'损伤中毒编码不在编码范围内','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.MZZD is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'门诊诊断不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.MZZD_JBBM is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'门诊诊断疾病编码不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if((substr(LS_BRZYXX.ZYZD_JBBM,1,3) between 'D00' and 'D48' or LS_BRZYXX.ZYZD_JBBM like 'C%') and LS_BRZYXX.BLZDBM is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'病理诊断编码不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if((substr(LS_BRZYXX.ZYZD_JBBM,1,3) between 'D00' and 'D48' or LS_BRZYXX.ZYZD_JBBM like 'C%') and LS_BRZYXX.BLZD00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'病理诊断名称不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if((substr(LS_BRZYXX.ZYZD_JBBM,1,3) between 'D00' and 'D48' or LS_BRZYXX.ZYZD_JBBM like 'C%') and LS_BRZYXX.blh000 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'病理诊断编码不能空,病理号不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into zdmCount1 from BA_BASZYB A ,XT_ZLXTM0 B where LSH000=LS_BRZYXX.LSH000 and A.BLZDBM=B.ICD100; if(LS_BRZYXX.BLZDBM is not null and trim(LS_BRZYXX.BLZDBM)<>'-' and zdmCount1=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'病理诊断编码不在编码范围内','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select floor(months_between(to_date(LS_BRZYXX.RYRQ00,'yyyy-mm-dd'), to_date(LS_BRZYXX.BRCSRQ,'yyyy-mm-dd'))/12 ) into mzCount from dual; if(mzCount -1 <= LS_BRZYXX.BRNL00 and mzCount+1>= LS_BRZYXX.BRNL00) then mzCount :=1; else insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'年龄应等于入院时间减出生日期(误差范围1岁)','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.RYKB00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'入院科别不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); else select count(1) into qtzdmCount from BA_SJJXDY H where H.BH0000=LS_BRZYXX.RYKB00 and rownum<=1; if(qtzdmCount =0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'入院科别三级绩效科室没对应','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; end if; if(LS_BRZYXX.CYKB00 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'出院科别不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); else select count(1) into qtzdmCount from BA_SJJXDY H where H.BH0000=LS_BRZYXX.CYKB00 and rownum<=1; if(qtzdmCount =0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'出院科别三级绩效科室没对应','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; end if; if(length(LS_BRZYXX.RYTJ00)>1) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'入院途径值域范围参考代码表','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into mzCount from BA_BASSSB SS join xt_cm3000 xt on ss.ssm000=xt.cm3000 where xt.lb0000 in ('手术','介入治疗') and trim(LS_BRZYXX.SZ1) is null and ss.lsh000 =LS_BRZYXX.LSH000 and ss.SSXH00 ='1'; if(mzCount >0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'主要手术操作编码为手术或介入治疗代码时,主要手术操作术者必填','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into mzCount from BA_BASSSB SS join xt_cm3000 xt on ss.ssm000=xt.cm3000 where xt.lb0000 in ('手术','介入治疗') and trim(LS_BRZYXX.SHJB1) is null and ss.lsh000 =LS_BRZYXX.LSH000 and ss.SSXH00 ='1'; if(mzCount >0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'主要手术操作编码为手术或介入治疗代码时,主要手术操作级别必填','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into mzCount from BA_BASSSB SS join xt_cm3000 xt on ss.ssm000=xt.cm3000 where xt.lb0000 in ('手术','介入治疗') and trim(LS_BRZYXX.YZ1) is null and ss.lsh000 =LS_BRZYXX.LSH000 and ss.SSXH00 ='1'; if(mzCount >0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'主要手术操作编码为手术或介入治疗代码时,主要手术操作I助必填','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into mzCount from BA_BASSSB SS join xt_cm3000 xt on ss.ssm000=xt.cm3000 where xt.lb0000 in ('手术','介入治疗') and trim(LS_BRZYXX.EZ1) is null and ss.lsh000 =LS_BRZYXX.LSH000 and ss.SSXH00 ='1'; if(mzCount >0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'主要手术操作编码为手术或介入治疗代码时,主要手术操作Ⅱ助必填','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into mzCount from BA_BASSSB SS join xt_cm3000 xt on ss.ssm000=xt.cm3000 where xt.lb0000 in ('手术','介入治疗') and trim(LS_BRZYXX.MZFS1) is null and ss.lsh000 =LS_BRZYXX.LSH000 and ss.SSXH00 ='1'; if(mzCount >0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'主要手术操作编码为手术或介入治疗代码时,主要手术操作麻醉方式必填','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into mzCount from BA_BASSSB SS join xt_cm3000 xt on ss.ssm000=xt.cm3000 where xt.lb0000 in ('手术','介入治疗') and trim(LS_BRZYXX.MZYS1) is null and ss.lsh000 =LS_BRZYXX.LSH000 and ss.SSXH00 ='1'; if(mzCount >0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'主要手术操作编码为手术或介入治疗代码时,主要手术操作麻醉医师必填','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into mzCount from BA_BASSSB SS join xt_cm3000 xt on ss.ssm000=xt.cm3000 where xt.lb0000 in ('手术') and trim(LS_BRZYXX.QKYHDJ1) is null and ss.lsh000 =LS_BRZYXX.LSH000 and ss.SSXH00 ='1'; if(mzCount >0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'主要手术操作编码为手术时,主要手术操作切口愈合等级必填','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.YBYLFW <0 or LS_BRZYXX.YBZLCZ <0 or LS_BRZYXX.HLF000 <0 or LS_BRZYXX.QTFY00 <0 or LS_BRZYXX.BLZDF0 <0 or LS_BRZYXX.SYSZDF <0 or LS_BRZYXX.YXXZDF <0 or LS_BRZYXX.LCZDXM <0 or LS_BRZYXX.FSSZLF <0 or LS_BRZYXX.SSZLF0 <0 or LS_BRZYXX.KFF000 <0 or LS_BRZYXX.ZYZL00 <0 or LS_BRZYXX.XYF000 <0 or LS_BRZYXX.ZCYF00 <0 or LS_BRZYXX.ZCYF10 <0 or LS_BRZYXX.XF0000 <0 or LS_BRZYXX.BDBLZP <0 or LS_BRZYXX.QDBLZP <0 or LS_BRZYXX.NXYZZP <0 or LS_BRZYXX.XBYZZP <0 or LS_BRZYXX.JCYCLF <0 or LS_BRZYXX.ZLYCLF <0 or LS_BRZYXX.SSYCLF <0 or LS_BRZYXX.Qtf000 <0 ) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'费用不能为负数','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into v_zlxg from (select rownum XH0000,a.* from (select ZLXG00 from bq_baszdb where ZYID00=LS_BRZYXX.LSH000 and ZDLB00='3' order by PLXH00,ID0000) a) where XH0000=1; if(v_zlxg <>'0') then select decode(ZLXG00,'1','1','2','2','3','3','4','4','5','9','6','9','7','9','8','9') into v_zlxg from (select rownum XH0000,a.* from (select ZLXG00 from bq_baszdb where ZYID00=LS_BRZYXX.LSH000 and ZDLB00='3' order by PLXH00,ID0000) a) where XH0000=1; if(v_zlxg ='4') then if(LS_BRZYXX.LYFS00 <>'死亡') then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'当出院主要诊断治疗效果为死亡,离院方式不能为1.医嘱离院 2.医嘱转院 3.医嘱转社区卫生服务机构 4.非医嘱离院 9. 其他','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; end if; end if; mzCount := trunc(MONTHS_BETWEEN(to_date(LS_BRZYXX.RYRQ00,'yyMMdd'),to_date(LS_BRZYXX.BRCSRQ,'yyMMdd'))/12); if(LS_BRZYXX.BRNLMM is null and mzCount=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'当年龄小于1周岁时,病人年龄月不能为空','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.BRNL00=0 and LS_BRZYXX.BRNLDD=0 ) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'当年龄小于1周岁时,病人年龄天不能为0','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if( (LS_BRZYXX.YBYLFW+LS_BRZYXX.YBZLCZ+LS_BRZYXX.HLF000+LS_BRZYXX.QTFY00+LS_BRZYXX.BLZDF0+LS_BRZYXX.SYSZDF+LS_BRZYXX.YXXZDF+LS_BRZYXX.LCZDXM+LS_BRZYXX.FSSZLF+LS_BRZYXX.SSZLF0+ LS_BRZYXX.KFF000+LS_BRZYXX.ZYZL00+LS_BRZYXX.XYF000+LS_BRZYXX.ZCYF00+LS_BRZYXX.ZCYF10+LS_BRZYXX.XF0000+LS_BRZYXX.BDBLZP+LS_BRZYXX.QDBLZP+LS_BRZYXX.NXYZZP+LS_BRZYXX.XBYZZP+ LS_BRZYXX.JCYCLF+LS_BRZYXX.ZLYCLF+LS_BRZYXX.SSYCLF+LS_BRZYXX.Qtf000) <> LS_BRZYXX.ZYZFY0 ) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'住院费用=一般医疗服务费用+一般治疗操作费+护理费+其他费用+病理诊断费+实验室诊断费+影像学诊断费+临床诊断项目费+非手术治疗项目费+手术治疗费+康复费+中医治疗费+西药费+中草药费+中草药费+血费+白蛋白质类制品费+球蛋白类制品费+凝血因子类制品费+细胞因子类制品费+检查用一次性医用材料费+治疗用一次性医用材料费+手术用一次性医用材料费+其他费','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); tempFlag :='t'; end if; if(tempFlag ='t') then delete from BA_SYFYB0 where zyid00= LS_BRZYXX.LSH000; insert into BA_SYFYB0(ZYID00,ZYZFY0,ZFJE00,YBYLFW,ZYBZLZ,ZYBZHZ,YBZLCZ,HLF000,QTFY00,BLZDF0,SYSZDF,YXXZDF,LCZDXM,FSSZLF,LCWLZL,SSZLF0, MZF000,SSF000,KFF000,ZYZD00,ZYZL00,ZYWZ00,ZYGS00,ZCYJF0,ZYTNZL,ZYGCZL,ZYTSZL,ZYQT00,ZYTSTP,BZSSF0,XYF000,KJYWF0,ZCYF00,ZYZJF0,ZCYF10, XF0000,BDBLZP,QDBLZP,NXYZZP,XBYZZP,JCYCLF,ZLYCLF,SSYCLF,QTF000) select ZYID00,ZYZFY0,ZFJE00,YBYLFW,ZYBZLZ,ZYBZHZ,YBZLCZ,HLF000,QTFY00,BLZDF0,SYSZDF,YXXZDF,LCZDXM,FSSZLF,LCWLZL,SSZLF0, MZF000,SSF000,KFF000,ZYZD00,ZYZL00,ZYWZ00,ZYGS00,ZCYJF0,ZYTNZL,ZYGCZL,ZYTSZL,ZYQT00,ZYTSTP,BZSSF0,XYF000,KJYWF0,ZCYF00,ZYZJF0,ZCYF10, XF0000,BDBLZP,QDBLZP,NXYZZP,XBYZZP,JCYCLF,ZLYCLF,SSYCLF,QTF000 from VW_MR_BRZYFY where ZYID00=LS_BRZYXX.LSH000; commit; end if; if(LS_BRZYXX.BLZDBM is not null and LS_BRZYXX.Blh000 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'有病理诊断编码时,病理号不能为空','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if( (LS_BRZYXX.cyrq00||LS_BRZYXX.cysj00 ) <= (LS_BRZYXX.ryrq00||LS_BRZYXX.rysj00 )) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'入院时间应不晚于出院时间','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into zdmCount1 from BQ_BASZDB where ZYID00=LS_BRZYXX.LSH000 and ZDM000 not in (select icd900 from XT_ICD900) and zdlb00 in ('3','4'); if(LS_BRZYXX.ZYZD_JBBM <> '-' and zdmCount1>0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'诊断疾病编码不在疾病编码范围内','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into zdmCount1 from XT_ICD900 where ICD900=LS_BRZYXX.MZZD_JBBM; if(LS_BRZYXX.MZZD_JBBM <> '-' and zdmCount1=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'门急诊疾病编码不在疾病编码范围内','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.zrhs00 is not null ) then select count(1) into v_zlxg from BM_YGBM00 where ygbh00||''=LS_BRZYXX.zrhs00 and YSZJHM is not null; if(v_zlxg =0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'责任护士医师执业证书编码未对应','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; end if; if(LS_BRZYXX.zyys00 is not null ) then select count(1) into v_zlxg from BM_YGBM00 where ygbh00||''=LS_BRZYXX.zyys00 and YSZJHM is not null; if(v_zlxg =0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'住院医师执业证书编码未对应','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; end if; if(LS_BRZYXX.zzys00 is not null ) then select count(1) into v_zlxg from BM_YGBM00 where ygbh00||''=LS_BRZYXX.zzys00 and YSZJHM is not null; if(v_zlxg =0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'主治医师执业证书编码未对应','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; end if; if(LS_BRZYXX.fzr000 is not null ) then select count(1) into v_zlxg from BM_YGBM00 where ygbh00||''=LS_BRZYXX.fzr000 and YSZJHM is not null; if(v_zlxg =0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'主(副主)任医师执业证书编码未对应','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; end if; if(LS_BRZYXX.kzr000 is not null ) then select count(1) into v_zlxg from BM_YGBM00 where ygbh00||''=LS_BRZYXX.kzr000 and YSZJHM is not null; if(v_zlxg =0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'科主任执业证书编码未对应','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; end if; if( LS_BRZYXX.ZYZFY0 <=0 or LS_BRZYXX.ZYZFY0 is null) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'住院费用不能为0','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if( length(LS_BRZYXX.BLZD00)>100) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'病理诊断名称长度不能超过100','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; if(LS_BRZYXX.YECSTZ is not null ) then if ( ISNUMBER(LS_BRZYXX.YECSTZ)=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'婴儿出生体重字段值错误,值域范围参考[100-9999]','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); elsif (ISNUMBER(LS_BRZYXX.YECSTZ)=1 and (to_number(LS_BRZYXX.YECSTZ)>9999 or to_number(LS_BRZYXX.YECSTZ)<100 )) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'婴儿出生体重字段值错误,值域范围参考[100-9999]','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; end if; if(LS_BRZYXX.YERYTZ is not null ) then if ( ISNUMBER(LS_BRZYXX.YERYTZ)=0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'婴儿入院体重字段值错误,值域范围参考[100-9999]','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); elsif (ISNUMBER(LS_BRZYXX.YERYTZ)=1 and (to_number(LS_BRZYXX.YERYTZ)>9999 or to_number(LS_BRZYXX.YERYTZ)<100 )) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'婴儿入院体重字段值错误,值域范围参考[100-9999]','3','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; end if; /* select count(1) into zdmCount1 from bq_baszdb where (zdm000 like 'S%' or zdm000 like 'T%') and zyid00=LS_BRZYXX.LSH000 ; select count(1) into zdmCount2 from ba_baszyb where LSH000 =LS_BRZYXX.LSH000 and SSZDBM is null ; if(zdmCount1 >0 and zdmCount2 >0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'损伤中毒编码不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if; select count(1) into zdmCount2 from ba_baszyb where LSH000 =LS_BRZYXX.LSH000 and SSZDWY is null ; if(zdmCount1 >0 and zdmCount2 >0) then insert into BA_ZKJL00(LSH000,WTSZ00,LX0000,TYPE00,CJR000,CJRQ00,CJSJ00) values(LS_BRZYXX.LSH000,'损伤中毒原因不能为空','1','3',as_cjr000,to_char(sysdate,'yyyyMMdd'),to_char(sysdate,'hh24miss')); end if;*/ end loop; close CUR_BRZYXX; exception when others then raise_application_error(-20001,'流水号'||LS_BRZYXX.LSH000||'执行过程SP_BA_BASSJZKXY出错!'); end;