Constructor

TLabTest.Create

Module

fODLab

Last Modified

7/15/2014 3:26:42 PM

Comments

Functions & procedures
dialog specific event procedures follow here ----------------------------------------------

Visibility

Public/Published

Owner

TLabTest

Declaration

constructor Create(const LabTestIEN: string; Responses: TResponses);

Calls Hierarchy


TLabTest.Create
 ├LoadLabTestData
 ├GetOneSpecimen
 ├TLabTest.FillCollSampList
 ├TResponses.FindResponseByName
 ├TLabTest.IndexOfCollSamp
 ├GetOneCollSamp
 ├TLabTest.LoadAllSamples
 │ ├LoadSamples
 │ └TLabTest.FillCollSampList
 └TLabTest.SetCollSampDflts
   ├TResponses.FindResponseByName
   ├TLabTest.ChangeSpecimen
   └TLabTest.IndexOfCollSamp

Called-By Hierarchy


               TLabTest.Create
TfrmODLab.cboAvailTestSelect┘ 
     TfrmODLab.SetupDialog┤   
TfrmODLab.cboAvailTestExit┘   

Calls

Name Declaration Comments
TLabTest.FillCollSampList procedure FillCollSampList(LoadData: TStringList; DfltCollSamp: Integer); -
TResponses.FindResponseByName function FindResponseByName(const APromptID: string; AnInstance: Integer): TResponse; -
GetOneCollSamp function GetOneCollSamp(LRFSAMP: integer): TStrings; -
GetOneSpecimen function GetOneSpecimen(LRFSPEC: integer): string; -
TLabTest.IndexOfCollSamp function IndexOfCollSamp(CollSampIEN: Integer): Integer; -
TLabTest.LoadAllSamples procedure LoadAllSamples; -
LoadLabTestData procedure LoadLabTestData(LoadData: TStringList; LabTestIEN: string) ; -
TLabTest.SetCollSampDflts procedure SetCollSampDflts; -

Called-By

Name Declaration Comments
TfrmODLab.cboAvailTestSelect procedure cboAvailTestSelect(Sender: TObject); -


Source

433   constructor TLabTest.Create(const LabTestIEN: string; Responses: TResponses);
434   var
435     LoadData, OneSamp: TStringList;
436     DfltCollSamp: Integer;
437     x: string;
438     tmpResp: TResponse;
439   begin
440     LoadData := TStringList.Create;
441     try
442       LoadLabTestData(LoadData, LabTestIEN) ;
443       with LoadData do
444       begin
445         QuickOrderResponses := Responses;
446         TestID := StrToInt(LabTestIEN);
447         TestName := Piece(ExtractDefault(LoadData, 'Test Name'),U,1);
448         LabSubscript := Piece(ExtractDefault(LoadData, 'Item ID'),U,2);
449         TestReqComment := ExtractDefault(LoadData, 'ReqCom');
450         if Length(ExtractDefault(LoadData, 'Unique CollSamp')) > 0 then UniqueCollSamp := True;
451         x := ExtractDefault(LoadData, 'Unique CollSamp');                            
452         if Length(x) = 0 then x := ExtractDefault(LoadData, 'Lab CollSamp');
453         if Length(x) = 0 then x := ExtractDefault(LoadData, 'Default CollSamp');
454         if Length(x) = 0 then x := '-1';
455         DfltCollSamp := StrToInt(x);
456         SpecimenList := TStringList.Create;
457         ExtractItems(SpecimenList, LoadData, 'Specimens');
458         if LRFSPEC <> '' then SpecimenList.Add(GetOneSpecimen(StrToInt(LRFSPEC)));
459         UrgencyList := TStringList.Create;
460         if Length(ExtractDefault(LoadData, 'Default Urgency')) > 0 then  { forced urgency }
461           begin
462             ForceUrgency := True;
463             UrgencyList.Add(ExtractDefault(LoadData, 'Default Urgency'));
464             Urgency := StrToInt(Piece(ExtractDefault(LoadData, 'Default Urgency'), '^', 1));
465             uDfltUrgency := Urgency;
466           end
467         else
468           begin                 { list of urgencies }
469             ExtractItems(UrgencyList, LoadData, 'Urgencies');
470             if StrToIntDef(LRFURG, 0) > 0 then
471               Urgency := StrToInt(LRFURG)
472             else
473               Urgency := uDfltUrgency;
474           end;
475         Comment := TStringList.Create ;
476         CurWardComment := TStringList.Create;
477         ExtractText(CurWardComment, LoadData, 'GenWardInstructions');
478         CollSamp := 0;
479         CollSampList := TList.Create;
480         FillCollSampList(LoadData, DfltCollSamp);
481         with QuickOrderResponses do tmpResp := FindResponseByName('SAMPLE'  ,1);
482         if (LRFSAMP <> '') and (IndexOfCollSamp(StrToInt(LRFSAMP)) < 0) and
483            (not UniqueCollSamp) and (tmpResp = nil) then
484           begin
485             OneSamp := TStringList.Create;
486             try
487               FastAssign(GetOneCollSamp(StrToInt(LRFSAMP)), OneSamp);
488               FillCollSampList(OneSamp, CollSampList.Count);
489             finally
490               OneSamp.Free;
491             end;
492           end;
493         if (not UniqueCollSamp) and (CollSampList.Count = 0) then LoadAllSamples;
494         CollSampCount := CollSampList.Count;
495       end;
496     finally
497       LoadData.Free;
498     end;
499     SetCollSampDflts;
500   end;