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

📄 babyborn.pas

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

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, wwdbdatetimepicker, DBCtrls, ComCtrls, ExtCtrls, Mask,
  wwdbedit, Db, DBTables, Wwquery, Wwtable, Wwdatsrc;

type
  TfrmBabyBorn = class(TForm)
    btnAddBaby: TBitBtn;
    btnCancel: TBitBtn;
    btnConfirm: TBitBtn;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    GroupBox1: TGroupBox;
    MotherName: TLabel;
    DBText1: TDBText;
    Label4: TLabel;
    Label5: TLabel;
    GroupBox2: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    dtpBabyDate: TDateTimePicker;
    ed_BabyName: TEdit;
    cb_Sex: TComboBox;
    Label6: TLabel;
    qryMotherInfo: TwwQuery;
    tblInsPatientSub: TwwTable;
    DBText2: TDBText;
    DBText3: TDBText;
    DBText4: TDBText;
    qryMaxSqid: TwwQuery;
    qryMaxSqidMAXSQID: TSmallintField;
    qryMotherInfoINID: TIntegerField;
    qryMotherInfoTIMES: TSmallintField;
    qryMotherInfoSQID: TSmallintField;
    qryMotherInfoPATDESC: TStringField;
    qryMotherInfoBIRTHDAY: TDateField;
    qryMotherInfoSEXNAME: TStringField;
    qryMotherInfoWARDID: TStringField;
    qryMotherInfoDEPTNUM: TStringField;
    qryMotherInfoINSTATE: TSmallintField;
    qryMotherInfoENABLED: TSmallintField;
    qryMotherInfoBEDID: TStringField;
    qryMotherInfoISBABY: TSmallintField;
    qryMotherInfoDRIPTIME: TDateTimeField;
    qryMotherInfoCLINICID: TStringField;
    qryMotherInfoISCHGDEPT: TSmallintField;
    srcMotherInfo: TwwDataSource;
    qryUpdateData: TwwQuery;
    tblInsPatientSubINID: TIntegerField;
    tblInsPatientSubTIMES: TSmallintField;
    tblInsPatientSubSQID: TSmallintField;
    tblInsPatientSubPATDESC: TStringField;
    tblInsPatientSubBIRTHDAY: TDateField;
    tblInsPatientSubSEXNAME: TStringField;
    tblInsPatientSubWARDID: TStringField;
    tblInsPatientSubDEPTNUM: TStringField;
    tblInsPatientSubINSTATE: TSmallintField;
    tblInsPatientSubENABLED: TSmallintField;
    tblInsPatientSubBEDID: TStringField;
    tblInsPatientSubISBABY: TSmallintField;
    tblInsPatientSubDRIPTIME: TDateTimeField;
    tblInsPatientSubCLINICID: TStringField;
    tblInsPatientSubISCHGDEPT: TSmallintField;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure btnConfirmClick(Sender: TObject);
  private
    function CrtBabyInfo : Boolean;
  public
    MaxSqid :Smallint;
  end;

var
  frmBabyBorn: TfrmBabyBorn;

implementation

uses DataModule, HisUtilitis;

{$R *.DFM}


function TfrmBabyBorn.CrtBabyInfo : boolean;  //病人出院
begin
  if ( Trim(ed_BabyName.Text) = '' ) then
  begin
    hisErrorPrompt('请输入新生儿姓名!!');
    Result := False;
    Exit;
  end;

  if ( Trim(cb_Sex.Text) = '' ) then
  begin
    hisErrorPrompt('请输入新生儿性别!!');
    Result := False;
    Exit;
  end;

  try
    qryMaxSqid.Close;
    qryMaxSqid.Params[0].AsInteger  := qryMotherInfoInid.Value;
    qryMaxSqid.Params[1].AsSmallint := qryMotherInfoTimes.Value;
    qryMaxSqid.Open;

    if qryMaxSqid.RecordCount = 0 then
    begin
      hisErrorPrompt('母亲的资料有误,请与系统管理员联系!!');
      Result := False;
      Exit;
    end;

    if not tblInsPatientSub.Active then tblInsPatientSub.Open;

    tblInsPatientSub.Edit;

    tblInsPatientSubInid.Value     := qryMotherInfoInid.Value;
    tblInsPatientSubTimes.Value    := qryMotherInfoTimes.Value;
    tblInsPatientSubSqid.Value     := qryMaxSqidMaxSqid.Value + 1;
    tblInsPatientSubPatDesc.Value  := Trim(ed_BabyName.Text);
    tblInsPatientSubBirthDay.Value := Trunc(dtpBabyDate.Date);
    tblInsPatientSubSexName.Value  := Trim(cb_Sex.Text);
    tblInsPatientSubWardID.Value   := qryMotherInfoWardID.Value;
    tblInsPatientSubDeptNum.Value  := qryMotherInfoDeptNum.Value;
    tblInsPatientSubInState.Value  := 1;
    tblInsPatientSubEnabled.Value  := 1;
    tblInsPatientSubBedID.Value    := qryMotherInfoBedID.Value;
    tblInsPatientSubIsBaBy.Value   := 1;
    tblInsPatientSubDripTime.Clear;
    tblInsPatientSubClinICID.Value := qryMotherInfoClinICID.Value;
    tblInsPatientSubIsChgDept.Value:= 0;

    tblInsPatientSub.Post;

    with qryUpdateData do
    begin
      Close;
      SQL.Clear;
      SQL.Add('UPDATE WARDBED SET ISBORNED = 1 ');
      SQL.Add('WHERE WARDID  = :P_WARDID  ');
      SQL.Add('  AND DEPTNUM = :P_DEPTNUM  ');
      SQL.Add('  AND BED     = :P_BEDID  ');
      Params[0].AsString := qryMotherInfoWardID.Value;
      Params[1].AsString := qryMotherInfoDeptNum.Value;
      Params[2].AsString := qryMotherInfoBedID.Value;
      ExecSQL;
    end;

    Result := True;
  except
    tblInsPatientSub.Cancel;
    Result := False;
  end;
end;

procedure TfrmBabyBorn.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  tblInsPatientSub.Close;
  qryMaxSqid.Close;
  qryMotherInfo.Close;
end;

procedure TfrmBabyBorn.btnConfirmClick(Sender: TObject);
begin
  if CrtBabyInfo then
  begin
    HisInfoPrompt('已经成功生成新生儿的资料!!');
    Close;
  end;
end;

end.

⌨️ 快捷键说明

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