388 lines
15 KiB
Plaintext
388 lines
15 KiB
Plaintext
maintenance:
|
|
|
|
title: Set Lovenox Nurse Orders Injectable;;
|
|
mlmname: FORM_Set_Lovenox_Orders_Inj;;
|
|
arden: version 2;;
|
|
version: 4.50;;
|
|
institution: St Clair Admissions;;
|
|
author: Don Warnick, Eclipsys Corp Ext 7463;;
|
|
specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
|
|
date: 2008-09-22;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Used for medication grids that holds Lovenox order set
|
|
;;
|
|
|
|
explanation: This MLM is called from the lovenox order set, form: PRX_OsEnoxaparin
|
|
|
|
|
|
Change history
|
|
|
|
09.23.2008 DW Initial build - derived from FORM_SET_HEPARIN_WEIGHT_BASED_INIT
|
|
09.27.2010 TMS Added routine for Hold session date handling
|
|
07.21.2011 TMS Added info for additional grid (MedGridC) to set Med_Was_Selected flag
|
|
04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
|
|
12.04.2017 TMS Restrict selections in Grid 1 when ordered from {{{SINGLE-QUOTE}}}Enoxaparin Inj Orders - Post Op Hip{{{SINGLE-QUOTE}}}
|
|
or "Enoxaparin Inj Orders - Post Op Fx Hip" order sets HD # 2978284
|
|
|
|
;;
|
|
keywords: Called MLMs, warfarin
|
|
;;
|
|
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;
|
|
|
|
|
|
|
|
|
|
/***************************************************************************************/
|
|
|
|
// Use String parse
|
|
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
|
|
|
// Initialize error message
|
|
error_message:="";
|
|
|
|
// Assigns fields passed in the Form object to the Field object
|
|
field_list:= this_form.fields;
|
|
|
|
comm_obj := this_communication.primaryobj;
|
|
client_guid := this_communication.ClientGUID;
|
|
visit_guid := this_communication.ClientVisitGUID;
|
|
chart_guid := this_communication.ChartGuid;
|
|
|
|
CallingEvent := this_communication.CallingEvent;
|
|
CallingField := this_communication.CallingFieldName;
|
|
OrderSetName := comm_obj.OrderSetName;
|
|
|
|
//Find the baseline order checkbox that may need to be ordered with this protocol
|
|
|
|
Labs_Baseline_field := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 1);
|
|
Labs_Baseline_List := Labs_Baseline_field.Value;
|
|
Baseline_CBC:= first of (Labs_Baseline_list where Labs_Baseline_list.Name = "CBC No Diff (Hemogram Only)");
|
|
Baseline_Creatinine:= first of (Labs_Baseline_list where Labs_Baseline_list.Name = "Creatinine");
|
|
|
|
|
|
//Find the daily order that may needs to accompany this protocol
|
|
|
|
Lab_Daily_Order_field := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
|
|
Lab_Daily_Order_List := Lab_Daily_Order_field.Value;
|
|
|
|
// Find the 5 Requested Date fields - #1 is visible, #2 - #5 are hidden
|
|
|
|
primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
|
|
secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
|
|
thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
|
|
fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 4);
|
|
fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 5);
|
|
|
|
//Find the daily reminder that may need to be ordered with this protocol
|
|
|
|
Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 3);
|
|
Lab_Rem_List := Lab_Rem.Value;
|
|
Daily_Reminder := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
|
|
|
|
|
|
//Find if any of the med boxes are checked...if so, set Med_Was_Selected to "yes"
|
|
Med_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
|
|
Med_GridC := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 4);
|
|
Med_List := Med_Grid.Value;
|
|
Med_ListC :=Med_GridC.Value;
|
|
Med_SelList := Med_List.IsSelected;
|
|
Med_ReadList := Med_List.IsReadOnly;
|
|
Med_SelListC := Med_ListC.IsSelected;
|
|
Med_Selected := true in Med_SelList;
|
|
Med_SelectedC := true in Med_SelListC;
|
|
|
|
If (Med_Selected = True or Med_SelectedC = True) then Med_Was_Selected := "yes"; else Med_Was_Selected := "no" ; endif;
|
|
|
|
prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
|
|
|
|
Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
|
|
Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
|
|
|
|
|
|
If CallingEvent = "FieldChange" Then
|
|
|
|
If (CallingField = "MultiOrderGrid|1" or CallingField = "MultiOrderGrid|4") then
|
|
|
|
If Med_Was_Selected = "yes"
|
|
then
|
|
Lab_Daily_Order_List.IsReadOnly := (True,True,True,True,True);
|
|
Lab_Daily_Order_List.IsSelected := (True,True,True,True,True);
|
|
Daily_Reminder.IsReadOnly := True;
|
|
Daily_Reminder.IsSelected := True;
|
|
else
|
|
Lab_Daily_Order_List.IsSelected := (False,False,False,False,False);
|
|
Daily_Reminder.IsSelected := False;
|
|
endif;
|
|
|
|
If CallingField = "MultiOrderGrid|1" and (OrderSetName = "Enoxaparin Inj Orders - Post Op Fx Hip" or OrderSetName = "Enoxaparin Inj Orders - Post Op Hip") then
|
|
|
|
If Med_SelList [1] = True and Med_SelList [2] = False and Med_ReadList [2] = False and Med_ReadList [1] = False then
|
|
|
|
Med_List.IsSelected := (True, True, False, False);
|
|
Med_List.IsReadOnly := (False, True, True, True);
|
|
Elseif
|
|
Med_SelList [1] = False and Med_SelList [2] = True and Med_ReadList [2] = True then
|
|
|
|
Med_List.IsSelected := (False, False, False, False);
|
|
Med_List.IsReadOnly := (False, False, False, False);
|
|
Lab_Daily_Order_List.IsSelected := (False,False,False,False,False);
|
|
Daily_Reminder.IsSelected := False;
|
|
Elseif
|
|
|
|
Med_SelList [2] = True and Med_SelList [1] = False and Med_ReadList [1] = False and Med_ReadList [2] = False then
|
|
|
|
Med_List.IsSelected := (True, True, False, False);
|
|
Med_List.IsReadOnly := (True, False, True, True);
|
|
|
|
Elseif
|
|
Med_SelList [2] = False and Med_SelList [1] = True and Med_ReadList [1] = True then
|
|
|
|
Med_List.IsSelected := (False, False, False, False);
|
|
Med_List.IsReadOnly := (False, False, False, False);
|
|
Lab_Daily_Order_List.IsSelected := (False,False,False,False,False);
|
|
Daily_Reminder.IsSelected := False;
|
|
|
|
Elseif Med_SelList [3] = True then
|
|
Med_List.IsReadOnly := (True, True, False, True);
|
|
Elseif Med_SelList [4] = True then
|
|
Med_List.IsReadOnly := (True, True, True, False);
|
|
Else
|
|
Med_List.IsReadOnly := (False, False, False, False);
|
|
Endif;
|
|
|
|
endif;
|
|
|
|
ElseIf CallingField = "RequestedDate|1" then
|
|
|
|
//Set the four remaining order set date fields based on the starting date
|
|
|
|
yr := extract year now;
|
|
mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
|
|
dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
|
|
today:= yr || "-" || mn || "-" || dd || "T00:00:00";
|
|
|
|
tomorrow := (today as time) +1 day;
|
|
tom_list := call str_parse with tomorrow, " ";
|
|
tom_dte := first(tom_list);
|
|
lesstomorrow := primreqdate.value < tomorrow;
|
|
|
|
If lesstomorrow = true then
|
|
|
|
this_communication.DisplayForm := "Yes";
|
|
this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")";
|
|
this_communication.MessageType := "Error";
|
|
|
|
primreqdate.value := tomorrow;
|
|
endif;
|
|
|
|
startdate:= primreqdate.value;
|
|
Order_From.value := primreqdate.value;
|
|
secreqdate.value := startdate + 2 days;
|
|
thirdreqdate.value := startdate + 4 days;
|
|
fourthreqdate.value := startdate + 6 days;
|
|
fifthreqdate.value := startdate + 8 days;
|
|
Order_To.value := fifthreqdate.value;
|
|
|
|
prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
|
|
fourthreqdate.value || "," || fifthreqdate.value;
|
|
|
|
endif;
|
|
|
|
elseif CallingEvent = "FormOpen" then
|
|
|
|
Lab_Daily_Order_List.IsReadOnly := (True,True,True,True,True);
|
|
Daily_Reminder.IsReadOnly := True;
|
|
// Daily_Reminder.IsSelected := True;
|
|
|
|
// Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
|
|
PlusLocation := FIND "+" IN STRING primreqdate.value;
|
|
TLocation := FIND "T" IN STRING primreqdate.value;
|
|
If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
|
|
If PlusLocation > 0 then
|
|
PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
|
|
primreqdate.value := (now as time) +(PlusDays as number) day;
|
|
endif;
|
|
|
|
startdate:= primreqdate.value;
|
|
Order_From.value := primreqdate.value;
|
|
secreqdate.value := startdate + 2 days;
|
|
thirdreqdate.value := startdate + 4 days;
|
|
fourthreqdate.value := startdate + 6 days;
|
|
fifthreqdate.value := startdate + 8 days;
|
|
Order_To.value := fifthreqdate.value;
|
|
|
|
prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
|
|
fourthreqdate.value || "," || fifthreqdate.value;
|
|
|
|
|
|
elseif CallingEvent = "FormClose" then
|
|
|
|
Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
|
|
(this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
|
|
|
|
|
|
/* this_communication.DisplayForm := "Yes";
|
|
this_communication.Message := "Found_CBC (" || Found_CBC.value || ")";
|
|
this_communication.MessageType := "Error";
|
|
*/
|
|
Med_SelList := Med_List.IsSelected;
|
|
Med_SelListC := Med_ListC.IsSelected;
|
|
Med_Selected := true in Med_SelList;
|
|
Med_SelectedC := true in Med_SelListC;
|
|
|
|
|
|
If (Med_Selected = True or Med_SelectedC = True) then Med_Was_Selected := "yes"; else Med_Was_Selected := "no" ; endif;
|
|
|
|
If Med_Was_Selected = "yes" then
|
|
|
|
// Find if there is a baseline CBC in the past 24 hours and if one is not found, check the baseline box
|
|
|
|
|
|
If (Baseline_CBC.IsSelected =false) or (Baseline_Creatinine.IsSelected = false) then
|
|
|
|
If Baseline_CBC.IsSelected = false then
|
|
|
|
CBC_Val := read last
|
|
{"Select top 1 o.Name"
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
|
|| " and ocmi.active = 1 "
|
|
|| " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
|
|
|| " where o.clientguid = " || SQL(client_guid)
|
|
|| " and o.chartguid = " || SQL(chart_guid)
|
|
|| " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
|
|
|| " and o.requesteddtm <= getdate() "
|
|
|| " and o.OrderStatusLevelNum > 15 "
|
|
|| " and o.OrderStatusLevelNum not in (69, 70) "
|
|
|| " order by o.requesteddtm desc "
|
|
};
|
|
|
|
If not exists CBC_Val then Baseline_CBC.ISSelected :=True; endif;
|
|
|
|
endif;
|
|
|
|
|
|
If Baseline_Creatinine.IsSelected = false then
|
|
|
|
Creatinine_Val := read last
|
|
{" Select top 1 o.Name"
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
|
|| " and ocmi.active = 1 "
|
|
|| " and ocmi.name in ({{{SINGLE-QUOTE}}}Creatinine{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}}, "
|
|
|| " {{{SINGLE-QUOTE}}}Basic Metabolic Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}},"
|
|
|| " {{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Panel Fasting{{{SINGLE-QUOTE}}})"
|
|
|| " where o.clientguid = " || SQL(client_guid)
|
|
|| " and o.chartguid = " || SQL(chart_guid)
|
|
|| " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
|
|
|| " and o.requesteddtm <= getdate() "
|
|
|| " and o.OrderStatusLevelNum > 15 "
|
|
|| " and o.OrderStatusLevelNum not in (69, 70) "
|
|
|| " order by o.requesteddtm desc "
|
|
};
|
|
|
|
If not exists Creatinine_Val then Baseline_Creatinine.ISSelected :=True; endif;
|
|
|
|
endif;
|
|
|
|
endif;
|
|
|
|
|
|
|
|
// Now find if there are already CBC{{{SINGLE-QUOTE}}}S ordered in the future...
|
|
// Reset the check boxes if they are.
|
|
|
|
formlist := call str_parse with prx_comment.value, ",";
|
|
|
|
end_date := fifthreqdate.value + 1 day;
|
|
|
|
CBC_daily_dates :=();
|
|
CBC_daily_dates := read
|
|
|
|
{"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
|
|| " and ocmi.active = 1 "
|
|
|| " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
|
|
|| " where o.clientguid = " || SQL(client_guid)
|
|
|| " and o.chartguid = " || SQL(chart_guid)
|
|
|| " and o.requesteddtm >= " || SQL(primreqdate.value)
|
|
|| " and o.requesteddtm < " || SQL(end_date)
|
|
|| " and o.OrderStatusLevelNum > 15 "
|
|
|| " and o.OrderStatusLevelNum not in (69, 70) "
|
|
|| " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
|
|
|
|
If exist(CBC_daily_dates) then
|
|
Reset_CBC_Grid:= ();
|
|
singledate := "";
|
|
index_list := 1 seqto (count formlist) ;
|
|
|
|
for J in index_list do
|
|
singledate := formlist[J];
|
|
Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
|
|
enddo;
|
|
|
|
Lab_Daily_Order_List.IsSelected := (Reset_CBC_Grid);
|
|
|
|
/*
|
|
this_communication.DisplayForm := "Yes";
|
|
this_communication.Message := "THIS MESSAGE IS FOR TESTING PURPOSES ONLY \n\n\n\n" ||
|
|
"Did you see any changes to the CBC Grid check boxes? \n\n" ||
|
|
"SQL returned dates for CBCS: " || CBC_daily_dates || "\n\n" ||
|
|
"GRID CBC orders with these dates should have been unchecked by this MLM!!!" || "\n\n\n"
|
|
;
|
|
this_communication.MessageType := "Informational";
|
|
*/
|
|
|
|
endif; //If exist
|
|
|
|
else
|
|
|
|
this_communication.DisplayForm := "Yes";
|
|
this_communication.Message := "Please enter a Lovenox Order or Cancel to Continue.\n\n" ;
|
|
this_communication.MessageType := "Error";
|
|
|
|
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:
|