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

153 lines
5.8 KiB
Plaintext

maintenance:
title: If PRN then PRN Reason text is mandatory;;
filename: FORM_PRN_reason;;
arden: version 2;;
version: 4.50;;
institution: Eclipsys, System MLM;;
author: Rob Warner, UYS,Inc;;
specialist: ;;
date: 2004-07-16;;
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.
History:
01.30.2013 TMS MLM not currently requiring a PRN reason. Logic added to make start now checkbox not selectable
If the the ISPRN checkbox is true, order is being entered in a hold session, or frequency is a one
time frequency.
08.09.2013 TMS Added logic to retrieve location and if equal to a behavioral health unit make the PRN Reason
mandatory. Field being used to document indication for medications. CSR 31639
08.15.2013 TMS Removed mandatory conrol for prn reason field for behav. health unitl department ensures
reasons are noted by physician. CSR 31639
02.21.2014 TMS Added functionality for STAT and Then orders, modified to allow use of PRN with Stat/Now and then orders.
Updated to use Total doses UDDI to populate the stop after field with appropriate value. CSR 31883
04.26.2017 TMS Make PRN indication mandatory if IsPRN is true. CSR 35622
05.16.2018 TMS Add "With Dialysis Treatment" to Frequency retrievals that contain As Ordered. CSR 33940
;;
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;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
comm_obj := this_communication.primaryobj;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
start_now_value := start_now.value;
stat_then := last of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then" );
stat_then_value := stat_then.value;
TotalDosing := first of ( field_list WHERE field_list.DataItemName = "PRX_Dosing Total Doses");
TotalDosing_value := TotalDosing.value;
order_freq := first of (field_list where field_list.DataItemName = "FrequencyCode");
order_freq_value := order_freq.value;
order_freq_summary := order_freq_value.FrequencySummary;
RX_Comments_field := last of (field_list where field_list.DataItemName = "Rx Comments");
RX_Comments_value := RX_Comments_field.value;
RX_Instructions_field := last of (field_list where field_list.DataItemName = "Rx Instructions");
BehavHealth := ("PSYE", "PSYW");
session_type := comm_obj.internalprocessingtype;
OneTimeFreq := ("As Ordered", "As-Directed", "Between Blood", "Given in Delivery Room",
"Given in Infusion Center", "Given in NSY", "Load", "Now", "Once",
"One Time", "Per-Protocol", "POST OP", "Post-Procedure", "Post-Transfusion",
"PRE OP", "Pre-Procedure", "Pre-Transfusion", "With Dialysis Treatment");
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
CurrentLocationGuid := read last
{"Select CurrentLocationGuid "
||" From cv3Clientvisit "
||" Where ClientGuid = " || SQL(Client_Guid)
||" and Guid = " || SQL(Visit_Guid)
||" and VisitStatus = {{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}}" };
CurrentLocation := read last
{"Select Name from cv3location "
||" Where Guid = " || SQL(CurrentLocationGuid) };
// This sets the visible control on the field dataitem - PRX_PRN_Reason
IsPRN_field := last of (field_list
where field_list.DataItemName = "IsPRN" );
PRX_PRN_Reason_field := first of (field_list
where field_list.DataItemName = "PRX_PRNCONDITION");
PRX_PRN_Reason_field_value := PRX_PRN_Reason_field.value;
// If CurrentLocation in BehavHealth then
// PRX_PRN_Reason_field.control_mandatory := FALSE;
// endif;
If IsPRN_field.Value = True then
PRX_PRN_Reason_field.control_mandatory := True;
elseif IsPRN_field.Value = False then
PRX_PRN_Reason_field.control_mandatory := False;
endif;
If exists start_now and session_type <> "Hold" and order_freq_summary not in OneTimeFreq then
start_now.control_read_only := false;
stat_then.control_read_only := false;
endif;
// If exists Rx_comments_field and CallingEvent = "FormClose" and PRX_PRN_Reason_field is not NULL then
// If RX_Comments_value is NULL then
// RX_Comments_field.value := PRX_PRN_Reason_field.value;
// else
// RX_Comments_field.value := RX_Comments_value || " for " || PRX_PRN_Reason_field_value;
// 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: