?? upatient.pas
字號:
unit uPatient;
interface
uses Windows, Messages, SysUtils, Variants, Classes,uPublicConnection,uPubFun,
DB,ADODB;
type
TPatient=class(TObject)
private
FQuery:TADOQuery;
function GetPatientID: Integer;
function GetPatientCount: Integer;
function GetIsValidPatient: Boolean;
public
constructor Create;
destructor Destroy;override;
//根據條件查詢病人檔案
function QueryPatient(sCondition:string):Boolean;
//獲得當前病人的所有ID號
procedure GetAllPatientID(PatientIDS:TStrings);
property PatientCount:Integer read GetPatientCount;
property Query:TADOQuery read FQuery;
property PatientID:Integer read GetPatientID;
property IsValidPatient:Boolean read GetIsValidPatient;
end;
resourcestring
AdviceFN='Advice';
BedCodeFN='BedCode';
BirthdayFN='Birthday';
BirthdayUnitFN='BirthdayUnit';
BloodCharacterFN='BloodCharacter';
CheckTimeFN='CheckTime';
ClassCodeFN='ClassCode';
CollectDateFN='CollectDate';
DepartmentFN='Department';
DiagnositicFN='Diagnositic';
MarrowCharacterFN='MarrowCharacter';
MedicalRecordCodeFN='MedicalRecordCode';
OutOrInFN='OutOrIn';
PatientCodeFN='PatientCode';
PatientIDFN='PatientID';
PatientNameFN='PatientName';
ReportDateFN='ReportDate';
ReportDoctorFN='ReportDoctor';
ReportMemoFN='ReportMemo';
SampleSourceFN='SampleSource';
SendDoctorFN='SendDoctor';
SexFN='Sex';
SickSectionFN='SickSection';
SliceCodeFN='SliceCode';
TestDateFN='TestDate';
TestDoctorFN='TestDoctor';
implementation
{ TPatient }
constructor TPatient.Create;
begin
inherited;
FQuery:=TADOQuery.Create(nil);
FQuery.Connection:=GlobalConnection.Connection;
end;
destructor TPatient.Destroy;
begin
if FQuery.Active then FQuery.Active:=False;
FreeAndNil(FQuery);
inherited;
end;
procedure TPatient.GetAllPatientID(PatientIDS: TStrings);
var
sOriginBookMark:string;
sPatientID:Integer;
tem:string;
i:Integer;
begin
if Assigned(PatientIDS)=False then Exit;
PatientIDS.Clear;
if PatientCount<1 then Exit;
try
sOriginBookMark:=FQuery.Bookmark;
FQuery.DisableControls;
FQuery.First;
for i:=1 to PatientCount do
begin
sPatientID:=TBasoUtils.GetDataFromField(FQuery,PatientIDFN,-1);
tem:=IntToStr(sPatientID);
if PatientIDS.IndexOf(tem)=-1 then PatientIDS.Add(tem);
FQuery.Next;
end;
finally
FQuery.Bookmark := sOriginBookMark;
FQuery.EnableControls;
end;
end;
function TPatient.GetIsValidPatient: Boolean;
begin
Result:=(Self.PatientID>0);
end;
function TPatient.GetPatientCount: Integer;
begin
result:=-1;
if FQuery.Active=False then Exit;
Result:=FQuery.RecordCount;
end;
function TPatient.GetPatientID: Integer;
begin
Result:=-1;
if (FQuery.Active=False)or(FQuery.RecordCount<1) then Exit;
Result:=FQuery.FieldByName('PatientID').AsInteger;
end;
function TPatient.QueryPatient(sCondition: string): Boolean;
var
sSQL:string;
begin
sSQL:='select* from MARROW_PATIENT';
sCondition:=Trim(sCondition);
if sCondition<>'' then
sSQL:=sSQL+' where '+sCondition;
if FQuery.Active then FQuery.Active:=False;
FQuery.SQL.Text:=sSQL;
try
FQuery.Active:=True;
finally
result:=FQuery.Active;
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -