Initial Checking with all 820 MLMs
This commit is contained in:
127
MLMStripper/bin/Debug/SCH/SCH_CANCEL_ACCOUNT_ORDER.mlm
Normal file
127
MLMStripper/bin/Debug/SCH/SCH_CANCEL_ACCOUNT_ORDER.mlm
Normal file
@@ -0,0 +1,127 @@
|
||||
maintenance:
|
||||
|
||||
title: Ordering: Check for complete registration when entering a discharge or expire order;;
|
||||
mlmname: SCH_Cancel_Account_Order;;
|
||||
arden: version 2;;
|
||||
version: 5.00;;
|
||||
institution: St Clair Cancel Account Order MLM;;
|
||||
author: Dean Miklavic, Allscripts Corp;;
|
||||
specialist: Kathy Egal;;
|
||||
date: 2010-09-28;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Prevent the Cancel Account Order from being entered if the patient visit contains Orders, Results or Documents.
|
||||
;;
|
||||
explanation: When a user selects the Cancel Account order item and the patients account contains non-cancelled Orders, Results or Documents a hard stop
|
||||
alert will display and not allow the user to proceed with submitting the order.
|
||||
|
||||
Change history
|
||||
|
||||
;;
|
||||
keywords: Cancel Account
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
/* Get the Chart GUID */
|
||||
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid) :=
|
||||
read last {ClientVisit: GUID, ChartGUID, ClientGUID };
|
||||
|
||||
|
||||
|
||||
// Set the text for this variable to indicate whether to send the message or not.
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
order_evoke1:= EVENT {OrderEnter User Order:
|
||||
WHERE Name Matches Pattern "cancel account%"};
|
||||
|
||||
// SQL Code to check for Non-Cancelled Orders, Lab Results, and or Documents.
|
||||
|
||||
ExistingActiveOrders := read last
|
||||
{ " Select top 1 Name"
|
||||
|| " from cv3order "
|
||||
|| " where OrderStatusCode = {{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} and clientguid = " || SQL(ClientGuid) || " and chartguid = " || SQL(ChartGuid) || " and clientvisitguid = " || SQL(ClientVisitGuid)
|
||||
|| " and name <> {{{SINGLE-QUOTE}}}RODS{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
ExistingOtherOrders := read last
|
||||
{ " Select top 1 Name"
|
||||
|| " from cv3order "
|
||||
|| " where OrderStatusCode not in ({{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}}) and clientguid = " || SQL(ClientGuid) || " and chartguid = " || SQL(ChartGuid) || " and clientvisitguid = " || SQL(ClientVisitGuid) };
|
||||
|
||||
ExistingLabs := read last
|
||||
{ " Select top 1 ItemName"
|
||||
|| " from cv3basicobservation "
|
||||
|| " where Status is not null and clientguid = " || SQL(ClientGuid) || " and chartguid = " || SQL(ChartGuid) || " and clientvisitguid = " || SQL(ClientVisitGuid) };
|
||||
|
||||
ExistingDocuments := read last
|
||||
{ " Select top 1 DocumentName"
|
||||
|| " from cv3clientdocument "
|
||||
|| " where IsCanceled is not null and clientguid = " || SQL(ClientGuid) || " and chartguid = " || SQL(ChartGuid) || " and clientvisitguid = " || SQL(ClientVisitGuid) };
|
||||
|
||||
|
||||
// Code to create cumulative message that is displayed in Alert.
|
||||
Message_Accumulator :=" ";
|
||||
Orders_Message := " ";
|
||||
|
||||
|
||||
If exists (ExistingOtherOrders) then Message_Accumulator := Message_Accumulator || " Non-Active Orders, " ;Message_Action := "alert"; endif;
|
||||
|
||||
If exists (ExistingLabs) then Message_Accumulator := Message_Accumulator || " Results, " ;Message_Action := "alert"; endif;
|
||||
|
||||
If exists (ExistingDocuments) then Message_Accumulator := Message_Accumulator || " Documents, " ;Message_Action := "alert" ; endif;
|
||||
|
||||
If exists (ExistingActiveOrders) then Message_Accumulator := Message_Accumulator || " Active Orders, " ;Message_Action := "stop"; endif;
|
||||
|
||||
// Code for messages , alerts
|
||||
|
||||
Orders_Message:= "You have entered a Cancel order on an account that has " ||Message_Accumulator ||
|
||||
"\n\nContact your manager for further direction." ||
|
||||
"\n\nOnce the above have been re-entered on the correct account or have been cancelled, RE-ENTER the Cancel order. .";
|
||||
|
||||
Orders_Message2:= "You have entered a Cancel order on an account that has " ||Message_Accumulator ||
|
||||
"\n\nContact your manager for further direction." ;
|
||||
|
||||
|
||||
alert_details:= destination { Alert: warning, "Not cleared for cancel", high, chart,
|
||||
"Cannot Place Cancel Order", 14005, send_alert, "No Override Allowed" };
|
||||
|
||||
// New second alert 09122011
|
||||
|
||||
alert2_details:= destination { Alert: warning, "Must acknowledege alert", high, chart,
|
||||
"Warning orders exist for patient", 14005, send_alert, "Must Acknowledge" };
|
||||
|
||||
|
||||
;;
|
||||
evoke: order_evoke1;
|
||||
;;
|
||||
logic:
|
||||
If Message_Accumulator <> " " then conclude true ; else conclude false ; endif;
|
||||
;;
|
||||
action:
|
||||
|
||||
// code to determine if user gets a hard stop or warning
|
||||
|
||||
// Warning Message
|
||||
|
||||
If Message_Action = "alert" then write "This patient has {{+B}}{{+R}}" || Message_Accumulator ||
|
||||
"{{-B}}{{-R}} on the account. \n\n {{+B}}{{+R}}" || Orders_Message2 || "{{-B}}{{-R}}" ||
|
||||
" " at alert2_details; endif;
|
||||
|
||||
// Hard Stop Message
|
||||
If Message_Action = "stop" then write "This patient has {{+B}}{{+R}}" || Message_Accumulator ||
|
||||
"{{-B}}{{-R}} on the account and the Cancel order cannot be placed. \n\n {{+B}}{{+R}}" || Orders_Message || "{{-B}}{{-R}}" ||
|
||||
" " at alert_details; endif;
|
||||
|
||||
|
||||
// write "This patient has {{+B}}{{+R}}" || Message_Accumulator ||
|
||||
// "{{-B}}{{-R}} on the account and the Cancel order cannot be placed. \n\n {{+B}}{{+R}}" || Orders_Message || "{{-B}}{{-R}}" ||
|
||||
// " " at alert_details;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user