Initial Checking with all 820 MLMs
This commit is contained in:
191
MLMStripper/bin/Debug/SCH/SCH_FUNC_DISCONTINUE_BY_ORDERGUID.mlm
Normal file
191
MLMStripper/bin/Debug/SCH/SCH_FUNC_DISCONTINUE_BY_ORDERGUID.mlm
Normal file
@@ -0,0 +1,191 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Func_Discontinue_By_OrderGuid;;
|
||||
mlmname: SCH_Func_Discontinue_By_OrderGuid;;
|
||||
arden: version 2.5;;
|
||||
version: 1.00;;
|
||||
institution: ;;
|
||||
author: Teresa Spicuzza;;
|
||||
specialist: Teresa Spicuzza;;
|
||||
date: 2017-10-23;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: This MLM will auto discontinue an order as identified by the order guid
|
||||
sent by the calling MLM
|
||||
;;
|
||||
explanation:
|
||||
12.20.2017 TMS CSR# 35886 Created using SCH_Func_Discontinue_Order as a reference
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
citations:
|
||||
;;
|
||||
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;
|
||||
|
||||
local_session := CDS_SESSION.local;
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
|
||||
|
||||
log_execution_info := false;
|
||||
( OrderGuid,
|
||||
RequestedByGUID,
|
||||
visitguid,
|
||||
Reason,
|
||||
Source
|
||||
|
||||
) := argument;
|
||||
|
||||
MedicationOrder_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM ",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Order Object",
|
||||
rule_number := 2017 ];
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Error destination
|
||||
//---------------------------------------------------------------
|
||||
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 := 1008,
|
||||
Rule_subgroup := "",
|
||||
Send_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true ];
|
||||
|
||||
If exist OrderGuid Then
|
||||
|
||||
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 := 1008,
|
||||
Rule_subgroup := "",
|
||||
Send_alert_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true ];
|
||||
|
||||
|
||||
// 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 := Source;
|
||||
OrderDiscontinuationReason := Reason;
|
||||
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;
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
;;
|
||||
action:
|
||||
|
||||
if error_occurred
|
||||
then
|
||||
|
||||
write "An error has occurred in the MLM {{+B}}SCH_Func_Discontinue_By_OrderGuid{{-B}} " ||
|
||||
"Please notify your System Administrators that an error message has " ||
|
||||
"occurred for this patient. They will review the following error(s) " ||
|
||||
"message: \n" at error_destination;
|
||||
write error_message at error_destination;
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if EXISTS MedicationOrder_dest then
|
||||
write true at MedicationOrder_dest;
|
||||
endif;
|
||||
|
||||
return error_occurred;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user