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

279 lines
10 KiB
Plaintext

maintenance:
title: Ordering Conditional Display field;;
mlmname: FORM_GENERIC_Display;;
arden: version 2;;
version: 4.50;;
institution: St Clair Hospital;;
author: Claudia Benson, Claudia.Benson@stclair.org, (412) 942-1307;;
specialist: Eclipsys Corporation;;
date: 2006-10-11;;
validation: testing;;
library:
purpose: Based on a value provided in one field, make another field DISPLAY.
;;
explanation: This generic MLM can be called from several order forms:
- Resp PFT
- (others?)
If a particular value is placed in a certain field of a certain form, specified by
the configuration list below, then another field, also in the list, will be made to
display.
Trigger on formopen or fieldchange.
Rules:
Use lists of
forms,
fields to test on the form,
values to test for,
field to make visible (if the value in the other field is present)
Value (T or F) of the read-only status of the visible field.
change history
05.22.2008 RS Get ED Status Board location
05.28.2008 DW Forced Xopenex error box if dose missing
01.20.2015 TMS Added new form map for "RESP Spont Aerosol" CSR 32176
04.26.2016 TMS Add call on form Open to Medication Order Management MLM CSR 33465
07.26.2017 AnkitM CSR 33723: Changed word references from {{{SINGLE-QUOTE}}}Xopenex{{{SINGLE-QUOTE}}} to {{{SINGLE-QUOTE}}}Levalbuterol{{{SINGLE-QUOTE}}}
;;
keywords: Called MLMs, Form fields, generic, field test, visible
;;
knowledge:
type: data-driven;;
data:
/***********************Make Changes To Spelling And Flags In This Section************************/
//NOTE: THE RELATIVE ORDER OF ITEMS MUST BE MAINTAINED WITHIN LISTS!!!
//MUST HAVE THE FOLLOWING ORDER FOR EACH ELEMENT ITEM:
//"FORM_NAME|FIELD_NAME_TO_TEST|VALUEs_TO_TEST_FOR|FIELD_TO_MAKE_VISIBLE|T_or_F(READ_ONLY)"
form_map_list :=
("Resp PFT|Resp PFT Reason For Test|Pre-Operative|Resp PFT_Surgery Date|F"
,"Resp PFT|Resp PFT Reason For Test|Pre-Operative|Resp PFT_Surgery Time|F"
,"RESP SA IPPB|IsPRN|TRUE|RESP_PRN Reasons|F"
,"RESP SA IPPB|RESP_Xopenex|Use Therapeutic Substitute|RESP_Xopenex Substitutes Label|T"
,"RESP SA IPPB|RESP_Xopenex|Use Therapeutic Substitute|RESP_Xopenex Substitute Label 2|T"
,"RESP SA IPPB|RESP_Xopenex|Per Physician Order: Do NOT Substitute|RESP_Xopenex 0.63mg/3ml NSS|F"
,"RESP SA IPPB|RESP_Xopenex|Per Physician Order: Do NOT Substitute|RESP_Xopenex 1.25mg/3ml NSS|F"
,"RESP Spont Aerosol|IsPRN|TRUE|RESP_PRN Reasons|F"
,"RESP Spont Aerosol|RESP_Xopenex|Use Therapeutic Substitute|RESP_Xopenex Substitutes Label|T"
,"RESP Spont Aerosol|RESP_Xopenex|Use Therapeutic Substitute|RESP_Xopenex Substitute Label 2|T"
,"RESP Spont Aerosol|RESP_Xopenex|Per Physician Order: Do NOT Substitute|RESP_Xopenex 0.63mg/3ml NSS|F"
,"RESP Spont Aerosol|RESP_Xopenex|Per Physician Order: Do NOT Substitute|RESP_Xopenex 1.25mg/3ml NSS|F"
,"YOUR_FORM_NAME_HERE|YOUR_TEST_FIELD_HERE|VALID_VAL1,VALID_VAL2|DISPLAY_FIELD_HERE|F_or_T"
);
/**************************************************************************************JAB********/
// 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;
//Initialize MLM pointers:
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
chk_overdue_time := MLM {{{SINGLE-QUOTE}}}overdue_req_time{{{SINGLE-QUOTE}}};
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingForm := this_form.name;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
Visit_Guid := this_communication.ClientVisitGuid;
// 05/22/08 RS Added per ED CPOE Beeper additions
If (CallingForm = "RESP SA IPPB" or CallingForm = "RESP Spont Aerosol") then
If (CallingEvent = "FormOpen") then
EDLoc :=last of (field_list
where field_list.DataItemName = "ED Location" );
Temp := read last {"Select el.EDDisplayName "
|| " from sxaedlocation as el "
|| " join sxaedboard as eb "
|| " on eb.EdLocationguid = el.locationguid "
|| " and eb.clientvisitguid = " || SQL(Visit_Guid)
|| " and eb.active =1 "};
EDLoc.Value := Temp;
elseif (CallingEvent = "FormClose") then
Levalbuterolquestion := last of (field_list where field_list.DataItemName = "RESP_Xopenex" );
Levalbuterol063 := last of (field_list where field_list.DataItemName = "RESP_Xopenex 0.63mg/3ml NSS" );
Levalbuterol125 := last of (field_list where field_list.DataItemName = "RESP_Xopenex 1.25mg/3ml NSS" );
If Levalbuterolquestion.value = "Per Physician Order: Do NOT Substitute" and (Levalbuterol063.value = False and Levalbuterol125.value = False) then
this_communication.Message :=
"callingform = "|| callingform
|| "\nCallingEvent = " || CallingEvent;
this_communication.Message := "You must select a Levalbuterol dose";
this_communication.MessageType := "Error";
endif;
endif;
endif;
if called_by_editor then
CallingForm := "LAB Ser Nsg Col_Ser1";
CallingEvent := "FieldChange";
CallingField := "LAB_M_VO_OBR15_SpecType_Ser1";
endif;
for i in 1 seqto count form_map_list do
// initialize vars:
visible_field := null;
trigger_field := null;
// parse the form mapper:
form_element_list := call str_parse with form_map_list[i], "|";
test_form_name := form_element_list[1]; //Lookup form name from map list
// Test for proper form
if CallingForm = test_form_name then
test_visible_field := form_element_list[4]; //Lookup visible field from map list
test_vis_field_r_o := form_element_list[5]; //Lookup read-only status from map list
visible_field := first of
(field_list where field_list.DataItemName = test_visible_field);
// Set open form defaults
if exists visible_field then
test_field := form_element_list[2]; //Lookup test field from map list
trigger_field := first of
(field_list where field_list.DataItemName = test_field);
//check for {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} fields
if visible_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then
Right_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Right" );
Superficial_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Superficial" );
Left_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Left" );
Deep_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Deep" );
endif;
// Test for proper field
if exists trigger_field then
//Lookup list of valid values for the test field
test_val_list := call str_parse with form_element_list[3], ",";
//Check for time field
if trigger_field.dataitemname = "RequestedTime"
and "overdue" is in test_val_list then
if exists trigger_field.value.reqtimevalue then
time_type := "scheduled";
time_val := trigger_field.value.reqtimevalue;
else
time_type := "coded";
time_val := trigger_field.value.reqtimecode;
endif;
// check for overdue time
time_is_overdue := call chk_overdue_time
with time_val, time_type;
endif;
if (trigger_field.value as string) is in test_val_list or time_is_overdue then
// Make the field visible (but NOT Manditory!)
visible_field.control_visible := True;
if test_vis_field_r_o = "F" then
visible_field.control_read_only := False;
else
visible_field.control_read_only := True;
endif;
// make {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} settings writable
if visible_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then
Right_box.control_visible := True;
Superficial_box.control_visible := True;
Left_box.control_visible := True;
Deep_box.control_visible := True;
if test_vis_field_r_o = "F" then
Right_box.control_read_only := False;
Superficial_box.control_read_only := False;
Left_box.control_read_only := False;
Deep_box.control_read_only := False;
else
Superficial_box.control_read_only := True;
Left_box.control_read_only := True;
Deep_box.control_read_only := True;
endif;
endif;
// FOR DEBUGGING PURPOSES: display a message to the user
/* this_communication.Message :=
"callingform = "|| callingform
|| "\nCallingEvent = " || CallingEvent
|| "\ntest_form_name = " || test_form_name
|| "\ntest_field = " || test_field
|| "\ntest_visible_field = " || test_visible_field
|| "\ntrigger_field = " || trigger_field.dataitemname
|| "\nvisible_field = " || visible_field.dataitemname
|| "\ntest_val_list = " || test_val_list;
this_communication.MessageType := "Informational";
*/
else
visible_field.control_visible := False;
if test_vis_field_r_o = "F" then
// visible_field.control_read_only := True;
visible_field.value := null;
endif;
if visible_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then
// set all {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} boxes to read-only
Right_box.control_visible := False;
Superficial_box.control_visible := False;
Left_box.control_visible := False;
Deep_box.control_visible := False;
Right_box.value := null;
Superficial_box.value := null;
Left_box.value := null;
Deep_box.value := null;
endif; // visible_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript"
endif; // (trigger_field.value as string) is in test_val_list
endif; // exists trigger_field
endif; // exists visible_field
endif; // CallingForm = test_form_name
enddo; // for i in 1 seqto count form_map_list
Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_Rx_Medication_Retrieval{{{SINGLE-QUOTE}}};
(this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
;;
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: