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

📄 upatient.pas

📁 一个简单得医院图像管理系统
💻 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 + -