maintenance: title: Alert Messages for Duplicate Task Checking MLM;; mlmname: STD_FUNC_TASK_MESSAGES;; 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: Selects the appropriate alert message for the Duplicate-Task Checking MLM. ;; explanation: This MLM encapsulates the messages, so that all changes to the messages can be done in one MLM. ;; keywords: Duplicate Task; Alert; Message; ;; knowledge: type: data-driven;; data: (task_name, task_status_code, is_primary_task, order_type_code, exact_msg, performed_msg, scheduled_msg, same_item_type, same_therapeutic_class_type, similar_task_type, conflict_type, possible_conflict_type, no_std_message_type, matching_task_name_list, matching_significant_date_list, matching_msg_type_list, matching_msg_text_list, matching_time_msg_list, matching_class_list, matching_latest_scheduled_dtm_list, matching_order_name_list, matching_order_type_code_list, matching_performed_to_dtm_list, matching_process_type_list, matching_schedule_type_code_list, matching_task_status_list ):= ARGUMENT; ;; evoke: ;; logic: /* Intialize variables */ indent_string:= " "; /*---------------------------------*/ /* Picks the correct alert message */ /*---------------------------------*/ long_alert_msg:= ""; processing_list:= 1 seqto (count matching_task_name_list); for k in processing_list do /* Gets duplicate task information */ dup_task_found:= processing_list = k; dup_task_name:= first (matching_task_name_list where dup_task_found); dup_task_significant_date:= first (matching_significant_date_list where dup_task_found); dup_task_msg_type:= first (matching_msg_type_list where dup_task_found); dup_task_msg_text:= first (matching_msg_text_list where dup_task_found); dup_task_time_msg:= first (matching_time_msg_list where dup_task_found); dup_task_class_msg:= first (matching_class_list where dup_task_found); dup_task_latest_scheduled_dtm:= first (matching_latest_scheduled_dtm_list where dup_task_found); dup_order_name:= first (matching_order_name_list where dup_task_found); dup_order_type_code:= first (matching_order_type_code_list where dup_task_found); dup_task_performed_to_dtm:= first (matching_performed_to_dtm_list where dup_task_found); dup_task_process_type:= first (matching_process_type_list where dup_task_found); dup_task_schedule_type_code:= first (matching_schedule_type_code_list where dup_task_found); dup_task_status_code:= first (matching_task_status_list where dup_task_found); /*--------------------------------------*/ /* Sets Variables for the Alert Message */ /*--------------------------------------*/ /* Set Code 10 */ if dup_task_status_code = "performed" then db10_task_schedule_type := "Already performed"; else if dup_task_schedule_type_code = "scheduled" then db10_task_schedule_type := "Scheduled"; elseif dup_task_schedule_type_code = "unscheduled" then db10_task_schedule_type := "Unscheduled"; elseif dup_task_schedule_type_code = "PRN" then db10_task_schedule_type := "Pending PRN"; elseif dup_task_schedule_type_code = "continuous" then db10_task_schedule_type := "Pending continuous"; elseif dup_task_schedule_type_code = "ToSchedule" and dup_task_process_type = 4 then db10_task_schedule_type := "To be scheduled starting when first done"; else db10_task_schedule_type := dup_task_schedule_type_code; endif; /* if dup_task_schedule_type_code */ endif; /* if dup_task_status_code */ /* Set Code 11 */ if dup_task_status_code = "performed" then if exist dup_task_performed_to_dtm then db11_date_label := "Date from: "; else db11_date_label := "Date: "; endif; /* if exist dup_task_performed_to_dtm */ elseif dup_task_status_code <> "performed" then if dup_task_schedule_type_code = "scheduled" then db11_date_label := "Date: "; else db11_date_label := "Earliest Date: "; endif; /* if dup_task_schedule_type_code */ endif; /* if dup_task_status_code */ /* Set Codes 13 and 14 */ if dup_task_status_code = "performed" and exist dup_task_performed_to_dtm then db13_to_label := " to: "; db14_end_date := dup_task_performed_to_dtm formatted with "%.4t"; elseif dup_task_status_code <> "performed" and exist dup_task_latest_scheduled_dtm then db13_to_label := " to latest date: "; db14_end_date := dup_task_latest_scheduled_dtm formatted with "%.4t"; else db13_to_label := ""; db14_end_date := ""; endif; /* if dup_task_status_code */ /* Set task string */ if is_primary_task then task_string := "task"; else task_string := "follow-up task"; endif; /* Set Code A */ if (is_primary_task AND order_type_code = "Medication") then a_type_of_order := "medication administration"; else a_type_of_order := task_string; endif; /* if order_type_code */ /* Set Code B */ if dup_task_schedule_type_code = "scheduled" then b_verb := "scheduled"; else b_verb := "created"; endif; /* if dup_task_schedule_type_code */ /* Set Code D */ if dup_task_schedule_type_code = "unscheduled" then d_task_schedule_type := "unscheduled"; elseif dup_task_schedule_type_code = "PRN" then d_task_schedule_type := "PRN"; elseif dup_task_schedule_type_code = "continuous" then d_task_schedule_type := "continuous"; else d_task_schedule_type := "" ; endif; /* if dup_task_schedule_type_code */ /* Set up {{{SINGLE-QUOTE}}}another{{{SINGLE-QUOTE}}} varible text */ if d_task_schedule_type = "" then another := "another"; else another := "another "; endif; /* Set Code C */ if dup_task_msg_type = same_item_type then if order_type_code = "Medication" then c_msg_type_text := another || d_task_schedule_type || " dose of the same medication"; else c_msg_type_text := another || d_task_schedule_type || " " || task_string || " of the same"; endif; elseif dup_task_msg_type = same_therapeutic_class_type then c_msg_type_text := another || d_task_schedule_type || " administration of a medication in the same therapeutic class"; elseif dup_task_msg_type = similar_task_type then c_msg_type_text := another || d_task_schedule_type || " " || task_string ||" of a similar type"; elseif dup_task_msg_type = conflict_type then c_msg_type_text := another || d_task_schedule_type || " conflicting " || task_string ; elseif dup_task_msg_type = possible_conflict_type then c_msg_type_text := another || d_task_schedule_type || " possibly conflicting " || task_string; endif; /* if dup_task_msg_type */ /* Set Code E */ if dup_task_status_code = "performed" then e_occurrence_status := "had already been done"; elseif dup_task_status_code <> "performed" then if dup_task_schedule_type_code = "scheduled" then e_occurrence_status := "was scheduled"; elseif dup_task_schedule_type_code = "ToSchedule" and dup_task_process_type = 4 /* When 1ST GIVEN */ then e_occurrence_status := "was to be scheduled starting when first done"; else e_occurrence_status := "was pending"; endif; /* if dup_task_schedule_type_code */ endif; /* if dup_task_status_code */ /* Set Codes F and H */ if (is_primary_task and dup_order_type_code = "Medication" and order_type_code = "Medication") then f_too_close := "two doses might be given too close together"; h_was_done := "dose of " || dup_order_name ||" was given"; else // two tasks(follow-up tasks) might be performed too close together f_too_close := "two "|| task_string || "s might be performed too close together"; h_was_done := "time " || dup_order_name ||" was done"; endif; /* Set Code G */ if (is_primary_task AND dup_order_type_code = "Medication") then g_doing_something := "giving this dose"; else g_doing_something := "performing this " || task_string ; endif; /* if is_primary_task AND dup_order_type_code */ /* Eliminates NULLs from printing in the alert message */ if dup_task_msg_text is null then dup_task_msg_text:= ""; print_cr := ""; else print_cr := "\n\n" ; endif; /* if dup_task_msg_text is null */ /*-------------------------------------------------*/ /* Creates the BEGINNING of the Long Alert Message */ /*-------------------------------------------------*/ if exist dup_task_significant_date then formatted_dup_task_significant_date := dup_task_significant_date formatted with "%.4t"; endif; //check for task significant date long_alert_msg:= long_alert_msg || indent_string || "{{+B}}{{+C}}"|| dup_task_name ||"{{-C}}{{-B}}"|| "\n" || indent_string || "( " || db10_task_schedule_type || " )\n" || indent_string || db11_date_label || formatted_dup_task_significant_date || db13_to_label || db14_end_date || "\n"; /*--------------------------------------------*/ /* Creates the REST of the Long Alert Message */ /*--------------------------------------------*/ if dup_task_msg_type = no_std_message_type then long_alert_msg:= long_alert_msg || dup_task_msg_text || "\n\n"; elseif dup_task_msg_type is in (same_item_type, same_therapeutic_class_type, similar_task_type , conflict_type , possible_conflict_type ) then long_alert_msg:= long_alert_msg ||"At the time this " || a_type_of_order || " was " || b_verb ||", " || c_msg_type_text || "," || " which is listed immediately above, " || e_occurrence_status || "." || " There is the potential that " || f_too_close ||"." || " Before " || g_doing_something || ", you should confirm that enough time has elapsed" || " since the last " || h_was_done || ". " || print_cr || dup_task_msg_text || "\n\n"; else long_alert_msg:= long_alert_msg || "Error Message: Undefined Message Type for the item ordered." || "\n\n"; endif; /*if dup_task_msg_type */ enddo; /* for k */ /* Always conclude true to return the alert message to the calling program */ conclude true; ;; action: RETURN long_alert_msg; ;; end: