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

360 lines
13 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
maintenance:
title: FORM_VALUE_IVF_IDCODE;;
mlmname: FORM_VALUE_IVF_IDCODE;;
arden: version 2;;
version: 4.50 ;;
institution: St. Clair Hospital;;
author: Teresa Spicuzza, St Clair Hospital ;;
specialist: Josue Lopez, Eclipsys Corp. ;;
date: 2007-01-05;;
validation: testing;;
library:
purpose:
This MLM will evaluate the IV additive field
If the IV additive field is valued it will send the correct ancillary code to
the pharmacy system.
If the IV additive field is not valued the ancillary code will be valued with
the floorstock item number.
;;
explanation:
Fields used:
IVAdditive - system defined compound field
PRX_NOIVAdditive user defined data item -free format text
PRX_IV Additive user defined data item - free format text (note space between IV and Additive)
PRX_DRUGIDCODE SIM defined data item - free format text
AdminInstructions - system defined - free format text
PRX_NOTECOMMENT0 - user defined - free format text
Logic
If IVAdditive is null
Then PRX_DRUGIDCODE equals value of PRX_NOIVAdditive
Else if IVAdditive is valued
Then PRX_DRUGIDCODE equals vaule of PRX_IV Additive
Modification history
Date Author Change(s) / Notes
01/05/2007 JLopez Updated maintenance slot information
JLopez added new required field (AdminInstructions)
JLopez added code for additional logic:
If any IV Additive description field contains "(HZ)" then
insert warning message into AdminInstructions field
JLopez MLM assigned to
OEF: PRX_IvW/Add
Event: FieldChange
Field: IVAdditive
01/08/2007 JLopez Changed target field for message to (new field) PRX_NOTECOMMENT0.
Added code to capture PRX_NOTECOMMENT0 string and restore orignal
when no hazardous med found.
04/27/2007 RSpence Added logic to trap for Non formulary additives, if found display
Information message and make medication mandatory
06/12/2008 DWarnick Added logic display Beta Blocker message in PRX_NOTECOMMENT0 field
08/05/2014 TSpicuzza Added logic to display Hazardous Waste disposal info to hidden field
on form. This will only display with the task and on the special notes
tab on veriscan to provide user administering medication with instructions
for Stericycle disposal method. CSR 31995
03.03.2016 TMS Added call for duplicate order checking if additives added. CSR 33465
07.23.2019 TMS CSR 37676 - Change log_execution_info to false per upgrade analysis.
;;
keywords: PRX_DRUGIDCODE, Hazardous Medication
;;
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;
// 06.12.08 DW - created hazard and betablocker flags and initialized them to "no"
// - changed the initial value of the haz_med_warning from the hazardous med warning note (commented out) to a single blank.
// the len of this field this is used for blanking out when an additive is removed
hazardfound := "no";
betafound := "no";
BKCfound := "no";
SPfound := "no";
SPPMfound := "no";
Disposalfound := "no";
Dup_Order_Mgt_MLM := mlm {{{SINGLE-QUOTE}}}FORM_RX_MEDICATION_RETRIEVAL{{{SINGLE-QUOTE}}};
BKC_Note := "If any medication remains dispose of container in BLACK Waste Bin - NO Empty Containers";
SP_Note := "If any medication remains dispose of container in BLUE Waste Bin - NO Empty Containers";
SPPM_Note := "Dispose of container/wrapper in Blue Waste Bin - Partial and Empty container/wrapper";
haz_med_warning := " ";
// haz_med_warning := "Hazardous Drug - Precautions required - "
// || "Administration by Credentialed RN ONLY";
/***************************************************************************************/
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
/****** Place all your reading and updating here **********/
CallingEvent := this_communication.CallingEvent;
If CallingEvent="FormClose"
then
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;
Instructions_field := last of (field_list where field_list.DataItemName = "PRX_HazDisposalMessage");
Instructions_value := Instructions_field.value;
If (Freq_Sum is Null)
then
Rate.Control_mandatory := True;
endif;
endif;
// obtain each of the possibly required fields
IV_additive := last of (field_list where field_list.DataItemName = "IVAdditive" );
PRX_additive := last of (field_list where field_list.DataItemName = "PRX_IV Additive" );
PRX_No_additive := last of (field_list where field_list.DataItemName = "PRX_NOIVAdditive" );
Drug_ID := last of (field_list where field_list.DataItemName = "PRX_DRUGIDCODE" );
Admin_Inst := first of (field_list where field_list.DataItemName = "AdminInstructions");
NF_AddName := last of (field_list where field_list.DataItemName = "PRX_NFADDNAME" ); //RS
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/* added 01-08-07 JLopez - checking PRX_NOTECOMMENT0 */
/* for haz_med_warning message, extracting original */
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
PRX_Comment := first of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
if exists PRX_Comment then
found_comment := PRX_Comment.Value;
add_len := count(extract characters haz_med_warning);
if found_comment is null then
tot_len := 0;
else
tot_len := count(extract characters found_comment);
if tot_len >= add_len then
comment_tail := string reverse (reverse extract characters found_comment)[1 seqto add_len];
if comment_tail matches pattern haz_med_warning then
if add_len = tot_len then
sans_warn := null;
else
orig_len := tot_len - add_len;
sans_warn := string(extract characters found_comment)[1 seqto orig_len];
endif; // add_len = tot_len
endif; // comment_tail matches pattern
else
sans_warn := found_comment;
endif; // tot_len >= add_len
endif; // exists PRX_Comment
endif; // exists PRX_Comment
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/* end of new code */
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
// if there is an IVAdditive field then obtain it{{{SINGLE-QUOTE}}}s values
if exists IV_additive then
additives_list := IV_additive.value;
// if there is any additive in the field then use PRX_additive value
// otherwise use the PRX_No_additive value
IF count additives_list > 0 then
Drug_ID.value := PRX_additive.Value;
(this_communication, this_form) := call Dup_Order_Mgt_MLM
with (this_communication, this_form, client_info_obj);
else
Drug_ID.value := PRX_No_additive.Value;
endif;
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/* added 01-05-07 JLopez - checking Additives list */
/* for identifier "(HZ)", inserting warning message */
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
if (exist additives_list) and (count(additives_list) > 0) then
haz_med_found := false;
haz_med_names := "";
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/* added 04-27-2007 RSpence - Check for NF also */
/* If exists, pop up reminder that NF_AddNameName */
/* Is becoming Mandatory, if not already filled in */
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
non_form_found := false; // RS
// examine IV additives for "(HZ)" identifier // or (NF) RS
for this_add in additives_list do
addv_guid := this_add.OrderCatalogMasterItemGUID;
this_add_desc := read last {"Select Description from "
|| "CV3OrderCatalogMasterItem "
|| "where GUID = " || SQL(addv_guid)
};
// 06.12.08 DW - added these routines to check for presence of of HZ and BB and present one of three possilbe messages
if (this_add_desc matches pattern "%(HZ)") then hazardfound := "yes"; endif;
if (this_add_desc matches pattern "%(BB)") then betafound := "yes"; endif;
if (this_add_desc matches pattern "%(BKC)") then
disposalfound := "yes";
waste_note := bkc_note;
endif;
if (this_add_desc matches pattern "%(SPPM)") then
disposalfound := "yes";
waste_note := sppm_note;
endif;
if (this_add_desc matches pattern "%(SP)") then
disposalfound := "yes";
waste_note := sp_note;
endif;
if (hazardfound = "yes") and (betafound = "yes") then
haz_med_warning := "Hazardous Drug - Precautions required - "
|| "Administration by Credentialed RN ONLY "
|| " "
|| " "
|| " **Beta Blocker";
endif;
if (hazardfound = "yes") and (betafound = "no") then
haz_med_warning := "Hazardous Drug - Precautions required - "
|| "Administration by Credentialed RN ONLY";
endif;
if (hazardfound = "no") and (betafound = "yes") then
haz_med_warning := "**Beta Blocker";
endif;
if (disposalfound = "yes") then
Instructions_field.value := waste_note;
endif;
// 06.12.08 DW - altered this statement to also search for BB when determining whether to populate the comments field
if (this_add_desc matches pattern "%(HZ)") or (this_add_desc matches pattern "%(BB)")
or (this_add_desc matches pattern "%(SP)") or (this_add_desc matches pattern "%(SPPM)")
or (this_add_desc matches pattern "%(BKC)")
then
haz_med_found := true;
if haz_med_names = "" then
haz_med_names := this_add.Name;
else
haz_med_names := haz_med_names || ", " || this_add.Name;
endif;
endif;
if this_add_desc matches pattern "%(NF)" then //RS
non_form_found := true; //RS
endif; //RS
enddo;
// insert warning into PRX_Comment if "(HZ)" found
PRX_Comment.Control_Read_Only := false;
if haz_med_found then
haz_med_names := "(" || haz_med_names || ")";
if sans_warn is null then
PRX_Comment.Value := haz_med_warning;
else
PRX_Comment.Value := sans_warn || haz_med_warning;
endif;
else
haz_med_names := null;
PRX_Comment.Value := sans_warn;
endif;
// 04-27-2007 RS, Make NF_AddName Mandatory or not, also pop up message
If non_form_found = True
then
If (NF_AddName.Value Is Null) or (NF_AddName.Value = "")
then
this_communication.DisplayForm := "Yes";
this_communication.Message := "You have selected a non-formulary IV additive. "||
"Use only for additives not found within the listing " || "\n\n" ||
"Verify Medication availability with Pharmacy before " ||
"continuing with order." || "\n\n" ||
"Include the name of the non-formulary Additive in the Medication " ||
"field on the form";
this_communication.MessageType := "Informational";
endif;
NF_AddName.control_mandatory := True;
NF_AddName.control_visible := TRUE;
Else
NF_AddName.value:="";
NF_AddName.control_mandatory := False;
NF_AddName.control_visible := False;
endif; // Non form
PRX_Comment.Control_Read_Only := true;
else // no additives in list
haz_med_found := null;
haz_med_names := null;
PRX_Comment.Control_Read_Only := false;
PRX_Comment.Value := sans_warn;
PRX_Comment.Control_Read_Only := true;
NF_AddName.value:="";
NF_AddName.control_mandatory := False;
NF_AddName.control_visible := False;
endif; // exist additives_list
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/* end of new code */
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
endif;
;;
evoke: // No evoke statement
;;
logic:
// always concludes TRUE
conclude true;
;;
action:
// This MLM returns two parameters, of types communication_type and form_type respectively.
return this_communication, this_form;
;;
end: