maintenance: title: FORM_SET_ACETADOTE_ACETYLCYSTEINE;; mlmname: FORM_SET_ACETADOTE_ACETYLCYSTEINE;; arden: version 2.5;; version: 5.50;; institution: St Clair Hospital;; author: Juliet M. Law, Allscripts ;; specialist: Bryan Berkeybile, Allscripts;; date: 2013-01-21;; validation: testing;; library: purpose: ;; explanation: This MLM is called from ... Change history 2013.01.21 JML CSR 30931: Created ;; keywords: Called MLMs ;; knowledge: type: data-driven;; data: standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; using "ObjectsPlusXA.SCM.Forms"; using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms"; // 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; /***************************************************************************************/ // 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; ClientGuid := this_communication.ClientGUID; ChartGuid := this_communication.ChartGUID; FormName := this_form.Name; PrimaryObjDetail := this_communication.PrimaryObj; OrderSetName := PrimaryObjDetail.OrderSetName; //Retrieve Fields Dosage_One := first of (field_list WHERE field_list.DataItemName = "DosageLow" and field_list.Control_MultiFieldOccNum = 1); Dosage_Two := first of (field_list WHERE field_list.DataItemName = "DosageLow" and field_list.Control_MultiFieldOccNum = 2); Dosage_Three := first of (field_list WHERE field_list.DataItemName = "DosageLow" and field_list.Control_MultiFieldOccNum = 3); Acetyl_Date_One := first of (field_list WHERE field_list.DataItemName = "RequestedDate" and field_list.Control_MultiFieldOccNum = 1); Acetyl_Time_One := first of (field_list WHERE field_list.DataItemName = "RequestedTime" and field_list.Control_MultiFieldOccNum = 1); Acetyl_Time_Value := Acetyl_Time_One.Value; Acetyl_Date_Two := first of (field_list WHERE field_list.DataItemName = "RequestedDate" and field_list.Control_MultiFieldOccNum = 2); Acetyl_Time_Two := first of (field_list WHERE field_list.DataItemName = "RequestedTime" and field_list.Control_MultiFieldOccNum = 2); Acetyl_Time2_Value := Acetyl_Time_Two.Value; Acetyl_Date_Three := first of (field_list WHERE field_list.DataItemName = "RequestedDate" and field_list.Control_MultiFieldOccNum = 3); Acetyl_Time_Three := first of (field_list WHERE field_list.DataItemName = "RequestedTime" and field_list.Control_MultiFieldOccNum = 3); Acetyl_Time3_Value := Acetyl_Time_Three.Value; OrderInfo := first of (field_list WHERE field_list.DataItemName = "PRX_Info" and field_list.Control_MultiFieldOccNum = 1); CombinedMeasurements := first of (field_list WHERE field_list.DataItemName = "CombinedMeasurements"); if (CallingEvent = "FormOpen") then if (exists OrderInfo) then OrderInfo.Control_Read_Only := true; endif; if (exists CombinedMeasurements) then CombinedMeasurements_fld := CombinedMeasurements.Value; patient_weight := CombinedMeasurements_fld.Weight; if (patient_weight > 0) then doseOneVal := (150 * patient_weight); rndDoseOneVal := int( ( doseOneVal + 50 ) / 100 ) * 100; Dosage_One.Value := rndDoseOneVal; doseTwoVal := (50 * patient_weight); rndDoseTwoVal := int( ( doseTwoVal + 50 ) / 100 ) * 100; Dosage_Two.Value := rndDoseTwoVal; doseThreeVal := (100 * patient_weight); rndDoseThreeVal := int( ( doseThreeVal + 50 ) / 100 ) * 100; Dosage_Three.Value := rndDoseThreeVal; else msg := "Please enter a calculation weight for this patient"; this_communication.MessageType := "Error"; this_communication.Message := msg; this_communication.DisplayMessage := true; endif; if ( NOT ( OrderSetName matches pattern "%Extended Therapy%" ) ) then currentDateTime := now; //currentDateTime := "2013-08-27 23:10:00" as time; currMinute := ( extract minute currentDateTime ) as number; currHour := ( extract hour currentDateTime ) as number; Acetyl_Time_Value.ReqTimeCode := "Scheduled/Start Time"; Acetyl_Time2_Value.ReqTimeCode := "Scheduled/Start Time"; Acetyl_Time3_Value.ReqTimeCode := "Scheduled/Start Time"; if (currMinute >= 1 AND currMinute < 30) then b := "30"; else currHour := currHour + 1; b := "00"; endif; if (( currHour ) >= 24 ) then Acetyl_Date_One.Value := "T+1"; Acetyl_Date_Two.Value := "T+1"; Acetyl_Date_Three.Value := "T+1"; elseif (( currHour + 1 ) >= 24 ) then Acetyl_Date_One.Value := currentDateTime; //Need to increment Date2 to T + 1 Acetyl_Date_Two.Value := "T+1"; Acetyl_Date_Three.value := "T+1"; elseif (( currHour + 5) >= 24 ) then Acetyl_Date_One.Value := currentDateTime; Acetyl_Date_Two.Value := currentDateTime; Acetyl_Date_Three.Value := "T+1"; else Acetyl_Date_One.Value := currentDateTime; Acetyl_Date_Two.Value := currentDateTime; Acetyl_Date_Three.Value := currentDateTime; endif; a := currHour; if ( (length (a as string)) = 1) then a := "0" || a; elseif (a = 24) then a := "00"; endif; a2 := currHour + 1; if (a2 = 24) then a2 := "00"; elseif (a2 > 24) then a2 := (a2 - 24); endif; if ( (length (a2 as string)) = 1) then a2 := "0" || a2; endif; a3 := currHour + 5; if (a3 = 24) then a3 := "00"; elseif (a3 > 24) then a3 := (a3 - 24); endif; if ( (length (a3 as string)) = 1) then a3 := "0" || a3; endif; Acetyl_Time_Value.ReqTimeValue := a || ":" || b; Acetyl_Time2_Value.ReqTimeValue := a2 || ":" || b; Acetyl_Time3_Value.ReqTimeValue := a3 || ":" || b; endif; endif; elseif (CallingEvent = "FieldChange") then if (CallingField = "CombinedMeasurements|1") then CombinedMeasurements_fld2 := CombinedMeasurements.Value; new_patient_weight := CombinedMeasurements_fld2.Weight; doseOneVal := (150 * new_patient_weight); rndDoseOneVal := int( ( doseOneVal + 50 ) / 100 ) * 100; Dosage_One.Value := rndDoseOneVal; doseTwoVal := (50 * new_patient_weight); rndDoseTwoVal := int( ( doseTwoVal + 50 ) / 100 ) * 100; Dosage_Two.Value := rndDoseTwoVal; doseThreeVal := (100 * new_patient_weight); rndDoseThreeVal := int( ( doseThreeVal + 50 ) / 100 ) * 100; Dosage_Three.Value := rndDoseThreeVal; elseif ( ( CallingField = "RequestedDate|1" OR CallingField = "RequestedTime|1" ) AND ( NOT ( OrderSetName matches pattern "%Extended Therapy%" ) ) ) then NewDateVal := Acetyl_Date_One.Value; NewTimeVal := Acetyl_Time_Value.ReqTimeValue as Time; newTimeHour := ( extract hour NewTimeVal ) as number; newTimeMin := ( extract minute NewTimeVal ) as number; Acetyl_Time_Value.ReqTimeCode := "Scheduled/Start Time"; Acetyl_Time2_Value.ReqTimeCode := "Scheduled/Start Time"; Acetyl_Time3_Value.ReqTimeCode := "Scheduled/Start Time"; if (newTimeMin >= 1 AND newTimeMin < 30) then newB := "30"; else newTimeHour := newTimeHour + 1; newB := "00"; endif; if (newTimeHour >= 24) then Acetyl_Date_One.Value := NewDateVal + 1 day; Acetyl_Date_Two.Value := NewDateVal + 1 day; Acetyl_Date_Three.Value := NewDateVal + 1 day; elseif (( newTimeHour + 1 ) >= 24 ) then Acetyl_Date_One.Value := NewDateVal; Acetyl_Date_Two.Value := NewDateVal + 1 day; Acetyl_Date_Three.Value := NewDateVal + 1 day; elseif (( newTimeHour + 5 ) >= 24 ) then Acetyl_Date_One.Value := NewDateVal; Acetyl_Date_Two.Value := NewDateVal; Acetyl_Date_Three.Value := NewDateVal + 1 day; else Acetyl_Date_One.Value := NewDateVal; Acetyl_Date_Two.Value := NewDateVal; Acetyl_Date_Three.Value := NewDateVal; endif; newA := newTimeHour; if (( length ( newA as string ) ) = 1 ) then newA := "0" || newA; elseif ( newA = 24 ) then newA := "00"; endif; newA2 := newTimeHour + 1; if ( newA2 = 24 ) then newA2 := "00"; elseif ( newA2 > 24 ) then newA2 := ( newA2 - 25 ); endif; if (( length( newA2 as string ) ) = 1 ) then newA2 := "0" || newA2; endif; newA3 := newTimeHour + 5; if ( newA3 = 24 ) then newA3 := "00"; elseif ( newA3 > 24 ) then newA3 := ( newA3 - 24 ); endif; if (( length ( newA3 as string ) ) = 1 ) then newA3 := "0" || newA3; endif; Acetyl_Time_Value.ReqTimeValue := newA || ":" || newB; Acetyl_Time2_Value.ReqTimeValue := newA2 || ":" || newB; Acetyl_Time3_Value.ReqTimeValue := newA3 || ":" || newB; endif; 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: