1 | unit rCore;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses SysUtils, Classes, Forms, ORNet, ORFn, ORClasses;
|
---|
6 |
|
---|
7 | { record types used to return data from the RPC's. Generally, the delimited strings returned
|
---|
8 | by the RPC are mapped into the records defined below. }
|
---|
9 |
|
---|
10 | const
|
---|
11 | UC_UNKNOWN = 0; // user class unknown
|
---|
12 | UC_CLERK = 1; // user class clerk
|
---|
13 | UC_NURSE = 2; // user class nurse
|
---|
14 | UC_PHYSICIAN = 3; // user class physician
|
---|
15 |
|
---|
16 | type
|
---|
17 | TUserInfo = record // record for ORWU USERINFO
|
---|
18 | DUZ: Int64;
|
---|
19 | Name: string;
|
---|
20 | UserClass: Integer;
|
---|
21 | CanSignOrders: Boolean;
|
---|
22 | IsProvider: Boolean;
|
---|
23 | OrderRole: Integer;
|
---|
24 | NoOrdering: Boolean;
|
---|
25 | DTIME: Integer;
|
---|
26 | CountDown: Integer;
|
---|
27 | EnableVerify: Boolean;
|
---|
28 | NotifyAppsWM: Boolean;
|
---|
29 | PtMsgHang: Integer;
|
---|
30 | Domain: string;
|
---|
31 | Service: Integer;
|
---|
32 | AutoSave: Integer;
|
---|
33 | InitialTab: Integer;
|
---|
34 | UseLastTab: Boolean;
|
---|
35 | WebAccess: Boolean;
|
---|
36 | IsRPL: string;
|
---|
37 | RPLList: string;
|
---|
38 | HasCorTabs: Boolean;
|
---|
39 | HasRptTab: Boolean;
|
---|
40 | IsReportsOnly: Boolean;
|
---|
41 | ToolsRptEdit: Boolean;
|
---|
42 | DisableHold: Boolean;
|
---|
43 | GECStatusCheck: Boolean;
|
---|
44 | StationNumber: string;
|
---|
45 | IsProductionAccount: boolean;
|
---|
46 | end;
|
---|
47 |
|
---|
48 | TPtIDInfo = record // record for ORWPT IDINFO
|
---|
49 | Name: string;
|
---|
50 | SSN: string;
|
---|
51 | DOB: string;
|
---|
52 | Age: string;
|
---|
53 | Sex: string;
|
---|
54 | SCSts: string;
|
---|
55 | Vet: string;
|
---|
56 | Location: string;
|
---|
57 | RoomBed: string;
|
---|
58 | //ADD VWPT BELOW FOR HRN
|
---|
59 | HRN : string;
|
---|
60 | AltHRN :string;
|
---|
61 | end;
|
---|
62 |
|
---|
63 | TPtSelect = record // record for ORWPT SELECT
|
---|
64 | Name: string;
|
---|
65 | ICN: string;
|
---|
66 | SSN: string;
|
---|
67 | DOB: TFMDateTime;
|
---|
68 | Age: Integer;
|
---|
69 | Sex: Char;
|
---|
70 | LocationIEN: Integer;
|
---|
71 | Location: string;
|
---|
72 | WardService: string;
|
---|
73 | RoomBed: string;
|
---|
74 | SpecialtyIEN: Integer;
|
---|
75 | CWAD: string;
|
---|
76 | Restricted: Boolean;
|
---|
77 | AdmitTime: TFMDateTime;
|
---|
78 | ServiceConnected: Boolean;
|
---|
79 | SCPercent: Integer;
|
---|
80 | PrimaryTeam: string;
|
---|
81 | PrimaryProvider: string;
|
---|
82 | Attending: string;
|
---|
83 | //ADD VWPT BELOW FOR HRN AltHRN
|
---|
84 | HRN : string;
|
---|
85 | AltHRN : string;
|
---|
86 | end;
|
---|
87 |
|
---|
88 | TEncounterText = record // record for ORWPT ENCTITL
|
---|
89 | LocationName: string;
|
---|
90 | LocationAbbr: string;
|
---|
91 | RoomBed: string;
|
---|
92 | ProviderName: string;
|
---|
93 | end;
|
---|
94 |
|
---|
95 | { Date/Time functions - right now these make server calls to use server time}
|
---|
96 |
|
---|
97 | function FMToday: TFMDateTime;
|
---|
98 | function FMNow: TFMDateTime;
|
---|
99 | function MakeRelativeDateTime(FMDateTime: TFMDateTime): string;
|
---|
100 | function StrToFMDateTime(const AString: string): TFMDateTime;
|
---|
101 | function ValidDateTimeStr(const AString, Flags: string): TFMDateTime;
|
---|
102 | procedure ListDateRangeClinic(Dest: TStrings);
|
---|
103 |
|
---|
104 | { General calls }
|
---|
105 |
|
---|
106 | function GetProgramFilesPath: String;
|
---|
107 | function ExternalName(IEN: Int64; FileNumber: Double): string;
|
---|
108 | function PersonHasKey(APerson: Int64; const AKey: string): Boolean;
|
---|
109 | function GlobalRefForFile(const FileID: string): string;
|
---|
110 | function SubsetOfGeneric(const StartFrom: string; Direction: Integer; const GlobalRef: string): TStrings;
|
---|
111 | function SubsetOfDevices(const StartFrom: string; Direction: Integer): TStrings;
|
---|
112 | function SubSetOfPersons(const StartFrom: string; Direction: Integer): TStrings;
|
---|
113 | function SubSetOfActiveAndInactivePersons(const StartFrom: string; Direction: Integer): TStrings;
|
---|
114 | function GetDefaultPrinter(DUZ: Int64; Location: integer): string;
|
---|
115 |
|
---|
116 | { User specific calls }
|
---|
117 |
|
---|
118 | function GetUserInfo: TUserInfo;
|
---|
119 | function GetUserParam(const AParamName: string): string;
|
---|
120 | function HasSecurityKey(const KeyName: string): Boolean;
|
---|
121 | function HasMenuOptionAccess(const OptionName: string): Boolean;
|
---|
122 | function ValidESCode(const ACode: string): Boolean;
|
---|
123 |
|
---|
124 | { Notifications calls }
|
---|
125 |
|
---|
126 | procedure LoadNotifications(Dest: TStrings);
|
---|
127 | procedure DeleteAlert(XQAID: string);
|
---|
128 | procedure DeleteAlertForUser(XQAID: string);
|
---|
129 | function GetXQAData(XQAID: string): string;
|
---|
130 | function GetTIUAlertInfo(XQAID: string): string;
|
---|
131 | procedure UpdateUnsignedOrderAlerts(PatientDFN: string);
|
---|
132 | function UnsignedOrderAlertFollowup(XQAID: string): string;
|
---|
133 | procedure UpdateExpiringMedAlerts(PatientDFN: string);
|
---|
134 | procedure UpdateExpiringFlaggedOIAlerts(PatientDFN: string; FollowUp: integer);
|
---|
135 | procedure AutoUnflagAlertedOrders(PatientDFN, XQAID: string);
|
---|
136 | procedure UpdateUnverifiedMedAlerts(PatientDFN: string);
|
---|
137 | procedure UpdateUnverifiedOrderAlerts(PatientDFN: string);
|
---|
138 | function GetNotificationFollowUpText(PatientDFN: string; Notification: integer; XQADATA: string): TStrings;
|
---|
139 | procedure ForwardAlert(XQAID: string; Recip: string; FWDtype: string; Comment: string);
|
---|
140 | procedure RenewAlert(XQAID: string);
|
---|
141 | function GetSortMethod: string;
|
---|
142 | procedure SetSortMethod(Sort: string; Direction: string);
|
---|
143 |
|
---|
144 | { Patient List calls }
|
---|
145 |
|
---|
146 | function DfltPtList: string;
|
---|
147 | function DfltPtListSrc: Char;
|
---|
148 | procedure SavePtListDflt(const x: string);
|
---|
149 | procedure ListSpecialtyAll(Dest: TStrings);
|
---|
150 | procedure ListTeamAll(Dest: TStrings);
|
---|
151 | procedure ListWardAll(Dest: TStrings);
|
---|
152 | procedure ListProviderTop(Dest: TStrings);
|
---|
153 | function SubSetOfProviders(const StartFrom: string; Direction: Integer): TStrings;
|
---|
154 | procedure ListClinicTop(Dest: TStrings);
|
---|
155 | function SubSetOfClinics(const StartFrom: string; Direction: Integer): TStrings;
|
---|
156 | function GetDfltSort: string;
|
---|
157 | procedure ResetDfltSort;
|
---|
158 | procedure ListPtByDflt(Dest: TStrings);
|
---|
159 | procedure ListPtByProvider(Dest: TStrings; ProviderIEN: Int64);
|
---|
160 | procedure ListPtByTeam(Dest: TStrings; TeamIEN: Integer);
|
---|
161 | procedure ListPtBySpecialty(Dest: TStrings; SpecialtyIEN: Integer);
|
---|
162 | procedure ListPtByClinic(Dest: TStrings; ClinicIEN: Integer; FirstDt, LastDt: string);
|
---|
163 | procedure ListPtByWard(Dest: TStrings; WardIEN: Integer);
|
---|
164 | procedure ListPtByLast5(Dest: TStrings; const Last5: string);
|
---|
165 | procedure ListPtByRPLLast5(Dest: TStrings; const Last5: string);
|
---|
166 | procedure ListPtByFullSSN(Dest: TStrings; const FullSSN: string);
|
---|
167 | procedure ListPtByRPLFullSSN(Dest: TStrings; const FullSSN: string);
|
---|
168 | procedure ListPtTop(Dest: TStrings);
|
---|
169 | function SubSetOfPatients(const StartFrom: string; Direction: Integer): TStrings;
|
---|
170 | function DfltDateRangeClinic: string;
|
---|
171 | function MakeRPLPtList(RPLList: string): string;
|
---|
172 | function ReadRPLPtList(RPLJobNumber: string; const StartFrom: string; Direction: Integer) : TStrings;
|
---|
173 | procedure KillRPLPtList(RPLJobNumber: string);
|
---|
174 |
|
---|
175 | // VWPT ADDITIONS FOR ENHANCED PATIENT LOOKUP
|
---|
176 | procedure ListPtByOther (Dest: Tstrings; const othertext: string ;caption :string);//:string; radbutton:Tobject);
|
---|
177 | procedure ListPtByTimson (Dest: Tstrings; const othertext: string);
|
---|
178 | //end VWPT
|
---|
179 |
|
---|
180 | { Patient specific calls }
|
---|
181 |
|
---|
182 | function CalcAge(BirthDate, DeathDate: TFMDateTime): Integer;
|
---|
183 | procedure CheckSensitiveRecordAccess(const DFN: string; var AccessStatus: Integer;
|
---|
184 | var MessageText: string);
|
---|
185 | procedure CheckRemotePatient(var Dest: string; Patient, ASite: string; var AccessStatus: Integer);
|
---|
186 | procedure CurrentLocationForPatient(const DFN: string; var ALocation: Integer; var AName: string; var ASvc: string);
|
---|
187 | function DateOfDeath(const DFN: string): TFMDateTime;
|
---|
188 | function GetPtIDInfo(const DFN: string): TPtIDInfo;
|
---|
189 | function HasLegacyData(const DFN: string; var AMsg: string): Boolean;
|
---|
190 | function LogSensitiveRecordAccess(const DFN: string): Boolean;
|
---|
191 | function MeansTestRequired(const DFN: string; var AMsg: string): Boolean;
|
---|
192 | function RestrictedPtRec(const DFN: string): Boolean;
|
---|
193 | procedure SelectPatient(const DFN: string; var PtSelect: TPtSelect);
|
---|
194 | function SimilarRecordsFound(const DFN: string; var AMsg: string): Boolean;
|
---|
195 | function GetDFNFromICN(AnICN: string): string;
|
---|
196 |
|
---|
197 | { Encounter specific calls }
|
---|
198 |
|
---|
199 | function GetEncounterText(const DFN: string; Location: integer; Provider: Int64): TEncounterText; //*DFN*
|
---|
200 | procedure ListApptAll(Dest: TStrings; const DFN: string; From: TFMDateTime = 0;
|
---|
201 | Thru: TFMDateTime = 0);
|
---|
202 | procedure ListAdmitAll(Dest: TStrings; const DFN: string);
|
---|
203 | function SubSetOfLocations(const StartFrom: string; Direction: Integer): TStrings;
|
---|
204 | function SubSetOfNewLocs(const StartFrom: string; Direction: Integer): TStrings;
|
---|
205 | function SubSetOfInpatientLocations(const StartFrom: string; Direction: Integer): TStrings;
|
---|
206 | function SubSetOfProvWithClass(const StartFrom: string; Direction: Integer; DateTime: string): TStrings;
|
---|
207 | function SubSetOfUsersWithClass(const StartFrom: string; Direction: Integer; DateTime: string): TStrings;
|
---|
208 |
|
---|
209 | { Remote Data Access calls }
|
---|
210 | function HasRemoteData(const DFN: string; var ALocations: TStringList): Boolean;
|
---|
211 | function CheckHL7TCPLink: Boolean;
|
---|
212 | function UseVistaWeb: Boolean;
|
---|
213 | function GetVistaWebAddress(value: string): string;
|
---|
214 | procedure ChangeVistaWebParam(value: string);
|
---|
215 |
|
---|
216 | implementation
|
---|
217 |
|
---|
218 | uses Hash, uCore, ShlObj, Windows;
|
---|
219 |
|
---|
220 | var
|
---|
221 | uFMToday: TFMDateTime; // Today's date in Fileman format.
|
---|
222 | uPtListDfltSort: string = ''; // Current user's patient selection list default sort order.
|
---|
223 |
|
---|
224 | { private calls }
|
---|
225 |
|
---|
226 | function FormatSSN(const x: string): string;
|
---|
227 | {places the dashes in a social security number }
|
---|
228 |
|
---|
229 | //vwpt code 4/17/0 see below
|
---|
230 | var
|
---|
231 |
|
---|
232 | i:Integer;
|
---|
233 | //end vwpt
|
---|
234 | begin
|
---|
235 | //vwpt code to prevent extra dashes 4/17/07
|
---|
236 | Result := x;
|
---|
237 | ///take out for i := 1 to Length(x) do if (x[i] in ['-'..'-']) then Exit;
|
---|
238 | //end vwpt
|
---|
239 | if Length(x) > 8
|
---|
240 | then Result := Copy(x,1,3) + '-' + Copy(x,4,2) + '-' + Copy(x,6,Length(x))
|
---|
241 | else Result := x;
|
---|
242 | end;
|
---|
243 |
|
---|
244 | function IsSSN(const x: string): Boolean;
|
---|
245 | var
|
---|
246 | i: Integer;
|
---|
247 | begin
|
---|
248 | Result := False;
|
---|
249 | if (Length(x) < 9) or (Length(x) > 10) then Exit;
|
---|
250 | for i := 1 to 9 do if not (x[i] in ['0'..'9']) then Exit;
|
---|
251 | Result := True;
|
---|
252 | end;
|
---|
253 |
|
---|
254 | function IsFMDate(const x: string): Boolean;
|
---|
255 | var
|
---|
256 | i: Integer;
|
---|
257 | begin
|
---|
258 | Result := False;
|
---|
259 | if Length(x) <> 7 then Exit;
|
---|
260 | for i := 1 to 7 do if not (x[i] in ['0'..'9']) then Exit;
|
---|
261 | Result := True;
|
---|
262 | end;
|
---|
263 |
|
---|
264 | { Date/Time functions - not in ORFn because they make server calls to use server time}
|
---|
265 |
|
---|
266 | function FMToday: TFMDateTime;
|
---|
267 | { return the current date in Fileman format }
|
---|
268 | begin
|
---|
269 | if uFMToday = 0 then uFMToday := Int(FMNow);
|
---|
270 | Result := uFMToday;
|
---|
271 | end;
|
---|
272 |
|
---|
273 | function FMNow: TFMDateTime;
|
---|
274 | { return the current date/time in Fileman format }
|
---|
275 | var
|
---|
276 | x: string;
|
---|
277 | begin
|
---|
278 | x := sCallV('ORWU DT', ['NOW']);
|
---|
279 | Result := StrToFloat(x);
|
---|
280 | end;
|
---|
281 |
|
---|
282 | function MakeRelativeDateTime(FMDateTime: TFMDateTime): string;
|
---|
283 | var
|
---|
284 | Offset: Integer;
|
---|
285 | h,n,s,l: Word;
|
---|
286 | ADateTime: TDateTime;
|
---|
287 | ATime: string;
|
---|
288 | begin
|
---|
289 | Result := '';
|
---|
290 | if FMDateTime <= 0 then Exit;
|
---|
291 | ADateTime := FMDateTimeToDateTime(FMDateTime);
|
---|
292 | Offset := Trunc(Int(ADateTime) - Int(FMDateTimeToDateTime(FMToday)));
|
---|
293 | if Offset < 0 then Result := 'T' + IntToStr(Offset)
|
---|
294 | else if Offset = 0 then Result := 'T'
|
---|
295 | else Result := 'T+' + IntToStr(Offset);
|
---|
296 | DecodeTime(ADateTime, h, n, s, l);
|
---|
297 | ATime := Format('@%.2d:%.2d', [h, n]);
|
---|
298 | if ATime <> '@00:00' then Result := Result + ATime;
|
---|
299 | end;
|
---|
300 |
|
---|
301 | function StrToFMDateTime(const AString: string): TFMDateTime;
|
---|
302 | { use %DT the validate and convert a string to Fileman format (accepts T, T-1, NOW, etc.) }
|
---|
303 | var
|
---|
304 | x: string;
|
---|
305 | begin
|
---|
306 | x := sCallV('ORWU DT', [AString]);
|
---|
307 | Result := StrToFloat(x);
|
---|
308 | end;
|
---|
309 |
|
---|
310 | function ValidDateTimeStr(const AString, Flags: string): TFMDateTime;
|
---|
311 | { use %DT to validate & convert a string to Fileman format, accepts %DT flags }
|
---|
312 | begin
|
---|
313 | Result := StrToFloat(sCallV('ORWU VALDT', [AString, Flags]));
|
---|
314 | end;
|
---|
315 |
|
---|
316 | procedure ListDateRangeClinic(Dest: TStrings);
|
---|
317 | { returns date ranges for displaying clinic appointments in patient lookup }
|
---|
318 | begin
|
---|
319 | CallV('ORWPT CLINRNG', [nil]);
|
---|
320 | Dest.Assign(RPCBrokerV.Results);
|
---|
321 | end;
|
---|
322 |
|
---|
323 | function DfltDateRangeClinic;
|
---|
324 | { returns current default date range settings for displaying clinic appointments in patient lookup }
|
---|
325 | begin
|
---|
326 | Result := sCallV('ORQPT DEFAULT CLINIC DATE RANG', [nil]);
|
---|
327 | end;
|
---|
328 |
|
---|
329 | { General calls }
|
---|
330 |
|
---|
331 | function GetProgramFilesPath: String;
|
---|
332 | Const
|
---|
333 | CSIDL_PROGRAM_FILES = $0026;
|
---|
334 | var
|
---|
335 | Path: array[0..Max_Path] of Char;
|
---|
336 | begin
|
---|
337 | Path := '';
|
---|
338 | SHGetSpecialFolderPath(0,Path,CSIDL_PROGRAM_FILES,false);
|
---|
339 | Result := Path;
|
---|
340 | end;
|
---|
341 |
|
---|
342 | function ExternalName(IEN: Int64; FileNumber: Double): string;
|
---|
343 | { returns the external name of the IEN within a file }
|
---|
344 | begin
|
---|
345 | Result := sCallV('ORWU EXTNAME', [IEN, FileNumber]);
|
---|
346 | end;
|
---|
347 |
|
---|
348 | function PersonHasKey(APerson: Int64; const AKey: string): Boolean;
|
---|
349 | begin
|
---|
350 | Result := sCallV('ORWU NPHASKEY', [APerson, AKey]) = '1';
|
---|
351 | end;
|
---|
352 |
|
---|
353 | function GlobalRefForFile(const FileID: string): string;
|
---|
354 | begin
|
---|
355 | Result := sCallV('ORWU GBLREF', [FileID]);
|
---|
356 | end;
|
---|
357 |
|
---|
358 | function SubsetOfGeneric(const StartFrom: string; Direction: Integer; const GlobalRef: string): TStrings;
|
---|
359 | begin
|
---|
360 | CallV('ORWU GENERIC', [StartFrom, Direction, GlobalRef]);
|
---|
361 | Result := RPCBrokerV.Results;
|
---|
362 | end;
|
---|
363 |
|
---|
364 | function SubsetOfDevices(const StartFrom: string; Direction: Integer): TStrings;
|
---|
365 | { returns a pointer to a list of devices (for use in a long list box) - The return value is
|
---|
366 | a pointer to RPCBrokerV.Results, so the data must be used BEFORE the next broker call! }
|
---|
367 | begin
|
---|
368 | CallV('ORWU DEVICE', [StartFrom, Direction]);
|
---|
369 | Result := RPCBrokerV.Results;
|
---|
370 | end;
|
---|
371 |
|
---|
372 | function SubSetOfPersons(const StartFrom: string; Direction: Integer): TStrings;
|
---|
373 | { returns a pointer to a list of persons (for use in a long list box) - The return value is
|
---|
374 | a pointer to RPCBrokerV.Results, so the data must be used BEFORE the next broker call! }
|
---|
375 | begin
|
---|
376 | CallV('ORWU NEWPERS', [StartFrom, Direction]);
|
---|
377 | // MixedCaseList(RPCBrokerV.Results);
|
---|
378 | Result := RPCBrokerV.Results;
|
---|
379 | end;
|
---|
380 |
|
---|
381 | { User specific calls }
|
---|
382 |
|
---|
383 | function GetUserInfo: TUserInfo;
|
---|
384 | { returns a record of user information,
|
---|
385 | Pieces: DUZ^NAME^USRCLS^CANSIGN^ISPROVIDER^ORDERROLE^NOORDER^DTIME^CNTDN^VERORD^NOTIFYAPPS^
|
---|
386 | MSGHANG^DOMAIN^SERVICE^AUTOSAVE^INITTAB^LASTTAB^WEBACCESS^ALLOWHOLD^ISRPL^RPLLIST^
|
---|
387 | CORTABS^RPTTAB^STATION#^GECStatus^Production account?}
|
---|
388 | var
|
---|
389 | x: string;
|
---|
390 | begin
|
---|
391 | x := sCallV('ORWU USERINFO', [nil]);
|
---|
392 | with Result do
|
---|
393 | begin
|
---|
394 | DUZ := StrToInt64Def(Piece(x, U, 1), 0);
|
---|
395 | Name := Piece(x, U, 2);
|
---|
396 | UserClass := StrToIntDef(Piece(x, U, 3), 0);
|
---|
397 | CanSignOrders := Piece(x, U, 4) = '1';
|
---|
398 | IsProvider := Piece(x, U, 5) = '1';
|
---|
399 | OrderRole := StrToIntDef(Piece(x, U, 6), 0);
|
---|
400 | NoOrdering := Piece(x, U, 7) = '1';
|
---|
401 | DTIME := StrToIntDef(Piece(x, U, 8), 300);
|
---|
402 | CountDown := StrToIntDef(Piece(x, U, 9), 10);
|
---|
403 | EnableVerify := Piece(x, U, 10) = '1';
|
---|
404 | NotifyAppsWM := Piece(x, U, 11) = '1';
|
---|
405 | PtMsgHang := StrToIntDef(Piece(x, U, 12), 5);
|
---|
406 | Domain := Piece(x, U, 13);
|
---|
407 | Service := StrToIntDef(Piece(x, U, 14), 0);
|
---|
408 | AutoSave := StrToIntDef(Piece(x, U, 15), 180);
|
---|
409 | InitialTab := StrToIntDef(Piece(x, U, 16), 1);
|
---|
410 | UseLastTab := Piece(x, U, 17) = '1';
|
---|
411 | WebAccess := Piece(x, U, 18) <> '1';
|
---|
412 | DisableHold := Piece(x, U, 19) = '1';
|
---|
413 | IsRPL := Piece(x, U, 20);
|
---|
414 | RPLList := Piece(x, U, 21);
|
---|
415 | HasCorTabs := Piece(x, U, 22) = '1';
|
---|
416 | HasRptTab := Piece(x, U, 23) = '1';
|
---|
417 | StationNumber := Piece(x, U, 24);
|
---|
418 | GECStatusCheck := Piece(x, U, 25) = '1';
|
---|
419 | IsProductionAccount := Piece(x, U, 26) = '1';
|
---|
420 | IsReportsOnly := false;
|
---|
421 | if ((HasRptTab) and (not HasCorTabs)) then
|
---|
422 | IsReportsOnly := true;
|
---|
423 | // Remove next if and nested if should an "override" later be provided for RPL users,etc.:
|
---|
424 | if HasCorTabs then
|
---|
425 | if (IsRPL = '1') then
|
---|
426 | begin
|
---|
427 | IsRPL := '0'; // Hard set for now.
|
---|
428 | IsReportsOnly := false;
|
---|
429 | end;
|
---|
430 | // Following hard set to TRUE per VHA mgt decision:
|
---|
431 | ToolsRptEdit := true;
|
---|
432 | // x := GetUserParam('ORWT TOOLS RPT SETTINGS OFF');
|
---|
433 | // if x = '1' then
|
---|
434 | // ToolsRptEdit := false;
|
---|
435 | end;
|
---|
436 | end;
|
---|
437 |
|
---|
438 | function GetUserParam(const AParamName: string): string;
|
---|
439 | begin
|
---|
440 | Result := sCallV('ORWU PARAM', [AParamName]);
|
---|
441 | end;
|
---|
442 |
|
---|
443 | function HasSecurityKey(const KeyName: string): Boolean;
|
---|
444 | { returns true if the currently logged in user has a given security key }
|
---|
445 | var
|
---|
446 | x: string;
|
---|
447 | begin
|
---|
448 | Result := False;
|
---|
449 | x := sCallV('ORWU HASKEY', [KeyName]);
|
---|
450 | if x = '1' then Result := True;
|
---|
451 | end;
|
---|
452 |
|
---|
453 | function HasMenuOptionAccess(const OptionName: string): Boolean;
|
---|
454 | begin
|
---|
455 | Result := (sCallV('ORWU HAS OPTION ACCESS', [OptionName]) = '1');
|
---|
456 | end;
|
---|
457 |
|
---|
458 | function ValidESCode(const ACode: string): Boolean;
|
---|
459 | { returns true if the electronic signature code in ACode is valid }
|
---|
460 | begin
|
---|
461 | Result := sCallV('ORWU VALIDSIG', [Encrypt(ACode)]) = '1';
|
---|
462 | end;
|
---|
463 |
|
---|
464 | { Notifications Calls }
|
---|
465 |
|
---|
466 | procedure LoadNotifications(Dest: TStrings);
|
---|
467 | var
|
---|
468 | tmplst: TStringList;
|
---|
469 | begin
|
---|
470 | tmplst := TStringList.Create;
|
---|
471 | try
|
---|
472 | //UpdateUnsignedOrderAlerts(Patient.DFN); //moved to AFTER signature and DC actions
|
---|
473 | tCallV(tmplst, 'ORWORB FASTUSER', [nil]);
|
---|
474 | Dest.Assign(tmplst);
|
---|
475 | finally
|
---|
476 | tmplst.Free;
|
---|
477 | end;
|
---|
478 | end;
|
---|
479 |
|
---|
480 | procedure UpdateUnsignedOrderAlerts(PatientDFN: string);
|
---|
481 | begin
|
---|
482 | CallV('ORWORB KILL UNSIG ORDERS ALERT',[PatientDFN]);
|
---|
483 | end;
|
---|
484 |
|
---|
485 | function UnsignedOrderAlertFollowup(XQAID: string): string;
|
---|
486 | begin
|
---|
487 | Result := sCallV('ORWORB UNSIG ORDERS FOLLOWUP',[XQAID]);
|
---|
488 | end;
|
---|
489 |
|
---|
490 | procedure UpdateExpiringMedAlerts(PatientDFN: string);
|
---|
491 | begin
|
---|
492 | CallV('ORWORB KILL EXPIR MED ALERT',[PatientDFN]);
|
---|
493 | end;
|
---|
494 |
|
---|
495 | procedure UpdateExpiringFlaggedOIAlerts(PatientDFN: string; FollowUp: integer);
|
---|
496 | begin
|
---|
497 | CallV('ORWORB KILL EXPIR OI ALERT',[PatientDFN, FollowUp]);
|
---|
498 | end;
|
---|
499 |
|
---|
500 | procedure UpdateUnverifiedMedAlerts(PatientDFN: string);
|
---|
501 | begin
|
---|
502 | CallV('ORWORB KILL UNVER MEDS ALERT',[PatientDFN]);
|
---|
503 | end;
|
---|
504 |
|
---|
505 | procedure UpdateUnverifiedOrderAlerts(PatientDFN: string);
|
---|
506 | begin
|
---|
507 | CallV('ORWORB KILL UNVER ORDERS ALERT',[PatientDFN]);
|
---|
508 | end;
|
---|
509 |
|
---|
510 | procedure AutoUnflagAlertedOrders(PatientDFN, XQAID: string);
|
---|
511 | begin
|
---|
512 | CallV('ORWORB AUTOUNFLAG ORDERS',[PatientDFN, XQAID]);
|
---|
513 | end;
|
---|
514 |
|
---|
515 | procedure DeleteAlert(XQAID: string);
|
---|
516 | //deletes an alert
|
---|
517 | begin
|
---|
518 | CallV('ORB DELETE ALERT',[XQAID]);
|
---|
519 | end;
|
---|
520 |
|
---|
521 | procedure DeleteAlertForUser(XQAID: string);
|
---|
522 | //deletes an alert
|
---|
523 | begin
|
---|
524 | CallV('ORB DELETE ALERT',[XQAID, True]);
|
---|
525 | end;
|
---|
526 |
|
---|
527 | procedure ForwardAlert(XQAID: string; Recip: string; FWDtype: string; Comment: string);
|
---|
528 | // Forwards an alert with comment to Recip[ient]
|
---|
529 | begin
|
---|
530 | CallV('ORB FORWARD ALERT', [XQAID, Recip, FWDtype, Comment]);
|
---|
531 | end;
|
---|
532 |
|
---|
533 | procedure RenewAlert(XQAID: string);
|
---|
534 | // Restores/renews an alert
|
---|
535 | begin
|
---|
536 | CallV('ORB RENEW ALERT', [XQAID]);
|
---|
537 | end;
|
---|
538 |
|
---|
539 | function GetSortMethod: string;
|
---|
540 | // Returns alert sort method
|
---|
541 | begin
|
---|
542 | Result := sCallV('ORWORB GETSORT',[nil]);
|
---|
543 | end;
|
---|
544 |
|
---|
545 | procedure SetSortMethod(Sort: string; Direction: string);
|
---|
546 | // Sets alert sort method for user
|
---|
547 | begin
|
---|
548 | CallV('ORWORB SETSORT', [Sort, Direction]);
|
---|
549 | end;
|
---|
550 |
|
---|
551 | function GetXQAData(XQAID: string): string;
|
---|
552 | // Returns data associated with an alert
|
---|
553 | begin
|
---|
554 | Result := sCallV('ORWORB GETDATA',[XQAID]);
|
---|
555 | end;
|
---|
556 |
|
---|
557 | function GetTIUAlertInfo(XQAID: string): string;
|
---|
558 | // Returns DFN and document type associated with a TIU alert
|
---|
559 | begin
|
---|
560 | Result := sCallV('TIU GET ALERT INFO',[XQAID]);
|
---|
561 | end;
|
---|
562 |
|
---|
563 | function GetNotificationFollowUpText(PatientDFN: string; Notification: integer; XQADATA: string): TStrings;
|
---|
564 | // Returns follow-up text for an alert
|
---|
565 | begin
|
---|
566 | CallV('ORWORB TEXT FOLLOWUP', [PatientDFN, Notification, XQADATA]);
|
---|
567 | Result := RPCBrokerV.Results;
|
---|
568 | end;
|
---|
569 |
|
---|
570 | { Patient List Calls }
|
---|
571 |
|
---|
572 | function DfltPtList: string;
|
---|
573 | { returns the name of the current user's default patient list, null if none is defined
|
---|
574 | Pieces: Ptr to Source File^Source Name^Source Type }
|
---|
575 | begin
|
---|
576 | Result := sCallV('ORQPT DEFAULT LIST SOURCE', [nil]);
|
---|
577 | if Length(Result) > 0 then Result := Pieces(Result, U, 2, 3);
|
---|
578 | end;
|
---|
579 |
|
---|
580 | function DfltPtListSrc: Char;
|
---|
581 | begin
|
---|
582 | Result := CharAt(sCallV('ORWPT DFLTSRC', [nil]), 1);
|
---|
583 | end;
|
---|
584 |
|
---|
585 | procedure SavePtListDflt(const x: string);
|
---|
586 | begin
|
---|
587 | CallV('ORWPT SAVDFLT', [x]);
|
---|
588 | end;
|
---|
589 |
|
---|
590 | procedure ListSpecialtyAll(Dest: TStrings);
|
---|
591 | { lists all treating specialties: IEN^Treating Specialty Name }
|
---|
592 | begin
|
---|
593 | CallV('ORQPT SPECIALTIES', [nil]);
|
---|
594 | MixedCaseList(RPCBrokerV.Results);
|
---|
595 | Dest.Assign(RPCBrokerV.Results);
|
---|
596 | end;
|
---|
597 |
|
---|
598 | procedure ListTeamAll(Dest: TStrings);
|
---|
599 | { lists all patient care teams: IEN^Team Name }
|
---|
600 | begin
|
---|
601 | CallV('ORQPT TEAMS', [nil]);
|
---|
602 | MixedCaseList(RPCBrokerV.Results);
|
---|
603 | Dest.Assign(RPCBrokerV.Results);
|
---|
604 | end;
|
---|
605 |
|
---|
606 | procedure ListWardAll(Dest: TStrings);
|
---|
607 | { lists all active inpatient wards: IEN^Ward Name }
|
---|
608 | begin
|
---|
609 | CallV('ORQPT WARDS', [nil]);
|
---|
610 | //MixedCaseList(RPCBrokerV.Results);
|
---|
611 | Dest.Assign(RPCBrokerV.Results);
|
---|
612 | end;
|
---|
613 |
|
---|
614 | procedure ListProviderTop(Dest: TStrings);
|
---|
615 | { checks parameters for list of commonly selected providers }
|
---|
616 | begin
|
---|
617 | end;
|
---|
618 |
|
---|
619 | function SubSetOfProviders(const StartFrom: string; Direction: Integer): TStrings;
|
---|
620 | { returns a pointer to a list of providers (for use in a long list box) - The return value is
|
---|
621 | a pointer to RPCBrokerV.Results, so the data must be used BEFORE the next broker call! }
|
---|
622 | begin
|
---|
623 | CallV('ORWU NEWPERS', [StartFrom, Direction, 'PROVIDER']);
|
---|
624 | // MixedCaseList(RPCBrokerV.Results);
|
---|
625 | Result := RPCBrokerV.Results;
|
---|
626 | end;
|
---|
627 |
|
---|
628 | function SubSetOfProvWithClass(const StartFrom: string; Direction: Integer; DateTime: string): TStrings;
|
---|
629 | { returns a pointer to a list of providers (for use in a long list box) - The return value is
|
---|
630 | a pointer to RPCBrokerV.Results, so the data must be used BEFORE the next broker call! }
|
---|
631 | begin
|
---|
632 | CallV('ORWU NEWPERS', [StartFrom, Direction, 'PROVIDER', DateTime]);
|
---|
633 | MixedCaseList(RPCBrokerV.Results);
|
---|
634 | Result := RPCBrokerV.Results;
|
---|
635 | end;
|
---|
636 |
|
---|
637 | function SubSetOfUsersWithClass(const StartFrom: string; Direction: Integer; DateTime: string): TStrings;
|
---|
638 | { returns a pointer to a list of users (for use in a long list box) - The return value is
|
---|
639 | a pointer to RPCBrokerV.Results, so the data must be used BEFORE the next broker call! }
|
---|
640 | begin
|
---|
641 | CallV('ORWU NEWPERS', [StartFrom, Direction, '', DateTime]);
|
---|
642 | MixedCaseList(RPCBrokerV.Results);
|
---|
643 | Result := RPCBrokerV.Results;
|
---|
644 | end;
|
---|
645 |
|
---|
646 | function SubSetOfActiveAndInactivePersons(const StartFrom: string; Direction: Integer): TStrings;
|
---|
647 | { returns a pointer to a list of users (for use in a long list box) - The return value is
|
---|
648 | a pointer to RPCBrokerV.Results, so the data must be used BEFORE the next broker call!}
|
---|
649 | begin
|
---|
650 | CallV('ORWU NEWPERS', [StartFrom, Direction, '', '', '', True]); //TRUE = return all active and inactive users
|
---|
651 | MixedCaseList(RPCBrokerV.Results);
|
---|
652 | Result := RPCBrokerV.Results;
|
---|
653 | end;
|
---|
654 |
|
---|
655 |
|
---|
656 | procedure ListClinicTop(Dest: TStrings);
|
---|
657 | { checks parameters for list of commonly selected clinics }
|
---|
658 | begin
|
---|
659 | end;
|
---|
660 |
|
---|
661 | function SubSetOfClinics(const StartFrom: string; Direction: Integer): TStrings;
|
---|
662 | { returns a pointer to a list of clinics (for use in a long list box) - The return value is
|
---|
663 | a pointer to RPCBrokerV.Results, so the data must be used BEFORE the next broker call! }
|
---|
664 | begin
|
---|
665 | CallV('ORWU CLINLOC', [StartFrom, Direction]);
|
---|
666 | MixedCaseList(RPCBrokerV.Results);
|
---|
667 | Result := RPCBrokerV.Results;
|
---|
668 | end;
|
---|
669 |
|
---|
670 | function GetDfltSort: string;
|
---|
671 | { Assigns uPtLstDfltSort to user's default patient list sort order (string character).}
|
---|
672 | begin
|
---|
673 | uPtListDfltSort := sCallV('ORQPT DEFAULT LIST SORT', [nil]);
|
---|
674 | if uPtListDfltSort = '' then uPtListDfltSort := 'A'; // Default is always "A" for alpha.
|
---|
675 | result := uPtListDfltSort;
|
---|
676 | end;
|
---|
677 |
|
---|
678 | procedure ResetDfltSort;
|
---|
679 | begin
|
---|
680 | uPtListDfltSort := '';
|
---|
681 | end;
|
---|
682 |
|
---|
683 | procedure ListPtByDflt(Dest: TStrings);
|
---|
684 | { loads the default patient list into Dest, Pieces: DFN^PATIENT NAME, ETC. }
|
---|
685 | var
|
---|
686 | i, SourceType: Integer;
|
---|
687 | ATime, APlace, Sort, Source, x: string;
|
---|
688 | tmplst: TORStringList;
|
---|
689 | begin
|
---|
690 | Sort := GetDfltSort();
|
---|
691 | tmplst := TORStringList.Create;
|
---|
692 | try
|
---|
693 | tCallV(tmplst, 'ORQPT DEFAULT PATIENT LIST', [nil]);
|
---|
694 | Source := sCallV('ORWPT DFLTSRC', [nil]);
|
---|
695 | if Source = 'C' then // Clinics.
|
---|
696 | begin
|
---|
697 | if Sort = 'P' then // "Appointments" sort.
|
---|
698 | SortByPiece(tmplst, U, 4)
|
---|
699 | else
|
---|
700 | SortByPiece(tmplst, U, 2);
|
---|
701 | for i := 0 to tmplst.Count - 1 do
|
---|
702 | begin
|
---|
703 | x := tmplst[i];
|
---|
704 | ATime := Piece(x, U, 4);
|
---|
705 | APlace := Piece(x, U, 3);
|
---|
706 | ATime := FormatFMDateTime('hh:nn mmm dd, yyyy', MakeFMDateTime(ATime));
|
---|
707 | SetPiece(x, U, 3, ATime);
|
---|
708 | x := x + U + APlace;
|
---|
709 | tmplst[i] := x;
|
---|
710 | end;
|
---|
711 | end
|
---|
712 | else
|
---|
713 | begin
|
---|
714 | SourceType := 0; // Default.
|
---|
715 | if Source = 'M' then SourceType := 1; // Combinations.
|
---|
716 | if Source = 'W' then SourceType := 2; // Wards.
|
---|
717 | case SourceType of
|
---|
718 | 1 : if Sort = 'S' then tmplst.SortByPieces([3, 8, 2]) // "Source" sort.
|
---|
719 | else if Sort = 'P' then tmplst.SortByPieces([8, 2]) // "Appointment" sort.
|
---|
720 | else if Sort = 'T' then SortByPiece(tmplst, U, 5) // "Terminal Digit" sort.
|
---|
721 | else SortByPiece(tmplst, U, 2); // "Alphabetical" (also the default) sort.
|
---|
722 | 2 : if Sort = 'R' then tmplst.SortByPieces([3, 2])
|
---|
723 | else SortByPiece(tmplst, U, 2);
|
---|
724 | else SortByPiece(tmplst, U, 2);
|
---|
725 | end;
|
---|
726 | end;
|
---|
727 | MixedCaseList(tmplst);
|
---|
728 | Dest.Assign(tmplst);
|
---|
729 | finally
|
---|
730 | tmplst.Free;
|
---|
731 | end;
|
---|
732 | end;
|
---|
733 |
|
---|
734 | procedure ListPtByProvider(Dest: TStrings; ProviderIEN: Int64);
|
---|
735 | { lists all patients associated with a given provider: DFN^Patient Name }
|
---|
736 | begin
|
---|
737 | CallV('ORQPT PROVIDER PATIENTS', [ProviderIEN]);
|
---|
738 | SortByPiece(TStringList(RPCBrokerV.Results), U, 2);
|
---|
739 | MixedCaseList(RPCBrokerV.Results);
|
---|
740 | Dest.Assign(RPCBrokerV.Results);
|
---|
741 | end;
|
---|
742 |
|
---|
743 | procedure ListPtByTeam(Dest: TStrings; TeamIEN: Integer);
|
---|
744 | { lists all patients associated with a given team: DFN^Patient Name }
|
---|
745 | begin
|
---|
746 | CallV('ORQPT TEAM PATIENTS', [TeamIEN]);
|
---|
747 | SortByPiece(TStringList(RPCBrokerV.Results), U, 2);
|
---|
748 | MixedCaseList(RPCBrokerV.Results);
|
---|
749 | Dest.Assign(RPCBrokerV.Results);
|
---|
750 | end;
|
---|
751 |
|
---|
752 | procedure ListPtBySpecialty(Dest: TStrings; SpecialtyIEN: Integer);
|
---|
753 | { lists all patients associated with a given specialty: DFN^Patient Name }
|
---|
754 | begin
|
---|
755 | CallV('ORQPT SPECIALTY PATIENTS', [SpecialtyIEN]);
|
---|
756 | SortByPiece(TStringList(RPCBrokerV.Results), U, 2);
|
---|
757 | MixedCaseList(RPCBrokerV.Results);
|
---|
758 | Dest.Assign(RPCBrokerV.Results);
|
---|
759 | end;
|
---|
760 |
|
---|
761 | procedure ListPtByClinic(Dest: TStrings; ClinicIEN: Integer; FirstDt, LastDt: string); //TFMDateTime);
|
---|
762 | { lists all patients associated with a given clinic: DFN^Patient Name^App't }
|
---|
763 | var
|
---|
764 | i: Integer;
|
---|
765 | x, ATime, APlace, Sort: string;
|
---|
766 | begin
|
---|
767 | Sort := GetDfltSort();
|
---|
768 | CallV('ORQPT CLINIC PATIENTS', [ClinicIEN, FirstDt, LastDt]);
|
---|
769 | with RPCBrokerV do
|
---|
770 | begin
|
---|
771 | if Sort = 'P' then
|
---|
772 | SortByPiece(TStringList(Results), U, 4)
|
---|
773 | else
|
---|
774 | SortByPiece(TStringList(Results), U, 2);
|
---|
775 | for i := 0 to Results.Count - 1 do
|
---|
776 | begin
|
---|
777 | x := Results[i];
|
---|
778 | ATime := Piece(x, U, 4);
|
---|
779 | APlace := Piece(x, U, 3);
|
---|
780 | ATime := FormatFMDateTime('hh:nn mmm dd, yyyy', MakeFMDateTime(ATime));
|
---|
781 | SetPiece(x, U, 3, ATime);
|
---|
782 | x := x + U + APlace;
|
---|
783 | Results[i] := x;
|
---|
784 | end;
|
---|
785 | MixedCaseList(Results);
|
---|
786 | Dest.Assign(Results);
|
---|
787 | end;
|
---|
788 | end;
|
---|
789 |
|
---|
790 | procedure ListPtByWard(Dest: TStrings; WardIEN: Integer);
|
---|
791 | { lists all patients associated with a given ward: DFN^Patient Name^Room/Bed }
|
---|
792 | var
|
---|
793 | Sort: string;
|
---|
794 | begin
|
---|
795 | Sort := GetDfltSort();
|
---|
796 | CallV('ORWPT BYWARD', [WardIEN]);
|
---|
797 | if Sort = 'R' then
|
---|
798 | SortByPiece(TStringList(RPCBrokerV.Results), U, 3)
|
---|
799 | else
|
---|
800 | SortByPiece(TStringList(RPCBrokerV.Results), U, 2);
|
---|
801 | MixedCaseList(RPCBrokerV.Results);
|
---|
802 | Dest.Assign(RPCBrokerV.Results);
|
---|
803 | end;
|
---|
804 |
|
---|
805 | // VWPT ADDITIONS FOR ENHANCED PATIENT LOOKUP
|
---|
806 | procedure ListPtByOther (Dest: Tstrings; const othertext: string;caption:string );//:string; radbutton:Tobject);
|
---|
807 | var
|
---|
808 | i: Integer;
|
---|
809 | x,Afieldname: string;
|
---|
810 | begin
|
---|
811 |
|
---|
812 | CallV('ORWPT OTHER-RADIOBUTTONS',[othertext, caption]);
|
---|
813 | //SortByPiece(TStringList(RPCBrokerV.Results), U, 2);
|
---|
814 | MixedCaseList(RPCBrokerV.Results);
|
---|
815 | Dest.Assign(RPCBrokerV.Results);
|
---|
816 | end;
|
---|
817 |
|
---|
818 | procedure ListPtByTimson (Dest: Tstrings; const othertext: string);//
|
---|
819 |
|
---|
820 | var
|
---|
821 | i: Integer;
|
---|
822 | x,Afieldname: string;
|
---|
823 | begin
|
---|
824 |
|
---|
825 | CallV('ORWPT ENHANCED PATLOOKUP',[othertext]);
|
---|
826 | //SortByPiece(TStringList(RPCBrokerV.Results), U, 2);
|
---|
827 | MixedCaseList(RPCBrokerV.Results);
|
---|
828 | Dest.Assign(RPCBrokerV.Results);
|
---|
829 | end;
|
---|
830 |
|
---|
831 |
|
---|
832 |
|
---|
833 | //END VWPT ADDITIONS
|
---|
834 | procedure ListPtByLast5(Dest: TStrings; const Last5: string);
|
---|
835 | var
|
---|
836 | i: Integer;
|
---|
837 | x, ADate, AnSSN: string;
|
---|
838 | begin
|
---|
839 | { Lists all patients found in the BS and BS5 xrefs that match Last5: DFN^Patient Name }
|
---|
840 | CallV('ORWPT LAST5', [UpperCase(Last5)]);
|
---|
841 | SortByPiece(TStringList(RPCBrokerV.Results), U, 2);
|
---|
842 | with RPCBrokerV do for i := 0 to Results.Count - 1 do
|
---|
843 | begin
|
---|
844 | x := Results[i];
|
---|
845 | ADate := Piece(x, U, 3);
|
---|
846 | AnSSN := Piece(x, U, 4);
|
---|
847 | if IsFMDate(ADate) then ADate := FormatFMDateTimeStr('mmm d, yyyy', ADate);
|
---|
848 | if IsSSN(AnSSN) then AnSSN := FormatSSN(AnSSN);
|
---|
849 | SetPiece(x, U, 3, AnSSN + ' ' + ADate);
|
---|
850 | Results[i] := x;
|
---|
851 | end;
|
---|
852 | MixedCaseList(RPCBrokerV.Results);
|
---|
853 | Dest.Assign(RPCBrokerV.Results);
|
---|
854 | end;
|
---|
855 |
|
---|
856 | procedure ListPtByRPLLast5(Dest: TStrings; const Last5: string);
|
---|
857 | var
|
---|
858 | i: Integer;
|
---|
859 | x, ADate, AnSSN: string;
|
---|
860 | begin
|
---|
861 | { Lists patients from RPL list that match Last5: DFN^Patient Name }
|
---|
862 | CallV('ORWPT LAST5 RPL', [UpperCase(Last5)]);
|
---|
863 | SortByPiece(TStringList(RPCBrokerV.Results), U, 2);
|
---|
864 | with RPCBrokerV do for i := 0 to Results.Count - 1 do
|
---|
865 | begin
|
---|
866 | x := Results[i];
|
---|
867 | ADate := Piece(x, U, 3);
|
---|
868 | AnSSN := Piece(x, U, 4);
|
---|
869 | if IsFMDate(ADate) then ADate := FormatFMDateTimeStr('mmm d, yyyy', ADate);
|
---|
870 | if IsSSN(AnSSN) then AnSSN := FormatSSN(AnSSN);
|
---|
871 | SetPiece(x, U, 3, AnSSN + ' ' + ADate);
|
---|
872 | Results[i] := x;
|
---|
873 | end;
|
---|
874 | MixedCaseList(RPCBrokerV.Results);
|
---|
875 | Dest.Assign(RPCBrokerV.Results);
|
---|
876 | end;
|
---|
877 |
|
---|
878 | procedure ListPtByFullSSN(Dest: TStrings; const FullSSN: string);
|
---|
879 | { lists all patients found in the SSN xref that match FullSSN: DFN^Patient Name }
|
---|
880 | var
|
---|
881 | i: integer;
|
---|
882 | x, ADate, AnSSN: string;
|
---|
883 | begin
|
---|
884 | x := FullSSN;
|
---|
885 | i := Pos('-', x);
|
---|
886 | while i > 0 do
|
---|
887 | begin
|
---|
888 | x := Copy(x, 1, i-1) + Copy(x, i+1, 12);
|
---|
889 | i := Pos('-', x);
|
---|
890 | end;
|
---|
891 | CallV('ORWPT FULLSSN', [UpperCase(x)]);
|
---|
892 | SortByPiece(TStringList(RPCBrokerV.Results), U, 2);
|
---|
893 | with RPCBrokerV do for i := 0 to Results.Count - 1 do
|
---|
894 | begin
|
---|
895 | x := Results[i];
|
---|
896 | ADate := Piece(x, U, 3);
|
---|
897 | AnSSN := Piece(x, U, 4);
|
---|
898 | if IsFMDate(ADate) then ADate := FormatFMDateTimeStr('mmm d, yyyy', ADate);
|
---|
899 | if IsSSN(AnSSN) then AnSSN := FormatSSN(AnSSN);
|
---|
900 | SetPiece(x, U, 3, AnSSN + ' ' + ADate);
|
---|
901 | Results[i] := x;
|
---|
902 | end;
|
---|
903 | MixedCaseList(RPCBrokerV.Results);
|
---|
904 | Dest.Assign(RPCBrokerV.Results);
|
---|
905 | end;
|
---|
906 |
|
---|
907 | procedure ListPtByRPLFullSSN(Dest: TStrings; const FullSSN: string);
|
---|
908 | { lists all patients found in the SSN xref that match FullSSN: DFN^Patient Name }
|
---|
909 | var
|
---|
910 | i: integer;
|
---|
911 | x, ADate, AnSSN: string;
|
---|
912 | begin
|
---|
913 | x := FullSSN;
|
---|
914 | i := Pos('-', x);
|
---|
915 | while i > 0 do
|
---|
916 | begin
|
---|
917 | x := Copy(x, 1, i-1) + Copy(x, i+1, 12);
|
---|
918 | i := Pos('-', x);
|
---|
919 | end;
|
---|
920 | CallV('ORWPT FULLSSN RPL', [UpperCase(x)]);
|
---|
921 | SortByPiece(TStringList(RPCBrokerV.Results), U, 2);
|
---|
922 | with RPCBrokerV do for i := 0 to Results.Count - 1 do
|
---|
923 | begin
|
---|
924 | x := Results[i];
|
---|
925 | ADate := Piece(x, U, 3);
|
---|
926 | AnSSN := Piece(x, U, 4);
|
---|
927 | if IsFMDate(ADate) then ADate := FormatFMDateTimeStr('mmm d, yyyy', ADate);
|
---|
928 | if IsSSN(AnSSN) then AnSSN := FormatSSN(AnSSN);
|
---|
929 | SetPiece(x, U, 3, AnSSN + ' ' + ADate);
|
---|
930 | Results[i] := x;
|
---|
931 | end;
|
---|
932 | MixedCaseList(RPCBrokerV.Results);
|
---|
933 | Dest.Assign(RPCBrokerV.Results);
|
---|
934 | end;
|
---|
935 |
|
---|
936 | procedure ListPtTop(Dest: TStrings);
|
---|
937 | { currently returns the last patient selected }
|
---|
938 | begin
|
---|
939 | CallV('ORWPT TOP', [nil]);
|
---|
940 | MixedCaseList(RPCBrokerV.Results);
|
---|
941 | Dest.Assign(RPCBrokerV.Results);
|
---|
942 | end;
|
---|
943 |
|
---|
944 | function SubSetOfPatients(const StartFrom: string; Direction: Integer): TStrings;
|
---|
945 | { returns a pointer to a list of patients (for use in a long list box) - The return value is
|
---|
946 | a pointer to RPCBrokerV.Results, so the data must be used BEFORE the next broker call! }
|
---|
947 | begin
|
---|
948 | CallV('ORWPT LIST ALL', [StartFrom, Direction]);
|
---|
949 | MixedCaseList(RPCBrokerV.Results);
|
---|
950 | Result := RPCBrokerV.Results;
|
---|
951 | end;
|
---|
952 |
|
---|
953 | function MakeRPLPtList(RPLList: string): string;
|
---|
954 | { Creates "RPL" Restricted Patient List based on Team List info in user's record. }
|
---|
955 | begin
|
---|
956 | result := sCallV('ORQPT MAKE RPL', [RPLList]);
|
---|
957 | end;
|
---|
958 |
|
---|
959 | function ReadRPLPtList(RPLJobNumber: string; const StartFrom: string; Direction: Integer) : TStrings;
|
---|
960 | { returns a pointer to a list of patients (for use in a long list box) - The return value is
|
---|
961 | a pointer to RPCBrokerV.Results, so the data must be used BEFORE the next broker call! }
|
---|
962 | begin
|
---|
963 | CallV('ORQPT READ RPL', [RPLJobNumber, StartFrom, Direction]);
|
---|
964 | MixedCaseList(RPCBrokerV.Results);
|
---|
965 | Result := RPCBrokerV.Results;
|
---|
966 | end;
|
---|
967 |
|
---|
968 | procedure KillRPLPtList(RPLJobNumber: string);
|
---|
969 | begin
|
---|
970 | CallV('ORQPT KILL RPL', [RPLJobNumber]);
|
---|
971 | end;
|
---|
972 |
|
---|
973 | { Patient Specific Calls }
|
---|
974 |
|
---|
975 | function CalcAge(BirthDate, DeathDate: TFMDateTime): Integer;
|
---|
976 | { calculates age based on today's date and a birthdate (in Fileman format) }
|
---|
977 | begin
|
---|
978 | if (DeathDate > BirthDate) then
|
---|
979 | Result := Trunc(DeathDate - BirthDate) div 10000
|
---|
980 | else
|
---|
981 | Result := Trunc(FMToday - BirthDate) div 10000
|
---|
982 | end;
|
---|
983 |
|
---|
984 | procedure CheckSensitiveRecordAccess(const DFN: string; var AccessStatus: Integer;
|
---|
985 | var MessageText: string);
|
---|
986 | begin
|
---|
987 | CallV('DG SENSITIVE RECORD ACCESS', [DFN]);
|
---|
988 | AccessStatus := -1;
|
---|
989 | MessageText := '';
|
---|
990 | with RPCBrokerV do
|
---|
991 | begin
|
---|
992 | if Results.Count > 0 then
|
---|
993 | begin
|
---|
994 | AccessStatus := StrToIntDef(Results[0], -1);
|
---|
995 | Results.Delete(0);
|
---|
996 | if Results.Count > 0 then MessageText := Results.Text;
|
---|
997 | end;
|
---|
998 | end;
|
---|
999 | end;
|
---|
1000 |
|
---|
1001 | procedure CheckRemotePatient(var Dest: string; Patient, ASite: string; var AccessStatus: Integer);
|
---|
1002 |
|
---|
1003 | begin
|
---|
1004 | CallV('XWB DIRECT RPC', [ASite, 'ORWCIRN RESTRICT', 0, Patient]);
|
---|
1005 | AccessStatus := -1;
|
---|
1006 | Dest := '';
|
---|
1007 | with RPCBrokerV do
|
---|
1008 | begin
|
---|
1009 | if Results.Count > 0 then
|
---|
1010 | begin
|
---|
1011 | if Results[0] = '' then Results.Delete(0);
|
---|
1012 | end;
|
---|
1013 | if Results.Count > 0 then
|
---|
1014 | begin
|
---|
1015 | if (length(piece(Results[0],'^',2)) > 0) and ((StrToIntDef(piece(Results[0],'^',1),0) = -1)) then
|
---|
1016 | begin
|
---|
1017 | AccessStatus := -1;
|
---|
1018 | Dest := piece(Results[0],'^',2);
|
---|
1019 | end
|
---|
1020 | else
|
---|
1021 | begin
|
---|
1022 | AccessStatus := StrToIntDef(Results[0], -1);
|
---|
1023 | Results.Delete(0);
|
---|
1024 | if Results.Count > 0 then Dest := Results.Text;
|
---|
1025 | end;
|
---|
1026 | end;
|
---|
1027 | end;
|
---|
1028 | end;
|
---|
1029 |
|
---|
1030 | procedure CurrentLocationForPatient(const DFN: string; var ALocation: Integer; var AName: string; var ASvc: string);
|
---|
1031 | var
|
---|
1032 | x: string;
|
---|
1033 | begin
|
---|
1034 | x := sCallV('ORWPT INPLOC', [DFN]);
|
---|
1035 | ALocation := StrToIntDef(Piece(x, U, 1), 0);
|
---|
1036 | AName := Piece(x, U, 2);
|
---|
1037 | ASvc := Piece(x, U, 3);
|
---|
1038 | end;
|
---|
1039 |
|
---|
1040 | function DateOfDeath(const DFN: string): TFMDateTime;
|
---|
1041 | { returns 0 or the date a patient died }
|
---|
1042 | begin
|
---|
1043 | Result := MakeFMDateTime(sCallV('ORWPT DIEDON', [DFN]));
|
---|
1044 | end;
|
---|
1045 |
|
---|
1046 | function GetPtIDInfo(const DFN: string): TPtIDInfo; //*DFN*
|
---|
1047 | { returns the identifiers displayed upon patient selection
|
---|
1048 | //VWPT ADD HRN ,ALT HRN (FUTURE)
|
---|
1049 | Pieces: SSN[1]^DOB[2]^SEX[3]^VET[4]^SC%[5]^WARD[6]^RM-BED[7]^NAME[8]^HRN[9]^ALTHRN[10] }
|
---|
1050 | // Pieces: SSN[1]^DOB[2]^SEX[3]^VET[4]^SC%[5]^WARD[6]^RM-BED[7]^NAME[8] }
|
---|
1051 | var
|
---|
1052 | x: string;
|
---|
1053 | begin
|
---|
1054 | x := sCallV('ORWPT ID INFO', [DFN]);
|
---|
1055 | with Result do // map string into TPtIDInfo record
|
---|
1056 | begin
|
---|
1057 | Name := MixedCase(Piece(x, U, 8)); // Name
|
---|
1058 | SSN := Piece(x, U, 1);
|
---|
1059 | DOB := Piece(x, U, 2);
|
---|
1060 | Age := '';
|
---|
1061 | if IsSSN(SSN) then SSN := FormatSSN(Piece(x, U, 1)); // SSN (PID)
|
---|
1062 | if IsFMDate(DOB) then DOB := FormatFMDateTimeStr('mmm dd,yyyy', DOB); // Date of Birth
|
---|
1063 | //Age := IntToStr(CalcAge(MakeFMDateTime(Piece(x, U, 2)))); // Age
|
---|
1064 | Sex := Piece(x, U, 3); // Sex
|
---|
1065 | if Length(Sex) = 0 then Sex := 'U';
|
---|
1066 | case Sex[1] of
|
---|
1067 | 'F','f': Sex := 'Female';
|
---|
1068 | 'M','m': Sex := 'Male';
|
---|
1069 | else Sex := 'Unknown';
|
---|
1070 | end;
|
---|
1071 | if Piece(x, U, 4) = 'Y' then Vet := 'Veteran' else Vet := ''; // Veteran?
|
---|
1072 | if Length(Piece(x, U, 5)) > 0 // % Service Connected
|
---|
1073 | then SCSts := Piece(x, U, 5) + '% Service Connected'
|
---|
1074 | else SCSts := '';
|
---|
1075 | Location := Piece(x, U, 6); // Inpatient Location
|
---|
1076 | RoomBed := Piece(x, U, 7); // Inpatient Room-Bed
|
---|
1077 | // VWPT ADD HRN
|
---|
1078 | HRN := Piece(x, U, 9);
|
---|
1079 | AltHRN := Piece(x, U, 10);
|
---|
1080 | end;
|
---|
1081 | end;
|
---|
1082 |
|
---|
1083 | function HasLegacyData(const DFN: string; var AMsg: string): Boolean;
|
---|
1084 | var
|
---|
1085 | i: Integer;
|
---|
1086 | begin
|
---|
1087 | Result := False;
|
---|
1088 | AMsg := '';
|
---|
1089 | CallV('ORWPT LEGACY', [DFN]);
|
---|
1090 | with RPCBrokerV do if Results.Count > 0 then
|
---|
1091 | begin
|
---|
1092 | Result := Results[0] = '1';
|
---|
1093 | for i := 1 to Results.Count - 1 do AMsg := AMsg + Results[i] + CRLF;
|
---|
1094 | end;
|
---|
1095 | end;
|
---|
1096 |
|
---|
1097 | function LogSensitiveRecordAccess(const DFN: string): Boolean;
|
---|
1098 | begin
|
---|
1099 | Result := sCallV('DG SENSITIVE RECORD BULLETIN', [DFN]) = '1';
|
---|
1100 | end;
|
---|
1101 |
|
---|
1102 | function MeansTestRequired(const DFN: string; var AMsg: string): Boolean;
|
---|
1103 | var
|
---|
1104 | i: Integer;
|
---|
1105 | begin
|
---|
1106 | Result := False;
|
---|
1107 | AMsg := '';
|
---|
1108 | CallV('DG CHK PAT/DIV MEANS TEST', [DFN]);
|
---|
1109 | with RPCBrokerV do if Results.Count > 0 then
|
---|
1110 | begin
|
---|
1111 | Result := Results[0] = '1';
|
---|
1112 | for i := 1 to Results.Count - 1 do AMsg := AMsg + Results[i] + CRLF;
|
---|
1113 | end;
|
---|
1114 | end;
|
---|
1115 |
|
---|
1116 | function RestrictedPtRec(const DFN: string): Boolean; //*DFN*
|
---|
1117 | { returns true if the record for a patient identified by DFN is restricted }
|
---|
1118 | begin
|
---|
1119 | Result := Piece(sCallV('ORWPT SELCHK', [DFN]), U, 1) = '1';
|
---|
1120 | end;
|
---|
1121 |
|
---|
1122 | procedure SelectPatient(const DFN: string; var PtSelect: TPtSelect); //*DFN*
|
---|
1123 | { selects the patient (updates DISV, calls Pt Select actions) & returns key fields
|
---|
1124 | Pieces: NAME[1]^SEX[2]^DOB[3]^SSN[4]^LOCIEN[5]^LOCNAME[6]^ROOMBED[7]^CWAD[8]^SENSITIVE[9]^
|
---|
1125 | //VWPT add HRN and ALTERNATE HRN used with PID hl7 segments
|
---|
1126 | ADMITTIME[10]^CONVERTED[11]^SVCONN[12]^SC%[13]^ICN[14]^Age[15]^TreatSpec[16]^HRN[17]^AltHRN[18] }
|
---|
1127 | // BEFORE THIS VWPT WAS ADMITTIME[10]^CONVERTED[11]^SVCONN[12]^SC%[13]^ICN[14]^Age[15]^TreatSpec[16] }
|
---|
1128 | var
|
---|
1129 | x: string;
|
---|
1130 | begin
|
---|
1131 | x := sCallV('ORWPT SELECT', [DFN]);
|
---|
1132 | with PtSelect do
|
---|
1133 | begin
|
---|
1134 | Name := Piece(x, U, 1);
|
---|
1135 | ICN := Piece(x, U, 14);
|
---|
1136 | SSN := FormatSSN(Piece(x, U, 4));
|
---|
1137 | DOB := MakeFMDateTime(Piece(x, U, 3));
|
---|
1138 | Age := StrToIntDef(Piece(x, U, 15), 0);
|
---|
1139 | //Age := CalcAge(DOB, DateOfDeath(DFN));
|
---|
1140 | if Length(Piece(x, U, 2)) > 0 then Sex := Piece(x, U, 2)[1] else Sex := 'U';
|
---|
1141 | LocationIEN := StrToIntDef(Piece(x, U, 5), 0);
|
---|
1142 | Location := Piece(x, U, 6);
|
---|
1143 | RoomBed := Piece(x, U, 7);
|
---|
1144 | SpecialtyIEN := StrToIntDef(Piece(x, u, 16), 0);
|
---|
1145 | CWAD := Piece(x, U, 8);
|
---|
1146 | Restricted := Piece(x, U, 9) = '1';
|
---|
1147 | AdmitTime := MakeFMDateTime(Piece(x, U, 10));
|
---|
1148 | ServiceConnected := Piece(x, U, 12) = '1';
|
---|
1149 | SCPercent := StrToIntDef(Piece(x, U, 13), 0);
|
---|
1150 |
|
---|
1151 | //VWPT ADD HRN AltHRN (future)
|
---|
1152 | HRN := Piece(x, U, 17);
|
---|
1153 | AltHRN := Piece(x, U, 18);
|
---|
1154 | end;
|
---|
1155 | x := sCallV('ORWPT1 PRCARE', [DFN]);
|
---|
1156 | with PtSelect do
|
---|
1157 | begin
|
---|
1158 | PrimaryTeam := Piece(x, U, 1);
|
---|
1159 | PrimaryProvider := Piece(x, U, 2);
|
---|
1160 | if Length(Location) > 0 then
|
---|
1161 | begin
|
---|
1162 | Attending := Piece(x, U, 3);
|
---|
1163 | x := sCallV('ORWPT INPLOC', [DFN]);
|
---|
1164 | WardService := Piece(x, U, 3);
|
---|
1165 | end;
|
---|
1166 | end;
|
---|
1167 | end;
|
---|
1168 |
|
---|
1169 | function SimilarRecordsFound(const DFN: string; var AMsg: string): Boolean;
|
---|
1170 | begin
|
---|
1171 | Result := False;
|
---|
1172 | AMsg := '';
|
---|
1173 | CallV('DG CHK BS5 XREF Y/N', [DFN]);
|
---|
1174 | with RPCBrokerV do if Results.Count > 0 then
|
---|
1175 | begin
|
---|
1176 | Result := Results[0] = '1';
|
---|
1177 | Results.Delete(0);
|
---|
1178 | AMsg := Results.Text;
|
---|
1179 | end;
|
---|
1180 | (*
|
---|
1181 | CallV('DG CHK BS5 XREF ARRAY', [DFN]);
|
---|
1182 | with RPCBrokerV do if Results.Count > 0 then
|
---|
1183 | begin
|
---|
1184 | Result := Results[0] = '1';
|
---|
1185 | for i := 1 to Results.Count - 1 do
|
---|
1186 | begin
|
---|
1187 | if Piece(Results[i], U, 1) = '0' then AMsg := AMsg + Copy(Results[i], 3, Length(Results[i])) + CRLF;
|
---|
1188 | if Piece(Results[i], U, 1) = '1' then AMsg := AMsg + Piece(Results[i], U, 3) + #9 +
|
---|
1189 | FormatFMDateTimeStr('mmm dd,yyyy', Piece(Results[i], U, 4)) + #9 + Piece(Results[i], U, 5) + CRLF;
|
---|
1190 | end;
|
---|
1191 | end;
|
---|
1192 | *)
|
---|
1193 | end;
|
---|
1194 |
|
---|
1195 | function GetDFNFromICN(AnICN: string): string;
|
---|
1196 | begin
|
---|
1197 | Result := Piece(sCallV('VAFCTFU CONVERT ICN TO DFN', [AnICN]), U, 1);
|
---|
1198 | end;
|
---|
1199 |
|
---|
1200 | { Encounter specific calls }
|
---|
1201 |
|
---|
1202 | function GetEncounterText(const DFN: string; Location: integer; Provider: Int64): TEncounterText; //*DFN*
|
---|
1203 | { returns resolved external values Pieces: LOCNAME[1]^PROVNAME[2]^ROOMBED[3] }
|
---|
1204 | var
|
---|
1205 | x: string;
|
---|
1206 | begin
|
---|
1207 | x := sCallV('ORWPT ENCTITL', [DFN, Location, Provider]);
|
---|
1208 | with Result do
|
---|
1209 | begin
|
---|
1210 | LocationName := Piece(x, U, 1);
|
---|
1211 | LocationAbbr := Piece(x, U, 2);
|
---|
1212 | RoomBed := Piece(x, U, 3);
|
---|
1213 | ProviderName := Piece(x, U, 4);
|
---|
1214 | // ProviderName := sCallV('ORWU1 NAMECVT', [Provider]);
|
---|
1215 | end;
|
---|
1216 | end;
|
---|
1217 |
|
---|
1218 | procedure ListApptAll(Dest: TStrings; const DFN: string; From: TFMDateTime = 0;
|
---|
1219 | Thru: TFMDateTime = 0);
|
---|
1220 | { lists appts/visits for a patient (uses same call as cover sheet)
|
---|
1221 | V|A;DateTime;LocIEN^DateTime^LocName^Status }
|
---|
1222 | const
|
---|
1223 | SKIP_ADMITS = 1;
|
---|
1224 | begin
|
---|
1225 | CallV('ORWCV VST', [Patient.DFN, From, Thru, SKIP_ADMITS]);
|
---|
1226 | with RPCBrokerV do
|
---|
1227 | begin
|
---|
1228 | InvertStringList(TStringList(Results));
|
---|
1229 | MixedCaseList(Results);
|
---|
1230 | SetListFMDateTime('mmm dd,yyyy hh:nn', TStringList(Results), U, 2);
|
---|
1231 | Dest.Assign(Results);
|
---|
1232 | end;
|
---|
1233 | (*
|
---|
1234 | CallV('ORWPT APPTLST', [DFN]);
|
---|
1235 | with RPCBrokerV do
|
---|
1236 | begin
|
---|
1237 | SortByPiece(TStringList(Results), U, 1);
|
---|
1238 | InvertStringList(TStringList(Results));
|
---|
1239 | for i := 0 to Results.Count - 1 do
|
---|
1240 | begin
|
---|
1241 | x := Results[i];
|
---|
1242 | ATime := Piece(x, U, 1);
|
---|
1243 | ATime := FormatFMDateTime('mmm dd, yyyy hh:nn', MakeFMDateTime(ATime));
|
---|
1244 | SetPiece(x, U, 5, ATime);
|
---|
1245 | Results[i] := x;
|
---|
1246 | end;
|
---|
1247 | Dest.Assign(Results);
|
---|
1248 | end;
|
---|
1249 | *)
|
---|
1250 | end;
|
---|
1251 |
|
---|
1252 | procedure ListAdmitAll(Dest: TStrings; const DFN: string); //*DFN*
|
---|
1253 | { lists all admissions for a patient: MovementTime^LocIEN^LocName^Type }
|
---|
1254 | var
|
---|
1255 | i: Integer;
|
---|
1256 | ATime, x: string;
|
---|
1257 | begin
|
---|
1258 | CallV('ORWPT ADMITLST', [DFN]);
|
---|
1259 | with RPCBrokerV do
|
---|
1260 | begin
|
---|
1261 | for i := 0 to Results.Count - 1 do
|
---|
1262 | begin
|
---|
1263 | x := Results[i];
|
---|
1264 | ATime := Piece(x, U, 1);
|
---|
1265 | ATime := FormatFMDateTime('mmm dd, yyyy hh:nn', MakeFMDateTime(ATime));
|
---|
1266 | SetPiece(x, U, 5, ATime);
|
---|
1267 | Results[i] := x;
|
---|
1268 | end;
|
---|
1269 | Dest.Assign(Results);
|
---|
1270 | end;
|
---|
1271 | end;
|
---|
1272 |
|
---|
1273 | function SubSetOfLocations(const StartFrom: string; Direction: Integer): TStrings;
|
---|
1274 | { returns a pointer to a list of locations (for use in a long list box) - The return value is
|
---|
1275 | a pointer to RPCBrokerV.Results, so the data must be used BEFORE the next broker call! }
|
---|
1276 | begin
|
---|
1277 | CallV('ORWU HOSPLOC', [StartFrom, Direction]);
|
---|
1278 | Result := RPCBrokerV.Results;
|
---|
1279 | end;
|
---|
1280 |
|
---|
1281 | function SubSetOfNewLocs(const StartFrom: string; Direction: Integer): TStrings;
|
---|
1282 | { Returns a pointer to a list of locations (for use in a long list box) - the return value is
|
---|
1283 | a pointer to RPCBrokerV.Results, so the data must be used BEFORE the next broker call!
|
---|
1284 | Filtered by C, W, and Z types - i.e., Clinics, Wards, and "Other" type locations.}
|
---|
1285 | begin
|
---|
1286 | CallV('ORWU1 NEWLOC', [StartFrom, Direction]);
|
---|
1287 | Result := RPCBrokerV.Results;
|
---|
1288 | end;
|
---|
1289 |
|
---|
1290 | function SubSetOfInpatientLocations(const StartFrom: string; Direction: Integer): TStrings;
|
---|
1291 | { returns a pointer to a list of locations (for use in a long list box) - The return value is
|
---|
1292 | a pointer to RPCBrokerV.Results, so the data must be used BEFORE the next broker call! }
|
---|
1293 | begin
|
---|
1294 | CallV('ORWU INPLOC', [StartFrom, Direction]);
|
---|
1295 | Result := RPCBrokerV.Results;
|
---|
1296 | end;
|
---|
1297 |
|
---|
1298 | { Remote Data Access calls }
|
---|
1299 |
|
---|
1300 | function HasRemoteData(const DFN: string; var ALocations: TStringList): Boolean;
|
---|
1301 | begin
|
---|
1302 | CallV('ORWCIRN FACLIST', [DFN]);
|
---|
1303 | ALocations.Assign(RPCBrokerV.Results);
|
---|
1304 | Result := not (Piece(RPCBrokerV.Results[0], U, 1) = '-1');
|
---|
1305 |
|
---|
1306 | // '-1^NO DFN'
|
---|
1307 | // '-1^PATIENT NOT IN DATABASE'
|
---|
1308 | // '-1^NO MPI Node'
|
---|
1309 | // '-1^NO ICN'
|
---|
1310 | // '-1^Parameter missing.'
|
---|
1311 | // '-1^No patient DFN.'
|
---|
1312 | // '-1^Could not find Treating Facilities'
|
---|
1313 | // '-1^Remote access not allowed' <===parameter ORWCIRN REMOTE DATA ALLOW
|
---|
1314 | end;
|
---|
1315 |
|
---|
1316 | function CheckHL7TCPLink: Boolean;
|
---|
1317 | begin
|
---|
1318 | CallV('ORWCIRN CHECKLINK',[nil]);
|
---|
1319 | Result := RPCBrokerV.Results[0] = '1';
|
---|
1320 | end;
|
---|
1321 |
|
---|
1322 | function UseVistaWeb: Boolean;
|
---|
1323 | begin;
|
---|
1324 | CallV('ORWCIRN VISTAWEB',[nil]);
|
---|
1325 | result := RPCBrokerV.Results[0] = '1';
|
---|
1326 | end;
|
---|
1327 |
|
---|
1328 | function GetVistaWebAddress(value: string): string;
|
---|
1329 | begin
|
---|
1330 | CallV('ORWCIRN WEBADDR', [value]);
|
---|
1331 | result := RPCBrokerV.Results[0];
|
---|
1332 | end;
|
---|
1333 |
|
---|
1334 | procedure ChangeVistaWebParam(value: string);
|
---|
1335 | begin
|
---|
1336 | CallV('ORWCIRN WEBCH',[value]);
|
---|
1337 | end;
|
---|
1338 |
|
---|
1339 | function GetDefaultPrinter(DUZ: Int64; Location: integer): string;
|
---|
1340 | begin
|
---|
1341 | Result := sCallV('ORWRP GET DEFAULT PRINTER', [DUZ, Location]) ;
|
---|
1342 | end;
|
---|
1343 |
|
---|
1344 | initialization
|
---|
1345 | uFMToday := 0;
|
---|
1346 |
|
---|
1347 | end.
|
---|