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

📄 outrecall.pas

📁 某大型医院护士站
💻 PAS
字号:
unit OutRecall;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ComCtrls, ExtCtrls, Buttons, Db, DBTables, Wwquery;

type
  TfrmOutRecall = class(TForm)
    Panel1: TPanel;
    btnCancel: TBitBtn;
    btnOK: TBitBtn;
    Bevel2: TBevel;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    cbIsOpenOrder: TCheckBox;
    CheckBox2: TCheckBox;
    Label1: TLabel;
    edInid: TEdit;
    Label2: TLabel;
    edBedID: TEdit;
    Label3: TLabel;
    Label4: TLabel;
    lbPatName: TLabel;
    qryPatTimeSqid: TwwQuery;
    procedure btnOKClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmOutRecall: TfrmOutRecall;

implementation

uses DataModule, HisUtilitis;

{$R *.DFM}

procedure TfrmOutRecall.btnOKClick(Sender: TObject);
var
  spResult :Integer;
begin
  if ( (Trim(edInid.Text) =  '' ) or (Trim(edBedID.Text ) = '') ) then
  begin
    HisErrorPrompt('住院号或床位号没有设定!');
    SysUtils.Abort;
  end;

  try
    if DM.ProjHisadt.InTransaction then
      DM.ProjHisadt.Commit;
    DM.ProjHisadt.StartTransaction;
    DM.spOutRecall.Params[0].AsInteger  := StrToInt(Trim(edInid.Text));
    DM.spOutRecall.Params[1].AsString   := DM.currWardid;
    DM.spOutRecall.Params[2].AsString   := Trim(edBedID.Text);
    DM.spOutRecall.Params[3].AsString   := DM.currOperatorno;

    if cbIsOpenOrder.Checked then
       DM.spOutRecall.Params[4].AsSmallInt := 1
    else
       DM.spOutRecall.Params[4].AsSmallInt := 0;

    DM.spOutRecall.Params[5].AsSmallInt := 1;
    DM.spOutRecall.Params[6].AsSmallInt := 1;
    DM.spOutRecall.ExecProc;
    DM.ProjHisAdt.Commit;

    spResult := DM.spOutRecall.Params[7].AsInteger;
    case  spResult of
      -1 : HisErrorPrompt('没有该住院号的病人资料,请认真核对住院号是否有误'
                          + #13 + '或请到住院科查询该病人是否结算出院!');
      -2 : HisErrorPrompt('该住院号的病人不是当前病区的病人!');
      -3 : HisErrorPrompt('当前床位已经有别的病人入住,请选择其他空床位!');
      -4 : HisErrorPrompt('该住院号的病人尚未定义出院!');
      -5 : HisErrorPrompt('本病区不存在该床位号!');
    end;

    if ( spResult < 0 ) then SysUtils.Abort;

    with qryPatTimeSqid do
    begin
      Close;
      Params[0].AsInteger := StrToInt(Trim(edInid.Text));
      Open;

      if ( RecordCount = 0 ) then
      begin
        HisErrorPrompt('病人资料有误,请联系系统管理员查明原因!');
        SysUtils.Abort;
      end;
    end;

    with DM do
    begin
      try
        if ProjHisadt.InTransaction then
          ProjHisadt.Commit;
        ProjHisadt.StartTransaction;
        spConfirm.Params[0].AsInteger  := StrToInt(Trim(edInid.Text));
        spConfirm.Params[1].AsSmallint := qryPatTimeSqid.FieldByName('Times').AsInteger;
        spConfirm.Params[2].AsSmallint := qryPatTimeSqid.FieldByName('Sqid').AsInteger;
        spConfirm.Params[3].AsString   := DM.currOperatorno;
        spConfirm.Params[4].AsInteger  := DM.SIsAutoAddIvdrip;
        spConfirm.Params[5].AsInteger  := 0;  //正常医嘱确认
        spConfirm.ExecProc;
        ProjHisadt.Commit;
        if spConfirm.Params[6].AsInteger < 0 then
           hisErrorPrompt('医嘱有错误,请认真查对!');
      except
        ProjHisadt.Rollback;
      end;
    end;
    
    Close;
  except
    DM.ProjHisadt.Rollback;
    HisErrorPrompt('出院召回失败!');
  end;
end;

procedure TfrmOutRecall.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  qryPatTimeSqid.Close;
end;

end.

⌨️ 快捷键说明

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