Initial Checking with all 820 MLMs
This commit is contained in:
203
MLMStripper/bin/Debug/SCH/SCH_DIET_SECLUSION_TRAY.mlm
Normal file
203
MLMStripper/bin/Debug/SCH/SCH_DIET_SECLUSION_TRAY.mlm
Normal file
@@ -0,0 +1,203 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Diet_Seclusion_Tray ;;
|
||||
mlmname: SCH_Diet_Seclusion_Tray ;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;; // FP1
|
||||
institution: St. Clair Hospital ;;
|
||||
author: Shivprasad Jadhav ;;
|
||||
specialist: ;;
|
||||
date: 2015-11-17;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Discontinue the Earlier Active and Latest {{{SINGLE-QUOTE}}}Diet Order{{{SINGLE-QUOTE}}} from Standard Session while creating new Diet order [Diet- Add to current ]
|
||||
;;
|
||||
explanation:
|
||||
Change History
|
||||
----------------------------------------------------
|
||||
17.11.2015 GOS CSR-32228 : Created MLM.
|
||||
|
||||
;;
|
||||
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 := "";
|
||||
|
||||
log_execution_info := false;
|
||||
|
||||
Order_Submit := event {OrderWorksheetSubmit User } ; //Order : WHERE Name Matches pattern "Place in Observation%" } ;//Order: where Name in ("Place in Observation")};
|
||||
onames, Mod := read Last { UNSUBMITTED ORDER: Name , Modifier };
|
||||
|
||||
( careProvider_obj ) := read last{ UserInfo: careProvider };
|
||||
( careProvider_Actaul ) := read last{ UserInfo: This };
|
||||
|
||||
|
||||
(location_guid, Active_ClientVisitGUID, client_guid) := read last { ClientVisit: CurrentLocationGUID, GUID, clientguid };
|
||||
|
||||
visitGuid := EVOKINGOBJECT.GUID ;
|
||||
|
||||
|
||||
OrderGuid := Read first{" Select Top 1 o1.guid from cv3ClientVisit cv with (nolock) Join Cv3Order o1 With (Nolock) "
|
||||
|| " on cv.guid=o1.ClientVisitGUID And cv.ClientGUID=o1.ClientGUID And cv.ChartGUID=o1.ChartGUID And o1.name = {{{SINGLE-QUOTE}}}Diet{{{SINGLE-QUOTE}}} "
|
||||
|| " And o1.OrderStatusLevelNum = 50 And o1.InitialSessionTypeCode <> {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} And cv.guid = " || visitGuid || " Order By O1.CreatedWhen Desc "} ;
|
||||
|
||||
|
||||
If ( "Diet" In onames) And ("(Add to current diet)" In Mod ) Then //And ("(Add to current diet)" In Mod
|
||||
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 "};
|
||||
|
||||
|
||||
If order_guid IS NULL then
|
||||
DiscontinueOrder := False ;
|
||||
Endif;
|
||||
|
||||
// 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}}}) ;
|
||||
// Get the current user as the default care provider
|
||||
// RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with (user_id_type, user_id_code);
|
||||
/* Added by Vishal Modi on 07/27/2015 */
|
||||
//RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((care_provider_guid 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;
|
||||
// Cannot continue with order discontinuation
|
||||
DiscontinueOrder := True ;
|
||||
Endcatch;
|
||||
// END Common Data
|
||||
|
||||
Try
|
||||
|
||||
//RequestedBySource := ".Per Electronic Order";
|
||||
//OrderDiscontinuationReason := "Cancelled by MLM as duplicate Diets order.";
|
||||
RequestedBySource := "per hospital policy";
|
||||
OrderDiscontinuationReason := "New diet ordered.";
|
||||
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 := True ;
|
||||
Endif;
|
||||
Endif;
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: Order_Submit; ;;
|
||||
logic:
|
||||
|
||||
if DiscontinueOrder = False
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
order_discontinued_no_error := false;
|
||||
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 := " Diet Not Entered";
|
||||
alert_message := "{{+B}}Sedation Protocol: Diet not entered into SCM" || "\n" ||
|
||||
"Due to a response (GO-BACK) to a Clinical Alert{{-B}}";
|
||||
write alert_message at error_destination;
|
||||
write error_message at error_destination;
|
||||
Else
|
||||
write "An error has occured in the MLM {{+B}} SCH_Diet_Seclusion_Tray {{-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:
|
||||
Reference in New Issue
Block a user