ubusinessobjectfactory.pas

来自「一个简单得医院图像管理系统」· PAS 代码 · 共 114 行

PAS
114
字号
unit uBusinessObjectFactory;

interface
uses Windows, Messages, SysUtils, Variants, Classes,uPublicConnection,uPubFun,
     DB,ADODB,uPatient,uTestResult,uPicture,uReference,CELL50Lib_TLB,DateUtils;
type
   TBasoPacsObjects=class(TObject)
   private
     FPatient:TPatient;
     FTestResult:TTestResult;
     FReference:TReference;
     FPicture:TBasoPicture;
    
   public
     constructor Create(Cell:TCell);reintroduce;
     destructor Destroy;override;

     //加载TEST RESULT PICTURE
     procedure LoadResultByPatient;
     //根据PATIENT ID选择对应的 TEST RESULT & PICTURE
     procedure SelectResultPictureByPatientID;

     //查询当天检验结果
     procedure QueryTodayPatientID;
     //查询其他条件的病人及其检验结果
     procedure Query(sConditon:string);
     //删除检验结果
     procedure Delete;

     property Patient:TPatient read FPatient;
     property TestResult:TTestResult read FTestResult;
     property Referecne:TReference read FReference;
     property BasoPicture:TBasoPicture read FPicture;
   end;

implementation

{ TBasoPacsObjects }

constructor TBasoPacsObjects.Create(Cell: TCell);
begin
   inherited Create;
   FPatient:=TPatient.Create;
   FTestResult:=TTestResult.Create(Cell);
   FReference:=TReference.Create(Cell);
   FPicture:=TBasoPicture.Create;
end;

procedure TBasoPacsObjects.Delete;
begin
  if FPatient.Query.Active=False then Exit;
  if FPatient.Query.RecordCount<1 then Exit;
  if FPatient.PatientID<1 then Exit;

  FPicture.DeleteCurrentAllPicture;
  FTestResult.DeleteCurrentTestResult;
  FPatient.Query.Delete;
  //SelectResultPictureByPatientID;

end;

destructor TBasoPacsObjects.Destroy;
begin
  FPatient.Free;
  FTestResult.Free;
  FReference.Free;
  FPicture.Free;
  inherited;
end;

procedure TBasoPacsObjects.LoadResultByPatient;
var
  PatientIDS:TStrings;
begin
  PatientIDS:=TStringList.Create;
try
  FPatient.GetAllPatientID(PatientIDS);
  FTestResult.QueryByPatientIDS(PatientIDS);
  FPicture.QueryByPatientIDS(PatientIDS);
finally
  PatientIDS.Free;
end;
end;

procedure TBasoPacsObjects.Query(sConditon: string);
begin
  FPatient.QueryPatient(sConditon);
  //加载数据
  LoadResultByPatient;
  //选择数据
 // SelectResultPictureByPatientID;
end;

procedure TBasoPacsObjects.QueryTodayPatientID;
var
  sConditon:string;
begin
  sConditon:='TestDate=#'+DateToStr(DateOf(Today))+'# and PatientID>0';
  FPatient.QueryPatient(sConditon);
  //加载数据
  LoadResultByPatient;
  //选择数据
  //SelectResultPictureByPatientID;
end;

procedure TBasoPacsObjects.SelectResultPictureByPatientID;
begin

  FTestResult.SelectTestResultByPatientID(FPatient.PatientID);
  FPicture.SelectTestResultByPatientID(FPatient.PatientID);
end;

end.

⌨️ 快捷键说明

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