401 lines
14 KiB
Plaintext
401 lines
14 KiB
Plaintext
maintenance:
|
|
|
|
title: Alert Messages for Advanced Duplicate Order Checking MLM;;
|
|
mlmname: STD_FUNC_DUP_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 Advanced Duplicate-Order
|
|
Checking MLM{{{SINGLE-QUOTE}}}s alerts and actions.
|
|
;;
|
|
explanation: The number of possible messages for the Advanced Duplicate-Order
|
|
Checking MLM is large. This MLM encapsulates the messages, so that all
|
|
changes to the messages can be done in one MLM.
|
|
;;
|
|
keywords: Duplicate Order; Alert; Message;
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
/***************Make Changes To Spelling And Flags In This Section***************/
|
|
/* Set to true if logging is needed.*/
|
|
log_execution_info := false;
|
|
|
|
/********************************************************************************/
|
|
|
|
(order_name,
|
|
order_status_code,
|
|
order_without_specific_stop_date,
|
|
exact_msg,
|
|
performed_msg,
|
|
scheduled_msg,
|
|
exact_type,
|
|
subset_type,
|
|
superset_type,
|
|
same_order_type,
|
|
partial_match_type,
|
|
conflict_type,
|
|
possible_conflict_type,
|
|
no_std_message_type,
|
|
matching_name_list,
|
|
matching_significant_date_list,
|
|
matching_requested_date_list,
|
|
matching_entered_date_list,
|
|
matching_stop_date_list,
|
|
matching_msg_type_list,
|
|
matching_msg_text_list,
|
|
matching_time_msg_list,
|
|
matching_class_list,
|
|
matching_summary_list,
|
|
matching_order_status_list,
|
|
matching_order_type_code_list,
|
|
matching_alternate_order_type_list,
|
|
matching_is_script_list,
|
|
community_resultedOrder_alert_text ):= ARGUMENT;
|
|
|
|
/* Gets the Full text description of the OrderStatusCode */
|
|
(status_code_list,
|
|
status_description_list):= read { "SELECT Code, Description FROM CV3OrderStatus WHERE Active = 1" };
|
|
;;
|
|
evoke:
|
|
;;
|
|
logic:
|
|
indent_string:= " ";
|
|
hyphen_string:= "-----";
|
|
|
|
// Substitutes the Status Description for the Status Code
|
|
order_status := first (status_description_list where (status_code_list = order_status_code ));
|
|
|
|
/*---------------------------------*/
|
|
/* Picks the correct alert message */
|
|
/*---------------------------------*/
|
|
|
|
//Initialize variables
|
|
long_alert_msg:= "";
|
|
short_message := "";
|
|
matching_short_message_list := ();
|
|
|
|
processing_list:= 1 seqto (count matching_name_list);
|
|
for k in processing_list do
|
|
// Gets duplicate order information
|
|
dup_order_found:= processing_list = k;
|
|
dup_order_name:= first (matching_name_list where dup_order_found);
|
|
dup_order_significant_date:= first (matching_significant_date_list where dup_order_found);
|
|
dup_order_entered_date := first (matching_entered_date_list where dup_order_found);
|
|
dup_order_requested_date := first(matching_requested_date_list where dup_order_found);
|
|
dup_order_stop_date:= first (matching_stop_date_list where dup_order_found);
|
|
dup_order_msg_type:= first (matching_msg_type_list where dup_order_found);
|
|
dup_order_msg_text:= first (matching_msg_text_list where dup_order_found);
|
|
dup_order_time_msg:= first (matching_time_msg_list where dup_order_found);
|
|
dup_order_class_msg:= first (matching_class_list where dup_order_found);
|
|
dup_order_summary:= first (matching_summary_list where dup_order_found);
|
|
dup_order_status_code:= first (matching_order_status_list where dup_order_found);
|
|
dup_order_type_code:= first (matching_order_type_code_list where dup_order_found);
|
|
dup_alternate_order_type := first(matching_alternate_order_type_list where dup_order_found);
|
|
dup_is_script := first(matching_is_script_list where dup_order_found);
|
|
|
|
// Format dates, removing milliseconds
|
|
if exist dup_order_significant_date then
|
|
dup_order_significant_date_formatted := dup_order_significant_date formatted with "%.4t";
|
|
else
|
|
dup_order_significant_date_formatted := "";
|
|
endif;
|
|
|
|
if exist dup_order_requested_date then
|
|
dup_order_requested_date_formatted := dup_order_requested_date formatted with "%.4t";
|
|
else
|
|
dup_order_requested_date_formatted := "";
|
|
endif;
|
|
|
|
if exist dup_order_entered_date then
|
|
dup_order_entered_date_formatted := dup_order_entered_date formatted with "%.4t";
|
|
else
|
|
dup_order_entered_date_formatted := "";
|
|
endif;
|
|
|
|
if exist dup_order_stop_date then
|
|
dup_order_stop_date_formatted := dup_order_stop_date formatted with "%.4t";
|
|
else
|
|
dup_order_stop_date_formatted := "";
|
|
endif;
|
|
|
|
// Eliminates NULLs from printing in the alert message
|
|
if dup_order_msg_text is null
|
|
then
|
|
dup_order_msg_text:= "";
|
|
endif;
|
|
|
|
if (dup_order_summary is not null AND dup_order_summary <> "")
|
|
then
|
|
dup_order_summary := hyphen_string || dup_order_summary;
|
|
else
|
|
dup_order_summary := "";
|
|
endif;
|
|
|
|
dup_order_status := "Unsubmitted";
|
|
if ( dup_order_status_code <> "Unsubmitted" )
|
|
then
|
|
// Substitutes the Status Description for the Status Code
|
|
dup_order_status := first (status_description_list where (status_code_list = dup_order_status_code ));
|
|
endif;
|
|
|
|
dup_date_prefix := "Start Date: ";
|
|
dup_date_str := dup_order_significant_date_formatted;
|
|
dup_status_suffix := "Order";
|
|
|
|
if (dup_alternate_order_type = 2)
|
|
then
|
|
if (dup_order_requested_date is NULL or dup_order_requested_date = "" or dup_order_requested_date = "null")
|
|
then
|
|
dup_date_prefix := "Entered Date: ";
|
|
endif;
|
|
|
|
if (dup_is_script)
|
|
then
|
|
dup_status_suffix := "Prescription";
|
|
else
|
|
dup_status_suffix := "Home Medication";
|
|
endif;
|
|
elseif (dup_alternate_order_type = 1)
|
|
then
|
|
dup_status_suffix := "";
|
|
elseif (dup_alternate_order_type = 3)
|
|
then
|
|
dup_order_name := dup_order_name || "{{+B}} (" || community_resultedOrder_alert_text || "){{-B}}";
|
|
endif;
|
|
|
|
// Creates the beginning of the long alert message
|
|
long_alert_msg:= long_alert_msg
|
|
|| dup_order_name || dup_order_summary || "\n"
|
|
|| dup_date_prefix || dup_date_str || "\n"
|
|
|| "Status: " || dup_order_status || " " || dup_status_suffix || "\n" ;
|
|
|
|
// Creates the rest of the long alert message
|
|
If dup_order_msg_type = exact_type
|
|
then
|
|
If dup_order_time_msg = exact_msg
|
|
then
|
|
short_message :=
|
|
"Warning duplicate order - " || dup_order_name
|
|
|| " has already been ordered for the same date and time. "
|
|
|| dup_order_msg_text
|
|
;
|
|
elseif dup_order_time_msg = performed_msg
|
|
then
|
|
if order_without_specific_stop_date
|
|
then
|
|
short_message :=
|
|
"Warning - potential duplicate - " || dup_order_name
|
|
|| " was performed " || dup_order_significant_date_formatted || ". "
|
|
|| dup_order_msg_text
|
|
;
|
|
else
|
|
short_message :=
|
|
"Warning - potential duplicate - " || dup_order_name
|
|
|| " was started " || dup_order_significant_date_formatted || ". "
|
|
|| dup_order_msg_text
|
|
;
|
|
endif; /* if order_without_specific_stop_date */
|
|
elseif dup_order_time_msg = scheduled_msg
|
|
then
|
|
if order_without_specific_stop_date
|
|
then
|
|
short_message :=
|
|
"Warning - potential duplicate - " || dup_order_name
|
|
|| " has already been scheduled on " || dup_order_significant_date_formatted
|
|
|| ". Consider cancelling one of the items. "
|
|
|| dup_order_msg_text
|
|
;
|
|
else
|
|
short_message :=
|
|
"Warning - potential duplicate - " || dup_order_name
|
|
|| " has already been scheduled to start on "
|
|
|| dup_order_significant_date_formatted
|
|
|| ". Consider cancelling one of the items. "
|
|
|| dup_order_msg_text
|
|
;
|
|
endif; /* if order_without_specific_stop_date */
|
|
|
|
|
|
else
|
|
short_message :=
|
|
"Error Message 1: Cannot find a message for an EXACT match."
|
|
;
|
|
endif; /* if dup_order_time_msg */
|
|
elseif dup_order_msg_type = subset_type
|
|
then
|
|
If dup_order_time_msg = exact_msg
|
|
then
|
|
short_message :=
|
|
"Warning duplicate order - Your current order for " || order_name
|
|
|| " includes the " || dup_order_name
|
|
|| " which has already been ordered for the same date and time. "
|
|
|| dup_order_msg_text
|
|
;
|
|
elseif dup_order_time_msg = performed_msg
|
|
then
|
|
short_message :=
|
|
"Warning - potential duplicate - Your current order for " || order_name
|
|
|| " includes the " || dup_order_name
|
|
|| " which was performed on " || dup_order_significant_date_formatted || ". "
|
|
|| dup_order_msg_text
|
|
;
|
|
elseif dup_order_time_msg = scheduled_msg
|
|
then
|
|
short_message :=
|
|
"Warning - potential duplicate - Your current order for " || order_name
|
|
|| " includes the " || dup_order_name
|
|
|| " which is already scheduled for " || dup_order_significant_date_formatted
|
|
|| ". Consider cancelling the " || dup_order_name || ". "
|
|
|| dup_order_msg_text
|
|
;
|
|
else
|
|
short_message :=
|
|
"Error Message 2: Cannot find a message for a SUBSET match."
|
|
;
|
|
endif; /* if dup_order_time_msg */
|
|
elseif dup_order_msg_type = superset_type
|
|
then
|
|
If dup_order_time_msg = exact_msg
|
|
then
|
|
short_message :=
|
|
"Warning duplicate order - Your current order for " || order_name
|
|
|| " is included in the " || dup_order_name
|
|
|| " which has already been ordered for the same date and time. "
|
|
|| dup_order_msg_text
|
|
;
|
|
elseif dup_order_time_msg = performed_msg
|
|
then
|
|
short_message :=
|
|
"Warning - potential duplicate - Your current order for " || order_name
|
|
|| " is included in the " || dup_order_name
|
|
|| " which has already been performed on "
|
|
|| dup_order_significant_date_formatted || ". "
|
|
|| dup_order_msg_text
|
|
;
|
|
elseif dup_order_time_msg = scheduled_msg
|
|
then
|
|
short_message :=
|
|
"Warning - potential duplicate - Your current order for " || order_name
|
|
|| " is included in the " || dup_order_name
|
|
|| " which is scheduled on " || dup_order_significant_date_formatted
|
|
|| ". Consider cancelling one of the items. "
|
|
|| dup_order_msg_text
|
|
;
|
|
else
|
|
short_message :=
|
|
"Error Message 3: Cannot find a message for a SUPERSET match."
|
|
;
|
|
endif; /* if dup_order_time_msg */
|
|
elseif dup_order_msg_type = partial_match_type
|
|
then
|
|
If dup_order_time_msg = exact_msg
|
|
then
|
|
short_message :=
|
|
"Warning - duplicate order - " || dup_order_name
|
|
|| " has already been ordered for the same date and time. Both "
|
|
|| order_name || " and " || dup_order_name
|
|
|| " have some items in common. "
|
|
|| dup_order_msg_text
|
|
;
|
|
elseif dup_order_time_msg = performed_msg
|
|
then
|
|
short_message :=
|
|
"Warning - potential duplicate - " || dup_order_name
|
|
|| " was already performed on " || dup_order_significant_date_formatted
|
|
|| ". Both " || order_name || " and " || dup_order_name
|
|
|| " have some items in common. "
|
|
|| dup_order_msg_text
|
|
;
|
|
elseif dup_order_time_msg = scheduled_msg
|
|
then
|
|
short_message :=
|
|
"Warning - potential duplicate - " || dup_order_name
|
|
|| " is already scheduled on " || dup_order_significant_date_formatted
|
|
|| ". Both " || order_name || " and " || dup_order_name
|
|
|| " have some items in common. "
|
|
|| dup_order_msg_text
|
|
;
|
|
else
|
|
short_message :=
|
|
"Error Message 4: Cannot find a message for a PARTIAL MATCH. "
|
|
;
|
|
endif; /* if dup_order_time_msg */
|
|
elseif dup_order_msg_type = same_order_type
|
|
then
|
|
//Avoid Printing NULL for dup_order_class_msg
|
|
if exist dup_order_class_msg
|
|
then print_dup_order_class_msg := ", " || dup_order_class_msg || ",";
|
|
else print_dup_order_class_msg := "";
|
|
endif;
|
|
short_message :=
|
|
"An order for " || dup_order_name
|
|
|| " is of the same type" || print_dup_order_class_msg
|
|
|| " as your current order for " || order_name || ". "
|
|
|| dup_order_msg_text
|
|
;
|
|
elseif dup_order_msg_type = conflict_type
|
|
then
|
|
short_message :=
|
|
"A scheduled order for " || dup_order_name
|
|
|| " conflicts with your current order for " || order_name
|
|
|| ". Either modify the stop date of your current order,"
|
|
|| " modify the date of the scheduled order, or cancel the future order. "
|
|
|| dup_order_msg_text
|
|
;
|
|
elseif dup_order_msg_type = possible_conflict_type
|
|
then
|
|
short_message :=
|
|
"An order for " || dup_order_name
|
|
|| " may conflict with your current order for " || order_name
|
|
|| ". Please review. "
|
|
|| dup_order_msg_text
|
|
;
|
|
elseif dup_order_msg_type = no_std_message_type
|
|
then
|
|
short_message :=
|
|
dup_order_msg_text
|
|
;
|
|
else
|
|
short_message :=
|
|
"Error Message 5: Undefined Message Type for the item ordered."
|
|
;
|
|
endif; /*if dup_order_msg_type */
|
|
|
|
|
|
//Add the Message to the lists
|
|
matching_short_message_list := matching_short_message_list, short_message;
|
|
long_alert_msg:= long_alert_msg ||short_message || "\n\n";
|
|
|
|
enddo; /* for k */
|
|
|
|
/* Always conclude true to return values to the calling program */
|
|
conclude true;
|
|
;;
|
|
action:
|
|
RETURN (order_status, long_alert_msg, matching_short_message_list );
|
|
;;
|
|
end:
|