| 1 | unit rGraphs;
 | 
|---|
| 2 | 
 | 
|---|
| 3 | interface
 | 
|---|
| 4 | 
 | 
|---|
| 5 | uses SysUtils, Classes, Controls, Forms, ORNet, ORFn, Graphics;
 | 
|---|
| 6 | 
 | 
|---|
| 7 | function rpcPublicEdit: Boolean;
 | 
|---|
| 8 | function rpcReportParams(ien: integer): String;
 | 
|---|
| 9 | 
 | 
|---|
| 10 | procedure onoff(x: integer);
 | 
|---|
| 11 | 
 | 
|---|
| 12 | function rpcTestGroups(user: int64): TStrings;
 | 
|---|
| 13 | function rpcATest(test: integer): TStrings;
 | 
|---|
| 14 | function rpcATestGroup(testgroup: Integer; user: int64): TStrings;
 | 
|---|
| 15 | function rpcClass(itemtype: string): TStrings;
 | 
|---|
| 16 | function rpcTaxonomy(alltax: boolean; taxonomies: TStrings): TStrings;
 | 
|---|
| 17 | procedure rpcDetailDay(Dest: TStrings; const PatientDFN: string; ADate1, ADate2: TFMDateTime;
 | 
|---|
| 18 |   ATypeItem: string; complete: boolean);  //*DFN*
 | 
|---|
| 19 | function rpcDetailSelected(const PatientDFN: string; ADate1, ADate2: TFMDateTime;
 | 
|---|
| 20 |   tests: TStringList; complete: boolean): TStrings;  //*DFN*
 | 
|---|
| 21 | procedure rpcFastData(const PatientDFN: string; alldata: TStrings; var ok: boolean);
 | 
|---|
| 22 | procedure rpcFastItems(const PatientDFN: string; allitems: TStrings; var ok: boolean);
 | 
|---|
| 23 | procedure rpcFastLabs(const PatientDFN: string; alllabs: TStrings; var ok: boolean);
 | 
|---|
| 24 | function rpcFastTask(const PatientDFN, oldDFN: string): string;
 | 
|---|
| 25 | function rpcGetAllItems(const PatientDFN: string): TStrings;
 | 
|---|
| 26 | function rpcGetItems(typeitem: string; const PatientDFN: string): TStrings;
 | 
|---|
| 27 | function rpcGetItemData(itemdata, timestamp: string; const PatientDFN: string): TStrings;
 | 
|---|
| 28 | function rpcGetTypes(const PatientDFN: string; subtypes: boolean): TStrings;
 | 
|---|
| 29 | function rpcGetTestSpec: TStrings;
 | 
|---|
| 30 | function rpcTesting: TStrings;
 | 
|---|
| 31 | function rpcGetViews(vtype: string; user: int64): TStrings;
 | 
|---|
| 32 | 
 | 
|---|
| 33 | function rpcGetGraphDateRange(reportid: string): TStrings;
 | 
|---|
| 34 | function rpcGetGraphSettings: TStrings;
 | 
|---|
| 35 | procedure rpcSetGraphSettings(paramsetting, permission: string);
 | 
|---|
| 36 | function rpcGetGraphSizing: TStrings;
 | 
|---|
| 37 | procedure rpcSetGraphSizing(values: TStrings);
 | 
|---|
| 38 | 
 | 
|---|
| 39 | function rpcGetGraphProfiles(profiles, permission: string; ext: integer; userx: int64): TStrings;
 | 
|---|
| 40 | procedure rpcSetGraphProfile(paramname, permission: string; paramvalues: TStrings);
 | 
|---|
| 41 | procedure rpcDeleteGraphProfile(paramname, permission: string);
 | 
|---|
| 42 | 
 | 
|---|
| 43 | function rpcLookupItems(const filename, startfrom: string; direction: integer): TStrings;
 | 
|---|
| 44 | function rpcDateItem(oldestdate, newestdate: double; filenum: string; const PatientDFN: string): TStrings;
 | 
|---|
| 45 | 
 | 
|---|
| 46 | implementation
 | 
|---|
| 47 | 
 | 
|---|
| 48 | //-------- RPCs copied from rLabs -------------
 | 
|---|
| 49 | function rpcTestGroups(user: int64): TStrings;
 | 
|---|
| 50 | begin
 | 
|---|
| 51 |   CallV('ORWLRR TG', [user]);
 | 
|---|
| 52 |   MixedCaseList(RPCBrokerV.Results);
 | 
|---|
| 53 |   Result := RPCBrokerV.Results;
 | 
|---|
| 54 | end;
 | 
|---|
| 55 | 
 | 
|---|
| 56 | function rpcATest(test: integer): TStrings;
 | 
|---|
| 57 | begin
 | 
|---|
| 58 |   CallV('ORWLRR ATESTS', [test]);
 | 
|---|
| 59 |   MixedCaseList(RPCBrokerV.Results);
 | 
|---|
| 60 |   Result := RPCBrokerV.Results;
 | 
|---|
| 61 | end;
 | 
|---|
| 62 | 
 | 
|---|
| 63 | function rpcATestGroup(testgroup: Integer; user: int64): TStrings;
 | 
|---|
| 64 | begin
 | 
|---|
| 65 |   CallV('ORWLRR ATG', [testgroup, user]);
 | 
|---|
| 66 |   MixedCaseList(RPCBrokerV.Results);
 | 
|---|
| 67 |   Result := RPCBrokerV.Results;
 | 
|---|
| 68 | end;
 | 
|---|
| 69 | //------------------------------------------
 | 
|---|
| 70 | 
 | 
|---|
| 71 | function rpcPublicEdit: Boolean;
 | 
|---|
| 72 | begin
 | 
|---|
| 73 |   onoff(1);
 | 
|---|
| 74 |   Result := sCallV('ORWGRPC PUBLIC', [nil]) = '1';
 | 
|---|
| 75 |   //Result := false;  //************* for testing turn on
 | 
|---|
| 76 |   onoff(0);
 | 
|---|
| 77 | end;
 | 
|---|
| 78 | 
 | 
|---|
| 79 | function rpcReportParams(ien: integer): String;
 | 
|---|
| 80 | begin
 | 
|---|
| 81 |   onoff(1);
 | 
|---|
| 82 |   Result := sCallV('ORWGRPC RPTPARAM', [ien]);
 | 
|---|
| 83 |   onoff(0);
 | 
|---|
| 84 | end;
 | 
|---|
| 85 | 
 | 
|---|
| 86 | procedure rpcDetailDay(Dest: TStrings; const PatientDFN: string; ADate1, ADate2: TFMDateTime;
 | 
|---|
| 87 |   ATypeItem: string; complete: boolean);  //*DFN*
 | 
|---|
| 88 | var
 | 
|---|
| 89 |   includecomplete: string;
 | 
|---|
| 90 | begin
 | 
|---|
| 91 |   if complete then includecomplete := '1' else includecomplete := '0';
 | 
|---|
| 92 |   onoff(1);
 | 
|---|
| 93 |   CallV('ORWGRPC DETAILS', [PatientDFN, ADate1, ADate2, ATypeItem, includecomplete]);
 | 
|---|
| 94 |   onoff(0);
 | 
|---|
| 95 |   FastAssign(RPCBrokerV.Results, Dest);
 | 
|---|
| 96 | end;
 | 
|---|
| 97 | 
 | 
|---|
| 98 | function rpcDetailSelected(const PatientDFN: string; ADate1, ADate2: TFMDateTime;
 | 
|---|
| 99 |   tests: TStringList; complete: boolean): TStrings;  //*DFN*
 | 
|---|
| 100 | var
 | 
|---|
| 101 |   includecomplete: string;
 | 
|---|
| 102 | begin
 | 
|---|
| 103 |   if complete then includecomplete := '1' else includecomplete := '0';
 | 
|---|
| 104 |   onoff(1);
 | 
|---|
| 105 |   CallV('ORWGRPC DETAIL', [PatientDFN, ADate1, ADate2, tests, includecomplete]);
 | 
|---|
| 106 |   onoff(0);
 | 
|---|
| 107 |   Result := RPCBrokerV.Results;
 | 
|---|
| 108 | end;
 | 
|---|
| 109 | 
 | 
|---|
| 110 | procedure rpcFastData(const PatientDFN: string; alldata: TStrings; var ok: boolean);
 | 
|---|
| 111 | begin
 | 
|---|
| 112 |   onoff(1);
 | 
|---|
| 113 |   CallV('ORWGRPC FASTDATA', [PatientDFN]);
 | 
|---|
| 114 |   onoff(0);
 | 
|---|
| 115 |   FastAssign(RPCBrokerV.Results, alldata);
 | 
|---|
| 116 |   ok := alldata.Count > 0;
 | 
|---|
| 117 | end;
 | 
|---|
| 118 | 
 | 
|---|
| 119 | procedure rpcFastItems(const PatientDFN: string; allitems: TStrings; var ok: boolean);
 | 
|---|
| 120 | begin
 | 
|---|
| 121 |   onoff(1);
 | 
|---|
| 122 |   CallV('ORWGRPC FASTITEM', [PatientDFN]);
 | 
|---|
| 123 |   onoff(0);
 | 
|---|
| 124 |   MixedCaseList(RPCBrokerV.Results);
 | 
|---|
| 125 |   FastAssign(RPCBrokerV.Results, allitems);
 | 
|---|
| 126 |   ok := allitems.Count > 0;
 | 
|---|
| 127 | end;
 | 
|---|
| 128 | 
 | 
|---|
| 129 | procedure rpcFastLabs(const PatientDFN: string; alllabs: TStrings; var ok: boolean);
 | 
|---|
| 130 | begin
 | 
|---|
| 131 |   onoff(1);
 | 
|---|
| 132 |   CallV('ORWGRPC FASTLABS', [PatientDFN]);
 | 
|---|
| 133 |   onoff(0);
 | 
|---|
| 134 |   FastAssign(RPCBrokerV.Results, alllabs);
 | 
|---|
| 135 |   ok := alllabs.Count > 0;
 | 
|---|
| 136 | end;
 | 
|---|
| 137 | 
 | 
|---|
| 138 | function rpcFastTask(const PatientDFN, oldDFN: string): string;
 | 
|---|
| 139 | begin
 | 
|---|
| 140 |   onoff(1);
 | 
|---|
| 141 |   Result := sCallV('ORWGRPC FASTTASK', [PatientDFN, oldDFN]);
 | 
|---|
| 142 |   onoff(0);
 | 
|---|
| 143 | end;
 | 
|---|
| 144 | 
 | 
|---|
| 145 | function rpcGetAllItems(const PatientDFN: string): TStrings;
 | 
|---|
| 146 | begin
 | 
|---|
| 147 |   onoff(1);
 | 
|---|
| 148 |   CallV('ORWGRPC ALLITEMS', [PatientDFN]);
 | 
|---|
| 149 |   onoff(0);
 | 
|---|
| 150 |   MixedCaseList(RPCBrokerV.Results);
 | 
|---|
| 151 |   Result := RPCBrokerV.Results;
 | 
|---|
| 152 | end;
 | 
|---|
| 153 | 
 | 
|---|
| 154 | function rpcGetTypes(const PatientDFN: string; subtypes: boolean): TStrings;
 | 
|---|
| 155 | var
 | 
|---|
| 156 |   includesubtypes: string;
 | 
|---|
| 157 | begin
 | 
|---|
| 158 |   if subtypes then includesubtypes := '1' else includesubtypes := '0';
 | 
|---|
| 159 |   onoff(1);
 | 
|---|
| 160 |   CallV('ORWGRPC TYPES', [PatientDFN, includesubtypes]);
 | 
|---|
| 161 |   onoff(0);
 | 
|---|
| 162 |   MixedCaseList(RPCBrokerV.Results);
 | 
|---|
| 163 |   Result := RPCBrokerV.Results;
 | 
|---|
| 164 | end;
 | 
|---|
| 165 | 
 | 
|---|
| 166 | function rpcGetItems(typeitem: string; const PatientDFN: string): TStrings;
 | 
|---|
| 167 | begin
 | 
|---|
| 168 |   onoff(1);
 | 
|---|
| 169 |   CallV('ORWGRPC ITEMS', [PatientDFN, typeitem]);
 | 
|---|
| 170 |   onoff(0);
 | 
|---|
| 171 |   MixedCaseList(RPCBrokerV.Results);
 | 
|---|
| 172 |   Result := RPCBrokerV.Results;
 | 
|---|
| 173 | end;
 | 
|---|
| 174 | 
 | 
|---|
| 175 | function rpcClass(itemtype: string): TStrings;
 | 
|---|
| 176 | begin
 | 
|---|
| 177 |   onoff(1);
 | 
|---|
| 178 |   CallV('ORWGRPC CLASS', [itemtype]);
 | 
|---|
| 179 |   onoff(0);
 | 
|---|
| 180 |   MixedCaseList(RPCBrokerV.Results);
 | 
|---|
| 181 |   Result := RPCBrokerV.Results;
 | 
|---|
| 182 | end;
 | 
|---|
| 183 | 
 | 
|---|
| 184 | function rpcTaxonomy(alltax: boolean; taxonomies: TStrings): TStrings;
 | 
|---|
| 185 | var
 | 
|---|
| 186 |   getall: string;
 | 
|---|
| 187 | begin
 | 
|---|
| 188 |   if alltax then getall := '1' else getall := '0';
 | 
|---|
| 189 |   onoff(1);
 | 
|---|
| 190 |   CallV('ORWGRPC TAX', [getall, taxonomies]);
 | 
|---|
| 191 |   onoff(0);
 | 
|---|
| 192 |   Result := RPCBrokerV.Results;
 | 
|---|
| 193 | end;
 | 
|---|
| 194 | 
 | 
|---|
| 195 | function rpcGetItemData(itemdata, timestamp: string; const PatientDFN: string): TStrings;
 | 
|---|
| 196 | begin
 | 
|---|
| 197 |   onoff(1);
 | 
|---|
| 198 |   CallV('ORWGRPC ITEMDATA', [itemdata, timestamp, PatientDFN]);
 | 
|---|
| 199 |   onoff(0);
 | 
|---|
| 200 |   Result := RPCBrokerV.Results;
 | 
|---|
| 201 | end;
 | 
|---|
| 202 | 
 | 
|---|
| 203 | function rpcGetGraphDateRange(reportid: string): TStrings;
 | 
|---|
| 204 | begin
 | 
|---|
| 205 |   onoff(1);
 | 
|---|
| 206 |   CallV('ORWGRPC GETDATES', [reportid]);
 | 
|---|
| 207 |   onoff(0);
 | 
|---|
| 208 |   Result := RPCBrokerV.Results;
 | 
|---|
| 209 | end;
 | 
|---|
| 210 | 
 | 
|---|
| 211 | function rpcGetGraphSettings: TStrings;
 | 
|---|
| 212 | begin
 | 
|---|
| 213 |   onoff(1);
 | 
|---|
| 214 |   CallV('ORWGRPC GETPREF', [nil]);
 | 
|---|
| 215 |   onoff(0);
 | 
|---|
| 216 |   Result := RPCBrokerV.Results;
 | 
|---|
| 217 | end;
 | 
|---|
| 218 | 
 | 
|---|
| 219 | procedure rpcSetGraphSettings(paramsetting, permission: string);
 | 
|---|
| 220 | begin
 | 
|---|
| 221 |   onoff(1);
 | 
|---|
| 222 |   CallV('ORWGRPC SETPREF', [paramsetting, permission]);
 | 
|---|
| 223 |   onoff(0);
 | 
|---|
| 224 | end;
 | 
|---|
| 225 | 
 | 
|---|
| 226 | function rpcGetGraphSizing: TStrings;
 | 
|---|
| 227 | begin
 | 
|---|
| 228 |   onoff(1);
 | 
|---|
| 229 |   CallV('ORWGRPC GETSIZE', [nil]);
 | 
|---|
| 230 |   onoff(0);
 | 
|---|
| 231 |   Result := RPCBrokerV.Results;
 | 
|---|
| 232 | end;
 | 
|---|
| 233 | 
 | 
|---|
| 234 | procedure rpcSetGraphSizing(values: TStrings);
 | 
|---|
| 235 | begin
 | 
|---|
| 236 |   onoff(1);
 | 
|---|
| 237 |   CallV('ORWGRPC SETSIZE', [values]);
 | 
|---|
| 238 |   onoff(0);
 | 
|---|
| 239 | end;
 | 
|---|
| 240 | 
 | 
|---|
| 241 | function rpcGetGraphProfiles(profiles, permission: string; ext: integer; userx: int64): TStrings;
 | 
|---|
| 242 | begin
 | 
|---|
| 243 |   onoff(1);
 | 
|---|
| 244 |   CallV('ORWGRPC GETVIEWS', [profiles, permission, ext, userx]);
 | 
|---|
| 245 |   onoff(0);
 | 
|---|
| 246 |   if (profiles = '1') or (ext = 1) then
 | 
|---|
| 247 |     MixedCaseList(RPCBrokerV.Results);
 | 
|---|
| 248 |   Result := RPCBrokerV.Results;
 | 
|---|
| 249 | end;
 | 
|---|
| 250 | 
 | 
|---|
| 251 | procedure rpcSetGraphProfile(paramname, permission: string; paramvalues: TStrings);
 | 
|---|
| 252 | begin
 | 
|---|
| 253 |   onoff(1);
 | 
|---|
| 254 |   CallV('ORWGRPC SETVIEWS', [paramname, permission, paramvalues]);
 | 
|---|
| 255 |   onoff(0);
 | 
|---|
| 256 | end;
 | 
|---|
| 257 | 
 | 
|---|
| 258 | procedure rpcDeleteGraphProfile(paramname, permission: string);
 | 
|---|
| 259 | begin
 | 
|---|
| 260 |   onoff(1);
 | 
|---|
| 261 |   CallV('ORWGRPC DELVIEWS', [paramname, permission]);
 | 
|---|
| 262 |   onoff(0);
 | 
|---|
| 263 | end;
 | 
|---|
| 264 | 
 | 
|---|
| 265 | function rpcGetTestSpec: TStrings;
 | 
|---|
| 266 | begin
 | 
|---|
| 267 |   onoff(1);
 | 
|---|
| 268 |   CallV('ORWGRPC TESTSPEC', []);
 | 
|---|
| 269 |   onoff(0);
 | 
|---|
| 270 |   Result := RPCBrokerV.Results;
 | 
|---|
| 271 | end;
 | 
|---|
| 272 | 
 | 
|---|
| 273 | function rpcTesting: TStrings;
 | 
|---|
| 274 | begin
 | 
|---|
| 275 |   onoff(1);
 | 
|---|
| 276 |   CallV('ORWGRPC TESTING', []);
 | 
|---|
| 277 |   onoff(0);
 | 
|---|
| 278 |   Result := RPCBrokerV.Results;
 | 
|---|
| 279 | end;
 | 
|---|
| 280 | 
 | 
|---|
| 281 | function rpcGetViews(vtype: string; user: int64): TStrings;
 | 
|---|
| 282 | begin
 | 
|---|
| 283 |   onoff(1);
 | 
|---|
| 284 |   CallV('ORWGRPC ALLVIEWS', [vtype, user]);
 | 
|---|
| 285 |   onoff(0);
 | 
|---|
| 286 |   MixedCaseList(RPCBrokerV.Results);
 | 
|---|
| 287 |   Result := RPCBrokerV.Results;
 | 
|---|
| 288 | end;
 | 
|---|
| 289 | 
 | 
|---|
| 290 | function rpcLookupItems(const filename, StartFrom: string; Direction: integer): TStrings;
 | 
|---|
| 291 | begin
 | 
|---|
| 292 |   onoff(1);
 | 
|---|
| 293 |   CallV('ORWGRPC LOOKUP', [filename, StartFrom, Direction]);
 | 
|---|
| 294 |   onoff(0);
 | 
|---|
| 295 |   MixedCaseList(RPCBrokerV.Results);
 | 
|---|
| 296 |   Result := RPCBrokerV.Results;
 | 
|---|
| 297 | end;
 | 
|---|
| 298 | 
 | 
|---|
| 299 | function rpcDateItem(oldestdate, newestdate: double; filenum: string; const PatientDFN: string): TStrings;
 | 
|---|
| 300 | begin
 | 
|---|
| 301 |   onoff(1);
 | 
|---|
| 302 |   CallV('ORWGRPC DATEITEM', [oldestdate, newestdate, filenum, PatientDFN]);
 | 
|---|
| 303 |   onoff(0);
 | 
|---|
| 304 |   Result := RPCBrokerV.Results;
 | 
|---|
| 305 | end;
 | 
|---|
| 306 | 
 | 
|---|
| 307 | procedure onoff(x: integer);
 | 
|---|
| 308 | begin
 | 
|---|
| 309 |   if x = 1 then
 | 
|---|
| 310 |   begin
 | 
|---|
| 311 |     //beep;
 | 
|---|
| 312 |     //Screen.Cursor := crHourGlass;
 | 
|---|
| 313 |   end
 | 
|---|
| 314 |   else
 | 
|---|
| 315 |   begin
 | 
|---|
| 316 |     //sleep(3000);
 | 
|---|
| 317 |     //Screen.Cursor := crDefault;
 | 
|---|
| 318 |     //sleep(1000);
 | 
|---|
| 319 |   end;
 | 
|---|
| 320 | end;
 | 
|---|
| 321 | 
 | 
|---|
| 322 | end.
 | 
|---|