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,373 @@
maintenance:
title: SCH_CHARTED_HALDOL_24HRS;;
mlmname: SCH_CHARTED_HALDOL_24HRS;;
arden: version 2.50;;
version: 5.50;;
institution: St. Clair Hospital;;
author: Shawn Head, Allscripts Corp;;
specialist: Dean Miklavic;;
date: 2016-04-07;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
04.07.2016 STH CSR #33207 Created to update the IV Haldol dosage given over the last 24 hours from last time IV Haldol was given. {Go-Live 6/1/2016}
06.02.2016 STH CSR #33207 CA service desk #: 2192254 - Correct issue so the MLM only updates the columns when IV haldol is being charted. There was logic that was still updating the columns
even if the task that was give was for a route of PO. Added an qulaifying IF statement to look at route first, and only when the route being given contains IV will the
MLM fire now.
;;
keywords: ObjectsPlus/XA, Order
;;
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}}};
create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
include standard_libs;
//Error Handling vars for ObjectsPlus Method calls
error_occurred := false;
error_message := "";
log_execution_info := false;
/*
//--------------------------------------------------------------------
if called_by_editor then
EvokingObject := read last {OrderTaskOccurrence: THIS
where TaskName Matches Pattern "%Haloperidol%" and orderguid = "9001409616300680"};
endif;
*/
//Event Triggers
any_modified_task:= event {OrderTaskOccurrenceModify
Any OrderTaskOccurrence:
WHERE TaskName Matches Pattern "%Haloperidol%" };
userguid :=read last {UserInfo: guid};
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
TS := 9 FORMATTED WITH "%c";
CRLF:= CR||LF;
//---------------------------------------------------------------
// 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 := 1001,
Rule_subgroup := "",
Send_with_order := "",
Alert_dialog_settings := "",
Display_alert := true ];
//Retrieve Client Visit GUID
TaskName,TaskDose, TaskStatusCode,orderguid ,significantdtm,taskoccuranceguid ,taskguid, routecode := read last {OrderTaskOccurrence: TaskName,TaskDose, TaskStatusCode,OrderGUID, SignificantDtm, guid, OrderTaskGUID, TaskRouteCode REFERENCING EvokingObject};
colUpdate := false;
if(routecode matches pattern "%IV%") then
(ClientVisitGUID, ClientGUID, ChartGUID, LocationGUID) := read last { " select cv.guid, cv.clientguid, cv.chartguid, cv.CurrentLocationGUID from cv3clientvisit cv with (nolock)
inner join cv3order o with (nolock) on cv.ClientGUID = o.clientguid and cv.ChartGUID = o.chartguid
and cv.guid = o.clientvisitguid where o.guid = " || SQL(orderguid)};
(ProviderGUID) := read last { " select ProviderGUID from CV3CareProviderVisitRole
where clientguid = " || sql(ClientGUID)
|| " and ClientVisitGUID = " || sql(ClientVisitGUID)
|| " and rolecode = {{{SINGLE-QUOTE}}}Attending{{{SINGLE-QUOTE}}}
and status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} " };
Unit := read last { " select name from cv3location where guid = " || sql(LocationGUID) };
Haldol_24hr_Dosage := read last { " select *
into #tmp_orders
from cv3order o with (nolock)
where o.ClientGUID = " || sql(ClientGUID)
|| " and o.chartguid = " || sql(chartGUID)
|| " and o.clientvisitguid = " || sql(ClientVisitGUID)
|| " and o.name like {{{SINGLE-QUOTE}}}%Haloperidol%{{{SINGLE-QUOTE}}}
select isnull(sum(cast(isnull(oto.taskdose,0) as float)),0) as {{{SINGLE-QUOTE}}}total_dosage_24hrs{{{SINGLE-QUOTE}}} from #tmp_orders o with (nolock)
inner join CV3OrderTaskOccurrence oto with (nolock)
on o.clientguid = oto.clientguid and o.guid = oto.OrderGUID
where oto.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}}
and oto.TaskRouteCode like {{{SINGLE-QUOTE}}}%IV%{{{SINGLE-QUOTE}}}
and oto.PerformedFromDtm >= DATEADD(hh,-24,GETDATE()) " };
try
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
WSSessionType := "Standard";
WSSessionReason := "";
WSRequestedBySource := "Protocol Order";
EntDefinedColumn_obj := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName
with ( client_visit_obj, "Haldol Total");
WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((ProviderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((LocationGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
endtry;
catch Exception ex
error_occurred := true;
error_message := "{{+R}}Common Data:{{-R}}\n" ||
ex.Message || "\n\n";
if ( client_visit_obj is NOT NULL ) then
void:= call client_visit_obj.Dispose;
client_visit_obj:= null;
endif;
if ( WSRequestedBy_obj is NOT NULL ) then
void:= call WSRequestedBy_obj.Dispose;
WSRequestedBy_obj:= null;
endif;
if ( WSlocation_obj is NOT NULL ) then
void:= call WSlocation_obj.Dispose;
WSlocation_obj:= null;
endif;
if ( EntDefinedColumn_obj is NOT NULL) then
void := call EntDefinedColumn_obj.Dispose;
EntDefinedColumn_obj := null;
endif;
endcatch;
reset_taskdose := 0;
if((Haldol_24hr_Dosage is null) or Haldol_24hr_Dosage = "" or Haldol_24hr_Dosage = 0) then
if(taskstatuscode = "Performed") then
abcxyz := "step1";
Haldol_24hr_Dosage := (taskdose as number);
else
abcxyz := "step2";
Haldol_24hr_Dosage := 0;
endif;
else
if(taskstatuscode = "Performed") then
abcxyz := "step3";
Haldol_24hr_Dosage := (Haldol_24hr_Dosage as number) + (taskdose as number);
else
abcxyz := "step4";
reset_taskdose := read last { " select taskdose from CV3OrderTaskOccurrence with (nolock)
where
clientguid = " || sql(ClientGUID)
|| " and orderguid = " || sql(orderguid)
|| " and OrderTaskGUID = " || sql(taskguid)
|| " and guid = " || sql(taskoccuranceguid) };
Haldol_24hr_Dosage := (Haldol_24hr_Dosage as number) - (reset_taskdose as number);
endif;
endif;
Haldol_24hr_Dosage := Haldol_24hr_Dosage formatted with "%.2f";
ColUpdateValue := "";
colUpdate := false;
createorders := ();
CreateMonitorOrder := false;
CreateTransferOrder := false;
currentvalue := EntDefinedColumn_obj.Value;
FindAstrick := find "*" in string currentvalue;
testvale := read last { " select replace(" || sql(currentvalue) || ",char(9),{{{SINGLE-QUOTE}}}--{{{SINGLE-QUOTE}}}) " };
FindTS := find "--" in string testvale;
if((Haldol_24hr_dosage as number) >= 0.00) then
colUpdate := true;
CurVal := Haldol_24hr_dosage;
if((FindAstrick>0) and (taskstatuscode="Performed"))then
ColUpdateValue := (CurVal as string) || "*";
elseif(FindTS>0) then
ColUpdateValue := (CurVal as string) || TS;
elseif(((Haldol_24hr_dosage as number) >= 2.00)) then
ColUpdateValue := (CurVal as string) || "*";
else
ColUpdateValue := (CurVal as string);
endif;
if((Haldol_24hr_dosage as number) >= 2.00) then
(MonitorOrderGUID, TransferOrderGUID) := read last { " select (select guid from cv3order o with (nolock)
where o.ClientGUID = " || sql(ClientGUID)
|| " and o.chartguid = " || sql(ChartGUID)
|| " and o.clientvisitguid = " || sql(ClientVisitGUID)
|| " and o.name = ({{{SINGLE-QUOTE}}}Monitor: Cardiac{{{SINGLE-QUOTE}}})
and o.orderstatuscode not in ({{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HISDP{{{SINGLE-QUOTE}}}))
,
(select guid from cv3order o with (nolock)
where o.ClientGUID = " || sql(ClientGUID)
|| " and o.chartguid = " || sql(ChartGUID)
|| " and o.clientvisitguid = " || sql(ClientVisitGUID)
|| " and o.name = ({{{SINGLE-QUOTE}}}Transfer-Monitored Bed{{{SINGLE-QUOTE}}})
and o.orderstatuscode not in ({{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HISDP{{{SINGLE-QUOTE}}})) " };
if(MonitorOrderGUID is null) then
createorders := createorders, "Monitor: Cardiac";
if(Unit in ("5F","5A","5G") and TransferOrderGUID is null) then
//void := call create_order with (ClientVisitGUID,UserGuid,ClientGUID,"Standard","Protocol Order","Transfer-Monitored Bed","IV Haloperidol Protocol","Other");
createorders := createorders, "Transfer-Monitored Bed";
endif;
endif;
endif;
endif;
for x in (1 seqto(count(createorders))) do
//order_Name := createorders[x];
order_Creation_Reason := "Protocol Order" ;
WSRequestedBySource := "Protocol Order";
order_Name := createorders[x];
try
Catalog_Item_Name := createorders[x];
order_type := "other";
modifier := "";
modversion := "";
order_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
with Catalog_Item_Name;
GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
with client_visit_obj,
order_catalog_item,
order_Creation_Reason,
WSRequestedBy_obj,
WSRequestedBySource,
WSSessionType,
WSSessionReason,
WSlocation_obj,
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
if (Order_catalog_item.Name in ("Monitor: Cardiac","Transfer-Monitored Bed")) then
GeneralOrder_obj.SpecialInstructions := "IV Haldol Protocol";
GeneralOrder_obj.RequestedTime := "Now";
endif;
if( GeneralOrder_obj is NOT NULL ) then
void := call GeneralOrder_Obj.Save;
void := call GeneralOrder_Obj.Dispose;
endif;
endtry;
catch Exception ex
error_occurred := true;
error_message := "{{+R}}New General order:{{-R}}\n" ||
ex.Message || "\n\n";
endcatch;
if ( Order_catalog_item is NOT NULL ) then
void:= call Order_catalog_item.Dispose;
Order_catalog_item:= null;
endif;
enddo;
endif;
;;
priority: 50
;;
evoke:
any_modified_task;
;;
logic:
if (EvokingObject is null) then
conclude false;
endif;
//Boolean to update TICU Status Board column true, continue with logic
if (colUpdate = true) then
try
EntDefinedColumn_obj.Value := ColUpdateValue;
void := call EntDefinedColumn_obj.Save;
void := call EntDefinedColumn_obj.Dispose;
EntDefinedColumn_obj := null;
endtry;
catch Exception ex
error_occurred := true;
error_message := error_message || "{{+R}}Enterprise Patient List Column{{-R}}\n"
|| ex.message || "\n\n";
if ex.InnerException is not null net_object then
error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
endif;
if (EntDefinedColumn_obj is not null) then
void := call EntDefinedColumn_obj.Dispose;
EntDefinedColumn_obj := null;
endif;
EDColumn_Dest := null;
endcatch;
if ( client_visit_obj is NOT NULL ) then
void:= call client_visit_obj.Dispose;
client_visit_obj:= null;
endif;
if ( WSRequestedBy_obj is NOT NULL ) then
void:= call WSRequestedBy_obj.Dispose;
WSRequestedBy_obj:= null;
endif;
if ( WSlocation_obj is NOT NULL ) then
void:= call WSlocation_obj.Dispose;
WSlocation_obj:= null;
endif;
if ( EntDefinedColumn_obj is NOT NULL) then
void := call EntDefinedColumn_obj.Dispose;
EntDefinedColumn_obj := null;
endif;
endif;
conclude true;
;;
action:
//Error Handling
if error_occurred then
write "An error occurred in the MLM {{+B}}SCH_CHARTED_HALDOL_24HRS{{-B}} "
|| " Please notify your system administrator 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;
;;
Urgency: 50;;
end: