Procedure

BuildResponses

Module

rOrders

Last Modified

7/15/2014 3:26:42 PM

Comments

Write Orders
Write Orders

Scope

Interfaced

Declaration

procedure BuildResponses(var ResolvedDialog: TOrderDialogResolved; const KeyVars: string;
  AnEvent: TOrderDelayEvent; ForIMO: boolean = False);

Calls Hierarchy


BuildResponses
 ├CheckQOGroup
 └CheckOrderGroup

Called-By Hierarchy


                                          BuildResponses
                                   ActivateOrderDialog┘ 
                           TfrmRemDlg.btnFinishClick┤   
           TfrmConsults.mnuActNewConsultRequestClick┤   
                   TfrmConsults.cmdNewConsultClick┘ │   
                TfrmConsults.mnuActNewProcedureClick┤   
                      TfrmConsults.cmdNewProcClick┘ │   
                                        ChangeOrders┤   
                      TfrmOrders.mnuActChangeClick┤ │   
                        TfrmMeds.mnuActChangeClick┘ │   
                                     ChangeOrdersEvt┤   
                                          CopyOrders┤   
                        TfrmOrders.mnuActCopyClick┤ │   
                          TfrmMeds.mnuActCopyClick┤ │   
                           TfrmODActive.btnOKClick┘ │   
                                      TransferOrders┤   
                        TfrmOrders.mnuActCopyClick┤ │   
                          TfrmMeds.mnuActCopyClick┤ │   
                           TfrmODActive.btnOKClick┘ │   
                            TfrmOrders.lstWriteClick┤   
               TfrmOrders.PlaceOrderForDefaultDialog┤   
                  TfrmOrders.DisplayDefaultDlgList┤ │   
                       TfrmOrders.ResetOrderPage┘ │ │   
               TfrmOrders.btnDelayedOrderClick┘   │ │   
                                 DisplayEvntDialog┤ │   
                             SetDelayEventForMed┘ │ │   
                      TfrmMeds.mnuActCopyClick┘   │ │   
                                 DisplayEvntDialog┤ │   
                                  SetViewForCopy┘ │ │   
                    TfrmOrders.mnuActCopyClick┘   │ │   
                                 DisplayEvntDialog┘ │   
                                ExecuteChangeEvt┘   │   
                 TfrmOrders.mnuActChgEvntClick┘     │   
                             TfrmMeds.mnuActNewClick┤   
                           TfrmOMNavA.ActivateDialog┤   
                         TfrmOMNavA.grdMenuKeyDown┤ │   
                         TfrmOMNavA.grdMenuMouseUp┘ │   
                                TfrmOMSet.DoNextItem┘   
                              TfrmOMSet.InsertList┤     
                               ActivateOrderList┘ │     
                     TfrmRemDlg.btnFinishClick┤   │     
                             ActivateOrderHTML┤   │     
                    TfrmOrders.lstWriteClick┤ │   │     
    TfrmOrders.PlaceOrderForDefaultDialog...┘ │   │     
                              ActivateOrderSet┤   │     
                   TfrmRemDlg.btnFinishClick┤ │   │     
TfrmConsults.mnuActNewConsultRequestClick...┤ │   │     
     TfrmConsults.mnuActNewProcedureClick...┤ │   │     
                    TfrmOrders.lstWriteClick┤ │   │     
    TfrmOrders.PlaceOrderForDefaultDialog...┤ │   │     
                     TfrmMeds.mnuActNewClick┤ │   │     
                TfrmOMNavA.ActivateDialog...┤ │   │     
                     TfrmOMSet.DoNextItem...┘ │   │     
                       TfrmOMNavA.DoSelectList┘   │     
                     TfrmOMNavA.grdMenuKeyUp┤     │     
                   TfrmOMNavA.grdMenuMouseUp┘     │     
                                        SkipToNext┤     
                         TfrmOMSet.DoNextItem...┘ │     
                            TfrmOMSet.UMDelayEvent┘     

Calls

Name Declaration Comments
CheckOrderGroup function CheckOrderGroup(AOrderID: string): integer; -
CheckQOGroup function CheckQOGroup(AQOId:string): Boolean; -

Called-By

Name Declaration Comments
ActivateOrderDialog function ActivateOrderDialog(const AnID: string; AnEvent: TOrderDelayEvent; AnOwner: TComponent; ARefNum: Integer; ANeedVerify: boolean = True): Boolean; -


Source

1166  procedure BuildResponses(var ResolvedDialog: TOrderDialogResolved; const KeyVars: string;
1167    AnEvent: TOrderDelayEvent; ForIMO: boolean);
1168  const
1169    BoolChars: array[Boolean] of Char = ('0', '1');
1170    RESERVED_PIECE = '';
1171  var
1172    DelayEvent, x, TheOrder: string;
1173    Idx, tmpOrderGroup, PickupIdx, ForIMOResponses: integer;
1174    IfUDGrp: Boolean;
1175    IfUDGrpForQO: Boolean;
1176    temp: string;
1177  begin
1178    ForIMOResponses := 0;
1179    tmpOrderGroup := 0;
1180    temp := '';
1181    if ForIMO then ForIMOResponses := 1;
1182    PickupIdx := 0;
1183    IfUDGrp := False;
1184    TheOrder := ResolvedDialog.InputID;
1185    IfUDGrpForQO := CheckQOGroup(TheOrder);
1186    if (CharAt(TheOrder,1) in ['C','T']) then
1187    begin
1188      Delete(TheOrder,1,1);
1189      tmpOrderGroup := CheckOrderGroup(TheOrder);
1190      if tmpOrderGroup = 1 then IfUDGrp := True else IfUDGrp := False;
1191    end;
1192    if (not IfUDGrp) and (AnEvent.EventType in ['A','T']) then
1193      IfUDGrp := True;
1194    //FLDS=DFN^LOC^ORNP^INPT^SEX^AGE^EVENT^SC%^^^Key Variables
1195    if (Patient.Inpatient = true) and (tmpOrderGroup = 2) then temp := '0';
1196    if temp <> '0' then temp := BoolChars[Patient.Inpatient];
1197    with AnEvent do
1198    begin
1199      if isNewEvent then
1200        DelayEvent := '0;'+ EventType + ';' + IntToStr(Specialty) + ';' + FloatToStr(Effective)
1201      else
1202        DelayEvent := IntToStr(AnEvent.PtEventIFN) + ';' + EventType + ';' + IntToStr(Specialty) + ';' + FloatToStr(Effective);
1203    end;
1204    x := Patient.DFN                  + U +   // 1
1205         IntToStr(Encounter.Location) + U +   // 2
1206         IntToStr(Encounter.Provider) + U +   // 3
1207         BoolChars[Patient.Inpatient] + U +   // 4
1208         Patient.Sex                  + U +   // 5
1209         IntToStr(Patient.Age)        + U +   // 6
1210         DelayEvent                   + U +   // 7 (for OREVENT)
1211         IntToStr(Patient.SCPercent)  + U +   // 8
1212         RESERVED_PIECE               + U +   // 9
1213         RESERVED_PIECE               + U +   // 10
1214         KeyVars;
1215    CallV('ORWDXM1 BLDQRSP', [ResolvedDialog.InputID, x, ForIMOResponses, Encounter.Location]);
1216    // LST(0)=QuickLevel^ResponseID(ORIT;$H)^Dialog^Type^FormID^DGrp
1217    with RPCBrokerV do
1218    begin
1219      x := Results[0];
1220      with ResolvedDialog do
1221      begin
1222        QuickLevel   := StrToIntDef(Piece(x, U, 1), 0);
1223        ResponseID   := Piece(x, U, 2);
1224        DialogIEN    := StrToIntDef(Piece(x, U, 3), 0);
1225        DialogType   := CharAt(Piece(x, U, 4), 1);
1226        FormID       := StrToIntDef(Piece(x, U, 5), 0);
1227        DisplayGroup := StrToIntDef(Piece(x, U, 6), 0);
1228        QOKeyVars    := Pieces(x, U, 7, 7 + MAX_KEYVARS);
1229        Results.Delete(0);
1230        if Results.Count > 0 then
1231        begin
1232          if (IfUDGrp) or (IfUDGrpForQO) then
1233          begin
1234            for Idx := 0 to Results.Count - 1 do
1235            begin
1236              if(Pos('PICK UP',UpperCase(Results[idx])) > 0) or (Pos('PICK-UP',UpperCase(Results[idx])) > 0) then
1237              begin
1238                PickupIdx := Idx;
1239                Break;
1240              end;
1241            end;
1242          end;
1243          if PickupIdx > 0 then
1244            Results.Delete(PickupIdx);
1245          SetString(ShowText, Results.GetText, StrLen(Results.GetText));
1246        end;
1247      end;
1248    end;
1249  end;