Unit9.~pas
资源名称:HIS.rar [点击查看]
上传用户:fjdqny
上传日期:2016-10-26
资源大小:6299k
文件大小:3k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit Unit9;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, Grids, DBGrids, StdCtrls, ComCtrls, DB, ADODB;
- type
- TForm9 = class(TForm)
- PageControl1: TPageControl;
- TabSheet1: TTabSheet;
- TabSheet2: TTabSheet;
- Label1: TLabel;
- Edit1: TEdit;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Edit2: TEdit;
- Edit3: TEdit;
- Edit4: TEdit;
- Button1: TButton;
- Button2: TButton;
- Label5: TLabel;
- Edit5: TEdit;
- Label6: TLabel;
- Edit6: TEdit;
- Button3: TButton;
- DBGrid1: TDBGrid;
- Button4: TButton;
- Button5: TButton;
- DataSource1: TDataSource;
- ADOQuery1: TADOQuery;
- ADOConnection1: TADOConnection;
- procedure Button1Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure Button3Click(Sender: TObject);
- procedure Button5Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form9: TForm9;
- Query : TADOQuery;
- aaa,bbb,w,ddd,eee:Char;
- implementation
- {$R *.dfm}
- procedure TForm9.Button1Click(Sender: TObject);
- begin
- if (Edit1.Text<>'') and (Edit2.text<>'')and (Edit4.text<>'') then
- begin
- Query := TADOQuery.Create(nil);
- Query.Connection :=ADOConnection1;
- Query.SQL.Add('select Patno,Bedno from zhuyuanbingren where Patno=:aaa and Bedno=:w');
- Query.Parameters.ParamByName('aaa').Value :=edit1.Text;
- Query.Parameters.ParamByName('w').Value :=edit4.Text;
- Query.Open;
- if Query.RecordCount =0 then
- showmessage('此病人信息不存在,请输入正确的病人编号和姓名和床位编号!!!')
- else
- begin
- // adoquery1.Open;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('update zhuyuanbingren set Extime=:ddd where Patno='''+edit1.Text+'''');
- adoquery1.Parameters.ParamByName('ddd').Value:=Edit2.Text;
- adoquery1.ExecSQL;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('update chuangwei set Isfree=:eee where Bedno='''+edit4.Text+'''');
- adoquery1.Parameters.ParamByName('eee').Value:='是';
- adoquery1.ExecSQL;
- edit1.Clear;edit2.Clear;edit3.clear;edit4.clear;
- showmessage('数据已经添加成功!');
- end
- end
- else
- if (Edit1.Text='') then
- showmessage('请输入病人编号!')
- else
- if (Edit2.Text='') then
- showmessage('请输入出院时间!')
- else
- if (Edit4.Text='') then
- showmessage('请输入床位编号!');
- end;
- procedure TForm9.Button2Click(Sender: TObject);
- begin
- form9.Close;
- end;
- procedure TForm9.Button3Click(Sender: TObject);
- begin
- if(Edit5.Text<>'') and (Edit6.Text<>'') then
- begin
- Query := TADOQuery.Create(nil);
- Query.Connection :=ADOConnection1;
- Query.SQL.Add('select Patno,Pat from shoufeidan where Patno =:aaa and Pat=:bbb');
- Query.Parameters.ParamByName('aaa').Value :=edit5.Text;
- Query.Parameters.ParamByName('bbb').Value :=edit6.Text;
- Query.Open;
- if Query.RecordCount =0 then //非0表示存在,0表示不存在
- showmessage('此病人信息不存在!')
- else
- begin
- adoquery1.Close;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('select Patno,Pat,Chaitem,Chasum from shoufeidan where Patno='''+edit5.Text+'''');
- adoquery1.Open;
- end
- end
- else
- if (Edit5.Text='') then
- showmessage('请输入病人编号!')
- else
- if (Edit6.Text='') then
- showmessage('请输入病人姓名!');
- end;
- procedure TForm9.Button5Click(Sender: TObject);
- begin
- form9.Close;
- end;
- end.