Ignore:
Timestamp:
Jul 7, 2010, 4:31:10 PM (14 years ago)
Author:
Kevin Toppenberg
Message:

Upgrade to version 27

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/trunk/CPRS-Chart/Orders/rOrders.pas

    r456 r829  
    3939    LinkObject:   TObject;
    4040    EnteredInError:     Integer; //AGP Changes 26.12 PSI-04-053
     41    DCOriginalOrder: boolean;
    4142    procedure Assign(Source: TOrder);
    4243    procedure Clear;
     
    200201procedure SendAndPrintOrders(OrderList, ErrList: TStrings; const ESCode: string; const DeviceInfo: string);
    201202procedure 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*}
     203procedure PrintOrdersOnReview(OrderList: TStringList; const DeviceInfo: string; PrintLoc: Integer = 0);  {*KCM*}
     204procedure PrintServiceCopies(OrderList: TStringList; PrintLoc: Integer = 0);  {*REV*}
     205procedure OrderPrintDeviceInfo(OrderList: TStringList; var PrintParams: TPrintParams; Nature: Char; PrintLoc: Integer = 0); {*KCM*}
    205206function UseNewMedDialogs: Boolean;
    206207
     
    221222procedure ListDCReasons(Dest: TStrings; var DefaultIEN: Integer);
    222223function GetREQReason: Integer;
    223 procedure DCOrder(AnOrder: TOrder; AReason: Integer; var DCType: Integer);
     224procedure DCOrder(AnOrder: TOrder; AReason: Integer; NewOrder: boolean; var DCType: Integer);
    224225procedure ReleaseOrderHold(AnOrder: TOrder);
    225226procedure AlertOrder(AnOrder: TOrder; AlertRecip: Int64);
     
    238239function IsPSOSupplyDlg(DlgID, QODlg: integer): boolean;
    239240procedure SaveChangesOnRenewOrder(var AnOrder: TOrder; AnID, TheRefills, ThePickup: string; IsTxtOrder: integer);
     241function DoesOrderStatusMatch(OrderArray: TStringList): boolean;
    240242//function GetPromptandDeviceParameters(Location: integer; OrderList: TStringList; Nature: string): TPrintParams;
    241243
     
    340342implementation
    341343
    342 uses Windows, rCore, uConst, TRPCB, ORCtrls, UBAGlobals, UBACore;
     344uses Windows, rCore, uConst, TRPCB, ORCtrls, UBAGlobals, UBACore, VAUtils;
    343345
    344346var
     
    576578
    577579procedure 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}
    580582begin
    581583  with AnOrder do
     
    600602    Retrieved := True;
    601603    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
    603606    Text := y;
    604607    XMLText := z;
     
    609612    else AnOrder.EnteredInError := 0;
    610613    //if DGroupName = 'Non-VA Meds' then Text := 'Non-VA  ' + Text;
     614    if Piece(x,U,20) = '1' then DCOriginalOrder := True
     615    else DCOriginalOrder := False;
    611616  end;
    612617end;
     
    655660  AnOrder: TOrder;
    656661  FilterTS: string;
     662  AlertedUserOnly: boolean;
    657663begin
    658664  ClearOrders(Dest);
    659665  if uDGroupMap = nil then LoadDGroupMap;  // to make sure broker not called while looping thru Results
    660666  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]);
    662669  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)
    663670  begin
     
    756763  CallV('ORWOR SHEETS', [Patient.DFN]);
    757764  MixedCaseByPiece(RPCBrokerV.Results, U, 2);
    758   Dest.Assign(RPCBrokerV.Results);
    759 end;
     765  FastAssign(RPCBrokerV.Results, Dest);
     766 end;
    760767
    761768procedure LoadOrderSheetsED(Dest: TStrings);
     
    771778    for i := 0 to RPCbrokerV.Results.Count - 1 do
    772779      RPCBrokerV.Results[i] := RPCBrokerV.Results[i] + ' Orders';
    773     Dest.AddStrings(RPCBrokerV.Results);
     780    FastAddStrings(RPCBrokerV.Results, Dest);
    774781  end;
    775782end;
     
    812819    for i := 0 to Pred(HaveList.Count) do Param[1].Mult['"' + HaveList[i] + '"'] := '';
    813820    CallBroker;
    814     IDList.Assign(Results);
     821    FastAssign(RPCBrokerV.Results,IDList);
    815822  end;
    816823end;
     
    10151022begin
    10161023  CallV('ORWORDG ALLTREE', [nil]);
    1017   Dest.Assign(RPCBrokerV.Results);
     1024  FastAssign(RPCBrokerV.Results, Dest);
    10181025end;
    10191026
     
    10221029  CallV('ORWOR TSALL', [nil]);
    10231030  MixedCaseList(RPCBrokerV.Results);
    1024   Dest.Assign(RPCBrokerV.Results);
     1031  FastAssign(RPCBrokerV.Results, Dest);
    10251032end;
    10261033
     
    10321039  otherEvts: TStringList;
    10331040  commonList: TStringList;
     1041  IsObservation: boolean;
    10341042begin
    10351043  if Encounter <> nil then
     
    10371045  else
    10381046    Currloc := 0;
     1047  IsObservation := (Piece(GetCurrentSpec(Patient.DFN), U, 3) = '1');
    10391048  commonList := TStringList.Create;
    10401049  CallV('OREVNTX1 CMEVTS',[Currloc]);
     
    10531062      commonList.Add(Results[i]);
    10541063    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
    10551070    else
    10561071    begin
     
    10611076  if commonList.Count > 0 then
    10621077  begin
    1063     Dest.AddStrings(TStrings(commonList));
     1078    FastAddStrings(TStrings(commonList), Dest);
    10641079    Dest.Add('^^^^^^^^___________________________________________________________________________________________');
    10651080    Dest.Add(LLS_SPACE);
     
    10741089    begin
    10751090      RPCBrokerV.Results.Delete(0);
    1076       admitEvts.AddStrings(RPCBrokerV.Results);
     1091      FastAddStrings(RPCBrokerV.Results, admitEvts);
    10771092    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']);
    10791097    //MixedCaseList(RPCBrokerV.Results);
    10801098    if RPCBrokerV.Results.Count > 0 then
    10811099    begin
    10821100      RPCBrokerV.Results.Delete(0);
    1083       otherEvts.AddStrings(RPCBrokerV.Results);
     1101      FastAddStrings(RPCBrokerV.Results, otherEvts);
    10841102    end;
    1085     Dest.AddStrings(TStrings(otherEvts));
     1103    FastAddStrings(TStrings(otherEvts), Dest);
    10861104    Dest.Add('^^^^^^^^_____________________________________________________________________________________________');
    10871105    Dest.Add(LLS_SPACE);
    1088     Dest.AddStrings(TStrings(admitEvts));
     1106    FastAddStrings(TStrings(admitEvts), Dest);
    10891107    admitEvts.Free;
    10901108    otherEvts.Free;
     
    10961114    if RPCBrokerV.Results.Count > 0 then
    10971115      RPCBrokerV.Results.Delete(0);
    1098     Dest.AddStrings(RPCBrokerV.Results);
     1116    FastAddStrings(RPCBrokerV.Results, Dest);
    10991117  end
    11001118  else
     
    11041122    if RPCBrokerV.Results.Count > 0 then
    11051123      RPCBrokerV.Results.Delete(0);
    1106     Dest.AddStrings(RPCBrokerV.Results);
     1124    FastAddStrings(RPCBrokerV.Results, Dest);
    11071125  end;
    11081126end;
     
    11111129begin
    11121130  CallV('ORWORDG REVSTS', [nil]);
    1113   Dest.Assign(RPCBrokerV.Results);
     1131  FastAssign(RPCBrokerV.Results, Dest);
    11141132end;
    11151133
     
    11181136begin
    11191137  CallV('ORWORDG REVSTS', [nil]);
    1120   Dest.Assign(RPCBrokerV.Results);
     1138  FastAssign(RPCBrokerV.Results, Dest);
    11211139end;
    11221140
     
    11721190       RESERVED_PIECE               + U +   // 10
    11731191       KeyVars;
    1174   CallV('ORWDXM1 BLDQRSP', [ResolvedDialog.InputID, x, ForIMOResponses]);
     1192  CallV('ORWDXM1 BLDQRSP', [ResolvedDialog.InputID, x, ForIMOResponses, Encounter.Location]);
    11751193  // LST(0)=QuickLevel^ResponseID(ORIT;$H)^Dialog^Type^FormID^DGrp
    11761194  with RPCBrokerV do
     
    12751293    RPCBrokerV.Results.Delete(0);
    12761294  end;
    1277   SetItems.Assign(RPCBrokerV.Results);
     1295  FastAssign(RPCBrokerV.Results, SetItems);
    12781296end;
    12791297
     
    12811299begin
    12821300  CallV('ORWDX WRLST', [Encounter.Location]);
    1283   Dest.Assign(RPCBrokerV.Results);
     1301  FastAssign(RPCBrokerV.Results, Dest);
    12841302end;
    12851303
     
    12901308  begin
    12911309    Dest.Clear;
    1292     Dest.Assign(RPCBrokerV.Results);
     1310  FastAssign(RPCBrokerV.Results, Dest);
    12931311  end
    12941312end;
     
    13101328      then Results[i] := Piece(Results[i], U, 1);
    13111329  OrderList.Clear;
    1312   OrderList.Assign(RPCBrokerV.Results);
     1330  FastAssign(RPCBrokerV.Results, OrderList);
    13131331end;
    13141332
     
    13241342  CallV('ORWDX SENDED',[OrderList,CurrTS,Loc]);
    13251343  OrderList.Clear;
    1326   OrderList.Assign(RPCBrokerV.Results);
     1344  FastAssign(RPCBrokerV.Results, OrderList);
    13271345end;
    13281346
     
    13391357end;
    13401358
    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]);
     1359procedure PrintOrdersOnReview(OrderList: TStringList; const DeviceInfo: string; PrintLoc: Integer = 0);
     1360var
     1361Loc: Integer;
     1362begin
     1363  if (PrintLoc > 0) and (PrintLoc <> Encounter.Location) then Loc := PrintLoc
     1364  else Loc := Encounter.Location;
     1365  CallV('ORWD1 RVPRINT',  [Loc, DeviceInfo, OrderList]);
     1366end;
     1367
     1368procedure PrintServiceCopies(OrderList: TStringList; PrintLoc: Integer = 0);  {*REV*}
     1369var
     1370Loc: Integer;
     1371begin
     1372  if (PrintLoc > 0) and (PrintLoc <> Encounter.Location) then Loc := PrintLoc
     1373  else Loc := Encounter.Location;
     1374  CallV('ORWD1 SVONLY',  [Loc, OrderList]);
    13491375end;
    13501376
     
    14321458  CallV('ORWOR ACTION TEXT',[ID]);
    14331459  if RPCBrokerV.Results.Count > 0 then
    1434     Errlist.Assign(RPCBrokerV.Results);
     1460    FastAssign(RPCBrokerV.Results, Errlist);
    14351461end;
    14361462
     
    15151541procedure ListDCReasons(Dest: TStrings; var DefaultIEN: Integer);
    15161542begin
    1517   CallV('ORWDXA DCREASON', [nil]);
     1543  CallV('ORWDX2 DCREASON', [nil]);
    15181544  ExtractItems(Dest, RPCBrokerV.Results, 'DCReason');
    15191545  //AGP Change 26.15 for PSI-04-63
     
    15261552end;
    15271553
    1528 procedure DCOrder(AnOrder: TOrder; AReason: Integer; var DCType: Integer);
    1529 var
    1530   AParentID : string;
     1554procedure DCOrder(AnOrder: TOrder; AReason: Integer; NewOrder: boolean; var DCType: Integer);
     1555var
     1556  AParentID, DCOrigOrder: string;
    15311557begin
    15321558  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]);
    15341562  UBACore.DeleteDCOrdersFromCopiedList(AnOrder.ID);
    15351563  DCType := StrToIntDef(Piece(RPCBrokerV.Results[0], U, 14), 0);
     
    15531581begin
    15541582  CallV('ORWDXA FLAGTXT', [ID]);
    1555   Dest.Assign(RPCBrokerV.Results);
     1583  FastAssign(RPCBrokerV.Results, Dest);
    15561584end;
    15571585
     
    15651593begin
    15661594  CallV('ORWDXA WCGET', [ID]);
    1567   Dest.Assign(RPCBrokerV.Results);
     1595  FastAssign(RPCBrokerV.Results, Dest);
    15681596end;
    15691597
     
    16141642      if piece(Results[0],'^',1) = '-1' then
    16151643        begin
    1616           ShowMessage('Storage of Digital Signature FAILED: ' + piece(Results[0],'^',2) + CRLF + CRLF +
     1644          ShowMsg('Storage of Digital Signature FAILED: ' + piece(Results[0],'^',2) + CRLF + CRLF +
    16171645            'This error will prevent this order from being sent to the service for processing. Please cancel the order and try again.' + CRLF + CRLF +
    16181646            '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.');
     
    16511679  SCallV('ORWDXR01 SAVCHG',[AnID,TheRefills,ThePickup,IsTxtOrder]);
    16521680  SetOrderFromResults(AnOrder);
     1681end;
     1682
     1683function DoesOrderStatusMatch(OrderArray: TStringList): boolean;
     1684begin
     1685 Result := StrtoIntDef(SCallV('ORWDX1 ORDMATCH',[Patient.DFN, OrderArray]),0)=1;
    16531686end;
    16541687
     
    16981731  CallV('ORWDPS5 LESAPI',[AnOrderInfo]);
    16991732  if RPCBrokerV.Results.Count > 0 then
    1700     RejectedReason.Assign(RPCBrokerV.Results);
     1733    FastAssign(RPCBrokerV.Results, RejectedReason);
    17011734end;
    17021735
     
    20762109      MixedCaseList( RPCBrokerV.Results );
    20772110      RPCBrokerV.Results.Delete(0);
    2078       Dest.Assign(RPCBrokerV.Results);
     2111      FastAssign(RPCBrokerV.Results, Dest);
    20792112    end;
    20802113  end;
     
    20872120  begin
    20882121    SortByPiece(TStringList(RPCBrokerV.Results),'^',2);
    2089     Dest.Assign(RPCBrokerV.Results);
     2122    FastAssign(RPCBrokerV.Results, Dest);
    20902123  end;
    20912124end;
     
    21882221    then CallV('ORWDXC ACCEPT', [Patient.DFN, FillerID, StartDtTm, Encounter.Location, OIList, DupORIFN])
    21892222    else CallV('ORWDXC ACCEPT', [Patient.DFN, FillerID, StartDtTm, Encounter.Location]);
    2190   ListOfChecks.Assign(RPCBrokerV.Results);
     2223  FastAssign(RPCBrokerV.Results, ListOfChecks);
    21912224end;
    21922225
     
    21982231    then CallV('ORWDXC DELAY', [Patient.DFN, FillerID, StartDtTm, Encounter.Location, OIList])
    21992232    else CallV('ORWDXC DELAY', [Patient.DFN, FillerID, StartDtTm, Encounter.Location]);
    2200   ListOfChecks.Assign(RPCBrokerV.Results);
     2233  FastAssign(RPCBrokerV.Results, ListOfChecks);
    22012234end;
    22022235
     
    22042237begin
    22052238  CallV('ORWDXC SESSION', [Patient.DFN, OrderList]);
    2206   ListOfChecks.Assign(RPCBrokerV.Results);
     2239  FastAssign(RPCBrokerV.Results, ListOfChecks);
    22072240end;
    22082241
     
    22532286                                  (PromptForWorkCopy     in ['1','2']));
    22542287        RPCBrokerV.Results.Delete(0);
    2255         OrdersToPrint.Assign(RPCBrokerV.Results);
     2288        FastAssign(RPCBrokerV.Results, OrdersToPrint);
    22562289      end;
    22572290    Result := TempParams;
     
    22622295*)
    22632296
    2264 procedure OrderPrintDeviceInfo(OrderList: TStringList; var PrintParams: TPrintParams; Nature: Char);
     2297procedure OrderPrintDeviceInfo(OrderList: TStringList; var PrintParams: TPrintParams; Nature: Char; PrintLoc: Integer = 0);
    22652298var
    22662299  x: string;
    22672300begin
    22682301  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
    22702306  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;
    22722311  x := RPCBrokerV.Results[0];
    22732312  FillChar(PrintParams, SizeOf(PrintParams), #0);
     
    22952334      RPCBrokerV.Results.Delete(0);
    22962335      OrderList.Clear;
    2297       OrderList.Assign(RPCBrokerV.Results);
     2336      FastAssign(RPCBrokerV.Results, OrderList);
    22982337    end;
    22992338end;
Note: See TracChangeset for help on using the changeset viewer.