maintenance: title: Med With User Schedule;; mlmname: FORM_Rx_User_Sched_Priority;; arden: version 2;; version: 15.10;; institution: St Clair ;; author: Teresa Spicuzza;; specialist: Teresa Spicuzza;; date: 2016-01-07;; validation: testing;; library: purpose: Used with parkinson medication orders to take information mapped from order set and create a user schedule ;; explanation: This MLM uses information mapped from order set dictionaries to create a user schedule for medication orders. Change History 10/05/2016 TMS New MLM to create a User Schedule based upon selections from an order set ;; keywords: Called MLMs, Form fields, User Schedule ;; 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; PrimaryObjdetail:=this_communication.PrimaryObj; session_type := PrimaryObjdetail.internalprocessingtype; /***************************************************************************************/ // Initialize error message error_message:=""; // References the LOCAL SESSION object local_session := cds_session.local; standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; // Obtain fields passed in the Form object to the Field object field_list:= this_form.fields; requested_date := last of (field_list where field_list.DataItemName = "RequestedDate" ); requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" ); is_prn := last of (field_list where field_list.DataItemName = "IsPRN" ); regular_freq := last of (field_list where field_list.DataItemName = "FrequencyCode"); requested_time_value := requested_time.value; regular_freq_value := regular_freq.value; start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" ); stat_then := first of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then"); TotalDosing := first of ( field_list WHERE field_list.DataItemName = "PRX_Dosing Total Doses"); TotalDosing_value := TotalDosing.value; RX_Comments_field := last of (field_list where field_list.DataItemName = "Rx Comments"); RX_Instructions_field := last of (field_list where field_list.DataItemName = "Rx Instructions"); AltDaysDose1 := last of (field_list where field_list.DataItemName = "PRX_SchedDays1" and field_List.Control_MultiFieldOccNum = 1); AltDaysDose1_list := AltDaysDose1.value; AltTimesDose1 := last of (field_list where field_list.DataItemName = "PRX_SchedTimes" and field_List.Control_MultiFieldOccNum = 1); AltTimesDose1_list := AltTimesDose1.value; DailyFreq := last of (field_list where field_list.DataItemName = "PRX_Std_Schedule"); DailyFreq_value := DailyFreq.value; CallingEvent := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; RX_Comments_field_value := RX_Comments_field.value; str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; AutoMedScheduling := MLM {{{SINGLE-QUOTE}}}FORM_Antibiotic_Scheduling{{{SINGLE-QUOTE}}}; // build user schedule from days and times selected mapped to order form from order set If exists AltDaysDose1 and (AltDaysDose1_list <> "None") then If exists AltTimesDose1 and (AltTimesDose1_list <> "None") then If AltDaysDose1.value = "AllDays" then regular_freq_value.FrequencySummary := ""; regular_freq_value.FreqFromTime := 1; regular_freq_value.FreqToTime := 0; regular_freq_value.FreqUOM := "day"; else regular_freq_value.FrequencySummary := ""; regular_freq_value.FreqFromTime := 1; regular_freq_value.FreqToTime := 0; regular_freq_value.FreqUOM := "week"; Dayslist := call str_parse with ((AltDaysDose1_list),","); regular_freq_value.FreqWeeklyDays := dayslist; endif; Timeslist := call str_parse with ((AltTimesDose1_list),","); regular_freq_value.FreqTimes := timeslist; endif; endif; If exists AltDaysDose1 and AltDaysDose1_list = "None" then If exists Dailyfreq and Dailyfreq_value <> "None" then regular_freq_value.FrequencySummary := Dailyfreq_value; If Dailyfreq_value = "Now" then requested_time_value.ReqTimeValue := NULL; requested_time_value.ReqTimeCode := "Routine"; elseif Dailyfreq_value = "Stat" then requested_time_value.ReqTimeValue := NULL; requested_time_value.ReqTimeCode := "STAT"; else; requested_time_value.ReqTimeValue := NULL; requested_time_value.ReqTimeCode := "Routine"; endif; endif; endif; // if the frequency is {{{SINGLE-QUOTE}}}User Schedule{{{SINGLE-QUOTE}}} then PRN, stat/then, now/then is not available // since all frequencies for methotrexate are one time or user schedule no need to make stat/now then fields available If regular_freq_value.FrequencySummary = "" then is_prn.control_visible := FALSE; start_now.control_read_only := True; start_now.value := False; stat_then.value := False; stat_then.control_read_only := True; TotalDosing.value := NULL; TotalDosing.control_read_only := True; else is_prn.control_visible := TRUE; endif; // do not allow a stat priority if frequency is not stat If (regular_freq_value.FrequencySummary <> "STAT")and (requested_time_value.ReqTimeCode = "STAT") then requested_time_value.ReqTimeValue := NULL; requested_time_value.ReqTimeCode := NULL; 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: