maintenance: title: Generic Medication Weight Calculation;; mlmname: Form_Medication_calc;; arden: version 2;; version: 16.3;; institution: St. Clair Hospital;; author: Teresa M. Spicuzza ;; specialist: Eclipsys Corporation;; date: 2018-01-04;; validation: testing;; library: purpose: Calculate Medications based upon the order name and multiplier entered by user. ;; explanation: Change history 04.09.2018 TMS CSR 35320 - Created for PACU Pedatric Medication Dose Calculation ;; keywords: Medication, Calculation; ;; knowledge: type: data-driven;; data: /********************Make Changes To Spelling And Flags In This Section*********************/ /*************************************************************************************************/ // 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; CallingEvent := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; comm_obj := this_communication.primaryobj; OrderName := comm_obj.Name; OrderSetName := comm_obj.OrderSetName; // Assigns fields passed in the Form object to the Field object field_list:= this_form.fields; standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; using "ObjectsPlusXA.SCM.Forms"; using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms"; // Get patient weight comb_ht_wt_field := first of (field_list where field_list.DataItemName = "CombinedMeasurements"); If exists comb_ht_wt_field then comb_ht_wt_val := comb_ht_wt_field.value; wt := comb_ht_wt_val.weight; weightvalue := (wt as number); endif; OrderedDose := first of (field_list where field_list.DataItemName = "DosageLow"); OrderedUnits := first of (field_list where field_list.DataItemName = "UOM"); Instructions := first of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0"); DosePerKg := first of (field_list where field_list.DataItemName = "PRX_DosePerKg"); If exists OrderedDose then OrderedDoseValue := OrderedDose.Value; endif; If exists OrderedUnits then OrderedUnitsValue := OrderedUnits.Value; endif; If exists DosePerKg then DosePerKgValue := DosePerKg.Value; endif; If DosePerKg is not null or callingevent = "FieldChange" then If OrderName = "OxyCODONE Solution" then If ((DosePerKgValue as number) >= 0.05 and (DosePerKgValue as number) <= 0.15) then Dose := DosePerKgValue * WeightValue; DoseFactor := ((Dose as number) - 0.25) * 10; rnd_dose := (int((doseFactor + 2.5)/5) * 5) /10; if rnd_dose > 5 then OrderedDose.value := 5; else Ordereddose.value := rnd_dose; endif; else dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Recommended dose is 0.05 mg/kg to 0.15 mg/kg.\n Maximum Dose of 5 mg/Dose\n\n Do you wish to change your entry?","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult as string) = "Yes") then DosePerKg.Value := ""; else Dose := DosePerKgValue * WeightValue; DoseFactor := ((Dose as number) - 0.25) * 10; rnd_dose := (int((doseFactor + 2.5)/5) * 5) /10; if rnd_dose > 5 then OrderedDose.value := 5; else Ordereddose.value := rnd_dose; endif; endif; endif; elseif OrderName = "OxyCODONE 5mg Tab" then If ((DosePerKgValue as number) >= 0.05 and (DosePerKgValue as number) <= 0.15) then Dose := DosePerKgValue * WeightValue; If (Dose as number) >= 1.25 and (Dose as number) < 2.5 then OrderedDose.value := 1.25; ElseIf (Dose as number) >= 2.5 and (Dose as number) < 5 then OrderedDose.value := 2.5; Else OrderedDose.value := 5; endif; else dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Recommended dose is 0.05 mg/kg to 0.15 mg/kg.\n Maximum Dose of 5 mg/Dose\n\n Do you wish to change your entry?","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult as string) = "Yes") then DosePerKg.Value := ""; else Dose := DosePerKgValue * WeightValue; If (Dose as number) >= 1.25 and (Dose as number) < 2.5 then OrderedDose.value := 1.25; ElseIf (Dose as number) >= 2.5 and (Dose as number) < 5 then OrderedDose.value := 2.5; Else OrderedDose.value := 5; endif; endif; endif; endif; endif; ;; evoke: ;; logic: Conclude true; ;; action: // This MLM returns two parameters, of types //communication_type and form_type respectively. return this_communication, this_form; ;; Urgency: 50;; end: