Initial Checking with all 820 MLMs

This commit is contained in:
2020-02-02 00:54:01 -05:00
parent c59dc6de2e
commit 840d0432f4
828 changed files with 239162 additions and 0 deletions

View File

@@ -0,0 +1,209 @@
maintenance:
title: Second Alert Escalation via Email;;
mlmname: STD_ESCALATION_EMAIL;;
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: Notifies the Alert Center that the patient{{{SINGLE-QUOTE}}}s Care-Provider has NOT ACKNOWLEDGED
an urgent alert within the past 30 minutes.
;;
explanation:
This time-based MLM handles the second (final) phase of Alert Escalation through an Email.
It is triggered 30 minutes after the unacknowledged alert is stored into the database.
A facility designates which Care-Provider-Role will be paged when an Escalation alert
occurs. This designation is set using the "provider_role_string" variable in this MLM.
When the patient{{{SINGLE-QUOTE}}}s care-provider has not acknowledged the escalated-alert within
30 minutes of the page, an Email message is sent to the designated Alert Center,
where an alternate care-provider can be contacted by the people at the center.
The rule is as follows:
If an "Escalation" alert-type is stored into the database in an UNACKNOWLEDGED state,
and it remains unacknowledged after 30 minutes
then an Email message is sent to the Alert Center.
;;
keywords: Time-based; Escalation; Alert Escalation;;
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;
/* The Destination statment is located at the end of the data slot */
/* This is due to the use of a variable in the statement, that is set dynamically */
/* Escalation is a core-loaded Alert Type. */
/* Recommend that the spelling within the quotes not be modified */
unack_escalated_alert:= event {AlertEnter Any Alert:
where TypeCode= "Escalation" and Status = "Unack" };
/* Which Care-Provider should be contacted when there is an escalated-alert? */
/* Change the provider-role in quotes to match the one in the STD_ESCALATION_PAGER MLM */
/* In addition, the Role must exist in the Provider Role dictionary */
provider_role_string:= "Attending";
/* Where should the Email be sent when the alert remains Unacknowledged for 30 minutes? */
/* Change the email address in quotes */
/* Recommend that this message be sent to your facility{{{SINGLE-QUOTE}}}s designated Alert Center */
email_address:= "AlertCenter";
/****************************************************************************************/
/* Execute only when this MLM is called by the editor */
if called_by_editor then
obj := read last
{ Alert: THIS
WHERE TypeCode= "Escalation"
AND Status = "Unack" };
EvokingObject := obj;
endif;
/* Get the patient{{{SINGLE-QUOTE}}}s ID and Name */
(client_guid,
client_name) := read last {ClientInfo: GUID, Name};
/* Get information about the evoking alert */
(alert_type,
alert_status,
client_visit_guid,
short_alert_msg,
alert_guid,
alert_text,
alert_has_long_text ):= read last
{Alert: TypeCode, Status, ClientVisitGUID, Description, GUID,
PlainMessageText, HasLongText,
REFERENCING EvokingObject };
/* Continue processing when there is an Unacknowledged alert. */
/* It may be possible that someone has acknowledged the alert, */
/* before the time-based MLM could run */
if alert_status = "unack"
then
/* Get the patient{{{SINGLE-QUOTE}}}s location group (unit) */
(current_loc_name,
patient_loc_group_name ):= read last
{"SELECT cv.CurrentLocation, loc.Name "
|| " FROM CV3ClientVisit AS cv JOIN CV3Location AS loc"
|| " ON cv.CurrentLocationGUID = loc.GUID "
|| " WHERE cv.GUID = " || SQL(client_visit_guid)
|| " AND cv.Active = 1 "
|| " AND loc.Active = 1 " };
/* Retrieve the current (unexpired) Care Provider information for the patient */
/* Only one Care Provider with the designated Care-Provider-Role is retrieved */
/* If there are two or more in the database, then the older ones will be ignored */
(provider_role_code,
provider_status,
from_date,
to_date,
touched_when,
provider_name ):= read last
{"SELECT cpvr.RoleCode, cpvr.Status, fromDtm.TimeValue AS FromDtm, toDtm.TimeValue AS ToDtm, "
||" touchedWhen.TimeValue AS TouchedWhen, cp.DisplayName "
||" FROM CV3CareProviderVisitRole AS cpvr JOIN CV3CareProvider AS cp ON cpvr.ProviderGUID = cp.GUID "
||" INNER JOIN CV3ClientVisit cv ON cpvr.ClientVisitGUID = cv.GUID "
||" CROSS APPLY dbo.SXADBConvertLocalToOffsetForVisitTblFn(cpvr.ClientVisitGUID, cpvr.FromDtm) as fromDtm "
||" CROSS APPLY dbo.SXADBConvertLocalToOffsetForVisitTblFn(cpvr.ClientVisitGUID, cpvr.ToDtm) as toDtm "
||" CROSS APPLY dbo.SXADBConvertEnterpriseToLocalTblFn(cv.TimeZone, cpvr.TouchedWhen) touchedWhenLocal "
||" CROSS APPLY dbo.SXADBConvertLocalToOffsetForVisitTblFn(cv.GUID, touchedWhenLocal.LocalDate) touchedWhen "
||" WHERE cpvr.ClientVisitGUID = " || SQL(client_visit_guid)
||" AND cpvr.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
||" AND cpvr.RoleCode = " || SQL(provider_role_string)
||" AND cpvr.FromDtm <= (SELECT TOP 1 LocalDate FROM dbo.SXADBConvertEnterpriseToLocalTblFn(cv.TimeZone, (SELECT CurDate FROM dbo.SXADBGetEnterpriseNowTblFn()))) "
||" AND (ISNULL (cpvr.ToDtm, (SELECT TOP 1 LocalDate FROM dbo.SXADBConvertEnterpriseToLocalTblFn(cv.TimeZone, (SELECT CurDate FROM dbo.SXADBGetEnterpriseNowTblFn())))) >= "
||" (SELECT TOP 1 LocalDate FROM dbo.SXADBConvertEnterpriseToLocalTblFn(cv.TimeZone, (SELECT CurDate FROM dbo.SXADBGetEnterpriseNowTblFn()))))"
, PrimaryTime = TouchedWhen };
endif; /* if alert_status = "Unack" */
/*------------------------*/
/* DESTINATION STATEMENTS */
/*------------------------*/
/* Change the message within the quotes if a different short-message is needed.*/
/* Do not change the Alert Type to Escalation. This will cause an infinite-loop */
intermediate_alert:= destination { IntermediateMessage: warning,
"Escalation Alert", high, chart,
"HVC Saved Escalation Message", 1010 };
email_alert:= destination { email: warning, "Escalation Alert",
high, chart, email_address };
;;
evoke: 30 minutes after time of unack_escalated_alert
;;
logic:
/* Exit the MLM when the alert has already been acknowledged */
If alert_status <> "Unack"
then conclude false;
endif;
/*---------------*/
/* Clinical Rule */
/*---------------*/
If alert_status = "unack"
then conclude true;
endif;
;;
action:
/* Send message to email */
write "The "|| provider_role_code || " ( " ||provider_name || " ) "
|| "has not acknowledged an escalated-alert for the patient listed "
|| "below in the past 30 minutes. "
|| "Due to the urgency of the alert, please contact his/her alternate."
|| "\n\nPatient: " || client_name
|| "\nLocation: " || patient_loc_group_name
|| "\nAlert Title: " || short_alert_msg || " (full text below)"
|| "\n\n"
|| alert_text
at email_alert;
/* Keep a copy of the e-mail message */
/* Store it in the database as an intermediate message */
write "The "|| provider_role_code || " ( " ||provider_name || " ) "
|| "has not acknowledged an escalated-alert for the patient listed "
|| "below in the past 30 minutes. "
|| "Due to the urgency of the alert, please contact his/her alternate."
|| "\n\nPatient: " || client_name
|| "\nLocation: " || patient_loc_group_name
|| "\nAlert Title: " || short_alert_msg || " (full text below)"
|| "\n\n"
|| alert_text
at intermediate_alert;
;;
end: