maintenance: title: FORM_DISCHARGE_REPEAT_MI_ORDERS;; mlmname: FORM_DISCHARGE_REPEAT_MI_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 MI_Date_fld := last of (field_list WHERE field_list.DataItemName = "DISC_FU MI Date"); MI_Test_List := last of (field_list WHERE field_list.DataItemName = "DISC_Medical Image Tests"); MI_Followup := last of (field_list WHERE field_list.DataItemName = "DISC_Medical Image Folllow up"); Repeat_Lab_Submit := last of (field_list WHERE field_list.DataItemName = "CPOE Repeat Lab Submit Button"); Repeat_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 MI_Test_List.Value, ";"; if ( ( count labs_ordered ) > 0 ) then if ( count ( labs_ordered ) = 1 ) then labs_ordered := last of (labs_ordered); endif; if (MI_Date_fld.Value is null) then labwork_date := ""; else labwork_date := "Do test on: " || ( SUBSTRING 10 CHARACTERS FROM ( MI_Date_fld.Value AS STRING) ); endif; if (MI_Followup.Value is null) then followup_with := ""; else followup_with := "Follow up in " || MI_Followup.Value; endif; //repeat_mi_list := spaceme || labs_ordered || labwork_date // || linebreakme || spaceme || followup_with; repeat_mi_list := spaceme || "Test(s): " || labs_ordered || linebreakme || spaceme || labwork_date || linebreakme || spaceme || followup_with; if (Repeat_Instructions.Value is null) then Repeat_Instructions.Value := "Medical Imaging & Other Tests - " || linebreakme || spaceme || "Date: " || ( SUBSTRING 10 CHARACTERS FROM ( now as string ) ) || linebreakme || repeat_mi_list; else Repeat_Instructions.Value := Repeat_Instructions.Value || linebreakme || linebreakme || repeat_mi_list; endif; //Clear List MI_Date_fld.Value := null; MI_Followup.Value := ""; MI_Test_List.Value := ""; endif; if (CallingEvent = "FormClose") then local_session.SessionDischargeMIOrders := Repeat_Instructions.Value; endif; elseif (CallingEvent = "FormOpen") then if (local_session.SessionDischargeMIOrders <> "") then local_session.SessionDischargeMIOrders := ""; 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: