| [459] | 1 | unit rReminders;
 | 
|---|
 | 2 | 
 | 
|---|
 | 3 | interface
 | 
|---|
 | 4 | uses
 | 
|---|
 | 5 |   Windows,Classes, SysUtils, TRPCB, ORNet, ORFn;
 | 
|---|
 | 6 | 
 | 
|---|
 | 7 | procedure GetCurrentReminders;
 | 
|---|
 | 8 | procedure GetOtherReminders(Dest: TStrings);
 | 
|---|
 | 9 | procedure EvaluateReminders(RemList: TStringList);
 | 
|---|
 | 10 | function EvaluateReminder(IEN: string): string;
 | 
|---|
 | 11 | procedure GetEducationTopicsForReminder(ReminderID: integer);
 | 
|---|
 | 12 | procedure GetEducationSubtopics(TopicID: integer);
 | 
|---|
 | 13 | procedure GetReminderWebPages(ReminderID: string);
 | 
|---|
 | 14 | function DetailReminder(IEN: Integer): TStrings;
 | 
|---|
 | 15 | function ReminderInquiry(IEN: Integer): TStrings;
 | 
|---|
 | 16 | function EducationTopicDetail(IEN: Integer): TStrings;
 | 
|---|
 | 17 | function GetDialogInfo(IEN: string; RemIEN: boolean): TStrings;
 | 
|---|
 | 18 | function GetDialogPrompts(IEN: string; Historical: boolean; FindingType: string): TStrings;
 | 
|---|
 | 19 | procedure GetDialogStatus(AList: TStringList);
 | 
|---|
 | 20 | function GetRemindersActive: boolean;
 | 
|---|
 | 21 | function GetProgressNoteHeader: string;
 | 
|---|
 | 22 | function LoadMentalHealthTest(TestName: string): TStrings;
 | 
|---|
 | 23 | procedure MentalHealthTestResults(var AText: string; const DlgIEN: integer; const TestName:
 | 
|---|
 | 24 |                                   string; const AProvider: Int64; const Answers: string);
 | 
|---|
 | 25 | procedure SaveMentalHealthTest(const TestName: string; ADate: TFMDateTime;
 | 
|---|
 | 26 |                                const AProvider: Int64; const Answers: string);
 | 
|---|
 | 27 | procedure SaveWomenHealthData(var WHData: TStringlist);
 | 
|---|
 | 28 | function CheckGECValue(const RemIEN: string; NoteIEN: integer): String;
 | 
|---|
 | 29 | procedure SaveMSTDataFromReminder(VDate, Sts, Prov, FType, FIEN, Res: string);
 | 
|---|
 | 30 | 
 | 
|---|
 | 31 | function GetReminderFolders: string;
 | 
|---|
 | 32 | procedure SetReminderFolders(const Value: string);
 | 
|---|
 | 33 | function GetDefLocations: TStrings;
 | 
|---|
 | 34 | function InsertRemTextAtCursor: boolean;
 | 
|---|
 | 35 | 
 | 
|---|
 | 36 | function NewRemCoverSheetListActive: boolean;
 | 
|---|
 | 37 | function CanEditAllRemCoverSheetLists: boolean;
 | 
|---|
 | 38 | function GetCoverSheetLevelData(ALevel, AClass: string): TStrings;
 | 
|---|
 | 39 | procedure SetCoverSheetLevelData(ALevel, AClass: string; Data: TStrings);
 | 
|---|
 | 40 | function GetCategoryItems(CatIEN: integer): TStrings;
 | 
|---|
 | 41 | function GetAllRemindersAndCategories: TStrings;
 | 
|---|
| [460] | 42 | function VerifyMentalHealthTestComplete(TestName, Answers: string): String;
 | 
|---|
| [459] | 43 | 
 | 
|---|
| [460] | 44 | 
 | 
|---|
| [459] | 45 | implementation
 | 
|---|
 | 46 | 
 | 
|---|
 | 47 | uses
 | 
|---|
 | 48 |   uCore, uReminders, rCore;
 | 
|---|
 | 49 | 
 | 
|---|
 | 50 | var
 | 
|---|
 | 51 |   uLastDefLocUser: int64 = -1;
 | 
|---|
 | 52 |   uDefLocs: TStringList = nil;
 | 
|---|
 | 53 |   uRemInsertAtCursor: integer = -1;
 | 
|---|
 | 54 |   uNewCoverSheetListActive: integer = -1;
 | 
|---|
 | 55 |   uCanEditAllCoverSheetLists: integer = -1;
 | 
|---|
 | 56 | 
 | 
|---|
 | 57 | procedure GetCurrentReminders;
 | 
|---|
 | 58 | begin
 | 
|---|
 | 59 |   CallV('ORQQPXRM REMINDERS UNEVALUATED', [Patient.DFN, Encounter.Location]);
 | 
|---|
 | 60 | end;
 | 
|---|
 | 61 | 
 | 
|---|
 | 62 | procedure GetOtherReminders(Dest: TStrings);
 | 
|---|
 | 63 | begin
 | 
|---|
 | 64 |   CallV('ORQQPXRM REMINDER CATEGORIES', [Patient.DFN, Encounter.Location]);
 | 
|---|
 | 65 |   Dest.Assign(RPCBrokerV.Results);
 | 
|---|
 | 66 | end;
 | 
|---|
 | 67 | 
 | 
|---|
 | 68 | procedure EvaluateReminders(RemList: TStringList);
 | 
|---|
 | 69 | var
 | 
|---|
 | 70 |   i: integer;
 | 
|---|
 | 71 | 
 | 
|---|
 | 72 | begin
 | 
|---|
 | 73 |   with RPCBrokerV do
 | 
|---|
 | 74 |   begin
 | 
|---|
 | 75 |     ClearParameters := True;
 | 
|---|
 | 76 |     RemoteProcedure := 'ORQQPXRM REMINDER EVALUATION';
 | 
|---|
 | 77 |     Param[0].PType := literal;
 | 
|---|
 | 78 |     Param[0].Value := Patient.DFN;
 | 
|---|
 | 79 |     Param[1].PType := list;
 | 
|---|
 | 80 |     for i := 0 to RemList.Count-1 do
 | 
|---|
 | 81 |       Param[1].Mult[IntToStr(i+1)] := Piece(RemList[i],U,1);
 | 
|---|
 | 82 |     CallBroker;
 | 
|---|
 | 83 |   end;
 | 
|---|
 | 84 | end;
 | 
|---|
 | 85 | 
 | 
|---|
 | 86 | function EvaluateReminder(IEN: string): string;
 | 
|---|
 | 87 | var
 | 
|---|
 | 88 |   TmpSL: TStringList;
 | 
|---|
 | 89 | 
 | 
|---|
 | 90 | begin
 | 
|---|
 | 91 |   TmpSL := TStringList.Create;
 | 
|---|
 | 92 |   try
 | 
|---|
 | 93 |     TmpSL.Add(IEN);
 | 
|---|
 | 94 |     EvaluateReminders(TmpSL);
 | 
|---|
 | 95 |     if(RPCBrokerV.Results.Count > 0) then
 | 
|---|
 | 96 |       Result := RPCBrokerV.Results[0]
 | 
|---|
 | 97 |     else
 | 
|---|
 | 98 |       Result := IEN;
 | 
|---|
 | 99 |   finally
 | 
|---|
 | 100 |     TmpSL.Free;
 | 
|---|
 | 101 |   end;
 | 
|---|
 | 102 | end;
 | 
|---|
 | 103 | 
 | 
|---|
 | 104 | procedure GetEducationTopicsForReminder(ReminderID: integer);
 | 
|---|
 | 105 | begin
 | 
|---|
 | 106 |   CallV('ORQQPXRM EDUCATION SUMMARY', [ReminderID]);
 | 
|---|
 | 107 | end;
 | 
|---|
 | 108 | 
 | 
|---|
 | 109 | procedure GetEducationSubtopics(TopicID: integer);
 | 
|---|
 | 110 | begin
 | 
|---|
 | 111 |   CallV('ORQQPXRM EDUCATION SUBTOPICS', [TopicID]);
 | 
|---|
 | 112 | end;
 | 
|---|
 | 113 | 
 | 
|---|
 | 114 | procedure GetReminderWebPages(ReminderID: string);
 | 
|---|
 | 115 | begin
 | 
|---|
 | 116 |   if(User.WebAccess) then
 | 
|---|
 | 117 |     CallV('ORQQPXRM REMINDER WEB', [ReminderID])
 | 
|---|
 | 118 |   else
 | 
|---|
 | 119 |     RPCBrokerV.ClearParameters := True;
 | 
|---|
 | 120 | end;
 | 
|---|
 | 121 | 
 | 
|---|
 | 122 | function DetailReminder(IEN: Integer): TStrings; // Clinical Maintenance
 | 
|---|
 | 123 | begin
 | 
|---|
 | 124 |   if InteractiveRemindersActive then
 | 
|---|
 | 125 |     CallV('ORQQPXRM REMINDER DETAIL', [Patient.DFN, IEN])
 | 
|---|
 | 126 |   else
 | 
|---|
 | 127 |     CallV('ORQQPX REMINDER DETAIL', [Patient.DFN, IEN]);
 | 
|---|
 | 128 |   Result := RPCBrokerV.Results;
 | 
|---|
 | 129 | end;
 | 
|---|
 | 130 | 
 | 
|---|
 | 131 | function ReminderInquiry(IEN: Integer): TStrings;
 | 
|---|
 | 132 | begin
 | 
|---|
 | 133 |   CallV('ORQQPXRM REMINDER INQUIRY', [IEN]);
 | 
|---|
 | 134 |   Result := RPCBrokerV.Results;
 | 
|---|
 | 135 | end;
 | 
|---|
 | 136 | 
 | 
|---|
 | 137 | function EducationTopicDetail(IEN: Integer): TStrings;
 | 
|---|
 | 138 | begin
 | 
|---|
 | 139 |   CallV('ORQQPXRM EDUCATION TOPIC', [IEN]);
 | 
|---|
 | 140 |   Result := RPCBrokerV.Results;
 | 
|---|
 | 141 | end;
 | 
|---|
 | 142 | 
 | 
|---|
 | 143 | function GetDialogInfo(IEN: string; RemIEN: boolean): TStrings;
 | 
|---|
 | 144 | begin
 | 
|---|
 | 145 |      if RemIEN then
 | 
|---|
 | 146 |         CallV('ORQQPXRM REMINDER DIALOG', [IEN, Patient.DFN])
 | 
|---|
 | 147 |      else
 | 
|---|
 | 148 |         CallV('PXRM REMINDER DIALOG (TIU)', [IEN, Patient.DFN]);
 | 
|---|
 | 149 |      Result := RPCBrokerV.Results;
 | 
|---|
 | 150 | end;
 | 
|---|
 | 151 | 
 | 
|---|
 | 152 | function GetDialogPrompts(IEN: string; Historical: boolean; FindingType: string): TStrings;
 | 
|---|
 | 153 | begin
 | 
|---|
 | 154 |   CallV('ORQQPXRM DIALOG PROMPTS', [IEN, Historical, FindingType]);
 | 
|---|
 | 155 |   Result := RPCBrokerV.Results;
 | 
|---|
 | 156 | end;
 | 
|---|
 | 157 | 
 | 
|---|
 | 158 | procedure GetDialogStatus(AList: TStringList);
 | 
|---|
 | 159 | var
 | 
|---|
 | 160 |   i: integer;
 | 
|---|
 | 161 | 
 | 
|---|
 | 162 | begin
 | 
|---|
 | 163 |   if(Alist.Count = 0) then exit;
 | 
|---|
 | 164 |   with RPCBrokerV do
 | 
|---|
 | 165 |   begin
 | 
|---|
 | 166 |     ClearParameters := True;
 | 
|---|
 | 167 |     RemoteProcedure := 'ORQQPXRM DIALOG ACTIVE';
 | 
|---|
 | 168 |     Param[0].PType := list;
 | 
|---|
 | 169 |     for i := 0 to AList.Count-1 do
 | 
|---|
 | 170 |       Param[0].Mult[AList[i]] := '';
 | 
|---|
 | 171 |     CallBroker;
 | 
|---|
 | 172 |     AList.Assign(Results);
 | 
|---|
 | 173 |   end;
 | 
|---|
 | 174 | end;
 | 
|---|
 | 175 | 
 | 
|---|
 | 176 | function GetRemindersActive: boolean;
 | 
|---|
 | 177 | begin
 | 
|---|
 | 178 |   CallV('ORQQPX NEW REMINDERS ACTIVE', []);
 | 
|---|
 | 179 |   Result := ((RPCBrokerV.Results.Count = 1) and (RPCBrokerV.Results[0] = '1'));
 | 
|---|
 | 180 | end;
 | 
|---|
 | 181 | 
 | 
|---|
 | 182 | function GetProgressNoteHeader: string;
 | 
|---|
 | 183 | begin
 | 
|---|
 | 184 |   Result := sCallV('ORQQPXRM PROGRESS NOTE HEADER', [Encounter.Location]);
 | 
|---|
 | 185 | end;
 | 
|---|
 | 186 | 
 | 
|---|
 | 187 | function LoadMentalHealthTest(TestName: string): TStrings;
 | 
|---|
 | 188 | begin
 | 
|---|
 | 189 |   CallV('ORQQPXRM MENTAL HEALTH', [TestName]);
 | 
|---|
 | 190 |   Result := RPCBrokerV.Results;
 | 
|---|
 | 191 | end;
 | 
|---|
 | 192 | 
 | 
|---|
 | 193 | procedure MentalHealthTestResults(var AText: string; const DlgIEN: integer; const TestName:
 | 
|---|
 | 194 |                                   string; const AProvider: Int64; const Answers: string);
 | 
|---|
 | 195 | var
 | 
|---|
 | 196 |   i, R: integer;
 | 
|---|
 | 197 |   Ans, tmp: string;
 | 
|---|
 | 198 | 
 | 
|---|
 | 199 | begin
 | 
|---|
 | 200 |   with RPCBrokerV do
 | 
|---|
 | 201 |   begin
 | 
|---|
 | 202 |     ClearParameters := True;
 | 
|---|
 | 203 |     RemoteProcedure := 'ORQQPXRM MENTAL HEALTH RESULTS';
 | 
|---|
 | 204 |     Param[0].PType := literal;
 | 
|---|
 | 205 |     Param[0].Value := IntToStr(DlgIEN);
 | 
|---|
 | 206 |     Param[1].PType := list;
 | 
|---|
 | 207 |     Param[1].Mult['"DFN"'] := Patient.DFN;
 | 
|---|
 | 208 |     Param[1].Mult['"CODE"'] := TestName;
 | 
|---|
 | 209 |     Param[1].Mult['"ADATE"'] := 'T';
 | 
|---|
 | 210 |     Param[1].Mult['"STAFF"'] := IntToStr(AProvider);
 | 
|---|
 | 211 |     R := 0;
 | 
|---|
 | 212 |     tmp := '';
 | 
|---|
 | 213 |     Ans := Answers;
 | 
|---|
 | 214 |     repeat
 | 
|---|
 | 215 |       tmp := copy(Ans,1,200);
 | 
|---|
 | 216 |       delete(Ans,1,200);
 | 
|---|
 | 217 |       inc(R);
 | 
|---|
 | 218 |       Param[1].Mult['"R' + IntToStr(R) + '"'] := tmp;
 | 
|---|
 | 219 |     until(Ans = '');
 | 
|---|
 | 220 |     CallBroker;
 | 
|---|
 | 221 |     AText := '';
 | 
|---|
 | 222 |     for i := 0 to Results.Count-1 do
 | 
|---|
 | 223 |     begin
 | 
|---|
 | 224 |       tmp := Results[i];
 | 
|---|
 | 225 |       if(Piece(tmp,U,1) = '7') then
 | 
|---|
 | 226 |       begin
 | 
|---|
 | 227 |         if(AText <> '') then
 | 
|---|
 | 228 |         begin
 | 
|---|
 | 229 |           if(copy(AText, length(AText), 1) = '.') then
 | 
|---|
 | 230 |             AText := AText + ' ';
 | 
|---|
 | 231 |           AText := AText + ' ';
 | 
|---|
 | 232 |         end;
 | 
|---|
 | 233 |         AText := AText + Trim(Piece(tmp, U, 2));
 | 
|---|
 | 234 |       end;
 | 
|---|
 | 235 |     end;
 | 
|---|
 | 236 |   end;
 | 
|---|
 | 237 | end;
 | 
|---|
 | 238 | 
 | 
|---|
 | 239 | procedure SaveMentalHealthTest(const TestName: string; ADate: TFMDateTime;
 | 
|---|
 | 240 |                                const AProvider: Int64; const Answers: string);
 | 
|---|
 | 241 | var
 | 
|---|
 | 242 |   R: integer;
 | 
|---|
 | 243 |   Ans, tmp: string;
 | 
|---|
 | 244 | 
 | 
|---|
 | 245 | begin
 | 
|---|
 | 246 |   with RPCBrokerV do
 | 
|---|
 | 247 |   begin
 | 
|---|
 | 248 |     ClearParameters := True;
 | 
|---|
 | 249 |     RemoteProcedure := 'ORQQPXRM MENTAL HEALTH SAVE';
 | 
|---|
 | 250 |     Param[0].PType := list;
 | 
|---|
 | 251 |     Param[0].Mult['"DFN"'] := Patient.DFN;
 | 
|---|
 | 252 |     Param[0].Mult['"CODE"'] := TestName;
 | 
|---|
 | 253 |     Param[0].Mult['"ADATE"'] := FloatToStr(ADate);
 | 
|---|
 | 254 |     Param[0].Mult['"STAFF"'] := IntToStr(AProvider);
 | 
|---|
 | 255 |     R := 0;
 | 
|---|
 | 256 |     tmp := '';
 | 
|---|
 | 257 |     Ans := Answers;
 | 
|---|
 | 258 |     repeat
 | 
|---|
 | 259 |       tmp := copy(Ans,1,200);
 | 
|---|
 | 260 |       delete(Ans,1,200);
 | 
|---|
 | 261 |       inc(R);
 | 
|---|
 | 262 |       Param[0].Mult['"R' + IntToStr(R) + '"'] := tmp;
 | 
|---|
 | 263 |     until(Ans = '');
 | 
|---|
 | 264 |     CallBroker;
 | 
|---|
 | 265 |   end;
 | 
|---|
 | 266 | end;
 | 
|---|
 | 267 | 
 | 
|---|
 | 268 | procedure SaveWomenHealthData(var WHData: TStringlist);
 | 
|---|
 | 269 | begin
 | 
|---|
 | 270 |   if assigned(WHData) then
 | 
|---|
 | 271 |   begin
 | 
|---|
 | 272 |   CallV('ORQQPXRM WOMEN HEALTH SAVE', [WHData]);
 | 
|---|
 | 273 | //  if RPCBrokerV.Results<>nil then
 | 
|---|
 | 274 | //  infoBox(RPCBrokerV.Results.Text,'Error in Saving WH Data',MB_OK);
 | 
|---|
 | 275 |   end;
 | 
|---|
 | 276 | end;
 | 
|---|
 | 277 | 
 | 
|---|
 | 278 | function CheckGECValue(const RemIEN: string; NoteIEN: integer): String;
 | 
|---|
 | 279 | var
 | 
|---|
 | 280 | ans,str,str1,title: string;
 | 
|---|
 | 281 | fin: boolean;
 | 
|---|
 | 282 | i,cnt: integer;
 | 
|---|
 | 283 | 
 | 
|---|
 | 284 | begin
 | 
|---|
 | 285 |   Result := sCallV('ORQQPXRM GEC DIALOG', [RemIEN, Patient.DFN, Encounter.VisitStr, NoteIEN]);
 | 
|---|
 | 286 |   if Piece(Result,U,1) <> '0' then
 | 
|---|
 | 287 |   begin
 | 
|---|
 | 288 |     if Piece(Result,U,5)='1' then
 | 
|---|
 | 289 |         begin
 | 
|---|
 | 290 |             if pos('~',Piece(Result,U,4))>0 then
 | 
|---|
 | 291 |                begin
 | 
|---|
 | 292 |                str:='';
 | 
|---|
 | 293 |                str1 := Piece(Result,U,4);
 | 
|---|
 | 294 |                cnt := DelimCount(str1, '~');
 | 
|---|
 | 295 |                for i:=1 to cnt+1 do
 | 
|---|
 | 296 |                    begin
 | 
|---|
 | 297 |                    if i = 1 then str := Piece(str1,'~',i);
 | 
|---|
 | 298 |                    if i > 1 then str :=str+CRLF+Piece(str1,'~',i);
 | 
|---|
 | 299 |                    end;
 | 
|---|
 | 300 |              end
 | 
|---|
 | 301 |              else str := Piece(Result,U,1);
 | 
|---|
 | 302 |         title := Piece(Result,U,3);
 | 
|---|
 | 303 |         fin := (InfoBox(str,title, MB_YESNO)=IDYES);
 | 
|---|
 | 304 |         if fin = true then ans := '1';
 | 
|---|
 | 305 |         if fin = false then ans := '0';
 | 
|---|
 | 306 |         CallV('ORQQPXRM GEC FINISHED?',[Patient.DFN,ans]);
 | 
|---|
 | 307 |         end;
 | 
|---|
 | 308 |    Result := Piece(Result, U,2);
 | 
|---|
 | 309 |    end
 | 
|---|
 | 310 |   else Result := '';
 | 
|---|
 | 311 | end;
 | 
|---|
 | 312 | 
 | 
|---|
 | 313 | procedure SaveMSTDataFromReminder(VDate, Sts, Prov, FType, FIEN, Res: string);
 | 
|---|
 | 314 | begin
 | 
|---|
 | 315 |   CallV('ORQQPXRM MST UPDATE', [Patient.DFN, VDate, Sts, Prov, FType, FIEN, Res]);
 | 
|---|
 | 316 | end;
 | 
|---|
 | 317 | 
 | 
|---|
 | 318 | function GetReminderFolders: string;
 | 
|---|
 | 319 | begin
 | 
|---|
 | 320 |   Result := sCallV('ORQQPX GET FOLDERS', []);
 | 
|---|
 | 321 | end;
 | 
|---|
 | 322 | 
 | 
|---|
 | 323 | procedure SetReminderFolders(const Value: string);
 | 
|---|
 | 324 | begin
 | 
|---|
 | 325 |   CallV('ORQQPX SET FOLDERS', [Value]);
 | 
|---|
 | 326 | end;
 | 
|---|
 | 327 | 
 | 
|---|
 | 328 | function GetDefLocations: TStrings;
 | 
|---|
 | 329 | begin
 | 
|---|
 | 330 |   if (User.DUZ <> uLastDefLocUser) then
 | 
|---|
 | 331 |   begin
 | 
|---|
 | 332 |     if(not assigned(uDefLocs)) then
 | 
|---|
 | 333 |       uDefLocs := TStringList.Create;
 | 
|---|
 | 334 |     tCallV(uDefLocs, 'ORQQPX GET DEF LOCATIONS', []);
 | 
|---|
 | 335 |     uLastDefLocUser := User.DUZ;
 | 
|---|
 | 336 |   end;
 | 
|---|
 | 337 |   Result := uDefLocs;
 | 
|---|
 | 338 | end;
 | 
|---|
 | 339 | 
 | 
|---|
 | 340 | function InsertRemTextAtCursor: boolean;
 | 
|---|
 | 341 | begin
 | 
|---|
 | 342 |   if uRemInsertAtCursor < 0 then
 | 
|---|
 | 343 |   begin
 | 
|---|
 | 344 |     Result := (sCallV('ORQQPX REM INSERT AT CURSOR', []) = '1');
 | 
|---|
 | 345 |     uRemInsertAtCursor := ord(Result);
 | 
|---|
 | 346 |   end
 | 
|---|
 | 347 |   else
 | 
|---|
 | 348 |     Result := Boolean(uRemInsertAtCursor);
 | 
|---|
 | 349 | end;
 | 
|---|
 | 350 | 
 | 
|---|
 | 351 | function NewRemCoverSheetListActive: boolean;
 | 
|---|
 | 352 | begin
 | 
|---|
 | 353 |   if uNewCoverSheetListActive < 0 then
 | 
|---|
 | 354 |   begin
 | 
|---|
 | 355 |     Result := (sCallV('ORQQPX NEW COVER SHEET ACTIVE', []) = '1');
 | 
|---|
 | 356 |     uNewCoverSheetListActive := ord(Result);
 | 
|---|
 | 357 |   end
 | 
|---|
 | 358 |   else
 | 
|---|
 | 359 |     Result := Boolean(uNewCoverSheetListActive);
 | 
|---|
 | 360 | end;
 | 
|---|
 | 361 | 
 | 
|---|
 | 362 | function CanEditAllRemCoverSheetLists: boolean;
 | 
|---|
 | 363 | begin
 | 
|---|
 | 364 |   if uCanEditAllCoverSheetLists < 0 then
 | 
|---|
 | 365 |   begin
 | 
|---|
 | 366 |     Result := HasMenuOptionAccess('PXRM CPRS CONFIGURATION');
 | 
|---|
 | 367 |     uCanEditAllCoverSheetLists := ord(Result);
 | 
|---|
 | 368 |   end
 | 
|---|
 | 369 |   else
 | 
|---|
 | 370 |     Result := Boolean(uCanEditAllCoverSheetLists);
 | 
|---|
 | 371 | end;
 | 
|---|
 | 372 | 
 | 
|---|
 | 373 | function GetCoverSheetLevelData(ALevel, AClass: string): TStrings;
 | 
|---|
 | 374 | begin
 | 
|---|
 | 375 |   CallV('ORQQPX LVREMLST', [ALevel, AClass]);
 | 
|---|
 | 376 |   Result := RPCBrokerV.Results;
 | 
|---|
 | 377 | end;
 | 
|---|
 | 378 | 
 | 
|---|
 | 379 | procedure SetCoverSheetLevelData(ALevel, AClass: string; Data: TStrings);
 | 
|---|
 | 380 | var
 | 
|---|
 | 381 |   i: integer;
 | 
|---|
 | 382 | 
 | 
|---|
 | 383 | begin
 | 
|---|
 | 384 |   with RPCBrokerV do
 | 
|---|
 | 385 |   begin
 | 
|---|
 | 386 |     ClearParameters := True;
 | 
|---|
 | 387 |     RemoteProcedure := 'ORQQPX SAVELVL';
 | 
|---|
 | 388 |     Param[0].PType := literal;
 | 
|---|
 | 389 |     Param[0].Value := ALevel;
 | 
|---|
 | 390 |     Param[1].PType := literal;
 | 
|---|
 | 391 |     Param[1].Value := AClass;
 | 
|---|
 | 392 |     Param[2].PType := list;
 | 
|---|
 | 393 |     for i := 0 to Data.Count-1 do
 | 
|---|
 | 394 |       Param[2].Mult[IntToStr(i+1)] := Data[i];
 | 
|---|
 | 395 |     CallBroker;
 | 
|---|
 | 396 |   end;
 | 
|---|
 | 397 | end;
 | 
|---|
 | 398 | 
 | 
|---|
 | 399 | function GetCategoryItems(CatIEN: integer): TStrings;
 | 
|---|
 | 400 | begin
 | 
|---|
 | 401 |   CallV('PXRM REMINDER CATEGORY', [CatIEN]);
 | 
|---|
 | 402 |   Result := RPCBrokerV.Results;
 | 
|---|
 | 403 | end;
 | 
|---|
 | 404 | 
 | 
|---|
 | 405 | function GetAllRemindersAndCategories: TStrings;
 | 
|---|
 | 406 | begin
 | 
|---|
 | 407 |   CallV('PXRM REMINDERS AND CATEGORIES', []);
 | 
|---|
 | 408 |   Result := RPCBrokerV.Results;
 | 
|---|
 | 409 | end;
 | 
|---|
 | 410 | 
 | 
|---|
| [460] | 411 | function VerifyMentalHealthTestComplete(TestName, Answers: string): String;
 | 
|---|
 | 412 | 
 | 
|---|
 | 413 | begin
 | 
|---|
 | 414 |     CallV('ORQQPXRM MHV', [Patient.DFN, TestName, Answers]);
 | 
|---|
 | 415 |     if RPCBrokerV.Results[0]='2' then
 | 
|---|
 | 416 |       begin
 | 
|---|
 | 417 |         Result := '2'+ U;
 | 
|---|
 | 418 |         EXIT;
 | 
|---|
 | 419 |       end;
 | 
|---|
 | 420 |     if RPCBrokerV.Results[0] = '1' then
 | 
|---|
 | 421 |       begin
 | 
|---|
 | 422 |         Result := '1' + U;
 | 
|---|
 | 423 |         EXIT;
 | 
|---|
 | 424 |       end;
 | 
|---|
 | 425 |     if RPCBrokerV.Results[0] = '0' then
 | 
|---|
 | 426 |       begin
 | 
|---|
 | 427 |         Result := '0' + U + RPCBrokerV.Results[1];
 | 
|---|
 | 428 |         EXIT;
 | 
|---|
 | 429 |       end;
 | 
|---|
 | 430 | end;
 | 
|---|
 | 431 | 
 | 
|---|
| [459] | 432 | initialization
 | 
|---|
 | 433 | 
 | 
|---|
 | 434 | finalization
 | 
|---|
 | 435 |   FreeAndNil(uDefLocs);
 | 
|---|
 | 436 | 
 | 
|---|
 | 437 | end.
 | 
|---|