maintenance: title: Set Lovenox Nurse Orders Injectable;; mlmname: FORM_Set_NonForm_Arixtra;; 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 warfarin order set ;; explanation: This MLM is called from the warfarin order set, form: PRX_OsEnoxaparin Change history 09.23.2008 RS Initial build - derived from FORM_SET_HEPARIN_WEIGHT_BASED_INIT 09.27.2010 TMS Added routine for Hold session date handling 05.02.2013 JML CSR #31334: Leapfrog changes; adding call to Anticoagulant alert function to check conflicts with Arixtra 04.26.2016 TMS CSR 33465: Add call on form Close to Medication Order Management MLM ;; 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}}}; anticoagulant_check := MLM {{{SINGLE-QUOTE}}}FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK{{{SINGLE-QUOTE}}}; //Include standard .Net libraries standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; //CSR 31334: Leapfrog // Initialize error message error_message:=""; // Assigns fields passed in the Form object to the Field object field_list:= this_form.fields; client_guid := this_communication.ClientGUID; visit_guid := this_communication.ClientVisitGUID; chart_guid := this_communication.ChartGuid; CallingEvent := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; //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); primtime:= last of (Field_list where field_list.DataItemName = "RequestedTime"); //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 arixtra med box exists, if not, it is not applicapable on this order set Med_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1); Med_List :=Med_Grid.Value; Fnd_Arixtra := first of (Med_List WHERE Med_List.Name = "Fondaparinux Inj"); Med_List_Sel := Med_List.IsSelected; Med_List_Name := Med_List.Name; ArixtraSel := false; ListMembMed := count Med_List_Sel; for k in (1 seqto ListMembMed) do if ((Med_List_Name[k] = "Fondaparinux Inj") and (Med_List_Sel[k] = True)) then ArixtraSel := True; endif; enddo; // Arixtra_fld := first of (Med_List where Med_List.Name = "Fondaparinux Inj"); 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" then If (ArixtraSel = True) and (Daily_Reminder.IsSelected = False) then //CSR # 31334: Leapfrog changes; calling anticoagulant alert check function for Arixtra (stop, stop_message, severity) := CALL anticoagulant_check WITH (this_communication, this_form, client_info_obj, Fnd_Arixtra.Name); if (stop = true) then if (severity = "high") then dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}}; Lab_Daily_Order_List.IsReadOnly := (False,False,False,False,False); Lab_Daily_Order_List.IsSelected := (False,False,False,False,False); Daily_Reminder.IsReadOnly := False; Daily_Reminder.IsSelected := False; Baseline_CBC.IsReadOnly := True; Baseline_Creatinine.IsReadOnly := True; primreqdate.control_read_only := True; primtime.control_read_only := True; ListMembMed := count Med_List_Sel; for k in (1 seqto ListMembMed) do if ((Med_List_Name[k] = "Fondaparinux Inj") and (Med_List_Sel[k] = True)) then Med_List[k].IsSelected := False; endif; enddo; else dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}}; if ((dialogRes as String) = "No") then Lab_Daily_Order_List.IsReadOnly := (False,False,False,False,False); Lab_Daily_Order_List.IsSelected := (False,False,False,False,False); Daily_Reminder.IsReadOnly := False; Daily_Reminder.IsSelected := False; Baseline_CBC.IsReadOnly := True; Baseline_Creatinine.IsReadOnly := True; primreqdate.control_read_only := True; primtime.control_read_only := True; ListMembMed := count Med_List_Sel; for k in (1 seqto ListMembMed) do if ((Med_List_Name[k] = "Fondaparinux Inj") and (Med_List_Sel[k] = True)) then Med_List[k].IsSelected := False; endif; enddo; else 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; Baseline_CBC.IsReadOnly := False; Baseline_Creatinine.IsReadOnly := False; primreqdate.control_read_only := False; primtime.control_read_only := False; endif; endif; else 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; Baseline_CBC.IsReadOnly := False; Baseline_Creatinine.IsReadOnly := False; primreqdate.control_read_only := False; primtime.control_read_only := False; endif; elseif (ArixtraSel= False) and (Daily_Reminder.IsSelected = True) then Lab_Daily_Order_List.IsSelected := (False,False,False,False,False); Daily_Reminder.IsSelected := False; Baseline_CBC.IsReadOnly := True; Baseline_CBC.IsSelected := False; Baseline_Creatinine.IsReadOnly := True; Baseline_Creatinine.IsSelected := False; primreqdate.control_read_only := True; primtime.control_read_only := True; 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 + 1 days; thirdreqdate.value := startdate + 2 days; fourthreqdate.value := startdate + 3 days; fifthreqdate.value := startdate + 4 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; Baseline_CBC.IsReadOnly := True; Baseline_Creatinine.IsReadOnly := True; primreqdate.control_read_only := True; primtime.control_read_only := 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 + 1 days; thirdreqdate.value := startdate + 2 days; fourthreqdate.value := startdate + 3 days; fifthreqdate.value := startdate + 4 days; Order_To.value := fifthreqdate.value; prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," || fourthreqdate.value || "," || fifthreqdate.value; elseif CallingEvent = "FormClose" then If ArixtraSel= True 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); endif; //If exist elseif (true not in Med_List.IsSelected) then this_communication.DisplayForm := "Yes"; this_communication.Message := "Please enter a Lovenox Order.\n\n" ; this_communication.MessageType := "Error"; endif; 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; 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: