Changeset 829 for cprs/trunk/CPRS-Chart/Orders/rODLab.pas
- Timestamp:
- Jul 7, 2010, 4:31:10 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/trunk/CPRS-Chart/Orders/rODLab.pas
r456 r829 23 23 function GetLastCollectionTime: string; 24 24 procedure GetPatientBBInfo(Dest: TStrings; PatientID: string; Loc: integer); 25 procedure ListForQuickOrders(var AListIEN, ACount: Integer; const DGrpNm: string); 26 procedure SubsetOfQuickOrders(Dest: TStringList; AListIEN, First, Last: Integer); 25 27 procedure GetPatientBloodResults(Dest: TStrings; PatientID: string; ATests: TStringList); 26 28 procedure GetPatientBloodResultsRaw(Dest: TStrings; PatientID: string; ATests: TStringList); 27 29 function StatAllowed(PatientID: string): boolean; 28 30 procedure GetBloodComponents(Dest: TStrings); 31 function NursAdminSuppress: boolean; 32 function GetSubtype(TestName: string): string; 33 function TNSDaysBack: integer; 34 procedure CheckForChangeFromLCtoWCOnAccept(Dest: TStrings; ALocation: integer; AStartDate, ACollType, ASchedule, ADuration: string); 35 procedure CheckForChangeFromLCtoWCOnRelease(Dest: TStrings; ALocation: integer; OrderList: TStringList); 36 function GetLCtoWCInstructions(Alocation: integer): string; 37 procedure FormatLCtoWCDisplayTextOnAccept(InputList, OutputList: TStrings); 38 procedure FormatLCtoWCDisplayTextOnRelease(InputList, OutputList: TStrings); 39 40 const 41 TX0 = 'The following Lab orders will be changed to Ward Collect:'; 42 TX2 = 'Order Date' + #9 +#9 + 'Reason Changed to Ward Collect'; 43 TX5 = 'Please contact the ward staff to insure the specimen is collected.'; 44 TX6 = 'You can print this screen for reference.'; 45 TX_BLANK = ''; 29 46 30 47 implementation 31 48 32 49 uses rODBase; 33 (* fODBase, rODBase, fODLab;*)34 50 35 51 procedure GetBloodComponents(Dest: TStrings); … … 38 54 end; 39 55 56 function NursAdminSuppress: boolean; 57 begin 58 Result := (StrToInt(sCallV('ORWDXVB NURSADMN',[nil])) < 1); 59 end; 60 40 61 function StatAllowed(PatientID: string): boolean; 41 62 begin … … 56 77 begin 57 78 tCallV(Dest, 'ORWDXVB GETALL', [PatientID, Loc]); 79 end; 80 81 function GetSubtype(TestName: string): string; 82 begin 83 Result := sCallV('ORWDXVB SUBCHK', [TestName]); 84 end; 85 86 function TNSDaysBack: integer; 87 begin 88 Result := StrToIntDef(sCallV('ORWDXVB VBTNS', [nil]),3); 89 end; 90 91 procedure ListForQuickOrders(var AListIEN, ACount: Integer; const DGrpNm: string); 92 begin 93 CallV('ORWUL QV4DG', [DGrpNm]); 94 AListIEN := StrToIntDef(Piece(RPCBrokerV.Results[0], U, 1), 0); 95 ACount := StrToIntDef(Piece(RPCBrokerV.Results[0], U, 2), 0); 96 end; 97 98 procedure SubsetOfQuickOrders(Dest: TStringList; AListIEN, First, Last: Integer); 99 var 100 i: Integer; 101 begin 102 CallV('ORWUL QVSUB', [AListIEN,'','']); 103 for i := 0 to RPCBrokerV.Results.Count -1 do 104 Dest.Add(RPCBrokerV.Results[i]); 58 105 end; 59 106 … … 158 205 end; 159 206 207 procedure CheckForChangeFromLCtoWCOnAccept(Dest: TStrings; ALocation: integer; AStartDate, ACollType, ASchedule, ADuration: string); 208 var 209 AList: TStringList; 210 begin 211 AList := TStringList.Create; 212 try 213 CallV('ORCDLR2 CHECK ONE LC TO WC', [ALocation, '', AStartDate, ACollType, ASchedule, ADuration]); 214 FastAssign(RPCBrokerV.Results, AList); 215 FormatLCtoWCDisplayTextOnAccept(AList, Dest); 216 finally 217 AList.Free; 218 end; 219 end; 220 221 procedure CheckForChangeFromLCtoWCOnRelease(Dest: TStrings; ALocation: integer; OrderList: TStringList); 222 var 223 AList: TStringList; 224 begin 225 AList := TStringList.Create; 226 try 227 CallV('ORCDLR2 CHECK ALL LC TO WC', [ALocation, OrderList]); 228 FastAssign(RPCBrokerV.Results, AList); 229 FormatLCtoWCDisplayTextOnRelease(AList, Dest); 230 finally 231 AList.Free; 232 end; 233 end; 234 235 procedure FormatLCtoWCDisplayTextOnAccept(InputList, OutputList: TStrings); 236 var 237 i: integer; 238 x: string; 239 begin 240 OutputList.Clear; 241 for i := InputList.Count - 1 downto 0 do 242 if Piece(InputList[i], U, 2) = '1' then InputList.Delete(i); 243 if InputList.Count > 0 then 244 begin 245 SetListFMDateTime('mmm dd, yyyy@hh:nn', TStringList(InputList), U, 1); 246 with OutputList do 247 begin 248 Add(TX0); 249 Add(TX_BLANK); 250 Add('Patient :' + #9 + Patient.Name); 251 Add('SSN :' + #9 + Patient.SSN); 252 Add('Location:' + #9 + Encounter.LocationName + CRLF); 253 for i := 0 to InputList.Count - 1 do 254 Add(Piece(InputList[i], U, 1) + #9 + Piece(InputList[i], U, 3)); 255 Add(TX_BLANK); 256 x := GetLCtoWCInstructions(Encounter.Location); 257 if x = '' then x := TX5; 258 Add(x); 259 Add(TX6); 260 end; 261 end; 262 end; 263 264 procedure FormatLCtoWCDisplayTextOnRelease(InputList, OutputList: TStrings); 265 var 266 i, j, k, Changed: integer; 267 AList: TStringlist; 268 x: string; 269 begin 270 OutputList.Clear; 271 Changed := StrToIntDef(ExtractDefault(InputList, 'COUNT'), 0); 272 if Changed > 0 then 273 begin 274 AList := TStringList.Create; 275 try 276 with OutputList do 277 begin 278 Add(TX0); 279 Add(TX_BLANK); 280 Add('Patient :' + #9 + Patient.Name); 281 Add('SSN :' + #9 + Patient.SSN); 282 Add('Location:' + #9 + Encounter.LocationName); 283 for i := 1 to Changed do 284 begin 285 Add(TX_BLANK); 286 AList.Clear; 287 ExtractText(AList, InputList, 'ORDER_' + IntToStr(i)); 288 Add('Order :' + #9 + AList[0]); 289 k := Length(OutputList[Count-1]); 290 if AList.Count > 1 then 291 for j := 1 to AList.Count - 1 do 292 begin 293 Add(StringOfChar(' ', 9) + #9 + AList[j]); 294 k := HigherOf(k, Length(OutputList[Count - 1])); 295 end; 296 Add(StringOfChar('-', k + 4)); 297 AList.Clear; 298 ExtractItems(AList, InputList, 'ORDER_' + IntToStr(i)); 299 SetListFMDateTime('mmm dd, yyyy@hh:nn', AList, U, 1); 300 for j := 0 to AList.Count - 1 do 301 OutputList.Add(Piece(AList[j], U, 1) + #9 + Piece(AList[j], U, 3)); 302 end; 303 Add(TX_BLANK); 304 x := GetLCtoWCInstructions(Encounter.Location); 305 if x = '' then x := TX5; 306 Add(x); 307 Add(TX6); 308 end; 309 finally 310 AList.Free; 311 end; 312 end; 313 end; 314 315 function GetLCtoWCInstructions(Alocation: integer): string; 316 begin 317 Result := sCallV('ORWDLR33 LC TO WC', [Encounter.Location]); 318 end; 319 160 320 end. 321 322
Note:
See TracChangeset
for help on using the changeset viewer.