Files
St.Clair/MLMStripper/bin/Debug/FORM/FORM_DIETALLOPTIONS.mlm

316 lines
11 KiB
Plaintext

maintenance:
title: Charging: If we select override billing location show more items;;
mlmname: FORM_DietAllOptions;;
arden: version 2;;
version: 4.50;;
institution: St Clair Charger MLM;;
author: Robert Spence, Eclipsys Corp;;
specialist: ;;
date: 2006-05-08;;
validation: testing;;
library:
purpose: This MLM sets the field PRN Reason text to visible and mandatory if IsPRN true.
;;
explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and
Communications objects and compares it to Client Information to determine whether to display
certain fields and make them mandatory.
A Banner message is presented to the user to remind them that these fields must be
completed.
If the patient data does not meet the above conditions the fields are not visible on
the form.
The MLM is not run from a trigger event, but rather is called by the application.
It should be configured to run on Form Open.
Change history
12.16.2015 DW CSR# 33655 Previnar - Created
07/20/2011 Modified data values as indicated below for Project #26464 Jack Miller and Maria Pest
04/05/2012 JL Added logic to include a note in the Order Summary Line when the user selects any of the "Consistent Carbohydrate" diet options; removed code that supports diet options
that are no longer available.
06/06/2012 Modified verbiage for the "Consistent Carbohydrate" diet options that displays in the Order Summary Line.
11/06/2015 CSR:32228- Seclusion Tray MLM - Added [Finger food] By Shivprasad Jadhav
04.26.2016 DW CSR# 34212 - Dietitian May Modify button selection
;;
keywords: Called MLMs, Form fields, PRN, PRN Reason text
;;
knowledge:
type: data-driven;;
data:
// This MLM is passed three arguments, of types
// communication_type, form_type and client info object respectively.
(this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := FALSE;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
//Custom variables
//Summary Line Verbiage
orderSummaryLine := "Add 1 carb serving (15g of carbohydrate) if 9pm BGM less than 100 mg/dl";
// This sets the visible control on the field dataitem - CHG_OVERRIDE_WITH
//Special Diets
Special_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_Special" );
//Sodium Options
Sodium_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD__Sodium" );
//Protein Options
Protein_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_Protein" );
//Carbohydrate & Calorie Controlled Diets
ADACalorie_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_ADA or Calorie" );
//Potassium Options
Potassium_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_Potassium" );
//Fluid Restrictions
FluidRestrictions_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_Fluid Restrictions" );
//Common Diets
Common_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_COMMON" );
Consistency_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_CONSISTENCY" );
//Liquid/Liquid Consistency Options
Liquid_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_LIQUID" );
//GI Options
GI_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_GI" );
//Other Diets
Other_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_Other" );
//Finger Food
Finger_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_Finger Foods" ); // Added By Shivprasad for CSR:32228- Seclusion Tray MLM on [6 Sept 2015]
//Thickened Liquids
//Hidden Field - Summary Line Verbiage
SummaryLine_Field := last of (field_list
where field_list.DataItemName = "DIET_Summary Line Verbiage");
Dietitian_May_Modify_SummaryLine:= last of (field_list where field_list.DataItemName = "DIET_May Not Modify" );
Dietitian_May_Modify_Selection := last of (field_list where field_list.DataItemName = "DIET_May Modify" );
// FIELD CHANGE
if (CallingEvent = "FieldChange") then
If CallingField="DIET_DSD_Special" then
//set everything to active where applicable
Sodium_Field.Control_READ_ONLY:= FALSE;
Potassium_Field.Control_READ_ONLY:= FALSE;
Protein_Field.Control_READ_ONLY:= FALSE;
If ((Liquid_Field.Value <> "Clear Liquid Controlled Carbohydrate") and
(Liquid_Field.Value <> "Full Liquid Controlled Carbohydrate")) or
(Liquid_Field.Value Is Null) then
ADACalorie_Field.Control_READ_ONLY:= FALSE;
endif;
Common_Field.Control_READ_ONLY:= FALSE;
Consistency_Field.Control_READ_ONLY:=FALSE;
Liquid_Field.Control_READ_ONLY:= FALSE;
GI_Field.Control_READ_ONLY:=FALSE;
Other_Field.Control_READ_ONLY:=FALSE;
FluidRestrictions_Field.Control_READ_ONLY:= FALSE;
//now for logic:
If Special_Field.Value ="Heart Healthy No Added Salt" then
Sodium_Field.Value:="";
Sodium_Field.Control_READ_ONLY:= TRUE;
endif;
If Special_Field.Value ="Heart Healthy 2 gram Sodium" then
Sodium_Field.Value:="";
Sodium_Field.Control_READ_ONLY:= TRUE;
endif;
/* Diet name changes, CSR 26464, 07/20/2011
Changed "Renal Dialysis NA3gmP90K70Fld1200"
to "Renal Dialysis: 3g Na, 90g Protein, 70meq K, 1200cc Fluid Restriction" */
If Special_Field.Value ="Renal Dialysis: 3g Na, 90g Protein, 70meq K, 1200cc Fluid Restriction" then
Sodium_Field.Value:="";
Sodium_Field.Control_READ_ONLY:= TRUE;
Potassium_Field.Value:="";
Potassium_Field.Control_READ_ONLY:= TRUE;
Protein_Field.Value:="";
Protein_Field.Control_READ_ONLY:= TRUE;
FluidRestrictions_Field.Value:="";
FluidRestrictions_Field.Control_READ_ONLY:= TRUE;
endif;
/* Diet name changes, CSR 26464, 07/20/2011
Changed "Renal Non Dialysis NA2gm P60 K60"
to "Renal Non Dialysis: 2g Na, 60g Protein, 60meq K" */
If Special_Field.Value ="Renal Non Dialysis: 2g Na, 60g Protein, 60meq K" then
Sodium_Field.Value:="";
Sodium_Field.Control_READ_ONLY:= TRUE;
Potassium_Field.Value:="";
Potassium_Field.Control_READ_ONLY:= TRUE;
Protein_Field.Value:="";
Protein_Field.Control_READ_ONLY:= TRUE;
endif;
endif;
If CallingField="DIET_DSD_LIQUID" then
// Do positive logic first
If (Liquid_Field.Value = "Clear Liquid Controlled Carbohydrate")
or (Liquid_Field.Value = "Full Liquid Controlled Carbohydrate") then
ADACalorie_Field.Value:="";
ADACalorie_Field.Control_READ_ONLY:= TRUE;
Else
ADACalorie_Field.Control_READ_ONLY := FALSE;
endif;
endif;
If CallingField ="DIET_DSD_GI" then
// Now for negative logic, also remember to trap for that null value
if ((Special_Field.Value <> "Renal Dialysis NA3gmP90K70Fld1200") OR (Special_Field.Value IS NULL)) then
FluidRestrictions_Field.Control_Read_Only:= False;
endif;
endif;
if CallingField = "DIET_DSD_COMMON" then
//CSR 30591, JML: Disable the Sodium options if Heart Healthy is selected under the common diets
if (Common_Field.Value = "Heart Healthy No Added Salt") then
Sodium_Field.Value:="";
Sodium_Field.Control_READ_ONLY:= TRUE;
else
Sodium_Field.Control_Read_Only := false;
endif;
//CSR 30591, JML: Add comment to hidden field if the carbohydrate option is selected;
// allows comment to appear on the Order Summary Line
if (Common_Field.Value = "No Concentrated Sweets, 2 carb 9pm snack") then
SummaryLine_Field.Value := orderSummaryLine;
else
SummaryLine_Field.Value := "";
endif;
endif;
if CallingField = "DIET_DSD_ADA or Calorie" then
//CSR 30591, JML: Add comment to hidden field on form if any of the Carbohydrate
// & Calorie Control Diets option is selected; allows the comment to appear
// on the Order Summary Line
if (ADACalorie_Field.Value IS NOT NULL) then
SummaryLine_Field.Value := orderSummaryLine;
else
SummaryLine_Field.Value := "";
endif;
endif;
// If the "Dietitian May Modfiy" button is de-selected, select the special instructions box "Not to be modified by dietitian"
If CallingField="DIET_May Modify" then
If Dietitian_May_Modify_Selection.Value = true
then
Dietitian_May_Modify_SummaryLine.Value := false;
endif;
If Dietitian_May_Modify_Selection.Value = false
then
Dietitian_May_Modify_SummaryLine.Value := true;
endif;
endif;
endif; // Field Change
// FORM CLOSE
If CallingEvent="FormClose" then
tally:=0;
If exist (Special_Field.value) then tally:=tally+1; endif;
If exist (Sodium_Field.value) then tally:=tally+1; endif;
If exist (Protein_Field.value) then tally:=tally+1; endif;
If exist (ADACalorie_Field.value) then tally:=tally+1; endif;
If exist (Potassium_Field.value) then tally:=tally+1; endif;
If exist (FluidRestrictions_Field.value) then tally:=tally+1; endif;
If exist (Common_Field.value) then tally:=tally+1; endif;
If exist (Consistency_Field.value) then tally:=tally+1; endif;
If exist (Liquid_Field.value) then tally:=tally+1; endif;
If exist (GI_Field.value) then tally:=tally+1; endif;
If exist (Other_Field.value) then tally:=tally+1; endif;
If exist (Finger_Field.value) then tally:=tally+1; endif; // Added By Shivprasad for CSR:32228- Seclusion Tray MLM on [17 Nov 2015]
If (tally <1) then
StopMessage:="You must enter at leaset one diet for this order";
endif;
If (tally >6) then
StopMessage:="You may only enter 6 total Diets to a Diet Order";
endif;
If (tally<1) or (tally>6) then
this_communication.DisplayForm := "Yes";
this_communication.Message := "You have entered " || tally || " diets " || "\n" || "\n" || StopMessage;
this_communication.MessageType := "Error";
endif;
endif;
;;
evoke: // No evoke statement
;;
logic:
conclude true;
;;
action:
// This MLM returns two parameters, of types communication_type and form_type respectively.
return this_communication, this_form;
;;
end: