maintenance: title: Pericarditis Pain Taper Orders;; mlmname: FORM_Set_Pericarditis_Pain;; arden: version 2.5;; version: 15.10;; institution: St Clair Hospital;; author: Teresa Spicuzza, Allscripts Corp ext 7448;; specialist: Teresa Spicuzza, Allscripts Corp ext 7448;; date: 2016-01-21;; validation: testing;; library: purpose: Used for medication grids on Tapering Ibuprofen on Pericarditis Pain ;; explanation: This MLM is called from the Tapering Ibuprofen on Pericarditis Pain Change history 03.08.2016 TMS Created for new Pericarditis Pain Order set. MLM looks at current time and selects correct order in the grid for start time. CSR #32396 ;; keywords: Called MLMs, Pericarditis, Pain, Ibuprofen, Tapering ;; 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"; //local_session := cds_session.local; /***************************************************************************************/ // Initialize error message error_message:=""; // Assigns fields passed in the Form object to the Field object field_list:= this_form.fields; CallingEvent := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; Med_Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 49); Med_Orders_List := Med_Orders.Value; ReqDate1 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1); ReqDate2 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2); ReqDate3 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3); ReqDate4 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 4); RequestTime1 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 1); RequestTime2 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 2); RequestTime3 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 3); RequestTime4 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 4); RxInstruct1 := last of (field_list where field_list.DataItemName = "Rx Comments" and field_List.Control_MultiFieldOccNum = 1); RxInstruct2 := last of (field_list where field_list.DataItemName = "Rx Comments" and field_List.Control_MultiFieldOccNum = 2); RxInstruct3 := last of (field_list where field_list.DataItemName = "Rx Comments" and field_List.Control_MultiFieldOccNum = 3); RxInstruct4 := last of (field_list where field_list.DataItemName = "Rx Comments" and field_List.Control_MultiFieldOccNum = 4); ReqTime1 := RequestTime1.value; ReqTime2 := RequestTime2.value; ReqTime3 := RequestTime3.value; ReqTime4 := RequestTime4.value; Med_Selected := true in Med_Orders_List; ThisHour := extract hour now; ThisMin := extract minute now; if ThisMin < 10 then ThisMin := "0"||ThisMin; endif; ThisTime := (ThisHour||ThisMin) as number; 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; // baseday:= yr || "-" || mn || "-" || dd || "T00:00:00"; baseday:= yr || "-" || mn || "-" || dd ; today := (baseday as time); tomorrow := (baseday as time) +1 day; // On form open check current hour and select appropriate start time If CallingEvent = "FormOpen" or (CallingEvent = "FormClose" and true not in Med_Orders_list.isSelected) then If ThisTime >= 0 and ThisTime <= 900 then Med_Orders_List.IsSelected := (True, True, True, True); Med_Orders_List.IsReadOnly := (True, True, True, True); ReqDate1.value := today; ReqTime1.ReqTimeCode := "Scheduled/Start Time"; ReqTime1.ReqTimeValue := "09:00"; FullDate1 := (ReqDate1.value as time); yr1 := extract year FullDate1; mn1 := extract month FullDate1; dd1 := extract day FullDate1; InstructDay1 := mn1 || "-" || dd1 || "-" || yr1; RxInstruct1.value := "Take 3 times a day for 3 days beginning on " || InstructDay1 || " at 9:00AM "; ReqDate2.value := today + 3 days; ReqTime2.ReqTimeCode := "Scheduled/Start Time"; ReqTime2.ReqTimeValue := "09:00"; FullDate2 := (ReqDate2.value as time); yr2 := extract year FullDate2; mn2 := extract month FullDate2; dd2 := extract day FullDate2; InstructDay2 := mn2 || "-" || dd2 || "-" || yr2; RxInstruct2.value := "Take 3 times a day for 3 days beginning on " || InstructDay2 || " at 9:00AM "; ReqDate3.value := today + 6 days; ReqTime3.ReqTimeCode := "Scheduled/Start Time"; ReqTime3.ReqTimeValue := "09:00"; FullDate3 := (ReqDate3.value as time); yr3 := extract year FullDate3; mn3 := extract month FullDate3; dd3 := extract day FullDate3; InstructDay3 := mn3 || "-" || dd3 || "-" || yr3; RxInstruct3.value := "Take 2 times a day for 3 days beginning on " || InstructDay3 || " at 9:00AM "; ReqDate4.value := today + 9 days; ReqTime4.ReqTimeCode := "Scheduled/Start Time"; ReqTime4.ReqTimeValue := "09:00"; FullDate4 := (ReqDate4.value as time); yr4 := extract year FullDate4; mn4 := extract month FullDate4; dd4 := extract day FullDate4; InstructDay4 := mn4 || "-" || dd4 || "-" || yr4; RxInstruct4.value := "Take once a day for 3 days beginning on " || InstructDay4 || " at 9:00AM "; elseIf ThisTime > 900 and ThisTime <= 1400 then Med_Orders_List.IsSelected := (True, True, True, True); Med_Orders_List.IsReadOnly := (True, True, True, True); ReqDate1.value := today; ReqTime1.ReqTimeCode := "Scheduled/Start Time"; ReqTime1.ReqTimeValue := "14:00"; FullDate1 := (ReqDate1.value as time); yr1 := extract year FullDate1; mn1 := extract month FullDate1; dd1 := extract day FullDate1; InstructDay1 := mn1 || "-" || dd1 || "-" || yr1; RxInstruct1.value := "Take 3 times a day for 3 days beginning on " || InstructDay1|| " at 2:00PM "; ReqDate2.value := today + 3 days; ReqTime2.ReqTimeCode := "Scheduled/Start Time"; ReqTime2.ReqTimeValue := "14:00"; FullDate2 := (ReqDate2.value as time); yr2 := extract year FullDate2; mn2 := extract month FullDate2; dd2 := extract day FullDate2; InstructDay2 := mn2 || "-" || dd2 || "-" || yr2; RxInstruct2.value := "Take 3 times a day for 3 days beginning on " || InstructDay2 || " at 2:00PM "; ReqDate3.value := today + 6 days; ReqTime3.ReqTimeCode := "Scheduled/Start Time"; ReqTime3.ReqTimeValue := "21:00"; FullDate3 := (ReqDate3.value as time); yr3 := extract year FullDate3; mn3 := extract month FullDate3; dd3 := extract day FullDate3; InstructDay3 := mn3 || "-" || dd3 || "-" || yr3; RxInstruct3.value := "Take 2 times a day for 3 days beginning on " || InstructDay3 || " at 9:00PM "; ReqDate4.value := today + 10 days; ReqTime4.ReqTimeCode := "Scheduled/Start Time"; ReqTime4.ReqTimeValue := "09:00"; FullDate4 := (ReqDate4.value as time); yr4 := extract year FullDate4; mn4 := extract month FullDate4; dd4 := extract day FullDate4; InstructDay4 := mn4 || "-" || dd4 || "-" || yr4; RxInstruct4.value := "Take once a day for 3 days beginning on " || InstructDay4 || " at 9:00AM "; elseIf ThisTime > 1400 and ThisTime <= 2100 then Med_Orders_List.IsSelected := (True, True, True, True); Med_Orders_List.IsReadOnly := (True, True, True, True); ReqDate1.value := today; ReqTime1.ReqTimeCode := "Scheduled/Start Time"; ReqTime1.ReqTimeValue := "21:00"; FullDate1 := (ReqDate1.value as time); yr1 := extract year FullDate1; mn1 := extract month FullDate1; dd1 := extract day FullDate1; InstructDay1 := mn1 || "-" || dd1 || "-" || yr1; RxInstruct1.value := "Take 3 times a day for 3 days beginning on " || InstructDay1 || " at 9:00PM "; ReqDate2.value := today + 3 days; ReqTime2.ReqTimeCode := "Scheduled/Start Time"; ReqTime2.ReqTimeValue := "21:00"; FullDate2 := (ReqDate2.value as time); yr2 := extract year FullDate2; mn2 := extract month FullDate2; dd2 := extract day FullDate2; InstructDay2 := mn2 || "-" || dd2 || "-" || yr2; RxInstruct2.value := "Take 3 times a day for 3 days beginning on " || InstructDay2 || " at 9:00PM "; ReqDate3.value := today + 7 days; ReqTime3.ReqTimeCode := "Scheduled/Start Time"; ReqTime3.ReqTimeValue := "09:00"; FullDate3 := (ReqDate3.value as time); yr3 := extract year FullDate3; mn3 := extract month FullDate3; dd3 := extract day FullDate3; InstructDay3 := mn3 || "-" || dd3 || "-" || yr3; RxInstruct3.value := "Take 2 times a day for 3 days beginning on " || InstructDay3 || " at 9:00AM "; ReqDate4.value := today + 10 days; ReqTime4.ReqTimeCode := "Scheduled/Start Time"; ReqTime4.ReqTimeValue := "09:00"; FullDate4 := (ReqDate4.value as time); yr4 := extract year FullDate4; mn4 := extract month FullDate4; dd4 := extract day FullDate4; InstructDay4 := mn4 || "-" || dd4 || "-" || yr4; RxInstruct4.value := "Take once a day for 3 days beginning on " || InstructDay4 || " at 9:00AM "; elseIf ThisTime > 2100 and ThisTime <= 2400 then Med_Orders_List.IsSelected := (True, True, True, True); Med_Orders_List.IsReadOnly := (True, True, True, True); ReqDate1.value := today + 1 days; ReqTime1.ReqTimeCode := "Scheduled/Start Time"; ReqTime1.ReqTimeValue := "09:00"; FullDate1 := (ReqDate1.value as time); yr1 := extract year FullDate1; mn1 := extract month FullDate1; dd1 := extract day FullDate1; InstructDay1 := mn1 || "-" || dd1 || "-" || yr1; RxInstruct1.value := "Take 3 times a day for 3 days beginning on " || InstructDay1 || " at 9:00AM "; FullDate2 := (ReqDate2.value as time); yr2 := extract year FullDate2; mn2 := extract month FullDate2; dd2 := extract day FullDate2; InstructDay2 := mn2 || "-" || dd2 || "-" || yr2; ReqDate2.value := today + 4 days; ReqTime2.ReqTimeCode := "Scheduled/Start Time"; ReqTime2.ReqTimeValue := "09:00"; RxInstruct2.value := "Take 3 times a day for 3 days beginning on " || InstructDay2 || " at 9:00AM "; ReqDate3.value := today + 7 days; ReqTime3.ReqTimeCode := "Scheduled/Start Time"; ReqTime3.ReqTimeValue := "09:00"; FullDate3 := (ReqDate3.value as time); yr3 := extract year FullDate3; mn3 := extract month FullDate3; dd3 := extract day FullDate3; InstructDay3 := mn3 || "-" || dd3 || "-" || yr3; RxInstruct3.value := "Take 3 times a day for 3 days beginning on " || InstructDay3 || " at 9:00AM "; ReqDate4.value := today + 10 days; ReqTime4.ReqTimeCode := "Scheduled/Start Time"; ReqTime4.ReqTimeValue := "09:00"; FullDate4 := (ReqDate4.value as time); yr4 := extract year FullDate4; mn4 := extract month FullDate4; dd4 := extract day FullDate4; InstructDay4 := mn4 || "-" || dd4 || "-" || yr4; RxInstruct4.value := "Take once a day for 3 days beginning on " || InstructDay4 || " at 9:00AM "; Endif; Endif; If CallingEvent = "FieldChange" and true not in Med_Orders_list.isSelected then Med_Orders_List.IsReadOnly := (False, False, False, False); else protectvaluelist := (); for r in 1 seqto (count Med_Orders_List) do If Med_Orders_List.IsSelected [r] = true then protectvalue := "false"; else protectvalue := "true"; endif; protectvaluelist := protectvaluelist , protectvalue; enddo; Med_Orders_List.IsReadOnly := protectvaluelist; 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: