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

227 lines
8.3 KiB
Plaintext

maintenance:
title: Ordering either one or another Manditory field;;
mlmname: FORM_GENERIC_EITHER_OR_MANDITORY;;
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: To make a list of fields all manditory until one is filled out.
;;
explanation: This generic MLM can be called from several Micro order forms:
- Resp CPAP
- Resp BiPAP
- (others?)
It will make ALL of the specified fields as manditory, unless one is filled in
with a value. Then, it will make all of the other, formerly manditory, fields
into non-manditory fields.
Trigger on formopen or fieldchange.
Rules:
Use lists of
forms,
list of fields to make manditory.
change history
09.11.2007 TMS added 3 new fields to order from to change from mandatory to non-mandatory. (LAB_RC_BGCMT_LV_RespNasalMaskLPM, LAB_RC_BGCMT_LO_RespPartRebreather, LAB_RC_BGCMT_LO_RespNonRebreather)
02.11.2007 DW added a new form, LAB ChemBloodGas_Tmp.
01.28.2009 DW added logic to end the MLM if the MLM_Form_Update_Flag is on the form and is unchecked (will check the field to indicate open for modification)
02.25.2009 DW revised the 01.28.2009 logic to bypass the edits if the form is accessd by a physician
02.26.2015 STH CSR# 32765 - updated to call the user lab priority options MLM to display the user friendly lab priorities when appropriate.
05.29.2015 MJP CSR# 33459: added new field to form to change from mandatory to non (LAB_RC_BGCMT_LV_HiFloNCLPM)
;;
keywords: Called MLMs, Form fields, generic, manditory
;;
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|FIELDS_TO_MAKE_MANDITORY"
form_map_list :=
("Resp CPAP|Resp BIPAP/CPAP O2%,Resp CPAP LPM"
,"Resp BIPAP|Resp BIPAP/CPAP O2%,Resp CPAP LPM"
,"LAB Chem Blood Gas|LAB_RC_BGCMT_LV_RespNCLPM" ||
",LAB_RC_BGCMT_LV_RespFaceMaskLPM,LAB_RC_BGCMT_LV_RespVenturiMaskFIO2" ||
",LAB_RC_BGCMT_LV_HiFloNCLPM" ||
",LAB_RC_BGCMT_LV_RESP Oximizer LPM,LAB_RC_BGCMT_RespAerosolMode,LAB_RC_BGCMT_BIPAP_CPAP" ||
",LAB_RC_BGCMT_LV_RespVentMode,LAB_RC_BGCMT_LO_RespRoomAir,LAB_RC_BGCMT_LO_Resp100 02" ||
",LAB_RC_BGCMT_LV_RespNasalMaskLPM,LAB_RC_BGCMT_LO_RespPartRebreather,LAB_RC_BGCMT_LO_RespNonRebreather"
,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_LV_RespNCLPM" ||
",LAB_RC_BGCMT_LV_RespFaceMaskLPM,LAB_RC_BGCMT_LV_RespVenturiMaskFIO2" ||
",LAB_RC_BGCMT_LV_HiFloNCLPM" ||
",LAB_RC_BGCMT_LV_RESP Oximizer LPM,LAB_RC_BGCMT_RespAerosolMode,LAB_RC_BGCMT_BIPAP_CPAP" ||
",LAB_RC_BGCMT_LV_RespVentMode,LAB_RC_BGCMT_LO_RespRoomAir,LAB_RC_BGCMT_LO_Resp100 02" ||
",LAB_RC_BGCMT_LV_RespNasalMaskLPM,LAB_RC_BGCMT_LO_RespPartRebreather,LAB_RC_BGCMT_LO_RespNonRebreather"
,"YOUR_FORM_NAME_HERE|MANDITORY_FIELD_1,MANDITORY_FIELD_2,MANDITORY_FIELD_3,...etc."
);
/**************************************************************************************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}}};
gen_ungray := mlm {{{SINGLE-QUOTE}}}FORM_GENERIC_un_gray{{{SINGLE-QUOTE}}};
// Display any field related to others:
(this_communication, this_form) := call gen_ungray
with this_communication, this_form, client_info_obj;
// Initialize lists
test_manditory_field_list := ();
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
//*****BEGIN ***** STH 2.10.2015 - Added for CSR 32765 to display user friendly lab priorities
Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
DisplayNewScheduled := first of (field_list.Value
where field_list.DataItemName = "LAB_CB_Alternate Priorities");
//*****END ***** STH 2.10.2015 - Added for CSR 32765 to display user friendly lab priorities
CallingForm := this_form.name;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
if called_by_editor then
CallingForm := "Resp CPAP";
endif;
// 2.25.2009 DW bypass logic
//
// Bypass this MLM{{{SINGLE-QUOTE}}}s logi when a form is opened by a physician
orderroletype:= this_communication.primaryobj.enterrole;
orderrole := orderroletype matches pattern "%Physician%";
userguid:= this_communication.UserGUID;
user_orderrole := read last { "Select orderroletype from CV3User where guid = " || SQL(userguid) };
user_orderrolephysicain := user_orderrole matches pattern "%Physician%";
If user_orderrolephysicain = true
then; // Go to the end of the MLM
else // Continue with the MLM logic
for i in 1 seqto count form_map_list do
// Initialize value counter
value_in_mand_field_counter := 0;
// initialize vars:
manditory_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
//Lookup manditory fields, from map list
test_manditory_field_list := call str_parse with form_element_list[2], ",";
for j in 1 seqto count test_manditory_field_list do
// Test for proper field
test_manditory_field := test_manditory_field_list[j];
manditory_field := first of
(field_list where field_list.DataItemName = test_manditory_field);
if exists manditory_field then
if (manditory_field.datatype <> "checkbox"
and manditory_field.value is not null)
or (manditory_field.datatype = "checkbox"
and manditory_field.value = true) then
value_in_mand_field_counter := value_in_mand_field_counter + 1;
endif;
endif;
enddo; // for j in 1 seq to count test_manditory_field_list
for k in 1 seqto count test_manditory_field_list do
test_manditory_field := test_manditory_field_list[k];
manditory_field := first of
(field_list where field_list.DataItemName = test_manditory_field);
if exists manditory_field then
if value_in_mand_field_counter <= 0 then // Set open form defaults
// Mandate the field and, if necessary, make it visible
manditory_field.control_visible := true;
manditory_field.control_mandatory := True;
manditory_field.control_read_only := False;
else
manditory_field.control_mandatory := False;
manditory_field.control_read_only := False;
endif; // value_in_mand_field_counter <= 0
endif; // exists manditory_field
enddo; // for k in 1 seq to count test_manditory_field_list
endif; // CallingForm = test_form_name
enddo; // for i in 1 seqto count form_map_list
endif; // If exist FormUpdateCheckbox and FormUpdateCheckbox.value = False
//****BEGIN***** STH 2.10.2015 Added for CSR 32765 only display user friendly lab priorities if the opbservation is added to the form AND selected/checked
if (DisplayNewScheduled) then
//Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
(this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
endif;
//****END***** STH 2.10.2015 Added for CSR 32765 only display user friendly lab priorities if the opbservation is added to the form AND selected/checked
;;
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: