source: cprs/branches/foia-cprs/CPRS-Chart/Orders/rODLab.pas@ 459

Last change on this file since 459 was 459, checked in by Kevin Toppenberg, 16 years ago

Adding foia-cprs branch

File size: 4.0 KB
Line 
1unit rODLab;
2
3interface
4
5uses SysUtils, Classes, ORNet, ORFn, rCore, uCore, TRPCB, dialogs ;
6
7 { Laboratory Ordering Calls }
8function ODForLab(Location: integer; Division: integer = 0): TStrings;
9procedure LoadLabTestData(LoadData: TStringList; LabTestIEN: string) ;
10procedure LoadSamples(LoadList: TStringList) ;
11procedure LoadSpecimens(SpecimenList: TStringList) ;
12function SubsetOfSpecimens(const StartFrom: string; Direction: Integer): TStrings;
13function CalcStopDate(Text: string): string ;
14function MaxDays(Location, Schedule: integer): integer;
15function IsLabCollectTime(ADateTime: TFMDateTime; Location: integer): boolean;
16function ImmediateCollectTimes: TStrings;
17function LabCollectFutureDays(Location: integer; Division: integer = 0): integer;
18function GetDefaultImmCollTime: TFMDateTime;
19function ValidImmCollTime(CollTime: TFMDateTime): string;
20function GetOneCollSamp(LRFSAMP: integer): TStrings;
21function GetOneSpecimen(LRFSPEC: integer): string;
22procedure GetLabTimesForDate(Dest: TStrings; LabDate: TFMDateTime; Location: integer);
23function GetLastCollectionTime: string;
24
25implementation
26
27uses rODBase;
28(* fODBase, rODBase, fODLab;*)
29
30function ODForLab(Location, Division: integer): TStrings;
31{ Returns init values for laboratory dialog. The results must be used immediately. }
32begin
33 CallV('ORWDLR32 DEF', [Location,Division]);
34 Result := RPCBrokerV.Results;
35end;
36
37procedure LoadLabTestData(LoadData: TStringList; LabTestIEN: string) ;
38begin
39 tCallV(LoadData, 'ORWDLR32 LOAD', [LabTestIEN]);
40end ;
41
42procedure LoadSamples(LoadList: TStringList) ;
43begin
44 tCallV(LoadList, 'ORWDLR32 ALLSAMP', [nil]);
45end ;
46
47function SubsetOfSpecimens(const StartFrom: string; Direction: Integer): TStrings;
48begin
49 Callv('ORWDLR32 ALLSPEC',[StartFrom, Direction]);
50 Result := RPCBrokerV.Results;
51end ;
52
53procedure LoadSpecimens(SpecimenList: TStringList) ;
54begin
55 tCallV(SpecimenList, 'ORWDLR32 ABBSPEC', [nil]);
56end ;
57
58function CalcStopDate(Text: string): string ;
59begin
60 Result := sCallV('ORWDLR32 STOP', [Text]);
61end ;
62
63function MaxDays(Location, Schedule: integer): integer;
64begin
65 Result := StrToInt(sCallV('ORWDLR32 MAXDAYS',[Location, Schedule]));
66end;
67
68function IsLabCollectTime(ADateTime: TFMDateTime; Location: integer): boolean;
69begin
70 Result := (StrToInt(sCallV('ORWDLR32 LAB COLL TIME',[ADateTime,Location])) > 0);
71end;
72
73function LabCollectFutureDays(Location: integer; Division: integer): integer;
74begin
75 Result := StrToInt(sCallV('ORWDLR33 FUTURE LAB COLLECTS',[Location, Division]));
76end;
77
78function ImmediateCollectTimes: TStrings;
79begin
80 CallV('ORWDLR32 IMMED COLLECT',[nil]);
81 Result := RPCBrokerV.Results;
82end;
83
84function GetDefaultImmCollTime: TFMDateTime;
85begin
86 CallV('ORWDLR32 IC DEFAULT',[nil]);
87 Result := StrToFloat(Piece(RPCBrokerV.Results[0], U, 1));
88end;
89
90function ValidImmCollTime(CollTime: TFMDateTime): string;
91begin
92 CallV('ORWDLR32 IC VALID',[CollTime]);
93 Result := RPCBrokerV.Results[0];
94end;
95
96function GetOneCollSamp(LRFSAMP: integer): TStrings;
97begin
98 CallV('ORWDLR32 ONE SAMPLE', [LRFSAMP]);
99 Result := RPCBrokerV.Results;
100end;
101
102function GetOneSpecimen(LRFSPEC: integer): string;
103begin
104 Result := sCallV('ORWDLR32 ONE SPECIMEN', [LRFSPEC]);
105end;
106
107function GetLastCollectionTime: string;
108begin
109 Result := sCallV('ORWDLR33 LASTTIME', [nil]);
110end
111;
112procedure GetLabTimesForDate(Dest: TStrings; LabDate: TFMDateTime; Location: integer);
113var
114 Prefix: string;
115 i: integer;
116begin
117 CallV('ORWDLR32 GET LAB TIMES', [LabDate, Location]);
118 with Dest do
119 begin
120 Assign(RPCBrokerV.Results);
121 if (Count > 0) and (Piece(Strings[0], U, 1) <> '-1') then
122 for i := 0 to Count - 1 do
123 begin
124 if Strings[i] > '1159' then Prefix := 'PM Collection: ' else Prefix := 'AM Collection: ';
125 Strings[i] := Strings[i] + U + Prefix + Copy(Strings[i], 1, 2) + ':' + Copy(Strings[i], 3, 2);
126 end;
127 end;
128end;
129
130end.
Note: See TracBrowser for help on using the repository browser.