⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sp_daserviceexecute.sql

📁 一整套的源代码
💻 SQL
字号:

create or replace procedure sp_daserviceexecute
(
  l_inpatientid in integer,
  l_stockoutorderid in integer,
  l_reckoningid in integer,
  l_createby in integer
)
is
  cursor c is select * from daservice where inpatientid = l_inpatientid and isactive = 0;
  r daservice%rowtype;
  l_price number(16, 4);
begin
  for r in c loop
    
    if round(trunc(sysdate, 'hh24') - trunc(r.executed, 'hh24'), 1) < 0.5 then
      raise_application_error(-20001, '12小时内不能重复执行医嘱');
    end if;

    select charge into l_price from service where serviceid = r.serviceid;
    insert into rservice
    (
      rserviceid,
      isactive,
      price,
      total,
      amount,
      reckoningid,
      unitsid,
      serviceid,
      created
    )
    values
    (
      null,
      0,
      l_price,
      r.daytimes * l_price,
      r.daytimes,
      l_reckoningid,
      null,
      r.serviceid,
      sysdate
    );
    update daservice set executed = sysdate where daserviceid = r.daserviceid;
    update daservice set stopdate = sysdate, isactive = 1 where daserviceid = r.daserviceid and istemporary = 0;
  end loop;
end;
/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -