Changeset 829 for cprs/trunk/CPRS-Chart/Orders/rOrders.pas
- Timestamp:
- Jul 7, 2010, 4:31:10 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/trunk/CPRS-Chart/Orders/rOrders.pas
r456 r829 39 39 LinkObject: TObject; 40 40 EnteredInError: Integer; //AGP Changes 26.12 PSI-04-053 41 DCOriginalOrder: boolean; 41 42 procedure Assign(Source: TOrder); 42 43 procedure Clear; … … 200 201 procedure SendAndPrintOrders(OrderList, ErrList: TStrings; const ESCode: string; const DeviceInfo: string); 201 202 procedure ExecutePrintOrders(SelectedList: TStringList; const DeviceInfo: string); 202 procedure PrintOrdersOnReview(OrderList: TStringList; const DeviceInfo: string ); {*KCM*}203 procedure PrintServiceCopies(OrderList: TStringList ); {*REV*}204 procedure OrderPrintDeviceInfo(OrderList: TStringList; var PrintParams: TPrintParams; Nature: Char ); {*KCM*}203 procedure PrintOrdersOnReview(OrderList: TStringList; const DeviceInfo: string; PrintLoc: Integer = 0); {*KCM*} 204 procedure PrintServiceCopies(OrderList: TStringList; PrintLoc: Integer = 0); {*REV*} 205 procedure OrderPrintDeviceInfo(OrderList: TStringList; var PrintParams: TPrintParams; Nature: Char; PrintLoc: Integer = 0); {*KCM*} 205 206 function UseNewMedDialogs: Boolean; 206 207 … … 221 222 procedure ListDCReasons(Dest: TStrings; var DefaultIEN: Integer); 222 223 function GetREQReason: Integer; 223 procedure DCOrder(AnOrder: TOrder; AReason: Integer; var DCType: Integer);224 procedure DCOrder(AnOrder: TOrder; AReason: Integer; NewOrder: boolean; var DCType: Integer); 224 225 procedure ReleaseOrderHold(AnOrder: TOrder); 225 226 procedure AlertOrder(AnOrder: TOrder; AlertRecip: Int64); … … 238 239 function IsPSOSupplyDlg(DlgID, QODlg: integer): boolean; 239 240 procedure SaveChangesOnRenewOrder(var AnOrder: TOrder; AnID, TheRefills, ThePickup: string; IsTxtOrder: integer); 241 function DoesOrderStatusMatch(OrderArray: TStringList): boolean; 240 242 //function GetPromptandDeviceParameters(Location: integer; OrderList: TStringList; Nature: string): TPrintParams; 241 243 … … 340 342 implementation 341 343 342 uses Windows, rCore, uConst, TRPCB, ORCtrls, UBAGlobals, UBACore ;344 uses Windows, rCore, uConst, TRPCB, ORCtrls, UBAGlobals, UBACore, VAUtils; 343 345 344 346 var … … 576 578 577 579 procedure SetOrderFields(AnOrder: TOrder; const x, y, z: string); 578 { 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 579 { Pieces: ~IFN^Grp^ActTm^StrtTm^StopTm^Sts^Sig^Nrs^Clk^PrvID^PrvNam^ActDA^Flag^DCType^ChrtRev^DEA#^VA#^DigSig }580 { 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 581 { Pieces: ~IFN^Grp^ActTm^StrtTm^StopTm^Sts^Sig^Nrs^Clk^PrvID^PrvNam^ActDA^Flag^DCType^ChrtRev^DEA#^VA#^DigSig^IMO^DCOrigOrder} 580 582 begin 581 583 with AnOrder do … … 600 602 Retrieved := True; 601 603 OrderLocIEN := Piece(Piece(x,U,19),':',2); //imo 602 OrderLocName := Piece(Piece(x,U,19),':',1); //imo 604 if Piece(Piece(x,U,19),':',1) = '0;SC(' then OrderLocName := 'Unknown' 605 else OrderLocName := Piece(Piece(x,U,19),':',1); //imo 603 606 Text := y; 604 607 XMLText := z; … … 609 612 else AnOrder.EnteredInError := 0; 610 613 //if DGroupName = 'Non-VA Meds' then Text := 'Non-VA ' + Text; 614 if Piece(x,U,20) = '1' then DCOriginalOrder := True 615 else DCOriginalOrder := False; 611 616 end; 612 617 end; … … 655 660 AnOrder: TOrder; 656 661 FilterTS: string; 662 AlertedUserOnly: boolean; 657 663 begin 658 664 ClearOrders(Dest); 659 665 if uDGroupMap = nil then LoadDGroupMap; // to make sure broker not called while looping thru Results 660 666 FilterTS := IntToStr(AView.Filter) + U + IntToStr(AView.EventDelay.Specialty); 661 CallV('ORWORR AGET', [Patient.DFN, FilterTS, AView.DGroup, AView.TimeFrom, AView.TimeThru, APtEvtID]); 667 AlertedUserOnly := (Notifications.Active and (AView.Filter = 12)); 668 CallV('ORWORR AGET', [Patient.DFN, FilterTS, AView.DGroup, AView.TimeFrom, AView.TimeThru, APtEvtID, AlertedUserOnly]); 662 669 if ((Piece(RPCBrokerV.Results[0], U, 1) = '0') or (Piece(RPCBrokerV.Results[0], U, 1) = '')) and (AView.Filter = 5) then // if no expiring orders found display expired orders) 663 670 begin … … 756 763 CallV('ORWOR SHEETS', [Patient.DFN]); 757 764 MixedCaseByPiece(RPCBrokerV.Results, U, 2); 758 Dest.Assign(RPCBrokerV.Results);759 end;765 FastAssign(RPCBrokerV.Results, Dest); 766 end; 760 767 761 768 procedure LoadOrderSheetsED(Dest: TStrings); … … 771 778 for i := 0 to RPCbrokerV.Results.Count - 1 do 772 779 RPCBrokerV.Results[i] := RPCBrokerV.Results[i] + ' Orders'; 773 Dest.AddStrings(RPCBrokerV.Results);780 FastAddStrings(RPCBrokerV.Results, Dest); 774 781 end; 775 782 end; … … 812 819 for i := 0 to Pred(HaveList.Count) do Param[1].Mult['"' + HaveList[i] + '"'] := ''; 813 820 CallBroker; 814 IDList.Assign(Results);821 FastAssign(RPCBrokerV.Results,IDList); 815 822 end; 816 823 end; … … 1015 1022 begin 1016 1023 CallV('ORWORDG ALLTREE', [nil]); 1017 Dest.Assign(RPCBrokerV.Results);1024 FastAssign(RPCBrokerV.Results, Dest); 1018 1025 end; 1019 1026 … … 1022 1029 CallV('ORWOR TSALL', [nil]); 1023 1030 MixedCaseList(RPCBrokerV.Results); 1024 Dest.Assign(RPCBrokerV.Results);1031 FastAssign(RPCBrokerV.Results, Dest); 1025 1032 end; 1026 1033 … … 1032 1039 otherEvts: TStringList; 1033 1040 commonList: TStringList; 1041 IsObservation: boolean; 1034 1042 begin 1035 1043 if Encounter <> nil then … … 1037 1045 else 1038 1046 Currloc := 0; 1047 IsObservation := (Piece(GetCurrentSpec(Patient.DFN), U, 3) = '1'); 1039 1048 commonList := TStringList.Create; 1040 1049 CallV('OREVNTX1 CMEVTS',[Currloc]); … … 1053 1062 commonList.Add(Results[i]); 1054 1063 end 1064 else if IsObservation then 1065 begin 1066 if (Piece(Results[i],'^',3) = 'T') then 1067 Continue; 1068 commonList.Add(Results[i]); 1069 end 1055 1070 else 1056 1071 begin … … 1061 1076 if commonList.Count > 0 then 1062 1077 begin 1063 Dest.AddStrings(TStrings(commonList));1078 FastAddStrings(TStrings(commonList), Dest); 1064 1079 Dest.Add('^^^^^^^^___________________________________________________________________________________________'); 1065 1080 Dest.Add(LLS_SPACE); … … 1074 1089 begin 1075 1090 RPCBrokerV.Results.Delete(0); 1076 admitEvts.AddStrings(RPCBrokerV.Results);1091 FastAddStrings(RPCBrokerV.Results, admitEvts); 1077 1092 end; 1078 CallV('OREVNTX ACTIVE',['T^O^M^D']); 1093 if IsObservation then 1094 CallV('OREVNTX ACTIVE',['O^M^D']) 1095 else 1096 CallV('OREVNTX ACTIVE',['T^O^M^D']); 1079 1097 //MixedCaseList(RPCBrokerV.Results); 1080 1098 if RPCBrokerV.Results.Count > 0 then 1081 1099 begin 1082 1100 RPCBrokerV.Results.Delete(0); 1083 otherEvts.AddStrings(RPCBrokerV.Results);1101 FastAddStrings(RPCBrokerV.Results, otherEvts); 1084 1102 end; 1085 Dest.AddStrings(TStrings(otherEvts));1103 FastAddStrings(TStrings(otherEvts), Dest); 1086 1104 Dest.Add('^^^^^^^^_____________________________________________________________________________________________'); 1087 1105 Dest.Add(LLS_SPACE); 1088 Dest.AddStrings(TStrings(admitEvts));1106 FastAddStrings(TStrings(admitEvts), Dest); 1089 1107 admitEvts.Free; 1090 1108 otherEvts.Free; … … 1096 1114 if RPCBrokerV.Results.Count > 0 then 1097 1115 RPCBrokerV.Results.Delete(0); 1098 Dest.AddStrings(RPCBrokerV.Results);1116 FastAddStrings(RPCBrokerV.Results, Dest); 1099 1117 end 1100 1118 else … … 1104 1122 if RPCBrokerV.Results.Count > 0 then 1105 1123 RPCBrokerV.Results.Delete(0); 1106 Dest.AddStrings(RPCBrokerV.Results);1124 FastAddStrings(RPCBrokerV.Results, Dest); 1107 1125 end; 1108 1126 end; … … 1111 1129 begin 1112 1130 CallV('ORWORDG REVSTS', [nil]); 1113 Dest.Assign(RPCBrokerV.Results);1131 FastAssign(RPCBrokerV.Results, Dest); 1114 1132 end; 1115 1133 … … 1118 1136 begin 1119 1137 CallV('ORWORDG REVSTS', [nil]); 1120 Dest.Assign(RPCBrokerV.Results);1138 FastAssign(RPCBrokerV.Results, Dest); 1121 1139 end; 1122 1140 … … 1172 1190 RESERVED_PIECE + U + // 10 1173 1191 KeyVars; 1174 CallV('ORWDXM1 BLDQRSP', [ResolvedDialog.InputID, x, ForIMOResponses ]);1192 CallV('ORWDXM1 BLDQRSP', [ResolvedDialog.InputID, x, ForIMOResponses, Encounter.Location]); 1175 1193 // LST(0)=QuickLevel^ResponseID(ORIT;$H)^Dialog^Type^FormID^DGrp 1176 1194 with RPCBrokerV do … … 1275 1293 RPCBrokerV.Results.Delete(0); 1276 1294 end; 1277 SetItems.Assign(RPCBrokerV.Results);1295 FastAssign(RPCBrokerV.Results, SetItems); 1278 1296 end; 1279 1297 … … 1281 1299 begin 1282 1300 CallV('ORWDX WRLST', [Encounter.Location]); 1283 Dest.Assign(RPCBrokerV.Results);1301 FastAssign(RPCBrokerV.Results, Dest); 1284 1302 end; 1285 1303 … … 1290 1308 begin 1291 1309 Dest.Clear; 1292 Dest.Assign(RPCBrokerV.Results);1310 FastAssign(RPCBrokerV.Results, Dest); 1293 1311 end 1294 1312 end; … … 1310 1328 then Results[i] := Piece(Results[i], U, 1); 1311 1329 OrderList.Clear; 1312 OrderList.Assign(RPCBrokerV.Results);1330 FastAssign(RPCBrokerV.Results, OrderList); 1313 1331 end; 1314 1332 … … 1324 1342 CallV('ORWDX SENDED',[OrderList,CurrTS,Loc]); 1325 1343 OrderList.Clear; 1326 OrderList.Assign(RPCBrokerV.Results);1344 FastAssign(RPCBrokerV.Results, OrderList); 1327 1345 end; 1328 1346 … … 1339 1357 end; 1340 1358 1341 procedure PrintOrdersOnReview(OrderList: TStringList; const DeviceInfo: string); 1342 begin 1343 CallV('ORWD1 RVPRINT', [Encounter.Location, DeviceInfo, OrderList]); 1344 end; 1345 1346 procedure PrintServiceCopies(OrderList: TStringList); {*REV*} 1347 begin 1348 CallV('ORWD1 SVONLY', [Encounter.Location, OrderList]); 1359 procedure PrintOrdersOnReview(OrderList: TStringList; const DeviceInfo: string; PrintLoc: Integer = 0); 1360 var 1361 Loc: Integer; 1362 begin 1363 if (PrintLoc > 0) and (PrintLoc <> Encounter.Location) then Loc := PrintLoc 1364 else Loc := Encounter.Location; 1365 CallV('ORWD1 RVPRINT', [Loc, DeviceInfo, OrderList]); 1366 end; 1367 1368 procedure PrintServiceCopies(OrderList: TStringList; PrintLoc: Integer = 0); {*REV*} 1369 var 1370 Loc: Integer; 1371 begin 1372 if (PrintLoc > 0) and (PrintLoc <> Encounter.Location) then Loc := PrintLoc 1373 else Loc := Encounter.Location; 1374 CallV('ORWD1 SVONLY', [Loc, OrderList]); 1349 1375 end; 1350 1376 … … 1432 1458 CallV('ORWOR ACTION TEXT',[ID]); 1433 1459 if RPCBrokerV.Results.Count > 0 then 1434 Errlist.Assign(RPCBrokerV.Results);1460 FastAssign(RPCBrokerV.Results, Errlist); 1435 1461 end; 1436 1462 … … 1515 1541 procedure ListDCReasons(Dest: TStrings; var DefaultIEN: Integer); 1516 1542 begin 1517 CallV('ORWDX ADCREASON', [nil]);1543 CallV('ORWDX2 DCREASON', [nil]); 1518 1544 ExtractItems(Dest, RPCBrokerV.Results, 'DCReason'); 1519 1545 //AGP Change 26.15 for PSI-04-63 … … 1526 1552 end; 1527 1553 1528 procedure DCOrder(AnOrder: TOrder; AReason: Integer; var DCType: Integer);1529 var 1530 AParentID 1554 procedure DCOrder(AnOrder: TOrder; AReason: Integer; NewOrder: boolean; var DCType: Integer); 1555 var 1556 AParentID, DCOrigOrder: string; 1531 1557 begin 1532 1558 AParentID := AnOrder.ParentID; 1533 CallV('ORWDXA DC', [AnOrder.ID, Encounter.Provider, Encounter.Location, AReason]); 1559 if AnOrder.DCOriginalOrder = true then DCOrigOrder := '1' 1560 else DCOrigOrder := '0'; 1561 CallV('ORWDXA DC', [AnOrder.ID, Encounter.Provider, Encounter.Location, AReason, DCOrigOrder, NewOrder]); 1534 1562 UBACore.DeleteDCOrdersFromCopiedList(AnOrder.ID); 1535 1563 DCType := StrToIntDef(Piece(RPCBrokerV.Results[0], U, 14), 0); … … 1553 1581 begin 1554 1582 CallV('ORWDXA FLAGTXT', [ID]); 1555 Dest.Assign(RPCBrokerV.Results);1583 FastAssign(RPCBrokerV.Results, Dest); 1556 1584 end; 1557 1585 … … 1565 1593 begin 1566 1594 CallV('ORWDXA WCGET', [ID]); 1567 Dest.Assign(RPCBrokerV.Results);1595 FastAssign(RPCBrokerV.Results, Dest); 1568 1596 end; 1569 1597 … … 1614 1642 if piece(Results[0],'^',1) = '-1' then 1615 1643 begin 1616 ShowM essage('Storage of Digital Signature FAILED: ' + piece(Results[0],'^',2) + CRLF + CRLF +1644 ShowMsg('Storage of Digital Signature FAILED: ' + piece(Results[0],'^',2) + CRLF + CRLF + 1617 1645 'This error will prevent this order from being sent to the service for processing. Please cancel the order and try again.' + CRLF + CRLF + 1618 1646 'If this problem persists, then there is a problem in the CPRS PKI interface, and it needs to be reported through the proper channels, to the developer Cary Malmrose.'); … … 1651 1679 SCallV('ORWDXR01 SAVCHG',[AnID,TheRefills,ThePickup,IsTxtOrder]); 1652 1680 SetOrderFromResults(AnOrder); 1681 end; 1682 1683 function DoesOrderStatusMatch(OrderArray: TStringList): boolean; 1684 begin 1685 Result := StrtoIntDef(SCallV('ORWDX1 ORDMATCH',[Patient.DFN, OrderArray]),0)=1; 1653 1686 end; 1654 1687 … … 1698 1731 CallV('ORWDPS5 LESAPI',[AnOrderInfo]); 1699 1732 if RPCBrokerV.Results.Count > 0 then 1700 RejectedReason.Assign(RPCBrokerV.Results);1733 FastAssign(RPCBrokerV.Results, RejectedReason); 1701 1734 end; 1702 1735 … … 2076 2109 MixedCaseList( RPCBrokerV.Results ); 2077 2110 RPCBrokerV.Results.Delete(0); 2078 Dest.Assign(RPCBrokerV.Results);2111 FastAssign(RPCBrokerV.Results, Dest); 2079 2112 end; 2080 2113 end; … … 2087 2120 begin 2088 2121 SortByPiece(TStringList(RPCBrokerV.Results),'^',2); 2089 Dest.Assign(RPCBrokerV.Results);2122 FastAssign(RPCBrokerV.Results, Dest); 2090 2123 end; 2091 2124 end; … … 2188 2221 then CallV('ORWDXC ACCEPT', [Patient.DFN, FillerID, StartDtTm, Encounter.Location, OIList, DupORIFN]) 2189 2222 else CallV('ORWDXC ACCEPT', [Patient.DFN, FillerID, StartDtTm, Encounter.Location]); 2190 ListOfChecks.Assign(RPCBrokerV.Results);2223 FastAssign(RPCBrokerV.Results, ListOfChecks); 2191 2224 end; 2192 2225 … … 2198 2231 then CallV('ORWDXC DELAY', [Patient.DFN, FillerID, StartDtTm, Encounter.Location, OIList]) 2199 2232 else CallV('ORWDXC DELAY', [Patient.DFN, FillerID, StartDtTm, Encounter.Location]); 2200 ListOfChecks.Assign(RPCBrokerV.Results);2233 FastAssign(RPCBrokerV.Results, ListOfChecks); 2201 2234 end; 2202 2235 … … 2204 2237 begin 2205 2238 CallV('ORWDXC SESSION', [Patient.DFN, OrderList]); 2206 ListOfChecks.Assign(RPCBrokerV.Results);2239 FastAssign(RPCBrokerV.Results, ListOfChecks); 2207 2240 end; 2208 2241 … … 2253 2286 (PromptForWorkCopy in ['1','2'])); 2254 2287 RPCBrokerV.Results.Delete(0); 2255 OrdersToPrint.Assign(RPCBrokerV.Results);2288 FastAssign(RPCBrokerV.Results, OrdersToPrint); 2256 2289 end; 2257 2290 Result := TempParams; … … 2262 2295 *) 2263 2296 2264 procedure OrderPrintDeviceInfo(OrderList: TStringList; var PrintParams: TPrintParams; Nature: Char );2297 procedure OrderPrintDeviceInfo(OrderList: TStringList; var PrintParams: TPrintParams; Nature: Char; PrintLoc: Integer = 0); 2265 2298 var 2266 2299 x: string; 2267 2300 begin 2268 2301 if Nature <> #0 then 2269 CallV('ORWD2 DEVINFO', [Encounter.Location, Nature, OrderList]) 2302 begin 2303 if PrintLoc > 0 then CallV('ORWD2 DEVINFO', [PrintLoc, Nature, OrderList]) 2304 else CallV('ORWD2 DEVINFO', [Encounter.Location, Nature, OrderList]); 2305 end 2270 2306 else 2271 CallV('ORWD2 MANUAL', [Encounter.Location, OrderList]); 2307 begin 2308 if PrintLoc > 0 then CallV('ORWD2 MANUAL', [PrintLoc, OrderList]) 2309 else CallV('ORWD2 MANUAL', [Encounter.Location, OrderList]); 2310 end; 2272 2311 x := RPCBrokerV.Results[0]; 2273 2312 FillChar(PrintParams, SizeOf(PrintParams), #0); … … 2295 2334 RPCBrokerV.Results.Delete(0); 2296 2335 OrderList.Clear; 2297 OrderList.Assign(RPCBrokerV.Results);2336 FastAssign(RPCBrokerV.Results, OrderList); 2298 2337 end; 2299 2338 end;
Note:
See TracChangeset
for help on using the changeset viewer.