create or replace procedure SP_MZHS_YYYSTZ ( Pghhbid in number , -- Pczy000 in number , Pczyks0 in number , Pcommit in varchar2 default 'N' , --是否提交 Pzxcgbz out number , --执行成功标志 1成功 0失败 Ptsxx00 out varchar2 , --执行结果提示信息,成功的情况下也可能有警告信息 Pxxxx00 out varchar2 --执行结果详细信息,成功的情况下也可能有警告信息,一般用来显示参数等指标 ) -- modification history -- Person Date Comments -- liwm 2019.01.22 create:预约医生停诊时,取消预约病人; for MZHS9-20190116-001 as cursor cur_YYBRXX is select * from SF_YYBRB0 where GHHBID = Pghhbid and YYZT00 in ('0','1'); yybrb0 SF_YYBRB0%rowtype; Ecustom exception; --错误变量 begin begin Pzxcgbz := 0; for yybrb0 in cur_YYBRXX loop SP_YY_INSERT_SF_YYBRB0 ( PYYID00 => yybrb0.YYID00, --预约编号 SQ_SF_YYBRBO_YYID00.nextval PGHHBID => yybrb0.GHHBID, --挂号号 SF_YSGHHB.GHHBID PYYH000 => yybrb0.YYH000, --预约号 PBRID00 => yybrb0.BRID00, --病人编号 BM_BRXXB0.BRID00 PBRXM00 => yybrb0.BRXM00, --病人姓名 PBRDH00 => yybrb0.BRDH00, --电话号码 PKMH000 => null, --卡面号 PICKH00 => null, --就诊卡号 PYYLB00 => null, --预约类别编号 0电话预约 1分诊台预约 2网络预约 PYYRQ00 => null, --预约日期 PYYJSSJ => null, --结束时间 PYYZT00 => null, --预约状态 0 登记 1 确认(预挂号) 2 取消 3 就诊 PYYYGBH => Pczy000, --预约操作员编号 BM_YGBM00.YGBH00 PBZ0000 => null, --备注 PCZYBM0 => Pczyks0, --操作科室 PCZBZ00 => '3', --操作标志 1 登记 2 变更 3 取消 4 还原取消记录 PSFZH00 => null, --身份证号 PCOMMIT => Pcommit --是否提交 'Y'提交N不提交 ); end loop; update YS_HBHZXH set BRID00 = '', BRXM00 = '' where GHHBID = Pghhbid; Pzxcgbz := 1; if Pcommit = 'Y' then commit; end if; exception when no_data_found then Ptsxx00:= substrb('未找到数据*'||sqlerrm,1,200); when others then Ptsxx00:= substrb('原因不明出错*'||sqlerrm,1,200); end; end;