maintenance: title: Formats medications to be displayed in alert message;; mlmname: STD_FUNC_FORMAT_MEDICATION;; arden: version 2.5;; version: 18.4;; institution: Allscripts, Standard MLM;; author: Allscripts Healthcare Solutions, Inc.;; specialist: ;; date: 2018-10-26;; validation: testing;; /* P r o p r i e t a r y N o t i c e */ /* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved. P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium, disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users: This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}. All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates. */ /* P r o p r i e t a r y N o t i c e */ library: purpose: Formats medication text to return to calling MLM for use in alert messages. ;; explanation: This MLM returns "msg_text" to the calling MLM. The variable "msg_text" contains the order name, summary line, start date, stop date and status. Each order is separated by a line. Order items that were found to match, are printed in blue or if an additive, an additional line indicates that the additive is contained in the order above. Example: D5W KCL 30 mEq, 100ml hourly QD starting on March 1, 2001, to March 17, 2001. STATUS:Active KCL contained in IV order above. (this is printed in blue) This MLM relys on calling MLM to send - a list indicating if the item is an order or component - a list of each item{{{SINGLE-QUOTE}}}s GUIDs - a list of each item{{{SINGLE-QUOTE}}}s name - a list of each order item{{{SINGLE-QUOTE}}}s summary lines - a list of each order item{{{SINGLE-QUOTE}}}s request date - a list of each order item{{{SINGLE-QUOTE}}}s stop date - a list of each order item{{{SINGLE-QUOTE}}}s status code - a list of which items matched ;; keywords: ;; knowledge: type: data-driven;; data: (order_component_list, // List indicating if an order or component guid_list, // List of each item{{{SINGLE-QUOTE}}}s GUIDs order_name_list, // List of each item{{{SINGLE-QUOTE}}}s name summary_line_list, // List of each order item{{{SINGLE-QUOTE}}}s summary lines order_significant_date_list, // List of each order item{{{SINGLE-QUOTE}}}s request date order_stop_date_list, // List of each order item{{{SINGLE-QUOTE}}}s stop date order_status_desc_list, // List of each order item{{{SINGLE-QUOTE}}}s status code match_med_found ) // List of which items matched := ARGUMENT; ;; evoke: ;; logic: msg_text := ""; index_list := 1 seqto (count order_name_list); for i in index_list do // Process each item on the order item lists previous_guid := guid; order_or_component := last(first i from order_component_list); guid := last(first i from guid_list); order_name := last(first i from order_name_list); summary_line := last(first i from summary_line_list); order_start_date := last(first i from order_significant_date_list); order_stop_date := last(first i from order_stop_date_list); order_status_desc := last(first i from order_status_desc_list); matching_med := last(first i from match_med_found); // Formats each item name, summary line, startdate, and stopdate if i > 1 then msg_text := msg_text || "\n"; endif; if exist order_or_component then // Check to see if item in list is an order or a component if order_or_component = "order" then if exist order_name then msg_text := msg_text ||"______________________________________"|| "\n"; If matching_med then // Format differently for matches found on order name V.S. additive msg_text := msg_text || "{{+B}}{{+c}}"|| order_name ||"{{-c}}{{-B}}"; else msg_text := msg_text || "{{+B}}"|| order_name ||"{{-B}}" ; endif; // Format order message endif; // if exist order_name if exist summary_line then msg_text := msg_text || " " || summary_line; endif; if exist order_start_date then temp_start_date := order_start_date formatted with "%.2t"; msg_text := msg_text || "\n starting on "|| temp_start_date; endif; if exist order_stop_date then temp_stop_date := order_stop_date formatted with "%.2t"; msg_text := msg_text|| " to "|| temp_stop_date; endif; if exist order_status_desc then msg_text := msg_text|| "{{+B}}" || " Status: "|| order_status_desc || "{{-B}}"; endif; else if exist order_name then // Format additional line to indicate which additives matched msg_text := msg_text || "{{+c}}"|| order_name || " contained in IV order above. {{-C}}"; endif; endif; endif;// Check to see if item in list is order or component enddo; conclude TRUE; ;; action: return msg_text ; ;; end: