CREATE OR REPLACE PROCEDURE SP_XT_TSXZ00 ( --0为门诊,传入挂号ID字段,1为住院,传入住院ID字段。 V_FLAG00 IN NUMBER DEFAULT 0, V_GHZYID IN NUMBER, V_RETURN OUT NUMBER, -- 1,3 前台warning 显示 2 前台回滚操作 4 前台ASK操作. V_ERROR0 OUT VARCHAR2, V_SFZDZD IN NUMBER DEFAULT 0, P_CFLSH0 IN varchar2 default '0' --处方流水号 ) as -- Person Date Comments -- yangy 2012.09.22 特定药品和毒码药品限制 -- yangy 2012.09.25 西成药处方一张只能开5个药品;过敏病人不允许开过敏药品 -- yangy 2012.10.20 特定药品和毒码药品限制更改 -- yangy 2012.11.22 整理 -- yangy 2012.11.28 两会512病人审批药品 -- yangy 2012.12.10 药房盘点时,限制处方保存 -- yangy 2013.01.07 退药处方不要提示皮试必须输入 -- yangy 2013.01.29 封装规格药品进行限制输入药品总量 -- yangy 2013.01.31 封装规格药品如果输入的总量是库存单位的整数倍,也可以允许保存 -- yangy 2013.08.05 特殊医保病人,特殊药品提示问题 -- yangy 2013.09.17 门诊病人药品没有审批不允许开出 -- yangy 2013.09.17 门诊病人药品没有审批数量不足,不允许开 -- yangy 2013.10.14 取消200~300的判断和提示,两费中心、省保健、市保健300元以上大型检查请到本院医保办审批备案: -- yangy 2013.12.13 中药不同材质分类的药品不能保存在一张处方中: -- qks 2014.01.13 修改 -- zhaoxz 2015.06.11 儿童用药限制 -- zhaoxz 2015.07.05 特殊病种“血液透析治疗”药品、项目限制 -- zhaoxz 2015.07.15 科室专用药品限制 -- zhaoxz 2016.03.22 判断药房该药品是否已经被暂停YF_YPKCXX.ZTBZ00 For MZYS9-20160323-001 -- zhaoxz 2016.07.25 增加皮试剂药品单开限制,不允许与其他药品同一处方 For MZYS9-20160725-002 -- zhaoxz 2016.10.25 药品停用判断时增加CFZT00限制,仅判断未记账和已记账药品 MZYS9-20161025-002 -- zhaoxz 2016.11.18 特殊病种处方保存时判断特殊病种用药目录限制 MZYS9-20161118-001 -- xuxm 2017.07.28 MZYS9-20170728-002 先选择挂号开单后,再选着特殊病种保存处方时需要提示该处方中哪些(药品和非药品),不存在于特殊病种目录并且处方保存失败。 -- ruanbh 2017.10.18 修改SF_TSBZLimitEntry=N,不限制特殊病种病人药品 MZYS9-20171011-001 -- ruanbh 2017.10.26 限制特定费别审批的药品目录 MZYS9-20171016-001 -- xuxm 2017.12.18 根据卫计委要求停止门诊科室的输液。医生开下西药的时候禁止使用输液用法。MZDZBLS-20171218-002 -- ruanbh 2017.12.25 限制包含关键字药品用法 MZDZBLS-20171218-001 -- ruanbh 2018.02.06 限制已停用用法 MZDZBLS-20180202-002-- linyj -- linyj 2018.03.08 参数YS_MZYPYFXZ 增加其他科室挂急诊号的时候 允许静脉输液 MZDZBLS-20180307-003 -- ruanbh 2018.07.16 一个病人一天之内,不允许存在相同的中药处方信息 MZDZBL9-20180709-001 -- ruanbh 2019.02.19 同时存在草药和全成分弹出提示 MZDZBL9-20190129-003 -- ruanbh 2019.04.24 提示套餐外项目金额 MZYSSJ5-20190424-002 -- ruanbh 2019.04.29 YS_SFQYZDCFTSBZ=Y时不判断特殊病种药品 MZYSSJ5-20190428-002 -- ruanbh 2019.06.25 特殊限制增加“特定费别限制药品目录”和“指定费别审批的药品目录” MZYSSJ5-20190624-003 -- ruanbh 2019.07.11 优化速度 MZYSSJ5-20190708-005 -- ruanbh 2019.11.11 增加处方特殊病种用药限制 MZYSSJ5-20190829-002 -- ruanbh 2020.02.05 增加中药单独支付限制 MZYSSJ5-20190829-002 -- ruanbh 2020.06.12 YS_ZYCFCDTS处方拆单参数开启用时,YS_YTNZYCFBNCF参数失效,处方允许重复 MZYSSJ5-20200509-001 --huangzw 2020.01.11 门诊中药处方如果处方退药后当日允许重复开 for MZYSSJ5-20201229-003 -- ruanbh 2021.06.07 要求在【本院特约名单】中的人,可以录入并保存【特定费别限制药品目录】中的药品 MZYSSJ5-20210426-002 -- chenna 2021.07.02 处方已经退费是否允许重复开,Y是 N否,默认N for MZYSSJ5-20210517-002 -- ruanbh 2022.01.05 抗肿瘤药物等级限制 MZYS115-20211220-001、MZYSSJ5-20220829-003 -- ruanbh 2022.03.18 修复中药重复开提示空白问题 MZYS115-20220316-002、MZYSSJ5-20220829-008 -- chenna 2022.03.29 是否根据BM_BRXXB0.SFBJ00判断允许开特定费别限制药品目录内药品 MZYSSJ5-20220329-001 -- chenna 2022.07.26 门诊是否能开具限制级抗生素药品 MZYSSJ5-20220725-001 C_BRID00 NUMBER(10); C_BJSL00 NUMBER(12,2); C_JYSL00 NUMBER(12,2); C_SL0000 NUMBER(12,2); C_XZMC00 BM_TSXZDM.XZMC00%TYPE;--限制提示 I_BH0000 BM_TSXZ00.BH0000%TYPE;--限制序号 C_BJSL00_YTCF NUMBER(12,2); C_JYSL00_YTCF NUMBER(12,2); LS_LJSYSL YF_MZCFMX.YPZSL0%type;--药品数量 C_SL0000_YTCF NUMBER(12,2); C_XZMC00_YTCF BM_TSXZDM.XZMC00%TYPE;--限制提示 I_BH0000_YTCF BM_TSXZ00.BH0000%TYPE;--限制序号 C_BJSL00_YZCF NUMBER(12,2); C_JYSL00_YZCF NUMBER(12,2); C_SL0000_YZCF NUMBER(12,2); C_XZMC00_YZCF BM_TSXZDM.XZMC00%TYPE;--限制提示 I_BH0000_YZCF BM_TSXZ00.BH0000%TYPE;--限制序号 V_COUNT0 NUMBER(5); --计数器 C_GHLB00 SF_BRXXB0.GHLB00%TYPE; C_GHKS00 SF_BRXXB0.GHKS00%TYPE; C_SFCZ00 SF_BRXXB0.SFCZ00%TYPE; C_SFJE00 NUMBER(8,2); C_MFHXZE NUMBER(8,2); SFQYNBF0 CHAR(1); C_YBZFJE NUMBER(12,2); C_BRGFZH BM_BRXXB0.BRGFZH%TYPE; C_YBBRYTCFZJE number(10,2); --医保病人一天处方总金额 V_CFJE00 BM_YD0000.KCJE00%TYPE; --今天处方总金额 V_CFLSH0 YF_MZCF00.CFLSH0%TYPE; C_GHLBMC BM_GHLBB0.LBMC00%TYPE; --挂号类别名称 v_ypmc00 varchar2(5000); --药品名称 v_ypmc01 varchar2(225); --药品名称 C_KDKS00 VARCHAR2(225); v_SFLJSCCWTS CHAR(1); --是否要和上一个判断的错误一起提示 0 不要 1要 ls_XZBRFB VARCHAR2(50); --指定费别的病人不允许开处方。 v_ypdlbh VARCHAR2(2); PZB0000 BM_YPJJB0.ZB0000%TYPE; --禁忌药品组。 PJJYPMC varchar2(200); --禁忌药品组名称 v_bz0000 char(1); lv_XTCS_VALUE0 XT_XTCS00.VALUE0%TYPE; --系统参数对应的值 lv_TS_clc varchar2(4000); --提示处理串 lv_TDYPID YF_BRTDYP.TDYPID%type; --特定药品ID C_KPBZ00 YF_BRYPGL.kpbz00%TYPE; --卡片标志 C_MAXJL0 YF_BRTDYP.MAXJL0%TYPE; C_MAXTS0 YF_BRTDYP.MAXTS0%TYPE; C_MAXZL0 YF_BRTDYP.MAXZL0%TYPE; C_MAXPC0 YF_BRTDYP.MAXPC0%TYPE; C_ZLDW00 YF_BRTDYP.dw0000%TYPE; C_KFDWZL YF_BRTDYP.MAXZL0%TYPE; C_YPLB00 YF_BRTDYP.YPLB00%TYPE; --药品类别 c_dqzqcs BM_PC0000.zqcs00%TYPE; c_maxcs0 BM_PC0000.zqcs00%TYPE; c_maxpcmc BM_PC0000.PCMC00%TYPE; c_yyypzl YF_MZCFMX.ypzsl0%TYPE; c_DZCFXZYPSL number(3); --单张处方限制药品总量 c_PSGMBRYPXZ char(1); --皮试过敏病人开药品是否进行限制; c_GMYPMC BM_YD0000.YPMC00%TYPE; --皮试过敏药品; C_FYBZ00 BM_BMBM00.FYBZ00%TYPE; --盘点标志 3代表正在盘点 C_FYBMMC BM_BMBM00.BMMC00%TYPE; --发药药房名称 C_FYYPMC BM_YD0000.YPMC00%TYPE; --发药药品名称 C_SFZTPD YF_YPKCXX.SFZTPD%TYPE; --是否暂停盘点 c_YS_YPPDQJKCF XT_XTCS00.VALUE0%TYPE; --药品盘点期间是否允许开处方 c_YPSLMOD NUMBER(8,2); --药品总数量求余 c_YPFZGGS varchar2(50); --药品限制的分装规格 v_FZGGQYPZL char(1); --是否分装规格计算药品总量 v_zlxmjc varchar2(250); --项目名称 v_zlxmjc1 varchar2(250); --项目名称1 V_PSID00 BM_PS0000.PSID00%TYPE; --皮试ID SF_TSBZLimitEntry XT_XTCS00.VALUE0%TYPE; --特殊病种病人是否要限制录入,如果参数为Y时,特殊病种病人录入时只能输入特殊病种目录下的药品和项目 vYBZXLB IC_YBBRLB.YBZXLB%TYPE; -- vFBBH00 IC_YBBRLB.FBBH00%TYPE; vYBBRLB BM_YBBRLB.ybbrlb%TYPE; Vbrid00 YS_CFXXB0.BRID00%type; VYSBH00 BM_YGBM00.YGBH00%type; ls_COU number(10); ls_COU1 number(10); VYPMC00 varchar(500); --药品名称 VTCWJE0 number(12,2); --套餐外金额 LS_TSYPYBZX XT_XTCS00.VALUE0%TYPE; YS_CFTFSFCFK XT_XTCS00.VALUE0%TYPE; --处方已经退费是否允许重复开,Y是 N否,默认N FOR MZYSSJ5-20210517-002 YS_SFGJSFBJKJMLNYP XT_XTCS00.VALUE0%TYPE; YS_KJXZJKSS XT_XTCS00.VALUE0%TYPE; --门诊是否能开具限制级抗生素药品 BEGIN --0表示成功, --1表示违反警告, --2表示违反限制。 --3表示其他错误。 V_RETURN:=0; V_ERROR0:='没有错误'; --return; v_SFLJSCCWTS:='0'; IF V_FLAG00=0 THEN BEGIN SELECT BRID00 INTO C_BRID00 FROM SF_BRXXB0 WHERE GHID00=V_GHZYID; EXCEPTION WHEN OTHERS THEN V_RETURN:=3; V_ERROR0:='查无此人!'; RETURN; END; ELSE BEGIN SELECT BRID00 INTO C_BRID00 FROM ZY_BRXXB0 WHERE ZYID00=V_GHZYID; EXCEPTION WHEN OTHERS THEN V_RETURN:=3; V_ERROR0:='查无此人!'; RETURN; END; END IF; BEGIN SELECT A.FBBH00,B.YBZXLB,A.YBBRLB INTO vFBBH00,vYBZXLB,vYBBRLB FROM BM_BRXXB0 A,IC_YBBRLB B WHERE BRID00=C_BRID00 AND A.FBBH00=B.FBBH00 AND A.YBLB00=B.YBLB00; EXCEPTION WHEN OTHERS THEN V_RETURN:=3; V_ERROR0:='查无此人!'; RETURN; END; --------------------------------血液透析治疗 特殊病种 begin------------------- if V_FLAG00=0 then select Count(*) into V_COUNT0 from sf_brxxb0 where ghid00=V_GHZYID and tsbzbh in(select bh0000 From bm_tsbzb0 where mc0000 ='血液透析治疗' ); if(V_COUNT0>0) then select Count(*) into V_COUNT0 from YF_MZCF00 a,YF_MZCFMX b where a.GHH000=to_char(V_GHZYID) and a.CFLSH0=b.CFLSH0 and a.CFLSH0=P_CFLSH0; if(V_COUNT0>0) then V_RETURN:=2; V_ERROR0:='该挂号为特殊病种号(血液透析治疗),必须开具指定项目!*'; return; end if; end if; end if; --------------------------------血液透析治疗 特殊病种 end--------------------- --------------------------------特殊病种用药 目录限制 begin------------------- select nvl(max(trim(value0)),'N') into SF_TSBZLimitEntry from XT_XTCS00 where NAME00='SF_TSBZLimitEntry'; select count(1) into V_COUNT0 from XT_XTCS00 where NAME00='YS_SFQYZDCFTSBZ' and value0='Y'; if SF_TSBZLimitEntry='Y' then if V_COUNT0=0 then if V_FLAG00=0 then V_YPMC00:=' ';--判断药品是否BM_XMBZ00已经维护的可以开 for C_YPMC_TSBZYP in (select distinct b.YPMC00 from YF_MZCF00 a,YF_MZCFMX b,SF_BRXXB0 c where nvl(c.TSBZBH,' ')<>' ' and a.CFLSH0=b.CFLSH0 and a.GHID00=c.GHID00 and a.GHID00=V_GHZYID and a.CFZT00 in('0') and (a.CFLSH0=P_CFLSH0 or nvl(P_CFLSH0,'0')='0') and exists(select 1 from BM_TSBZB0 where BH0000=c.TSBZBH and YBZXLB=c.YBZXLB and MLXZBZ in ('1','3')) and not exists (select 1 from BM_XMBZ00 where type00='0' and YBZXLB=c.YBZXLB and BH0000=c.TSBZBH and XMBH00=b.YPNM00) ) loop if V_YPMC00=' ' then V_YPMC00:=C_YPMC_TSBZYP.YPMC00; else V_YPMC00:=V_YPMC00||','||C_YPMC_TSBZYP.YPMC00; end if; end loop; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:='如下药品('||V_YPMC00||')不属于选择特殊病种目录药品,无法保存!*'; return; end if; end if; if V_FLAG00=0 then V_YPMC00:=' ';--判断药品除BM_XMBZ00以外的可以开 for C_YPMC_TSBZYP in (select distinct b.YPMC00 from YF_MZCF00 a,YF_MZCFMX b,SF_BRXXB0 c where nvl(c.TSBZBH,' ')<>' ' and a.CFLSH0=b.CFLSH0 and a.GHID00=c.GHID00 and a.GHID00=V_GHZYID and a.CFZT00 in('0') and (a.CFLSH0=P_CFLSH0 or nvl(P_CFLSH0,'0')='0') and exists(select 1 from BM_TSBZB0 where BH0000=c.TSBZBH and YBZXLB=c.YBZXLB and MLXZBZ in ('4','6')) and exists (select 1 from BM_XMBZ00 where type00='0' and YBZXLB=c.YBZXLB and BH0000=c.TSBZBH and XMBH00=b.YPNM00) ) loop if V_YPMC00=' ' then V_YPMC00:=C_YPMC_TSBZYP.YPMC00; else V_YPMC00:=V_YPMC00||','||C_YPMC_TSBZYP.YPMC00; end if; end loop; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:='如下药品('||V_YPMC00||')不属于选择特殊病种目录药品,无法保存!*'; return; end if; end if; else ---- ruanbh 2019.11.11 增加处方特殊病种用药限制 MZYSSJ5-20190829-002 if V_FLAG00=0 then for C_YPMC_TSBZYP in ( select b.YPMC00 from YF_MZCF00 a,YF_MZCFMX b,SF_BRXXB0 c where nvl(a.TSBZBH,' ')<>' ' and a.CFLSH0=b.CFLSH0 and a.GHID00=c.GHID00 and a.GHID00=V_GHZYID and a.CFZT00 in('0') and (a.CFLSH0=P_CFLSH0 or nvl(P_CFLSH0,'0')='0') and exists(select 1 from BM_TSBZB0 where BH0000=a.TSBZBH and YBZXLB=c.YBZXLB and MLXZBZ in ('1','3')) and not exists (select 1 from BM_XMBZ00 where type00='0' and YBZXLB=c.YBZXLB and BH0000=a.TSBZBH and XMBH00=b.YPNM00) ) loop if V_YPMC00=' ' then V_YPMC00:=C_YPMC_TSBZYP.YPMC00; else V_YPMC00:=V_YPMC00||','||C_YPMC_TSBZYP.YPMC00; end if; if V_YPMC00<>' ' then if V_ERROR0='没有错误' then V_ERROR0:='如下药品不属于选择特殊病种目录药品:'||chr(13)||V_YPMC00; else V_ERROR0:=V_ERROR0||chr(13)||'如下药品不属于选择特殊病种目录药品:'||chr(13)||V_YPMC00; end if; end if; if V_RETURN=0 and V_YPMC00<>' ' then V_RETURN:=2; end if; end loop; end if; end if; end if; --------------------------------特殊病种用药 目录限制 end--------------------- --------------------------------儿童用药限制 begin---------------------------- if V_FLAG00=0 then select (sysdate- to_date(decode(a.brcsrq,null,to_char(sysdate,'YYYYMMDD'),a.brcsrq),'YYYYMMDD'))/365 into V_COUNT0 From bm_brxxb0 a where brid00=C_BRID00; if(V_COUNT0>18) then V_YPMC00:=' '; for c_etyp in (select distinct b.YPMC00 from YF_MZCF00 a,YF_MZCFMX b ,BM_TYZD00 c where a.GHH000=to_char(V_GHZYID) and a.CFLSH0=b.CFLSH0 and a.CFLSH0=P_CFLSH0 and b.YPNM00=c.DJ0000 and c.ZDMC00='儿童用药药品目录' and c.YXBZ00='1') loop if V_YPMC00=' ' then V_YPMC00:=c_etyp.YPMC00; else V_YPMC00:=V_YPMC00||'、'||c_etyp.YPMC00; end if; end loop; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:='药品('||V_YPMC00||')是儿童用药,成人无法开具!*'; return; end if; end if; end if; --------------------------------儿童用药限制 end------------------------------ --------------------------------科室专用药品限制 begin------------------------ if V_FLAG00=0 then V_YPMC00:=' '; for c_ksyp in (select b.ypnm00,b.ypmc00,a.ghks00 from YF_MZCF00 a,YF_MZCFMX b,BM_TYZD00 c where a.GHH000=to_char(V_GHZYID) and a.CFLSH0=b.CFLSH0 and a.CFLSH0=P_CFLSH0 and b.Ypnm00=c.dj0000 and c.ZDMC00='科室专用药品维护' and c.YXBZ00='1')loop select count(*) into V_COUNT0 from BM_TYZD00 where zdmc00='科室专用药品维护' and yxbz00='1' and dj0000=c_ksyp.ypnm00 and bh0000=to_char(c_ksyp.ghks00); if(V_COUNT0=0) then V_RETURN:=2; V_ERROR0:='药品('||c_ksyp.ypmc00||')是科室专用药品,请联系药房!*'; return; end if; end loop; end if; --------------------------------科室专用药品限制 end-------------------------- --------------------------------门诊药品用法限制 begin------------------------ select count(*) into V_COUNT0 from XT_XTCS00 where NAME00='YS_MZYPYFXZ' and VALUE0<>'0'; if V_COUNT0>0 then select count(*) into V_COUNT0 from YF_MZCF00 a,YF_MZCFMX b where a.GHH000=to_char(V_GHZYID) and a.CFLSH0=b.CFLSH0 and a.CFLSH0=P_CFLSH0 and not exists(select 1 from XT_XTCS00 where name00 = 'YS_MZYPYFXZ' and Value0 like '%,'||a.Ghks00||',%') and exists(select 1 from BM_TYZD00 where ZDMC00='门诊药品给药途径用法限制' and YXBZ00='1' and MC0000=trim(YPYFMC)) and (select lbmc00 from bm_ghlbb0 where lbbh00 in (select ghlb00 from sf_brxxb0 where ghh000 = to_char(V_GHZYID)) and rownum = 1) not like '%急诊%'; if(V_COUNT0>0) then V_RETURN:=2; V_ERROR0:='根据省卫计生委要求:决定2017年12月15日起,取消我院门诊输液(除急诊,儿科,发热门诊,感染性疾病科,血透中心)。'; return; end if; end if; --------------------------------门诊药品用法限制 end-------------------------- --------------------------------皮试剂药品单开限制 begin---------------------- if V_FLAG00=0 then V_YPMC00:=' '; select max(b.psid00),max(a.ypmc00) into V_PSID00,V_YPMC00 from YF_MZCFMX a,BM_PS0000 b where a.YPNM00=b.DYPSYP and CFLSH0=P_CFLSH0; if nvl(V_PSID00,' ')<>' ' then select count(*) into V_COUNT0 from YF_MZCFMX a,BM_YD0000 b where a.ypnm00=b.ypnm00 and b.pslx00=v_psid00 and CFLSH0=P_CFLSH0; if V_COUNT0<>0 then V_RETURN:=2; V_ERROR0:='皮试剂药品('||V_YPMC00||')不允许与需要该皮试类型的药品同一处方,请删除!*'; return; end if; end if; end if; --------------------------------皮试剂药品单开限制 end------------------------ --------------------------------YF_YPKCXX.TYBZ00 begin------------------------ V_YPMC00:=' '; for c_tyyp in (select b.ypmc00 from yf_mzcf00 a,yf_mzcfmx b where a.cflsh0=b.cflsh0 and a.ghh000=to_char(V_GHZYID) and A.SFKSLY='N' and exists(select 1 from yf_ypkcxx where ypnm00=b.ypnm00 and yfbmbh=a.yfbmbh and ztbz00='1') and a.CFZT00 in('0','1')) loop if V_YPMC00=' ' then V_YPMC00:=c_tyyp.YPMC00; else V_YPMC00:=V_YPMC00||'、'||c_tyyp.YPMC00; end if; end loop; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:='药品('||V_YPMC00||')已暂停使用,请联系药房!*'; return; end if; --------------------------------YF_YPKCXX.TYBZ00 end-------------------------- if V_FLAG00=0 then if nvl(P_CFLSH0,'0') = '0' then select to_number(nvl(max(trim(value0)),'0')) into C_YBBRYTCFZJE from xt_xtcs00 where name00='YS_YBBRYTCFZJE'; if C_YBBRYTCFZJE>0 then select nvl(round(sum(C.YPZSL0*LSDJ00),2),0) CFJE00 into V_CFJE00 from SF_BRXXB0 A,YF_MZCF00 B,YF_MZCFMX C where A.BRID00=C_BRID00 and A.GHID00=B.GHID00 and B.CFZT00 IN ('0','1','2') and A.FBBH00=3 and B.CFLSH0=C.CFLSH0 and B.SRRQ00=TO_CHAR(SYSDATE,'YYYYMMDD'); if V_CFJE00>C_YBBRYTCFZJE then V_RETURN:=2; V_ERROR0:='医保病人一天处方总金额不能超过'||trim(to_char(C_YBBRYTCFZJE))||'元,超过'||trim(to_char(V_CFJE00-C_YBBRYTCFZJE))||'元,不能进行保存!'; RETURN; end if; end if; -----------------------------皮试药品控制------------------------ select Count(*) into V_COUNT0 from XT_XTCS00 where trim(NAME00)='YS_PSYPWTXPSSFXZBC' and trim(VALUE0)='Y'; if V_COUNT0>0 then v_ypmc00:=' '; for c_psyp in (select a.* from YF_MZCFMX a,YF_MZCF00 b,BM_YD0000 c where b.GHH000=to_char(V_GHZYID) and a.CFLSH0=b.CFLSH0 and ((a.YPYFMC not like '%脱敏%' and a.YPYFMC not like '%免试%') or (a.YPYFMC is null)) -- in ('脱敏','免试','续注') and ((instr(a.BZ0000,'带出处方')=0) or (a.BZ0000 is null)) and a.YPNM00=c.YPNM00 and c.SFPSYY='Y' and a.PSLBID is null and b.cfzt00 not in ('5','6') and not exists(select 1 from yf_mzcf00 where ghh000=b.ghh000 and bccfh0=b.cflsh0)) loop if V_YPMC00=' ' then V_YPMC00:=C_PSYP.YPMC00; else V_YPMC00:=V_YPMC00||'、'||C_PSYP.YPMC00; end if; end loop; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:='药品('||V_YPMC00||')为皮试药,请输入皮试后,再保存!*'; return; end if; end if; --福州市保健,福建省保健办二级保健,福建省两会中心特殊病人进行开药品和项目提醒 select count(1) into V_COUNT0 from bm_brxxb0 a,ic_ybbrlb b,bm_ybbrlb c where a.fbbh00=b.fbbh00 and a.yblb00=b.yblb00 and a.fbbh00=c.fbbh00 and b.ybzxlb=c.ybzxlb and a.ybbrlb=c.ybbrlb and a.brid00=C_BRID00 and (b.ybzxlb in ('7','I') or (b.ybzxlb ='H' and c.ybbrlb='0')) ; if (V_COUNT0>0) then --v_ypmc00:=' '; --for c_wspyp in (select distinct b.YPMC00 from YF_MZCF00 a,YF_MZCFMX b -- where a.CFLSH0=b.CFLSH0 and a.GHH000=to_char(V_GHZYID) -- and a.CFZT00='0' and b.CXBZ00='Z' and b.SFZBY0='N' -- and b.YPNM00 IN (select DJ0000 from bm_tyzd00 where zdmc00 ='指定费别审批的药品目录')) loop -- if V_YPMC00=' ' then -- V_YPMC00:='"'||c_wspyp.YPMC00||'"'; -- else -- V_YPMC00:=V_YPMC00||';'||'"'||c_wspyp.YPMC00||'"'; -- end if; --end loop; -- --if V_YPMC00<>' ' then -- V_RETURN:=3; -- V_ERROR0:='药品'||V_YPMC00||'省两费、512干部、省二级保健、市保健需审批才能使用,否则按自费处理!*'; -- return; --end if; v_zlxmjc := ' '; v_zlxmjc1 := ' '; for c_cjejczl in (select distinct a.ZLXMJC,a.zje000 from YJ_YW0000 a,BM_ZLZD00 b where a.zlxmid=b.zlxmid and a.ZYHGHH=to_char(V_GHZYID) AND a.MZZYBZ='0' and b.LBBH00 in (3,5) and a.XMZT00 in ('0','1') and a.zje000>=200 ) loop if c_cjejczl.zje000<=300 then if v_zlxmjc=' ' then v_zlxmjc:='"'||c_cjejczl.ZLXMJC||'"'; else v_zlxmjc:=v_zlxmjc||';'||'"'||c_cjejczl.ZLXMJC||'"'; end if; else if v_zlxmjc1=' ' then v_zlxmjc1:='"'||c_cjejczl.ZLXMJC||'"'; else v_zlxmjc1:=v_zlxmjc1||';'||'"'||c_cjejczl.ZLXMJC||'"'; end if; end if; end loop; --if v_zlxmjc<>' ' then -- V_RETURN:=3; -- V_ERROR0:=v_zlxmjc||'单个项目费用金额在200-300元,需本院审核、备案;!*'; -- return; --end if; if v_zlxmjc1<>' ' then V_RETURN:=3; V_ERROR0:='"'||v_zlxmjc1||'" 两费中心、省保健、市保健300元以上大型检查请到本院医保办审批备案。!'; return; end if; end if; select count(*) into V_COUNT0 from XT_XTCS00 where name00='YS_MZZYCFPWJJTS' and TRIM(VALUE0)='Y'; if V_COUNT0>0 then v_ypmc00:=' '; for c_psyp in (select cflsh0 from YF_MZCF00 b where b.GHH000=to_char(V_GHZYID) and b.YPDLBH='2' ) loop select count(distinct c.ypczfl) into V_COUNT0 from yf_mzcfmx b,bm_yd0000 c where b.ypnm00=c.ypnm00 and b.cflsh0 = c_psyp.CFLSH0; if V_COUNT0 > 1 then V_RETURN:=2; V_ERROR0:='不同类别的药品不能保存在一张处方中!*'; return; end if; v_ypmc00:=' '; for c_pysyp_dzcf in (select a.YPNM00 from YF_MZCFMX a,YF_MZCF00 b where a.cflsh0=b.cflsh0 and a.CFLSH0=c_psyp.CFLSH0 and a.CXBZ00='Z' and trim(b.cfsm00) is null) loop if V_YPMC00=' ' then V_YPMC00:=c_pysyp_dzcf.YPNM00; else V_YPMC00:=V_YPMC00||','||to_char(c_pysyp_dzcf.YPNM00); end if; end loop; if V_YPMC00<>' ' then PZB0000:=0; PJJYPMC:=''; Sp_Bm_Ypjjpd(V_YPMC00,'0',0,PZB0000,PJJYPMC); if PZB0000>0 then V_RETURN:=2; if v_SFLJSCCWTS='0' then V_ERROR0:='处方中"'||PJJYPMC||'"出现‘十八反、十九畏’,如必须使用,请在“处方说明”中输入使用原因!*'; else V_ERROR0:=substr(V_ERROR0||'处方中"'||PJJYPMC||'"出现‘十八反、十九畏’,如必须使用,请在“处方说明”中输入使用原因!*',1,220); end if; v_SFLJSCCWTS:='1'; goto afterbcxh; end if; end if; end loop; end if; else --以下针对某一张处方: ------------------------------------------------------------------------------------------------------------------------- --门诊药品总量超过一定数量要进行限制; select to_number(substr(nvl(max(trim(value0)),'0'),1,1)) into c_DZCFXZYPSL from XT_XTCS00 where name00='YS_YZCFXZSL'; if c_DZCFXZYPSL>0 then select count(1) into V_COUNT0 from yf_mzcf00 a, yf_mzcfmx b where a.cflsh0=b.cflsh0 and a.cflsh0 = P_CFLSH0 and a.ypdlbh in ('0','1'); if V_COUNT0 > c_DZCFXZYPSL then V_RETURN:=2; V_ERROR0:='一张处方最多只能开'||to_char(c_DZCFXZYPSL)||'种药品!*'; return; end if; end if; --门诊是否能开具限制级抗生素药品,Y:是 N:否 默认为N MZYSSJ5-20220725-001 select nvl(max(trim(value0)),'N') into YS_KJXZJKSS from XT_XTCS00 where name00='YS_MZSFNKJXZJKSS'; select count(1),nvl(max(trim(b.ypmc00)),' ') into V_COUNT0,V_YPMC00 from yf_mzcfmx b,bm_yd0000 c where b.ypnm00=c.ypnm00 and b.cflsh0 = P_CFLSH0 and c.kssjb0>=3; if YS_KJXZJKSS='N' and V_COUNT0 > 0 then V_RETURN:=2; V_ERROR0:='门诊不能开具限制级抗生素药品”'||V_YPMC00||'“!*'; return; end if; --药品盘点期间是否允许开处方,N:不允许 Y 允许 select nvl(max(trim(value0)),'N') into c_YS_YPPDQJKCF from XT_XTCS00 where name00='YS_YPPDQJKCF'; if (c_YS_YPPDQJKCF = 'N') then select count(1),nvl(max(trim(c.fybz00)),'0'),nvl(max(trim(c.bmmc00)),'0'),nvl(max(trim(b.ypmc00)),'0'), nvl(max(trim(d.sfztpd)),'0') into V_COUNT0,C_FYBZ00,C_FYBMMC,C_FYYPMC,C_SFZTPD from yf_mzcf00 a, yf_mzcfmx b,bm_bmbm00 c, yf_ypkcxx d where a.cflsh0=b.cflsh0 and a.yfbmbh=c.bmbh00 and a.yfbmbh=d.yfbmbh and b.ypnm00=d.ypnm00 and a.cflsh0 = P_CFLSH0 and (c.fybz00='3' or d.sfztpd='1'); if V_COUNT0 > 0 then if C_FYBZ00 = '3' then V_RETURN:=2; V_ERROR0 := C_FYBMMC||'正在盘点,不能保存发往'||C_FYBMMC||'的处方!'; return; elsif C_SFZTPD = '1' then V_RETURN:=2; V_ERROR0 := '药品"'||C_FYYPMC||'"正在盘点,不能保存!'; return; end if; end if; end if; --福建省保健办二级保健,福建省两会中心特殊病人进行开药品和项目提醒 select count(1) into V_COUNT0 from bm_brxxb0 a,ic_ybbrlb b,bm_ybbrlb c where a.fbbh00=b.fbbh00 and a.yblb00=b.yblb00 and a.fbbh00=c.fbbh00 and b.ybzxlb=c.ybzxlb and a.ybbrlb=c.ybbrlb and a.brid00=C_BRID00 and (b.ybzxlb in ('I') or (b.ybzxlb ='H' and c.ybbrlb='0')) ; if (V_COUNT0>0) then -----------------------------通用处理3:控制一张处方报警金额,禁用金额end------------------------ --专人专用药品目录限制---begin-------------------------------- select count(*) into V_COUNT0 from BM_TYZD00 where ZDMC00='指定费别审批的药品目录' and YXBZ00='1' ; if V_COUNT0>0 then v_ypmc00:=' '; for c_wspyp in (select distinct b.YPMC00 from YF_MZCF00 a,YF_MZCFMX b ,BM_TYZD00 c,BM_BMBM00 d where a.GHH000=to_char(V_GHZYID) and a.CFLSH0=b.CFLSH0 and a.GHKS00=d.BMBH00 and a.CFLSH0=P_CFLSH0 and a.CFZT00='0' and b.CXBZ00='Z' and b.SFZBY0='N' and b.YPNM00=c.DJ0000 and c.ZDMC00='指定费别审批的药品目录' and c.YXBZ00='1' --and d.BMMC00 not like '%急%' and not exists (select 1 from YK_YBMLSP x where x.BRID00=C_BRID00 and x.YPNM00=b.YPNM00 and x.SPLB00='0' and x.MZZYBZ='0' and x.ZFRQ00='20991231' and x.KSSYRQ<=to_char(sysdate,'YYYYMMDD') and x.JSSYRQ>=to_char(sysdate,'YYYYMMDD') and x.KSSYRQ||x.KSSYSJ<=to_char(sysdate,'YYYYMMDDHH24:MI:SS') and x.JSSYRQ||x.JSSYSJ>=to_char(sysdate,'YYYYMMDDHH24:MI:SS') and x.SPJG00='1' and nvl(x.SPSL00,0)*nvl(x.ZHL000,0) >= b.YPZSL0*b.ZHL000 ) ) loop if V_YPMC00=' ' then V_YPMC00:=c_wspyp.YPMC00; else V_YPMC00:=V_YPMC00||'、'||c_wspyp.YPMC00; end if; end loop; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:='药品('||V_YPMC00||')尚未审批或审批数量不足,处方不能保存,请先让病人到医保办审批!*'; return; end if; end if; --专人专用药品目录限制---end-------------------------------- end if; -- -----------------------------通用处理3:控制一张处方报警金额,禁用金额end------------------------ --专人专用药品目录限制---begin-------------------------------- --elect count(*) into V_COUNT0 from BM_TYZD00 where ZDMC00='离退休干部审批的药品目录' and YXBZ00='1' ; --f V_COUNT0>0 then -- -- --nd if; --病人皮试过敏药品限制 N:不限制 Y:限制 select nvl(max(trim(value0)),'N') into c_PSGMBRYPXZ from XT_XTCS00 where name00='YS_PSGMBRYPXZ'; if c_PSGMBRYPXZ = 'Y' then select count(1),nvl(max(trim(c.ypmc00)),' ') into V_COUNT0, c_GMYPMC from yj_brgmjl a, yf_mzcf00 b, yf_mzcfmx c where b.cflsh0=c.cflsh0 and a.brid00=b.brid00 and a.ypnm00=c.ypnm00 and b.cflsh0=P_CFLSH0 and a.BRID00 = C_BRID00 and a.JGMS00 like '%+%'; if V_COUNT0 > 0 then V_RETURN:=2; V_ERROR0:='该病人对药品'||c_GMYPMC||'皮试过敏!*'; return; end if; end if; --门诊麻醉药品特定药品审核控制;毒码和精一类药品 select count(*) into V_COUNT0 from XT_XTCS00 where name00='YS_MZMZYPTDYPSHKZ' and TRIM(VALUE0)='Y'; if V_COUNT0>0 then v_ypmc00:=' '; for c_mztdyp in (select a.YPNM00,a.YPMC00,nvl(a.csl000,0) csl000,nvl(a.yysj00,0) yysj00,nvl(a.pcid00,0) pcid00, nvl(a.ypzsl0,0)*nvl(a.zhl000,0) ypzsl0, b.JLDW00, a.cflsh0 ,b.SFTDYP, b.MZDJ00, b.SJDJ00, b.DPDJ00 from YS_CFMX00 a, BM_YD0000 b where a.YPNM00=b.YPNM00 and a.CFLSH0=P_CFLSH0 and (b.SFTDYP in ('1','2','3','4') or mzdj00>0 or sjdj00>0 or dpdj00>0) and lbbh00<>'2') loop --select count(1) into V_COUNT0 from yf_mzcfmx where cflsh0 = P_CFLSH0 and ypnm00 = c_mztdyp.ypnm00 and TDYPID is not null; --if V_COUNT0 =0 then --已经使用过特定药品的处方不再判断 if (c_mztdyp.sjdj00 >1) and (c_mztdyp.mzdj00 = 0) and (c_mztdyp.dpdj00 = 0) and (c_mztdyp.sftdyp = '0') then --精二药品 --精二药品用药时间不能超过7天 C_MAXTS0 := 7; if (c_mztdyp.yysj00 > C_MAXTS0) then V_RETURN:=2; V_ERROR0:='精神二类药品"'||c_mztdyp.YPMC00||'"用药时间不能超过'||to_char(C_MAXTS0)||'天!*'; return; end if; else select nvl(max(trim(KPBZ00)),'w'),nvl(max(TDYPID),0),nvl(max(MAXJL0),0),nvl(max(MAXTS0),0), nvl(max(MAXZL0),0)*nvl(max(ZHL000),0),nvl(max(MAXPC0),0),nvl(max(trim(DW0000)),' '),nvl(max(MAXZL0),0),nvl(max(trim(b.YPLB00)),'0') into C_KPBZ00,lv_TDYPID,C_MAXJL0,C_MAXTS0,C_MAXZL0,C_MAXPC0,C_ZLDW00,C_KFDWZL,C_YPLB00 from YF_BRYPGL a,YF_BRTDYP b where a.BRYPID=b.BRYPID and a.BRID00 = C_BRID00 and a.KPZT00='1' and a.MZZYBZ='0' and nvl(b.ZHZXRQ,a.JSRQ00)>=to_char(sysdate,'yyyyMMdd') and ((b.YPLB00 = '0' and b.YPNM00 = c_mztdyp.YPNM00) or (b.YPLB00 in ('2','3','4') and b.YPLB00 = c_mztdyp.SFTDYP)); if C_KPBZ00='w' then --c_mztdyp.SFTDYP 1:特定药品, 2针剂, 3普通片剂,4缓释片 if c_mztdyp.SFTDYP = '2' then --“针剂”每次只能开1天1次用量(q.d); “普通片剂”一次只能最多开3天领药量; “缓释片”只能开7天; C_MAXTS0 := 1; C_MAXPC0 := 1; elsif c_mztdyp.SFTDYP = '3' then C_MAXTS0 := 3; C_MAXPC0 := 0; elsif c_mztdyp.SFTDYP = '4' then C_MAXTS0 := 7; C_MAXPC0 := 0; else V_RETURN:=2; V_ERROR0:='该处方中出现特殊药品"'||c_mztdyp.YPMC00||'",如必须使用,请先到药房申请!*'; return; end if; --用药时间最大值判断 if (c_mztdyp.yysj00 >0) and (C_MAXTS0 >0) and (c_mztdyp.yysj00>C_MAXTS0) then V_RETURN:=2; V_ERROR0:='无麻醉卡的病人开药品"'||c_mztdyp.YPMC00||'",用药时间超过'||to_char(C_MAXTS0)||'天!*'; return; end if; --频次判断 if (c_mztdyp.pcid00 >0) and (C_MAXPC0 >0) then select (c.ZQCS00*24)/c.HSZQCD into c_dqzqcs from bm_pc0000 c where pcid00= c_mztdyp.pcid00; -- select (c.ZQCS00*24)/c.HSZQCD, pcmc00 into c_maxcs0,c_maxpcmc from bm_pc0000 c where pcid00= C_MAXPC0; if c_dqzqcs>1 then V_RETURN:=2; V_ERROR0:='无麻醉卡的病人开药品"'||c_mztdyp.YPMC00||'",频次不能超过每天一次!*'; return; end if; end if; elsif C_KPBZ00='0' then --有申请无麻醉卡(这种情况没有,不考虑) select count(1) into V_COUNT0 from YF_MZCFMX a, YF_MZCF00 b where a.CFLSH0 = b.CFLSH0 and b.BRID00 = C_BRID00 and a.TDYPID = lv_TDYPID and a.YPNM00=c_mztdyp.YPNM00 and b.CFZT00 in ('0','1','2') and b.cflsh0<>c_mztdyp.cflsh0; --历史处方 if V_COUNT0>0 then V_RETURN:=2; V_ERROR0:='无麻醉卡瘀?病人已经开过一次药品"'||c_mztdyp.YPMC00||'",不能再次使用,如需再次使用,请到药房申请!*'; return; else --总数量最大值判断 if (c_mztdyp.ypzsl0 >0) and (C_MAXZL0 >0) and (c_mztdyp.ypzsl0>C_MAXZL0) then V_RETURN:=2; V_ERROR0:='无麻醉卡的病人开药品"'||c_mztdyp.YPMC00||'",总量超过申请的最大限量'||C_KFDWZL||C_ZLDW00 ||'!*'; return; end if; --用药时间最大值判断 if (c_mztdyp.yysj00 >0) and (C_MAXTS0 >0) and (c_mztdyp.yysj00>C_MAXTS0) then V_RETURN:=2; V_ERROR0:='无麻醉卡的病人开药品"'||c_mztdyp.YPMC00||'",用药时间超过申请的最大时间'||C_MAXTS0||'天!*'; return; end if; --每次用量判断 if (c_mztdyp.csl000 >0) and (C_MAXJL0 >0) and (c_mztdyp.csl000>C_MAXJL0) then V_RETURN:=2; V_ERROR0:='无麻醉卡的病人开药品"'||c_mztdyp.YPMC00||'",每次用量超过申请的最大剂量'||C_MAXJL0||c_mztdyp.JLDW00||'!*'; return; end if; --频次判断 if (c_mztdyp.pcid00 >0) and (C_MAXPC0 >0) and (c_mztdyp.pcid00<>C_MAXPC0) then select (c.ZQCS00/c.HSZQCD)*24 into c_dqzqcs from bm_pc0000 c where pcid00= c_mztdyp.pcid00; select (c.ZQCS00/c.HSZQCD)*24, pcmc00 into c_maxcs0,c_maxpcmc from bm_pc0000 c where pcid00= C_MAXPC0; if c_dqzqcs>c_maxcs0 then V_RETURN:=2; V_ERROR0:='无麻醉卡的病人开药品"'||c_mztdyp.YPMC00||'",频次超过最大频次'||c_maxpcmc||'!*'; return; end if; end if; update YF_MZCFMX set TDYPID = lv_TDYPID WHERE cflsh0 = P_CFLSH0 and ypnm00 = c_mztdyp.YPNM00; -- (select nvl(max(c.ZQCS00),0)/nvl(max(c.HSZQCD),24)*24 from bm_pc0000 c where pcid00(+)=b.MAXPC0) maxzqcs end if; else --计算已经使用药品总量; select NVL(SUM(nvl(a.ypzsl0,0)*nvl(a.zhl000,0)),0) into c_yyypzl from YF_MZCFMX a, YF_MZCF00 b where a.CFLSH0 = b.CFLSH0 and b.BRID00 = C_BRID00 and a.TDYPID = lv_TDYPID and a.YPNM00=c_mztdyp.YPNM00 and b.CFZT00 in ('0','1','2') and b.cflsh0<>c_mztdyp.cflsh0; --历史处方 --合计总数量最大值判断 if (c_mztdyp.ypzsl0 >0) and (C_MAXZL0 >0) and (c_mztdyp.ypzsl0 + c_yyypzl > C_MAXZL0) then V_RETURN:=2; V_ERROR0:='有麻醉卡的病人开药品"'||c_mztdyp.YPMC00||'",合计总量超过申请的最大限量'||C_KFDWZL||C_ZLDW00 ||'!*'; return; end if; --用药时间最大值判断 if (c_mztdyp.yysj00 >0) and (C_MAXTS0 >0) and (c_mztdyp.yysj00>C_MAXTS0) then V_RETURN:=2; V_ERROR0:='有麻醉卡的病人开药品"'||c_mztdyp.YPMC00||'",用药时间超过申请的最大时间'||C_MAXTS0||'天!*'; return; end if; --每次用量判断 if (c_mztdyp.csl000 >0) and (C_MAXJL0 >0) and (c_mztdyp.csl000>C_MAXJL0) then V_RETURN:=2; V_ERROR0:='有麻醉卡的病人开药品"'||c_mztdyp.YPMC00||'",每次用量超过申请的最大剂量'||C_MAXJL0||c_mztdyp.JLDW00||'!*'; return; end if; --频次判断 if (c_mztdyp.pcid00 >0) and (C_MAXPC0 >0) and (c_mztdyp.pcid00<>C_MAXPC0) then select c.ZQCS00/c.HSZQCD*24 into c_dqzqcs from bm_pc0000 c where pcid00= c_mztdyp.pcid00; select c.ZQCS00/c.HSZQCD*24, pcmc00 into c_maxcs0,c_maxpcmc from bm_pc0000 c where pcid00= C_MAXPC0; if c_dqzqcs>c_maxcs0 then V_RETURN:=2; V_ERROR0:='有麻醉卡的病人开药品"'||c_mztdyp.YPMC00||'",频次超过最大频次'||c_maxpcmc||'!*'; return; end if; end if; update YF_MZCFMX set TDYPID = lv_TDYPID WHERE cflsh0 = P_CFLSH0 and ypnm00 = c_mztdyp.YPNM00; end if; end if; --end if; ------------------------------------------------------------------------------------------ end loop; end if; --根据分装规格取药品总数量 select nvl(max(trim(value0)),'N') into v_FZGGQYPZL from xt_xtcs00 where name00='YS_GJFZGGQYPZL'; if (v_FZGGQYPZL='Y') then --判断有分装规格的药品,并且发药单位是中间剂量单位的,药品总量必须是分装规格的整数倍 for c_fzggyp in (select a.YPMC00,B.MZFYDW,B.ZJJLDW,B.FZGG01,B.FZGG02,A.YPZSL0,A.CFDW00,A.ZHL000,b.K2J000,b.KCDW00 from YF_MZCFMX a, BM_YD0000 b where a.YPNM00=b.YPNM00 and a.CFLSH0=P_CFLSH0 and (b.FZGG01 is not null or b.FZGG02 is not null) AND A.CFDW00=B.ZJJLDW) loop c_YPSLMOD := 1; c_YPFZGGS := null; if (c_fzggyp.fzgg01 is not null) then c_YPSLMOD := mod(c_fzggyp.YPZSL0,c_fzggyp.fzgg01); c_YPFZGGS := to_char(c_fzggyp.fzgg01)||c_fzggyp.ZJJLDW; end if; if (c_YPSLMOD <> 0) and (c_fzggyp.fzgg02 is not null) then c_YPSLMOD := mod(c_fzggyp.YPZSL0,c_fzggyp.fzgg02); if c_YPFZGGS is not null then c_YPFZGGS := c_YPFZGGS||','||to_char(c_fzggyp.fzgg02)||c_fzggyp.ZJJLDW; else c_YPFZGGS := to_char(c_fzggyp.fzgg02)||c_fzggyp.ZJJLDW; end if; end if; if (c_YPSLMOD <> 0) and (c_fzggyp.KCDW00 <> c_fzggyp.CFDW00) then c_YPSLMOD := mod(c_fzggyp.YPZSL0*c_fzggyp.ZHL000,c_fzggyp.K2J000); c_YPFZGGS := c_YPFZGGS||',1'||c_fzggyp.KCDW00; end if; if (c_YPSLMOD <> 0) then V_RETURN:=2; V_ERROR0:='药品"'||c_fzggyp.YPMC00||'"总量输入错误,总量必须是"'||c_YPFZGGS||'"的整数倍!'; return; end if; end loop; end if; --特殊限制 select count(*) into V_COUNT0 from XT_XTCS00 where name00='YS_MZZYCFPWJJTS' and TRIM(VALUE0)='Y'; if V_COUNT0>0 then v_ypmc00:=' '; --for c_psyp in (select cflsh0 from YF_MZCF00 b where b.CFLSH0=P_CFLSH0 and b.YPDLBH='2' ) loop select count(distinct c.ypczfl) into V_COUNT0 from yf_mzcfmx b,bm_yd0000 c where b.ypnm00=c.ypnm00 and b.cflsh0 =P_CFLSH0 and b.YPDLBH='2'; if V_COUNT0 > 1 then V_RETURN:=2; V_ERROR0:='不同类别的药品不能保存在一张处方中!*'; return; end if; v_ypmc00:=' '; for c_pysyp_dzcf in (select a.YPNM00 from YF_MZCFMX a,YF_MZCF00 b where a.cflsh0=b.cflsh0 and a.CFLSH0=P_CFLSH0 and b.YPDLBH='2' and a.CXBZ00='Z' and trim(b.cfsm00) is null) loop if V_YPMC00=' ' then V_YPMC00:=c_pysyp_dzcf.YPNM00; else V_YPMC00:=V_YPMC00||','||to_char(c_pysyp_dzcf.YPNM00); end if; end loop; if V_YPMC00<>' ' then PZB0000:=0; PJJYPMC:=''; Sp_Bm_Ypjjpd(V_YPMC00,'0',0,PZB0000,PJJYPMC); if PZB0000>0 then V_RETURN:=2; if v_SFLJSCCWTS='0' then V_ERROR0:='处方中"'||PJJYPMC||'"出现‘十八反、十九畏’,如必须使用,请在“处方说明”中输入使用原因!*'; else V_ERROR0:=substr(V_ERROR0||'处方中"'||PJJYPMC||'"出现‘十八反、十九畏’,如必须使用,请在“处方说明”中输入使用原因!*',1,220); end if; v_SFLJSCCWTS:='1'; goto afterbcxh; end if; end if; --end loop; end if; end if; end if; --限制特定费别审批的药品目录 MZYS9-20171016-001---begin-------------------------------- select count(*) into V_COUNT0 from BM_TYZD00 where ZDMC00='特定费别审批的药品目录' and YXBZ00='1' ; if V_COUNT0>0 then select count(*) into V_COUNT0 from XT_XTCS00 where NAME00='ZS_TDFBBSPBQ' and instrb(','||trim(VALUE0)||',',','||to_char(C_KDKS00)||',')>0; if V_COUNT0>0 then --针对新开处方,是否存在审批目录中的药品,若有存在,判断是否存在有效的审批记录,没有的话进行提示。 v_ypmc00:=' '; for c_wspyp in (select distinct b.YPMC00 from YF_MZCF00 a,YF_MZCFMX b ,BM_TYZD00 c where A.CFLSH0=B.CFLSH0 and a.CFLSH0=P_CFLSH0 and c.BZDYBH=to_char(vFBBH00)||'-'||vYBZXLB||'-'||vYBBRLB and b.YPNM00=c.DJ0000 and c.ZDMC00='特定费别审批的药品目录' and c.YXBZ00='1' and not exists (select 1 from YK_YBMLSP where ZYID00=V_GHZYID and SPLB00='2' and MZZYBZ='0' and ZFRQ00='20991231' and KSSYRQ<=to_char(sysdate,'YYYYMMDD') and JSSYRQ>=to_char(sysdate,'YYYYMMDD') and KSSYRQ||KSSYSJ<=to_char(sysdate,'YYYYMMDDHH24:MI:SS') and JSSYRQ||JSSYSJ>=to_char(sysdate,'YYYYMMDDHH24:MI:SS') and SPJG00='1' and YPNM00=b.YPNM00) ) loop if V_YPMC00=' ' then V_YPMC00:=c_wspyp.YPMC00; else V_YPMC00:=V_YPMC00||'、'||c_wspyp.YPMC00; end if; end loop; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:=substr(v_YPMC00||'需要审批使用,处方不能保存!*',1,220) ; return; end if; end if; end if; --限制特定费别审批的药品目录---end-------------------------------- ------------------------------------------------------------------------------------------------------------------------- --限制包含关键字药品用法 MZDZBLS-20171218-001---begin-------------------------------- for c_yp in (select a.ypmc00,b.ypyfmc from YS_CFMX00 A, BM_YPYF00 B where A.YFID00 = B.Yfid00 and A.CFLSH0 = P_CFLSH0 AND exists (select 1 from bm_tyzd00 x where x.zdmc00 = '限制用法的药品关键字' and a.ypmc00 like '%' || x.mc0000 || '%') AND exists (select 1 from bm_tyzd00 x where x.zdmc00 = '限制用法关键字' and b.ypyfmc like '%' || x.mc0000 || '%')) loop V_RETURN:=2; V_ERROR0:=c_yp.YPMC00||'不允许使用'||c_yp.ypyfmc||'!*'; return; end loop; -- ruanbh 2018.02.06 限制已停用用法 MZDZBLS-20180202-002 for c_yp in (select b.ypyfmc from YS_CFMX00 A,BM_YPYF00 B where A.YFID00 = B.Yfid00 and A.CFLSH0 = P_CFLSH0 and B.TYBZ00='0') loop V_RETURN:=2; V_ERROR0:='用法'''||c_yp.ypyfmc||'''已停用,请修改用法!*'; return; end loop; -- chenna 2021.05.21 处方已经退费是否允许重复开 by MZYSSJ5-20210517-002 begin select trim(VALUE0) into YS_CFTFSFCFK from xt_xtcs00 where name00='YS_CFTFSFCFK'; exception when others then YS_CFTFSFCFK:='N'; end; -- ruanbh 2018.07.16 一个病人一天之内,不允许存在相同的中药处方信息 MZDZBL9-20180709-001 if nvl(P_CFLSH0,'0')<>'0' then select count(*) into V_COUNT0 from XT_XTCS00 where NAME00 = 'YS_YTNZYCFBNCF' and VALUE0 = 'Y'; if V_COUNT0 > 0 then --中药处方一天只开一次 -- ruanbh 2020.06.12 YS_ZYCFCDTS处方拆单参数开启用时,YS_YTNZYCFBNCF参数失效,处方允许重复 MZYSSJ5-20200509-001 select count(*) into V_COUNT0 from XT_XTCS00 where NAME00 = 'YS_ZYCFCDTS' and nvl(VALUE0,' ') <>' '; if V_COUNT0 = 0 then V_COUNT0 := 0; begin select BRID00,YSGZH0 into Vbrid00,VYSBH00 from YS_CFXXB0 where GHID00 = V_GHZYID and rownum = 1; exception when others then Vbrid00 := NULL; VYSBH00:=0; end; if VYSBH00>0 then select count(*) into V_COUNT0 from BM_TYZD00 where ZDMC00='特殊病种开最大药品天数豁免医生' and instr(','||MC0000||',',','||VYSBH00||',')>0; end if; if Vbrid00 is not null and V_COUNT0=0 then select count(*) into V_COUNT0 from ys_cfmx00 where CFLSH0=P_CFLSH0; ls_COU:=0; if trim(YS_CFTFSFCFK)='Y' then for c_zycfcs in( select CFLSH0 from ( SELECT a.CFLSH0, count(*) YPCOU FROM ys_cfmx00 a, ys_cfxxb0 b WHERE a.cflsh0 = b.cflsh0 AND b.ypdlbh = '2' AND b.brid00 = Vbrid00 AND b.srrq00 = TO_CHAR (SYSDATE, 'YYYYMMDD') and a.YPNM00 in (select YPNM00 from YS_CFMX00 where CFLSH0= P_CFLSH0 ) and not exists (select 1 from yf_mzcf00 h where h.cflsh0=b.cflsh0 and h.cfzt00 in ('3','6')) and not exists (select 1 from yf_mzcf00 z where z.bccfh0=b.cflsh0 and z.cfzt00 in ('5','6')) and a.CFLSH0<>P_CFLSH0 GROUP BY a.CFLSH0) where YPCOU=V_COUNT0) loop select count(*) into ls_COU1 from ys_cfmx00 where CFLSH0=c_zycfcs.CFLSH0; if ls_COU1=V_COUNT0 then if ls_COU = 0 then VYPMC00 := '('||c_zycfcs.CFLSH0||')' ; else VYPMC00 := VYPMC00||',('||c_zycfcs.CFLSH0||')'; end if; ls_COU:=ls_COU+1; end if; end loop; else for c_zycfcs in( select CFLSH0 from ( SELECT a.CFLSH0, count(*) YPCOU FROM ys_cfmx00 a, ys_cfxxb0 b WHERE a.cflsh0 = b.cflsh0 AND b.ypdlbh = '2' AND b.brid00 = Vbrid00 AND b.srrq00 = TO_CHAR (SYSDATE, 'YYYYMMDD') and a.YPNM00 in (select YPNM00 from YS_CFMX00 where CFLSH0= P_CFLSH0 ) and not exists (select 1 from yf_mzcf00 h where h.cflsh0=b.cflsh0 and h.cfzt00 in ('3','6')) and not exists (select 1 from yf_mzcf00 z where z.bccfh0=b.cflsh0 and z.cfzt00 in ('5','6')) and a.CFLSH0<>P_CFLSH0 GROUP BY a.CFLSH0) where YPCOU=V_COUNT0) loop select count(*) into ls_COU1 from ys_cfmx00 where CFLSH0=c_zycfcs.CFLSH0; if ls_COU1=V_COUNT0 then if ls_COU = 0 then VYPMC00 := '('||c_zycfcs.CFLSH0||')' ; else VYPMC00 := VYPMC00||',('||c_zycfcs.CFLSH0||')'; end if; ls_COU:=ls_COU+1; end if; end loop; end if; if ls_COU > 0 then V_RETURN:=2; V_ERROR0 := '此中药处方重复:'||VYPMC00||'。一天相同中药处方不能重复开!请检查!'; end if; end if; end if; end if; end if; -- ruanbh 2019.02.19 同时存在草药和全成分弹出提示 MZDZBL9-20190129-003 select count(*) into V_COUNT0 from XT_XTCS00 where NAME00 = 'YS_TSCZCYQCFTCTS' and VALUE0 = 'Y'; if V_COUNT0>0 and nvl(P_CFLSH0,'0')='0' then select count(*) into V_COUNT0 from YS_CFXXB0 A where A.GHID00=V_GHZYID and YPDLBH='2' and A.YPCZFL='0'; if V_COUNT0>0 then select count(*) into V_COUNT0 from YS_CFXXB0 A where A.GHID00=V_GHZYID and YPDLBH='2' and A.YPCZFL<>'0'; if V_COUNT0>0 then V_RETURN:=1; V_ERROR0 :='本次就诊同时存在颗粒和草药处方,请核对是否正确!'; end if; end if; end if; -- ruanbh 2019.04.24 提示套餐外项目金额 MZYSSJ5-20190424-002 select count(*) into V_COUNT0 from XT_XTCS00 where NAME00 = 'YS_TCKD' and VALUE0 = 'Y'; if V_COUNT0>0 and nvl(P_CFLSH0,'0')='0' then select count(*) into V_COUNT0 from SF_TCDJ00 A where BRID00=C_BRID00 and A.MZZYBZ='0' and A.ZT0000='0' and exists(select 1 from SF_TCDJMX X where X.DJID00=A.DJID00 and X.SYSL00>0); if V_COUNT0>0then select sum(A.ZJE000*decode(sign(A.XMZK00),1,A.XMZK00,1)) into VTCWJE0 from YJ_YW0000 A WHERE A.XMZT00 in('0','1','2') and A.ZYGHID=V_GHZYID and DJID00 is null; if VTCWJE0>0 then V_RETURN:=1; V_ERROR0 :='本次开单含套餐外金额:'||VTCWJE0||'元!'; end if; end if; end if; ----YS_TSYPYBZX中设置的病人才能开BM_TYZD00.ZDMC00="特定费别限制药品目录"的药品 if nvl(P_CFLSH0,'0')<>'0' then begin select trim(VALUE0) into LS_TSYPYBZX from XT_XTCS00 where NAME00='YS_TSYPYBZX' and rownum=1; LS_TSYPYBZX:=','||LS_TSYPYBZX||','; exception when others then LS_TSYPYBZX:='N'; end; ---YS_SFGJSFBJKJMLNYP是否根据BM_BRXXB0.SFBJ00判断允许开特定费别限制药品目录内药品 begin select trim(VALUE0) into YS_SFGJSFBJKJMLNYP from XT_XTCS00 where NAME00='YS_SFGJSFBJKJMLNYP' and rownum=1; select count(*) into V_COUNT0 from user_tab_columns where UPPER(column_name)='SFBJ00' AND TABLE_NAME = 'BM_BRXXB0'; if V_COUNT0=0 then YS_SFGJSFBJKJMLNYP:='N'; end if; if YS_SFGJSFBJKJMLNYP ='Y' then --LS_TSYPYBZX:='N'; V_YPMC00:=' '; for c_ypmx in( select c.YPMC00 from SF_BRXXB0 a,YF_MZCF00 b,YF_MZCFMX c, BM_BRXXB0 d where a.GHID00=V_GHZYID and b.CFLSH0=P_CFLSH0 and a.GHID00=b.GHID00 and b.CFLSH0=c.CFLSH0 and a.brid00=d.brid00 and exists (select 1 from BM_TYZD00 a where ZDMC00='特定费别限制药品目录' and DJ0000=c.YPNM00 ) and d.SFBJ00<>'1' ) loop if V_YPMC00=' ' then V_YPMC00:=chr(13)||c_ypmx.YPMC00 ; else V_YPMC00:=V_YPMC00||','||c_ypmx.YPMC00; end if; end loop; if V_YPMC00=' ' then LS_TSYPYBZX:='N'; end if; end if; exception when others then YS_SFGJSFBJKJMLNYP:='N'; end; if LS_TSYPYBZX<>'N' and LS_TSYPYBZX<>'0' then V_YPMC00:=' '; for c_ypmx in( select c.YPMC00 from SF_BRXXB0 a,YF_MZCF00 b,YF_MZCFMX c where a.GHID00=V_GHZYID and b.CFLSH0=P_CFLSH0 and a.GHID00=b.GHID00 and b.CFLSH0=c.CFLSH0 and exists (select 1 from BM_TYZD00 a where ZDMC00='特定费别限制药品目录' and DJ0000=c.YPNM00 ) and instr(LS_TSYPYBZX,','||a.FBBH00||'-'||a.YBZXLB||',')<=0 and not exists(select 1 from BM_TYZD00 X where X.ZDMC00='本院特约名单' and X.BH0000=to_char(C_BRID00)) ) loop if V_YPMC00=' ' then V_YPMC00:=chr(13)||c_ypmx.YPMC00 ; else V_YPMC00:=V_YPMC00||','||c_ypmx.YPMC00; end if; end loop; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:='对不起,存在如下特定病人使用药品不能开:'||V_YPMC00; return; end if; end if; end if; --如果医生开具的的处方是参数(XT_ZDYBYPMLXYSPBR)定义的病人且包含了需要审批的目录(目录定义在通用字典),则提示病人当前药品是否已经审批。 ---------------------------------------------------------------------------------------------------------------------------------------- if nvl(P_CFLSH0,'0')<>'0' then select count(*) into V_COUNT0 from BM_TYZD00 where ZDMC00='指定费别审批的药品目录' and YXBZ00='1' and BZDYBH=to_char(VFBBH00)||'-'||VYBZXLB||'-'||VYBBRLB; if V_COUNT0>0 then-- a if V_FLAG00=0 THEN-- b --未审批药品的处理方式:0只提示 1限制保存并且进行数量的控制 select count(*) into V_COUNT0 from XT_XTCS00 where NAME00='YS_WSPYPCLFS' and TRIM(VALUE0)='1'; if V_COUNT0=0 then --c只提示 --针对本次挂号的未记账处方中,是否存在审批目录中的药品,若有存在,判断是否存在有效的审批记录,没有的话进行提示。 v_ypmc00:=' '; for c_wspyp in (select distinct b.YPMC00 from YF_MZCF00 a,YF_MZCFMX b ,BM_TYZD00 c where a.GHID00=V_GHZYID and a.CFZT00='0' and a.CFLSH0=b.CFLSH0 and b.CXBZ00='Z' and b.SFZBY0='N' and b.YPNM00=c.DJ0000 and c.ZDMC00='指定费别审批的药品目录' and c.YXBZ00='1' and c.BZDYBH=to_char(VFBBH00)||'-'||VYBZXLB||'-'||VYBBRLB and not exists (select 1 from YK_YBMLSP where BRID00=C_BRID00 and SPLB00='0' and MZZYBZ='0' and ZFRQ00='20991231' and KSSYRQ<=to_char(sysdate,'YYYYMMDD') and JSSYRQ>=to_char(sysdate,'YYYYMMDD') and KSSYRQ||KSSYSJ<=to_char(sysdate,'YYYYMMDDHH24:MI:SS') and JSSYRQ||JSSYSJ>=to_char(sysdate,'YYYYMMDDHH24:MI:SS') and SPJG00='1' and YPNM00=b.YPNM00) ) loop if V_YPMC00=' ' then V_YPMC00:=c_wspyp.YPMC00; else V_YPMC00:=V_YPMC00||'、'||c_wspyp.YPMC00; end if; end loop; if V_YPMC00<>' ' then V_RETURN:=1; if v_SFLJSCCWTS='0' then V_ERROR0:='药品('||V_YPMC00||')尚未审批,将自费使用!*'; else V_ERROR0:=substr(V_ERROR0||' 药品('||V_YPMC00||')尚未审批,将自费使用!*',1,220); end if; v_SFLJSCCWTS:='1'; end if; else--限制保存并且进行数量的控制 --针对本次挂号的未记账处方中,是否存在审批目录中的药品,若有存在,判断是否存在有效的审批记录,没有的话进行提示。 v_ypmc00:=' '; for c_wspyp in (select distinct b.YPMC00 from YF_MZCF00 a,YF_MZCFMX b ,BM_TYZD00 c where a.GHID00=V_GHZYID and a.CFZT00='0' and a.CFLSH0=b.CFLSH0 and b.CXBZ00='Z' and b.SFZBY0='N' and b.YPNM00=c.DJ0000 and c.ZDMC00='指定费别审批的药品目录' and c.YXBZ00='1' and c.BZDYBH=to_char(VFBBH00)||'-'||VYBZXLB||'-'||VYBBRLB and not exists (select 1 from YK_YBMLSP where BRID00=C_BRID00 and SPLB00='0' and MZZYBZ='0' and ZFRQ00='20991231' and KSSYRQ<=to_char(sysdate,'YYYYMMDD') and JSSYRQ>=to_char(sysdate,'YYYYMMDD') and KSSYRQ||KSSYSJ<=to_char(sysdate,'YYYYMMDDHH24:MI:SS') and JSSYRQ||JSSYSJ>=to_char(sysdate,'YYYYMMDDHH24:MI:SS') and SPJG00='1' and YPNM00=b.YPNM00) ) loop if V_YPMC00=' ' then V_YPMC00:=c_wspyp.YPMC00; else V_YPMC00:=V_YPMC00||'、'||c_wspyp.YPMC00; end if; end loop; v_ypmc01:=' '; --对数量进行限制 for c_yspyp in (select b.YPNM00,b.YPMC00,d.LSH000,SUM(ROUND(b.YPZSL0*b.ZHL000/C.K2J000,3)) BCSL00, SUM(Round(d.SPSL00*d.ZHL000/C.K2J000,3)) SPSL00 from YF_MZCF00 A,YF_MZCFMX B,BM_YD0000 C,YK_YBMLSP D WHERE a.GHID00=V_GHZYID and a.CFLSH0=B.CFLSH0 AND B.CXBZ00='Z' and b.SFZBY0='N' AND b.YPNM00=C.YPNM00 and b.YPNM00=d.YPNM00 and d.BRID00=C_BRID00 and d.SPLB00='0' AND d.MZZYBZ='0' AND d.ZFRQ00='20991231' and d.kssyrq<=to_char(sysdate,'YYYYMMDD') and d.JSSYRQ>=to_char(sysdate,'YYYYMMDD') and d.KSSYRQ||d.KSSYSJ<=to_char(sysdate,'YYYYMMDDHH24:MI:SS') and d.JSSYRQ||d.JSSYSJ>=to_char(sysdate,'YYYYMMDDHH24:MI:SS') and d.SPJG00='1' and d.YPNM00=b.YPNM00 group by b.YPNM00,b.YPMC00,d.LSH000) loop select nvl(SUM(ROUND(b.YPZSL0*b.ZHL000/C.K2J000,3)),0) into LS_LJSYSL from YF_MZCF00 a,YF_MZCFMX b,BM_YD0000 c,YK_YBMLSP d where a.BRID00=C_BRID00 and a.CFLSH0=b.CFLSH0 and b.YPNM00=c_yspyp.YPNM00 and b.SFZBY0='N' and b.CXBZ00='Z' and b.YPNM00=c.YPNM00 and d.LSH000=c_yspyp.LSH000 and a.SRRQ00>=d.KSSYRQ and A.SRRQ00<=D.JSSYRQ and a.SRRQ00||a.SRSJ00>=d.KSSYRQ||d.KSSYSJ and a.SRRQ00||a.SRSJ00<=d.JSSYRQ||d.JSSYSJ; if LS_LJSYSL>c_yspyp.SPSL00 then if v_ypmc01=' ' then v_ypmc01:=c_yspyp.YPMC00||'累计使用'||trim(replace(to_char(LS_LJSYSL,'FM9999990.999')||' ','. ',''))||',审批数量为'|| trim(replace(to_char(c_yspyp.SPSL00,'FM9999990.999')||' ','. ','')); else V_YPMC01:=V_YPMC01||'、'||c_yspyp.YPMC00||'累计使用'||trim(replace(to_char(LS_LJSYSL,'FM9999990.999')||' ','. ',''))||',审批数量为'|| trim(replace(to_char(c_yspyp.SPSL00,'FM9999990.999')||' ','. ','')); end if; end if; end loop; if (v_ypmc00<>' ') and (v_ypmc01<>' ') then V_RETURN:=2; V_ERROR0:=substr('药品('||V_YPMC00||')尚未审批' ||v_ypmc01||',不能保存!*',1,220) ; return; elsif (v_ypmc00<>' ') and (v_ypmc01=' ') then V_RETURN:=2; V_ERROR0:=substr('药品('||V_YPMC00||')尚未审批' ||',不能保存!*',1,220) ; return; elsif (v_ypmc00=' ') and (v_ypmc01<>' ') then V_RETURN:=2; V_ERROR0:=substr(v_ypmc01||',不能保存!*',1,220) ; return; end if; end if; --c提示结束 end if; --b end if;--a end if; -- ruanbh 2020.02.05 增加中药单独支付限制 MZYSSJ5-20190829-002 select count(*) into V_COUNT0 from XT_XTCS00 where NAME00 = 'YS_KQZYDDZFXZ' and VALUE0 = 'Y'; if V_COUNT0>0 and nvl(P_CFLSH0,'0')<>'0' then select count(*) into V_COUNT0 from YS_CFXXB0 A where A.CFLSH0=P_CFLSH0 and YPDLBH='2'; if V_COUNT0>0 then select count(*) into V_COUNT0 from YS_CFXXB0 A,YS_CFMX00 B where A.CFLSH0=B.CFLSH0 and A.CFLSH0=P_CFLSH0 and B.YPNM00 not in (select X.YPNM00 from BM_YDTSSX X,BM_YPSX00 Y WHERE X.SXBH00=Y.SXBH00 and Y.sxmc00='禁止单独支付'); if V_COUNT0=0 then V_RETURN:=2; V_ERROR0 := '中药处方属单方或复方不合理不予保存!'; return; end if; end if; end if; -- ruanbh 2022.01.05 抗肿瘤药物等级限制 MZYS115-20211220-001 if V_ERROR0='没有错误' then V_ERROR0:=''; for C_YP in (select B.YPMC00 from YS_CFXXB0 A,YS_CFMX00 B,BM_YD0000 C,BM_YGBM00 D where A.CFLSH0=B.CFLSH0 and B.YPNM00=C.YPNM00 and A.YSGZH0=D.YGBH00 and A.CFLSH0=P_CFLSH0 and C.ZLDJ00>D.ZLDJ00) loop V_ERROR0:=V_ERROR0||chr(10)||C_YP.YPMC00; end loop; if nvl(V_ERROR0,' ')<>' ' then V_RETURN:=2; V_ERROR0 := '以下药品抗肿瘤药物等级不足:'||V_ERROR0; return; end if; end if; <> return; END;