Files
St.Clair/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_DUPLICATE_ORDERS.mlm

168 lines
4.8 KiB
Plaintext

maintenance:
title: SCH_ALERT_ON_DUPLICATE_ORDERS;;
mlmname: SCH_ALERT_ON_DUPLICATE_ORDERS;;
arden: version 2.5;;
version: 16.30;;
institution: St. Clair;;
author: Teresa Spicuzza;;
specialist: Teresa Spicuzza;;
date: 2017-04-12;;
validation: testing;;
library:
purpose: Generate an informational alert for pharmacy listing duplicate orders managed via the orders management window.
;;
explanation: When an potential therapeutic duplicate has been addressed via the orders management window, create
an informational alert that is not presented to the user, but able to be viewed from the order or viewed with all alerts on the pt info tab.
Change History:
2017.04.12 TMS Created as an informational alert, not presented to user but viewable as a reference to what
actions were taken from the order management window. CSR 33465
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(client_visit_guid, chart_guid, client_guid, OrderName) := ARGUMENT;
//.Net libraries
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
/*******************************************************************/
//Set to true if logging needed
log_execution_info := false;
//Set the text for this variable to indicate whether to send the message or not
send_alert := "DoNotSend";
//Destination Object Properties
alert_dialog := "";
alert_message := "";
alert_override_msg := "";
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
CRLF:= CR||LF;
TAB := 9 formatted with "%c";
continueprocessing := false;
//Destination
duplicated_medication_order := event {OrderEnter User Order:
WHERE TypeCode = "Medication"
AND OrderStatusLevelNum >= 0
AND OrderStatusLevelNum <= 50
// AND IsHeld = FALSE
AND IsSuspended = FALSE };
/* Get the OrderUserData object pointer */
OrderUserDataObj := read last
{ Order: OrderUserData
REFERENCING EvokingObject };
( ActionUserDataCode, ActionValue ) := read first
{ OrderUserData: UserDataCode, Value
REFERENCING OrderUserDataObj where
UserDataCode = "PRX_Duplicate_Order_Action_Text" };
( InfoUserDataCode, DupOrderGuidList ) := read first
{ OrderUserData: UserDataCode, Value
REFERENCING OrderUserDataObj where
UserDataCode = "PRX_Order_Guids" };
numguids := count (duporderguidlist);
if actionvalue is not null then
continueprocessing := true;
DupGuidsFromOrder := ();
GuidCount := count (DupOrderGuidList);
DupGuidsFromOrder := call str_parse with DupOrderGuidList,",";
finalcount := count (DupGuidsFromOrder);
for s in 1 seqto finalcount do
if s = 1 then
FinalList := dupguidsfromorder [s] as number;
else
FinalList := FinalList, dupguidsfromorder [s] as number;
endif;
enddo;
newnumguids := count (DupGuidsFromOrder);
if finalcount >= 1 then
(dupordername, dupordersummary, duporderstatus) := read {"select o.name, Replace (o.summaryline, CHAR(13) + CHAR(10), {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}), os.Description from cv3order o "
|| "join CV3OrderStatus os on os.code = o.orderstatuscode "
|| "where o.guid in ("|| SQL (finallist) || ")" };
endif;
endif;
duplicate_orderset_alert:= DESTINATION {Alert} WITH
[ alert_type:= "Informational",
short_message:= "Potential Therapeutic Duplicate Information",
priority:= low,
scope:= chart,
rule_group:= "Therapeutic Med Duplicate Info",
rule_number:= 3095,
send_with_order := send_alert,
alert_dialog_settings := alert_dialog,
display_alert := false];
bodytext := CRLF;
for r in 1 seqto count(duporderstatus) do
bodytext := bodytext || duporderstatus[r] || Tab || dupordername [r] || CRLF || TAB || TAB || dupordersummary [r] || CRLF;
enddo;
alert_message := "The order for {{+B}}" ||EvokingObject.Name || " {{-B}}was presented as a potential therapeutic duplicate with: " || CRLF || bodytext;
/*******************************************************************/
//Unit testing
if called_by_editor then
OrderName := "Codeine 15mg Tab";
endif;
;;
priority: 99
;;
evoke:
duplicated_medication_order;
;;
logic:
if exists OrderName then
duplicate_addressed := true;
alert_message := "Issue with " || OrderName || " has been addressed.";
alert_status := true;
endif;
If continueprocessing = true then
conclude true;
else
conclude false;
endif;
;;
action:
write alert_message at duplicate_orderset_alert;
return alert_status;
;;
Urgency: 90;;
end: