Procedure

TfrmOrders.ProcessNotifications

Module

fOrders

Last Modified

7/15/2014 3:26:42 PM

Visibility

Private

Owner

TfrmOrders

Declaration

procedure ProcessNotifications;

Calls Hierarchy


TfrmOrders.ProcessNotifications
 ├TNotifications.GetFollowUp
 ├TfrmOrders.ViewAlertedOrders
 │ ├DGroupAll
 │ ├ListDGroupAll
 │ ├TfrmOrders.SetOrderView
 │ │ ├TfrmOrders.CanChangeOrderView
 │ │ │ └ActiveOrdering
 │ │ ├StrToFMDateTime
 │ │ ├FMNow
 │ │ ├TfrmOrders.UseDefaultSort
 │ │ ├ExpiredOrdersStartDT
 │ │ └TfrmOrders.RefreshOrderList
 │ │   ├LoadOrdersAbbr
 │ │   │ ├ClearOrders
 │ │   │ ├LoadDGroupMap
 │ │   │ ├ExpiredOrdersStartDT
 │ │   │ ├FMNow
 │ │   │ └SeqOfDGroup
 │ │   │   └LoadDGroupMap
 │ │   ├ClearOrders
 │ │   ├LoadOrdersAbbr
 │ │   │ ├LoadDGroupMap
 │ │   │ ├FMNow
 │ │   │ └SeqOfDGroup...
 │ │   ├TfrmOrders.ExpandEventSection
 │ │   ├TfrmOrders.CompressEventSection
 │ │   ├SortOrders
 │ │   │ ├InverseByGroup
 │ │   │ │ └TChanges.Exist
 │ │   │ ├ForwardByGroup
 │ │   │ │ └TChanges.Exist
 │ │   │ ├InverseChrono
 │ │   │ └ForwardChrono
 │ │   ├TfrmOrders.AddToListBox
 │ │   │ └TfrmOrders.GetPlainText
 │ │   │   └TfrmOrders.GetOrderText
 │ │   │     ├LoadFlagReason
 │ │   │     ├TfrmOrders.GetStartStopText
 │ │   │     └NameOfStatus
 │ │   └DGroupAll
 │ └TNotifications.Delete
 │   └DeleteAlert
 ├AutoUnflagAlertedOrders
 ├UnsignedOrderAlertFollowup
 ├TNotifications.Delete...
 ├ReportBox
 │ └CreateReportBox
 │   └TfrmBase508Form.Create
 │     ├TfrmBase508Form.UpdateAccessibilityActions
 │     ├UnfocusableControlEnter
 │     └AdjustControls
 │       ├TfrmBase508Form.ModifyUnfocusableControl
 │       └..(rec)..
 ├ResultOrder
 ├ValidateOrderAction
 ├UpdateUnverifiedMedAlerts
 ├UpdateUnverifiedOrderAlerts
 ├UpdateExpiringFlaggedOIAlerts
 ├GetConsultOrderNumber
 ├TNotifications.GetAlertData
 │ └GetXQAData
 └TfrmOrders.mnuViewUnsignedClick
   ├TfrmOrders.SetOrderView...
   └DGroupAll

Called-By Hierarchy


TfrmOrders.ProcessNotifications
       TfrmOrders.DisplayPage┘ 

Calls

Name Declaration Comments
AutoUnflagAlertedOrders procedure AutoUnflagAlertedOrders(PatientDFN, XQAID: string); -
TNotifications.Delete procedure Delete; -
TNotifications.GetAlertData function GetAlertData: string; -
GetConsultOrderNumber function GetConsultOrderNumber(ConsultIEN: string): string; -
TNotifications.GetFollowUp function GetFollowUp: Integer; -
TfrmOrders.mnuViewUnsignedClick procedure mnuViewUnsignedClick(Sender: TObject); -
ReportBox procedure ReportBox(ReportText: TStrings; ReportTitle: string; AllowPrint: boolean); -
ResultOrder function ResultOrder(const ID: string): TStrings; -
UnsignedOrderAlertFollowup function UnsignedOrderAlertFollowup(XQAID: string): string; -
UpdateExpiringFlaggedOIAlerts procedure UpdateExpiringFlaggedOIAlerts(PatientDFN: string; FollowUp: integer); -
UpdateUnverifiedMedAlerts procedure UpdateUnverifiedMedAlerts(PatientDFN: string); -
UpdateUnverifiedOrderAlerts procedure UpdateUnverifiedOrderAlerts(PatientDFN: string); -
ValidateOrderAction procedure ValidateOrderAction(const ID, Action: string; var ErrMsg: string); -
TfrmOrders.ViewAlertedOrders procedure ViewAlertedOrders(OrderIEN: string; Status: integer; DispGrp: string; BySvc, InvDate: boolean; Title: string); -

Called-By

Name Declaration Comments
TfrmOrders.DisplayPage procedure DisplayPage; override; -


Source

2418  procedure TfrmOrders.ProcessNotifications;
2419  var
2420    OrderIEN, ErrMsg: string;
2421    BigOrderID: string;
2422  begin
2423      //if not User.NoOrdering then LoadWriteOrders(lstWrite.Items) else lstWrite.Clear; {**KCM**}
2424      OrderIEN := IntToStr(ExtractInteger(Notifications.AlertData));
2425      case Notifications.FollowUp of
2426        NF_FLAGGED_ORDERS                :
2427          begin
2428            ViewAlertedOrders('', STS_FLAGGED, '', False, True, 'All Services, Flagged');
2429            AutoUnflagAlertedOrders(Patient.DFN, Piece(Notifications.RecordID, U, 2));
2430          end;
2431        NF_ORDER_REQUIRES_ELEC_SIGNATURE :
2432          begin
2433            ViewAlertedOrders('', STS_UNSIGNED, '', False, True, 'All Services, Unsigned');
2434            UnsignedOrderAlertFollowup(Piece(Notifications.RecordID, U, 2));
2435          end;
2436        NF_IMAGING_REQUEST_CANCEL_HELD   :
2437          if Pos('HELD', UpperCase(Notifications.Text)) > 0 then
2438            begin
2439              ViewAlertedOrders(OrderIEN, STS_HELD, 'IMAGING', False, True, 'Imaging, On Hold');
2440              Notifications.Delete;
2441            end
2442          else
2443            begin
2444              ViewAlertedOrders(OrderIEN, STS_DISCONTINUED, 'IMAGING', False, True, 'Imaging, Cancelled');
2445              Notifications.Delete;
2446            end;
2447        NF_SITE_FLAGGED_RESULTS       :
2448          begin
2449            ViewAlertedOrders(OrderIEN, STS_COMPLETE, '', False, True, 'All Services, Site-Flagged');
2450            with lstOrders do if Selected[ItemIndex] then
2451            begin
2452              BigOrderID := TOrder(Items.Objects[ItemIndex]).ID;
2453              if Length(Piece(BigOrderID,';',1)) > 0 then
2454              begin
2455                ReportBox(ResultOrder(BigOrderID), 'Order Results - ' + BigOrderID, True);
2456                Notifications.Delete;
2457              end;
2458            end;
2459          end;
2460        NF_ORDERER_FLAGGED_RESULTS       :
2461          begin
2462            ViewAlertedOrders(OrderIEN, STS_COMPLETE, '', False, True, 'All Services, Orderer-Flagged');
2463            with lstOrders do if Selected[ItemIndex] then
2464            begin
2465              BigOrderID := TOrder(Items.Objects[ItemIndex]).ID;
2466              if Length(Piece(BigOrderID,';',1)) > 0 then
2467              begin
2468                ReportBox(ResultOrder(BigOrderID), 'Order Results - ' + BigOrderID, True);
2469                Notifications.Delete;
2470              end;
2471            end;
2472          end;
2473        NF_ORDER_REQUIRES_COSIGNATURE    :
2474          ViewAlertedOrders('', STS_UNSIGNED, '', False, True, 'All Services, Unsigned');
2475        NF_LAB_ORDER_CANCELED            :
2476          begin
2477            ViewAlertedOrders(OrderIEN, STS_DISCONTINUED, 'LABORATORY', False, True, 'Lab, Cancelled');
2478            Notifications.Delete;
2479          end;
2480        NF_DNR_EXPIRING                  :
2481          ViewAlertedOrders('', STS_EXPIRING, '', False, True, 'All Services, Expiring');
2482        NF_MEDICATIONS_EXPIRING_INPT          :
2483          begin
2484            ViewAlertedOrders('', STS_EXPIRING, 'PHARMACY', False, True, 'Medications, Expiring');
2485          end;
2486        NF_MEDICATIONS_EXPIRING_OUTPT          :
2487          begin
2488            ViewAlertedOrders('', STS_EXPIRING, 'PHARMACY', False, True, 'Medications, Expiring');
2489          end;
2490        NF_UNVERIFIED_MEDICATION_ORDER   :
2491          begin
2492            ViewAlertedOrders(OrderIEN, STS_UNVERIFIED, 'PHARMACY', False, True, 'Medications, Unverified');
2493            if StrToIntDef(OrderIEN, 0) > 0 then    {**REV**}
2494              begin       // Delete alert if user can't verify
2495                ValidateOrderAction(OrderIEN, OA_VERIFY, ErrMsg);
2496                if Pos('COMPLEX-PSI',ErrMsg)>0 then
2497                  ErrMsg := TX_COMPLEX;
2498                if Length(ErrMsg) > 0 then Notifications.Delete;
2499              end;
2500            UpdateUnverifiedMedAlerts(Patient.DFN);
2501          end;
2502        NF_NEW_ORDER                     :
2503          begin
2504            ViewAlertedOrders(OrderIEN, STS_RECENT, '',  False, True, 'All Services, Recent Activity');
2505            Notifications.Delete;
2506          end;
2507        NF_UNVERIFIED_ORDER              :
2508          begin
2509            ViewAlertedOrders(OrderIEN, STS_UNVERIFIED, '',  False, True, 'All Services, Unverified');
2510            if StrToIntDef(OrderIEN, 0) > 0 then    {**REV**}
2511              begin       // Delete alert if user can't verify
2512                ValidateOrderAction(OrderIEN, OA_SIGN, ErrMsg);
2513                if Pos('COMPLEX-PSI',ErrMsg)>0 then
2514                  ErrMsg := TX_COMPLEX;
2515                if Length(ErrMsg) > 0 then Notifications.Delete;
2516              end;
2517            UpdateUnverifiedOrderAlerts(Patient.DFN);
2518          end;
2519        NF_FLAGGED_OI_RESULTS       :
2520          begin
2521            ViewAlertedOrders(OrderIEN, STS_COMPLETE, '', False, True, 'All Services, Orderable Item Flagged');
2522            with lstOrders do if Selected[ItemIndex] then
2523            begin
2524              BigOrderID := TOrder(Items.Objects[ItemIndex]).ID;
2525              if Length(Piece(BigOrderID,';',1)) > 0 then
2526              begin
2527                ReportBox(ResultOrder(BigOrderID), 'Order Results - ' + BigOrderID, True);
2528                Notifications.Delete;
2529              end;
2530            end;
2531          end;
2532        NF_DC_ORDER                      :
2533          begin
2534            ViewAlertedOrders(OrderIEN, STS_RECENT, '',  False, True, 'All Services, Recent Activity');
2535            Notifications.Delete;
2536          end;
2537        NF_DEA_AUTO_DC_CS_MED_ORDER      :
2538          begin
2539            ViewAlertedOrders(OrderIEN, STS_RECENT, '',  False, True, 'All Services, Recent Activity');
2540            Notifications.Delete;
2541          end;
2542        NF_DEA_CERT_REVOKED              :
2543          begin
2544            ViewAlertedOrders(OrderIEN, STS_RECENT, '',  False, True, 'All Services, Recent Activity');
2545            Notifications.Delete;
2546          end;
2547        NF_FLAGGED_OI_EXP_INPT           :
2548          begin
2549            ViewAlertedOrders('', STS_EXPIRING, '', False, True, 'All Services, Expiring');
2550            UpdateExpiringFlaggedOIAlerts(Patient.DFN, NF_FLAGGED_OI_EXP_INPT);
2551          end;
2552        NF_FLAGGED_OI_EXP_OUTPT          :
2553          begin
2554            ViewAlertedOrders('', STS_EXPIRING, '', False, True, 'All Services, Expiring');
2555            UpdateExpiringFlaggedOIAlerts(Patient.DFN, NF_FLAGGED_OI_EXP_OUTPT);
2556          end;
2557        NF_CONSULT_REQUEST_CANCEL_HOLD   :
2558          begin
2559            OrderIEN := GetConsultOrderNumber(Notifications.AlertData);
2560            ViewAlertedOrders(OrderIEN, STS_DISCONTINUED, 'CONSULTS',  False, True, 'Consults, Cancelled');
2561            with lstOrders do Selected[ItemIndex] := True;
2562          end;
2563      else mnuViewUnsignedClick(Self);
2564      end;
2565  end;