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,253 @@
maintenance:
title: SCH_CREATE_SODIUM_FROM_RESULT;;
mlmname: SCH_CREATE_SODIUM_FROM_RESULT;;
arden: version 2.5;;
version: 5.50;;
institution: Eclipsys, Test MLM;;
author: Dean Miklavic;;
specialist: Shawn Head;;
date: 2017-11-20;;
validation: testing;;
library:
purpose: This MLM will create a Sodium order when a low sodium level is received.
;;
explanation: This orders created by this MLM will by-pass the order entry worksheet
and will write directly to the database once the evoking object is saved.
Change history
11.20.2017 STH CSR#: 36015 created (copied from the SCH_CREATE_LACTIC_ACID_FROM_RESULT which is similar) {Go-Live 07/03/2018}
;;
keywords: ObjectsPlus, Orders
;;
knowledge:
type: data-driven;;
data:
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
error_occurred := false;
error_message := "";
log_execution_info := false;
////// Added on 01.08.2015 by DW for CSR#: 33901 //////
/*
create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}}; // MLM that creates the Enterprise Defined Column in the "Action" section of the MLM
EDCObj := OBJECT [column_name,column_value,client_guid,chart_guid,client_visit_guid]; // Create Enterprise Defined Column Obj
*/
////// Added on 01.08.2015 by DW for CSR#: 33901 //////
observation_enter_event := event { ObservationEnter Any Observation: where (itemname in ("Sodium from Blood Gas","Sodium Plasma/Serum","Sodium, ABG, POC","Sodium, VBG, POC") AND (IsHistory = FALSE AND Active = TRUE))};
// If called by the editor
If called_by_editor then EvokingObject := read last { Observation: This where (itemname in ("Sodium from Blood Gas","Sodium Plasma/Serum","Sodium, ABG, POC","Sodium, VBG, POC") AND (IsHistory = FALSE AND Active = TRUE)) }; endif;
//
// Gather data
( OrderGUID, resultValue ) := read last { Observation: OrderGUID, Value REFERENCING EvokingObject};
(ClientVisitGUID, ChartGUID, ClientGUID, ReqByGUID, CodedTime, location_guid, OrderName, currentlocation, visittype) := Read Last {" Select
a.ClientVisitGUID, a.ChartGUID, a.ClientGUID, a.CareProviderGUID, a.RequestedTime, b.CurrentLocationGUID, a.name, b.currentlocation, b.typecode
from CV3Order a with (nolock) Join CV3ClientVisit b with(nolock) on
a.ClientVisitGUID = b.GUID and a.ClientGUID = b.ClientGUID and a.ChartGUID = b.ChartGUID and a.GUID = " || SQL(OrderGUID) };
LowSodiumValueEntered := false;
if (resultValue = "<8") then
resultValueNumeric := 1; //sets the value less than 120 to trigger re-order when lower limit reached
else
resultValueNumeric := resultValue as number;
endif;
if(visittype in ("Inpatient","Emergency","Observation")) then
validpatient := true;
else
validpatient := false;
endif;
if ((resultValueNumeric < 120) and (validpatient)) then
PerformedDTTM := EVOKINGOBJECT.PerformedDtm;
PerformedDTTM_4hrsRound2wholehr := read last { " select dateadd(hour, 4 + datediff(hour, 0," || sql(PerformedDTTM) || " ), 0) " };
//check to see if the result trigger MLM is the same as the oldest result saved to the database with a value > 2.
if PerformedDTTM_4hrsRound2wholehr is not null then
//check to see if there is already an active order for lactic acid with a requested date in-side the 4 hour window of the significant date/time of the result that filed.
Chk4ValidOrder := Read Last {" select top 1 o.guid from CV3Order o with (nolock)
where o.clientguid = " || sql(ClientGUID) || "
and o.chartguid = " || sql(ChartGUID) || "
and o.clientvisitguid = " || sql(ClientVisitGUID) || "
and o.GUID <> " || sql(OrderGUID) || "
and o.name in ({{{SINGLE-QUOTE}}}Sodium Plasma/Serum{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Sodium from Blood Gas{{{SINGLE-QUOTE}}})
and o.Requesteddtm >= " || sql(PerformedDTTM) || "
and o.RequestedDtm <= " || sql(PerformedDTTM_4hrsRound2wholehr) || "
and o.orderstatuscode not like {{{SINGLE-QUOTE}}}can%{{{SINGLE-QUOTE}}} and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "};
if ((Chk4ValidOrder is null) and (PerformedDTTM_4hrsRound2wholehr > now)) then
reordername := "Sodium Plasma/Serum";
reorderpiority := "Scheduled Time";
reqdate := (extract year PerformedDTTM_4hrsRound2wholehr) || "-" || ((extract month PerformedDTTM_4hrsRound2wholehr) formatted with "%0.2d")
|| "-" || ((extract day PerformedDTTM_4hrsRound2wholehr) formatted with "%0.2d");
ReqTimeHR := (extract hour PerformedDTTM_4hrsRound2wholehr);
ReqTimeMin := ((extract minute PerformedDTTM_4hrsRound2wholehr) formatted with "%0.2d");
LowSodiumValueEntered := true;
endif;
endif;
//END OF RESULTVALUENUMERIC > 2 IF STATEMENT
endif;
// Order and Error Destinations
DiagnosticOrder_dest := destination { ObjectsPlus } with
[ alert_type := "Warning",
short_message := "Object created by MLM",
priority := "low",
scope := "chart",
rule_group := "Order Object",
rule_number := 2010 ];
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 := 1003,
Rule_subgroup := "",
Send_alert_with_order := "",
Alert_dialog_settings := "",
Display_alert := true ];
// Build some preliminary objects
if ((LowSodiumValueEntered = true) and (validpatient)) then
try
SessionType := "Standard";
SessionReason := "";
RequestedBySource := "Standing Order";
OrderCreationReason := "Automatically created by MLM";
RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( ReqByGUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} ); //Int64
Location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
ClientVisit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
endtry;
// Failed to build preliminary objects - Dispose
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;
if ( Location_obj is NOT NULL ) then void:= call Location_obj.Dispose; Location_obj:= null; endif;
endcatch;
// Build the order object
try
//Catalog_Item_Name := "CPK Isoenzymes";
diagnostic_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with reordername;
DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
with
ClientVisit_obj, // ClientVisit ObjectsPlus object
diagnostic_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
OrderCreationReason, // CreateReason
RequestedBy_obj, // RequestedBy ObjectsPlus object
RequestedBySource, // string RequestedBySource (must be in dictionary)
SessionType, // string SessionType
SessionReason, // string SessionReason
Location_obj, // Location ReleaseLocGrpID
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
// Populate the Requested Time field
DiagnosticOrder_obj.RequestedDate := reqdate;
ReqTime_obj := new net_object {{{SINGLE-QUOTE}}}RequestedTime{{{SINGLE-QUOTE}}};
ReqTime_obj.CodedTime := reorderpiority;
time_obj := new net_object {{{SINGLE-QUOTE}}}Time{{{SINGLE-QUOTE}}} with (ReqTimeHR As Number) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, (ReqTimeMin As Number) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}};
ReqTime_obj.time := time_obj;
retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldVisible{{{SINGLE-QUOTE}}} with "RequestedTime",true;
retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "RequestedTime",false;
DiagnosticOrder_obj.RequestedTime := ReqTime_obj;
retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "LAB_Info Summary",false;
retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
"LAB_Info Summary", "Repeat Per Sodium Protocol" ;
retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "LAB_Info Summary",true;
DiagnosticOrder_dest.ObjectsPlus := DiagnosticOrder_obj;
endtry;
// Failed to build the order object and make the order - Return error and dispose
catch Exception ex
error_occurred := true;
error_message := error_message || "{{+R}}New diagnostic order:{{-R}}\n" || ex.Message || "\n\n";
if ( diagnostic_catalog_item is NOT NULL ) then void:= call diagnostic_catalog_item.Dispose; diagnostic_catalog_item:= null; endif;
if ( DiagnosticOrder_obj is NOT NULL ) then void:= call DiagnosticOrder_obj.Dispose; DiagnosticOrder_obj:= null; endif;
DiagnosticOrder_dest := null;
endcatch;
// Dispose
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;
if ( Location_obj is NOT NULL ) then void:= call Location_obj.Dispose; Location_obj:= null; endif;
endif;
;;
priority: 90
;;
evoke:
5 seconds after time of observation_enter_event;
;;
logic:
if(validpatient) then
conclude true;
else
conclude false;
endif;
;;
action:
if Error_occurred
then
write "An error has occured in the MLM {{+B}}SCH_CREATE_SODIUM_FROM_RESULT{{-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 "1. " || error_message at error_destination;
endif;
if EXISTS DiagnosticOrder_dest then
write true at DiagnosticOrder_dest;
endif;
;;
Urgency: 50;;
end: