CREATE OR REPLACE PROCEDURE SP_ZS_YJTSXZ ( V_ZYID00 IN number, --住院ID 只限制住院的 V_YJDJH0 IN number DEFAULT 0, --默认为0 表示对ZYID00的提醒,并且只提醒一次, V_RETURN OUT number, --0表示成功,--1表示违反警告,--2表示违反限制 --3表示其他错误。 V_ERROR0 OUT varchar2, --错误提示 V_FLAG00 IN number default 0, --0 项目 1 药品 V_KDYS00 IN number default 0, --开嘱医生 V_DYMK00 in number default 0 --0医嘱保存时调用 1常规项目保存时调用 ) as C_BRID00 number(10); vCOUNTER number; --临时变量 V_COUNT0 number(5); --计数器 V_COUNT2 number(5); --计数器 vYBZXLB IC_YBBRLB.YBZXLB%TYPE; -- vFBBH00 IC_YBBRLB.FBBH00%TYPE; vYBBRLB BM_YBBRLB.ybbrlb%TYPE; C_BJSL00 NUMBER(12,2); C_JYSL00 NUMBER(12,2); C_SL0000 NUMBER(12,2); C_FZTJ00 BM_TSXZ00.FZTJ00%TYPE; C_XZMC00 BM_TSXZDM.XZMC00%TYPE;--限制提示 I_BH0000 BM_TSXZ00.BH0000%TYPE;--限制序号 C_ZLXMID NUMBER(8,0); C_SQL000 varchar2(1600); V_YPMC00 varchar2(220); V_YPMC01 varchar2(220); V_YPMC02 varchar2(220); LS_LJSYSL_YZ YF_YZYPSQ.YPZSL0%TYPE;--累计使用数量。 LS_LJSYSL_LS YF_YZYPSQ.YPZSL0%TYPE;--累计使用数量。 C_RETURN NUMBER(5); --本次限制是否跳过,1跳过,0检查 v_SFLJSCCWTS CHAR(1); --是否要和上一个判断的错误一起提示 0 不要 1要 LS_TSKSSJBSFXSP varchar2(10); LS_KSSJB0 BM_YGBM00.KSSJB0%type; V_COUNT1 number(5); strSql1 varchar(1000); TYPE TCUR IS REF CURSOR; CUR TCUR; AC VARCHAR2(100); LS_CJGTS varchar2(1);--超过价格提示 LS_COU number; LS_COU1 number; LS_COU2 number; LS_COU3 number; LS_SFQYZKYYQXKZ varchar2(5);--专科用药限制 跟门诊医生用同一个参数 LS_SFQYQKYPXZ varchar2(5); LS_CYDYYPXZ varchar2(10);--出院带药限制 for ZYYS-20150616-002 vXTJYXMKDXZ varchar2(10); LS_TSYPYBZX varchar2(100); V_WPHDJ0 ZY_BRXXB0.WPHDJ0%type; LS_SFQYWPH varchar2(20); --是否启用无陪护 begin --0表示成功, --1表示违反警告, --2表示违反限制。 --3表示其他错误。 -- MODIFICATION HISTORY -- Person Date Comments -- liuj 20110407 create 允许根据条件限制诊疗项目开单金额 -- csf 20110428 如果医生开具的的医嘱是参数(XT_ZDYBYPMLXYSPBR)定义的病人且包含了需要审批的目录(目录定义在通用字典),则提示病人当前药品是否已经审批。 -- csf 20110524 病人需要审批目录定义方式变了,审批的方式也变了,所以对病人是否审批的判断提示也做相应的修改。 -- csf 2011.06.23 XT_ZDYBYPMLXYSPBR参数要维护所有参与控制的病人类别,太麻烦,不用参数而直接用通用字典判断。 -- csf 2011.08.08 C_SQL000 BM_TSXZ00.fztj00%TYPE 改为 C_SQL000 varchar2(1600)原有的字符长度不够,会提示字符缓冲区太小 -- csf 2011.09.16 老年医院只允许开审批通过的药品,且这个审批通过的药品只能开短嘱,且数量也要做限制,加参数控制。 -- CSF 2011.10.20 医保审批记录加条件SPLB00='0' -- CSF 2011.11.21 专人专用审批,修改提示内容 -- liuj 2011.12.09 yzzt00='7' 改为yzzt00 in ('7','0')由于病区也要用这个过程限制 by BQ-20111203-001 -- CSF 2011.12.15 审批药品的数量限制的判断要具体到时间点。 ZYYS-20111130-003 -- CSF 2012.01.17 指定的药品只能儿科使用,非儿科使用不允许保存,指定的药品用通用字典来维护字典名称为“儿科专用药品目录” ZYYS-20120118-001 -- Dsm 2012.04.27 专人专用抗生素,越级解除后不限制 for ZYYS-20120418-003 -- Dsm 2012.08.07 抗生素级别>=3的药品要审批 for ZYYS-20120801-001 -- Dsm 2012.11.06 开嘱托的药品不需要审批(审批目录中) for ZYYS-20121019-001 -- Dsm 2013.02.16 保存某些诊疗项目时要弹出提示“该项目超过1000元,需到医务科审审批后方能使用” for ZYYS-20130129-001 -- dsm 2013.03.13 XZLB00=20的提示有问题 for ZYYS-20130313-001 -- dsm 2013.04.03 同1天费用互斥提示 for BQ-20130416-001 -- liuj 2013.08.16 开药品医嘱跳出药品浓度检测提示 for BQ-20130810-001 -- dsm 2013.09.22 专科用药住院的限制 for ZYYS-20130920-001 -- dsm 2014.01.16 抗生素切口限制 for ZYYS-20140113-004 -- dsm 2014.07.07 高切口等级可以用底切口等级的抗生素 for ZYYS-20140702-001 -- dsm 2014.07.29 and nvl(c.QKLX00,' ')<>' ' for ZYYS-20140729-001 -- dsm 2014.08.06 instr(c.QKLX00,'无')=0的才限制 for ZYYS-20140806-003 -- dsm 2015.04.07 医保病人药品审批的使用,原来只能临时医嘱,现改成按YK_YBMLSP.CLBZ00来限制 for XMGL-20150228-001 -- dsm 2015.06.18 莆田附属针剂不能出院带药,出院带药不能超7天,加参数ZS_CYDYYPXZ控制 for ZYYS_20150616-002 -- dsm 2015.07.14 用门诊参数XTJYXMKDXZ控制"相同检验项目是否可以开单" for ZYYS-20150520-001 -- daihq 2015.09.15 肺科增加限制特殊药品指定药品药品 for XMGL-20150714-001 -- dsm 2016.01.28 肺科专人专用药品控制量 for ZYYS-20151008-001 -- dsm 2016.06.16 泉州人民有些成药不能开长期医嘱 for ZYYS-20160522-001 -- dsm 2016.11.04 肺科为了让ICU病人及时开出专人专用药品,增加设置"专人专用审批的药品目录豁免科室" for ZYYS-20161031-001 -- dsm 2016.12.30 专人专用药品用量提示,前面会多了个顿号 for BQ-20161215-001 -- dsm 2017.06.20 "专人专用审批的药品目录豁免科室"的备注设置YPNM00多个逗号分隔 -- ,并且把字典名称改成“专人专用审批的药品豁免科室” for ZYYS-20170420-002 -- dsm 2017.06.28 YS_TSYPYBZX中设置的病人才能开BM_TYZD00.ZDMC00="特定费别限制药品目录"的药品 for ZYYS-20170621-003 -- dsm 2024.09.19 无陪护医嘱限制 BQ-20240416-001 V_RETURN:=0; V_ERROR0:='没有错误'; BEGIN SELECT BRID00 INTO C_BRID00 FROM ZY_BRXXB0 WHERE ZYID00=V_ZYID00; EXCEPTION WHEN OTHERS THEN V_RETURN:=3; V_ERROR0:='查无此人!'; RETURN; END; 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 select nvl(MAX(trim(VALUE0)),'N') into vXTJYXMKDXZ from XT_XTCS00 where NAME00='YS_XTJYXMKDXZ' and instr(SYXT00,'Z')>0; exception when others then vXTJYXMKDXZ := 'N'; end; v_SFLJSCCWTS:='0'; if V_FLAG00=0 then --项目开始 if V_YJDJH0 = 0 then --只提醒一次 开始 C_RETURN:=0; --是否存在诊疗单金额的限制 0存在 1 不存在 --取对应的所有诊疗单报警金额、禁用金额的 BEGIN SELECT BJSL00,JYSL00,FZTJ00,bh0000 INTO C_BJSL00,C_JYSL00,C_FZTJ00,i_bh0000 FROM BM_TSXZ00 WHERE (FBBH00=0 OR FBBH00=vFBBH00) AND (YBZXLB='Z' OR YBZXLB=vYBZXLB) AND (YBBRLB='Z' OR YBBRLB=vYBBRLB) AND (MZZYBZ='1' OR MZZYBZ='2') AND ROWNUM=1 AND XZLB00=6 ; EXCEPTION WHEN OTHERS THEN C_FZTJ00:=NULL; C_RETURN:=1; END; select nvl(max(trim(xzmc00)),' ') into c_xzmc00 from BM_TSXZDM where bh0000=i_bh0000 and rownum=1; --------------------------------------------begin------------------------ if C_RETURN=0 then IF C_FZTJ00 IS NOT NULL THEN C_SQL000:=C_FZTJ00; C_SQL000:=' select nvl(sum(c.sfje00*a.mcsl00*b.zqcs00*decode(a.ts0000,0,1,a.ts0000)),0) sl0000 from bq_yjyz00 a,bm_pc0000 b,vw_yj_zlxmjg c WHERE b.pcid00=decode(a.pcid00,0,2,a.pcid00) and a.zlxmid=c.zlxmid and a.zyid00='||V_ZYID00||' and a.yzzt00 in (''7'',''0'') and a.lrrq00=to_char(sysdate,''YYYYMMDD'') and a.zlxmid in ('||C_SQL000||')'; execute immediate C_SQL000 into C_SL0000; IF C_SL0000>C_JYSL00 THEN V_RETURN:=2; if c_xzmc00<>' ' then V_ERROR0:=C_XzMC00; else V_ERROR0:='当前所开特定医技项目总金额超过禁用金额:'||TRIM(TO_CHAR(C_JYSL00)); end if; RETURN; ELSE IF C_SL0000>C_BJSL00 THEN V_RETURN:=1; if c_xzmc00<>' ' then V_ERROR0:=C_XzMC00; else V_ERROR0:='当前所开特定医技项目总金额超过报警金额:'||TRIM(TO_CHAR(C_BJSL00)); --继续下一个限制 end if; v_SFLJSCCWTS:='1'; END IF; END IF; end if; END IF; --if C_RETURN=0 --超过1000元的项目要提示 begin------------------------------------------------------ for ZYYS-20130129-001 --BM_TSXZ00表有定义则提示,不定义则不提示 LS_CJGTS:='0'; BEGIN SELECT BJSL00,JYSL00,FZTJ00,bh0000 INTO C_BJSL00,C_JYSL00,C_FZTJ00,i_bh0000 FROM BM_TSXZ00 WHERE (FBBH00=0 OR FBBH00=vFBBH00) AND (YBZXLB='Z' OR YBZXLB=vYBZXLB) AND (YBBRLB='Z' OR YBBRLB=vYBBRLB) AND (MZZYBZ='1' OR MZZYBZ='2') AND ROWNUM=1 AND XZLB00=20 ; EXCEPTION WHEN OTHERS THEN C_FZTJ00:=NULL; C_RETURN:=1; LS_CJGTS:='1'; END; select NVL(MAX(TRIM(XZMC00)),' ') into c_xzmc00 from BM_TSXZDM where BH0000=I_BH0000 AND ROWNUM=1; if LS_CJGTS='0' then V_YPMC00:=' '; V_ERROR0:=' '; IF C_FZTJ00 IS NOT NULL THEN C_SQL000:=REPLACE(C_FZTJ00,'V_ZYID00',to_char(V_ZYID00)); OPEN CUR FOR 'select ZLXMJC from BQ_YJYZ00 A WHERE A.ZYID00='||V_ZYID00||' and A.YZZT00 IN (''7'',''0'') '|| 'and A.LRRQ00=TO_CHAR(SYSDATE,''YYYYMMDD'') and A.ZLXMID In ('||C_SQL000||') '; LOOP FETCH CUR INTO AC; EXIT WHEN CUR%NOTFOUND; if V_YPMC00=' ' then V_YPMC00:=AC; else V_YPMC00:=V_YPMC00||'、'||AC; end if; END LOOP; CLOSE CUR; --V_RETURN:=C_JYSL00; 移到IF else中,否则会导致空提示 if V_YPMC00<>' ' and C_XZMC00<>' ' then V_RETURN:=C_JYSL00; V_ERROR0:='['||V_YPMC00||']'||C_XZMC00; elsif V_YPMC00<>' ' then V_RETURN:=C_JYSL00; V_ERROR0:='['||V_YPMC00||']'||'该项目超过1000元,需到医务科审审批后方能使用!'; end if; if V_ERROR0<>' ' then RETURN; end if; END IF; end if; --超过1000元的项目要提示 end------------------------------------------------------ for ZYYS-20130129-001 ----------------同1天互斥项目的提示------begin--------------------------------------------------for BQ-20130416-001 --BM_TYZD00中有定义就提示 V_YPMC00:=' '; for c_TYZD in (select MC0000,BZ0000 from BM_TYZD00 where ZDMC00='同一天费用互斥' order by XSXH00) loop select nvl(sum(decode(a.YZZT00,'0',1,'7',1,'2',1,'3',1,0)),0) BCYZ00,count(*) into ls_cou,ls_cou1 from BQ_YJYZ00 a,BM_ZLZD00 b,XT_ZLSFGX c where a.ZYID00=V_ZYID00 and (a.TZRQ00 is null or a.TZRQ00>=to_char(sysdate,'YYYYMMDD')) and a.ZLXMID=b.ZLXMID and b.ZLXMID=c.ZLXMID and instr(','||c_TYZD.MC0000||',',','||SFXMID||',' )>0; select nvl(sum(decode(GZRQ00,null,1,0)),0) BCXM00, count(*) into ls_cou2,ls_cou3 from BQ_JZXM00 a where a.ZYID00=V_ZYID00 and (a.TZRQ00 is null or TZRQ00>=to_char(sysdate,'YYYYMMDD') ) and instr(','||c_TYZD.MC0000||',',','||SFXMID||',' )>0; if ((ls_cou>0 and V_DYMK00=0) or (V_DYMK00=1 and ls_cou2>0)) and (ls_cou1+ls_cou3>1) then if V_YPMC00=' ' then V_YPMC00:=c_TYZD.BZ0000; else V_YPMC00:=V_YPMC00||chr(13)||c_TYZD.BZ0000; end if; end if; end loop; if V_YPMC00<>' ' then if V_ERROR0='没有错误' or V_ERROR0=' ' then V_ERROR0:=V_YPMC00; V_RETURN:=1; else V_ERROR0:=V_ERROR0||','||V_YPMC00; end if; end if; ----------------同1天互斥项目的提示------end-------------------------------------------------- ----判断同个病人同一天是否有开相同的检验项目(包括子项目) for ZYYS-20150520-001 if vXTJYXMKDXZ = 'Y' then for C_ZLXM in (select ZLXMID,XMMC00 from ( select ZLXMID,XMMC00,count(1) COUNT0 from ( select a.zlxmjc,a.zlxmid,a.ZLXMJC XMMC00 from BQ_YJYZ00 a,BM_ZLZD00 b where a.ZYID00=V_ZYID00 and a.QYRQ00=to_char(sysdate,'YYYYMMDD') and a.ZLXMID=b.zlxmid and exists(select 1 from BM_ZLZD00 where ZLXMID=a.ZLXMID and LBBH00=4) and a.YZZT00 in ('0','1','2','3','7') union all select a.ZLXMJC,b.zlxmid,(select ZLXMJC from BM_ZLZD00 where ZLXMID=b.ZLXMID) XMMC00 from BQ_YJYZ00 a,XT_ZHMX00 b where a.ZYID00=V_ZYID00 and a.QYRQ00=to_char(sysdate,'YYYYMMDD') and a.ZLXMID=b.ZHXMID and exists(select 1 from BM_ZLZD00 where ZLXMID=a.ZLXMID and LBBH00=4) and a.YZZT00 in ('0','1','2','3','7') ) group by ZLXMID,XMMC00) where COUNT0>1) loop if V_ERROR0='没有错误' or nvl(V_ERROR0,' ')=' ' then V_ERROR0 := C_ZLXM.XMMC00; else V_ERROR0 := V_ERROR0||','||C_ZLXM.XMMC00; end if; end loop; if (V_ERROR0 <> '没有错误') and nvl(V_ERROR0,' ')<>' ' then V_RETURN := 2; V_ERROR0 := V_ERROR0||',今天已有相同检验开单,不能保存'; return; end if; end if; --------------------------------- ZYYS-20150520-001 end------------------------------------------------------------ select nvl(max(MC0000),'0') into LS_SFQYWPH from BM_TYZD00 where ZDMC00='住院无陪护业务字典' and BH0000='WithoutAccompanying_Open'; --无陪护限制begin if substr(LS_SFQYWPH,1,1)='1' and V_DYMK00=0 then V_YPMC00:=' '; for c_wphxm in ( select distinct a.ZLXMJC from BQ_YJYZ00 a,BM_WPHZLB b where a.ZYID00=V_ZYID00 and a.YZZT00 in ('0','7') and a.ZLXMID=b.BZZLXM and b.DJID00=V_WPHDJ0 ) loop if V_YPMC00=' ' then V_YPMC00:=c_wphxm.ZLXMJC; else V_YPMC00:=V_YPMC00||'、'||c_wphxm.ZLXMJC; end if; end loop; if V_YPMC00<>' ' then V_return:=2; V_ERROR0:='无陪护病人不能开如下项目:'||chr(13)||V_YPMC00||'!'; return; end if; end if; --无陪护限制end end if;----只提醒一次 结束 else --项目结束 下面处理药品 --专人专用药品目录限制---begin-------------------------------- select count(*) into V_COUNT0 from BM_TYZD00 where ZDMC00='专人专用审批的药品目录' and YXBZ00='1' ; --for ZYYS-20161031-001,ZYYS-20170420-002 --select count(*) into V_COUNT1 from ZY_BRXXB0 a where ZYID00=V_ZYID00 -- and exists(select 1 from BM_TYZD00 where ZDMC00='专人专用审批的药品目录豁免科室' -- and MC0000=to_char(a.DQKS00) ) ; if V_COUNT0>0 then --针对新开医嘱,是否存在审批目录中的药品,若有存在,判断是否存在有效的审批记录,没有的话进行提示。 v_ypmc00:=' '; v_ypmc01:=' '; for c_wspyp in (select distinct b.YPMC00 from BQ_YPYZ00 a,BQ_YPYZMX b ,BM_TYZD00 c where a.ZYID00=V_ZYID00 and a.YZZT00 in ('7','0') and a.LRRQ00=to_char(sysdate,'YYYYMMDD') and a.YZID00=b.YZID00 --and c.BZDYBH=to_char(vFBBH00)||'-'||vYBZXLB||'-'||vYBBRLB and b.YPNM00=c.DJ0000 and c.ZDMC00='专人专用审批的药品目录' and c.YXBZ00='1' and nvl(b.YJYYLY,' ')=' ' and not exists(select 1 from BM_TYZD00 where ZDMC00='专人专用审批的药品豁免科室' and MC0000=to_char(a.KSH000) and instr(','||BZ0000||',',','||b.YPNM00||',')>0 ) and not exists (select 1 from YK_YBMLSP where ZYID00=V_ZYID00 and SPLB00='1' and MZZYBZ='1' 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; begin select to_number(TRIM(VALUE0)) into V_COUNT0 from XT_XTCS00 where NAME00='ZS_ZRZYYPSYLTS' ; --专人专用药品使用量提示,1提示,2限制,0不处理,默认0 exception when others then V_COUNT0:=0; end; --使用量的提示 ZYYS-20151008-001 if V_COUNT0>0 then for c_yspyp in ( select b.YPNM00,b.YPMC00,d.LSH000,SUM(ROUND(b.LYL000*b.Z2J000/C.K2J000,3)) BCSL00, Round(d.SPSL00*d.ZHL000/C.K2J000,3) SPSL00 from BQ_YPYZ00 a,BQ_YPYZMX b ,BM_YD0000 C,YK_YBMLSP D WHERE a.ZYID00=V_ZYID00 and a.YZZT00 in ('7','0') and a.LRRQ00=to_char(sysdate,'YYYYMMDD') and a.YZID00=b.YZID00 and b.YPNM00=c.YPNM00 and D.MZZYBZ='1' --and a.CLBZ00='1' 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.YPNM00=b.YPNM00 and D.ZYID00=V_ZYID00 and D.SPLB00='1' and (d.CLBZ00=a.CLBZ00 or d.CLBZ00='2') group by b.YPNM00,b.YPMC00,d.LSH000,Round(d.SPSL00*d.ZHL000/C.K2J000,3) ) loop LS_LJSYSL_YZ:=0; LS_LJSYSL_LS:=0; select nvl(SUM(ROUND(a.YPZSL0*a.ZHL000/C.K2J000,3)),0) into LS_LJSYSL_YZ from YF_YZYPSQ a,BM_YD0000 c,YK_YBMLSP d where a.ZYID00=V_ZYID00 and a.YPNM00=c_yspyp.YPNM00 and a.QLZT00<>'3' and a.YPNM00=c.YPNM00 and c.YPNM00=d.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; select nvl(SUM(ROUND(b.YPZSL0*b.ZHL000/C.K2J000,3)),0) into LS_LJSYSL_LS from YF_ZYCF00 a,YF_ZYCFMX b,BM_YD0000 c,YK_YBMLSP d where a.ZYID00=V_ZYID00 and a.CFLSH0=b.CFLSH0 and b.YPNM00=c_yspyp.YPNM00 and a.CFZT00<>'3' and B.YPNM00=c.YPNM00 and c.YPNM00=d.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_YZ+LS_LJSYSL_LS+c_yspyp.BCSL00>c_yspyp.SPSL00 then if v_ypmc01=' ' then v_ypmc01:=c_yspyp.YPMC00||'累计使用'||trim(replace(to_char(LS_LJSYSL_YZ+LS_LJSYSL_LS+c_yspyp.BCSL00,'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_YZ+LS_LJSYSL_LS+c_yspyp.BCSL00,'FM9999990.999')||' ','. ',''))||',审批数量为'|| trim(replace(to_char(c_yspyp.SPSL00,'FM9999990.999')||' ','. ','')); end if; end if; end loop; if V_YPMC01<>' ' then V_RETURN:=V_COUNT0; V_ERROR0:=substr(V_YPMC01||'超过了审批总量,医嘱不能保存!',1,220) ; return; end if; end if; end if; --专人专用药品目录限制---end-------------------------------- --如果医生开具的的处方是参数(XT_ZDYBYPMLXYSPBR)定义的病人且包含了需要审批的目录(目录定义在通用字典),则提示病人当前药品是否已经审批。 ---------------------------------------------------------------------------------------------------------------------------------------- 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 --未审批药品的处理方式:0只提示 1限制保存并且进行数量的控制 select count(*) into V_COUNT0 from XT_XTCS00 where NAME00='ZS_WSPYPCLFS' and TRIM(VALUE0)='1'; --add for 老年ZYYS-20121019-001 嘱托医嘱是否限制begin select count(*) into V_COUNT1 from XT_XTCS00 where NAME00='ZS_SFXZZTYZ' and TRIM(VALUE0)='N'; --add for 老年ZYYS-20121019-001 end if V_COUNT0=0 then -- b只提示 --针对新开医嘱,是否存在审批目录中的药品,若有存在,判断是否存在有效的审批记录,没有的话进行提示。 v_ypmc00:=' '; for c_wspyp in (select distinct b.YPMC00 from BQ_YPYZ00 a,BQ_YPYZMX b ,BM_TYZD00 c where a.ZYID00=V_ZYID00 and a.YZZT00 in ('7','0') and a.LRRQ00=to_char(sysdate,'YYYYMMDD') and a.YZID00=b.YZID00 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_ZYID00 and SPLB00='0' and MZZYBZ='1' 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 and (CLBZ00=a.CLBZ00 or CLBZ00='2')) and ((b.YZCLLB not in('嘱托')) or V_COUNT1=0) ) 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'; -- return; end if; else --b限制保存 --针对新开医嘱,是否存在审批目录中的药品,若有存在,判断是否存在有效的审批记录,没有的话进行提示。 v_ypmc00:=' '; v_ypmc02:=' '; for c_wspyp in (select distinct a.clbz00,b.YPMC00 from BQ_YPYZ00 a,BQ_YPYZMX b ,BM_TYZD00 c where a.ZYID00=V_ZYID00 and a.YZZT00 in ('7','0') and a.LRRQ00=to_char(sysdate,'YYYYMMDD') and a.YZID00=b.YZID00 and c.BZDYBH=to_char(vFBBH00)||'-'||vYBZXLB||'-'||vYBBRLB and b.YPNM00=c.DJ0000 and c.ZDMC00='指定费别审批的药品目录' and c.YXBZ00='1' and ((b.YZCLLB not in('嘱托')) or V_COUNT1=0) and not exists (select 1 from YK_YBMLSP where ZYID00=V_ZYID00 and SPLB00='0' and MZZYBZ='1' 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 and (CLBZ00=a.CLBZ00 or CLBZ00='2') ) ) loop --if c_wspyp.CLBZ00='0' then -- if V_YPMC02=' ' then -- V_YPMC02:=c_wspyp.YPMC00; -- else -- V_YPMC02:=V_YPMC02||'、'||c_wspyp.YPMC00; -- end if; --else if V_YPMC00=' ' then V_YPMC00:=c_wspyp.YPMC00; else V_YPMC00:=V_YPMC00||'、'||c_wspyp.YPMC00; end if; --end if; end loop; v_ypmc01:=' '; for c_yspyp in (select b.YPNM00,b.YPMC00,d.LSH000,SUM(ROUND(b.LYL000*b.Z2J000/C.K2J000,3)) BCSL00, Round(d.SPSL00*d.ZHL000/C.K2J000,3) SPSL00 from BQ_YPYZ00 a,BQ_YPYZMX b ,BM_YD0000 C,YK_YBMLSP D WHERE a.ZYID00=V_ZYID00 and a.YZZT00 in ('7','0') and a.LRRQ00=to_char(sysdate,'YYYYMMDD') and a.YZID00=b.YZID00 and b.YPNM00=c.YPNM00 and D.MZZYBZ='1' --and a.CLBZ00='1' 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 and D.ZYID00=V_ZYID00 and D.SPLB00='0' and (d.CLBZ00=a.CLBZ00 or d.CLBZ00='2') group by b.YPNM00,b.YPMC00,d.LSH000,Round(d.SPSL00*d.ZHL000/C.K2J000,3) ) loop LS_LJSYSL_YZ:=0; LS_LJSYSL_LS:=0; select nvl(SUM(ROUND(a.YPZSL0*a.ZHL000/C.K2J000,3)),0) into LS_LJSYSL_YZ from YF_YZYPSQ a,BM_YD0000 c,YK_YBMLSP d where a.ZYID00=V_ZYID00 and a.YPNM00=c_yspyp.YPNM00 and a.QLZT00<>'3' and a.YPNM00=c.YPNM00 and c.YPNM00=d.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; select nvl(SUM(ROUND(b.YPZSL0*b.ZHL000/C.K2J000,3)),0) into LS_LJSYSL_LS from YF_ZYCF00 a,YF_ZYCFMX b,BM_YD0000 c,YK_YBMLSP d where a.ZYID00=V_ZYID00 and a.CFLSH0=b.CFLSH0 and b.YPNM00=c_yspyp.YPNM00 and a.CFZT00<>'3' and B.YPNM00=c.YPNM00 and c.YPNM00=d.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_YZ+LS_LJSYSL_LS+c_yspyp.BCSL00>c_yspyp.SPSL00 then if v_ypmc01=' ' then v_ypmc01:=c_yspyp.YPMC00||'累计使用'||trim(replace(to_char(LS_LJSYSL_YZ+LS_LJSYSL_LS+c_yspyp.BCSL00,'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_YZ+LS_LJSYSL_LS+c_yspyp.BCSL00,'FM9999990.999')||' ','. ',''))||',审批数量为'|| trim(replace(to_char(c_yspyp.SPSL00,'FM9999990.999')||' ','. ','')); end if; end if; end loop; if v_ypmc02=' ' then 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; else if (v_ypmc00<>' ') and (v_ypmc01<>' ') then V_RETURN:=2; V_ERROR0:=substr('药品('||V_YPMC00||')尚未审批' ||v_YPMC02||'不能为长嘱,'||v_ypmc01||',不能保存!',1,220) ; return; elsif (v_ypmc00<>' ') and (v_ypmc01=' ') then V_RETURN:=2; V_ERROR0:=substr('药品('||V_YPMC00||')尚未审批' ||v_YPMC02||'不能为长嘱,'||',不能保存!',1,220) ; return; elsif (v_ypmc00=' ') and (v_ypmc01<>' ') then V_RETURN:=2; V_ERROR0:=substr(v_YPMC02||'不能为长嘱,'||v_ypmc01||',不能保存!',1,220) ; return; else V_RETURN:=2; V_ERROR0:=substr(v_YPMC02||'不能为长嘱!',1,220) ; return; end if; end if; end if;-- b限制保存 end if;-- a ---------------------------------------------------------------------------------------------------------------------------------------- --非儿科不能使用药品控制 Select count(*) into V_COUNT0 from BM_TYZD00 a,BM_YD0000 b where a.ZDMC00='儿科专用药品目录' and a.YXBZ00='1' and a.DJ0000=b.YPNM00; if V_COUNT0>0 then v_ypmc00:=' '; for c_erzyyp in (select distinct c.YPMC00 from BM_BMBM00 a,BQ_YPYZ00 b,BQ_YPYZMX c where b.ZYID00=V_ZYID00 and b.KSH000=a.BMBH00 and a.BMMC00 not like '%儿%' and b.YZID00=c.YZID00 and b.YZZT00 in ('0','7') and exists (select 1 from BM_TYZD00 d,BM_YD0000 e where d.ZDMC00='儿科专用药品目录' and d.YXBZ00='1' and d.DJ0000=e.YPNM00 and e.YPNM00=c.YPNM00)) loop if V_YPMC00=' ' then V_YPMC00:=c_erzyyp.YPMC00; else V_YPMC00:=V_YPMC00||'、'||c_erzyyp.YPMC00; end if; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:='药品('||V_YPMC00||')只能儿科使用,处方保存不成功!'; end if; end loop; end if; --浓度检测提示 Select count(*) into V_COUNT0 from XT_XTCS00 where name00='BQ_YZLLSFTSNDJCTSNR' and value0='Y'; if V_COUNT0>0 then v_ypmc00:=' '; for c_erzyyp in (select distinct b.YPMC00,c.ndjcts from BQ_YPYZ00 a,BQ_YPYZMX b,BM_YD0000 c where a.zyid00=V_ZYID00 and a.yzid00=b.yzid00 and a.yzzt00 in ('0','7') and C.ypnm00=B.ypnm00 and c.ndjcts is not null ) loop if V_YPMC00=' ' then V_YPMC00:='药品:'||c_erzyyp.YPMC00||' 浓度监测提示:'||c_erzyyp.ndjcts; else V_YPMC00:=V_YPMC00||';'||'药品:'||c_erzyyp.YPMC00||' 浓度监测提示:'||c_erzyyp.ndjcts; end if; if V_YPMC00<>' ' then V_RETURN:=1; V_ERROR0:=V_YPMC00; end if; end loop; end if; --(特殊)抗生素等级>=3的,长嘱是否需要进行审批 ,Y要审批 N不要 默认N begin select trim(VALUE0) into LS_TSKSSJBSFXSP from XT_XTCS00 where NAME00='ZS_TSKSSJBSFXSP'; exception when others then LS_TSKSSJBSFXSP:='N'; end; if LS_TSKSSJBSFXSP='Y' then V_YPMC00:=' '; for c_erzyyp in ( select distinct c.YPMC00 from BQ_YPYZ00 b,BQ_YPYZMX c,BM_YD0000 d where b.ZYID00=V_ZYID00 and b.YZID00=c.YZID00 and b.YZZT00 in ('0','7') and c.YPNM00=d.YPNM00 and d.KSSJB0>=3 and b.CLBZ00='0' and not exists (select 1 from YK_YBMLSP e where ZYID00=b.ZYID00 and YPNM00=c.YPNM00 and SPJG00='1' and YPNM00>0 and SPLB00='1')) loop if V_YPMC00=' ' then V_YPMC00:=c_erzyyp.YPMC00; else V_YPMC00:=V_YPMC00||'、'||c_erzyyp.YPMC00; end if; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:='药品('||V_YPMC00||')需要审批才能使用,处方保存不成功!'; end if; end loop; end if; --专科用药限制begin-----------------------BM_ZKYYKZ begin select SUBSTRB(Trim(Value0),1,1) into LS_SFQYZKYYQXKZ from XT_XTCS00 where NAME00='YS_SFQYZKYYQXKZ'; exception when others then LS_SFQYZKYYQXKZ:='N'; end; if LS_SFQYZKYYQXKZ='Y' then V_YPMC00:=' '; for c_erzyyp in ( select distinct c.YPMC00 from BQ_YPYZ00 b,BQ_YPYZMX c,BM_YD0000 d,BM_ZKYYKZ e where b.ZYID00=V_ZYID00 and b.YZID00=c.YZID00 and b.YZZT00 in ('0','7') and d.YPNM00=e.YPNM00 and e.SFQY00='1' and e.MZZYBZ in('1','2') and c.YPNM00=d.YPNM00 and not exists (select 1 from BM_ZKYYQX f where YPNM00=e.YPNM00 and to_char(sysdate,'YYYYMMDDHH24:MI:SS')>=f.KSRQ00||f.KSSJ00 and to_char(sysdate,'YYYYMMDDHH24:MI:SS')<=f.JSRQ00||f.JSSJ00 and YSGZH0=b.KZYS00 and f.MZZYBZ in('1','2') ) ) loop if V_YPMC00=' ' then V_YPMC00:=c_erzyyp.YPMC00; else V_YPMC00:=V_YPMC00||'、'||c_erzyyp.YPMC00; end if; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:='药品('||V_YPMC00||')是专科用药控制品种,属于特定医生使用!'; end if; end loop; end if; --专科用药限制end----------------------- --抗生素生药品切口类型限制begin-----------------------BM_ZKYYKZ begin select Trim(Value0) into LS_SFQYQKYPXZ from XT_XTCS00 where NAME00='ZS_SFQYQKYPXZ'; exception when others then LS_SFQYQKYPXZ:='N'; end; if LS_SFQYQKYPXZ='Y' or LS_SFQYQKYPXZ='M' then V_YPMC00:=' '; for c_erzyyp in ( select distinct c.QKLX00||'类切口 不能用'||c.YPMC00 YPMC00 from BQ_YPYZ00 b,BQ_YPYZMX c,BM_YD0000 d where b.ZYID00=V_ZYID00 and b.YZID00=c.YZID00 and b.YZZT00 in ('0','7') and c.KSSYF0 in('1','2') --手术预防 and c.YPNM00=d.YPNM00 and d.KSSJB0>0 and nvl(c.QKLX00,' ')<>' ' and instr(c.QKLX00,'无')=0 and not exists (select 1 from VW_BM_SSQKLXYP f where YPNM00=c.YPNM00 and (LS_SFQYQKYPXZ='M' and QKLX00<=c.QKLX00) or (LS_SFQYQKYPXZ='Y' and QKLX00=c.QKLX00) )) loop if V_YPMC00=' ' then V_YPMC00:=c_erzyyp.YPMC00; else V_YPMC00:=V_YPMC00||chr(13)||c_erzyyp.YPMC00; end if; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:=chr(13)||' 如下手术预防用药超出对应的切口用药范围!'||chr(13)||V_YPMC00||chr(13)||' 请检查输入!'; end if; end loop; --抗生素生药品切口类型限制end----------------------- end if; --出院带药保存时,若其他含有针剂药品,则提示并限制不得带针剂;若药量超过7天,则提示药量不能超过7天。莆田附属 begin select Trim(Value0) into LS_CYDYYPXZ from XT_XTCS00 where NAME00='ZS_CYDYYPXZ';--出院带药药品限制 exception when others then LS_CYDYYPXZ:='N'; end; if LS_CYDYYPXZ='Y' then V_YPMC00:=' '; for c_cydyyp in ( select YPMC00,YFLBID,TS0000,decode(YFLBID,2,0,1) BZ0000 from ( select c.YPMC00,(select YFLBID from BM_YPYF00 where YFID00=b.YFID00) YFLBID,decode(ZQDW00,'周',ZQS000*7,ZQS000) TS0000 from BQ_YPYZ00 b,BQ_YPYZMX c where b.ZYID00=V_ZYID00 and b.YZID00=c.YZID00 and c.YZCLLB='出院带药' and YZZT00 in('7')) where YFLBID in(2) or TS0000>7 order by decode(YFLBID,2,0,1) ) loop if c_cydyyp.BZ0000=0 then if V_YPMC00=' ' then V_YPMC00:='出院带药不能开针剂:'||c_cydyyp.YPMC00; else V_YPMC00:=V_YPMC00||chr(13)||c_cydyyp.YPMC00; end if; else if V_YPMC00=' ' then V_YPMC00:='出院带药不能超7天:'||c_cydyyp.YPMC00; else if sign(instr(V_YPMC00,'出院带药不能超7天'))=-1 then V_YPMC00:='出院带药不能超7天:'|| V_YPMC00||chr(13)||c_cydyyp.YPMC00; else V_YPMC00:= V_YPMC00||chr(13)||c_cydyyp.YPMC00; end if; end if; end if; end loop; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:=chr(13)||' 如下出院带药被限制!'||chr(13)||V_YPMC00||chr(13)||' 请检查输入!'; end if; --抗生素生药品切口类型限制end----------------------- end if; --XMGL-20150714-001 begin 增加限制特殊药品指定药品药品 select count(1) into V_COUNT0 from BM_TYZD00 where ZDMC00='药品指定药品用法'; if V_COUNT0>1 then V_YPMC00:=' '; for c_ypxx in (select c.YPNM00,c.YPMC00 from BQ_YPYZ00 b,BQ_YPYZMX c,BM_TYZD00 d where b.ZYID00=V_ZYID00 and b.YZID00=c.YZID00 and b.YZZT00 in ('0','7') and d.ZDMC00='药品指定药品用法' and d.YXBZ00='1' and c.YPNM00=d.DJ0000 and not exists(select 1 from BM_TYZD00 e where e.ZDMC00='药品指定药品用法' and e.YXBZ00='1' and c.YPNM00=e.DJ0000 and e.BZDYBH=trim(b.YFID00)) and rownum=1) loop for c_yfxx in (select d.BZ0000 from BQ_YPYZ00 b,BQ_YPYZMX c,BM_TYZD00 d where b.ZYID00=V_ZYID00 and b.YZID00=c.YZID00 and b.YZZT00 in ('0','7') and d.ZDMC00='药品指定药品用法' and d.YXBZ00='1' and c.YPNM00=c_ypxx.YPNM00 and c.YPNM00=d.DJ0000 ) loop if V_YPMC00=' ' then V_YPMC00:='药品:'||c_ypxx.YPMC00||',限制只能使用以下用法:'||chr(13)||c_yfxx.BZ0000; else V_YPMC00:=V_YPMC00||','||c_yfxx.BZ0000; end if; end loop; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:=chr(13)||V_YPMC00||chr(13)||' 请检查输入!'; end if; end loop; end if; --XMGL-20150714-001 end 增加限制特殊药品指定药品药品 --ZYYS-20160522-001 begin 增加限制有些中成药不能开长嘱 select count(1) into V_COUNT0 from BM_TYZD00 where ZDMC00='不能开长期医嘱剂型'; if V_COUNT0>0 then V_YPMC00:=' '; for c_ypxx in (select c.YPNM00,c.YPMC00 from BQ_YPYZ00 b,BQ_YPYZMX c,BM_YD0000 d where b.ZYID00=V_ZYID00 and b.YZID00=c.YZID00 and b.YZZT00 in ('0','7') and b.CLBZ00='0' and D.LBBH00=1 and c.YPNM00=d.YPNM00 and exists(select 1 from BM_TYZD00 e where e.ZDMC00='不能开长期医嘱剂型' and e.YXBZ00='1' and instr(','||e.MC0000||',',','||trim(d.JXBH00)||',')>0 ) ) loop if V_YPMC00=' ' then V_YPMC00:='药品:'||c_ypxx.YPMC00; else V_YPMC00:=V_YPMC00||','||c_ypxx.YPMC00; end if; end loop; if V_YPMC00<>' ' then V_RETURN:=2; V_ERROR0:='如下中成药不能零发,请开短嘱:'||chr(13)||V_YPMC00||chr(13)||' 请检查输入!'; end if; end if; --ZYYS-20160522-001 end 增加限制有些中成药不能开长嘱 ---ZYYS-20170621-003begin --YS_TSYPYBZX中设置的病人才能开BM_TYZD00.ZDMC00="特定费别限制药品目录"的药品 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; if LS_TSYPYBZX<>'N' and LS_TSYPYBZX<>'0' then V_YPMC00:=' '; for c_ypmx in( select c.YPMC00 from ZY_BRXXB0 a,BQ_YPYZ00 b,BQ_YPYZMX c where a.ZYID00=V_ZYID00 and b.YZID00=c.YZID00 and a.ZYID00=b.ZYID00 and b.YZZT00 in('0','1') and exists (select 1 from BM_TYZD00 a where ZDMC00='特定费别限制药品目录' and DJ0000=c.YPNM00 ) and instr(LS_TSYPYBZX,','||a.FBBH00||'-'||a.YBZXLB||',')<=0) 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; ---ZYYS-20170621-003end end if;--药品处理结束 end SP_ZS_YJTSXZ;