Unit8.pas
资源名称:HIS.rar [点击查看]
上传用户:fjdqny
上传日期:2016-10-26
资源大小:6299k
文件大小:5k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit Unit8;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ComCtrls, StdCtrls, DB, ADODB;
- type
- TForm8 = class(TForm)
- PageControl1: TPageControl;
- TabSheet1: TTabSheet;
- TabSheet2: TTabSheet;
- Label1: TLabel;
- Edit1: TEdit;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label5: TLabel;
- Edit2: TEdit;
- Edit3: TEdit;
- Edit4: TEdit;
- Label6: TLabel;
- Label7: TLabel;
- Label8: TLabel;
- Edit5: TEdit;
- Edit6: TEdit;
- Edit7: TEdit;
- Label10: TLabel;
- Label11: TLabel;
- Label12: TLabel;
- Edit9: TEdit;
- Edit10: TEdit;
- Edit11: TEdit;
- Button1: TButton;
- Button2: TButton;
- Label13: TLabel;
- Edit12: TEdit;
- Label14: TLabel;
- Label15: TLabel;
- Label16: TLabel;
- Label17: TLabel;
- Edit13: TEdit;
- Edit14: TEdit;
- Edit15: TEdit;
- Button3: TButton;
- Button4: TButton;
- ADOConnection1: TADOConnection;
- ADOQuery1: TADOQuery;
- DataSource1: TDataSource;
- procedure Button1Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure Button3Click(Sender: TObject);
- procedure Button4Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form8: TForm8;
- Query : TADOQuery;
- aaa,bbb,ccc,ddd,eee,fff,zzz,xxx,Patno,Phone,Addr,Link,Linp,Entime,Extime,Fore,Bedno,Sex,Birth,Nation:Char;
- implementation
- {$R *.dfm}
- procedure TForm8.Button1Click(Sender: TObject);
- begin
- if (Edit5.Text<>'') and (Edit9.text<>'') then
- begin
- Query := TADOQuery.Create(nil);
- Query.Connection :=ADOConnection1;
- Query.SQL.Add('select Patno,Pat from bingren where Patno=:aaa and Pat=:bbb');
- Query.Parameters.ParamByName('aaa').Value :=edit5.Text;
- Query.Parameters.ParamByName('bbb').Value :=edit9.Text;
- Query.Open;
- if Query.RecordCount =0 then
- showmessage('此病人信息不存在,请输入正确的病人编号和姓名!!!')
- else
- begin
- // adoquery1.Open;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('insert into zhuyuanbingren(Patno,Phone,Addr,Link,Linp,Entime,Extime,Fore,Bedno) values(:Patno,:Phone,:Addr,:Link,:Linp,:Entime,:Extime,:Fore,:Bedno)');
- adoquery1.Parameters.ParamByName('Patno').Value:=Edit5.Text;
- adoquery1.Parameters.ParamByName('Phone').Value:=Edit3.Text;
- adoquery1.Parameters.ParamByName('Addr').Value:=Edit7.Text;
- adoquery1.Parameters.ParamByName('Link').Value:=Edit11.Text;
- adoquery1.Parameters.ParamByName('Linp').Value:=Edit4.Text;
- adoquery1.Parameters.ParamByName('Entime').Value:=Edit1.Text;
- adoquery1.Parameters.ParamByName('Extime').Value:='';
- adoquery1.Parameters.ParamByName('Fore').Value:=0;
- // adoquery1.Parameters.ParamByName('Bedno').Value:='''';
- adoquery1.ExecSQL;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('update bingren set Sex=:Sex,Birth=:Birth,Nation=:Nation where Patno='''+edit5.Text+'''');
- adoquery1.Parameters.ParamByName('Sex').Value:=Edit2.Text;
- adoquery1.Parameters.ParamByName('Birth').Value:=Edit6.Text;
- adoquery1.Parameters.ParamByName('Nation').Value:=Edit10.Text;
- adoquery1.ExecSQL;
- edit1.Clear;edit2.Clear;edit3.clear;edit4.clear;edit5.clear;edit6.clear;edit7.clear;edit9.clear;edit10.clear;edit11.clear;
- showmessage('数据已经添加成功!');
- end
- end
- else
- if (Edit5.Text='') then
- showmessage('请输入病人编号!')
- else
- if (Edit9.Text='') then
- showmessage('请输入病人姓名!');
- end;
- procedure TForm8.Button2Click(Sender: TObject);
- begin
- form8.Close;
- end;
- procedure TForm8.Button3Click(Sender: TObject);
- begin
- if (Edit12.Text<>'') and (Edit15.text<>'') and (Edit14.text<>'') then
- begin
- Query := TADOQuery.Create(nil);
- Query.Connection :=ADOConnection1;
- Query.SQL.Add('select Patno,Pat from bingren where Patno=:zzz and Pat=:xxx');
- Query.Parameters.ParamByName('zzz').Value :=edit12.Text;
- Query.Parameters.ParamByName('xxx').Value :=edit14.Text;
- Query.Open;
- if Query.RecordCount =0 then
- showmessage('此病人信息不存在,请输入正确的病人编号和姓名!!!')
- else
- begin
- Query := TADOQuery.Create(nil);
- Query.Connection :=ADOConnection1;
- Query.SQL.Add('select Bedno,Isfree from chuangwei where Bedno=:ccc and Isfree=:ddd');
- Query.Parameters.ParamByName('ccc').Value :=edit15.Text;
- Query.Parameters.ParamByName('ddd').Value :='是';
- Query.Open;
- if Query.RecordCount =0 then
- showmessage('此床位不存在或已经有病人,请输入正确的床位号!!!')
- else
- begin
- // adoquery1.Open;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('update zhuyuanbingren set Fore=:eee,Bedno=:fff where Patno='''+edit12.Text+'''');
- adoquery1.Parameters.ParamByName('eee').Value:=strtoint(Edit13.Text);
- adoquery1.Parameters.ParamByName('fff').Value:=Edit15.Text;
- adoquery1.ExecSQL;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('update chuangwei set Isfree=:ggg where Bedno='''+edit15.Text+'''');
- adoquery1.Parameters.ParamByName('ggg').Value:='否';
- adoquery1.ExecSQL;
- edit12.Clear;edit13.clear;edit14.clear;edit15.clear;
- showmessage('数据已经添加成功!');
- end
- end
- end
- else
- if (Edit12.Text='') then
- showmessage('请输入病人编号!')
- else
- if (Edit14.Text='') then
- showmessage('请输入病人姓名!')
- else
- if (Edit15.Text='') then
- showmessage('请输入床位编号!');
- end;
- procedure TForm8.Button4Click(Sender: TObject);
- begin
- form8.Close;
- end;
- end.