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