260 lines
11 KiB
Plaintext
260 lines
11 KiB
Plaintext
maintenance:
|
|
|
|
title: FORM_SET_TUBE_FEEDING_ORDERS;;
|
|
mlmname: FORM_SET_TUBE_FEEDING_ORDERS;;
|
|
arden: version 2.5;;
|
|
version: 5.50;;
|
|
institution: St. Clair Hospital;;
|
|
author: Juliet Law, Allscripts Ext. 7461;;
|
|
specialist: Maria Pest, Allscripts Ext. 7443;;
|
|
date: 2012-01-20;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Determines if a tube feeding order should be submitted as a supplement based on existence
|
|
of active diet order.
|
|
;;
|
|
explanation: If an active diet order exists, then the user will be alerted that the tube feeding will be submitted
|
|
as a supplement to the active diet; otherwise the tube feeding order will be ordered as the active diet.
|
|
|
|
Change History
|
|
|
|
01.20.2012 JMLaw CSR 25867: Created MLM
|
|
09.02.2014 DW CSR# 32365 - Auto select orders when one is not present
|
|
01.28.2015 JML WO# 1620448: modified the query that retrieves active diet orders to not include Completed (level num 100)
|
|
as an active diet order.
|
|
;;
|
|
keywords: tube feeding, diet
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
//This MLM is passed three arguments of type
|
|
// communication_type, form_type, and client_info_obj respectively
|
|
(this_communication,
|
|
this_form,
|
|
client_info_obj) := argument;
|
|
|
|
//Obtain fields passed in from Form object
|
|
field_list := this_form.fields;
|
|
|
|
//Obtain attribute values from Communication Object
|
|
client_guid := this_communication.ClientGUID;
|
|
visit_guid := this_communication.ClientVisitGUID;
|
|
chart_guid := this_communication.ChartGUID;
|
|
CallingEvent := this_communication.CallingEvent;
|
|
CallingField := this_communication.CallingFieldName;
|
|
|
|
//Include .Net libraries
|
|
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
//Initialize local session object
|
|
local_session := cds_session.local;
|
|
|
|
//Declare and initialize boolean local variables
|
|
tubeFeedSelected := false;
|
|
sessionObjectExists := false;
|
|
dietOrderExists := false;
|
|
|
|
//Retrieve field list of Tube Feeding Nursing Order Grid
|
|
TubeFeedingOrder := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 2);
|
|
TubeFeedingOrder_List := TubeFeedingOrder.Value;
|
|
|
|
//Retrieve mapped field on Tube Feeding Order
|
|
DietOrderFld := first of (field_list where field_list.DataItemName = "DIET_DSD_Tube Feed Order" and field_list.Control_MultiFieldOccNum = 1);
|
|
DietSupplementFld := first of (field_list where field_list.DataItemName = "DIET_Tube Feed Diet or Supplement" and field_list.Control_MultiFieldOccNum = 1);
|
|
|
|
//Retrieve field list of NPO with Tube Feed Diet Grid
|
|
NPOTubeFeedOrder := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 4);
|
|
NPOTubeFeedOrder_List := NPOTubeFeedOrder.Value;
|
|
|
|
TubeFeedingFlush := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 3);
|
|
TubeFeedingFlush_List := TubeFeedingFlush.Value;
|
|
|
|
DietitianConsult := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 6);
|
|
DietitianConsult_List := DietitianConsult.Value;
|
|
|
|
Residuals := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 5);
|
|
Residuals_List := Residuals.Value;
|
|
|
|
NursingInstruct := last of (field_list where field_list.DataItemName = "MultiOrderInline" and field_list.Control_MultiFieldOccNum = 1);
|
|
NursingInstruct_List := NursingInstruct.Value;
|
|
|
|
|
|
|
|
|
|
// FIELD CHANGE
|
|
|
|
|
|
|
|
//Only perform logic if a field change event has occurred on the Order Set
|
|
|
|
if (CallingEvent = "FieldChange") then
|
|
|
|
if (CallingField = "MultiOrderGrid|2") then
|
|
|
|
//Retrieve Nutritional Order Tube Feeding field; set boolean if selected or not
|
|
TubeFeedFld := first of (TubeFeedingOrder_List where TubeFeedingOrder_List.Name = "Tube Feeding");
|
|
|
|
if (TubeFeedFld.IsSelected = true) then
|
|
tubeFeedSelected := true;
|
|
else
|
|
tubeFeedSelected := false;
|
|
endif;
|
|
endif;
|
|
|
|
if (tubeFeedSelected = true) then
|
|
//If Nutritional Diet Tube Feeding was selected, check for unsubmitted or submitted active Diet order
|
|
if (local_session.SessionUnsubDietExists = true) then
|
|
//Unsubmitted Active Diet order determined by local session variable
|
|
//set in MLM SCH_ALERT_ON_NPO_TUBE_FEEDING_ORDERS
|
|
dietOrderExists := true;
|
|
sessionObjectExists := true;
|
|
else
|
|
//No unsubmitted, check database for Diet order
|
|
(orderName) := read {"SELECT o.Name, o.TouchedWhen"
|
|
|| " FROM CV3Order as o with (nolock) JOIN"
|
|
|| " (CV3OrderCatalogMasterItem AS ocmi with (nolock)"
|
|
|| " JOIN CV3OrderReviewCategory AS orc with (nolock)"
|
|
|| " ON ocmi.OrderReviewCategoryGUID = orc.GUID)"
|
|
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
|
|
|| " WHERE o.ClientGUID = " || SQL(client_guid)
|
|
|| " AND o.ClientVisitGUID = " || SQL(visit_guid)
|
|
|| " AND o.ChartGUID = " || SQL(chart_guid)
|
|
|| " AND ("
|
|
|| " (o.Name = {{{SINGLE-QUOTE}}}Diet{{{SINGLE-QUOTE}}}"
|
|
|| " OR o.Name = {{{SINGLE-QUOTE}}}Liquids Only for Test{{{SINGLE-QUOTE}}}))"
|
|
|| " AND"
|
|
|| " ((o.OrderStatusLevelNum > 15"
|
|
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|
|
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
|
|
, primaryTime = touchedWhen};
|
|
orderCount := count(orderName) as number;
|
|
if (orderCount > 0) then
|
|
dietOrderExists := true;
|
|
endif;
|
|
endif;
|
|
endif;
|
|
|
|
//If Nutritional Diet Tube Feeding was selected and an active Diet order exists
|
|
//then alert that tube feed will be entered as supplement
|
|
//If user selects {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}, tube feed will be entered as only diet
|
|
if (tubeFeedSelected = true AND dietOrderExists = true) then
|
|
msg := "Patient has Active diet order."
|
|
|| "\n\nThis tube feed order will be entered as a supplement to the existing tray diet."
|
|
|| "\n\nIf this is correct, choose {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}."
|
|
|| "\n\nIf this is not correct, choose {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} and remember to discontinue the Active diet order.";
|
|
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg, "Active Diet Found", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
|
|
|
//If user selects YES, tube feed will be entered as a supplement
|
|
if ((dialogRes as string) = "Yes") then
|
|
DietOrderFld.Value := "";
|
|
DietSupplementFld.Value := "Supplement";
|
|
|
|
if (true IN NPOTubeFeedOrder_List.IsSelected) then
|
|
NPOTubeFeedOrder_List.IsSelected := false;
|
|
endif;
|
|
NPOTubeFeedOrder_List.IsReadOnly := true;
|
|
|
|
elseif ((dialogRes as string) = "No") then
|
|
DietOrderFld.Value := "Tube Feeding";
|
|
DietSupplementFld.Value := "Diet";
|
|
endif;
|
|
|
|
//If Nutritional Diet Tube Feeding was selected and an active Diet order does not exists
|
|
//then alert that tube feed will be entered as only diet
|
|
//If user selects {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}, tube feed will be automatically unselected and alert
|
|
//will display to enter an active diet order first
|
|
elseif (tubeFeedSelected = true AND dietOrderExists = false) then
|
|
msg := "Patient DOES NOT have an Active diet.\n\nThis order will be entered as a tube feed only diet."
|
|
|| " Patient will not receive a tray diet."
|
|
|| "\n\nIf this is correct, choose {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}."
|
|
|| "\n\nIf this is not correct and the patient is to receive this tube feed as a supplement, choose {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}.\n\n";
|
|
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg, "No Active Diet Found", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
|
|
|
if ((dialogRes as string) = "Yes") then
|
|
DietOrderFld.Value := "Tube Feeding";
|
|
DietSupplementFld.Value := "Diet";
|
|
elseif ((dialogRes as string) = "No") then
|
|
DietOrderFld.Value := "Tube Feeding";
|
|
DietSupplementFld.Value := "Supplement";
|
|
|
|
//Display additional messagebox to user
|
|
msg2 := "You MUST enter the tray diet order first, then enter the Tube Feeding order.";
|
|
dialogRes2 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg2, "Information", "Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
|
|
|
TubeFeedingOrder_List.IsSelected := "false";
|
|
endif;
|
|
|
|
else
|
|
NPOTubeFeedOrder_List.IsReadOnly := "false";
|
|
|
|
endif;
|
|
|
|
endif; // Field Change
|
|
|
|
|
|
|
|
|
|
// FORM OPEN
|
|
|
|
|
|
|
|
if (CallingEvent = "FormOpen")
|
|
|
|
then
|
|
|
|
(DietOrders) := read {"Select o.Name, o.TouchedWhen, ocmi.name "
|
|
|| " From CV3OrderCatalogMasterItem AS ocmi with (nolock) "
|
|
|| " Join CV3Order o with (nolock) ON o.OrderCatalogMasterItemGUID = ocmi.GUID "
|
|
|| " Where o.ClientGUID = " || SQL(client_guid) || " AND o.ClientVisitGUID = " || SQL(visit_guid) || " AND o.ChartGUID = " || SQL(chart_guid)
|
|
|| " and o.name in ({{{SINGLE-QUOTE}}}Tube Feed Flush{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}NPO with Tube Feed Diet (nursing instruction only){{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Dietitian Consult for Tube Feed{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Tube Feed Residuals{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Tube Feed Nursing Instructions{{{SINGLE-QUOTE}}})"
|
|
|| " and ((o.OrderStatusLevelNum > 15 AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))) "
|
|
};
|
|
|
|
// Initialize all orders to selected
|
|
|
|
TubeFeedingFlush_List.IsSelected := "true";
|
|
NPOTubeFeedOrder_List.IsSelected := "true";
|
|
DietitianConsult_List.IsSelected := "true";
|
|
Residuals_List.IsSelected:= "true";
|
|
NursingInstruct_List.IsSelected := "true";
|
|
|
|
|
|
// Parse out the current orders and deselect the order if it is already on file.
|
|
|
|
for i in 1 seqto count DietOrders do
|
|
|
|
DietOrder := DietOrders [i] ;
|
|
|
|
|
|
if DietOrder = "Tube Feed Flush" then TubeFeedingFlush_List.IsSelected := "false";
|
|
elseif DietOrder = "NPO with Tube Feed Diet (nursing instruction only)" then NPOTubeFeedOrder_List.IsSelected := "false";
|
|
elseif DietOrder = "Dietitian Consult for Tube Feed" then DietitianConsult_List.IsSelected := "false";
|
|
elseif DietOrder = "Tube Feed Residuals" then Residuals_List.IsSelected:= "false";
|
|
elseif DietOrder = "Tube Feed Nursing Instructions" then NursingInstruct_List.IsSelected := "false";
|
|
endif;
|
|
|
|
enddo;
|
|
|
|
endif; // Form Open
|
|
|
|
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke:
|
|
;;
|
|
logic:
|
|
|
|
conclude true;
|
|
;;
|
|
action:
|
|
|
|
//This MLM returns two parameters of type this_communication and this_form, respectively.
|
|
return this_communication, this_form;
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|