310 lines
13 KiB
Plaintext
310 lines
13 KiB
Plaintext
maintenance:
|
|
|
|
title: FORM_SET_FBC_ADMISSION_ORDERS;;
|
|
mlmname: FORM_SET_FBC_ADMISSION_ORDERS;;
|
|
arden: version 2;;
|
|
version: 5.50;;
|
|
institution: St Clair Hospital;;
|
|
author: Juliet M. Law, Allscripts Corp ext 7461;;
|
|
specialist: Dean Miklavic, Allscripts Corp Ext 7466;;
|
|
date: 2012-03-01;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Used for medication grids to disable dosing instruction checkbox in Family Birth Center Admission Order Set
|
|
;;
|
|
|
|
explanation: This MLM is called from the Family Birth Center Admission Order Set
|
|
|
|
|
|
Change history
|
|
|
|
03.01.2012 JML Copied from FORM_SET_SUBCUTANEOUS_INSULIN MLM
|
|
07.26.2016 BB CSR#33588 - Adding Antibiotic scheduling to FBC Admission Orderset
|
|
|
|
;;
|
|
keywords: Called MLMs, Family, Birth
|
|
;;
|
|
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;
|
|
|
|
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
using "ObjectsPlusXA.SCM.Forms";
|
|
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
|
|
|
/***************************************************************************************/
|
|
|
|
// Initialize error message
|
|
error_message := "";
|
|
|
|
// Assigns fields passed in the Form object to the Field object
|
|
field_list:= this_form.fields;
|
|
|
|
//Retrieve Calling Event and Field information
|
|
CallingEvent := this_communication.CallingEvent;
|
|
CallingField := this_communication.CallingFieldName;
|
|
|
|
//Retrieve list and values of Pharmacy Medication Guidelines Field
|
|
Pharm_Med_Guidelines := last of (field_list where field_list.DataItemName = "MultiOrderInline"
|
|
AND field_List.Control_MultiFieldOccNum = 1);
|
|
Pharm_Med_Guidelines_List := Pharm_Med_Guidelines.Value;
|
|
|
|
//Retrieve list and values of Group B Strep Medications Grid
|
|
GroupB_Strep := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
|
|
AND field_list.Control_MultiFieldOccNum = 45);
|
|
GroupB_Strep_List := GroupB_Strep.Value;
|
|
|
|
//BB
|
|
//Retrieve values for Requested Date/Time hidden fields [BB]
|
|
GroupB_Strep_Pen_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
|
|
and field_list.Control_MultiFieldOccNum = 1);
|
|
GroupB_Strep_Pen_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
|
|
and field_list.Control_MultiFieldOccNum = 1);
|
|
Pen_ReqDate_Val := GroupB_Strep_Pen_ReqDate.Value;
|
|
Pen_ReqTime_Val := GroupB_Strep_Pen_ReqTime.Value;
|
|
|
|
GroupB_Strep_Cef_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
|
|
and field_list.Control_MultiFieldOccNum = 2);
|
|
GroupB_Strep_Cef_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
|
|
and field_list.Control_MultiFieldOccNum = 2);
|
|
Cef_ReqDate_Val := GroupB_Strep_Cef_ReqDate.Value;
|
|
Cef_ReqTime_Val := GroupB_Strep_Cef_ReqTime.Value;
|
|
|
|
GroupB_Strep_Van_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
|
|
and field_list.Control_MultiFieldOccNum = 3);
|
|
GroupB_Strep_Van_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
|
|
and field_list.Control_MultiFieldOccNum = 3);
|
|
Van_ReqDate_Val := GroupB_Strep_Van_ReqDate.Value;
|
|
Van_ReqTime_Val := GroupB_Strep_Van_ReqTime.Value;
|
|
|
|
//Set date/time for current, +4hours, +8hours, +12hours and parse each section for later manipulation [BB]
|
|
TimeTest := "00:00";
|
|
MinuteTime := Minute of Now;
|
|
|
|
DateTimeNow := now;
|
|
DateTimePlusFour := DateTimeNow + 4 hour;
|
|
DateTimePlusFourPlus := DateTimeNow + 5 hour;
|
|
DateTimePlusEight := DateTimeNow + 8 hour;
|
|
DateTimePlusEightPlus := DateTimeNow + 9 hour;
|
|
DateTimePlusTwelve := DateTimeNow + 12 hour;
|
|
DateTimePlusTwelvePlus := DateTimeNow + 13 hour;
|
|
|
|
// Current Date/Time
|
|
DateMonth := month of DateTimeNow ;
|
|
if ( length ( DateMonth as string ) = 1 ) then DateMonth := "0" || DateMonth; endif;
|
|
DateDay := day of DateTimeNow;
|
|
if ( length ( DateDay as string ) = 1 ) then DateDay := "0" || DateDay; endif;
|
|
DateYear := year of DateTimeNow;
|
|
DateSplit := DateMonth ||"-"|| DateDay ||"-"|| DateYear;
|
|
|
|
TimeHour := hour of DateTimeNow;
|
|
if ( length ( TimeHour as string ) = 1 ) then TimeHour := "0" || TimeHour; endif;
|
|
TimeMinute := minute of DateTimeNow;
|
|
if ( length ( TimeMinute as string ) = 1 ) then TimeMinute := "0" || TimeMinute; endif;
|
|
TimeSplit := TimeHour ||":"|| TimeMinute;
|
|
|
|
// Date/Time plus 4 hours
|
|
DateMonth4 := month of DateTimePlusFour ;
|
|
if ( length ( DateMonth4 as string ) = 1 ) then DateMonth4 := "0" || DateMonth4; endif;
|
|
DateDay4 := day of DateTimePlusFour;
|
|
if ( length ( DateDay4 as string ) = 1 ) then DateDay4 := "0" || DateDay4; endif;
|
|
DateYear4 := year of DateTimePlusFour;
|
|
DateSplit4 := DateMonth4 ||"-"|| DateDay4 ||"-"|| DateYear4; // || " 00:00") as time; //7/19/16
|
|
|
|
TimeHour4 := hour of DateTimePlusFour;
|
|
if ( length ( TimeHour4 as string ) = 1 ) then TimeHour4 := "0" || TimeHour4; endif;
|
|
TimeHour4Plus := hour of DateTimePlusFourPlus;
|
|
if ( length ( TimeHour4Plus as string ) = 1 ) then TimeHour4Plus := "0" || TimeHour4Plus; endif;
|
|
TimeMinute4 := minute of DateTimePlusFour;
|
|
if ( length ( TimeMinute4 as string ) = 1 ) then TimeMinute4 := "0" || TimeMinute4; endif;
|
|
TimeSplit4 := TimeHour4 ||":"|| TimeMinute4;
|
|
|
|
// Date/Time plus 8 hours
|
|
DateMonth8 := month of DateTimePlusEight ;
|
|
if ( length ( DateMonth8 as string ) = 1 ) then DateMonth8 := "0" || DateMonth8; endif;
|
|
DateDay8 := day of DateTimePlusEight;
|
|
if ( length ( DateDay8 as string ) = 1 ) then DateDay8 := "0" || DateDay8; endif;
|
|
DateYear8 := year of DateTimePlusEight;
|
|
DateSplit8 := DateMonth8 ||"-"|| DateDay8 ||"-"|| DateYear8;
|
|
|
|
TimeHour8 := hour of DateTimePlusEight;
|
|
if ( length ( TimeHour8 as string ) = 1 ) then TimeHour8 := "0" || TimeHour8; endif;
|
|
TimeHour8Plus := hour of DateTimePlusEightPlus;
|
|
if ( length ( TimeHour8Plus as string ) = 1 ) then TimeHour8Plus := "0" || TimeHour8Plus; endif;
|
|
TimeMinute8 := minute of DateTimePlusEight;
|
|
if ( length ( TimeMinute8 as string ) = 1 ) then TimeMinute8 := "0" || TimeMinute8; endif;
|
|
TimeSplit8 := TimeHour8 ||":"|| TimeMinute8;
|
|
|
|
// Date/Time plus 12 hours
|
|
DateMonth12 := month of DateTimePlusTwelve ;
|
|
if ( length ( DateMonth12 as string ) = 1 ) then DateMonth12 := "0" || DateMonth12; endif;
|
|
DateDay12 := day of DateTimePlusTwelve;
|
|
if ( length ( DateDay12 as string ) = 1 ) then DateDay12 := "0" || DateDay12; endif;
|
|
DateYear12 := year of DateTimePlusTwelve;
|
|
DateSplit12 := DateMonth12 ||"-"|| DateDay12 ||"-"|| DateYear12;
|
|
|
|
TimeHour12 := hour of DateTimePlusTwelve;
|
|
if ( length ( TimeHour12 as string ) = 1 ) then TimeHour12 := "0" || TimeHour12; endif;
|
|
TimeHour12Plus := hour of DateTimePlusTwelvePlus;
|
|
if ( length ( TimeHour12Plus as string ) = 1 ) then TimeHour12Plus := "0" || TimeHour12Plus; endif;
|
|
TimeMinute12 := minute of DateTimePlusTwelve;
|
|
if ( length ( TimeMinute12 as string ) = 1 ) then TimeMinute12 := "0" || TimeMinute12; endif;
|
|
TimeSplit12 := TimeHour12 ||":"|| TimeMinute12;
|
|
//bb
|
|
|
|
//On Form Open Event, disable the checkbox contained in the Pharmacy Medication Guidelines Field
|
|
if (CallingEvent = "FormOpen") then
|
|
Pharm_Med_Guidelines_List.IsReadOnly := (True);
|
|
endif;
|
|
|
|
//On Field Change event, control the ability to select group of medications contained in the
|
|
//Group B Strep Medications Grid
|
|
if (CallingEvent = "FieldChange") then
|
|
|
|
if (CallingField = "MultiOrderGrid|45") then
|
|
//List of Penicillin medications selected
|
|
FirstThree := (GroupB_Strep_List.IsSelected[1],
|
|
GroupB_Strep_list.IsSelected[2],
|
|
GroupB_Strep_List.IsSelected[3]);
|
|
//List of Cefazolin medications selected
|
|
NextTwo := (GroupB_Strep_List.IsSelected[4],
|
|
GroupB_Strep_List.IsSelected[5]);
|
|
|
|
LastTwo := (GroupB_Strep_List.IsSelected[6],
|
|
GroupB_Strep_List.IsSelected[7]);
|
|
|
|
//Determines the number of penicillin medications selected based on list defined above
|
|
FirstThreeTrueCount := count (FirstThree WHERE FirstThree = true);
|
|
//Determines the number of cefazolin medications selected based on list defined above
|
|
NextTwoTrueCount := count (NextTwo WHERE NextTwo = true);
|
|
//Determines if the vancomycin medication is selected
|
|
LastTwoTrueCount := count (LastTwo WHERE LastTwo = true);
|
|
//Count of medications in the Group B Strep Medications Grid that are set to Read Only
|
|
ReadOnlyTrueCount := count (GroupB_Strep_List.IsReadOnly WHERE GroupB_Strep_List.IsReadOnly = true);
|
|
|
|
//Initialize variables used to set the IsReadOnly and IsSelected property on medications in the grid
|
|
NewReadOnly := ();
|
|
NewSelected := ();
|
|
//Begin loop through Group B Strep Medications grid
|
|
for k in 1 seqto (count GroupB_Strep_List.IsSelected) do
|
|
|
|
//If 1 penicillin medication is selected, then select all 3 penicillins and set all other medications in grid
|
|
//to Read Only
|
|
if (FirstThreeTrueCount = 1) then
|
|
if (k <= 3) then
|
|
NewReadOnly := NewReadOnly, false;
|
|
NewSelected := NewSelected, true;
|
|
else
|
|
NewReadOnly := NewReadOnly, true;
|
|
NewSelected := NewSelected, false;
|
|
|
|
//BB
|
|
//when Penicillin is selected add 4 hours to additional scheduled Penicillin order admin time [BB]
|
|
//Adjust for Administration time calculated for < 45 minutes is initiating hour, >= 45 minutes is next hour [BB]
|
|
GroupB_Strep_Pen_ReqDate.value := DateSplit4 ;
|
|
Pen_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
|
If MinuteTime >= 45 then
|
|
Pen_ReqTime_Val.ReqTimeValue := TimeHour4Plus ||":00";
|
|
else
|
|
Pen_ReqTime_Val.ReqTimeValue := TimeHour4 ||":00";
|
|
endif;
|
|
//bb
|
|
endif;
|
|
|
|
//If 2 pencillin medications are selected, we can safely assume user is attempting to unselect the penicillins
|
|
//UnSelect all penicillin medications and reset the other medications in grid to NOT Read Only
|
|
elseif (FirstThreeTrueCount = 2) then
|
|
NewReadOnly := NewReadOnly, false;
|
|
NewSelected := NewSelected, false;
|
|
//If 1 cefazolin medication is selected and no other medications in the grid are set to Read Only,
|
|
//we can safely assume user is attempting to select cefazolin
|
|
//Select both cefazolin medications and set all other medications in the grid to Read Only
|
|
elseif (NextTwoTrueCount = 1 AND ReadOnlyTrueCount = 0) then
|
|
if (k >= 4 AND k < 6) then
|
|
NewReadOnly := NewReadOnly, false;
|
|
NewSelected := NewSelected, true;
|
|
else
|
|
NewReadOnly := NewReadOnly, true;
|
|
NewSelected := NewSelected, false;
|
|
|
|
//BB
|
|
//when Cefazolin is selected add 8 hours to additional scheduled Cefazolin order admin time [BB]
|
|
//Adjust for Administration time calculated for < 45 minutes is initiating hour, >= 45 minutes is next hour [BB]
|
|
GroupB_Strep_Cef_ReqDate.value := DateSplit8;
|
|
Cef_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
|
If MinuteTime >= 45 then
|
|
Cef_ReqTime_Val.ReqTimeValue := TimeHour8Plus ||":00";
|
|
else
|
|
Cef_ReqTime_Val.ReqTimeValue := TimeHour8 ||":00";
|
|
endif;
|
|
//bb
|
|
endif;
|
|
//If 1 cefazolin medication is selected and other medications in the grid are set to Read Only,
|
|
//we can safely assume user is attempting to unselect cefazolin
|
|
//Unselect both cefazolin medications and reset all other medications in the grid to NOT Read Only
|
|
elseif (NextTwoTrueCount = 1 AND ReadOnlyTrueCount > 0) then
|
|
NewReadOnly := NewReadOnly, false;
|
|
NewSelected := NewSelected, false;
|
|
//If vancomycin is selected, then set all other medications in the grid to Read Only
|
|
elseif (LastTwoTrueCount = 1 AND ReadOnlyTrueCount = 0) then
|
|
if (k = 6 OR k = 7) then
|
|
NewReadOnly := NewReadOnly, false;
|
|
NewSelected := NewSelected, true;
|
|
else
|
|
NewReadOnly := NewReadOnly, true;
|
|
NewSelected := NewSelected, false;
|
|
|
|
//BB
|
|
//when Vancomycin is selected add 12 hours to additional scheduled Vancomycin order admin time [BB]
|
|
//Adjust for Administration time calculated for < 45 minutes is initiating hour, >= 45 minutes is next hour [BB]
|
|
GroupB_Strep_Van_ReqDate.value := DateSplit12;
|
|
Van_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
|
If MinuteTime >= 45 then
|
|
Van_ReqTime_Val.ReqTimeValue := TimeHour12Plus ||":00";
|
|
else
|
|
Van_ReqTime_Val.ReqTimeValue := TimeHour12 ||":00";
|
|
endif;
|
|
//bb
|
|
|
|
endif;
|
|
//If vancomycin is unselected, then reset all other medications in grid to NOT Read Only
|
|
elseif (LastTwoTrueCount = 1 AND ReadOnlyTrueCount > 0) then
|
|
NewReadOnly := NewReadOnly, false;
|
|
NewSelected := NewSelected, false;
|
|
endif;
|
|
enddo;
|
|
//Update Group B Strep List grid fields with the appropriate IsReadOnly and IsSelected properties.
|
|
GroupB_Strep_List.IsReadOnly := NewReadOnly;
|
|
GroupB_Strep_List.IsSelected := NewSelected;
|
|
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:
|