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

206 lines
7.0 KiB
Plaintext

maintenance:
title: IV Special Rates to Rate Mandatory;;
mlmname: FORM_Rx_SpecialRate_To_RateMan;;
arden: version 2;;
version: 4.50;;
institution: St Clair IV Special Rate MLM;;
author: Robert Spence, Eclipsys Corp;;
specialist: ;;
date: 2007-04-27;;
validation: testing;;
library:
purpose: Make Rate mandatory per the selection of Special rates.
;;
explanation: This MLM is called from the PRX_IV forms.
If Special Rates are TiTrate Rate is not Mandatory
Wide Open Rate is not mandatory - changed to mandatory 5/2/15
KVO Rate is Mandatory
Blank (Null) Rate is Madatory
Special considerations:
Special rate is a FrequencyCode type
Rate is a OrderIVRate type
Initial testing performed on PRX_IvW/Add form
History:
05.24.2016 TMS CSR 34387 Updated to make Wide Open Rate mandatory and default to 999 ml/hr for
patient in an ICU location.
05.22.2017 JML CSR 35272 Added logic to calculate IV rate based on weight - used for (ED) Sepsis Work Up Orders
06.30.2018 TMS CSR 36870 Added Lactated Ringers to logic to calculate IV rate based on weight - used for (ED) Sepsis Work Up Orders
10.29.2018 TMS HD 3481625 Added logic to make IV Rate for Fentanyl 200mcg + Bupiv125mg+NS 46ml on FBC Epidural Orders mandatory upon form open.
;;
keywords: Called MLMs, Form fields, IV, Special Rates, Rate Mandatory
;;
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;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
/*******************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;
comm_primary_obj := this_communication.PrimaryObj;
order_set_name := comm_primary_obj.OrderSetName;
order_name := comm_primary_obj.Name;
order_mod := comm_primary_obj.Modifier;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
SpecialRate := last of (field_list where field_list.DataItemName = "FrequencyCode" );
SpecialRate_Val := SpecialRate.Value;
Freq_Sum := SpecialRate_Val.FrequencySummary;
Rate := last of (field_list where field_list.DataItemName = "OrderIVRate" );
Rate_Val := Rate.Value;
Instr := last of ( field_list WHERE field_list.DataItemName = "AdminInstructions" );
MLM_From_OrderSet := last of ( field_list WHERE fiel_list.DataItemName = "MLM_From Order Set" );
LocName:= read last
{"SELECT currentlocation "
|| " FROM cv3clientvisit "
|| " WHERE ClientGUID = " || SQL(client_guid )
|| " And GUID = " || SQL(visit_guid)};
/******* JML: BEGIN CSR 35272 CHANGE ***********************/
if ( CallingEvent = "FieldChange" AND CallingField = "MLM_From Order Set" ) then
if ( order_set_name = "Septic Work Up Orders" AND (order_name = "Lactated Ringers 1000ml" or order_name = "0.9% NaCl 1000ml")) then
if ( order_mod = "Weight based dosing" ) then
//Retrieve weight
comb_ht_wt_field := first of ( field_list WHERE field_list.DataItemName = "CombinedMeasurements" );
if exists comb_ht_wt_field then
comb_ht_wt_val := comb_ht_wt_field.Value;
wt := comb_ht_wt_val.weight;
ht := comb_ht_wt_val.height;
weightvalue := ( wt as number );
endif;
if ( weightvalue = 0 OR weightvalue IS NULL OR ht = 0 OR ht IS NULL ) then
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Weight Based Dosing Requires Height & Weight To Be Entered.", "Alert", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
else
calc_rate := round ( weightvalue * 30 );
calc_hundreds := SUBSTRING 3 CHARACTERS STARTING AT ( LENGTH ( calc_rate AS STRING ) - 2 ) FROM ( calc_rate AS STRING );
if ( ( ( calc_hundreds AS NUMBER ) >= 750 ) ) OR ( ( ( calc_hundreds AS NUMBER ) >= 250 ) AND ( ( calc_hundreds AS NUMBER ) <= 500 ) ) then
calc_rate := CEILING ( ( calc_rate as number ) / 500 ) * 500;
elseif ( ( ( calc_hundreds AS NUMBER ) >= 501 ) AND ( ( calc_hundreds AS NUMBER ) < 750 ) ) OR ( ( calc_hundreds AS NUMBER ) < 250 ) then
calc_rate := FLOOR ( ( calc_rate AS NUMBER ) / 500 ) * 500;
endif;
Instr.Value := "Volume to be administered is " || calc_rate || " mL";
SpecialRate_Val.FrequencySummary := "Wide Open";
endif;
endif;
endif;
if ( order_set_name = "FBC Epidural Orders" AND order_name = "Fentanyl 200mcg + Bupiv125mg+NS 46ml" ) then
If Freq_Sum is Null then
Rate_Val.Amount := null;
Rate.Control_mandatory := True;
Rate.Value := Rate_Val;
endif;
endif;
endif;
If (CallingField = "FrequencyCode") then
If (Freq_Sum = "Titrate")// or (Freq_Sum = "Wide Open")
then
Rate.Control_mandatory := False;
Rate_Val.Amount := "";
Rate.Value := Rate_Val;
elseif (Freq_Sum = "Wide Open")
then
Rate_Val.UOM := "ml/hr";
If LocName matches pattern "ICU-%" then
Rate_Val.Amount := "999";
endif;
Rate.Value := Rate_Val;
elseif (Freq_Sum = "KVO") or (Freq_Sum is Null)
then
Rate_Val.Amount := null;
Rate.Control_mandatory := True;
Rate.Value := Rate_Val;
endif; //Freq Sum Checking
Elseif (CallingField = "OrderIVRate") then
If (Rate_Val.UOM Is Null) or (Rate_Val.UOM ="")
then
this_communication.DisplayForm := "Yes";
this_communication.Message := "Please select a unit of measure for the Rate Field";
this_communication.MessageType := "Error";
Rate_Val.UOM := "";
Rate.Value := Rate_Val;
Endif; // Rate check
endif; //calling field or event
If CallingEvent = "FormClose"
then
If (Freq_Sum is Null)
then
Rate.Control_mandatory := True;
endif;
endif;
/* this_communication.DisplayForm := "Yes";
this_communication.Message := "MLM Field :" || CallingField || "\n" ||
"MLM Event :" || CallingEvent || "\n" ||
"Special rate Value:" || SpecialRate_Val || "\n" ||
"Special Rate Freq Summary:" || Freq_Sum || "\n" ||
"Rate Amount: " || Rate_Val.Amount;
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: