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

230 lines
8.3 KiB
Plaintext

maintenance:
title: Change Supplement Form Per Required Fields And Frequency Checks;;
mlmname: FORM_Diet_Supplement_Req;;
arden: version 2;;
version: 4.50;;
institution: St Clair Diet MLM;;
author: Robert Spence, Eclipsys Corp;;
specialist: ;;
date: 2006-03-31;;
validation: testing;;
library:
purpose: This MLM checks the frequency valuse and 2 other required supplements
;;
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.
Change History:
03/13/2007 RS Changed to disable buttons on field change of 3 supplement choices
03/21/2012 TS/MJP Orders Rec Project 26841: DataItemName used for frequency value
and summary changed to Frequencycode to correct frequency translation
on Post Hospital Care Orders. Logic for UDDI Frequency Field included
in logic to allow MLM to work with either field during turnover period
of 4 hours for MLM to be recached. This field can be removed from the
MLM and the call for the MLM on field change can be removed from this
field on the form for any subsequent changes to this MLM.
;;
keywords: Called MLMs, Form fields, Frequency, Supplements
;;
knowledge:
type: data-driven;;
data:
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// 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;
// This sets the visible control on the field dataitem - FrequencyCode
Supplement_field := first of (field_list
where field_list.DataItemName = "DIET_DSS_Supplement" );
Specific_field := first of (field_list
where field_list.DataItemName = "DIET_DSS_Supplement Flavors" );
PerPatient_field := first of (field_list
where field_list.DataItemName = "DIET_Supplements per Patient" );
Note_field := first of (field_list
where field_list.DataItemName = "DIET_Supplement Flavor Note" );
//Initial value
NoteValue:="Supplement flavors will be varied. If you prefer specific flavors, they must be selected specifically.";
UDFreq_field := first of (field_list
where field_list.DataItemName = "DIET_Supplement Frequency" );
Freq_field := first of (field_list
where field_list.DataItemName = "FrequencyCode" );
Freq_value := freq_field.value;
Freq_summary := freq_value.frequencysummary;
Breakfast_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_1_Breakfast" );
MidMorning_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_2_Mid Morning" );
Lunch_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_3_Lunch" );
MidAfternoon_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_4_Mid Afternoon" );
Dinner_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_5_Dinner" );
BeforeBed_field := last of (field_list
where field_list.DataItemName = "DIET_SSP_LO_6_Before Bed" );
If CallingEvent="FieldChange"
then
If ((CallingField="FrequencyCode") or (CallingField="DIET_Supplement Frequency"))
then
If Freq_summary = "Daily" OR UDFreq_field.value = "Daily"
then
Breakfast_field.Value :=FALSE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=TRUE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=FALSE;
BeforeBed_field.Value :=FALSE;
elseif (Freq_summary = "BID" OR UDFreq_field.value = "BID")
then
Breakfast_field.Value :=FALSE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=TRUE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=TRUE;
BeforeBed_field.Value :=FALSE;
elseif (Freq_summary = "TID" OR UDFreq_field.value = "TID")
then
Breakfast_field.Value :=TRUE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=TRUE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=TRUE;
BeforeBed_field.Value :=FALSE;
elseif (Freq_summary = "QID" OR UDFreq_field.value = "QID")
then
Breakfast_field.Value :=TRUE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=TRUE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=TRUE;
BeforeBed_field.Value :=TRUE;
else
Breakfast_field.Value :=FALSE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=FALSE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=FALSE;
BeforeBed_field.Value :=FALSE;
endif;
elseif (CallingField =("DIET_DSS_Supplement"))
then
If (Supplement_field.Value Is Not Null)
Then
Specific_field.value :="";
Specific_field.control_read_only :=True;
PerPatient_field.value :=False;
PerPatient_field.control_read_only :=True;
Note_Field.Value :="By selecting a Supplement, you are not able to select a Specific Flavor or Patient{{{SINGLE-QUOTE}}}s Choice";
else
Specific_field.control_read_only :=False;
PerPatient_field.control_read_only :=False;
Note_Field.Value :=NoteValue;
endif;
elseif (CallingField =("DIET_DSS_Supplement Flavors"))
then
If (Specific_field.value Is Not Null)
Then
Supplement_field.value :="";
Supplement_field.control_read_only :=True;
PerPatient_field.value :=False;
PerPatient_field.control_read_only :=True;
Note_Field.Value :="By selecting a Specific Flavor, you are not able to select Supplement or Patient{{{SINGLE-QUOTE}}}s Choice";
else
Supplement_field.control_read_only :=False;
PerPatient_field.control_read_only :=False;
Note_Field.Value :=NoteValue;
endif;
elseif (CallingField = "DIET_Supplements per Patient")
then
If PerPatient_Field.Value = TRUE
Then
Supplement_field.value :="";
Supplement_field.control_read_only :=True;
Specific_field.value :="";
Specific_field.control_read_only :=True;
Note_Field.Value :="By selecting Patient{{{SINGLE-QUOTE}}}s Choice, you are not able to select a Supplement or a Specific Flavor";
else
Supplement_field.control_read_only :=False;
Specific_field.control_read_only :=False;
Note_Field.Value :=NoteValue;
endif;
endif;
elseif (CallingEvent ="FormClose")
then
if (PerPatient_Field.Value = False) and (Supplement_field.Value Is Null) and (Specific_field.value Is Null)
then
this_communication.DisplayForm := "Yes";
this_communication.Message := "You must select at least one Supplement";
this_communication.MessageType := "Error";
// Supplement_field.value :=Supplement_field.value;
endif;
endif;
// this_communication.DisplayForm := "Yes";
// this_communication.Message := "The Frequency is: " || In_Frequency_field || "\n" || "Freq defined as: "|| Freq
// || "\n" || "Calling event is: " || CallingEvent
// || "\n" || "Calling field is : " || CallingField;
// this_communication.MessageType := "Informational";
;;
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: