maintenance: title: FORM_DISCHARGE_REPEAT_LAB_ORDERS;; mlmname: FORM_DISCHARGE_REPEAT_LAB_ORDERS;; arden: version 2.5;; version: 5.50;; institution: St Clair Charger MLM;; author: Juliet Johns, Allscripts, Inc;; specialist: Dean Miklavic, Allscripts, Inc;; date: 2013-08-19;; validation: testing;; library: purpose: ;; explanation: ;; keywords: Called MLMs, Form fields, Discharge Orders, Repeat Lab ;; 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; // RS ADD Message box standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; //String Parsing Lib str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; //Local session object local_session := cds_session.local; /*******************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; CallingField :=this_communication.CallingFieldName; CallingEvent := this_communication.CallingEvent; FormType := this_communication.FormType; //Retrieve fields Lab_Date_fld := last of (field_list WHERE field_list.DataItemName = "DISC_FU Labwork Date"); Lab_Test_List := last of (field_list WHERE field_list.DataItemName = "DISC_Lab Tests"); Labwork_Schd := last of (field_list WHERE field_list.DataItemName = "DISC_Lab Schedule"); Lab_Followup := last of (field_list WHERE field_list.DataItemName = "Obj_Plus_MD FollowUp2"); Repeat_Lab_Submit := last of (field_list WHERE field_list.DataItemName = "CPOE Repeat Lab Submit Button"); Addl_Instructions := last of (field_list WHERE field_list.DataItemName = "NUR_NurInstructionFreeText"); linebreakme:= read last {" SELECT " || " {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} +char(13) + char(10) " }; tabme := read last {" SELECT " || " char(9) " }; spaceme := " "; If ((CallingEvent = "ButtonClick") AND (CallingField = "CPOE Repeat Lab Submit Button") OR (CallingEvent = "FormClose")) then labs_ordered := call str_parse with Lab_Test_List.Value, ";"; if ( ( count labs_ordered ) > 0 ) then if ( count ( labs_ordered ) = 1 ) then labs_ordered := last of (labs_ordered); endif; if (Lab_Date_fld.Value is null) then labwork_date := ""; else labwork_date := "Next date of labwork: " || ( SUBSTRING 10 CHARACTERS FROM (Lab_Date_fld.Value AS String) ); endif; if (Lab_Followup.Value is null) then followup_with := ""; else followup_with := "Follow up with " || Lab_Followup.Value; endif; if (Labwork_Schd.Value is null) then lab_schd := ""; else lab_schd := "Labwork schedule: " || Labwork_Schd.Value; endif; repeat_labs_list := spaceme || labwork_date || linebreakme || spaceme || labs_ordered || linebreakme || spaceme || lab_schd || linebreakme || spaceme || followup_with || linebreakme; if (Addl_Instructions.Value is null) then Addl_Instructions.Value := linebreakme || repeat_labs_list; else Addl_Instructions.Value := Addl_Instructions.Value || linebreakme || linebreakme || repeat_labs_list; endif; //Clear List Lab_Date_fld.Value := null; Labwork_Schd.Value := ""; Lab_Followup.Value := ""; Lab_Test_List.Value := ""; endif; if (CallingEvent = "FormClose") then local_session.SessionDischargeLabOrders := Addl_Instructions.Value; endif; elseif (CallingEvent = "FormOpen") then if (local_session.SessionDischargeLabOrders <> "") then local_session.SessionDischargeLabOrders := ""; 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: