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,219 @@
maintenance:
title: SCH_C_Difficile_OrderDiscontinue ;;
mlmname: SCH_C_Difficile_OrderDiscontinue ;;
arden: version 2.5;;
version: 5.50;; // FP1
institution: St. Clair Hospital ;;
author: Shivprasad Jadhav ;;
specialist: ;;
date: 2015-10-01;;
validation: testing;;
library:
purpose: Discontinue the Earlier {{{SINGLE-QUOTE}}}Clostridium Difficile Toxin Gene Testing by PCR{{{SINGLE-QUOTE}}} order
When difference between [C Diff order Placed Time] and [Current Time ] is greter than 24 hours and Order status is [pending Collection].
;;
explanation:
Change History
---------------------------------------------------------------------------------
12/06/2016 SSJ - CSR 35200 - C Diff Order Cancellation Created.
06/12/2017 AM - CA# 2712873 - Added Order Release Event.
08/07/2019 JML - CSR 38386 - New inpatient lab order created.
;;
keywords: ObjectsPlus, Orders
;;
knowledge:
type: data-driven;;
data:
// Specify which .NET assemblies need to be loaded for ObjectsPlus
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
using "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
using "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
using "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
using "ObjectsPlusXA.SCM";
using "System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
using "SCMLib";
using namespace "System";
using namespace "System.Exception";
using namespace "System.Windows.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager";
using namespace "SCMLib.PObj";
using namespace "SCMLib.PObj.OrderPObj";
include standard_libs;
error_occurred := false;
error_message := "";
if called_by_editor then
evokingobject := read last {Order : THIS where Name = "Clostridium Difficile Toxin Gene Testing by PCR"};
endif;
log_execution_info := false;
Order_Submit := event {OrderEnter User Order: WHERE Name IN ( "Clostridium Difficile Toxin Gene Testing by PCR", "Clostridium Difficile Screening" ) };
Order_Release := event {OrderRelease User Order: WHERE Name IN ( "Clostridium Difficile Toxin Gene Testing by PCR", "Clostridium Difficile Screening" ) };
idest:= destination{IntermediateMessage: Warning, "ColValue",high, chart, "RuleGroupHere1", 1001, "", "" };
( careProvider_obj ) := read last{ UserInfo: careProvider };
( careProvider_Actaul ) := read last{ UserInfo: This };
//Capture current patient
(clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
visitGuid := read last {ClientVisit : GUID};
chartGuid := read last {ClientVisit : ChartGUID};
VisitType := read last {ClientVisit : Typecode };
//Clostridium Difficile Toxin Gene Testing by PCR
If (VisitType Matches Pattern "%Inpatient%") or (VisitType Matches Pattern "%Observation%") Then
(location_guid, Active_ClientVisitGUID, client_guid) := read last { ClientVisit: CurrentLocationGUID, GUID, clientguid };
// To Retrive Order Guid from placed order data
OrderGuid := Read First {" SELECT o.Guid
FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)
ON cv.GUID = o.ClientVisitGUID
AND cv.ClientGUID = o.ClientGUID
AND cv.ChartGUID = o.ChartGUID
WHERE cv.GUID = " || visitGuid || "
AND o.Name In ( {{{SINGLE-QUOTE}}}Clostridium Difficile Toxin Gene Testing by PCR{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Clostridium Difficile Screening{{{SINGLE-QUOTE}}} )
And DATEDIFF(Minute, o.ARRIVALDTM, GetDate()) >= 1440
And o.OrderStatusCode in ({{{SINGLE-QUOTE}}}PCOL{{{SINGLE-QUOTE}}})
And o.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} Order By o.CreatedWhen Desc "};
// If Order Present With difference between order placed time and Current Time
// with greater than 24 Hrs and Status is {{{SINGLE-QUOTE}}}pending Collection{{{SINGLE-QUOTE}}} Then Discontinue the order
If exist OrderGuid Then
//(Typecode, Username ) := Read first {" Select Typecode, DisplayName from CV3CareProvider Where GUID = " || Care_Provider || " "} ;
location_guid := Read First {" Select CurrentLocationGUID from CV3ClientVisit Where GUID = " || visitGuid || " "} ;
order_Creation_Reason := "Created by MLM";
error_destination := destination { Alert } with [
alert_type := "Warning",
short_message := "ObjectsPlus Error from MLM",
priority := "low",
scope := "chart",
Rule_group := "ObjectsPlus Error from MLM",
Rule_number := 1004,
Rule_subgroup := "",
Send_alert_with_order := "",
Alert_dialog_settings := "",
Display_alert := true ];
RequestedByGUID:= "" ;
RequestedByGUID:= READ LAST {" select top 1 RequestedByGUID from CV3OrderStatusHistory (nolock)
Where OrderGUID = " || SQL(OrderGuid) ||" order by CreatedWhen "};
// Common data
Try
// .Net version of Client Visit Object
ClientVisit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((RequestedByGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
error_occurred := false;
Endtry;
Catch Exception ex
error_occurred := true;
error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
If ClientVisit_obj IS NOT NULL then
void := call ClientVisit_obj.Dispose;
ClientVisit_obj := NULL;
Endif;
If RequestedBy_obj IS NOT NULL then
void := call RequestedBy_obj.Dispose;
RequestedBy_obj := NULL;
Endif;
Endcatch;
Try
//RequestedBySource := ".Per Electronic Order";
//OrderDiscontinuationReason := "Cancelled by MLM as duplicate Diets order.";
RequestedBySource := "per hospital policy";
OrderDiscontinuationReason := "24 Hours completed after order entry.";
order_obj := new net_object {{{SINGLE-QUOTE}}}SCMLib.PObj.OrderPObj{{{SINGLE-QUOTE}}} with OrderGuid;
order_obj.SuppressSignOnSubmit := true;
order_obj.ToBeSigned := false;
now_dtm := now + 1 minute;
date_str := ((extract year now_dtm) as string) || "-" ||
(extract month now_dtm) formatted with "%0.2d" || "-" ||
(extract day now_dtm) formatted with "%0.2d";
time_str := (extract hour now_dtm) formatted with "%0.2d" || ":" ||
(extract minute now_dtm) formatted with "%0.2d" || ":" ||
(extract second now_dtm) formatted with "%0.2d";
care_provider_guid_str :=(RequestedBy_obj.PrimaryKey as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) as string;
dc_order := call order_obj.Discontinue with OrderDiscontinuationReason,
date_str,
time_str,
RequestedBySource,
care_provider_guid_str;
Endtry;
Catch Exception ex
error_occurred := true;
error_message := "{{+R}}Discontinuing order:{{-R}}\n" || ex.Message || "\n\n";
DiscontinueOrder := True ;
EndCatch;
DiscontinueOrder := False ;
Endif;
Endif;
;;
priority: 50
;;
evoke: 1440 Minute After Time of Order_Submit;
1440 Minute After Time of Order_Release;
;;
logic:
conclude true;
;;
action:
// To Write error in Table
If error_message <> "" Then
write error_message at idest;
Else
Void:= Void ;
EndIf;
If error_occurred = true then
If error_message MATCHES PATTERN "%update you requested has been canceled due%"
or error_message MATCHES PATTERN "%Failed to Store Alert to database%" then
error_destination.short_message := " C Diff Not Entered";
alert_message := "{{+B}}Sedation Protocol: C Diff not entered into SCM" || "\n" ||
"Due to a response (GO-BACK) to a Clinical Alert{{-B}}";
write alert_message at error_destination;
Else
write "An error has occured in the MLM {{+B}} SCH_C_Diff_OrderDiscontinue {{-B}} " ||
"Please notify your System Administrators that an error message has " ||
"occurred for this patient. They will review the following error " ||
"message: \n" at error_destination;
write error_message at error_destination;
Endif;
Else
order_discontinued_no_error := true;
return order_discontinued_no_error;
Endif;
;;
Urgency: 50;;
end: