1 | //kt -- Modified with SourceScanner on 8/7/2007
|
---|
2 | unit rLabs;
|
---|
3 |
|
---|
4 | interface
|
---|
5 |
|
---|
6 | uses SysUtils, Classes, ORNet, ORFn;
|
---|
7 |
|
---|
8 | function AtomicTests(const StartFrom: string; Direction: Integer): TStrings;
|
---|
9 | function Specimens(const StartFrom: string; Direction: Integer): TStrings;
|
---|
10 | function AllTests(const StartFrom: string; Direction: Integer): TStrings;
|
---|
11 | function ChemTest(const StartFrom: string; Direction: Integer): TStrings;
|
---|
12 | function Users(const StartFrom: string; Direction: Integer): TStrings;
|
---|
13 | function TestGroups(user: int64): TStrings;
|
---|
14 | function ATest(test: integer): TStrings;
|
---|
15 | function ATestGroup(testgroup: Integer; user: int64): TStrings;
|
---|
16 | procedure UTGAdd(tests: TStrings);
|
---|
17 | procedure UTGReplace(tests: TStrings; testgroup: integer);
|
---|
18 | procedure UTGDelete(testgroup: integer);
|
---|
19 | procedure SpecimenDefaults(var blood, urine, serum, plasma: string);
|
---|
20 | procedure Cumulative(Dest: TStrings; const PatientDFN: string;
|
---|
21 | daysback: integer; ADate1, ADate2: TFMDateTime; ARpc: string);
|
---|
22 | procedure RemoteLabCumulative(Dest: TStrings; const PatientDFN: string;
|
---|
23 | daysback: integer; ADate1, ADate2: TFMDateTime; ASite, ARemoteRPC: String);
|
---|
24 | procedure Interim(Dest: TStrings; const PatientDFN: string; ADate1, ADate2: TFMDateTime; ARpc: string); //*DFN*
|
---|
25 | procedure RemoteLabInterim(Dest: TStrings; const PatientDFN: string; ADate1,
|
---|
26 | ADate2: TFMDateTime; ASite, ARemoteRPC: String);
|
---|
27 | procedure Micro(Dest: TStrings; const PatientDFN: string; ADate1,
|
---|
28 | ADate2: TFMDateTime; ARpc: string); //*DFN*
|
---|
29 | procedure RemoteLabMicro(Dest: TStrings; const PatientDFN: string; ADate1,
|
---|
30 | ADate2: TFMDateTime; ASite, ARemoteRPC: String);
|
---|
31 | function InterimSelect(const PatientDFN: string; ADate1, ADate2: TFMDateTime;
|
---|
32 | tests: TStrings): TStrings; //*DFN*
|
---|
33 | function InterimGrid(const PatientDFN: string; ADate1: TFMDateTime;
|
---|
34 | direction, format: integer): TStrings; //*DFN*
|
---|
35 | function Worksheet(const PatientDFN: string; ADate1, ADate2: TFMDateTime;
|
---|
36 | spec: string; tests: TStrings): TStrings; //*DFN*
|
---|
37 | procedure Reports(Dest: TStrings; const PatientDFN: string; reportid, hstype,
|
---|
38 | ADate, section: string; Adate1, Adate2: TFMDateTime; ARpc: string); //*DFN*
|
---|
39 | procedure RemoteLabReports(Dest: TStrings; const PatientDFN: string; reportid, hstype,
|
---|
40 | ADate, section: string; Adate1, Adate2: TFMDateTime; ASite, ARemoteRPC: String);
|
---|
41 | procedure RemoteLab(Dest: TStrings; const PatientDFN: string; reportid, hstype,
|
---|
42 | ADate, section: string; Adate1, Adate2: TFMDateTime; ASite, ARemoteRPC: String);
|
---|
43 | procedure GetNewestOldest(const PatientDFN: string; var newest, oldest: string); //*DFN*
|
---|
44 | function GetChart(const PatientDFN: string; ADate1, ADate2: TFMDateTime;
|
---|
45 | spec, test: string): TStrings; //*DFN*
|
---|
46 | procedure PrintLabsToDevice(AReport, ADaysBack: Integer;
|
---|
47 | const PatientDFN, ADevice: string; ATests: TStrings;
|
---|
48 | var ErrMsg: string; ADate1, ADate2: TFMDateTime; ARemoteSiteID, ARemoteQuery: string);
|
---|
49 | function GetFormattedLabReport(AReport, ADaysBack: Integer; const PatientDFN: string;
|
---|
50 | ATests: TStrings; ADate1, ADate2: TFMDateTime; ARemoteSiteID, ARemoteQuery: string): TStrings;
|
---|
51 | function TestInfo(Test: String): TStrings;
|
---|
52 |
|
---|
53 | implementation
|
---|
54 |
|
---|
55 | uses rCore, uCore, graphics
|
---|
56 | ,DKLang //kt
|
---|
57 | ;
|
---|
58 |
|
---|
59 | function AtomicTests(const StartFrom: string; Direction: Integer): TStrings;
|
---|
60 | begin
|
---|
61 | CallV('ORWLRR ATOMICS', [StartFrom, Direction]);
|
---|
62 | MixedCaseList(RPCBrokerV.Results);
|
---|
63 | Result := RPCBrokerV.Results;
|
---|
64 | end;
|
---|
65 |
|
---|
66 | function Specimens(const StartFrom: string; Direction: Integer): TStrings;
|
---|
67 | begin
|
---|
68 | CallV('ORWLRR SPEC', [StartFrom, Direction]);
|
---|
69 | MixedCaseList(RPCBrokerV.Results);
|
---|
70 | Result := RPCBrokerV.Results;
|
---|
71 | end;
|
---|
72 |
|
---|
73 | function AllTests(const StartFrom: string; Direction: Integer): TStrings;
|
---|
74 | begin
|
---|
75 | CallV('ORWLRR ALLTESTS', [StartFrom, Direction]);
|
---|
76 | MixedCaseList(RPCBrokerV.Results);
|
---|
77 | Result := RPCBrokerV.Results;
|
---|
78 | end;
|
---|
79 |
|
---|
80 | function ChemTest(const StartFrom: string; Direction: Integer): TStrings;
|
---|
81 | begin
|
---|
82 | CallV('ORWLRR CHEMTEST', [StartFrom, Direction]);
|
---|
83 | MixedCaseList(RPCBrokerV.Results);
|
---|
84 | Result := RPCBrokerV.Results;
|
---|
85 | end;
|
---|
86 |
|
---|
87 | function Users(const StartFrom: string; Direction: Integer): TStrings;
|
---|
88 | begin
|
---|
89 | CallV('ORWLRR USERS', [StartFrom, Direction]);
|
---|
90 | MixedCaseList(RPCBrokerV.Results);
|
---|
91 | Result := RPCBrokerV.Results;
|
---|
92 | end;
|
---|
93 |
|
---|
94 | function TestGroups(user: int64): TStrings;
|
---|
95 | begin
|
---|
96 | CallV('ORWLRR TG', [user]);
|
---|
97 | MixedCaseList(RPCBrokerV.Results);
|
---|
98 | Result := RPCBrokerV.Results;
|
---|
99 | end;
|
---|
100 |
|
---|
101 | function ATest(test: integer): TStrings;
|
---|
102 | begin
|
---|
103 | CallV('ORWLRR ATESTS', [test]);
|
---|
104 | MixedCaseList(RPCBrokerV.Results);
|
---|
105 | Result := RPCBrokerV.Results;
|
---|
106 | end;
|
---|
107 |
|
---|
108 | function ATestGroup(testgroup: Integer; user: int64): TStrings;
|
---|
109 | begin
|
---|
110 | CallV('ORWLRR ATG', [testgroup, user]);
|
---|
111 | MixedCaseList(RPCBrokerV.Results);
|
---|
112 | Result := RPCBrokerV.Results;
|
---|
113 | end;
|
---|
114 |
|
---|
115 | procedure UTGAdd(tests: TStrings);
|
---|
116 | begin
|
---|
117 | CallV('ORWLRR UTGA', [tests]);
|
---|
118 | end;
|
---|
119 |
|
---|
120 | procedure UTGReplace(tests: TStrings; testgroup: integer);
|
---|
121 | begin
|
---|
122 | CallV('ORWLRR UTGR', [tests, testgroup]);
|
---|
123 | end;
|
---|
124 |
|
---|
125 | procedure UTGDelete(testgroup: integer);
|
---|
126 | begin
|
---|
127 | CallV('ORWLRR UTGD', [testgroup]);
|
---|
128 | end;
|
---|
129 |
|
---|
130 | procedure SpecimenDefaults(var blood, urine, serum, plasma: string);
|
---|
131 | begin
|
---|
132 | CallV('ORWLRR PARAM', [nil]);
|
---|
133 | blood := Piece(RPCBrokerV.Results[0], '^', 1);
|
---|
134 | urine := Piece(RPCBrokerV.Results[0], '^', 2);
|
---|
135 | serum := Piece(RPCBrokerV.Results[0], '^', 3);
|
---|
136 | plasma := Piece(RPCBrokerV.Results[0], '^', 4);
|
---|
137 | end;
|
---|
138 |
|
---|
139 | procedure Cumulative(Dest: TStrings; const PatientDFN: string; daysback: integer; ADate1, ADate2: TFMDateTime; ARpc: string); //*DFN*
|
---|
140 | begin
|
---|
141 | if Length(ARpc) > 0 then
|
---|
142 | begin
|
---|
143 | CallV(ARpc, [PatientDFN, daysback, ADate1, ADate2]);
|
---|
144 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
145 | end
|
---|
146 | else
|
---|
147 | begin
|
---|
148 | // Dest.Add('RPC is missing from report definition (file 101.24).'); <-- original line. //kt 8/7/2007
|
---|
149 | Dest.Add(DKLangConstW('rLabs_RPC_is_missing_from_report_definition_xfile_101x24xx')); //kt added 8/7/2007
|
---|
150 | // Dest.Add('Please contact Technical Support.'); <-- original line. //kt 8/7/2007
|
---|
151 | Dest.Add(DKLangConstW('rLabs_Please_contact_Technical_Supportx')); //kt added 8/7/2007
|
---|
152 | end;
|
---|
153 | end;
|
---|
154 |
|
---|
155 | procedure RemoteLabCumulative(Dest: TStrings; const PatientDFN: string;
|
---|
156 | daysback: integer; ADate1, ADate2: TFMDateTime; ASite, ARemoteRPC: String);
|
---|
157 | begin
|
---|
158 | CallV('XWB REMOTE RPC', [ASite, ARemoteRPC, 0, PatientDFN, daysback, Adate1, Adate2]);
|
---|
159 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
160 | end;
|
---|
161 |
|
---|
162 | procedure Interim(Dest: TStrings; const PatientDFN: string; ADate1, ADate2: TFMDateTime; ARpc: string); //*DFN*
|
---|
163 | begin
|
---|
164 | if Length(ARpc) > 0 then
|
---|
165 | begin
|
---|
166 | CallV(ARpc, [PatientDFN, ADate1, ADate2]);
|
---|
167 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
168 | end
|
---|
169 | else
|
---|
170 | begin
|
---|
171 | // Dest.Add('RPC is missing from report definition (file 101.24).'); <-- original line. //kt 8/7/2007
|
---|
172 | Dest.Add(DKLangConstW('rLabs_RPC_is_missing_from_report_definition_xfile_101x24xx')); //kt added 8/7/2007
|
---|
173 | // Dest.Add('Please contact Technical Support.'); <-- original line. //kt 8/7/2007
|
---|
174 | Dest.Add(DKLangConstW('rLabs_Please_contact_Technical_Supportx')); //kt added 8/7/2007
|
---|
175 | end;
|
---|
176 | end;
|
---|
177 |
|
---|
178 | procedure RemoteLabInterim(Dest: TStrings; const PatientDFN: string; ADate1,
|
---|
179 | ADate2: TFMDateTime; ASite, ARemoteRPC: String);
|
---|
180 | begin
|
---|
181 | CallV('XWB REMOTE RPC',[ASite, ARemoteRPC, 0, PatientDFN, Adate1, Adate2]);
|
---|
182 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
183 | end;
|
---|
184 |
|
---|
185 | procedure Micro(Dest: TStrings; const PatientDFN: string; ADate1, ADate2: TFMDateTime; ARpc: string); //*DFN*
|
---|
186 | begin
|
---|
187 | if Length(ARpc) > 0 then
|
---|
188 | begin
|
---|
189 | CallV(ARpc, [PatientDFN, ADate1, ADate2]);
|
---|
190 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
191 | end
|
---|
192 | else
|
---|
193 | begin
|
---|
194 | // Dest.Add('RPC is missing from report definition (file 101.24).'); <-- original line. //kt 8/7/2007
|
---|
195 | Dest.Add(DKLangConstW('rLabs_RPC_is_missing_from_report_definition_xfile_101x24xx')); //kt added 8/7/2007
|
---|
196 | // Dest.Add('Please contact Technical Support.'); <-- original line. //kt 8/7/2007
|
---|
197 | Dest.Add(DKLangConstW('rLabs_Please_contact_Technical_Supportx')); //kt added 8/7/2007
|
---|
198 | end;
|
---|
199 | end;
|
---|
200 |
|
---|
201 | procedure RemoteLabMicro(Dest: TStrings; const PatientDFN: string; ADate1,
|
---|
202 | ADate2: TFMDateTime; ASite, ARemoteRPC: String);
|
---|
203 | begin
|
---|
204 | CallV('XWB REMOTE RPC',[ASite, ARemoteRPC, 0, PatientDFN, Adate1, Adate2]);
|
---|
205 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
206 | end;
|
---|
207 |
|
---|
208 | function InterimSelect(const PatientDFN: string; ADate1, ADate2: TFMDateTime; tests: TStrings): TStrings; //*DFN*
|
---|
209 | begin
|
---|
210 | CallV('ORWLRR INTERIMS', [PatientDFN, ADate1, ADate2, tests]);
|
---|
211 | Result := RPCBrokerV.Results;
|
---|
212 | end;
|
---|
213 |
|
---|
214 | function InterimGrid(const PatientDFN: string; ADate1: TFMDateTime; direction, format: integer): TStrings; //*DFN*
|
---|
215 | begin
|
---|
216 | CallV('ORWLRR INTERIMG', [PatientDFN, ADate1, direction, format]);
|
---|
217 | Result := RPCBrokerV.Results;
|
---|
218 | end;
|
---|
219 |
|
---|
220 | function Worksheet(const PatientDFN: string; ADate1, ADate2: TFMDateTime; spec: string; tests: TStrings): TStrings; //*DFN*
|
---|
221 | begin
|
---|
222 | CallV('ORWLRR GRID', [PatientDFN, ADate1, ADate2, spec, tests]);
|
---|
223 | Result := RPCBrokerV.Results;
|
---|
224 | end;
|
---|
225 |
|
---|
226 | procedure Reports(Dest: TStrings; const PatientDFN: string; reportid, hstype, ADate, section: string; Adate1, Adate2: TFMDateTime; ARpc: string); //*DFN*
|
---|
227 | begin
|
---|
228 | if Length(ARpc) > 0 then
|
---|
229 | begin
|
---|
230 | CallV(ARpc, [PatientDFN, reportid, hstype, ADate, section, Adate2, Adate1]);
|
---|
231 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
232 | end
|
---|
233 | else
|
---|
234 | begin
|
---|
235 | // Dest.Add('RPC is missing from report definition (file 101.24).'); <-- original line. //kt 8/7/2007
|
---|
236 | Dest.Add(DKLangConstW('rLabs_RPC_is_missing_from_report_definition_xfile_101x24xx')); //kt added 8/7/2007
|
---|
237 | // Dest.Add('Please contact Technical Support.'); <-- original line. //kt 8/7/2007
|
---|
238 | Dest.Add(DKLangConstW('rLabs_Please_contact_Technical_Supportx')); //kt added 8/7/2007
|
---|
239 | end;
|
---|
240 | end;
|
---|
241 |
|
---|
242 | procedure RemoteLabReports(Dest: TStrings; const PatientDFN: string; reportid, hstype,
|
---|
243 | ADate, section: string; Adate1, Adate2: TFMDateTime; ASite, ARemoteRPC: String);
|
---|
244 | begin
|
---|
245 | CallV('XWB REMOTE RPC',[ASite, ARemoteRPC, 0, PatientDFN,
|
---|
246 | reportid + ';1', hstype, ADate, section, Adate2, Adate1]);
|
---|
247 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
248 | end;
|
---|
249 |
|
---|
250 | procedure RemoteLab(Dest: TStrings; const PatientDFN: string; reportid, hstype,
|
---|
251 | ADate, section: string; Adate1, Adate2: TFMDateTime; ASite, ARemoteRPC: String);
|
---|
252 | begin
|
---|
253 | CallV('XWB REMOTE RPC',[ASite, ARemoteRPC, 0, PatientDFN,
|
---|
254 | reportid + ';1', hstype, ADate, section, Adate2, Adate1]);
|
---|
255 | QuickCopy(RPCBrokerV.Results,Dest);
|
---|
256 | end;
|
---|
257 |
|
---|
258 | procedure GetNewestOldest(const PatientDFN: string; var newest, oldest: string); //*DFN*
|
---|
259 | begin
|
---|
260 | CallV('ORWLRR NEWOLD', [PatientDFN]);
|
---|
261 | newest := Piece(RPCBrokerV.Results[0], '^', 1);
|
---|
262 | oldest := Piece(RPCBrokerV.Results[0], '^', 2);
|
---|
263 | end;
|
---|
264 |
|
---|
265 | function GetChart(const PatientDFN: string; ADate1, ADate2: TFMDateTime; spec, test: string): TStrings; //*DFN*
|
---|
266 | begin
|
---|
267 | CallV('ORWLRR CHART', [PatientDFN, ADate1, ADate2, spec, test]);
|
---|
268 | Result := RPCBrokerV.Results;
|
---|
269 | end;
|
---|
270 |
|
---|
271 | procedure PrintLabsToDevice(AReport, ADaysBack: Integer;
|
---|
272 | const PatientDFN, ADevice: string; ATests: TStrings; var ErrMsg: string;
|
---|
273 | ADate1, ADate2: TFMDateTime; ARemoteSiteID, ARemoteQuery: string);
|
---|
274 | { prints a report on the selected device }
|
---|
275 | var
|
---|
276 | j: integer;
|
---|
277 | RemoteHandle,Report: string;
|
---|
278 | aHandles: TStringlist;
|
---|
279 | begin
|
---|
280 | aHandles := TStringList.Create;
|
---|
281 | if Length(ARemoteSiteID) > 0 then
|
---|
282 | begin
|
---|
283 | RemoteHandle := '';
|
---|
284 | for j := 0 to RemoteReports.Count - 1 do
|
---|
285 | begin
|
---|
286 | Report := TRemoteReport(RemoteReports.ReportList.Items[j]).Report;
|
---|
287 | if Report = ARemoteQuery then
|
---|
288 | begin
|
---|
289 | RemoteHandle := TRemoteReport(RemoteReports.ReportList.Items[j]).Handle
|
---|
290 | + '^' + Pieces(Report,'^',9,10);
|
---|
291 | break;
|
---|
292 | end;
|
---|
293 | end;
|
---|
294 | if Length(RemoteHandle) > 1 then
|
---|
295 | with RemoteSites.SiteList do
|
---|
296 | aHandles.Add(ARemoteSiteID + '^' + RemoteHandle);
|
---|
297 | end;
|
---|
298 | if aHandles.Count > 0 then
|
---|
299 | begin
|
---|
300 | ErrMsg := sCallV('ORWRP PRINT LAB REMOTE',[ADevice, PatientDFN, AReport, aHandles]);
|
---|
301 | if Piece(ErrMsg, U, 1) = '0' then ErrMsg := '' else ErrMsg := Piece(ErrMsg, U, 2);
|
---|
302 | end
|
---|
303 | else
|
---|
304 | begin
|
---|
305 | ErrMsg := sCallV('ORWRP PRINT LAB REPORTS',[ADevice, PatientDFN, AReport,
|
---|
306 | ADaysBack, ATests, ADate2, ADate1]);
|
---|
307 | if Piece(ErrMsg, U, 1) = '0' then ErrMsg := '' else ErrMsg := Piece(ErrMsg, U, 2);
|
---|
308 | end;
|
---|
309 | aHandles.Clear;
|
---|
310 | aHandles.Free;
|
---|
311 | end;
|
---|
312 |
|
---|
313 | function GetFormattedLabReport(AReport, ADaysBack: Integer;
|
---|
314 | const PatientDFN: string; ATests: TStrings; ADate1, ADate2: TFMDateTime;
|
---|
315 | ARemoteSiteID, ARemoteQuery: string): TStrings;
|
---|
316 | { prints a report on the selected Windows device }
|
---|
317 | var
|
---|
318 | j: integer;
|
---|
319 | RemoteHandle,Report: string;
|
---|
320 | aHandles: TStringlist;
|
---|
321 | begin
|
---|
322 | aHandles := TStringList.Create;
|
---|
323 | if Length(ARemoteSiteID) > 0 then
|
---|
324 | begin
|
---|
325 | RemoteHandle := '';
|
---|
326 | for j := 0 to RemoteReports.Count - 1 do
|
---|
327 | begin
|
---|
328 | Report := TRemoteReport(RemoteReports.ReportList.Items[j]).Report;
|
---|
329 | if Report = ARemoteQuery then
|
---|
330 | begin
|
---|
331 | RemoteHandle := TRemoteReport(RemoteReports.ReportList.Items[j]).Handle
|
---|
332 | + '^' + Pieces(Report,'^',9,10);
|
---|
333 | break;
|
---|
334 | end;
|
---|
335 | end;
|
---|
336 | if Length(RemoteHandle) > 1 then
|
---|
337 | with RemoteSites.SiteList do
|
---|
338 | aHandles.Add(ARemoteSiteID + '^' + RemoteHandle);
|
---|
339 | end;
|
---|
340 | if aHandles.Count > 0 then
|
---|
341 | begin
|
---|
342 | CallV('ORWRP PRINT WINDOWS LAB REMOTE',[PatientDFN, AReport, aHandles]);
|
---|
343 | Result := RPCBrokerV.Results;
|
---|
344 | end
|
---|
345 | else
|
---|
346 | begin
|
---|
347 | CallV('ORWRP WINPRINT LAB REPORTS',[PatientDFN, AReport, ADaysBack, ATests,
|
---|
348 | ADate2, ADate1]);
|
---|
349 | Result := RPCBrokerV.Results;
|
---|
350 | end;
|
---|
351 | aHandles.Clear;
|
---|
352 | aHandles.Free;
|
---|
353 | end;
|
---|
354 |
|
---|
355 | function TestInfo(Test: String): TStrings;
|
---|
356 | begin
|
---|
357 | CallV('ORWLRR INFO',[Test]);
|
---|
358 | Result := RPCBrokerV.Results;
|
---|
359 | end;
|
---|
360 |
|
---|
361 | end.
|
---|