maintenance: title: Titration Guidelines for IV Drips;; mlmname: FORM_Rx_Titration_values;; arden: version 2;; version: 15.10;; institution: St Clair Hospital;; author: Teresa Spicuzza;; specialist: ;; date: 2016-08-10;; validation: testing;; library: purpose: Change the status of fields based upon the infusion selected ;; explanation: This MLM is called from the PRX_lvDripTitrate form. Change History 08.18.2016 TMS Created. CSR 34238 ;; keywords: Called MLMs, Form fields, Titrate ;; 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; /***************************************************************************************/ comm_obj := this_communication.primaryobj; // Initialize error message error_message:=""; str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; // Assigns fields passed in the Form object to the Field object field_list:= this_form.fields; CallingEvent := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; OrderCatalogItemGUID := this_Communication.ItemID; include standard_libs; using "ObjectsPlusXA.SCM.Forms"; using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms"; CR := 13 formatted with "%c"; LF := 10 formatted with "%c"; CRLF:= CR||LF; OrderManagement := MLM {{{SINGLE-QUOTE}}}FORM_Rx_Medication_Retrieval{{{SINGLE-QUOTE}}}; UseSuggestedValues := last of (field_list where field_list.DataItemName = "PRX_IVTitrateValues" ); IVTitrate := last of (field_list where field_list.DataItemName = "PRX_IVTitrate" ); TitrateGoal := last of (field_list where field_list.DataItemName = "PRX_IVTitrationGoal" ); TitrateIncr := last of (field_list where field_list.DataItemName = "PRX_IVTitrationIncrement" ); MaxDose := last of (field_list where field_list.DataItemName = "PRX_IVMaxDose" ); MaxDoseUom := last of (field_list where field_list.DataItemName = "PRX_IVMaxDoseUOM" ); StartDose := last of (field_list where field_list.DataItemName = "PRX_IVStartDose" ); StartDoseUOM := last of (field_list where field_list.DataItemName = "PRX_IVStartDoseUOM" ); OrderIVRate := last of (field_list where field_list.DataItemName = "OrderIvRate" ); OrderIvRate_val := OrderIvRate.Value; OrderInfo := last of (field_list where field_list.DataItemName = "PRX_NoteComment0" ); frequency := last of (field_list where field_list.DataItemName = "FrequencyCode" ); freq_Val := frequency.Value; Guidelines := last of (field_list where field_list.DataItemName = "PRX_PermOrderInfo" ); If CallingEvent = "FormOpen" then If freq_val.frequencysummary = "Titrate" and IVTitrate.Value = False then IvTitrate.value := True; endif; (this_communication, this_form) := call OrderManagement with (this_communication, this_form, client_info_obj); endif; If (CallingEvent = "FormOpen") or (CallingEvent = "FormClose") or (CallingEvent = "FieldChange" and (callingfield = "FrequencyCode" or callingfield = "PRX_IVTitrate" or callingfield = "PRX_IVTitrateValues")) then Drug_Code:= Read Last {" SELECT CV3CatalogClassTypeValue.Value FROM CV3CatalogClassTypeValue INNER JOIN" || " CV3ClassType ON CV3CatalogClassTypeValue.ClassTypeGUID = CV3ClassType.GUID" || " WHERE CV3ClassType.Code = {{{SINGLE-QUOTE}}}PRX_Titration Guidelines{{{SINGLE-QUOTE}}} AND CV3CatalogClassTypeValue.CatalogMasterGUID = " || SQL(OrderCatalogItemGUID) }; endif; If Drug_Code is not null then GuidelineInfo:= Read Last {" SELECT Value FROM CV3UserDictionaryValue " || " WHERE UserDictionaryCode = {{{SINGLE-QUOTE}}}PRX_Titration Info{{{SINGLE-QUOTE}}} and value like {{{SINGLE-QUOTE}}}" || Drug_Code || "%{{{SINGLE-QUOTE}}}" }; TitrateInfo := call str_parse with GuidelineInfo,"|"; DrugNameInfo := TitrateInfo[1]; StartingDoseInfo := TitrateInfo[2]; StartTitrateInfo := TitrateInfo[3]; MaxDoseInfo := TitrateInfo[4]; UOMInfo := TitrateInfo[5]; IncrementInfo := TitrateInfo[6]; GoalInfo := TitrateInfo[7]; GuidelineMsg := "Starting Dose: " || StartingDoseInfo || " " || UOMInfo || CRLF || "Maximum Dose: " || MaxDoseInfo || " " || UOMInfo || CRLF || "Titration & Increment: " || IncrementInfo || CRLF || "Goals: " || GoalInfo ; If Callingfield = "FrequencyCode" and freq_val.frequencysummary = "Titrate" then IvTitrate.value := True; else IvTitrate.value := false; endif; If (CallingEvent = "Fieldchange" or CallingEvent = "FormOpen") then Guidelines.value := Guidelinemsg; If IvTitrate.value = True or freq_val.frequencysummary = "Titrate" then OrderIvRate_val.Amount := null ; OrderIvRate_val.UOM := null; OrderIvRate.control_mandatory := False; OrderIvRate.control_read_only := True; freq_Val.frequencysummary := "Titrate"; StartDose.control_read_only := False; StartDose.control_mandatory := True; StartDoseUOM.control_mandatory := True; StartDoseUOM.control_read_only := True; StartDoseUOM.value := UOMInfo; MaxDose.control_read_only := False; MaxDose.control_mandatory := True; MaxDoseUOM.control_read_only := True; MaxDoseUOM.control_mandatory := True; MaxDoseUOM.value := UOMInfo; TitrateIncr.control_read_only := False; TitrateIncr.control_mandatory := True; TitrateGoal.control_read_only := False; TitrateGoal.control_mandatory := True; elseif IvTitrate.value = false or freq_val.frequencysummary <> "Titrate" then IvTitrate.value := false; If callingevent = "fieldchange" then OrderIvRate_val.Amount := null ; OrderIvRate_val.UOM := UOMInfo; endif; OrderIvRate.control_read_only := False; OrderIvRate.control_mandatory := True; freq_Val.frequencysummary := Null; StartDose.value := " "; StartDose.control_mandatory := False; StartDose.control_read_only := True; StartDoseUOM.value := " "; StartDoseUOM.control_mandatory := False; MaxDose.value := " "; MaxDose.control_mandatory := False; MaxDose.control_read_only := True; MaxDoseUOM.value := " "; MaxDoseUOM.control_mandatory := False; TitrateIncr.value := " "; TitrateIncr.control_mandatory := False; TitrateIncr.control_read_only := True; TitrateGoal.value := " "; TitrateGoal.control_mandatory := False; TitrateGoal.control_read_only := True; freq_Val.frequencysummary := Null; endif; //IvTitrate.value = True or freq_val.frequencysummary = "Titrate" endif; //If (CallingEvent = "Fieldchange" or CallingEvent = "FormOpen") If (CallingEvent = "Fieldchange" and callingfield = "PRX_IVTitrateValues") or (CallingEvent = "FormOpen" and UseSuggestedValues = True) then If IvTitrate.value = True or freq_val.frequencysummary = "Titrate" then Guidelines.value := Guidelinemsg; MSG3 := ""; MSG4 := ""; If StartDose.value is not null then TempStartDose := StartDose.value; If MSG3 = "" and MSG4 = "" then MSG3 := " Starting Dose"; MSG4 := " Starting Dose: " || StartDose.value ||UOMInfo; else MSG3 := MSG4 ||", Starting Dose"; MSG3 := MSG4 || CRLF || " Starting Dose: " || StartDose.value ||UOMInfo; endif; else TempStartDose := StartTitrateInfo; Endif; If MaxDose.value is not null then TempMaxDose := MaxDose.value; If MSG3 = "" and MSG4 = "" then MSG3 := " Maximum Dose"; MSG4 := " Maximum Dose: " || MaxDose.value || UOMInfo; else MSG3 := MSG3 ||", Maximum Dose"; MSG4 := MSG4 ||CRLF || " Maximum Dose: " || MaxDose.value || UOMInfo; endif; else TempMaxDose := MaxDoseInfo; endif; If TitrateIncr.value is not null then TempIncrement := TitrateIncr.value; If MSG3 = "" and MSG4 = "" then MSG3 := " Titration & Increment"; MSG4 := " Titration & Increment: " || TitrateIncr.value; else MSG3 := MSG3 ||", Titration & Increment"; MSG4 := MSG4 || CRLF || " Titration & Increment: " || TitrateIncr.value; endif; else TempIncrement := IncrementInfo; Endif; If TitrateGoal.value is not null then TempTitrateGoal := TitrateGoal.value; If MSG3 = "" and MSG4 = "" then MSG3 := " Titration Goals"; MSG4 := " Titration Goals: " || TitrateGoal.value; else MSG3 := MSG3 ||", Titrate Goal"; MSG4 := MSG4 ||CRLF || " Titrate Goal: " || TitrateGoal.value; endif; else TempTitrateGoal := GoalInfo; Endif; OrderIvRate_val.Amount := null ; OrderIvRate_val.UOM := null; OrderIvRate.control_mandatory := False; OrderIvRate.control_read_only := True; freq_Val.frequencysummary := "Titrate"; IVTitrate.Value := True; If Msg3 <> "" then dialogResult2 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "You have already entered values for: "||CRLF || Msg3 ||" \n\n Choose YES to OVERWRITE all values with the recommended dosing. " ||" \n\n Choose NO to KEEP the entered values:" || CRLF || Msg4 ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult2 as string) = "Yes") then TitrateGoal.value := GoalInfo; TitrateIncr.value := IncrementInfo; MaxDose.value := MaxDoseInfo; MaxDoseUOM.value := UOMInfo; OrderIvRate_val.Amount := null ; OrderIvRate_val.UOM := null; OrderIvRate.control_mandatory := False; OrderIvRate.control_read_only := True; StartDose.value := StartTitrateInfo; StartDoseUOM.value := UOMInfo; IvTitrate.value := True; freq_val.frequencysummary := "Titrate" ; UsesuggestedValues.value := false; else TitrateGoal.value := TempTitrateGoal; TitrateIncr.value := TempIncrement; MaxDose.value := TempMaxDose; MaxDoseUOM.value := UOMInfo; OrderIvRate_val.Amount := null ; OrderIvRate_val.UOM := null; OrderIvRate.control_mandatory := False; OrderIvRate.control_read_only := True; StartDose.value := TempStartDose; StartDoseUOM.value := UOMInfo; IvTitrate.value := True; freq_val.frequencysummary := "Titrate" ; UsesuggestedValues.value := false; endif; else TitrateGoal.value := GoalInfo; TitrateIncr.value := IncrementInfo; MaxDose.value := MaxDoseInfo; MaxDoseUOM.value := UOMInfo; OrderIvRate_val.Amount := null ; OrderIvRate_val.UOM := null; OrderIvRate.control_mandatory := False; OrderIvRate.control_read_only := True; StartDose.value := StartTitrateInfo; StartDoseUOM.value := UOMInfo; IvTitrate.value := True; freq_val.frequencysummary := "Titrate" ; UsesuggestedValues.value := false; endif; else IvTitrate.value := True; TitrateGoal.value := GoalInfo; TitrateIncr.value := IncrementInfo; MaxDose.value := MaxDoseInfo; MaxDoseUOM.value := UOMInfo; OrderIvRate_val.Amount := null ; OrderIvRate_val.UOM := null; OrderIvRate.control_mandatory := False; OrderIvRate.control_read_only := True; StartDose.value := StartTitrateInfo; StartDoseUOM.value := UOMInfo; Guidelines.value := Guidelinemsg; freq_Val.frequencysummary := "Titrate"; StartDose.control_read_only := False; StartDose.control_mandatory := True; StartDoseUOM.control_mandatory := True; StartDoseUOM.control_read_only := True; StartDoseUOM.value := UOMInfo; MaxDose.control_read_only := False; MaxDose.control_mandatory := True; MaxDoseUOM.control_read_only := True; MaxDoseUOM.control_mandatory := True; MaxDoseUOM.value := UOMInfo; TitrateIncr.control_read_only := False; TitrateIncr.control_mandatory := True; TitrateGoal.control_read_only := False; TitrateGoal.control_mandatory := True; UsesuggestedValues.value := false; endif; endif; If CallingEvent = "FormClose" and (freq_val.frequencysummary = "Titrate" or IVTitrate.Value = True) then MSG1 := ""; MSG2 := ""; If StartDose.value is null then If MSG1 = "" and MSG2 = "" then MSG1 := " Starting Dose"; MSG2 := " Starting Dose: " || StartTitrateInfo ||UOMInfo; else MSG1 := MSG1 ||", Starting Dose"; MSG2 := MSG2 || CRLF || "Starting Dose: " || StartTitrateInfo ||UOMInfo; endif; Endif; If MaxDose.value is null then If MSG1 = "" and MSG2 = "" then MSG1 := " Maximum Dose"; MSG2 := " Maximum Dose: " || MaxDoseInfo || UOMInfo; else MSG1 := MSG1 ||", Maximum Dose"; MSG2 := MSG2 ||CRLF || " Maximum Dose: " || MaxDoseInfo || UOMInfo; endif; endif; If TitrateIncr.value is null then If MSG1 = "" and MSG2 = "" then MSG1 := " Titration & Increment"; MSG2 := " Titration & Increment: " || IncrementInfo; else MSG1 := MSG1 ||", Titration & Increment"; MSG2 := MSG2 || CRLF || " Titration & Increment: " || IncrementInfo; endif; Endif; If TitrateGoal.value is null then If MSG1 = "" and MSG2 = "" then MSG1 := " Titrate Goal"; MSG2 := " Titrate Goal: " || GoalInfo; else MSG1 := MSG1 ||", Titrate Goal"; MSG2 := MSG2 ||CRLF || " Titrate Goal: " || GoalInfo; endif; Endif; OrderIvRate_val.Amount := null ; OrderIvRate_val.UOM := null; OrderIvRate.control_mandatory := False; OrderIvRate.control_read_only := True; freq_Val.frequencysummary := "Titrate"; IVTitrate.Value := True; If Msg1 <> "" then dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "You have not entered values for: "|| CRLF ||Msg1 ||" \n\n Choose YES to use recommended dosing: " || CRLF || Msg2 ||" \n\n Choose NO to enter your own values. " ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult as string) = "Yes") then If TitrateGoal.value is null then TitrateGoal.value := GoalInfo; Endif; If TitrateIncr.value is null then TitrateIncr.value := IncrementInfo; Endif; If MaxDose.value is null then MaxDose.value := MaxDoseInfo; MaxDoseUOM.value := UOMInfo; endif; OrderIvRate_val.Amount := null ; OrderIvRate_val.UOM := null; OrderIvRate.control_mandatory := False; OrderIvRate.control_read_only := True; freq_Val.frequencysummary := "Titrate"; IVTitrate.Value := True; If StartDose.value is null then StartDose.value := StartTitrateInfo; StartDoseUOM.value := UOMInfo; endif; else TitrateGoal.control_mandatory := True; TitrateIncr.control_mandatory := True; MaxDose.control_mandatory := True; StartDose.control_mandatory := True; endif; endif; If TitrateGoal.value is not null and TitrateIncr.value is not null and MaxDose.value is not null and MaxDoseUOM.value is not null and StartDose.value is not null and StartDoseUOM.value is not null then Instructions := "Starting Dose: " || StartDose.value || " " || StartDoseUOM.value || CRLF ||"Maximum Dose: " || MaxDose.value || " " || MaxDoseUOM.value || CRLF ||"Titration & Increment: " || TitrateIncr.value || CRLF ||"Goals: " || TitrateGoal.value; OrderInfo.value := Instructions; endif; endif; //CallingEvent = "FormClose" and (freq_val.frequencysummary = "Titrate" or IVTitrate.Value = True 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: