create or replace procedure SP_BQ_SSJJDCZ ( Pzyid00 in number , --住院流水号 Plrrq00 in varchar2 , --录入日期 Plrsj00 in varchar2 , --录入时间 Pczy000 in number , --操作员 Pbl0000 in char , --病历 Pfsp000 in char , --放射片 Pssyk00 in char , --手术衣裤 Pjz0000 in char , --假肢 Pjzbw00 in varchar2 , --假肢部位 Phdyc00 in char , --活动义齿 Phdycfs in varchar2 , --活动义齿份数 Pgzwp00 in char , --贵重物品 Pgzwpmc in varchar2 , --贵重物品名称 Pjmsy00 in char , --静脉输液 Plzdn00 in char , --留置导尿 Pylzz00 in char , --引流装置 Pylzzmc in varchar2 , --引流装置名称 Pshyy00 in char , --术后余药 Pshyyym in varchar2 , --术后余药药名 Pwywxzp in char , --未用完血制品 Pxzpmc0 in varchar2 , --未用完血制品名称 Ppfqk00 in varchar2 , --皮肤情况 Pshsyqk in varchar2 , --术后剩余情况 Pqrhs00 in varchar2 , --病区至手术室确认护士 Ptdhs00 in varchar2 , --手术室至病区填单护士 -- Pzyhs00 in varchar2 , --转运护士 Pcommit in varchar2 default 'N' , --是否提交 Pzxcgbz out number , --执行成功标志 1成功 0失败 Ptsxx00 out varchar2 , --执行结果提示信息,成功的情况下也可能有警告信息 Pxxxx00 out varchar2 --执行结果详细信息,成功的情况下也可能有警告信息,一般用来显示参数等指标 ) -- modification history -- Person Date Comments -- dongxb 2021.01.21 create 手术交接单操作 for BQHS9.0-20210108-001 as Vsysdate date; --日期变量 Vcounter number(10); --计数器变量 Vtznr00 BQ_BRTZXX.TZNR00%type; Ecustom exception; begin Pzxcgbz := 0; Vsysdate := sysdate; Pxxxx00 := nvl(to_char(Pzyid00),'null')||','||nvl(to_char(Plrrq00),'null')||','||nvl(to_char(Plrsj00),'null')||','|| nvl(to_char(Pczy000),'null'); SP_TransLog(Vsysdate,'SP_BQ_SSJJDCZ',Pczy000,0,Pxxxx00); --判断病区是否有录入该单子,没录入不允许录入 select count(1) into Vcounter from BQ_BRTZXX where ZYID00=Pzyid00 and TZLBID in(select TZLBID from BQ_TZLB00 where HLDLB0='25') and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00; if Vcounter=0 then Ptsxx00 := '未找到病人日期为'||Plrrq00||' '||Plrsj00||' '||Pzyid00||'手术交接记录单,请确认!'; raise Ecustom; end if; --------------------------------病历---------------------------------------- if Pbl0000 is not null then if Pbl0000='1' then Vtznr00:='1#0'; else Vtznr00:='0#1'; end if; else Vtznr00:='0#0'; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2525; --------------------------------放射片---------------------------------------- if Pfsp000 is not null then if Pfsp000='1' then Vtznr00:='1#0'; else Vtznr00:='0#1'; end if; else Vtznr00:='0#0'; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2526; ----------------------------------手术衣裤---------------------------------------- if Pssyk00 is not null then if Pssyk00='1' then Vtznr00:='1#0'; else Vtznr00:='0#1'; end if; else Vtznr00:='0#0'; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2527; ----------------------------------假肢---------------------------------------- if Pjz0000 is not null then if Pjz0000='1' then Vtznr00:='1#0#'; else Vtznr00:='0#1#'; end if; else Vtznr00:='0#0#'; end if; if Pjzbw00 is not null then Vtznr00:=Vtznr00||Pjzbw00; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2528; ----------------------------------活动义齿---------------------------------------- if Phdyc00 is not null then if Phdyc00='1' then Vtznr00:='1#0#'; else Vtznr00:='0#1#'; end if; else Vtznr00:='0#0#'; end if; if Phdycfs is not null then Vtznr00:=Vtznr00||Phdycfs; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2529; ----------------------------------贵重物品---------------------------------------- if Pgzwp00 is not null then if Pgzwp00='1' then Vtznr00:='1#0#'; else Vtznr00:='0#1#'; end if; else Vtznr00:='0#0#'; end if; if Pgzwpmc is not null then Vtznr00:=Vtznr00||Pgzwpmc; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2530; ----------------------------------静脉输液---------------------------------------- if Pjmsy00 is not null then if Pjmsy00='1' then Vtznr00:='1#0'; else Vtznr00:='0#1'; end if; else Vtznr00:='0#0'; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2531; ----------------------------------留置导尿---------------------------------------- if Plzdn00 is not null then if Plzdn00='1' then Vtznr00:='1#0'; else Vtznr00:='0#1'; end if; else Vtznr00:='0#0'; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2532; ----------------------------------引流装置---------------------------------------- if Pylzz00 is not null then if Pylzz00='1' then Vtznr00:='1#0#'; else Vtznr00:='0#1#'; end if; else Vtznr00:='0#0#'; end if; if Pylzzmc is not null then Vtznr00:=Vtznr00||Pylzzmc; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2533; ----------------------------------术后余药---------------------------------------- if Pshyy00 is not null then if Pshyy00='1' then Vtznr00:='1#0#'; else Vtznr00:='0#1#'; end if; else Vtznr00:='0#0#'; end if; if Pshyyym is not null then Vtznr00:=Vtznr00||Pshyyym; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2534; ----------------------------------未用完血制品---------------------------------------- if Pwywxzp is not null then if Pwywxzp='1' then Vtznr00:='1#0#'; else Vtznr00:='0#1#'; end if; else Vtznr00:='0#0#'; end if; if Pxzpmc0 is not null then Vtznr00:=Vtznr00||Pxzpmc0; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2535; ----------------------------------皮肤情况---------------------------------------- if Ppfqk00 is not null then Vtznr00:=Ppfqk00; else Vtznr00:=' '; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2536; ----------------------------------术后剩余情况---------------------------------------- if Pshsyqk is not null then Vtznr00:=Pshsyqk; else Vtznr00:=' '; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2537; ----------------------------------病区至手术室 手术室物品确认护士---------------------------------------- if Pqrhs00 is not null then Vtznr00:=Pqrhs00; else Vtznr00:=' '; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2538; ----------------------------------手术室至病区填单护士---------------------------------------- if Ptdhs00 is not null then Vtznr00:=Ptdhs00; else Vtznr00:=' '; end if; update BQ_BRTZXX set TZNR00=Vtznr00 where ZYID00=Pzyid00 and LRRQ00=Plrrq00 and trim(LRSJ00)=Plrsj00 and TZLBID=2524; Pzxcgbz := 1; if(Pcommit='Y') then commit; end if; exception when no_data_found then raise_application_error(-20001,substrb('没有找到数据!*'||sqlerrm,1,240)); when Ecustom then raise_application_error(-20010,substrb(Ptsxx00||'!*',1,240)); when others then raise_application_error(-20002,substrb(nvl(sqlerrm, '原因不明出错')||'!*',1,240)); end;