Initial Checking with all 820 MLMs
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_48_HOUR_ANTIBIOTIC_REVIEW_COLUMN_UDPATE;;
|
||||
mlmname: SCH_48_HOUR_ANTIBIOTIC_REVIEW_COLUMN_UPDATE;;
|
||||
arden: version 2.50;;
|
||||
version: 16.30;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Juliet M. Law, Allscripts Corp, x7461;;
|
||||
specialist: Peggy Karish, Allscripts Corp, x7441;;
|
||||
date: 2018-02-20;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Add value to Enterprise Defined Column on 48 Hour Antibiotic Review Patient List when an ID Consult Order is entered on a patient.
|
||||
|
||||
;;
|
||||
|
||||
explanation: The pharmacy maintains a custom visit list that contains patients that are currently admitted for a minimum of 48 hours and
|
||||
are being administered a subset of antibiotic medications. This MLM will update an Enterprised Defined Column with "YES"
|
||||
or "NO" based on the existence of an ID Consult order on the patient{{{SINGLE-QUOTE}}}s chart.
|
||||
Valid Values:
|
||||
"YES" = active ID Consult order.
|
||||
"NO" = completed / discontinued ID consult order.
|
||||
Blank = No ID Consult order.
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
02.20.2018 JML CSR 35297 Created
|
||||
|
||||
;;
|
||||
keywords: ObjectsPlus/XA, Infectious, Enterprise Defined Column
|
||||
|
||||
;;
|
||||
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}}};
|
||||
include standard_libs;
|
||||
|
||||
//Include parsing MLM
|
||||
//str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
||||
|
||||
//Include generic function to update enterprise defined column
|
||||
create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
|
||||
|
||||
log_execution_info := false;
|
||||
update_column := false;
|
||||
consult_doctor := "";
|
||||
excess_chars := 0;
|
||||
trimmed_doc := "";
|
||||
ID_Col_Value := "";
|
||||
|
||||
//Create Enterprise Defined Column Obj
|
||||
EDCObj := OBJECT [
|
||||
column_name,
|
||||
column_value,
|
||||
client_guid,
|
||||
chart_guid,
|
||||
client_visit_guid
|
||||
];
|
||||
|
||||
//Event Triggers
|
||||
consult_order_enter := EVENT { OrderEnter User Order : WHERE Name = "Physician Consult" };
|
||||
consult_order_dc := EVENT { OrderDiscontinue User Order : WHERE Name = "Physician Consult" };
|
||||
consult_order_complete := EVENT { OrderComplete User Order : WHERE Name = "Physician Consult" };
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
if called_by_editor
|
||||
then
|
||||
EvokingObject := read last { Order : THIS };
|
||||
endif;
|
||||
|
||||
|
||||
//Retrieve relevant GUIDs
|
||||
ActiveClient_Visit_GUID := EvokingObject.ClientVisitGUID;
|
||||
ActiveClient_GUID := EvokingObject.ClientGUID;
|
||||
ActiveChart_GUID := EvokingObject.ChartGUID;
|
||||
|
||||
//Retrieve additional data items entered on Order
|
||||
OrderUserData_Obj := read last { Order : OrderUserData REFERENCING EvokingObject };
|
||||
|
||||
//Retrieve physician to be consulted
|
||||
consult_doctor := read last { OrderUserData : Value REFERENCING OrderUserData_Obj WHERE UserDataCode = "Obj_Plus_Consult" };
|
||||
|
||||
//Format physician name
|
||||
excess_chars := FIND "(" IN STRING ( consult_doctor as string );
|
||||
trimmed_doc := TRIM( SUBSTRING ( excess_chars - 1 ) CHARACTERS STARTING AT 1 FROM ( consult_doctor as string ) );
|
||||
|
||||
//Is physician to be consulted an ID doc?
|
||||
ID_Physician := read last { "SELECT 1 FROM CV3CareProvider cp WITH (NOLOCK) WHERE cp.TypeCode = {{{SINGLE-QUOTE}}}Physician{{{SINGLE-QUOTE}}} "
|
||||
|| " AND ( cp.Discipline = {{{SINGLE-QUOTE}}}Infectious Disease{{{SINGLE-QUOTE}}} OR cp.Discipline = {{{SINGLE-QUOTE}}}Infectious Diseases{{{SINGLE-QUOTE}}} ) "
|
||||
|| " AND cp.DisplayName = " || SQL(trimmed_doc) };
|
||||
|
||||
if ( exists ID_Physician ) then
|
||||
update_column := true;
|
||||
|
||||
if ( EvokingEvent = consult_order_enter ) then
|
||||
ID_Col_Value := "YES";
|
||||
elseif ( EvokingEvent = consult_order_dc OR EvokingEvent = consult_order_complete ) then
|
||||
ID_Col_Value := "";
|
||||
else
|
||||
ID_Col_Value := "";
|
||||
endif;
|
||||
endif;
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
consult_order_enter;
|
||||
consult_order_dc;
|
||||
consult_order_complete;
|
||||
;;
|
||||
logic:
|
||||
|
||||
if ( EvokingObject is null ) then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
|
||||
if ( update_column = true AND ( EvokingEvent = consult_order_enter OR EvokingEvent = consult_order_dc OR EvokingEvent = consult_order_complete ) ) then
|
||||
|
||||
ID_Consult_Col := NEW EDCObj WITH [
|
||||
column_name := "ID Consult",
|
||||
column_value := ID_Col_Value,
|
||||
client_guid := ActiveClient_GUID,
|
||||
chart_guid := ActiveChart_GUID,
|
||||
client_visit_guid := ActiveClient_Visit_GUID
|
||||
];
|
||||
|
||||
return_value := call create_ED_column with ( ID_Consult_Col );
|
||||
conclude true;
|
||||
/*
|
||||
elseif ( update_column = true AND EvokingEvent = user_logon ) then
|
||||
|
||||
//Loop through the Infectious Disease column values and update
|
||||
for j IN 1 seqto ( count infect_col_value ) do
|
||||
|
||||
Infect_Col := NEW EDCObj WITH [
|
||||
column_name := "Infectious Disease",
|
||||
column_value := infect_col_value[j],
|
||||
client_guid := infect_client_guid[j],
|
||||
chart_guid := "",
|
||||
client_visit_guid := infect_visit_guid[j]
|
||||
];
|
||||
|
||||
return_value := call create_ED_column WITH ( Infect_Col );
|
||||
enddo;
|
||||
|
||||
conclude true;
|
||||
*/
|
||||
endif;
|
||||
|
||||
;;
|
||||
action:
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
208
MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_COLUMN_UPDATE.mlm
Normal file
208
MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_COLUMN_UPDATE.mlm
Normal file
@@ -0,0 +1,208 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Access_Manager_Column_Update;;
|
||||
mlmname: SCH_Access_Manager_Column_Update;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: Eclipsys, Test MLM;;
|
||||
author: Dan Bredl;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2017-10-05;;
|
||||
validation: testing;;
|
||||
|
||||
|
||||
library:
|
||||
purpose: This MLM will Enterprise Defined Columns created for the SER system
|
||||
|
||||
|
||||
;;
|
||||
explanation: The columns will be updated by various registration triggers, client visit enter, client visit modify etc...
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
10.05.2017 DW CSR# 26413 Access Manager - Created
|
||||
01/16/2018 BB CSR# 26413 Access Manager - modififed the authorization search, as it changed locations in the database.
|
||||
08/17/2018 DW HD#3341738 Incomplete registration flag is set to "complete" by incoming "blood refusal" interface message (we should not be sending in interfaced ADT, but we are)
|
||||
09/27/2018 BB CSR# 36624 Access Manager Phase II - Added new entry for Consent Indicator, which returns if Conditions of Admission or Important Message from Medicare (IMM)
|
||||
or Emergency Medicine Consent to Treat has been filled out in Signature Capture and signed.
|
||||
10/15/2018 DW CSR# 37522 Optimize timed MLM{{{SINGLE-QUOTE}}}s - Modified the MLM for optimization.
|
||||
05/10/2019 BB CSR#37676 18.4 Upgrade resolution. Interfaces UserDisplayName is no longer used in this version, has now become {{{SINGLE-QUOTE}}}NPSCMServices{{{SINGLE-QUOTE}}}
|
||||
|
||||
|
||||
;;
|
||||
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;
|
||||
|
||||
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 ];
|
||||
|
||||
If called_by_editor then EvokingObject := read last { ClientVisit: This }; endif; // If called by the editor
|
||||
|
||||
SigCaptureFlagFormatted := " "; //[BB] Addition
|
||||
|
||||
// Evoking Events (Note: The ClientVisitModify is not evoked by all Access Manager updates.)
|
||||
|
||||
visit_enter_event := event{ClientVisitEnter Any ClientVisit};
|
||||
visit_modify_event:= event{ClientVisitModify Any ClientVisit};
|
||||
|
||||
(UserDisplayaName ) := read last { UserInfo: Displayname };
|
||||
|
||||
|
||||
if EvokingEventType = "ClientVisitEnter" or EvokingEventType = "ClientVisitModify"
|
||||
then
|
||||
(client_guid, chart_guid, client_visit_guid,New_Location) := read last {ClientVisit: clientguid, chartguid, guid,CurrentLocation REFERENCING EvokingObject};
|
||||
endif;
|
||||
|
||||
if EvokingEventType = "ClientVisitEnter" OR ( UserDisplayaName <> "Interface" AND evokingEventType = "ClientVisitModify" )
|
||||
THEN
|
||||
|
||||
CompleteRegistrationFlag := read last
|
||||
{"
|
||||
select case when vr.IsCompleteRegistration = 0
|
||||
or (avl.CurrentLocation = {{{SINGLE-QUOTE}}}er major{{{SINGLE-QUOTE}}} and vr.ModeOfArrivalID is null) or (avl.CurrentLocation <> {{{SINGLE-QUOTE}}}er major{{{SINGLE-QUOTE}}} and vr.AdmitSourceID is null)
|
||||
then {{{SINGLE-QUOTE}}} * {{{SINGLE-QUOTE}}}else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end
|
||||
from CV3ActiveVisitList avl with (nolock)
|
||||
join SXAAMVisitRegistration vr with (nolock) on vr.ClientVisitGUID = avl.GUID
|
||||
where avl.GUID = " || client_visit_guid || " AND avl.ClientGUID = " || client_guid || " and avl.ChartGUID = " || chart_guid || " "
|
||||
};
|
||||
|
||||
If not exists CompleteRegistrationFlag then CompleteRegistrationFlag := " "; endif; // If for some reason the 4 second delay is not enough
|
||||
|
||||
|
||||
InsuranceAuthorizationFlag := read last
|
||||
{"
|
||||
|
||||
select
|
||||
a.AuthNumber
|
||||
from SXAEDIAuthorization a with (nolock)
|
||||
JOIN SXAEDIAuthorizationPatientVisitXRef avp with (nolock) ON a.AuthorizationID = avp.AuthorizationID
|
||||
where avp.VisitGUID = " || client_visit_guid || " "
|
||||
};
|
||||
|
||||
|
||||
If not exists InsuranceAuthorizationFlag then InsuranceAuthorizationFlag := " "; endif; // If for some reason the 4 second delay is not enough
|
||||
|
||||
|
||||
// Create a Column Object for the Generic Enterprise Defined Column Creator MLM
|
||||
|
||||
|
||||
CreateColumnMLM := 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
|
||||
ColumnObj := OBJECT [column_name,column_value,client_guid,chart_guid,client_visit_guid]; // Create Enterprise Defined Column Obj
|
||||
|
||||
|
||||
// Update the Insurance Authorization Column
|
||||
|
||||
Auth_Column := NEW ColumnObj WITH
|
||||
[
|
||||
column_name := "Authorization",
|
||||
column_value := InsuranceAuthorizationFlag,
|
||||
client_guid := client_guid,
|
||||
chart_guid := chart_guid,
|
||||
client_visit_guid := client_visit_guid
|
||||
];
|
||||
return_value := call CreateColumnMLM with ( Auth_Column );
|
||||
|
||||
|
||||
// Update the Incomplete Registration Column
|
||||
|
||||
IncompleteRegistration_Column := NEW ColumnObj WITH
|
||||
[
|
||||
column_name := "Incomplete Registration",
|
||||
column_value := CompleteRegistrationFlag,
|
||||
client_guid := client_guid,
|
||||
chart_guid := chart_guid,
|
||||
client_visit_guid := client_visit_guid
|
||||
];
|
||||
return_value := call CreateColumnMLM with ( IncompleteRegistration_Column );
|
||||
|
||||
Endif;
|
||||
|
||||
|
||||
//If UserDisplayaName = "Interface" AND evokingEventType = "ClientVisitModify" //[BB] Interfaces userdisplayanme has changed for 18.4
|
||||
If UserDisplayaName matches pattern "%SCMServices%" AND evokingEventType = "ClientVisitModify"
|
||||
then
|
||||
|
||||
SigCaptureFlag := read
|
||||
{"
|
||||
select case when cd.documentname = {{{SINGLE-QUOTE}}}Conditions of Admission{{{SINGLE-QUOTE}}} Then {{{SINGLE-QUOTE}}}COA{{{SINGLE-QUOTE}}}
|
||||
WHEN cd.documentname = {{{SINGLE-QUOTE}}}Important Message from Medicare (IMM){{{SINGLE-QUOTE}}} Then {{{SINGLE-QUOTE}}}IMM{{{SINGLE-QUOTE}}}
|
||||
WHEN cd.documentname = {{{SINGLE-QUOTE}}}Emergency Medicine Consent to Treat{{{SINGLE-QUOTE}}} Then {{{SINGLE-QUOTE}}}EMCT{{{SINGLE-QUOTE}}}
|
||||
End
|
||||
from cv3clientdocumentCUR cd with (nolock)
|
||||
where cd.Active=1
|
||||
and cd.DocumentName in ({{{SINGLE-QUOTE}}}Conditions of Admission{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Important Message from Medicare (IMM){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Emergency Medicine Consent to Treat{{{SINGLE-QUOTE}}})
|
||||
AND cd.ClientVisitGUID = " || client_visit_guid || " AND cd.ClientGUID = " || client_guid || " AND cd.chartguid = " || chart_guid || " "
|
||||
};
|
||||
if exists SigCaptureFlag then
|
||||
|
||||
|
||||
|
||||
for i in 1 seqto count SigCaptureFlag DO
|
||||
SigCaptureFlagFormatted := SigCaptureFlagFormatted || SigCaptureFlag[i] || " / ";
|
||||
enddo;
|
||||
endif;
|
||||
|
||||
// Update the Admission Column
|
||||
CreateColumnMLM := 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
|
||||
ColumnObj := OBJECT [column_name,column_value,client_guid,chart_guid,client_visit_guid]; // Create Enterprise Defined Column Obj
|
||||
|
||||
|
||||
SigCap_Column := NEW ColumnObj WITH
|
||||
[
|
||||
column_name := "Consent Indicator",
|
||||
column_value := SigCaptureFlagFormatted,
|
||||
client_guid := client_guid,
|
||||
chart_guid := chart_guid,
|
||||
client_visit_guid := client_visit_guid
|
||||
];
|
||||
return_value := call CreateColumnMLM with ( SigCap_Column );
|
||||
|
||||
If not exists SigCaptureFlag then SigCaptureFlag := " "; endif; // If for some reason the 4 second delay is not enough
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
|
||||
priority: 50
|
||||
|
||||
;;
|
||||
|
||||
evoke:
|
||||
|
||||
// Note: Delays were added because the MLM was sometimes presdeing the creation or modification of the patient record. No data or the piror data was being returned.
|
||||
|
||||
4 seconds after time of visit_enter_event;
|
||||
4 seconds after time of visit_modify_event;
|
||||
|
||||
|
||||
;;
|
||||
|
||||
logic:
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
|
||||
action:
|
||||
|
||||
if Error_occurred
|
||||
then
|
||||
write "An error has occured in the MLM {{+B}}SCH_Access_Manager_Incomplete_Registration_Collumn_Update{{-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;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,165 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Access_Manager_Create_AdmittingDx_HealthIssue;;
|
||||
mlmname: SCH_Access_Manager_Create_AdmittingDx_HealthIssue;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Dan Bredl ;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2018-01-17;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Called from registraion event
|
||||
;;
|
||||
explanation: This MLM will create or replace an Admitting DX Health Issue each time a Compaint_ECLP health issue is created or replaced.
|
||||
|
||||
Change history
|
||||
|
||||
01.17.2018 DW CSR# 26413 Access Manager - Created
|
||||
02.02.2078 DW CSR# 26413 Access Manager - Adjusted the code to only discontinue/create the Admitting DX if the Compaint_ECLP text is different from that of the
|
||||
|
||||
;;
|
||||
keywords: Regsitration Event MLM
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
error_occurred := false;
|
||||
send_alert:= "DoNotSend";
|
||||
|
||||
mlm_alert := destination { Alert: warning, "MLM Alert", high, chart, "Registration Issue", 15042, send_alert, "" };
|
||||
|
||||
NewHealthIssue_dest := destination { ObjectsPlus } with [ alert_type := "Warning", short_message := "Object created by MLM", priority := "low", scope := "chart", rule_group := "Health Issue Object", rule_number := 2010 ];
|
||||
Discontinue_HealthIssue_dest := destination { ObjectsPlus } with [ alert_type := "Warning", short_message := "Object deleted by MLM", priority := "low", scope := "chart", rule_group := "Health Issue Object",rule_number := 2040 ];
|
||||
|
||||
alert_dest := destination { Alert: warning, "AdmDxCreateDiagnostics", high, chart, "AdmDxCreateDiagnostics", 15042, send_alert, "" };
|
||||
|
||||
|
||||
If called_by_editor then EvokingObject := read last { ClientVisit: This }; endif; // If called by the editor
|
||||
|
||||
visit_enter_event := event{ClientVisitEnter Any ClientVisit};
|
||||
visit_modify_event:= event{ClientVisitModify Any ClientVisit};
|
||||
(ClientGUID, ChartGUID, ClientVisitGUID) := read last {ClientVisit: clientguid, chartguid, guid REFERENCING EvokingObject};
|
||||
|
||||
// Gather the current Admitting Dx
|
||||
|
||||
(AdmittingDxguid,AdmittingDxText ) := read last
|
||||
{"
|
||||
select
|
||||
hid.guid , hid.shortname
|
||||
from CV3HealthIssueDeclaration as hid with (nolock)
|
||||
where hid.TypeCode = {{{SINGLE-QUOTE}}}Admitting DX{{{SINGLE-QUOTE}}} AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}
|
||||
and hid.ClientGUID = " || ClientGUID || " and hid.ChartGUID = " || ChartGUID || " and hid.ClientVisitGUID = " || ClientVisitGUID ||
|
||||
" "} ;
|
||||
|
||||
// Gather the newly filed Complaint_ECLP Dx
|
||||
|
||||
(ComplaintECLPText) := read last
|
||||
{"
|
||||
select
|
||||
hid.Description
|
||||
from CV3HealthIssueDeclaration as hid with (nolock)
|
||||
where hid.TypeCode = {{{SINGLE-QUOTE}}}Complaint_ECLP{{{SINGLE-QUOTE}}} and hid.Description is not null AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}
|
||||
and hid.ClientGUID = " || ClientGUID || " and hid.ChartGUID = " || ChartGUID || " and hid.ClientVisitGUID = " || ClientVisitGUID ||
|
||||
" "} ;
|
||||
|
||||
|
||||
// Proceed if the new Complaint_ECLP Health Issue has filed
|
||||
|
||||
// if exists ComplaintECLPText ( DW 02.02.2018 - added qualifiers to only proceed if the Compaint_ECLP HI value has changed (different from current Admitting DX) or this is the initial registration (no Admitting DX))
|
||||
|
||||
if exists ComplaintECLPText and (ComplaintECLPText <> AdmittingDxText or not exists AdmittingDxText)
|
||||
|
||||
then
|
||||
|
||||
// Delete the existing Admitting Dx if it exists (visit modification)
|
||||
|
||||
if exists AdmittingDxguid
|
||||
then
|
||||
Discontinue_HealthIssue_Obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( (AdmittingDxguid as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
empty := call Discontinue_HealthIssue_Obj.Discontinue;
|
||||
Discontinue_HealthIssue_dest.ObjectsPlus := Discontinue_HealthIssue_Obj;
|
||||
endif;
|
||||
|
||||
|
||||
// Create the Admitting Dx health issue using the Complaint_ECLP health issue verbiage
|
||||
|
||||
try
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred:= true;
|
||||
error_message := "{{+R}}Retrieve client:{{-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;
|
||||
endcatch;
|
||||
|
||||
try
|
||||
New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateNonCodedHealthIssue with (client_visit_obj, "Admitting Dx");
|
||||
New_HealthIssue_obj.Name := ComplaintECLPText;
|
||||
New_HealthIssue_obj.Text := ComplaintECLPText;
|
||||
NewHealthIssue_dest.ObjectsPlus := New_HealthIssue_obj;
|
||||
endtry;
|
||||
catch exception ex
|
||||
error_occurred := true;
|
||||
if ( New_HealthIssue_obj is NOT NULL ) then void:= call New_HealthIssue_obj.Dispose; New_HealthIssue_obj:= null; endif;
|
||||
NewHealthIssue_dest := null;
|
||||
endcatch;
|
||||
|
||||
|
||||
endif;
|
||||
|
||||
;;
|
||||
|
||||
|
||||
evoke:
|
||||
|
||||
// Note: Delay to allow the Complaint_ECLP HI to file
|
||||
|
||||
4 seconds after time of visit_enter_event;
|
||||
4 seconds after time of visit_modify_event;
|
||||
|
||||
;;
|
||||
|
||||
logic:
|
||||
Conclude true ;
|
||||
;;
|
||||
|
||||
action:
|
||||
|
||||
/*
|
||||
write " Messages " || " version 11 "
|
||||
|| "\n Evoking Event Type: " || EvokingEventType
|
||||
|| "\n Existing AdmittingDx Text: " || AdmittingDxText
|
||||
|| "\n New ComplaintECLP Text: " || ComplaintECLPText
|
||||
at alert_dest;
|
||||
*/
|
||||
|
||||
if error_occurred
|
||||
then
|
||||
write "An error has occured in the MLM {{+B}} SCH_Access_Manager_Create_AdmittingDx_HealthIssue {{-B}} Please notify your System Administrators that an error message has occurred message: \n" at mlm_alert;
|
||||
write error_message at mlm_alert;
|
||||
endif;
|
||||
|
||||
|
||||
if exists NewHealthIssue_dest
|
||||
then
|
||||
write TRUE at NewHealthIssue_dest;
|
||||
endif;
|
||||
|
||||
if exists Discontinue_HealthIssue_Dest
|
||||
then
|
||||
write TRUE at Discontinue_HealthIssue_Dest;
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,178 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Access_Manager_InsuranceID_Formatting;;
|
||||
mlmname: SCH_Access_Manager_InsuranceID_Formatting;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Dan Bredl ;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2017-06-05;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Called from registraion event
|
||||
;;
|
||||
explanation: This MLM will check the format of Insurance IDs
|
||||
|
||||
Change history
|
||||
|
||||
06.05.2017 DW CSR# 26413 Access Manager - Created
|
||||
01.30.2018 JML CSR# 26413 Access Manager - Modified to accept additional Medicare Insurance Number Formats
|
||||
02.14.2018 DW CSR# 26413 Access Manager - Modified to accept additional an additional 12 digit pattern
|
||||
03.28.2018 DW CSR# 36475 AMPFM upgrade - Comment out Medicare rules as new complex ones were introuduced on April 1. The registration department decided to remove all Medicare formatting edits for now
|
||||
|
||||
|
||||
;;
|
||||
keywords: Regsitration Event MLM
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
error_occurred := false;
|
||||
|
||||
send_alert:= "DoNotSend";
|
||||
mlm_alert := destination { Alert: warning, "Insurance Number Formatting Problem", high, chart, "Insurance Formatting MLM", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
insurance_enter_event := Event {InsuranceEnter ANY ClientVisit};
|
||||
insurance_modify_event:= Event {InsuranceModify ANY ClientVisit};
|
||||
|
||||
ClientUserData_Obj := read last { Insurance: ClientUserData REFERENCING EvokingObject };
|
||||
(CUD_User_Data_Code, CUD_Value ) := read last { ClientUserData: UserDataCode, Value REFERENCING ClientUserData_Obj };
|
||||
|
||||
InsuranceType := EVOKINGOBJECT.FRPName;
|
||||
InsuranceNumber := ClientUserData_Obj.value;
|
||||
InsuranceNumberLength := length (ClientUserData_Obj.value);
|
||||
InsuranceNumberPattern := "";
|
||||
MessageText := "OK";
|
||||
errormessage := " ";
|
||||
GenerateAlert := false;
|
||||
|
||||
// Medicaid Insurance
|
||||
|
||||
If InsuranceNumberLength < 10 and InsuranceType = "MEDICAID"
|
||||
then
|
||||
MessageText := " must be 10 characters in length. The number has " || InsuranceNumberLength || " characters.";
|
||||
else
|
||||
MessageText := "OK";
|
||||
|
||||
endif; // Medicaid
|
||||
|
||||
/*
|
||||
// Medicare Insurance
|
||||
|
||||
|
||||
If InsuranceType = "MEDICARE"
|
||||
then
|
||||
|
||||
for x in 1 seqto InsuranceNumberLength do
|
||||
|
||||
InsuranceCharacter := substring 1 characters starting at x from InsuranceNumber ;
|
||||
|
||||
if (InsuranceCharacter as number) is null
|
||||
then InsuranceCharacterType := "X";
|
||||
else InsuranceCharacterType := "9";
|
||||
endif;
|
||||
|
||||
InsuranceNumberPattern := InsuranceNumberPattern || InsuranceCharacterType ;
|
||||
|
||||
enddo;
|
||||
|
||||
If InsuranceNumberLength < 6 or InsuranceNumberLength > 12
|
||||
then
|
||||
MessageText := " must be between 6 and 12 characters in length. The number has " || InsuranceNumberLength || " characters.";
|
||||
elseif
|
||||
InsuranceNumberLength = 6
|
||||
then
|
||||
if InsuranceNumberPattern = "X99999"
|
||||
then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
|
||||
endif;
|
||||
elseif
|
||||
InsuranceNumberLength = 7
|
||||
then
|
||||
if InsuranceNumberPattern = "X999999" or InsuranceNumberPattern = "XX99999"
|
||||
then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
|
||||
endif;
|
||||
elseif
|
||||
InsuranceNumberLength = 8
|
||||
then
|
||||
if InsuranceNumberPattern = "X9999999" or InsuranceNumberPattern = "XX999999"
|
||||
then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
|
||||
endif;
|
||||
elseif
|
||||
InsuranceNumberLength = 9
|
||||
then
|
||||
if InsuranceNumberPattern = "X99999999" or InsuranceNumberPattern = "XX9999999"
|
||||
then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
|
||||
endif;
|
||||
elseif
|
||||
InsuranceNumberLength = 10
|
||||
then
|
||||
if InsuranceNumberPattern = "X999999999" or InsuranceNumberPattern = "XX99999999" or InsuranceNumberPattern = "999999999X" or InsuranceNumberPattern = "9999999999"
|
||||
then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
|
||||
endif;
|
||||
elseif
|
||||
InsuranceNumberLength = 11
|
||||
then
|
||||
// JML : Added insurance number patterns
|
||||
if InsuranceNumberPattern = "X9999999999" or InsuranceNumberPattern = "XX999999999" OR InsuranceNumberPattern = "999999999XX" OR InsuranceNumberPattern = "999999999X9"
|
||||
then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
|
||||
endif;
|
||||
elseif
|
||||
InsuranceNumberLength = 12
|
||||
then
|
||||
// JML : Added insurance number patterns 02/14/2018 DW : added pattern InsuranceNumberPattern = XXX999999999
|
||||
if InsuranceNumberPattern = "X99999999999" or InsuranceNumberPattern = "XX9999999999" or InsuranceNumberPattern = "XXX999999999" or InsuranceNumberPattern = "99999999999X" OR InsuranceNumberPattern = "9999999999XX"
|
||||
then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
|
||||
endif;
|
||||
else
|
||||
MessageText := "OK";
|
||||
endif;
|
||||
|
||||
endif; // Medicare
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// Format the error message if necessary
|
||||
|
||||
|
||||
If MessageText <> "OK"
|
||||
then
|
||||
GenerateAlert := true;
|
||||
errormessage := "The " || InsuranceType || " number" || MessageText || " Please correct this.";
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
evoke:
|
||||
|
||||
insurance_enter_event;
|
||||
insurance_modify_event;
|
||||
|
||||
|
||||
;;
|
||||
logic:
|
||||
Conclude true ;
|
||||
;;
|
||||
action:
|
||||
|
||||
|
||||
if GenerateAlert = true
|
||||
then
|
||||
write errormessage at mlm_alert;
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if error_occurred then
|
||||
write "An error has occured in the MLM {{+B}}SCH_Access_Manager_InsuranceID_Formatting {{-B}} " ||"Please notify your System Administrators that an error message has occurred message: \n" at mlm_alert;
|
||||
write messageText at mlm_alert;
|
||||
endif;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,147 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Access_Manager_Insurance_Carrier_B_Alert;;
|
||||
mlmname: SCH_Access_Manager_Insurance_Carrier_B_Alert;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: Eclipsys, Test MLM;;
|
||||
author: Dan Bredl;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2017-10-09;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: This MLM will alert the user when the visit level incsurance carrier name does not end in (B)
|
||||
|
||||
|
||||
;;
|
||||
explanation: The MLM will trigger when visit level insurance is modified. This MLM will only affect visits created prior to the SCM migration.
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
10.09.2017 DW CSR# 26413 Access Manager - Created
|
||||
|
||||
;;
|
||||
|
||||
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;
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
local_session := cds_session.local;
|
||||
|
||||
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 ];
|
||||
mlm_alert := destination { Alert: warning, "Insurance Data Alert", high, chart, "Registration Issue", 15042, send_alert, "" };
|
||||
|
||||
|
||||
insurance_modify_event := event{InsuranceModify User ClientVisit};
|
||||
(ClientGuid, ClientVisitGuid) := read last {Insurance: ClientGuid, ClientVisitGUID REFERENCING EvokingObject};
|
||||
|
||||
|
||||
// Only alert registration department users....and HIS
|
||||
|
||||
(UserGUID ) := read last { UserInfo: GUID };
|
||||
|
||||
(UserDepartment) := read last {"
|
||||
select ou.name
|
||||
from CV3User u with (nolock)
|
||||
join cv3organizationalunit ou on ou.guid = u.orgunitguid
|
||||
where " || UserGuid || " = u.guid
|
||||
"
|
||||
};
|
||||
|
||||
if (UserDepartment = "Registration Department" or UserDepartment = "Eclipsys Corporation")
|
||||
|
||||
then
|
||||
|
||||
// Search for visit level insurance that isn{{{SINGLE-QUOTE}}}t suffixed with "(B)"
|
||||
|
||||
InsuranceCarrierNonBGuid := read last
|
||||
{"
|
||||
select fc.guid
|
||||
from CV3FRPContract fc with (nolock)
|
||||
join CV3FRP f with (nolock) on f.GUID = fc.FRPGUID
|
||||
join SXAAMInsuranceCarrier ic with (nolock) on ic.InsuranceCarrierID = f.InsuranceCarrierID
|
||||
where fc.ClientGUID = " || ClientGuid || " and fc.ClientVisitGUID = " || ClientVisitGuid || " and
|
||||
fc.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} and charindex({{{SINGLE-QUOTE}}}(B){{{SINGLE-QUOTE}}},ic.name) = 0 "
|
||||
};
|
||||
|
||||
if EVOKINGOBJECT.GUID = InsuranceCarrierNonBGuid and EVOKINGOBJECT.Status = "Inactive"
|
||||
then
|
||||
local_session.SessionInsurancePlanBIssueCorrected := true;
|
||||
endif;
|
||||
|
||||
|
||||
// Evidence Box for MLM validation
|
||||
/*
|
||||
MessageWillDisplay := " "; if exists InsuranceCarrierNonBGuid and EVOKINGOBJECT.Status <> "Inactive" and local_session.SessionService is null then MessageWillDisplay:= " (display error message)"; endif;
|
||||
ThisIsTheBadInsurance:= " "; if EVOKINGOBJECT.GUID = InsuranceCarrierNonBGuid then ThisIsTheBadInsurance:= " *"; endif;
|
||||
|
||||
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
|
||||
"\n\n This Insurance :" || EVOKINGOBJECT.FRPName || MessageWillDisplay ||
|
||||
"\n\n This Status :" || EVOKINGOBJECT.Status ||
|
||||
"\n\n (NonB)Plan Guid :" || InsuranceCarrierNonBGuid ||
|
||||
"\n\n This GUID :" || EVOKINGOBJECT.GUID || ThisIsTheBadInsurance ||
|
||||
"\n\n Issue Resolved :" || local_session.SessionInsurancePlanBIssueCorrected ||
|
||||
" " , "Evidence","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
*/
|
||||
|
||||
If exists InsuranceCarrierNonBGuid and EVOKINGOBJECT.Status <> "Inactive" and local_session.SessionInsurancePlanBIssueCorrected is null
|
||||
then
|
||||
GenerateAlert:= true;
|
||||
errormessage := " This Account contains one or more insurances that need to be updated. " ||
|
||||
" \n\n All insurances should have a name ending with a suffix of (B) example: Medicaid PA(B) " ||
|
||||
" \n\n Please change insurance carrier. " ||
|
||||
" " ;
|
||||
endif;
|
||||
|
||||
|
||||
endif; // Is the user from the Registration or HIS department?
|
||||
|
||||
|
||||
|
||||
;;
|
||||
|
||||
priority: 50
|
||||
;;
|
||||
|
||||
evoke:
|
||||
|
||||
insurance_modify_event;
|
||||
;;
|
||||
|
||||
logic:
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
|
||||
action:
|
||||
|
||||
|
||||
if GenerateAlert = true
|
||||
then
|
||||
write errormessage at mlm_alert;
|
||||
endif;
|
||||
|
||||
|
||||
if Error_occurred
|
||||
then
|
||||
write "An error has occured in the MLM {{+B}}SCH_Access_Manager_Insurance_Carrier_B_Alert {{-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;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,121 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Access_Manager_Patient_Selection_Alert;;
|
||||
mlmname: SCH_Access_Manager_Patient_Selection_Alert;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Dan Bredl ;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2017-09-27;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Called from registraion event
|
||||
;;
|
||||
explanation: This MLM will check for the combined mrn flag
|
||||
|
||||
Change history
|
||||
|
||||
09.27.2017 DW CSR# 26413 Access Manager - Created
|
||||
01.30.2018 JML CSR# 26413 Access Manager - Modified Combined MRN SQL to filter out Inactive comments
|
||||
|
||||
;;
|
||||
keywords: Regsitration Event MLM
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
error_occurred := false;
|
||||
send_alert:= "DoNotSend";
|
||||
|
||||
CombinedMRN_ErrorMessage:= "";
|
||||
SecondAdmit_ErrorMessage:= "";
|
||||
|
||||
mlm_alert := destination { Alert: warning, "MLM Alert", high, chart, "MLM Issue", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
combinedmrn_alert := destination { Alert: warning, "Combined MRN Alert", high, chart, "Registration Issue", 15042, send_alert, "No Override Allowed" };
|
||||
twovisits_alert := destination { Alert: warning, "2nd Vist Same Day Alert", high, chart, "Registration Issue", 15042, send_alert, "" };
|
||||
|
||||
clientvisit_enter_event := Event {ClientVisitEnter ANY ClientVisit};
|
||||
|
||||
(ClientGuid, ChartGuid, ClientVisitGuid, VisitAdmitDtm) := read last {ClientVisit: clientguid, chartguid,guid,AdmitDtm REFERENCING EvokingObject};
|
||||
|
||||
|
||||
|
||||
// Generate error message if Combined MRN Comment is found
|
||||
|
||||
|
||||
CombinedMRNComment := read last
|
||||
{"
|
||||
select text from CV3CommentDeclaration with (nolock)
|
||||
where typecode = {{{SINGLE-QUOTE}}}MRN{{{SINGLE-QUOTE}}} and text like {{{SINGLE-QUOTE}}}additional%{{{SINGLE-QUOTE}}}
|
||||
and ClientGUID = " || ClientGuid || "
|
||||
AND Active = 1
|
||||
AND Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}
|
||||
"};
|
||||
|
||||
PrimaryMRN := substring 7 characters starting at (length(CombinedMRNComment)-10) from CombinedMRNComment ;
|
||||
|
||||
If exists CombinedMRNComment
|
||||
then
|
||||
CombinedMRN_ErrorMessage := "You have selected the patients secondary medical record number." || " \n\n Please create the account using " || PrimaryMRN || " ";
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// Generate error message if other visists are scheduled for the same day
|
||||
|
||||
|
||||
VisitAdmitDtmString := VisitAdmitDtm as string;
|
||||
VisitAdmitDtmStringDate:= substring 10 characters from VisitAdmitDtmString; // date only
|
||||
|
||||
OtherVisitAdmitDates := read last
|
||||
{"
|
||||
select substring (VisitIDCode,1,7)
|
||||
from cv3clientvisit
|
||||
where ClientGUID = " || ClientGuid || " and convert(char (10),AdmitDtm,110) = {{{SINGLE-QUOTE}}}" || VisitAdmitDtmStringDate || "{{{SINGLE-QUOTE}}} and VisitStatus <> {{{SINGLE-QUOTE}}}CAN{{{SINGLE-QUOTE}}} "
|
||||
};
|
||||
|
||||
If exists OtherVisitAdmitDates
|
||||
then
|
||||
SecondAdmit_ErrorMessage := " A visit for this day already exists. Please review visit number " || OtherVisitAdmitDates || " and cancel duplicate account if need. ";
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
evoke:
|
||||
|
||||
clientvisit_enter_event;
|
||||
|
||||
;;
|
||||
logic:
|
||||
Conclude true ;
|
||||
;;
|
||||
action:
|
||||
|
||||
|
||||
if CombinedMRN_ErrorMessage <> ""
|
||||
then
|
||||
write CombinedMRN_ErrorMessage at combinedmrn_alert;
|
||||
endif;
|
||||
|
||||
|
||||
if SecondAdmit_ErrorMessage <> ""
|
||||
then
|
||||
write SecondAdmit_ErrorMessage at twovisits_alert;
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if error_occurred then
|
||||
write "An error has occured in the MLM {{+B}}SCH_Access_Manager_Patient_Selection_Alert {{-B}} " ||"Please notify your System Administrators that an error message has occurred message: \n" at mlm_alert;
|
||||
write messageText at mlm_alert;
|
||||
endif;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,98 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Access_Manager_Patient_Type_Change_Alert;;
|
||||
mlmname: SCH_Access_Manager_Patient_Type_Change_Alert;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Dan Bredl ;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2017-09-27;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Called from registraion event
|
||||
;;
|
||||
explanation: This MLM will check for the combined mrn flag
|
||||
|
||||
Change history
|
||||
|
||||
12.19.2017 DW CSR# 26413 Access Manager - Created
|
||||
|
||||
;;
|
||||
keywords: Regsitration Event MLM
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
error_occurred := false;
|
||||
send_alert:= "DoNotSend";
|
||||
|
||||
Transfer_ErrorMessage:= "";
|
||||
|
||||
mlm_alert := destination { Alert: warning, "MLM Alert", high, chart, "MLM Issue", 15042, send_alert, "No Override Allowed" };
|
||||
type_change_alert:= destination { Alert: warning, "Patient Type Change Alert", high, chart, "Registration Issue", 15042, send_alert, "" };
|
||||
|
||||
visit_modify:= event{ClientVisitModify User ClientVisit};
|
||||
|
||||
(ClientGuid, ChartGuid, ClientVisitGuid, VisitAdmitDtm) := read last {ClientVisit: clientguid, chartguid,guid,AdmitDtm REFERENCING EvokingObject};
|
||||
|
||||
|
||||
if called_by_editor
|
||||
then
|
||||
visit_obj := read last { ClientVisit: THIS }; EvokingObject := visit_obj; Bk_Loc_Name := "ER-2401"; Bk_Loc_GUid := "4000001081061001"; Bk_VisitStatus := "ADM"; Bk_TypeCode := "Inpatient";
|
||||
else
|
||||
|
||||
// Get the prior data
|
||||
|
||||
(backup_obj) := read last {ClientVisit: Backup REFERENCING EvokingObject};
|
||||
(Bk_Loc_Name, Bk_Loc_GUID, Bk_VisitStatus,Bk_TypeCode,Bk_TemporaryLocation) := read last {ClientVisit: CurrentLocation,CurrentLocationGUID,VisitStatus,TypeCode, TemporaryLocation REFERENCING backup_obj};
|
||||
|
||||
endif;
|
||||
|
||||
// Get the new data
|
||||
|
||||
(To_Loc_Name,To_Loc_GUID,To_VisitStatus,To_TypeCode,To_TemporaryLocation,VisitGuid, CurrentLocationGUID) := read last {ClientVisit: CurrentLocation,CurrentLocationGUID,VisitStatus,TypeCode,TemporaryLocation,guid, CurrentLocationGUID REFERENCING EvokingObject};
|
||||
|
||||
DashPostitionInLocationName := find "-" in string To_Loc_Name;
|
||||
|
||||
|
||||
// If the patient arrival is being cancelled, the location cannot be a bed (...location name has a dash)
|
||||
|
||||
If Bk_VisitStatus = "ADM" and To_VisitStatus = "PRE" and DashPostitionInLocationName <> 0
|
||||
then
|
||||
Transfer_ErrorMessage := "Patient is in a PRE Status - Please Select the Nursing Unit without a Room Number";
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
|
||||
evoke:
|
||||
visit_modify;
|
||||
;;
|
||||
|
||||
logic:
|
||||
Conclude true ;
|
||||
;;
|
||||
|
||||
action:
|
||||
|
||||
If Transfer_ErrorMessage <> ""
|
||||
then
|
||||
write Transfer_ErrorMessage at type_change_alert;
|
||||
endif;
|
||||
|
||||
|
||||
if error_occurred then
|
||||
write "An error has occured in the MLM {{+B}}SCH_Access_Manager_Patient_Type_Change_Alert {{-B}} " ||"Please notify your System Administrators that an error message has occurred message: \n" at mlm_alert;
|
||||
write messageText at mlm_alert;
|
||||
endif;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,101 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Access_Manager_Registration_Data_Compatibility_Check;;
|
||||
mlmname: SCH_Access_Manager_Registration_Data_Compatibility_Check;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Dan Bredl ;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2017-12-04;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Called from registraion event
|
||||
;;
|
||||
explanation: This MLM will check for compatibility of registration data
|
||||
|
||||
Change history
|
||||
|
||||
12.04.2017 DW CSR# 26413 Access Manager - Created
|
||||
02.06.2018 DW CSR# 26413 Access Manager - Limit Hospice Compatibilty to only Inpatients
|
||||
|
||||
;;
|
||||
keywords: Regsitration Event MLM
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
error_occurred := false;
|
||||
|
||||
local_session := cds_session.local;
|
||||
|
||||
send_alert:= "DoNotSend";
|
||||
mlm_alert := destination { Alert: warning, "Service / Insurance Compatibility Problem", high, chart, "Registration Issue", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
clientvisit_enter_event:= Event {ClientVisitEnter ANY ClientVisit};
|
||||
insurance_enter_event := Event {InsuranceEnter ANY ClientVisit};
|
||||
|
||||
|
||||
// Hospice Insurance/Service Edit Section
|
||||
|
||||
|
||||
if EvokingEventType = "ClientVisitEnter"
|
||||
then
|
||||
(ClientGuid, ChartGuid, ClientVisitGuid) := read last {ClientVisit: clientguid, chartguid,guid REFERENCING EvokingObject};
|
||||
service := read last {ClientVisit: serviceguid REFERENCING EvokingObject};
|
||||
ServiceDescription := read last {"select Description from CV3Service with (nolock) where guid = " || service || " " };
|
||||
local_session.SessionService := ServiceDescription;
|
||||
local_session.SessionPatientType := EVOKINGOBJECT.TypeCode;
|
||||
GenerateAlert := false;
|
||||
endif;
|
||||
|
||||
|
||||
if EvokingEventType = "InsuranceEnter"
|
||||
then
|
||||
(client_guid, client_visit_guid) := read last {Insurance: ClientGuid, ClientVisitGUID REFERENCING EvokingObject};
|
||||
|
||||
ClientUserData_Obj := read last { Insurance: ClientUserData REFERENCING EvokingObject };
|
||||
errormessage := " ";
|
||||
GenerateAlert := false;
|
||||
|
||||
|
||||
|
||||
If EVOKINGOBJECT.FRPName = "HOSPICE" and EVOKINGOBJECT.Status = "Active" and local_session.SessionService <> "HOSPICE" and local_session.SessionPatientType = "Inpatient" then GenerateAlert := true; errormessage := "\n\nThe patient has been registered with a Hospice insurance plan, but is not registered for Hospice service. Please correct this."; endif;
|
||||
If EVOKINGOBJECT.FRPName <> "HOSPICE" and EVOKINGOBJECT.Status = "Active" and local_session.SessionService = "HOSPICE" and local_session.SessionPatientType = "Inpatient" then GenerateAlert := true; errormessage := "\n\nThe patient is registered for Hospice Service but does not have a Hospice insurance plan. Please correct this."; endif;
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
evoke:
|
||||
|
||||
clientvisit_enter_event;
|
||||
insurance_enter_event;
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
Conclude true ;
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
if GenerateAlert = true
|
||||
then
|
||||
write errormessage at mlm_alert;
|
||||
endif;
|
||||
|
||||
|
||||
if error_occurred
|
||||
then
|
||||
write "An error has occured in the MLM {{+B}}SCH_Access_Manager_Registration_Data_Compatibility_Check {{-B}} " ||"Please notify your System Administrators that an error message has occurred message: \n" at mlm_alert;
|
||||
endif
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,302 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_ACCESS_MANAGER_SUICIDAL_OR_VIOLENT;;
|
||||
mlmname: SCH_ACCESS_MANAGER_SUICIDAL_OR_VIOLENT;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Peggy Karish;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2018-05-01;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Called from registraion event
|
||||
;;
|
||||
explanation: When a quick registration is entered, this MLM will present an alert when Suicide or Violence risk information is found in the chart.
|
||||
It will also update the Suicide Violence status board column
|
||||
|
||||
Change history
|
||||
|
||||
05.01.2018 DW CSR# 36510 Harm to Self or Others - Created
|
||||
07.03.2018 DW CSR# 36510 added this response which is configured in the Paient Profile "NA under 12 years of age". There is no comma after the "NA" as there is in the ED Triage Note.
|
||||
08.14.2018 DW CSR# 36510 Harm to Self or Others - Changes required for inpatient processes
|
||||
|
||||
;;
|
||||
keywords: Regsitration Event MLM
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
/*
|
||||
// Return break to a single user
|
||||
UserGUID := read last { UserInfo: GUID };
|
||||
UserName := read last {"select displayname from CV3User u with (nolock) where " || UserGuid || " = u.guid and displayname like {{{SINGLE-QUOTE}}}%warnick%{{{SINGLE-QUOTE}}} "};
|
||||
if exists username then break; endif;
|
||||
*/
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
error_occurred := false;
|
||||
send_alert:= "DoNotSend";
|
||||
|
||||
// Alert Destinations
|
||||
|
||||
mlm_alert := destination { Alert: warning, "MLM Alert", high, chart, "MLM Issue", 15042, send_alert, "No Override Allowed" };
|
||||
harm_alert:= destination { Alert: warning,"HARM / VIOLENCE ALERT", high, chart, "Registration Issue", 15042, send_alert, "" };
|
||||
|
||||
// Evoking Events
|
||||
|
||||
clientvisit_enter_event := event {ClientVisitEnter ANY ClientVisit};
|
||||
client_visit_modify := event {ClientVisitModify User ClientVisit};
|
||||
/*
|
||||
order_discontinue_event := event {OrderDiscontinue User Order: where Name = "SCO"};
|
||||
order_submit_event := event {OrderWorksheetSubmit User };
|
||||
|
||||
if EvokingEventType = "OrderWorksheetSubmit"
|
||||
then
|
||||
UnsubmittedSCO := read last { UNSUBMITTED Order: Name where Name = "SCO"}; // Determine if an SCO is amongst the orders
|
||||
endif;
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// Visit Enter/Modify Section
|
||||
|
||||
|
||||
If EvokingEventType = "ClientVisitEnter" or EvokingEventType = "ClientVisitModify"
|
||||
|
||||
then
|
||||
|
||||
PtArrival := "";
|
||||
(ClientGuid, ChartGuid, ClientVisitGuid) := read last {ClientVisit: clientguid, chartguid,guid REFERENCING EvokingObject};
|
||||
VisitRegistration_Obj := read last { ClientVisit: VisitRegistration REFERENCING EvokingObject };
|
||||
|
||||
// Determine it the Modify Event is a Patient Arrival
|
||||
|
||||
If EvokingEventType = "ClientVisitModify"
|
||||
then
|
||||
(backup_obj) := read last {ClientVisit: Backup REFERENCING EvokingObject};
|
||||
(Bk_VisitStatus) := read last {ClientVisit: VisitStatus REFERENCING backup_obj}; // Get the prior data
|
||||
(To_VisitStatus) := read last {ClientVisit: VisitStatus REFERENCING EvokingObject}; // Get the new data
|
||||
|
||||
if Bk_VisitStatus = "PRE" and To_VisitStatus = "ADM" then PtArrival:= "True"; endif;
|
||||
endif;
|
||||
|
||||
|
||||
// Proceed if Quick ED / Inpatient Registration / Observation Registration / Patient Arrival
|
||||
|
||||
|
||||
if (EvokingEventType = "ClientVisitEnter" and EVOKINGOBJECT.TypeCode = "Emergency" and VisitRegistration_Obj.IsCompleteRegistration = false) or
|
||||
(EvokingEventType = "ClientVisitEnter" and EVOKINGOBJECT.TypeCode = "Inpatient" and EVOKINGOBJECT.VisitStatus = "ADM") or
|
||||
(EvokingEventType = "ClientVisitEnter" and EVOKINGOBJECT.TypeCode = "Observation" and EVOKINGOBJECT.VisitStatus = "ADM") or
|
||||
(EvokingEventType = "ClientVisitModify" and EVOKINGOBJECT.TypeCode = "Inpatient" and PtArrival = "True") or
|
||||
(EvokingEventType = "ClientVisitModify" and EVOKINGOBJECT.TypeCode = "Observation" and PtArrival = "True")
|
||||
|
||||
then
|
||||
|
||||
|
||||
// Gather past history
|
||||
|
||||
|
||||
SignificantEvent := read
|
||||
{"
|
||||
select
|
||||
case when (c.OnsetYearNum is null and c.OnsetMonthNum is null) or (c.OnsetYearNum = 0 and c.OnsetMonthNum = 0) then cast (convert(char(10), c.CreatedWhen,20)as varchar)
|
||||
when c.OnsetYearNum is not null and c.OnsetYearNum <> 0 and c.OnsetMonthNum is not null and c.OnsetMonthNum <> 0 and c.OnsetDayNum is not null and c.OnsetDayNum <> 0 then cast (c.OnsetYearNum as varchar) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + cast (c.OnsetMonthNum as varchar) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + cast (c.OnsetDayNum as varchar)
|
||||
else
|
||||
case
|
||||
when c.OnsetYearNum is not null and c.OnsetMonthNum = 0 then cast (c.OnsetYearNum as varchar)
|
||||
when c.OnsetYearNum is not null and c.OnsetMonthNum > 0 then cast (c.OnsetYearNum as varchar) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + cast (c.OnsetMonthNum as varchar)
|
||||
end
|
||||
end +
|
||||
case when c.TypeCode = {{{SINGLE-QUOTE}}}Violence-Clinical Support Team{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}} - Flagged for Violence Caution by the Clinical Support Team (see significant event){{{SINGLE-QUOTE}}}
|
||||
when c.TypeCode = {{{SINGLE-QUOTE}}}Behavioral Health{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}} - Flagged by Mental Health for {{{SINGLE-QUOTE}}} + c.Description + {{{SINGLE-QUOTE}}} (see significant event){{{SINGLE-QUOTE}}}
|
||||
end
|
||||
+ {{{SINGLE-QUOTE}}}\n{{{SINGLE-QUOTE}}}
|
||||
from CV3ClientEventDeclaration c with (nolock)
|
||||
where c.TypeCode in ({{{SINGLE-QUOTE}}}Violence-Clinical Support Team{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Behavioral Health{{{SINGLE-QUOTE}}}) and c.status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} and c.ClientGUID = " || ClientGuid || "
|
||||
order by c.CreatedWhen
|
||||
"};
|
||||
|
||||
|
||||
SuidcideObservation := read
|
||||
{"
|
||||
SET CONCAT_NULL_YIELDS_NULL off
|
||||
select cast (convert(char(10), obsparam.RecordedDtm,20)as varchar) + {{{SINGLE-QUOTE}}} - {{{SINGLE-QUOTE}}} +
|
||||
case when ocmi.name = {{{SINGLE-QUOTE}}}SCH_PSY_Wish to be Dead{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Have you wished you were dead or wished you could sleep and not wake up?{{{SINGLE-QUOTE}}}
|
||||
when ocmi.name = {{{SINGLE-QUOTE}}}SCH_PSY_Suicidal Thoughts{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Have you actually had any thoughts of killing yourself?{{{SINGLE-QUOTE}}}
|
||||
when ocmi.name = {{{SINGLE-QUOTE}}}SCH_PSY_Suicide Behavior Question{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Have you ever done, started, prepared to end your life?{{{SINGLE-QUOTE}}}
|
||||
else ocmi.LeftJustifiedLabel + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + ocmi.RightJustifiedLabel
|
||||
end
|
||||
+ {{{SINGLE-QUOTE}}} - {{{SINGLE-QUOTE}}} + {{{SINGLE-QUOTE}}} ({{{SINGLE-QUOTE}}} + fs.Value + obsparam.ValueText +{{{SINGLE-QUOTE}}}){{{SINGLE-QUOTE}}}
|
||||
+ {{{SINGLE-QUOTE}}}\n{{{SINGLE-QUOTE}}}
|
||||
from CV3ObsCatalogMasterItem ocmi with (nolock)
|
||||
inner join SXACDObservationParameter obsparam with (nolock) on " || ClientGuid || " = obsparam.ClientGUID and obsparam.ObsMasterItemGUID = ocmi.GUID and obsparam.IsCanceled = 0
|
||||
left outer join SCMObsFSListValues fs with (nolock) on fs.ClientGUID = " || ClientGuid || " and ObsParam.ObservationDocumentGUID = fs.ParentGUID
|
||||
where
|
||||
(
|
||||
(
|
||||
ocmi.name like ({{{SINGLE-QUOTE}}}%hurt%{{{SINGLE-QUOTE}}}) or ocmi.name in ({{{SINGLE-QUOTE}}}SCH_PSY_Wish to be Dead{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_PSY_Suicidal Thoughts{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_PSY_Suicide Behavior Question{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}CAS psych suicide homicide ideation{{{SINGLE-QUOTE}}})
|
||||
)
|
||||
and fs.value not in ({{{SINGLE-QUOTE}}}no{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Not at all{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Unable to answer due to clinical condition{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}NA, under 12 years of age{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}NA under 12 years of age{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Unable to respond or under 12 years of age{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}neither{{{SINGLE-QUOTE}}})
|
||||
)
|
||||
or ocmi.name = {{{SINGLE-QUOTE}}}SCH_PSY_Columbia Risk Score{{{SINGLE-QUOTE}}} and obsparam.ValueText <> {{{SINGLE-QUOTE}}}No Risk{{{SINGLE-QUOTE}}}
|
||||
|
||||
order by obsparam.RecordedDtm desc
|
||||
"};
|
||||
|
||||
|
||||
|
||||
// Prepare the alert message
|
||||
|
||||
|
||||
Harm_ErrorMessage:= "";
|
||||
HarmText := "";
|
||||
|
||||
|
||||
// Concatenate the individual significant event items into a text variable (removes the commas)
|
||||
|
||||
If exists SignificantEvent
|
||||
then
|
||||
SignificantEventText:= "";
|
||||
for i in 1 seqto count SignificantEvent do
|
||||
SignificantEventText := SignificantEventText || SignificantEvent[i];
|
||||
enddo;
|
||||
|
||||
HarmText:= SignificantEventText;
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// Concatenate the individual suicide list items into a text variable (removes the commas)
|
||||
|
||||
If exists SuidcideObservation
|
||||
then
|
||||
SuidcideObservationText:= "";
|
||||
for i in 1 seqto count SuidcideObservation do
|
||||
SuidcideObservationText := SuidcideObservationText || SuidcideObservation[i];
|
||||
enddo;
|
||||
|
||||
if harmtext = ""
|
||||
then
|
||||
HarmText := SuidcideObservationText;
|
||||
else
|
||||
HarmText := HarmText || SuidcideObservationText;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// Return the alert and update the enterprise defined column
|
||||
|
||||
|
||||
If HarmText <> ""
|
||||
|
||||
then
|
||||
|
||||
|
||||
// Return the Alert
|
||||
|
||||
|
||||
Harm_ErrorMessage := "{{+B}}{{+R}} CAUTION {{-B}} {{-R}} " ||
|
||||
"\n\n{{+B}}{{+R}}The patient has a history of (or has expressed thoughts of) committing harm to self or others during past visits{{-B}}{{-R}}\n\n" || HarmText || " " ;
|
||||
|
||||
|
||||
// Update the Column
|
||||
|
||||
|
||||
create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}}; // MLM that creates the Enterprise Defined Column
|
||||
EDCObj := OBJECT [column_name,column_value,client_guid,chart_guid,client_visit_guid]; // Create Enterprise Defined Column Obj
|
||||
|
||||
if exists SuidcideObservation or exists SignificantEvent then columnvalue := "Yes"; // Past History
|
||||
else columnvalue := "."; // No Past History
|
||||
endif;
|
||||
|
||||
SuicideViolence_Column := NEW EDCObj WITH
|
||||
[
|
||||
column_name := "Suicide Violence Risk",
|
||||
column_value := columnvalue,
|
||||
client_guid := ClientGUID,
|
||||
chart_guid := ChartGUID,
|
||||
client_visit_guid := ClientVisitGUID
|
||||
];
|
||||
|
||||
return_value := call create_ED_column with ( SuicideViolence_Column );
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
endif; // Quick ED registtration evoke
|
||||
|
||||
|
||||
/*
|
||||
|
||||
// SCO Order Section
|
||||
|
||||
|
||||
|
||||
|
||||
elseif EvokingEventType = "OrderDiscontinue" or (EvokingEventType = "OrderWorksheetSubmit" and exists UnsubmittedSCO)
|
||||
|
||||
|
||||
then
|
||||
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid) := read last {ClientVisit: GUID, ChartGUID, ClientGUID};
|
||||
|
||||
// Update the Column
|
||||
|
||||
create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}}; // MLM that creates the Enterprise Defined Column
|
||||
EDCObj := OBJECT [column_name,column_value,client_guid,chart_guid,client_visit_guid]; // Create Enterprise Defined Column Obj
|
||||
|
||||
if EvokingEventType = "OrderWorksheetSubmit" then columnvalue := "Yes"; // New Order
|
||||
else columnvalue := "."; // D/C Order
|
||||
endif;
|
||||
|
||||
SuicideViolence_Column := NEW EDCObj WITH
|
||||
[
|
||||
column_name := "Suicide Violence Risk",
|
||||
column_value := columnvalue,
|
||||
client_guid := ClientGUID,
|
||||
chart_guid := ChartGUID,
|
||||
client_visit_guid := ClientVisitGUID
|
||||
];
|
||||
|
||||
return_value := call create_ED_column with ( SuicideViolence_Column );
|
||||
*/
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
;;
|
||||
evoke:
|
||||
|
||||
clientvisit_enter_event;
|
||||
client_visit_modify;
|
||||
/*
|
||||
order_submit_event;
|
||||
order_discontinue_event;
|
||||
*/
|
||||
;;
|
||||
logic:
|
||||
|
||||
Conclude true ;
|
||||
;;
|
||||
action:
|
||||
|
||||
|
||||
if Harm_ErrorMessage <> ""
|
||||
then
|
||||
write Harm_ErrorMessage at harm_alert;
|
||||
endif;
|
||||
|
||||
|
||||
if error_occurred then
|
||||
write "An error has occured in the MLM {{+B}} SCH_ACCESS_MANAGER_SUICIDAL_OR_VIOLENT {{-B}} " ||"Please notify your System Administrators that an error message has occurred message: \n" at mlm_alert;
|
||||
write messageText at mlm_alert;
|
||||
endif;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,171 @@
|
||||
maintenance:
|
||||
|
||||
title: Ordering: Generate MRSA order upon entry of Admit (for ED admits), Discharge, or Expire order;;
|
||||
mlmname: SCH_AdmitDischargeExpire_Order_Generate_MRSA_Order;;
|
||||
arden: version 2;;
|
||||
version: 5.00;;
|
||||
institution: St Clair;;
|
||||
author: Don Warnick, Allscripts Corp;;
|
||||
specialist: Teresa Spicuzza;;
|
||||
date: 2010-12-13;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Generate a MRSA order under certain conditions when a patient is discharged, expired, or admited from the ED
|
||||
;;
|
||||
explanation: When the patient is discharged or expired or admitted from the ED (if certain criteria are met) a MRSA test is required.
|
||||
|
||||
Change history
|
||||
|
||||
12.16.2010 DW Created
|
||||
07.07.2016 DW HD# 1744944 - Create a new order only if this the first admit (or discharge order)
|
||||
10.03.2016 STH CSR#: 35095 - Issue identified where patients that have an admit to inpatient or place in observation order entered days after their admission the logic
|
||||
was creating a new MRSA screen if the previous one was more than 24 hours in the past. The logic has been updated to not create a new MRSA screen
|
||||
if there is any active MRSA screen order already on the patients account.
|
||||
;;
|
||||
keywords: MRSA
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, VisitStatus) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, VisitStatus };
|
||||
(UserGUID ) := read last { UserInfo: GUID };
|
||||
|
||||
|
||||
discharge_expire_event := EVENT {OrderEnter User Order: WHERE Name in ("Discharge","Expired")};
|
||||
admit_event := EVENT {OrderEnter User Order: WHERE Name in ("Admit to Inpatient","Place in Observation")};
|
||||
|
||||
|
||||
// Retrieve Current Admit Orders
|
||||
|
||||
(admit_order) := read last
|
||||
{
|
||||
" select ocmi.name "
|
||||
|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
|
||||
|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid "
|
||||
|| " where "
|
||||
|| " o.clientguid = " || SQL (ClientGuid) || " and o.chartguid = " || SQL (ChartGuid) || " and o.clientvisitguid = " || SQL (ClientVisitGuid) || " and "
|
||||
|| " o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) and ocmi.name in ({{{SINGLE-QUOTE}}}Admit to Inpatient{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Place in Observation{{{SINGLE-QUOTE}}}) "
|
||||
};
|
||||
|
||||
// Retrieve Current Discharge Orders
|
||||
|
||||
(discharge_order) := read last
|
||||
{
|
||||
" select ocmi.name "
|
||||
|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
|
||||
|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid "
|
||||
|| " where "
|
||||
|| " o.clientguid = " || SQL (ClientGuid) || " and o.chartguid = " || SQL (ChartGuid) || " and o.clientvisitguid = " || SQL (ClientVisitGuid) || " and "
|
||||
|| " o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) and ocmi.name in ({{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Expired{{{SINGLE-QUOTE}}}) "
|
||||
};
|
||||
|
||||
|
||||
|
||||
MRSA_Rules_MLM := mlm {{{SINGLE-QUOTE}}}SCH_Func_MRSA_Order{{{SINGLE-QUOTE}}};
|
||||
(ScreeningUnit, OrderedToday, OrderedWithin3, Positivescreen, SignificantDTM, StatusCode, ResultValue, MRSAHistory, NursingHomeResidency, AntiInfectivewithin7)
|
||||
:= call MRSA_Rules_MLM with (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation);
|
||||
|
||||
|
||||
|
||||
If AntiInfectivewithin7 = "Yes" then ModifierVariable := "Ordered Per Protocol"; else ModifierVariable := "MRSA Screen Antibiotics"; endif;
|
||||
|
||||
|
||||
// This order is entered on an ED patient to be admitted
|
||||
|
||||
if EvokingEvent = admit_event then
|
||||
|
||||
if ((not exist admit_order) and (StatusCode is null) and (VisitStatus = "Adm") and ((NursingHomeResidency = "Yes") or (MRSAHistory = "Yes")))
|
||||
then Proceed := "Yes"; else Proceed := "No";
|
||||
endif;
|
||||
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
// This order is entered on an inpatients to be discharged or expired
|
||||
|
||||
if EvokingEvent = discharge_expire_event then
|
||||
|
||||
if VisitStatus = "Adm" and ScreeningUnit = "Yes" and orderedtoday = "No" and Positivescreen = "No" and orderedwithin3 = "No" and not exist discharge_order
|
||||
then Proceed := "Yes"; else Proceed := "No";
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
SessionType := "Standard";
|
||||
SessionReason := "";
|
||||
RequestingSource := "";
|
||||
user_IDType := "Edstan Number (physician)";
|
||||
order_Creation_Reason := "From Protocol";
|
||||
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
// user_IDCode := read last {"SELECT IDCode FROM CV3User " || " where GUID = " || UserGUID};
|
||||
user_IDCode := "infectioncontrol";
|
||||
RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
|
||||
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || ClientGUID};
|
||||
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
|
||||
;;
|
||||
evoke: admit_event or discharge_expire_event
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
if proceed = "Yes" then conclude true; else conclude false; endif;
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
if Proceed = "Yes" then
|
||||
|
||||
try
|
||||
Catalog_Item_Name := "Nasal Screen for MRSA (Infection Control)";
|
||||
Catalog_Item_Modifier := ModifierVariable;
|
||||
Catalog_Item_Version := "";
|
||||
Laboratory_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
|
||||
Parent_DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
Laboratory_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
||||
Catalog_Item_Modifier, // string ItemNameModifier
|
||||
Catalog_Item_Version, // string ItemNameModifierVersion
|
||||
order_Creation_Reason, // string CreateReason
|
||||
RequestingCareProvider_obj , // RequestedBy ObjectsPlus object
|
||||
RequestingSource, // 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
|
||||
|
||||
|
||||
if ( Laboratory_catalog_item is NOT NULL ) then
|
||||
void := call Parent_DiagnosticOrder_obj.Save;
|
||||
void := call Parent_DiagnosticOrder_obj.Dispose;
|
||||
void:= call Laboratory_catalog_item.Dispose;
|
||||
Laboratory_catalog_item:= null;
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex error_occurred := true; error_message := "{{+R}}New Parent Diagnostic order:{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
if ( Laboratory_catalog_item is NOT NULL ) then void:= call Laboratory_catalog_item.Dispose; Laboratory_catalog_item:= null; endif;
|
||||
if ( Parent_DiagnosticOrder_obj is NOT NULL ) then void:= call Parent_DiagnosticOrder_obj.Dispose; Parent_DiagnosticOrder_obj:= null; endif;
|
||||
|
||||
Parent_DiagnosticOrder_dest := null;
|
||||
|
||||
endcatch;
|
||||
|
||||
endif;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
933
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_ANTICOAGULANT_ORDERS.mlm
Normal file
933
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_ANTICOAGULANT_ORDERS.mlm
Normal file
@@ -0,0 +1,933 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_ALERT_ON_ANTICOAGULANT_ORDERS;;
|
||||
mlmname: SCH_ALERT_ON_ANTICOAGULANT_ORDERS;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: Allscripts;;
|
||||
author: Juliet M. Law;;
|
||||
specialist: Teresa Spicuzza;;
|
||||
date: 2011-07-25;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Generate alert if an anticoagulant order exists that conflicts with anticoagulant medication
|
||||
being ordered.
|
||||
;;
|
||||
explanation: When an order for an anticoagulant is requested, the MLM will check for an existing anticoagulant order.
|
||||
If one exists, then an alert will be generated informing the user that these two orders cannot coexist.
|
||||
The following anticoagulant medications report a conflict and generate a hard or soft stop alert:
|
||||
Soft Stop Alerts
|
||||
---------------------
|
||||
Lovenox -> Heparin IV
|
||||
Xarelto -> Warfarin
|
||||
|
||||
Hard Stop Alerts
|
||||
------------------------
|
||||
Lovenox -> Heparin SQ
|
||||
Lovenox -> Pradaxa
|
||||
Lovenox -> Xarelto
|
||||
Heparin IV -> Pradaxa
|
||||
Heparin IV -> Xarelto
|
||||
Heparin SQ -> Pradaxa
|
||||
Heparin SQ -> Xarelto
|
||||
Xarelto -> Pradaxa
|
||||
Pradaxa -> Xarelto
|
||||
Warfarin -> Xarelto
|
||||
|
||||
Change History:
|
||||
2012.08.19 JML Created
|
||||
2012.04.04 JML Added logic to capture unsubmitted anticoagulant orders and save to session variable
|
||||
so it can be checked on a Form called MLM
|
||||
2012.04.26 JML Added logic to include alerts for duplicate orders of Heparin IV, Heparin SQ, and Lovenox.
|
||||
2012.05.09 JML Changed Lovenox duplicate med alert to soft stop
|
||||
2012.05.16 JML Changed Heparin duplicate med alert to soft stop
|
||||
2013.04.09 JML Changed Heparin IV -> Pradaxa & Xarelto from a hard stop to a soft stop
|
||||
2013.05.01 JML CSR #31334: Added alerts for anticoagulant med additions Arixtra, Argatroban,
|
||||
and Eliquis
|
||||
2014.10.07 TMS CSR #32392: Added "Warfarin Orders" to the Warfarin_Orderset_Event declaration.
|
||||
2015.02.03 TMS Corrected name of Dabigatran order set to match catalog name. Ticket 1628100
|
||||
2015.09.24 TMS Added low intesity heparin protocol to logic. CSR 33670
|
||||
2016.03.21 JML CSR 33801: Added alert support for Post Op Cardiac Arrest Induced Hypothermia and
|
||||
Non-Formulary Orders order sets.
|
||||
2017.10.05 SZ CSR #35039: requested changes cause unnecessary alert fatigue in ordersets “Rivaroxaban” and “Apixaban”.
|
||||
I have added child orders to both ordersets with modifier "- Initial Dose" and "- Maintenance Dose"
|
||||
and inserted code in this MLM to prevent orders with those modifiers from firing.
|
||||
2018.05.31 JML CSR # 35994: Remove pradaxa, xarelto, and apixaban reorder events. This is to remove duplicate anticoagulant
|
||||
alerts that are firing when entering certain orders.
|
||||
2018.09.11 JML CSR # 37062, 36317: Include functional call to anticoagulant conflict check MLM
|
||||
2018.11.16 JML CSR # 37344/37345/37346: Added new DVT Anticoagulant Orders- Ortho Procedures order set; called from some
|
||||
ortho post op order sets.
|
||||
2019.02.12 JML WO# 3622425: Modified Heparin IV duplicate alert to display both order name and order set name for tPA for Pulmonary
|
||||
Embolism due to alert verbiage confusion.
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
//.Net libraries
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
//Local session object
|
||||
local_session := cds_session.local;
|
||||
|
||||
|
||||
//Include MLM to create Alert On Action object
|
||||
create_alert_on_action_obj := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_ALERT_ACTION_OBJECT{{{SINGLE-QUOTE}}};
|
||||
|
||||
/*******************************************************************/
|
||||
//Set to true if logging needed
|
||||
log_execution_info := false;
|
||||
|
||||
//Set the text for this variable to indicate whether to send the message or not
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
|
||||
//Set the stop message
|
||||
stop_message := false;
|
||||
soft_message := false;
|
||||
|
||||
//Set stop
|
||||
hard_stop := false;
|
||||
found_unsubmitted_orders := false;
|
||||
existing_orders := ();
|
||||
alert_priority := "High";
|
||||
include_generic_msg := true;
|
||||
include_trans_msg := false;
|
||||
|
||||
//Destination Object Properties
|
||||
alert_dialog := "Must Acknowledge";
|
||||
alert_message := "";
|
||||
alert_override_msg := "";
|
||||
ok_to_show_aoa := false;
|
||||
|
||||
|
||||
//Define list of anticoagulant medications
|
||||
(anticoagulant_meds) := READ {"SELECT ocmi.Name"
|
||||
|| " FROM CV3OrderCatalogMasterItem ocmi WITH (NOLOCK)"
|
||||
|| " WHERE ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}coagulation modifiers | anticoagulants{{{SINGLE-QUOTE}}}"
|
||||
|| " and ocmi.Name not like {{{SINGLE-QUOTE}}}zz%{{{SINGLE-QUOTE}}}"
|
||||
|| " ORDER BY ocmi.Name"};
|
||||
|
||||
(heparin_inj_meds) := (anticoagulant_meds WHERE anticoagulant_meds IN ("Heparin Inj",
|
||||
"Heparin Inj -",
|
||||
"Heparin Inj-",
|
||||
"Heparin Inj.") );
|
||||
|
||||
(heparin_iv_meds) := (anticoagulant_meds WHERE anticoagulant_meds matches pattern "Heparin%25,000%"
|
||||
OR anticoagulant_meds MATCHES PATTERN "Heparin%Infusion%");
|
||||
|
||||
(lovenox_meds) := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Enoxaparin%");
|
||||
|
||||
(pradaxa_meds) := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Dabigatran%");
|
||||
|
||||
(xarelto_meds) := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Rivaroxaban%");
|
||||
|
||||
(warfarin_meds) := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Warfarin%");
|
||||
|
||||
//CSR #31334: Leapfrog changes
|
||||
(arixtra_meds) := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Fondaparinux%");
|
||||
|
||||
(argatroban_meds) := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Argatroban%");
|
||||
|
||||
(apixaban_meds) := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Apixaban%");
|
||||
|
||||
|
||||
//Define Event Triggers for anticoagulant orders and order sets
|
||||
pradaxa_orderset_event := event{OrderSetInit User OrderSet :
|
||||
WHERE OrderSetName = "Dabigatran Orders"};
|
||||
|
||||
//******** CSR 35994: Remove reorder events JML ****************************************
|
||||
//Pradaxa Order to prevent reordering
|
||||
//pradaxa_reorder_event := event{OrderInit User Order :
|
||||
// WHERE Name matches pattern "Dabigatran%"};
|
||||
//pradaxa_reorder_event2 := event{OrderEnter User Order :
|
||||
// WHERE Name matches pattern "Dabigatran%"};
|
||||
|
||||
|
||||
lovenox_orderset_event := event{OrderSetInit User OrderSet :
|
||||
WHERE OrderSetName IN ("Enoxaparin"
|
||||
, "Blood Formation/Coagulation"
|
||||
, "Enoxaparin Inj - (Lovenox) 40mg, SQ Q24H"
|
||||
, "Enoxaparin Inj Orders - Post Op Shoulder"
|
||||
, "Enoxaparin Inj Orders - Post Op Hip"
|
||||
, "Enoxaparin Inj Orders - Post Op Knee"
|
||||
, "Enoxaparin Orders - Calculated Dose with CrCl (CPOE Only)")};
|
||||
|
||||
heparin_orderset_event := event{OrderSetInit User OrderSet :
|
||||
WHERE OrderSetName IN ("Weight Based Heparin Protocol (Initial)"
|
||||
,"Weight Based Heparin Protocol (Maint.)"
|
||||
,"Post Op Vascular Heparin (Initial)"
|
||||
,"Post Op Vascular Heparin (Maintenance)"
|
||||
,"Cardiac/CCM Heparin Protocol (Initial)"
|
||||
,"Cardiac/CCM Heparin Protocol (Maint)"
|
||||
,"Low Intensity Heparin Protocol (Init)"
|
||||
,"Low Intensity Heparin Protocol (Maint)"
|
||||
,"Retavase Therapy for AMI."
|
||||
,"Heparin (Vascular Orders) -"
|
||||
,"Hemodialysis Medications"
|
||||
,"Heparin IV Bolus (One Time Order Only)"
|
||||
,"Heparin Inj - SQ"
|
||||
,"ACS Orders"
|
||||
,"Blood Formation/Coagulation")};
|
||||
|
||||
xarelto_orderset_event := event{OrderSetInit User OrderSet :
|
||||
WHERE OrderSetName = "Rivaroxaban"};
|
||||
|
||||
//******** CSR 35994: Remove reorder events JML ****************************************
|
||||
//Xarelto Order to prevent reordering
|
||||
//xarelto_reorder_event := event{OrderInit User Order :
|
||||
// WHERE Name matches pattern "Rivaroxaban%"};
|
||||
//xarelto_reorder_event2 := event{OrderEnter User Order :
|
||||
// WHERE Name matches pattern "Rivaroxaban%"};
|
||||
|
||||
|
||||
warfarin_orderset_event := event{OrderSetInit User OrderSet :
|
||||
WHERE OrderSetName IN ("Warfarin Sliding Scale"
|
||||
,"Warfarin Tablet"
|
||||
,"Warfarin Orders"
|
||||
,"Warfarin Vial Injection")};
|
||||
|
||||
heparin_nonprotocol_event := event{OrderInit User Order :
|
||||
where typecode="Medication" and Name = "Heparin 25,000 Units + D5W 500ml"};
|
||||
heparin_nonprotocol_event2 := event{OrderEnter User Order :
|
||||
WHERE typecode = "Medication" and Name = "Heparin 25,000 Units + D5W 500ml"};
|
||||
|
||||
//CSR #31334: Leapfrog changes
|
||||
argatroban_order_event := event {OrderInit User Order :
|
||||
WHERE Name matches pattern "Argatroban%"};
|
||||
|
||||
apixaban_orderset_event := event {OrderSetInit User OrderSet :
|
||||
WHERE OrderSetName = "Apixaban"};
|
||||
|
||||
//******** CSR 35994: Remove reorder events JML ****************************************
|
||||
//apixaban_reorder_event := event {OrderInit User Order :
|
||||
// WHERE Name matches pattern "Apixaban%"};
|
||||
//apixaban_reorder_event2 := event {OrderEnter User Order :
|
||||
// WHERE Name matches pattern "Apixaban%"};
|
||||
|
||||
|
||||
|
||||
//These are the OS event triggers - secondary MLM FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK interacts with these events
|
||||
//within the OS themselves
|
||||
anticoag_os_event := event{OrderSetInit User OrderSet :
|
||||
WHERE OrderSetName matches pattern "VTE Prophylaxis%"
|
||||
OR OrderSetName IN ("CCM Admission Orders"
|
||||
,"Non Formulary Medications - Order Set"
|
||||
,"Total Knee Replacement Post Op Orders"
|
||||
,"Total Hip Replacement Post Op Orders"
|
||||
,"Fractured Hip Post Op Orders"
|
||||
,"Post Op Cardiac Arrest Induced Hypothermia"
|
||||
,"Post Op Shoulder"
|
||||
,"tPA (Alteplase) for the Treatment of Pulmonary Embolism (PE)"
|
||||
, "DVT Anticoagulant Orders- Ortho Procedures")};
|
||||
|
||||
//Destination
|
||||
order_alert_dest := destination {alert} with
|
||||
[alert_type := warning,
|
||||
short_message := "Anticoagulant Order Conflict",
|
||||
priority := alert_priority,
|
||||
scope := Chart,
|
||||
rule_group := "Anticoagulant Conflict Group",
|
||||
rule_number := 8000,
|
||||
send_with_order := send_alert,
|
||||
alert_dialog_settings := alert_dialog,
|
||||
display_alert := true];
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
|
||||
//Unit testing
|
||||
if called_by_editor then
|
||||
evokingobject := read last {OrderSet : THIS where OrderSetName matches pattern "Heparin Inj%"};
|
||||
endif;
|
||||
|
||||
//Capture current patient
|
||||
(clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
|
||||
clientVisitGuid := read last {ClientVisit : GUID};
|
||||
chartGuid := read last {ClientVisit : ChartGUID};
|
||||
|
||||
//Determine evoking event - grab order or order set object
|
||||
if (EvokingEvent = heparin_nonprotocol_event
|
||||
OR EvokingEvent = heparin_nonprotocol_event2
|
||||
//OR EvokingEvent = pradaxa_reorder_event
|
||||
//OR EvokingEvent = pradaxa_reorder_event2
|
||||
//OR EvokingEvent = xarelto_reorder_event
|
||||
//OR EvokingEvent = xarelto_reorder_event2
|
||||
//OR EvokingEvent = apixaban_reorder_event
|
||||
//OR EvokingEvent = apixaban_reorder_event2
|
||||
OR EvokingEvent = argatroban_order_event) then
|
||||
|
||||
(this_order_id, this_order) := read last {Order : GUID, Name Referencing EvokingObject};
|
||||
else
|
||||
(this_order_id, this_order) := read last {OrderSet : GUID, OrderSetName Referencing EvokingObject};
|
||||
endif;
|
||||
|
||||
//Check for unsubmitted anticoagulant orders
|
||||
(existing_orders, origOrderSet) := READ { UnsubmittedOrders: Name, OrderSetName
|
||||
WHERE Name matches pattern "Heparin Inj%"
|
||||
OR Name matches pattern "Heparin 25%"
|
||||
OR Name matches pattern "Heparin 25%"
|
||||
OR Name matches pattern "Enoxaparin%"
|
||||
OR Name matches pattern "Dabigatran%"
|
||||
OR Name matches pattern "Rivaroxaban%"
|
||||
OR Name matches pattern "Warfarin%"
|
||||
OR Name matches pattern "Fondaparinux%"
|
||||
OR Name matches pattern "Argatroban%"
|
||||
OR Name matches pattern "Apixaban%" };
|
||||
|
||||
//If triggering on unsubmitted orders, set boolean to true for logic to configure alert destination and
|
||||
// set local session var to the list of unsubmitted orders - local session var will be checked
|
||||
// in the OS conflict check
|
||||
|
||||
if ((exists (existing_orders)) AND (count(existing_orders) > 0)) then
|
||||
hard_stop := true;
|
||||
|
||||
if (EvokingEvent = anticoag_os_event) then
|
||||
local_session.SessionUnsubmittedAnticoagulantOrders := existing_orders;
|
||||
endif;
|
||||
|
||||
else
|
||||
//No unsubmitted anticoagulant order - check for existing anticoagulant active orders
|
||||
(existing_orders,
|
||||
origOrderSet) := read {"SELECT o.Name, o.OrderSetName, o.TouchedWhen"
|
||||
|| " FROM CV3Order as o with (nolock) JOIN CV3OrderCatalogMasterItem AS ocmi with (nolock)"
|
||||
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
|
||||
|| " WHERE o.ClientGUID = " || clientGuid
|
||||
|| " AND o.ClientVisitGUID = " || clientVisitGuid
|
||||
|| " AND o.ChartGUID = " || chartGuid
|
||||
|| " AND (o.Name like {{{SINGLE-QUOTE}}}Enoxaparin%{{{SINGLE-QUOTE}}}"
|
||||
|| " OR o.Name like {{{SINGLE-QUOTE}}}Heparin%25,000%{{{SINGLE-QUOTE}}}"
|
||||
|| " OR o.Name like {{{SINGLE-QUOTE}}}Heparin Inj%{{{SINGLE-QUOTE}}}"
|
||||
|| " OR o.Name like {{{SINGLE-QUOTE}}}Dabigatran%{{{SINGLE-QUOTE}}}"
|
||||
|| " OR o.Name like {{{SINGLE-QUOTE}}}Rivaroxaban%{{{SINGLE-QUOTE}}}"
|
||||
|| " OR o.Name like {{{SINGLE-QUOTE}}}Warfarin%{{{SINGLE-QUOTE}}}"
|
||||
|| " OR o.Name like {{{SINGLE-QUOTE}}}Fondaparinux%{{{SINGLE-QUOTE}}}"
|
||||
|| " OR o.Name like {{{SINGLE-QUOTE}}}Argatroban%{{{SINGLE-QUOTE}}}"
|
||||
|| " OR o.Name like {{{SINGLE-QUOTE}}}Apixaban%{{{SINGLE-QUOTE}}})"
|
||||
|| " AND"
|
||||
|| " ((o.OrderStatusLevelNum > 15"
|
||||
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|
||||
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
|
||||
, primarytime = touchedWhen};
|
||||
|
||||
order_count := count(existing_orders) as number;
|
||||
|
||||
if (order_count > 0) then
|
||||
hard_stop := true;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if (hard_stop) then
|
||||
//Keep counter in case other anticoagulant order exist that are not in conflict
|
||||
i := 0;
|
||||
|
||||
//loop through existing, active patient orders
|
||||
for orderItem in existing_orders do
|
||||
i := i + 1;
|
||||
|
||||
//LOVENOX CHECK (trying to order)
|
||||
if ((EvokingEvent = lovenox_orderset_event)) then
|
||||
|
||||
//LOVENOX -> HEPARIN IV, ARGATROBAN
|
||||
if ((orderItem in heparin_iv_meds)
|
||||
OR (orderItem in argatroban_meds)) then
|
||||
soft_message := true;
|
||||
order_name := orderItem;
|
||||
alert_priority := "Low";
|
||||
alert_dialog := "Must Acknowledge";
|
||||
|
||||
include_trans_msg := true;
|
||||
|
||||
//ARGATROBAN custom message
|
||||
if (orderItem in argatroban_meds) then
|
||||
alert_override_msg := "\n \n Start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} when {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} infusion is stopped.";
|
||||
|
||||
//HEAPRIN IV custom message
|
||||
elseif (orderItem in heparin_iv_meds) then
|
||||
alert_override_msg := "\n \n Start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} 2 hours before to 2 hours after {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} infusion is stopped based on last aPTT.";
|
||||
endif;
|
||||
|
||||
//LOVENOX -> HEPARIN SQ, PRADAXA, XARELTO, ARIXTRA, APIXABAN
|
||||
elseif ((orderItem in heparin_inj_meds)
|
||||
OR (orderItem in pradaxa_meds)
|
||||
OR (orderItem in xarelto_meds)
|
||||
OR (orderItem in arixtra_meds)
|
||||
OR (orderItem in apixaban_meds)) then
|
||||
stop_message := true;
|
||||
order_name := orderItem;
|
||||
alert_dialog := "No Override Allowed";
|
||||
|
||||
//APIXABAN custom message
|
||||
if (orderItem in apixaban_meds) then
|
||||
alert_override_msg := "\n \n Discontinue {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} when the next {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose would have been due.";
|
||||
|
||||
//XARELTO custom message
|
||||
elseif (orderItem IN xarelto_meds) then
|
||||
alert_override_msg := "\n When switching from {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} and give {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} when the next {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose would have been due.";
|
||||
|
||||
//PRADAXA custom message
|
||||
elseif (orderItem IN pradaxa_meds) then
|
||||
alert_override_msg := "\n If CrCl is greater than or equal to 30 ml/min, begin {{+B}}{{+R}}"
|
||||
|| this_order
|
||||
|| "{{-R}}{{-B}} 12 hours after last {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose."
|
||||
|| "\n\nIf CrCl is less than 30 ml/min, begin {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} 24 hours after last {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose.";
|
||||
endif;
|
||||
|
||||
//LOVENOX -> LOVENOX (duplicate)
|
||||
elseif ((orderItem IN lovenox_meds)) then
|
||||
soft_message := true;
|
||||
order_name := orderItem;
|
||||
alert_priority := "Low";
|
||||
alert_dialog := "Must Acknowledge";
|
||||
|
||||
include_generic_msg := false;
|
||||
alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}Enoxaparin{{-R}}."
|
||||
|| " You MUST discontinue the previous {{+R}}Enoxaparin{{-R}} "
|
||||
|| "order before placing a new {{+R}}Enoxaparin{{-R}} order, UNLESS the therapies will not be overlapping."
|
||||
|| "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Proceed{{{SINGLE-QUOTE}}}{{-B}}";
|
||||
endif;
|
||||
|
||||
//PRADAXA CHECK (trying to order)
|
||||
elseif (EvokingEvent = pradaxa_orderset_event ) then
|
||||
// OR EvokingEvent = pradaxa_reorder_event
|
||||
// OR EvokingEvent = pradaxa_reorder_event2) then
|
||||
|
||||
//PRADAXA -> HEPARIN SQ, LOVENOX, XARELTO, WARFARIN, ARIXTRA, APIXABAN
|
||||
if ((orderItem in heparin_inj_meds)
|
||||
OR (orderItem in lovenox_meds)
|
||||
OR (orderItem in xarelto_meds)
|
||||
OR (orderItem in warfarin_meds)
|
||||
OR (orderItem in arixtra_meds)
|
||||
OR (orderItem in apixaban_meds)) then
|
||||
|
||||
stop_message := true;
|
||||
order_name := orderItem;
|
||||
alert_dialog := "No Override Allowed";
|
||||
|
||||
//WARFARIN custom message
|
||||
if (orderItem in warfarin_meds) then
|
||||
alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} when INR {{+B}}is less than{{-B}} 2.0";
|
||||
|
||||
//ARIXTRA custom message
|
||||
elseif (orderItem in arixtra_meds) then
|
||||
alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} 0-2 hours before the next {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} dose would have been due.";
|
||||
|
||||
//APIXABAN custom message
|
||||
elseif (orderItem in apixaban_meds) then
|
||||
alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} when the next {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose would have been due.";
|
||||
|
||||
//LOVENOX custom message
|
||||
elseif (orderItem in lovenox_meds) then
|
||||
alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} 0-2 hours before the next {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose would have been due.";
|
||||
endif;
|
||||
|
||||
//PRADAXA -> HEPARIN IV, ARGATROBAN
|
||||
elseif ((orderItem in heparin_iv_meds)
|
||||
OR (orderItem in argatroban_meds)) then
|
||||
|
||||
soft_message := true;
|
||||
order_name := orderItem;
|
||||
alert_priority := "Low";
|
||||
alert_dialog := "Must Acknowledge";
|
||||
include_generic_msg := false;
|
||||
|
||||
alert_override_msg := "{{+B}}{{+R}}" || this_order || "{{-R}} and {{+R}}" || order_name
|
||||
|| "{{-R}} should not be used together due to increased bleeding risk"
|
||||
|| " except when transitioning from {{+R}}" || order_name || "{{-R}} to {{+R}}"
|
||||
|| this_order || "{{-R}}{{-B}}."
|
||||
|| "\n\nStart {{+B}}{{+R}}" || this_order || "{{-R}}{{-B}}"
|
||||
|| " when {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}}"
|
||||
|| " infusion is stopped.";
|
||||
|
||||
//PRADAXA -> PRADAXA (duplicate)
|
||||
elseif ( orderItem IN pradaxa_meds ) then
|
||||
soft_message := true;
|
||||
order_name := orderItem;
|
||||
alert_priority := "Low";
|
||||
alert_dialog := "Must Acknowledge";
|
||||
include_generic_msg := false;
|
||||
|
||||
alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}Pradaxa{{-R}}."
|
||||
|| " You MUST discontinue the previous {{+R}}Pradaxa{{-R}} "
|
||||
|| "order before placing a new {{+R}}Pradaxa{{-R}} order, UNLESS the therapies will not be overlapping."
|
||||
|| "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Proceed{{{SINGLE-QUOTE}}}{{-B}}";
|
||||
endif;
|
||||
|
||||
//XARELTO CHECK (trying to order)
|
||||
elseif (EvokingEvent = xarelto_orderset_event ) then
|
||||
// OR EvokingEvent = xarelto_reorder_event
|
||||
// OR EvokingEvent = xarelto_reorder_event2) then
|
||||
|
||||
//XARELTO -> HEPARIN SQ, LOVENOX, PRADAXA, WARFARIN, ARIXTRA, APIXABAN
|
||||
if ((orderItem in heparin_inj_meds)
|
||||
OR (orderItem in lovenox_meds)
|
||||
OR (orderItem in pradaxa_meds)
|
||||
OR (orderItem in warfarin_meds)
|
||||
OR (orderItem in arixtra_meds)
|
||||
OR (orderItem in apixaban_meds)) then
|
||||
|
||||
stop_message := true;
|
||||
order_name := orderItem;
|
||||
alert_dialog := "No Override Allowed";
|
||||
|
||||
//WARFARIN custom message
|
||||
if (orderItem in warfarin_meds) then
|
||||
alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} when INR {{+B}}is less than{{-B}} 3.0";
|
||||
|
||||
//ARIXTRA custom message
|
||||
elseif (orderItem in arixtra_meds) then
|
||||
alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} 0-2 hours before the next {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} dose would have been due.";
|
||||
|
||||
//APIXABAN custom message
|
||||
elseif (orderItem in apixaban_meds) then
|
||||
alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} when the next {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose would have been due.";
|
||||
|
||||
//LOVENOX custom message
|
||||
elseif (orderItem in lovenox_meds) then
|
||||
alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} 0-2 hours before the next {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose would have been due.";
|
||||
endif;
|
||||
|
||||
//XARELTO -> HEPARIN IV, ARGATROBAN
|
||||
elseif ((orderItem in heparin_iv_meds)
|
||||
OR (orderItem in argatroban_meds)) then
|
||||
soft_message := true;
|
||||
order_name := orderItem;
|
||||
alert_priority := "High";
|
||||
alert_dialog := "Must Acknowledge";
|
||||
include_generic_msg := false;
|
||||
|
||||
alert_override_msg := "{{+B}}{{+R}}" || this_order || "{{-R}} and {{+R}}" || order_name
|
||||
|| "{{-R}} should not be used together due to increased bleeding risk"
|
||||
|| " except when transitioning from {{+R}}" || order_name || "{{-R}} to {{+R}}"
|
||||
|| this_order || "{{-R}}{{-B}}."
|
||||
|| "\n\nStart {{+B}}{{+R}}" || this_order || "{{-R}}{{-B}}"
|
||||
|| " when {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}}"
|
||||
|| " infusion is stopped.";
|
||||
|
||||
|
||||
//XARELTO -> XARELTO (duplicate)
|
||||
elseif ( orderItem IN xarelto_meds ) and (EVOKINGOBJECT.Modifier <> "- Initial Dose") and (EVOKINGOBJECT.Modifier <> "- Maintenance Dose") then //CSR #35039 SZ
|
||||
|
||||
soft_message := true;
|
||||
order_name := orderItem;
|
||||
alert_priority := "Low";
|
||||
alert_dialog := "Must Acknowledge";
|
||||
include_generic_msg := false;
|
||||
|
||||
alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}Xarelto{{-R}}."
|
||||
|| " You MUST discontinue the previous {{+R}}Xarelto{{-R}} "
|
||||
|| "order before placing a new {{+R}}Xarelto{{-R}} order, UNLESS the therapies will not be overlapping."
|
||||
|| "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Proceed{{{SINGLE-QUOTE}}}{{-B}}";
|
||||
|
||||
endif;
|
||||
//WARFARIN CHECK (trying to order)
|
||||
elseif (EvokingEvent = warfarin_orderset_event) then
|
||||
|
||||
//WARFARIN -> XARELTO, APIXABAN
|
||||
if ((orderItem in xarelto_meds)
|
||||
OR (orderItem in apixaban_meds)) then
|
||||
|
||||
soft_message := true;
|
||||
order_name := orderItem;
|
||||
alert_priority := "Low";
|
||||
alert_dialog := "Must Acknowledge";
|
||||
|
||||
//APIXABAN custom message
|
||||
if (orderItem in apixaban_meds) then
|
||||
alert_override_msg := "When converting from {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} because it affects the INR."
|
||||
|| "\n \n Use Heparin or Lovenox with {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} as bridge therapy while waiting for the INR to rise"
|
||||
|| " if therapeutic levels are needed immediately.";
|
||||
|
||||
//XARELTO custom message
|
||||
elseif (orderItem in xarelto_meds) then
|
||||
alert_override_msg := "\n When converting from {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} because {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} affects the INR."
|
||||
|| "\n\nUse Heparin or Lovenox with {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} as bridge therapy while waiting for the INR to rise"
|
||||
|| " if therapeutic levels are needed immediately.";
|
||||
|
||||
//GENERIC message
|
||||
else
|
||||
alert_override_msg := "{{+B}}{{+R}}" || this_order || "{{-R}} and {{+R}}" || order_name
|
||||
|| "{{-R}} should not be used together due to increased bleeding risk"
|
||||
|| " except when transitioning from {{+R}}" || order_name || "{{-R}} to {{+R}}"
|
||||
|| this_order || "{{-R}}{{-B}}.";
|
||||
endif;
|
||||
endif;
|
||||
|
||||
//HEPARIN CHECK (trying to order)
|
||||
elseif ((EvokingEvent = heparin_orderset_event)
|
||||
OR (EvokingEvent = heparin_nonprotocol_event)
|
||||
OR (EvokingEvent = heparin_nonprotocol_event2)) then
|
||||
|
||||
//HEPARIN SQ CHECK (trying to order)
|
||||
if (this_order = "Heparin Inj - SQ") then
|
||||
|
||||
//HEPARIN SQ -> LOVENOX, PRADAXA, XARELTO, HEPARIN IV, ARIXTRA, ARGATROBAN, APIXABAN
|
||||
if ((orderItem in lovenox_meds)
|
||||
OR (orderItem in pradaxa_meds)
|
||||
OR (orderItem in xarelto_meds)
|
||||
OR (orderItem in heparin_iv_meds)
|
||||
OR (orderItem in arixtra_meds)
|
||||
OR (orderItem in argatroban_meds)
|
||||
OR (orderItem in apixaban_meds)) then
|
||||
|
||||
stop_message := true;
|
||||
order_name := orderItem;
|
||||
alert_dialog := "No Override Allowed";
|
||||
|
||||
//HEPARIN SQ -> HEPARIN SQ (duplicate)
|
||||
elseif (orderItem in heparin_inj_meds) then
|
||||
soft_message := true;
|
||||
order_name := orderItem;
|
||||
alert_priority := "Low";
|
||||
alert_dialog := "Must Acknowledge";
|
||||
|
||||
include_generic_msg := false;
|
||||
alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}Heparin SQ{{-R}}."
|
||||
|| " You MUST discontinue the previous {{+R}}Heparin SQ{{-R}} "
|
||||
|| "order before placing a new {{+R}}Heparin SQ{{-R}} order, UNLESS the therapies will not be overlapping."
|
||||
|| "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Proceed{{{SINGLE-QUOTE}}}{{-B}}";
|
||||
endif;
|
||||
|
||||
//HEPARIN IV CHECK (trying to order)
|
||||
else
|
||||
|
||||
//HEPARIN IV -> PRADAXA, XARELTO, LOVENOX, ARIXTRA, ARGATROBAN, APIXABAN
|
||||
if ((orderItem in pradaxa_meds)
|
||||
OR (orderItem in xarelto_meds)
|
||||
OR (orderItem in lovenox_meds)
|
||||
OR (orderItem in arixtra_meds)
|
||||
OR (orderItem in argatroban_meds)
|
||||
OR (orderItem in apixaban_meds)) then
|
||||
stop_message := true;
|
||||
order_name := orderItem;
|
||||
alert_dialog := "No Override Allowed";
|
||||
|
||||
//APIXABAN custom message
|
||||
if (orderItem in apixaban_meds) then
|
||||
alert_override_msg := "When converting from {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} infusion when the next {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose would have been due.";
|
||||
|
||||
//XARELTO custom message
|
||||
elseif (orderItem in xarelto_meds) then
|
||||
alert_override_msg := "\n When switching from {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue the {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} infusion when the next {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose whould have been due.";
|
||||
|
||||
//PRADAXA custom message
|
||||
elseif (orderItem in pradaxa_meds) then
|
||||
alert_override_msg := "If CrCl is greater than or equal to 30 ml/min, begin {{+B}}{{+R}}"
|
||||
|| this_order || "{{-R}}{{-B}} 12 hours after last {{+B}}{{+R}}"
|
||||
|| order_name || "{{-R}}{{-B}} dose."
|
||||
|| "\n\nIf CrCl is less than 30 ml/min, begin {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} 24 hours after last {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose.";
|
||||
endif;
|
||||
|
||||
//HEPARIN IV -> HEPARIN SQ
|
||||
elseif (orderItem IN heparin_inj_meds) then
|
||||
stop_message := true;
|
||||
order_name := orderItem;
|
||||
alert_dialog := "No Override Allowed";
|
||||
include_generic_msg := false;
|
||||
|
||||
alert_override_msg := "{{+B}}Avoid concurrent use of {{+R}}" || this_order || "{{-R}} and {{+R}}" || order_name
|
||||
|| " SQ{{-R}} due to increased bleeding risk.{{-B}}"
|
||||
|| "\nContact physician to adjust orders.";
|
||||
|
||||
//HEPARIN IV -> HEPARIN IV (duplicate)
|
||||
elseif (orderItem in heparin_iv_meds) then
|
||||
soft_message := true;
|
||||
order_name := orderItem;
|
||||
alert_dialog := "Must Acknowledge";
|
||||
alert_priority := "Low";
|
||||
|
||||
include_generic_msg := false;
|
||||
|
||||
if ( origOrderSet[i] = "tPA (Alteplase) for the Treatment of Pulmonary Embolism (PE)" ) then
|
||||
alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}"
|
||||
|| order_name || "{{-R}} from {{+B}}" || origOrderSet[i] || ". Please discontinue the {{+R}}" || order_name
|
||||
|| "{{-R}} before placing an order";
|
||||
else
|
||||
alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}"
|
||||
|| origOrderSet[i] || "{{-R}}. Please discontinue the {{+R}}" || origOrderSet[i]
|
||||
|| "{{-R}} before placing an order";
|
||||
endif;
|
||||
|
||||
//HEPARIN NON PROTOCOL ORDER handling
|
||||
if ((EvokingEvent = heparin_nonprotocol_event)
|
||||
OR (EvokingEvent = heparin_nonprotocol_event2)) then
|
||||
alert_override_msg := alert_override_msg || " for {{+R}}" || this_order || "{{-R}}.{{-B}}";
|
||||
else
|
||||
alert_override_msg := alert_override_msg || " from the {{+R}}" || this_order || "{{-R}}.{{-B}}";
|
||||
endif; //end EvokingEvent = heparin_nonprotocol_event
|
||||
endif; //End orderItem IN pradaxa_meds...elseif...
|
||||
endif; //End this_order = Heparin_Inj = SQ....else....
|
||||
|
||||
//ARGATROBAN CHECK (trying to order)
|
||||
elseif (EvokingEvent = argatroban_order_event) then
|
||||
|
||||
//ARGATROBAN -> LOVENOX, ARIXTRA, HEPARIN SQ, HEPARIN IV, PRADAXA, XARELTO, APIXABAN
|
||||
if ((orderItem IN lovenox_meds)
|
||||
OR (orderItem IN arixtra_meds)
|
||||
OR (orderItem IN heparin_inj_meds)
|
||||
OR (orderItem IN heparin_iv_meds)
|
||||
OR (orderItem IN pradaxa_meds)
|
||||
OR (orderItem IN xarelto_meds)
|
||||
OR (orderItem IN apixaban_meds)) then
|
||||
|
||||
stop_message := true;
|
||||
order_name := orderItem;
|
||||
alert_dialog := "No Override Allowed";
|
||||
|
||||
//PRADAXA custom message
|
||||
if (orderItem IN pradaxa_meds) then
|
||||
alert_override_msg := "If CrCl is greater than or equal to 30 ml/min, begin {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} infusion 12 hours after last {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose."
|
||||
|| "\n \n If CrCl is less than 30 ml/min, begin {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} infusion 24 hours after last {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose.";
|
||||
|
||||
//XARELTO custom message
|
||||
elseif (orderItem IN xarelto_meds) then
|
||||
alert_override_msg := "When switching from {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} , discontinue {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} infusion when the next {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose would have been due.";
|
||||
|
||||
//APIXABAN custom message
|
||||
elseif (orderItem IN apixaban_meds) then
|
||||
alert_override_msg := "When converting from {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} infusion when the next {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose would have been due.";
|
||||
endif;
|
||||
|
||||
//ARGATROBAN -> ARGATROBAN (duplicate)
|
||||
elseif (orderItem IN argatroban_meds) then
|
||||
soft_message := true;
|
||||
order_name := orderItem;
|
||||
alert_dialog := "Must Acknowledge";
|
||||
alert_priority := "Low";
|
||||
|
||||
include_generic_msg := false;
|
||||
alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}Argatroban{{-R}}."
|
||||
|| " You MUST discontinue the previous {{+R}}Argatroban{{-R}} "
|
||||
|| "order before placing a new {{+R}}Argatroban{{-R}} order, UNLESS the therapies will not be overlapping."
|
||||
|| "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Proceed{{{SINGLE-QUOTE}}}{{-B}}";
|
||||
endif;
|
||||
|
||||
//APIXABAN CHECK (trying to order)
|
||||
elseif (EvokingEvent = apixaban_orderset_event ) then
|
||||
// OR EvokingEvent = apixaban_reorder_event
|
||||
// OR EvokingEvent = apixaban_reorder_event2) then
|
||||
|
||||
//APIXABAN -> LOVENOX, ARIXTRA, HEPARIN SQ, WARFARIN, PRADAXA, XARELTO
|
||||
if ((orderItem IN lovenox_meds)
|
||||
OR (orderItem IN arixtra_meds)
|
||||
OR (orderItem IN heparin_inj_meds)
|
||||
OR (orderItem IN warfarin_meds)
|
||||
OR (orderItem IN pradaxa_meds)
|
||||
OR (orderItem IN xarelto_meds)) then
|
||||
|
||||
stop_message := true;
|
||||
order_name := orderItem;
|
||||
alert_dialog := "No Override Allowed";
|
||||
|
||||
//LOVENOX, ARIXTRA, PRADAXA, XARELTO custom message
|
||||
if ((orderItem IN lovenox_meds)
|
||||
OR (orderItem IN arixtra_meds)
|
||||
OR (orderItem IN pradaxa_meds)
|
||||
OR (orderItem IN xarelto_meds)) then
|
||||
alert_override_msg := "When converting from {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} when the next {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} dose would have been due.";
|
||||
|
||||
//WARFARIN custom message
|
||||
elseif (orderItem IN warfarin_meds) then
|
||||
alert_override_msg := "When converting from {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} when INR less then 2.0.";
|
||||
endif;
|
||||
|
||||
//APIXABAN -> HEPARIN IV, ARGATROBAN
|
||||
elseif ((orderItem IN heparin_iv_meds)
|
||||
OR (orderItem IN argatroban_meds)) then
|
||||
|
||||
soft_message := true;
|
||||
order_name := orderItem;
|
||||
alert_priority := "Low";
|
||||
alert_dialog := "Must Acknowledge";
|
||||
include_trans_msg := true;
|
||||
|
||||
alert_override_msg := "When converting from {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
|
||||
|| "{{-R}}{{-B}} when {{+B}}{{+R}}" || order_name
|
||||
|| "{{-R}}{{-B}} infusion is stopped.";
|
||||
|
||||
//APIXABAN -> APIXABAN (duplicate)
|
||||
elseif (orderItem IN apixaban_meds) and (EVOKINGOBJECT.Modifier <> "- Initial Dose") and (EVOKINGOBJECT.Modifier <> "- Maintenance Dose") then //CSR #35039 SZ
|
||||
soft_message := true;
|
||||
order_name := orderItem;
|
||||
alert_priority := "Low";
|
||||
alert_dialog := "Must Acknowledge";
|
||||
|
||||
include_generic_msg := false;
|
||||
alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}Apixaban{{-R}}."
|
||||
|| " You MUST discontinue the previous {{+R}}Apixaban{{-R}} "
|
||||
|| "order before placing a new {{+R}}Apixaban{{-R}} order, UNLESS the therapies will not be overlapping."
|
||||
|| "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Proceed{{{SINGLE-QUOTE}}}{{-B}}";
|
||||
endif;
|
||||
endif; //End EvokingEvent = heparin_orderset_event...elseif...else
|
||||
enddo; //End looping through existing, active patient anticoagulant orders
|
||||
endif; // End hard_stop = true
|
||||
|
||||
//Set alert priority and dialog settings based on CONFLICT
|
||||
order_alert_dest.Priority := alert_priority;
|
||||
order_alert_dest.Alert_Dialog_Settings := alert_dialog;
|
||||
|
||||
//Configure message based on alert and custom settings
|
||||
if ((stop_message and soft_message) OR (stop_message and not(soft_message))) then
|
||||
alert_message := "{{+B}}Avoid concurrent use of {{+R}}" || this_order || "{{-R}} and {{+R}}"
|
||||
|| order_name || "{{-R}} due to increased bleeding risk.{{-B}} Contact physician to adjust orders.";
|
||||
|
||||
//Determine if we display an override message along with or in place of the generic message
|
||||
if (alert_override_msg <> "") then
|
||||
if (include_generic_msg) then
|
||||
alert_message := alert_message || "\n\n" || alert_override_msg;
|
||||
else
|
||||
alert_message := alert_override_msg;
|
||||
endif;
|
||||
endif;
|
||||
elseif (soft_message) then
|
||||
alert_message := "{{+B}}{{+R}}" || this_order || "{{-R}} and {{+R}}" || order_name || "{{-R}} "
|
||||
|| " should not be used together due to increased bleeding risk";
|
||||
|
||||
if (include_trans_msg) then
|
||||
alert_message := alert_message || " except when transitioning from {{+R}}" || order_name
|
||||
|| "{{-R}} to {{+R}}" || this_order || "{{-R}}{{-B}}.";
|
||||
else
|
||||
alert_message := alert_message || ".{{-B}} Contact physician to adjust orders";
|
||||
endif;
|
||||
|
||||
if (alert_override_msg <> "") then
|
||||
if (include_generic_msg) then
|
||||
alert_message := alert_message || "\n\n" || alert_override_msg;
|
||||
else
|
||||
alert_message := alert_override_msg;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
else
|
||||
hard_stop := false;
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
|
||||
pradaxa_orderset_event;
|
||||
xarelto_orderset_event;
|
||||
lovenox_orderset_event;
|
||||
heparin_orderset_event;
|
||||
heparin_nonprotocol_event;
|
||||
heparin_nonprotocol_event2;
|
||||
warfarin_orderset_event;
|
||||
//pradaxa_reorder_event;
|
||||
//pradaxa_reorder_event2;
|
||||
//xarelto_reorder_event;
|
||||
//xarelto_reorder_event2;
|
||||
argatroban_order_event;
|
||||
apixaban_orderset_event;
|
||||
//apixaban_reorder_event;
|
||||
//apixaban_reorder_event2;
|
||||
anticoag_os_event
|
||||
|
||||
;;
|
||||
|
||||
logic:
|
||||
conclude hard_stop
|
||||
;;
|
||||
action:
|
||||
write alert_message at order_alert_dest;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
114
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_CODEINE_ORDERS.mlm
Normal file
114
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_CODEINE_ORDERS.mlm
Normal file
@@ -0,0 +1,114 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_ALERT_ON_CODEINE_ORDERS ;;
|
||||
mlmname: SCH_ALERT_ON_CODEINE_ORDERS;;
|
||||
arden: version 2.5;;
|
||||
version: 1.00;;
|
||||
institution: St.Clair Hospital ;;
|
||||
author: Sandy Zhang ;;
|
||||
specialist: Amy Georgulis ;;
|
||||
date: 2018-08-27;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: If the patient is a child under 18 years old (1 - 17) then present a hard stop alert when the user attempts to order codeine, codeine combo, or tramadol products for the patient.
|
||||
No ability to proceed with hard stops.
|
||||
;;
|
||||
explanation:
|
||||
|
||||
Change History
|
||||
|
||||
08.27.2018 SZ CSR 36725: codeine and tramadol alert for children < 18 yo
|
||||
;;
|
||||
keywords: codeine, tramadol, pediatric alert
|
||||
;;
|
||||
citations:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
// MLM evoked on Fentanyl Patch orders
|
||||
codeine_tramadol_order_event := event{OrderInit User Order :
|
||||
WHERE Name matches pattern "%codeine%" or Name matches pattern "%tramadol%" };
|
||||
|
||||
// grab relevant guids
|
||||
ClientGuid := EVOKINGOBJECT.ClientGUID;
|
||||
ChartGuid := EVOKINGOBJECT.ChartGUID;
|
||||
userguid := EVOKINGOBJECT.UserGUID;
|
||||
VisitGuid := EVOKINGOBJECT.ClientVisitGUID;
|
||||
|
||||
|
||||
/************************* check 1 *****************************************/
|
||||
// only proceed with alert if patient is 0 to 18 years old
|
||||
if (EvokingEventType = "OrderInit") then
|
||||
(Client_g, Client_dn, birthdate, Client_birthyearnum) := read last {ClientInfo: GUID, DisplayName, birthdate, birthyearnum};
|
||||
endif;
|
||||
|
||||
patient_age := (NOW - birthdate) / (1 year);
|
||||
|
||||
if patient_age >= 0 and patient_age < 18 then
|
||||
show_alert := true;
|
||||
else
|
||||
show_alert := false;
|
||||
endif;
|
||||
|
||||
|
||||
/************************* Alert Details *****************************************/
|
||||
|
||||
// Set the med name for use in alert text/message
|
||||
if EVOKINGOBJECT.Name matches pattern "%codeine%" then
|
||||
med_name_codeine := true;
|
||||
med_name := "Codeine";
|
||||
elseif EVOKINGOBJECT.Name matches pattern "%Tramadol%" then
|
||||
med_name_tramadol := true;
|
||||
med_name := "Tramadol";
|
||||
else
|
||||
med_name_either := true;
|
||||
med_name := "Codeine/Tramadol";
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// alert message content
|
||||
if (med_name_codeine = true) then
|
||||
alert_message := "\n Use of codeine in ultra-rapid metabolizers causes life-threatening , high levels of morphine that has led to respiratory depression and fatalities in children. Per the FDA, Codeine is contraindicated in children under 12 years old for ALL indications and in patients 12-18 years old for cough or pain following tonsillectomy or adenoidectomy. Codeine is also not recommended for pain in children 12-18 years of age who are obese, or have severe lung disease or obstructive sleep apnea." ||
|
||||
"\n ";
|
||||
endif;
|
||||
|
||||
|
||||
if (med_name_tramadol = true) then
|
||||
alert_message := "\n Use of tramadol in ultra-rapid metabolizers causes life-threatening , high levels of the active ingredients that has led to respiratory depression and fatalities in children. Per the FDA, tramadol is contraindicated in all children under 12 years old and in patients 12-18 years old for pain following tonsillectomy or adenoidectomy. Tramadol is also not recommended for pain in children 12-18 years of age who are obese, or have severe lung disease or obstructive sleep apnea. " ||
|
||||
"\n ";
|
||||
endif;
|
||||
|
||||
if (med_name_either = true) then
|
||||
alert_message := "\n" || med_name || " is contraindicated in pediatric patients (0-17 yo) due to a significant risk of respiratory depression which has led to fatalities." ||
|
||||
"\n ";
|
||||
endif;
|
||||
|
||||
// alert destination
|
||||
order_alert_dest := destination {alert} with
|
||||
[alert_type := warning,
|
||||
short_message := med_name || " Pediatric Alert",
|
||||
priority := "High",
|
||||
scope := Chart,
|
||||
rule_group := "Codeine/Tramadol Pediatric Alert",
|
||||
rule_number := 8000,
|
||||
send_with_order := "DoNotSend",
|
||||
alert_dialog_settings := "No Override Allowed",
|
||||
display_alert := true];
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: codeine_tramadol_order_event;
|
||||
;;
|
||||
logic: conclude show_alert;
|
||||
;;
|
||||
action:
|
||||
write alert_message at order_alert_dest;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
61
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_CPK_ISOENZYMES.mlm
Normal file
61
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_CPK_ISOENZYMES.mlm
Normal file
@@ -0,0 +1,61 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_ALERT_ON_CPK_ISOENZYMES;;
|
||||
mlmname: SCH_ALERT_ON_CPK_ISOENZYMES;;
|
||||
arden: version 2.5;;
|
||||
version: 15.3;;
|
||||
institution: ;;
|
||||
author: Maria Pest;;
|
||||
specialist: Shawn Head x7468;;
|
||||
date: 2018-04-17;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
;;
|
||||
explanation:
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
04.17.2018 STH CSR# 36392 - Created
|
||||
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
Order_Event_Init := event{OrderInit User Order : WHERE Name = "CPK Isoenzymes" };
|
||||
|
||||
ClientGuid := EVOKINGOBJECT.ClientGUID;
|
||||
ChartGuid := EVOKINGOBJECT.ChartGUID;
|
||||
VisitGuid := EVOKINGOBJECT.ClientVisitGUID;
|
||||
|
||||
send_alert:= "DoNotSend";
|
||||
alert_dest:= destination { Alert: warning, "CPK Isoenzymes Alert", high, chart, "CPK Isoenzymes Alert MLM", 15042, send_alert, "" };
|
||||
|
||||
alert_message := "The American College of Cardiology recognizes Troponin as the biomarker of choice due to its nearly absolute specificity and high clinical sensitivity for myocardial injury. \n\nCK-MB provides no incremental value to patient care. \n\n{{+B}}{{+R}}Do you wish to proceed with this order?{{-B}}{{-R}}";
|
||||
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: Order_Event_Init;
|
||||
;;
|
||||
logic:
|
||||
Conclude True;
|
||||
;;
|
||||
action:
|
||||
|
||||
|
||||
If alert_message <> "" then write alert_message at alert_dest; endif;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,149 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Alert_On_Diabetic_Steroid_Order ;;
|
||||
mlmname: SCH_Alert_On_Diabetic_Steroid_Order;;
|
||||
arden: version 2.5;;
|
||||
version: 1.00;;
|
||||
institution: St.Clair Hospital ;;
|
||||
author: Sandy Zhang & Kathy Baumgarten;;
|
||||
specialist: Sandy Zhang & Kathy Baumgarten;;
|
||||
date: 2018-01-22;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Provides an alert to inpatient physicians when a patient is diabetic and is ordered an oral or injectable steroid.
|
||||
;;
|
||||
explanation:
|
||||
|
||||
Change history
|
||||
01.22.2018 SZ CSR #36170 - Steroid alert. Created to alert physicians to evaluate the diabetic patient{{{SINGLE-QUOTE}}}s med regimen when ordering an oral or injectable steroid.
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
citations:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
/*******************Make Changes To Spelling And Flags In This Section*******************/
|
||||
true_false_flag := true;
|
||||
/***************************************************************************************/
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
//Capture current patient
|
||||
(clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
|
||||
clientVisitGuid := read last {ClientVisit : GUID};
|
||||
chartGuid := read last {ClientVisit : ChartGUID};
|
||||
|
||||
// alert physicians only if patient is diabetic (based on ICD codes) and if medication being ordered is:
|
||||
// 1) prednisone (all - oral & inj)
|
||||
// 2) methylprednisolone (all - oral & inj)
|
||||
// 3) prednisolone (tab, solution) (exclude ophth)
|
||||
// 4) budesonide (tab, cap)
|
||||
// 5) dexamethasone (all - oral & inj)
|
||||
// 6) hydrocortisone (tab, inj, IV, PB)
|
||||
// We were told to alert on all steroids oral and injectable.
|
||||
// At the writing of this MLM (1/29/2018), the above options were the most logical based on Order Catalog Item Configurations.
|
||||
|
||||
// 1) prednisone (all)
|
||||
prednisone_order_event := EVENT {OrderEnter User Order:
|
||||
where name matches pattern "%prednisone%"};
|
||||
|
||||
// 2) methylprednisolone (all)
|
||||
methylprenisolone_order_event := EVENT {OrderEnter User Order:
|
||||
where name matches pattern "%methylprednisolone%"};
|
||||
|
||||
// 3) prednisolone (tab, solution) (exclude ophth)
|
||||
prednisolone_order_event := EVENT {OrderEnter User Order:
|
||||
where name matches pattern "%prednisolone%"};
|
||||
|
||||
// 4) budesonide (tab, cap)
|
||||
budesonide_order_event := EVENT {OrderEnter User Order:
|
||||
where name matches pattern "%budesonide%"};
|
||||
|
||||
// 5) dexamethasone (all)
|
||||
dexamethasone_order_event := EVENT {OrderEnter User Order:
|
||||
where name matches pattern "%dexamethasone%"};
|
||||
|
||||
// 6) hydrocortisone (tab, inj, IV, PB) - filtering below
|
||||
hydrocortisone_order_event := EVENT {OrderEnter User Order:
|
||||
where name matches pattern "%hydrocortisone%"};
|
||||
|
||||
|
||||
order_name := read last {Order: name Referencing EvokingObject};
|
||||
|
||||
|
||||
// filters hydrocortisone to alert user if it{{{SINGLE-QUOTE}}}s a (tab, inj, IV, PB)
|
||||
if (EvokingEvent = prednisone_order_event) or
|
||||
(EvokingEvent = methylprenisolone_order_event) or
|
||||
(EvokingEvent = prednisolone_order_event) or
|
||||
(EvokingEvent = budesonide_order_event) or
|
||||
(EvokingEvent = dexamethasone_order_event) or
|
||||
(EvokingEvent = hydrocortisone_order_event)
|
||||
then
|
||||
// turns flag true if order is IVPB, inj, or tab
|
||||
if (EVOKINGOBJECT.Modifier matches pattern "%pb%" or
|
||||
EVOKINGOBJECT.Modifier matches pattern "%iv%" or
|
||||
order_name matches pattern "%inj%" or
|
||||
order_name matches pattern "%tab%" or
|
||||
order_name matches pattern "%cap%" or
|
||||
order_name matches pattern "%soln%" or
|
||||
order_name matches pattern "%solution%")
|
||||
then
|
||||
true_false_flag := true;
|
||||
if (order_name matches pattern "%ophth%" or order_name matches pattern "%otic%") then true_false_flag := false; endif;
|
||||
else
|
||||
true_false_flag := false;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
/*********************************BEGIN HEALTH ISSUE SECTION**********************************************/
|
||||
// if patient has ICD-10 health issue of diabetes then fire the alert
|
||||
|
||||
HealthIssue := read last {" select distinct hi.ShortName
|
||||
from cv3healthissuedeclaration hi with (nolock)
|
||||
inner join cv3codedhealthissue chi with (nolock) on hi.CodedHealthIssueGUID = chi.guid and chi.TypeCode IN({{{SINGLE-QUOTE}}}I9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}})
|
||||
where Clientguid = " || SQL (clientguid)
|
||||
|| " and hi.active = 1
|
||||
and Status in ({{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chronic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Retired Code{{{SINGLE-QUOTE}}})
|
||||
and (((ICD10Code like {{{SINGLE-QUOTE}}}E10%{{{SINGLE-QUOTE}}}) or (ICD10Code like {{{SINGLE-QUOTE}}}E11%{{{SINGLE-QUOTE}}}) or (ICD10Code like {{{SINGLE-QUOTE}}}E09%{{{SINGLE-QUOTE}}}))
|
||||
or ((ICD9Code like {{{SINGLE-QUOTE}}}250.%{{{SINGLE-QUOTE}}} and ICD10Code is null))
|
||||
or ((ICD9Code like {{{SINGLE-QUOTE}}}249.%{{{SINGLE-QUOTE}}} and ICD10Code is null))
|
||||
or ((chi.TypeCode IN({{{SINGLE-QUOTE}}}I9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}})) and ((chi.Code like {{{SINGLE-QUOTE}}}250.%{{{SINGLE-QUOTE}}}) or chi.Code like {{{SINGLE-QUOTE}}}249.%{{{SINGLE-QUOTE}}}))
|
||||
or ((chi.TypeCode = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}}) and ((chi.Code like {{{SINGLE-QUOTE}}}E11%{{{SINGLE-QUOTE}}}) or chi.Code like {{{SINGLE-QUOTE}}}E09%{{{SINGLE-QUOTE}}})))"};
|
||||
|
||||
// if health issue = diabetes and order qualifies then fire alert
|
||||
if (exist HealthIssue) and (true_false_flag = true) then
|
||||
// start of alert dialogue
|
||||
MsgText := "\n\nSince you have prescribed systemic steroids for a diabetic patient, please review the patient’s meds and blood sugar.\n\nAdjust meds as needed.\n";
|
||||
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " " || MsgText, "Diabetic Steroid Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
/*********************************END HEALTH ISSUE SECTION**********************************************/
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
|
||||
prednisone_order_event;
|
||||
methylprenisolone_order_event;
|
||||
prednisolone_order_event;
|
||||
budesonide_order_event;
|
||||
dexamethasone_order_event;
|
||||
hydrocortisone_order_event;
|
||||
|
||||
;;
|
||||
logic:
|
||||
conclude true
|
||||
;;
|
||||
action:
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
167
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_DUPLICATE_ORDERS.mlm
Normal file
167
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_DUPLICATE_ORDERS.mlm
Normal file
@@ -0,0 +1,167 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_ALERT_ON_DUPLICATE_ORDERS;;
|
||||
mlmname: SCH_ALERT_ON_DUPLICATE_ORDERS;;
|
||||
arden: version 2.5;;
|
||||
version: 16.30;;
|
||||
institution: St. Clair;;
|
||||
author: Teresa Spicuzza;;
|
||||
specialist: Teresa Spicuzza;;
|
||||
date: 2017-04-12;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Generate an informational alert for pharmacy listing duplicate orders managed via the orders management window.
|
||||
|
||||
;;
|
||||
explanation: When an potential therapeutic duplicate has been addressed via the orders management window, create
|
||||
an informational alert that is not presented to the user, but able to be viewed from the order or viewed with all alerts on the pt info tab.
|
||||
|
||||
Change History:
|
||||
2017.04.12 TMS Created as an informational alert, not presented to user but viewable as a reference to what
|
||||
actions were taken from the order management window. CSR 33465
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
(client_visit_guid, chart_guid, client_guid, OrderName) := ARGUMENT;
|
||||
|
||||
|
||||
//.Net libraries
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
||||
|
||||
/*******************************************************************/
|
||||
//Set to true if logging needed
|
||||
log_execution_info := false;
|
||||
|
||||
//Set the text for this variable to indicate whether to send the message or not
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
//Destination Object Properties
|
||||
alert_dialog := "";
|
||||
alert_message := "";
|
||||
alert_override_msg := "";
|
||||
CR := 13 formatted with "%c";
|
||||
LF := 10 formatted with "%c";
|
||||
CRLF:= CR||LF;
|
||||
TAB := 9 formatted with "%c";
|
||||
continueprocessing := false;
|
||||
|
||||
|
||||
//Destination
|
||||
|
||||
duplicated_medication_order := event {OrderEnter User Order:
|
||||
WHERE TypeCode = "Medication"
|
||||
AND OrderStatusLevelNum >= 0
|
||||
AND OrderStatusLevelNum <= 50
|
||||
// AND IsHeld = FALSE
|
||||
AND IsSuspended = FALSE };
|
||||
|
||||
|
||||
|
||||
/* Get the OrderUserData object pointer */
|
||||
OrderUserDataObj := read last
|
||||
{ Order: OrderUserData
|
||||
REFERENCING EvokingObject };
|
||||
|
||||
( ActionUserDataCode, ActionValue ) := read first
|
||||
{ OrderUserData: UserDataCode, Value
|
||||
REFERENCING OrderUserDataObj where
|
||||
UserDataCode = "PRX_Duplicate_Order_Action_Text" };
|
||||
|
||||
( InfoUserDataCode, DupOrderGuidList ) := read first
|
||||
{ OrderUserData: UserDataCode, Value
|
||||
REFERENCING OrderUserDataObj where
|
||||
UserDataCode = "PRX_Order_Guids" };
|
||||
|
||||
numguids := count (duporderguidlist);
|
||||
|
||||
if actionvalue is not null then
|
||||
continueprocessing := true;
|
||||
DupGuidsFromOrder := ();
|
||||
GuidCount := count (DupOrderGuidList);
|
||||
|
||||
DupGuidsFromOrder := call str_parse with DupOrderGuidList,",";
|
||||
finalcount := count (DupGuidsFromOrder);
|
||||
|
||||
for s in 1 seqto finalcount do
|
||||
if s = 1 then
|
||||
FinalList := dupguidsfromorder [s] as number;
|
||||
else
|
||||
FinalList := FinalList, dupguidsfromorder [s] as number;
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
newnumguids := count (DupGuidsFromOrder);
|
||||
|
||||
if finalcount >= 1 then
|
||||
|
||||
(dupordername, dupordersummary, duporderstatus) := read {"select o.name, Replace (o.summaryline, CHAR(13) + CHAR(10), {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}), os.Description from cv3order o "
|
||||
|| "join CV3OrderStatus os on os.code = o.orderstatuscode "
|
||||
|| "where o.guid in ("|| SQL (finallist) || ")" };
|
||||
|
||||
endif;
|
||||
endif;
|
||||
|
||||
duplicate_orderset_alert:= DESTINATION {Alert} WITH
|
||||
|
||||
[ alert_type:= "Informational",
|
||||
short_message:= "Potential Therapeutic Duplicate Information",
|
||||
priority:= low,
|
||||
scope:= chart,
|
||||
rule_group:= "Therapeutic Med Duplicate Info",
|
||||
rule_number:= 3095,
|
||||
send_with_order := send_alert,
|
||||
alert_dialog_settings := alert_dialog,
|
||||
display_alert := false];
|
||||
|
||||
|
||||
bodytext := CRLF;
|
||||
|
||||
for r in 1 seqto count(duporderstatus) do
|
||||
bodytext := bodytext || duporderstatus[r] || Tab || dupordername [r] || CRLF || TAB || TAB || dupordersummary [r] || CRLF;
|
||||
enddo;
|
||||
|
||||
alert_message := "The order for {{+B}}" ||EvokingObject.Name || " {{-B}}was presented as a potential therapeutic duplicate with: " || CRLF || bodytext;
|
||||
|
||||
/*******************************************************************/
|
||||
|
||||
//Unit testing
|
||||
if called_by_editor then
|
||||
OrderName := "Codeine 15mg Tab";
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
priority: 99
|
||||
;;
|
||||
evoke:
|
||||
duplicated_medication_order;
|
||||
;;
|
||||
|
||||
logic:
|
||||
if exists OrderName then
|
||||
duplicate_addressed := true;
|
||||
alert_message := "Issue with " || OrderName || " has been addressed.";
|
||||
alert_status := true;
|
||||
endif;
|
||||
If continueprocessing = true then
|
||||
|
||||
conclude true;
|
||||
else
|
||||
conclude false;
|
||||
endif;
|
||||
;;
|
||||
action:
|
||||
write alert_message at duplicate_orderset_alert;
|
||||
return alert_status;
|
||||
|
||||
;;
|
||||
Urgency: 90;;
|
||||
end:
|
||||
@@ -0,0 +1,300 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_ALERT_ON_ED_BUPRENORPHINE_ORDERS ;;
|
||||
mlmname: SCH_ALERT_ON_ED_BUPRENORPHINE_ORDERS;;
|
||||
arden: version 2.5;;
|
||||
version: 1.00;;
|
||||
institution: St.Clair Hospital ;;
|
||||
author: Sandy Zhang ;;
|
||||
specialist: Amy Georgulis ;;
|
||||
date: 2019-02-05;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
;;
|
||||
explanation:
|
||||
|
||||
Change History
|
||||
|
||||
02.05.2019 SZ CSR 37650: Buprenorphine alert on patients treated in the ED for withdrawal
|
||||
|
||||
;;
|
||||
keywords: Buprenorphine, naloxone, suboxone, subutex
|
||||
;;
|
||||
citations:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
// MLM evoked on Buprenorphine orders
|
||||
buprenorphine_order_event := event{OrderInit User Order :
|
||||
WHERE Name matches pattern "%buprenorphine%"};
|
||||
|
||||
(CurrentLocation, LocationGuid, VisitStatus, AdmitDtm) := read last {ClientVisit: CurrentLocation, CurrentLocationGUID, VisitStatus, AdmitDtm };
|
||||
|
||||
// grab relevant guids
|
||||
ClientGuid := EVOKINGOBJECT.ClientGUID;
|
||||
ChartGuid := EVOKINGOBJECT.ChartGUID;
|
||||
userguid := EVOKINGOBJECT.UserGUID;
|
||||
VisitGuid := EVOKINGOBJECT.ClientVisitGUID;
|
||||
|
||||
show_alert := false;
|
||||
|
||||
x_waivered_physicians := ("Biggs, Jason", "DAlo, Julia M", "Hinds, Jennifer M", "Coyle, Andrew", "Friend, Kevin", "Traynor, Owen T");
|
||||
|
||||
/************************* decision 1 *****************************************/
|
||||
/* 1) Only proceed to alert if patient has (historic data):
|
||||
a) current location of ER Major
|
||||
b) at least one prior ED visit without admission (visit with a currentlocation of {{{SINGLE-QUOTE}}}ER Major{{{SINGLE-QUOTE}}})
|
||||
and
|
||||
c) in that visit, buprenorphine was administered
|
||||
*/
|
||||
|
||||
|
||||
if (CurrentLocation = "ER Major") then
|
||||
/*
|
||||
// sql for finding all prior charted orders of buprenorphine (of which the patient was not admitted, only ER)
|
||||
(performed_date, drug_name, location_name, ordering_provider) := read {
|
||||
"CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), transferdate datetime, locationname varchar(100), visitstatus varchar (50), clientguid numeric(16, 0) , transferoutdate datetime, visitguid numeric(16, 0), admitted varchar(50))"
|
||||
||" INSERT INTO #tmp_aaa (transferdate, locationname, visitstatus, clientguid, transferoutdate, visitguid, admitted)"
|
||||
||" select cvl.TransferRequestDtm, l.shortname, v.VisitStatus, v.ClientGUID, GETDATE(), v.GUID, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}"
|
||||
||" from cv3clientvisitlocation cvl "
|
||||
||" join cv3location l on l.guid = cvl.locationguid "
|
||||
||" join cv3clientvisit v on v.guid = cvl.ClientVisitGUID"
|
||||
||" where v.ClientGUID = " || sql(ClientGuid)
|
||||
||" update t1 set transferoutdate = t2.transferdate from #tmp_aaa t1 "
|
||||
||" inner join #tmp_aaa t2 on t2.id = t1.id +1 "
|
||||
||" and t1.clientguid = t2.clientguid "
|
||||
||" update a set admitted = o.Name from #tmp_aaa a"
|
||||
||" left join CV3Order o on o.ClientVisitGUID = a.visitguid "
|
||||
||" and o.Name in ({{{SINGLE-QUOTE}}}Admit to Inpatient{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Place in Observation Status{{{SINGLE-QUOTE}}})"
|
||||
||" delete from #tmp_aaa where admitted is not null"
|
||||
||" select otc.PerformedFromDtm, TaskName, a.locationname, cp.DisplayName"
|
||||
||" from CV3OrderTaskOccurrence otc"
|
||||
||" join #tmp_aaa a on a.clientguid = otc.ClientGUID"
|
||||
||" join cv3order o with (nolock)on o.GUID = otc.OrderGUID"
|
||||
||" join CV3OrderStatusHistory osh with (nolock) on osh.OrderGUID = o.GUID"
|
||||
||" join CV3CareProvider cp with (nolock) on cp.GUID = osh.RequestedByGUID"
|
||||
||" where " || sql(ClientGuid) || " = otc.ClientGUID and taskname like {{{SINGLE-QUOTE}}}%buprenorphine%{{{SINGLE-QUOTE}}} and TaskStatusCode = {{{SINGLE-QUOTE}}}performed{{{SINGLE-QUOTE}}}"
|
||||
||" and TaskStatusCode = {{{SINGLE-QUOTE}}}performed{{{SINGLE-QUOTE}}}"
|
||||
||" and otc.PerformedFromDtm > a.transferdate "
|
||||
||" and otc.PerformedFromDtm < a.transferoutdate"
|
||||
||" drop table #tmp_aaa"
|
||||
};
|
||||
*/
|
||||
|
||||
// sql for finding all prior charted orders of buprenorphine (of which the patient was not admitted, only ER)
|
||||
// revised on 5/7/2019 - works faster and better
|
||||
(performed_date, drug_name, location_name, ordering_provider) := read {
|
||||
"CREATE TABLE #tmp_aaa (ID int IDENTITY(1, 1),transferdate datetime, locationname varchar(100), visitstatus varchar (50), clientguid numeric(16, 0) , transferoutdate datetime, visitguid numeric(16, 0), visittype varchar(50))"
|
||||
||" INSERT INTO #tmp_aaa "
|
||||
||" select distinct v.AdmitDtm, l.Name, v.VisitStatus,v.ClientGUID, GETDATE(), v.GUID , v.TypeCode"
|
||||
||" from cv3clientvisitlocation cvl "
|
||||
||" join cv3location l on l.guid = cvl.locationguid"
|
||||
||" join cv3clientvisit v on v.guid = cvl.ClientVisitGUID and (v.ClientGUID = " || sql(ClientGuid) || ")"
|
||||
||" order by v.AdmitDtm"
|
||||
||" update t1 "
|
||||
||" set transferoutdate = t2.transferdate from #tmp_aaa t1"
|
||||
||" join #tmp_aaa t2 on t2.id = t1.id +1 and (t1.clientguid = t2.clientguid)"
|
||||
||" delete from #tmp_aaa where visittype <> {{{SINGLE-QUOTE}}}Emergency{{{SINGLE-QUOTE}}}"
|
||||
||" select distinct otc.PerformedFromDtm, otc.TaskName, a.locationname, cp.DisplayName"
|
||||
||" from #tmp_aaa a"
|
||||
||" join CV3OrderTaskOccurrence otc on a.clientguid = otc.ClientGUID "
|
||||
||" and (otc.ClientGUID = " || sql(ClientGuid) || ") "
|
||||
||" and (otc.TaskName like {{{SINGLE-QUOTE}}}%buprenorphine%tab%{{{SINGLE-QUOTE}}})"
|
||||
||" and (otc.TaskStatusCode = {{{SINGLE-QUOTE}}}performed{{{SINGLE-QUOTE}}})"
|
||||
||" and (otc.PerformedFromDtm > a.transferdate)"
|
||||
||" and (otc.PerformedFromDtm < a.transferoutdate)"
|
||||
||" join cv3order o with (nolock)on o.GUID = otc.OrderGUID"
|
||||
||" join CV3OrderStatusHistory osh with (nolock) on osh.OrderGUID = o.GUID"
|
||||
||" join CV3CareProvider cp with (nolock) on cp.GUID = osh.RequestedByGUID"
|
||||
||" drop table #tmp_aaa"
|
||||
};
|
||||
|
||||
items_in_sql := count drug_name;
|
||||
|
||||
|
||||
if (items_in_sql = 0) then
|
||||
scenario := "1a";
|
||||
else
|
||||
scenario := "1b";
|
||||
show_alert := true;
|
||||
|
||||
/************************* decision 2 *****************************************/
|
||||
// Is current buprenorphine is being ordered by an x-waivered doctor?
|
||||
// if yes, -> then present all prior buprenorphine administrations from all MDs
|
||||
// if no, -> then continue onto next decision
|
||||
|
||||
// grab the ordering provider guid
|
||||
if (EvokingEventType = "OrderInit") then
|
||||
(OrderingProviderGuid) := read last {Order: CareProviderGuid REFERENCING EvokingObject};
|
||||
endif;
|
||||
|
||||
|
||||
// SQL to get the discipline/specialty of the ordering provider
|
||||
(ordering_provider_discipline, ordering_provider_name) := read last {
|
||||
"select cp.Discipline, cp.displayname"
|
||||
||" from CV3User u"
|
||||
||" join CV3OrganizationalUnit ou on ou.GUID = u.OrgUnitGUID"
|
||||
||" join CV3CareProvider cp on cp.GUID = u.GUID"
|
||||
||" where u.Active = 1"
|
||||
||" and u.GUID = " || sql(OrderingProviderGuid)
|
||||
};
|
||||
|
||||
|
||||
// if current buprenorphine is being ordered by an x-waivered MD,
|
||||
// then present all prior charted orders of buprenorphine
|
||||
if (ordering_provider_name is in x_waivered_physicians) then
|
||||
|
||||
scenario := "2b";
|
||||
|
||||
alert_med_details := ();
|
||||
|
||||
// build alert order lines (alert body content)
|
||||
// alert 1
|
||||
for i in (1 seqto items_in_sql) do
|
||||
add_line := "Order " || i || ": {{+R}}" || drug_name[i] || "{{-R}}\n Performed at: " || performed_date[i] || "\n Location: {{+B}}" || location_name[i] || "{{-B}}" || "\n Ordering Provider: " || ordering_provider[i] || "\n";
|
||||
alert_med_details := alert_med_details , add_line;
|
||||
|
||||
if (i = 1) then
|
||||
alert_lines := alert_med_details[i] || "\n " ;
|
||||
else
|
||||
alert_lines := alert_lines || alert_med_details[i] || "\n " ;
|
||||
endif;
|
||||
|
||||
enddo;
|
||||
|
||||
|
||||
// Main alert message content
|
||||
alert_message := "\nThese are all prior ED charted Buprenorphine orders for this patient: " ||
|
||||
"\n " ||
|
||||
"\n{{+B}}Total Buprenorphine orders charted: " || items_in_sql || "{{-B}}" ||
|
||||
"\n " ||
|
||||
"\n"|| alert_lines ||
|
||||
"\n ";
|
||||
|
||||
|
||||
else // scenario 2a, proceeds to Decision 3
|
||||
scenario := "2a";
|
||||
|
||||
|
||||
/************************* decision 3 *****************************************/
|
||||
// Is current buprenorphine is being ordered by an x-waivered doctor?
|
||||
// if yes, -> then present all prior buprenorphine administrations from all MDs
|
||||
//-> if no, -> then was all prior buprenorphine orders placed by an x-waivered physician?
|
||||
// (loop through each prior order and see if ordering physician matches up completely to XW md list
|
||||
// if yes, -> then present all prior buprenorphine administrations from all MDs (along with message of:
|
||||
// (message content: All doses were administed by x-waivered physician
|
||||
// if no, -> then present this alert message:
|
||||
// (message content: This patient was administered buprenorphine in the ED at least once by a non-x-waivered physician....
|
||||
|
||||
scenario_list := ();
|
||||
|
||||
for k in (1 seqto count ordering_provider) do
|
||||
|
||||
if (ordering_provider[k] is in x_waivered_physicians) then
|
||||
scenario_list := scenario_list, "in";
|
||||
else
|
||||
scenario_list := scenario_list, "out";
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
|
||||
if ("out" is in scenario_list) then
|
||||
scenario := "3a";
|
||||
else
|
||||
scenario := "3b";
|
||||
endif;
|
||||
|
||||
|
||||
// Building the body content for alerts in both scenarios 3a and 3b
|
||||
// Body content is the order details for charted buprenorphine, in which the patient was NOT admitted to inpatient
|
||||
alert_med_details := ();
|
||||
// build alert order lines (alert body content)
|
||||
for i in (1 seqto items_in_sql) do
|
||||
add_line := "Order " || i || ": {{+R}}" || drug_name[i] || "{{-R}}\n Performed at: " || performed_date[i] || "\n Location: {{+B}}" || location_name[i] || "{{-B}}" || "\n Ordering Provider: " || ordering_provider[i] || "\n";
|
||||
alert_med_details := alert_med_details , add_line;
|
||||
|
||||
if (i = 1) then
|
||||
alert_lines := alert_med_details[i] || "\n " ;
|
||||
else
|
||||
alert_lines := alert_lines || alert_med_details[i] || "\n " ;
|
||||
endif;
|
||||
|
||||
enddo;
|
||||
|
||||
|
||||
if scenario = "3b" then
|
||||
|
||||
// alert message content
|
||||
// alert 2
|
||||
alert_message := "\nThese are all prior ED charted Buprenorphine orders for this patient: " ||
|
||||
"\n " ||
|
||||
"\n{{+B}}All doses were ordered by X-Waivered physicians.{{-B}} " ||
|
||||
"\n " ||
|
||||
"\n{{+B}}Total Buprenorphine orders charted: " || items_in_sql || "{{-B}}" ||
|
||||
"\n " ||
|
||||
"\n"|| alert_lines ||
|
||||
"\n ";
|
||||
|
||||
endif; // if scenario = "3b" then
|
||||
|
||||
|
||||
// scenario 3a, show dialogue alert first, then show second alert with charted buprenorphine orders
|
||||
if scenario = "3a" then
|
||||
|
||||
// dialogue alert message content
|
||||
// alert 3
|
||||
alert_message_dialogue := "\nThis patient was administered buprenorphine in the ED at least once by a non-X-Waivered physician. If this visit is for treatment of opioid use disorder only, this patient may not be eligible for additional buprenorphine treatment. Please review patient history." ||
|
||||
"\n ";
|
||||
|
||||
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " " || alert_message_dialogue, "ED Buprenorphine Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
// Main alert message content
|
||||
// alert 3
|
||||
alert_message := "\nThese are all prior ED charted Buprenorphine orders for this patient: " ||
|
||||
"\n " ||
|
||||
"\n{{+B}}Total Buprenorphine orders charted: " || items_in_sql || "{{-B}}" ||
|
||||
"\n " ||
|
||||
"\n"|| alert_lines ||
|
||||
"\n ";
|
||||
endif;
|
||||
|
||||
|
||||
endif; // if (ordering_provider_name is in x_waivered_physicians) then
|
||||
|
||||
endif; // if (items_in_sql = 0) then
|
||||
|
||||
endif; // if (CurrentLocation = "ER Major") then
|
||||
|
||||
|
||||
// alert destination
|
||||
order_alert_dest := destination {alert} with
|
||||
[alert_type := warning,
|
||||
short_message := "ED Buprenorphine Alert",
|
||||
priority := "High",
|
||||
scope := Chart,
|
||||
rule_group := "ED Buprenorphine Alert",
|
||||
rule_number := 8000,
|
||||
send_with_order := "DoNotSend",
|
||||
alert_dialog_settings := "Must Acknowledge",
|
||||
display_alert := show_alert];
|
||||
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: buprenorphine_order_event;
|
||||
;;
|
||||
logic: conclude show_alert;
|
||||
;;
|
||||
action: write alert_message at order_alert_dest;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
201
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_FENTANYL_ORDERS.mlm
Normal file
201
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_FENTANYL_ORDERS.mlm
Normal file
@@ -0,0 +1,201 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_ALERT_ON_FENTANYL_ORDERS ;;
|
||||
mlmname: SCH_ALERT_ON_FENTANYL_ORDERS;;
|
||||
arden: version 2.5;;
|
||||
version: 1.00;;
|
||||
institution: St.Clair Hospital ;;
|
||||
author: Sandy Zhang ;;
|
||||
specialist: Rob Stewart ;;
|
||||
date: 2017-06-21;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
;;
|
||||
explanation:
|
||||
|
||||
Change History
|
||||
|
||||
06.19.2017 SZ CSR 35469: Fentanyl/Duragesic Patch Indication Alert
|
||||
;;
|
||||
keywords: fentanyl transdermal patch, duragesic, alert
|
||||
;;
|
||||
citations:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
// MLM evoked on these Fentanyl order sets
|
||||
fentanyl_orderset_event := event{OrderSetInit User OrderSet :
|
||||
WHERE OrderSetName IN ("Fentanyl 125mcg Patch"
|
||||
, "Fentanyl Patch"
|
||||
, "Fentanyl Other Orders")};
|
||||
|
||||
// MLM evoked on Fentanyl Patch orders
|
||||
fentanyl_order_event := event{OrderInit User Order :
|
||||
WHERE Name matches pattern "%Fentanyl%" and Name matches pattern "%patch%" };
|
||||
|
||||
// MLM evoked on Duragesic Patch orders
|
||||
//duragesic_order_event := event{OrderInit User Order :
|
||||
// WHERE Name matches pattern "%Duragesic%" and Name matches pattern "%patch%" };
|
||||
|
||||
|
||||
|
||||
// grab relevant guids
|
||||
ClientGuid := EVOKINGOBJECT.ClientGUID;
|
||||
ChartGuid := EVOKINGOBJECT.ChartGUID;
|
||||
userguid := read last {UserInfo: GUID};
|
||||
VisitGuid := EVOKINGOBJECT.ClientVisitGUID;
|
||||
|
||||
// By default, the Fentanyl patch/duragesic alert IS displayed to user upon FormOpen of fentanyl patch/duragesic order
|
||||
// If it meets any of these 3 exceptions then the alert is not shown:
|
||||
// 1) User is a pain management or palliative care specialist
|
||||
// 2) If patient was already prescribed fentanyl patch/duragesic during this visit
|
||||
// 3) If fentanyl patch/duragesic is a home med and listed in their OMR
|
||||
|
||||
show_alert := "Yes";
|
||||
|
||||
//med_extension := EVOKINGOBJECT.MedicationExtension;
|
||||
//order_user_data := EVOKINGOBJECT.OrderUserData;
|
||||
|
||||
|
||||
/************************* exception 1 *****************************************/
|
||||
// grab the ordering provider guid
|
||||
if (EvokingEventType = "OrderInit") then
|
||||
(OrderingProviderGuid) := read last {Order: CareProviderGuid REFERENCING EvokingObject};
|
||||
endif;
|
||||
|
||||
// For ordersets, CareProviderGuid doesn{{{SINGLE-QUOTE}}}t exist so we{{{SINGLE-QUOTE}}}ll use userguid instead since that{{{SINGLE-QUOTE}}}s the best we can do
|
||||
if (EvokingEventType = "OrderSetInit") then
|
||||
(OrderingProviderGuid) := userguid;
|
||||
endif;
|
||||
|
||||
|
||||
exception_discpline := ("pain management", "palliative care", "palliative care/internal med");
|
||||
exception_physicians := ("Erlanger, Daniel B","Platto, Michael J");
|
||||
|
||||
|
||||
// SQL to get the discipline/specialty of the ordering provider
|
||||
(ordering_provider_discipline, ordering_provider_name) := read last {
|
||||
"select cp.Discipline, cp.displayname"
|
||||
||" from CV3User u"
|
||||
||" join CV3OrganizationalUnit ou on ou.GUID = u.OrgUnitGUID"
|
||||
||" join CV3CareProvider cp on cp.GUID = u.GUID"
|
||||
||" where u.Active = 1"
|
||||
||" and u.GUID = " || sql(OrderingProviderGuid)
|
||||
};
|
||||
|
||||
// if the ordering provider is a pain management or palliative care specialist then don{{{SINGLE-QUOTE}}}t show the alert
|
||||
if (ordering_provider_discipline is in exception_discpline) then
|
||||
show_alert := "No";
|
||||
discipline_bypassed := "yay the provider{{{SINGLE-QUOTE}}}s DISCIPLINE has bypassed this alert";
|
||||
endif;
|
||||
|
||||
|
||||
if (ordering_provider_name is in exception_physicians) then
|
||||
show_alert := "No";
|
||||
provider_bypassed := "yay the provider has bypassed this alert";
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
/************************* exception 2 *****************************************/
|
||||
// SQL to see if patient was already ordered Fentanyl during this visit
|
||||
existing_fentanyl_order := read last {
|
||||
"select ocmi.Name"
|
||||
||" from cv3ordercatalogmasteritem ocmi with (nolock)"
|
||||
||" join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid"
|
||||
||" where"
|
||||
||" o.clientguid = " || sql(ClientGuid)
|
||||
||" and o.chartguid = " || sql(ChartGuid)
|
||||
||" and o.clientvisitguid = " || sql(VisitGuid)
|
||||
||" and ocmi.Name like {{{SINGLE-QUOTE}}}%fentanyl%{{{SINGLE-QUOTE}}}"
|
||||
||" and ocmi.Name like {{{SINGLE-QUOTE}}}%patch%{{{SINGLE-QUOTE}}}"
|
||||
};
|
||||
|
||||
// if fentanyl patch order exists from this visit then don{{{SINGLE-QUOTE}}}t show alert
|
||||
if exist existing_fentanyl_order then
|
||||
show_alert := "No";
|
||||
endif;
|
||||
|
||||
|
||||
/************************* exception 3 *****************************************/
|
||||
// SQL to see if fentanyl patch/duragesic is a home med and already in OMR
|
||||
existing_fentanyl_omr := read last {
|
||||
"SELECT p.DrugName"
|
||||
||" FROM SXAAMBClientPrescription p with (nolock) JOIN SXAAMBDrugCategoryXRef xr with (nolock)"
|
||||
||" ON p.GenericNameID = xr.GenericNameID"
|
||||
||" JOIN SXAAMBDrugCategory dc with (nolock)"
|
||||
||" ON xr.DrugCategoryID = dc.DrugCategoryID"
|
||||
||" WHERE p.ClientGUID = " || sql(ClientGuid)
|
||||
||" and ((p.DrugName like {{{SINGLE-QUOTE}}}%fentanyl%{{{SINGLE-QUOTE}}} and p.DrugName like {{{SINGLE-QUOTE}}}%transdermal%{{{SINGLE-QUOTE}}}) "
|
||||
||" or (p.DrugName like {{{SINGLE-QUOTE}}}%duragesic%{{{SINGLE-QUOTE}}}))"
|
||||
};
|
||||
|
||||
// if fentanyl patch/duragesic is a home med and exists in OMR then don{{{SINGLE-QUOTE}}}t show alert
|
||||
if exist existing_fentanyl_omr then
|
||||
show_alert := "No";
|
||||
endif;
|
||||
|
||||
/************************* other exceptions *****************************************/
|
||||
// Don{{{SINGLE-QUOTE}}}t fire on fentanyl patch removal orders
|
||||
if (EVOKINGOBJECT.Name matches pattern "%removal%") then
|
||||
show_alert := "No";
|
||||
endif;
|
||||
|
||||
// don{{{SINGLE-QUOTE}}}t fire on fentanyl patch orders that are part of an order set
|
||||
if exists EVOKINGOBJECT.OrderSet then
|
||||
show_alert := "No";
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
// alert message content
|
||||
alert_message := "\nFentanyl Transdermal Patch (Duragesic®) is used ONLY in patients with: " ||
|
||||
"\n " ||
|
||||
"\n1) {{+B}}CHRONIC{{-B}}, severe PAIN requiring long-term, around-the-clock analgesia." ||
|
||||
"\n " ||
|
||||
"\n{{+R}}AND{{-R}}" ||
|
||||
"\n " ||
|
||||
"\n2) {{+B}}OPIOID-TOLERANCE{{-B}}:" ||
|
||||
"\ntaking AT LEAST 60 mg PO morphine OR 30 mg oxycodone OR 8 mg PO hydromorphone OR an equianalgesic-dose of another opioid for 7 DAYS OR MORE" ||
|
||||
"\n ";
|
||||
|
||||
|
||||
// alert destination
|
||||
order_alert_dest := destination {alert} with
|
||||
[alert_type := warning,
|
||||
short_message := "Fentanyl Transdermal Patch (Duragesic®)",
|
||||
priority := "High",
|
||||
scope := Chart,
|
||||
rule_group := "Fentanyl patch",
|
||||
rule_number := 8000,
|
||||
send_with_order := "DoNotSend",
|
||||
alert_dialog_settings := "Must Acknowledge",
|
||||
display_alert := true];
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: fentanyl_orderset_event;
|
||||
fentanyl_order_event;
|
||||
;;
|
||||
logic:
|
||||
|
||||
/************************* Main Rule *****************************************/
|
||||
// if no exceptions stopped the alert from showing then proceed with alert
|
||||
if (show_alert = "Yes") then
|
||||
conclude true;
|
||||
else
|
||||
conclude false;
|
||||
endif;
|
||||
;;
|
||||
action:
|
||||
write alert_message at order_alert_dest;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
94
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_IFEX_MESNA_OS.mlm
Normal file
94
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_IFEX_MESNA_OS.mlm
Normal file
@@ -0,0 +1,94 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Alert_on_Ifex_Mesna_OS ;;
|
||||
mlmname: SCH_Alert_on_Ifex_Mesna_OS ;;
|
||||
arden: version 2.5;;
|
||||
version: 0.00;;
|
||||
institution: St.Clair Hospital ;;
|
||||
author: Sandy Zhang ;;
|
||||
specialist: Shawn Roberts;;
|
||||
date: 2019-02-13;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Hard stop to force users to select a mesna order when ordering ifex on order set "Ifosfamide and Mesna orders (Standard)"
|
||||
;;
|
||||
explanation:
|
||||
|
||||
Change History:
|
||||
2019.02.13 SZ CSR #37916 - Update Ifex/Mesna Order Set
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
citations:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
// initiation of nitroglycerin ointment order
|
||||
ifex_mesna_OS_event:= event{OrderSetEnter User Order :
|
||||
WHERE OrderSetName IN ("Ifosfamide and Mesna orders (Standard)")};
|
||||
|
||||
//Check for unsubmitted nitroglycerin orders
|
||||
(unsubmitted_mesna, origOrderSet) := READ { UnsubmittedOrders: Name, OrderSetName
|
||||
WHERE Name matches pattern "%mesna%"};
|
||||
|
||||
(unsubmitted_ifex, origOrderSet) := READ { UnsubmittedOrders: Name, OrderSetName
|
||||
WHERE Name matches pattern "%ifosfamide%"};
|
||||
|
||||
|
||||
// we want a hard stop when Ifex exists and NO mesna order exists
|
||||
if (exist unsubmitted_ifex) and (NOT exist unsubmitted_mesna) then
|
||||
unsubmitted_order_break_message := "no unbsubmitted mesna order was found :( ";
|
||||
stop_message := true;
|
||||
else
|
||||
unsubmitted_order_break_message := "unbsubmitted order for mesna was found :) ";
|
||||
endif;
|
||||
|
||||
hard_stop := false;
|
||||
|
||||
/************************************** Declare Alert Details ********************************/
|
||||
|
||||
// If stop message is true then set the alert message and fire hard stop alert
|
||||
if (stop_message) then
|
||||
|
||||
// alert destination
|
||||
order_alert_dest := destination {alert} with
|
||||
[alert_type := warning,
|
||||
short_message := "Mesna must be ordered with Ifex(Ifosfamide)",
|
||||
priority := "High",
|
||||
scope := Chart,
|
||||
rule_group := "Mesna Conflict Group",
|
||||
rule_number := 8050,
|
||||
send_with_order := "DoNotSend",
|
||||
alert_dialog_settings := "No Override Allowed",
|
||||
display_alert := true];
|
||||
|
||||
// alert message
|
||||
alert_message := "{{+B}}Mesna must be ordered with Ifex (Ifosfamide). Please go back and select a Mesna order.{{-B}} ";
|
||||
|
||||
hard_stop := true;
|
||||
|
||||
endif;
|
||||
|
||||
/*******************************************************************************************/
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: ifex_mesna_OS_event;
|
||||
|
||||
;;
|
||||
logic: conclude hard_stop;
|
||||
;;
|
||||
action:
|
||||
|
||||
write alert_message at order_alert_dest;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
234
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_NITROGLYCERIN_ORDERS.mlm
Normal file
234
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_NITROGLYCERIN_ORDERS.mlm
Normal file
@@ -0,0 +1,234 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_ALERT_ON_NITROGLYCERIN_ORDERS ;;
|
||||
mlmname: SCH_ALERT_ON_NITROGLYCERIN_ORDERS;;
|
||||
arden: version 2.5;;
|
||||
version: 1.00;;
|
||||
institution: ;;
|
||||
author: Sandy Zhang ;;
|
||||
specialist: Sandy Zhang ;;
|
||||
date: 2017-07-28;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Generate a hard stop alert if nitroglycerin ointment or patch order exists and another is attempting to be ordered.
|
||||
;;
|
||||
explanation:
|
||||
|
||||
Change History:
|
||||
2017.07.28 SZ CSR #33082 - Custom duplicate alert for nitroglycerin ointment and topical patch
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
citations:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
//.Net libraries
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
//Set the stop message
|
||||
stop_message := false;
|
||||
hard_stop := false;
|
||||
|
||||
//Capture current patient data
|
||||
(clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
|
||||
clientVisitGuid := read last {ClientVisit : GUID};
|
||||
chartGuid := read last {ClientVisit : ChartGUID};
|
||||
|
||||
|
||||
//Set med lists for later
|
||||
(nitro_patch_meds) := ("Nitroglycerin 0.1mg/hr Patch", "Nitroglycerin 0.2mg/hr Patch", "Nitroglycerin 0.3mg/hr Patch"
|
||||
, "Nitroglycerin 0.4mg/hr Patch", "Nitroglycerin 0.6mg/hr Patch");
|
||||
|
||||
(nitro_oint_meds) := ("Nitroglycerin 2% Oint");
|
||||
|
||||
|
||||
|
||||
/*************************** Possible Evoking Events ************************************/
|
||||
|
||||
// initiation of nitroglycerin ointment order
|
||||
nitro_oint_event:= event{OrderInit User Order :
|
||||
WHERE Name = "Nitroglycerin 2% Oint"};
|
||||
|
||||
// initiation of nitroglycerin patch order
|
||||
nitro_patch_event := event{OrderInit User Order :
|
||||
WHERE Name IN ("Nitroglycerin 0.1mg/hr Patch"
|
||||
, "Nitroglycerin 0.2mg/hr Patch"
|
||||
, "Nitroglycerin 0.3mg/hr Patch"
|
||||
, "Nitroglycerin 0.4mg/hr Patch"
|
||||
, "Nitroglycerin 0.6mg/hr Patch")};
|
||||
|
||||
// initiation of nitroglycerin ointment orderset
|
||||
nitro_oint_orderset_event := event{OrderSetInit User OrderSet :
|
||||
WHERE OrderSetName IN ("Nitroglycerin Ointment","Nitroglycerin Ointment")};
|
||||
|
||||
|
||||
// initiation of nitroglycerin patch orderset
|
||||
nitro_patch_orderset_event := event{OrderSetInit User OrderSet :
|
||||
WHERE OrderSetName IN ("Nitroglycerin Patch")};
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Determine evoking event -
|
||||
if (EvokingEvent = nitro_patch_event OR EvokingEvent = nitro_oint_event) then
|
||||
|
||||
(this_order_id, this_order) := read last {Order : GUID, Name Referencing EvokingObject};
|
||||
else
|
||||
(this_order_id, this_order) := read last {OrderSet : GUID, OrderSetName Referencing EvokingObject};
|
||||
endif;
|
||||
|
||||
|
||||
//Check for unsubmitted nitroglycerin orders
|
||||
(existing_orders, origOrderSet) := READ { UnsubmittedOrders: Name, OrderSetName
|
||||
WHERE Name matches pattern "Nitroglycerin 0.1mg/hr Patch%"
|
||||
OR Name matches pattern "Nitroglycerin 0.2mg/hr Patch%"
|
||||
OR Name matches pattern "Nitroglycerin 0.3mg/hr Patch%"
|
||||
OR Name matches pattern "Nitroglycerin 0.4mg/hr Patch%"
|
||||
OR Name matches pattern "Nitroglycerin 0.6mg/hr Patch%"
|
||||
OR Name matches pattern "Nitroglycerin 2% Oint%"};
|
||||
|
||||
if (exist existing_orders) then
|
||||
found_unsubmitted_order := "unbsubmitted orders were found :) ";
|
||||
|
||||
else
|
||||
no_unsubmitted_order := "no unbsubmitted orders were found :( ";
|
||||
|
||||
//No unsubmitted nitroglycerin order - check for existing nitroglycerin active orders
|
||||
(existing_orders,
|
||||
origOrderSet) := read {"SELECT o.Name, o.OrderSetName, o.TouchedWhen"
|
||||
|| " FROM CV3Order as o with (nolock) JOIN CV3OrderCatalogMasterItem AS ocmi with (nolock)"
|
||||
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
|
||||
|| " WHERE o.ClientGUID = " || clientGuid
|
||||
|| " AND o.ClientVisitGUID = " || clientVisitGuid
|
||||
|| " AND o.ChartGUID = " || chartGuid
|
||||
|| " AND (o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 2% Oint%{{{SINGLE-QUOTE}}}"
|
||||
|| " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.1mg/hr Patch%{{{SINGLE-QUOTE}}}"
|
||||
|| " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.2mg/hr Patch%{{{SINGLE-QUOTE}}}"
|
||||
|| " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.3mg/hr Patch%{{{SINGLE-QUOTE}}}"
|
||||
|| " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.4mg/hr Patch%{{{SINGLE-QUOTE}}}"
|
||||
|| " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.6mg/hr Patch%{{{SINGLE-QUOTE}}})"
|
||||
|| " AND"
|
||||
|| " ((o.OrderStatusLevelNum > 15"
|
||||
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|
||||
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
|
||||
, primarytime = touchedWhen};
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
// if an existing order was detected
|
||||
if (exist existing_orders) then
|
||||
//Keep counter in case other nitroglycerin order exist that are not in conflict
|
||||
i := 0;
|
||||
|
||||
//loop through existing, active patient orders
|
||||
for orderItem in existing_orders do
|
||||
i := i + 1;
|
||||
|
||||
// if ordering nitro ointment
|
||||
if (EvokingEvent = nitro_oint_event) then
|
||||
// and existing order is nitro patch then send alert
|
||||
if ((orderItem in nitro_patch_meds)) then
|
||||
stop_message := true;
|
||||
existing_order_name := orderItem;
|
||||
situation_1 := "ordering nitro ointment and existing order is nitro patch";
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// if ordering nitro ointment from orderset
|
||||
elseif (EvokingEvent = nitro_oint_orderset_event) then
|
||||
// and existing order is nitro patch then send alert
|
||||
if (orderItem in nitro_patch_meds) then
|
||||
stop_message := true;
|
||||
existing_order_name := orderItem;
|
||||
situation_2 := "ordering nitro ointment from orderset and existing order is nitro patch ";
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// if ordering nitro patch
|
||||
elseif (EvokingEvent = nitro_patch_event) then
|
||||
// and existing order is nitro ointment then send alert
|
||||
if ((orderItem in nitro_oint_meds)) then
|
||||
stop_message := true;
|
||||
existing_order_name := orderItem;
|
||||
situation_3 := "ordering nitro patch and existing order is nitro ointment";
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// if ordering patch orderset
|
||||
elseif (EvokingEvent = nitro_patch_orderset_event) then
|
||||
// and existing order is nitro ointment then send alert
|
||||
if ((orderItem in nitro_oint_meds)) then
|
||||
stop_message := true;
|
||||
existing_order_name := orderItem;
|
||||
situation_4 := "ordering patch orderset and existing order is nitro ointment ";
|
||||
endif;
|
||||
endif;
|
||||
enddo; //End loop through existing, active nitroglycerin patch/topical orders
|
||||
endif; // End - if (exist existing_orders)
|
||||
|
||||
|
||||
|
||||
/************************************** Declare Alert Details ********************************/
|
||||
|
||||
// If stop message is true then set the alert message and fire hard stop alert
|
||||
if (stop_message) then
|
||||
|
||||
// alert destination
|
||||
order_alert_dest := destination {alert} with
|
||||
[alert_type := warning,
|
||||
short_message := "Nitroglycerin topical/patch Order Conflict",
|
||||
priority := "High",
|
||||
scope := Chart,
|
||||
rule_group := "Nitroglycerin Conflict Group",
|
||||
rule_number := 8050,
|
||||
send_with_order := "DoNotSend",
|
||||
alert_dialog_settings := "No Override Allowed",
|
||||
display_alert := true];
|
||||
|
||||
// alert message
|
||||
alert_message := "{{+B}}Avoid concurrent use of {{+R}}" || this_order || "{{-R}} and {{+R}}"
|
||||
|| existing_order_name || "{{-R}}. Contact physician to adjust orders. {{-B}} ";
|
||||
|
||||
hard_stop := true;
|
||||
|
||||
endif;
|
||||
|
||||
/*******************************************************************************************/
|
||||
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
|
||||
nitro_patch_event;
|
||||
nitro_oint_event;
|
||||
nitro_patch_orderset_event;
|
||||
nitro_oint_orderset_event;
|
||||
|
||||
;;
|
||||
logic:
|
||||
conclude hard_stop;
|
||||
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
write alert_message at order_alert_dest;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,133 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_ALERT_ON_NPO_TUBE_FEEDING_ORDERS;;
|
||||
mlmname: SCH_ALERT_ON_NPO_TUBE_FEEDING_ORDERS;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: Allscripts;;
|
||||
author: Juliet M. Law;;
|
||||
specialist: Maria Pest;;
|
||||
date: 2012-01-17;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Generate an alert if a Tube Feeding order exists when ordering an NPO diet.
|
||||
;;
|
||||
explanation: If user attempts to order NPO (Form name = Diet_NPO), MLM will look for active Tube Feeding order.
|
||||
If exists, form cannot be accessed. Pop up alert will state "Patient has active Tube Feed Order."
|
||||
;;
|
||||
keywords: NPO, Tube Feed, Diet
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
//.Net libraries
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
local_session := cds_session.local;
|
||||
|
||||
/*****************************************************************************************************************/
|
||||
//Set to true if logging needed
|
||||
log_execution_info := false;
|
||||
|
||||
//Set the text for this variable to indicate whether to send the message or not
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
//Set the stop message
|
||||
stop_message := false;
|
||||
|
||||
//Set Stop
|
||||
hard_stop := false;
|
||||
found_unsubmitted_orders := false;
|
||||
existing_orders := ();
|
||||
alert_priority := "High";
|
||||
|
||||
alert_dialog := "No Override Allowed";
|
||||
alert_message := "{{+B}}Patient has active {{+R}}Tube Feed{{-R}} order.{{-B}}";
|
||||
|
||||
//Define events
|
||||
npo_order_event := event{OrderInit User Order :
|
||||
where name = "NPO"};
|
||||
diet_order_event := event{OrderEnter User Order :
|
||||
where name = "Diet"};
|
||||
|
||||
order_alert_dest := destination {alert} with
|
||||
[alert_type := warning,
|
||||
short_message := "NPO Order Conflict",
|
||||
priority := alert_priority,
|
||||
scope := Chart,
|
||||
rule_group := "NPO Conflict Group",
|
||||
rule_number := 9000,
|
||||
send_with_order := send_alert,
|
||||
alert_dialog_settings := alert_dialog,
|
||||
display_alert := true];
|
||||
|
||||
/************************************************************************************************************/
|
||||
|
||||
if called_by_editor then
|
||||
evokingobject := read last {Order : THIS where Name = "NPO"};
|
||||
endif;
|
||||
|
||||
//Capture current patient
|
||||
(clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
|
||||
clientVisitGuid := read last {ClientVisit : GUID};
|
||||
chartGuid := read last {ClientVisit : ChartGUID};
|
||||
|
||||
this_order := read last {Order : Name Referencing EvokingObject};
|
||||
|
||||
(existing_orders) := Read {UnsubmittedOrders : Name
|
||||
WHERE Name matches pattern "Tube Feed%"};
|
||||
|
||||
local_session.SessionUnsubDietExists := false;
|
||||
if (EvokingObject.Name = "Diet") then
|
||||
local_session.SessionUnsubDietExists := true;
|
||||
else
|
||||
local_session.SessionUnsubDietExists := false;
|
||||
endif;
|
||||
|
||||
if (EvokingEvent = npo_order_event) then
|
||||
if ((exists (existing_orders)) AND (count(existing_orders) > 0 )) then
|
||||
hard_stop := true;
|
||||
else
|
||||
(existing_orders) := read {"SELECT o.Name, o.TouchedWhen"
|
||||
|| " FROM CV3Order as o with (nolock) JOIN CV3OrderCatalogMasterItem AS ocmi with (nolock)"
|
||||
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
|
||||
|| " WHERE o.ClientGUID = " || clientGuid
|
||||
|| " AND o.ClientVisitGUID = " || clientVisitGuid
|
||||
|| " AND o.ChartGUID = " || chartGuid
|
||||
|| " AND (o.Name IN ({{{SINGLE-QUOTE}}}Tube Feeding{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}Tube Feeding (No other Diet Order).{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}Tube Feeding(Supplements Existing Diet).{{{SINGLE-QUOTE}}}))"
|
||||
|| " AND"
|
||||
|| " ((o.OrderStatusLevelNum > 15"
|
||||
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|
||||
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
|
||||
, primarytime = touchedWhen};
|
||||
|
||||
order_count := count(existing_orders) as number;
|
||||
|
||||
if (order_count > 0) then
|
||||
hard_stop := true;
|
||||
endif;
|
||||
endif;
|
||||
else
|
||||
hard_stop := false;
|
||||
endif;
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
npo_order_event;
|
||||
diet_order_event;
|
||||
;;
|
||||
logic:
|
||||
conclude hard_stop
|
||||
;;
|
||||
action:
|
||||
write alert_message at order_alert_dest;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
120
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_SPECIALTY_COAGULATION.mlm
Normal file
120
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_SPECIALTY_COAGULATION.mlm
Normal file
@@ -0,0 +1,120 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_ALERT_ON_SPECIALTY_COAGULATION;;
|
||||
mlmname: SCH_ALERT_ON_SPECIALTY_COAGULATION;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: Allscripts;;
|
||||
author: Shawn Head;;
|
||||
specialist: Maria Pest;;
|
||||
date: 2018-04-24;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Generate an alert on Inpatient, Observation, and Emergency patients if specialty coaguation orders being entered (HARD STOP).
|
||||
;;
|
||||
explanation: If user attempts to order a specialty coagulation order on an inpatient, observation, or emergency patient present a hard stop.
|
||||
These orders should be entered for outpatient and physician office orders only.
|
||||
|
||||
04-25-2018 STH CSR#: 36394 - Created
|
||||
08-01-2018 STH CSR#: 36394 - Added logic to alert only once every 20 minutes per patient. This is due to the fact that the alert was
|
||||
presented multiple times when entering the orders through an order set.
|
||||
;;
|
||||
keywords: Thrombotic Risk Profile (ITxM), Antithrombin III Activity (ITxM), APC Resistance (ITxM), Protein C Activity Plasma (ITxM)
|
||||
Factor V Leiden Mutation (ITxM), Factor X (ITxM), Protein S Activity Plasma (ITxM), Prothrombin Gene Variant (ITxM)
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
//.Net libraries
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
/*****************************************************************************************************************/
|
||||
//Set to true if logging needed
|
||||
log_execution_info := false;
|
||||
|
||||
//Set the text for this variable to indicate whether to send the message or not
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
//Set the stop message
|
||||
stop_message := false;
|
||||
|
||||
//Set Stop
|
||||
hard_stop := false;
|
||||
found_unsubmitted_orders := false;
|
||||
existing_orders := ();
|
||||
alert_priority := "High";
|
||||
|
||||
alert_dialog := "Must Comment";
|
||||
alert_message := "Hypercoaguable Profiles/Component testing on Inpatients is not appropriate in a setting of acute thrombosis or current anticoagulant usage. \n\n{{+B}}Please consult Hematology with any questions.{{-B}}\nOffice phone: 412-831-1320";
|
||||
|
||||
//Define events
|
||||
coag_orderinit_event := event{OrderInit User Order :
|
||||
where name in ("Thrombotic Risk Profile (ITxM)","Antithrombin III Activity (ITxM)","APC Resistance (ITxM)","Protein C Activity Plasma (ITxM)","Factor V Leiden Mutation (ITxM)","Factor X (ITxM)","Protein S Activity Plasma (ITxM)","Prothrombin Gene Variant (ITxM)")};
|
||||
//coag_orderenter_event := event{OrderEnter User Order :
|
||||
// where name in ("Thrombotic Risk Profile (ITxM)","Antithrombin III Activity (ITxM)","APC Resistance (ITxM)","Protein C Activity Plasma (ITxM)","Factor V Leiden Mutation (ITxM)","Factor X (ITxM)","Protein S Activity Plasma (ITxM)","Prothrombin Gene Variant (ITxM)")};
|
||||
|
||||
order_alert_dest := destination {alert} with
|
||||
[alert_type := "WARNING",
|
||||
short_message := "Specialty Coagulation Conflict",
|
||||
priority := alert_priority,
|
||||
scope := Chart,
|
||||
rule_group := "Specialty Coagulation Conflict Group",
|
||||
rule_number := 9000,
|
||||
send_with_order := send_alert,
|
||||
display_alert := true,
|
||||
alert_dialog_settings := alert_dialog,
|
||||
async_alert_dialog_settings := async_alert_dialog,
|
||||
document_name := "",
|
||||
document_conditional_text := (),
|
||||
ack_comment_UDDD := "Lab_Hypercoag Alert",
|
||||
ack_comment_UDDD_is_restricted := true];
|
||||
|
||||
|
||||
/************************************************************************************************************/
|
||||
|
||||
if called_by_editor then
|
||||
evokingobject := read last {Order : THIS where Name = "Thrombotic Risk Profile (ITxM)"};
|
||||
endif;
|
||||
|
||||
//Capture current patient
|
||||
(clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
|
||||
(clientVisitGuid, chartGuid, TypeCode) := read last {ClientVisit : GUID, ChartGUID, TypeCode};
|
||||
|
||||
this_order := read last {Order : Name Referencing EvokingObject};
|
||||
|
||||
comm_obj := this_communication.primaryobj;
|
||||
Order_set_name := comm_obj.OrderSetName;
|
||||
|
||||
//Only alert on patients that are currently listed as inpatient, observation, or emergency visit types.
|
||||
if (TypeCode in ("Inpatient","Observation","Emergency")) then
|
||||
AlertAlreadyFired := read last {" select guid From CV3AlertRepository with (nolock)
|
||||
where CreatedWhen >= dateadd(minute,-20,getdate())
|
||||
and status = {{{SINGLE-QUOTE}}}ack{{{SINGLE-QUOTE}}}
|
||||
and AlertComments is not null
|
||||
and UserGUID = " || EVOKINGOBJECT.UserGUID || "
|
||||
and ClientGUID = " ||EVOKINGOBJECT.ClientGUID || "
|
||||
and ClientVisitGUID = " ||EVOKINGOBJECT.ClientVisitGUID };
|
||||
|
||||
if((count(AlertAlreadyFired) = 0) or (AlertAlreadyFired is null))then
|
||||
hard_stop := true;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
coag_orderinit_event;
|
||||
//COAG_orderenter_event;
|
||||
|
||||
;;
|
||||
logic:
|
||||
conclude hard_stop
|
||||
;;
|
||||
action:
|
||||
write alert_message at order_alert_dest;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,146 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_ALERT_ON_TPA_EXCLUSION_FOR_STROKE;;
|
||||
mlmname: SCH_ALERT_ON_TPA_EXCLUSION_FOR_STROKE;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: Allscripts;;
|
||||
author: Juliet M. Law;;
|
||||
specialist: Maria Pest;;
|
||||
date: 2012-09-24;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Generate an alert if an order exists or not for TPA Inclusion/Exclusion.
|
||||
;;
|
||||
explanation: When user attempts to enter Acute Ischemic Stroke order set, this MLM will check for the existence of a TPA
|
||||
Inclusion/Exclusion order. If one exists, but no exclusions have been identified, then this MLM will do
|
||||
nothing. If an order exists with identified exclusions, then an alert will display to the user and
|
||||
display the exclusions. If an no order exists, then an alert will display to the user requesting an
|
||||
order be created.
|
||||
|
||||
Change History
|
||||
2012.09.24 MLM CSR 30685: Created.
|
||||
;;
|
||||
keywords: TPA, Inclusion/Exclusion, stroke
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
//.Net libraries
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
local_session := cds_session.local;
|
||||
|
||||
/*****************************************************************************************************************/
|
||||
//Set to true if logging needed
|
||||
log_execution_info := false;
|
||||
|
||||
//Set the text for this variable to indicate whether to send the message or not
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
//Set the stop message
|
||||
hard_stop := false;
|
||||
hard_stop_message := "";
|
||||
tpaOrderCount := 0;
|
||||
alertDialogSettings := "";
|
||||
alertPriority := "High";
|
||||
|
||||
stroke_order_event := event {OrderSetInit User Order :
|
||||
WHERE OrderSetName = "TPA for Acute Ischemic Stroke"};
|
||||
|
||||
order_alert_dest := destination {Alert} WITH
|
||||
[alert_type := "Warning",
|
||||
short_message := "TPA for Acute Ischemic Stroke Alert",
|
||||
scope := "Chart",
|
||||
rule_group := "TPA for Acute Ischemic Stroke Alert Group",
|
||||
rule_number := 9020,
|
||||
send_with_order := send_alert,
|
||||
display_alert := true,
|
||||
alert_abstract := "",
|
||||
asynch_alert_dialog_settings := "",
|
||||
document_name := "",
|
||||
document_conditional_text := (),
|
||||
ack_comment_UDDD := "",
|
||||
ack_comment_UDDD_is_restricted := False];
|
||||
|
||||
/*********************************************************************************************************************************/
|
||||
|
||||
if called_by_editor then
|
||||
evokingobject := read last {OrderSet : THIS where OrderSetName = "TPA for Acute Ischemic Stroke"};
|
||||
endif;
|
||||
|
||||
//Capture current patient
|
||||
(clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
|
||||
clientVisitGuid := read last {ClientVisit : GUID};
|
||||
chartGuid := read last {ClientVisit : ChartGUID};
|
||||
|
||||
this_order := read last {OrderSet : OrderSetName Referencing EvokingObject};
|
||||
|
||||
//Check for unsubmitted tpa Inclusion/Exclusion orders first
|
||||
(existing_tpa_order, tpaOrderSummaryLine) := read {UnsubmittedOrders : Name, SummaryLine
|
||||
WHERE Name = "tPA Inclusion/ Exclusion Criteria"};
|
||||
|
||||
if (exists existing_tpa_order) then
|
||||
tpaOrderCount := 1;
|
||||
else
|
||||
//Check for existence of TPA Inclusion/Exclusion Order
|
||||
(tpaOrder, tpaOrderSummaryLine) := read {"SELECT o.Name, o.SummaryLine"
|
||||
|| " FROM CV3Order as o with (nolock) JOIN CV3OrderCatalogMasterItem AS ocmi with (nolock)"
|
||||
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
|
||||
|| " WHERE o.ClientGUID = " || Sql(clientGuid)
|
||||
|| " AND o.ClientVisitGUID = " || Sql(clientVisitGuid)
|
||||
|| " AND o.ChartGUID = " || Sql(chartGuid)
|
||||
|| " AND o.Name = {{{SINGLE-QUOTE}}}tPA Inclusion/ Exclusion Criteria{{{SINGLE-QUOTE}}}"
|
||||
|| " AND"
|
||||
|| " ((o.OrderStatusLevelNum > 15"
|
||||
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|
||||
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
|
||||
|
||||
tpaOrderCount := (count tpaOrder) as number;
|
||||
endif;
|
||||
|
||||
if (tpaOrderCount = 0) then
|
||||
hard_stop := true;
|
||||
alertDialogSettings := "No Override Allowed";
|
||||
alertPriority := "High";
|
||||
hard_stop_message := "tPA Inclusion/Exclusion Order has not been completed electronically.\n\nYou must electronically enter a tPA Inclusion/Exclusion Order before you can Proceed.";
|
||||
elseif (tpaOrderCount > 0) then
|
||||
if ((first of (tpaOrderSummaryLine) matches pattern "%No Exclusions%") AND (first of (tpaOrderSummaryLine) matches pattern "%Questions unanswered = 0%%")) then
|
||||
hard_stop := false;
|
||||
else
|
||||
if (NOT (first of (tpaOrderSummaryLine) matches pattern "%Questions unanswered = 0%%")) then
|
||||
hard_stop := true;
|
||||
alertDialogSettings := "No Override Allowed";
|
||||
alertPriority := "High";
|
||||
hard_stop_message := "{{+B}}tPA Inclusion/Exclusion Criteria - {{-B}}\n"
|
||||
|| "The tPA Inclusion/Exclusion Criteria Order contains unanswered questions. You MUST answer"
|
||||
|| " all questions before you can continue.";
|
||||
else
|
||||
hard_stop := true;
|
||||
alertDialogSettings := "Must Acknowledge, Must Comment";
|
||||
alertPriority := "Low";
|
||||
hard_stop_message := "{{+B}}tPA Inclusion/Exclusion Criteria - {{-B}}\n" || first of (tpaOrderSummaryLine)
|
||||
|| "\n\n{{+B}}If you wish to override, enter Comment and Proceed.{{-B}}";
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
order_alert_dest.Priority := alertPriority;
|
||||
order_alert_dest.Alert_Dialog_Settings := alertDialogSettings;
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
//stroke_order_event;
|
||||
;;
|
||||
logic:
|
||||
conclude hard_stop;
|
||||
;;
|
||||
action:
|
||||
write hard_stop_message at order_alert_dest;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
233
MLMStripper/bin/Debug/SCH/SCH_AUTO_GENERATE_ORDERS.mlm
Normal file
233
MLMStripper/bin/Debug/SCH/SCH_AUTO_GENERATE_ORDERS.mlm
Normal file
@@ -0,0 +1,233 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Auto_Generate_Orders ;;
|
||||
mlmname: SCH_Auto_Generate_Orders ;;
|
||||
arden: version 16.3;;
|
||||
version: 16.3;;
|
||||
institution: SCH;;
|
||||
author: Shubhang Acharya;;
|
||||
specialist: ;;
|
||||
date: 2017-08-01;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create order through MLM.
|
||||
|
||||
Argument Required ::
|
||||
1) Client visit GUID
|
||||
2) client_guid
|
||||
3) user_GUID
|
||||
4) location_guid
|
||||
5) Order_Type ( Pass anyone from below three value based on performing operation )
|
||||
A. GeneralOrder
|
||||
B. MedicationOrder
|
||||
C. DiagnosticOrder
|
||||
6) orderItemName ( Pass Name of Order )
|
||||
7) order_Creation_Reason ( Pass reason for order creation. )
|
||||
8) RequestingSource ( Pass RequestedBySource (must be in dictionary) )
|
||||
9) SessionType ( Pass SessionType )
|
||||
10) SessionReason ( Pass SessionReason )
|
||||
|
||||
NOTE: There is commented code in MLM in case developer wants to set custom form field values.
|
||||
|
||||
Sample Argument ::
|
||||
|
||||
MLM_Name := MLM {{{SINGLE-QUOTE}}}SCH_Auto_Generate_Orders{{{SINGLE-QUOTE}}}; // MLM name
|
||||
|
||||
orderItemName := orderItemName; //"CBC W/O Differential"; // "Activity" // Gen_Order ;// "Dietician Consult";
|
||||
//orderItemModifier := ".";
|
||||
//orderItemVersion := "";
|
||||
order_Creation_Reason := "From MLM";
|
||||
RequestingSource := "";
|
||||
SessionType := "Standard";
|
||||
SessionReason := ""; //SessionReason should be blank for Session Type "Standard Orders"
|
||||
|
||||
//user_GUID := 9000010934301190;
|
||||
|
||||
|
||||
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit " ||
|
||||
" where ClientGUID = " || ClientGUID};
|
||||
//Filed_1 := "NUR_PatientStatus"; // set Consult Call field on order
|
||||
//Val_1 := "Inpatient";
|
||||
|
||||
Order_Type := "DiagnosticOrder";
|
||||
|
||||
Status := call MLM_Name with ClientVisitGUID,ClientGUID,user_GUID,location_guid,Order_Type,orderItemName
|
||||
,order_Creation_Reason,RequestingSource,SessionType,SessionReason;//,Filed_1,Val_1;
|
||||
|
||||
|
||||
Return Type ::
|
||||
MLM will return Success if Order created Successfully.
|
||||
MLM will return error_message if any error generate while creating Orders.
|
||||
|
||||
|
||||
Modification History:
|
||||
--------------------------------------------------
|
||||
08.01.2017 SAcharya - CSR# 35187: MLM Created.
|
||||
;;
|
||||
explanation:
|
||||
|
||||
;;
|
||||
keywords: Physician Documenation, Default date
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
//(this_documentcommunication) := argument;
|
||||
|
||||
(client_visit_guid,client_guid,user_GUID,location_guid,Order_Type,orderItemName,Catalog_Item_Modifier
|
||||
,order_Creation_Reason,RequestingSource,SessionType,SessionReason
|
||||
) := argument;
|
||||
|
||||
log_execution_info := FALSE;
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
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 ];
|
||||
|
||||
mlm_name := "SCH_Auto_Generate_Orders";
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
|
||||
If Not Called_By_Editor Then
|
||||
try
|
||||
// Get the Client Visit object.
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((client_visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ; //OK
|
||||
|
||||
// get CatalogMasterItem ObjectsPlus object
|
||||
catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName //OK
|
||||
with orderItemName;
|
||||
|
||||
RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ( (user_GUID as Number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
|
||||
|
||||
// get the location object
|
||||
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
if Order_Type = "GeneralOrder" then
|
||||
// Create the prefilled General order
|
||||
Catalog_Item_Version := "";
|
||||
Order_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
catalog_item, // CatalogMasterItem ObjectsPlus
|
||||
//object
|
||||
//Catalog_Item_Modifier, // string ItemNameModifier
|
||||
//Catalog_Item_Version, // string ItemNameModifierVersion
|
||||
order_Creation_Reason, // CreateReason
|
||||
RequestingCareProvider_obj, // RequestingProvider
|
||||
//ObjectsPlus object
|
||||
RequestingSource, // string requestingSource
|
||||
//(must be in dictionary)
|
||||
SessionType, // string SessionType
|
||||
SessionReason, // string SessionReason
|
||||
location_obj, // Location ReleaseLocGrpID
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
|
||||
|
||||
void := call Order_obj.Save; // Create the order
|
||||
void := call Order_obj.Dispose;
|
||||
|
||||
endif;
|
||||
|
||||
if Order_Type = "MedicationOrder" then
|
||||
|
||||
Order_obj := call {{{SINGLE-QUOTE}}}MedicationOrder{{{SINGLE-QUOTE}}}.CreateMedicationOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
catalog_item, // CatalogMasterItem ObjectsPlus object
|
||||
//Catalog_Item_Modifier, // string ItemNameModifier
|
||||
//Catalog_Item_Version, // string ItemNameModifierVersion
|
||||
order_Creation_Reason, // string CreateReason
|
||||
RequestingCareProvider_obj, // RequestedBy ObjectsPlus object
|
||||
RequestingSource, // string RequestedBySource (must be in dictionary)
|
||||
SessionType, // string SessionType
|
||||
SessionReason, // string SessionReason
|
||||
location_obj,
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
|
||||
//"SignOnSubmit" as {{{SINGLE-QUOTE}}}SuppressNotificationOptions{{{SINGLE-QUOTE}}} ;
|
||||
|
||||
void := call Order_obj.Save; // Create the order
|
||||
void := call Order_obj.Dispose;
|
||||
|
||||
endif;
|
||||
|
||||
if Order_Type = "DiagnosticOrder" then
|
||||
|
||||
Order_obj := call {{{SINGLE-QUOTE}}} DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
catalog_item, // CatalogMasterItem ObjectsPlus object
|
||||
//Catalog_Item_Modifier, // string ItemNameModifier
|
||||
//Catalog_Item_Version, // string ItemNameModifierVersion
|
||||
order_Creation_Reason, // string CreateReason
|
||||
RequestingCareProvider_obj, // RequestedBy ObjectsPlus object
|
||||
RequestingSource, // string RequestedBySource (must be in dictionary)
|
||||
SessionType, // string SessionType
|
||||
SessionReason, // string SessionReason
|
||||
location_obj,
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
|
||||
//"SignOnSubmit" as {{{SINGLE-QUOTE}}}SuppressNotificationOptions{{{SINGLE-QUOTE}}} ;
|
||||
|
||||
|
||||
void := call Order_obj.Save; // Create the order
|
||||
void := call Order_obj.Dispose;
|
||||
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
catch Exception ex
|
||||
|
||||
error_occurred := true;
|
||||
error_message := error_message ||
|
||||
"{{+R}} Order {{-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 ( Order_obj is NOT NULL ) then
|
||||
void:= call Order_obj.Dispose;
|
||||
Order_obj:= null;
|
||||
endif;
|
||||
endcatch;
|
||||
endif;
|
||||
|
||||
conclude true;
|
||||
;;
|
||||
action:
|
||||
if Error_occurred then
|
||||
write "An error has occured in the MLM "
|
||||
|| "{{+B}}" || mlm_name || "{{-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;
|
||||
|
||||
if Error_occurred then
|
||||
return error_message;
|
||||
else
|
||||
return "Success";
|
||||
endif;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
233
MLMStripper/bin/Debug/SCH/SCH_AVL_ACO.mlm
Normal file
233
MLMStripper/bin/Debug/SCH/SCH_AVL_ACO.mlm
Normal file
@@ -0,0 +1,233 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_AVL_ACO;;
|
||||
mlmname: SCH_AVL_ACO;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: St. Cair Hospital;;
|
||||
author: Janet Nordin;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2018-08-03;;
|
||||
validation: Testing;;
|
||||
|
||||
library:
|
||||
purpose: Maintains ACO patients Advanced Visit List data
|
||||
;;
|
||||
|
||||
explanation: This MLM maintains the ACO Advanced Visit List
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
08.15.2018 DW CSR# 37090 - Create and AVL of ACO patients for Care Director staff and Navicare representative
|
||||
02.04.2018 DW HD#3609427 - The large batch ACO updates affect currently admitted patients more than expected. To better update these patients, I added a new trigger for "A&I flowsheet update" which occurs once per shift.
|
||||
|
||||
;;
|
||||
|
||||
keywords: ObjectsPlus, Advanced Visit List Data, ACO
|
||||
;;
|
||||
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
|
||||
// Advanced Visit List Item Names
|
||||
|
||||
AVL_Name := "ACO Patients";
|
||||
AVL_External_ID := "009";
|
||||
AVL_1 := "ACOProgram";
|
||||
AVL_2 := "ACOInsurances";
|
||||
AVL_3 := "ACODischargeDispositions";
|
||||
AVL_4 := "ACODischargeLocations";
|
||||
|
||||
continue_processing:= true;
|
||||
record_remove := false;
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
log_execution_info := false;
|
||||
|
||||
|
||||
// Triggers
|
||||
|
||||
trig_event_enter := event {ClientDocumentEnter User ClientDocument: where (documentname matches pattern "%Profile%") or (documentname = "ED Triage Note") or documentname in ("2. Adult Assessment/Intervention" )};
|
||||
trig_event_modify:= event {ClientDocumentModify User ClientDocument: where (documentname matches pattern "%Profile%") or (documentname = "ED Triage Note") or documentname in ("2. Adult Assessment/Intervention" )};
|
||||
|
||||
|
||||
(VisitGUID, ChartGUID, ClientGUID, docguid) := read last {ClientDocument: ClientVisitGuid, ChartGUID, ClientGUID, guid REFERENCING EvokingObject};
|
||||
|
||||
|
||||
// Destinations
|
||||
|
||||
|
||||
objects_plus_destination := destination {ObjectsPlus} with [ alert_type:= "Warning",short_message:= "Object created by MLM",priority := "low",scope:= "chart",rule_group:= "Advanced Visit List Data Object",rule_number:= 2010];
|
||||
send_alert := "DoNotSend";
|
||||
alert_dest := destination { Alert: warning, "Order Session Type", high, chart, "Order Session Type", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
|
||||
// Gather ACO information
|
||||
|
||||
ACOFlag := read first {"select text from CV3CommentDeclaration with (nolock) where typecode = {{{SINGLE-QUOTE}}}ACO Flags{{{SINGLE-QUOTE}}} and status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}}
|
||||
and ClientGUID = " || ClientGUID || " "
|
||||
};
|
||||
|
||||
if not exists ACOFlag
|
||||
|
||||
then
|
||||
|
||||
// Check for Existing Record to Remove
|
||||
|
||||
ExistingRecord := read last {"
|
||||
select avld.AdvancedVisitListDataGUID
|
||||
from CV3AdvancedVisitListData avld with (nolock)
|
||||
where avld.ClientVisitGUID = " || VisitGUID || " and avld.ExternalID = " || AVL_External_ID || " "
|
||||
};
|
||||
|
||||
if exists ExistingRecord
|
||||
then
|
||||
record_remove := true;
|
||||
else
|
||||
continue_processing := false; // No processing necessary
|
||||
endif;
|
||||
|
||||
|
||||
else
|
||||
|
||||
// Gather Prior Discharge information
|
||||
|
||||
|
||||
(ACODischLoc, ACODischDisp) := read last {"
|
||||
select isnull (dischargelocation, {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}), isnull (DischargeDisposition, {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}})
|
||||
from cv3clientvisit with (nolock) where ClientGUID = " || ClientGUID || "
|
||||
and visitstatus = {{{SINGLE-QUOTE}}}dsc{{{SINGLE-QUOTE}}} order by DischargeDtm desc
|
||||
"};
|
||||
|
||||
if not exists ACODischLoc then ACODischLoc:= " "; endif;
|
||||
if not exists ACODischDisp then ACODischDisp:= " "; endif;
|
||||
|
||||
|
||||
// Gather Visit Insurance plan information
|
||||
|
||||
|
||||
InsurancePlan := read {"
|
||||
select ic.name
|
||||
from CV3FRPContract fc with (nolock)
|
||||
join CV3FRP f with (nolock) on f.GUID = fc.FRPGUID
|
||||
join SXAAMInsuranceCarrier ic with (nolock) on ic.InsuranceCarrierID = f.InsuranceCarrierID
|
||||
where fc.ClientGUID = " || ClientGUID || " and fc.ClientVisitGUID = " || VisitGUID || " and fc.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}
|
||||
order by fc.SequenceNum
|
||||
"};
|
||||
|
||||
If exists InsurancePlan
|
||||
then
|
||||
for i in 1 seqto count InsurancePlan do
|
||||
if i = 1 then InsurancePlanList := InsurancePlan[i];
|
||||
else InsurancePlanList := InsurancePlanList || " / " || InsurancePlan[i];
|
||||
endif;
|
||||
enddo;
|
||||
else
|
||||
InsurancePlanList := " ";
|
||||
endif;
|
||||
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if continue_processing
|
||||
|
||||
then
|
||||
|
||||
// Create Objecs for Add, Update, or Removal of a record
|
||||
|
||||
try
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((VisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
advanced_visit_list_data_obj := call {{{SINGLE-QUOTE}}}AdvancedVisitListData{{{SINGLE-QUOTE}}}.CreateAdvancedVisitListData with (client_visit_obj, AVL_Name, AVL_External_ID) ;
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
|
||||
if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
endcatch;
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
|
||||
priority: 50
|
||||
;;
|
||||
|
||||
evoke:
|
||||
|
||||
trig_event_enter;
|
||||
trig_event_modify;
|
||||
;;
|
||||
|
||||
logic:
|
||||
|
||||
if continue_processing = false
|
||||
|
||||
then
|
||||
|
||||
conclude false;
|
||||
|
||||
else
|
||||
|
||||
|
||||
try
|
||||
|
||||
if record_remove = true
|
||||
|
||||
then
|
||||
// Remove - Update the Advance Visit List Object for purge
|
||||
|
||||
void := call advanced_visit_list_data_obj.Deactivate;
|
||||
void := call advanced_visit_list_data_obj.Purge;
|
||||
objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
|
||||
else
|
||||
// Add or Update - Update the Advance Visit List Object with data
|
||||
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<String>{{{SINGLE-QUOTE}}} with AVL_1 , ACOFlag ;
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<String>{{{SINGLE-QUOTE}}} with AVL_2 , InsurancePlanList ;
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<String>{{{SINGLE-QUOTE}}} with AVL_3 , ACODischDisp ;
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<String>{{{SINGLE-QUOTE}}} with AVL_4 , ACODischLoc ;
|
||||
objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
|
||||
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
|
||||
if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
endcatch;
|
||||
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
|
||||
conclude true;
|
||||
|
||||
|
||||
endif;
|
||||
|
||||
;;
|
||||
|
||||
action:
|
||||
|
||||
if error_occurred
|
||||
then
|
||||
write "An error has occured in the MLM {{+B}}MLM SCH_AVL_ACO {{-B}} Please notify your System Administrators that an error message has occurred for this patient. They will review the following error message: \n" at alert_dest;
|
||||
write error_message at alert_dest;
|
||||
endif;
|
||||
|
||||
if exists objects_plus_destination then write true at objects_plus_destination; endif;
|
||||
|
||||
;;
|
||||
|
||||
urgency: 50;;
|
||||
end:
|
||||
413
MLMStripper/bin/Debug/SCH/SCH_AVL_COPD.mlm
Normal file
413
MLMStripper/bin/Debug/SCH/SCH_AVL_COPD.mlm
Normal file
@@ -0,0 +1,413 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_AVL_COPD;;
|
||||
mlmname: SCH_AVL_COPD;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Juliet Law, Allscripts;;
|
||||
specialist: Dean Miklavic, Allscripts;;
|
||||
date: 2012-06-26;;
|
||||
validation: Testing;;
|
||||
|
||||
library:
|
||||
purpose: Maintains COPD Advanced Visit List data
|
||||
;;
|
||||
|
||||
explanation: This MLM maintains the COPD Advanced Visit List
|
||||
|
||||
;;
|
||||
|
||||
keywords: ObjectsPlus, Advanced Visit List Data, Potential Heart Failure
|
||||
;;
|
||||
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
//****************Make Changes To Spelling And Flags In This Section****************
|
||||
|
||||
|
||||
// Advanced Visit List Item Names
|
||||
AVL_Name := "AVL Potential COPD Patients";
|
||||
AVL_External_ID := "004";
|
||||
AVL_HI_GUID_Coded := "HealthIssue_GUID_Coded";
|
||||
AVL_HI_OnsetDate := "HealthIssue_OnsetDate";
|
||||
AVL_HI_GUID_Patient := "HealthIssue_GUID_Patient";
|
||||
|
||||
// Triggers
|
||||
clientvisit_enter_event := Event {ClientVisitEnter ANY ClientVisit :
|
||||
WHERE TypeCode = "Inpatient" OR TypeCode = "Observation"};
|
||||
|
||||
clientvisit_modify_event := Event {ClientVisitModify ANY ClientVisit :
|
||||
WHERE TypeCode = "Inpatient" OR TypeCode = "Observation"};
|
||||
|
||||
healthissue_enter_event := Event {HealthIssueEnter ANY HealthIssue :
|
||||
WHERE TypeCode IN ("Admitting DX","AMB Med History","Problem-Chronic",
|
||||
"Problem-Proced","Problem-Visit") AND
|
||||
(ShortName matches pattern "%COPD%" OR Text matches pattern "%COPD%") };
|
||||
|
||||
healthissue_modify_event := Event {HealthIssueModify ANY HealthIssue :
|
||||
WHERE TypeCode IN ("Admitting DX","AMB Med History","Problem-Chronic",
|
||||
"Problem-Proced","Problem-Visit") AND
|
||||
(ShortName matches pattern "%COPD%" OR Text matches pattern "%COPD%") };
|
||||
|
||||
healthissue_delete_event := Event {HealthIssueDelete ANY HealthIssue :
|
||||
WHERE TypeCode IN ("Admitting DX","AMB Med History","Problem-Chronic",
|
||||
"Problem-Proced","Problem-Visit") AND
|
||||
(ShortName matches pattern "%COPD%" OR Text matches pattern "%COPD%") };
|
||||
|
||||
healthissue_discontinue_event := Event {HealthIssueDiscontinue ANY HealthIssue :
|
||||
WHERE TypeCode IN ("Admitting DX","AMB Med History","Problem-Chronic",
|
||||
"Problem_Proced","Problem-Visit") AND
|
||||
(ShortName matches pattern "%COPD%" OR Text matches pattern "%COPD%") };
|
||||
|
||||
//Destinations
|
||||
objects_plus_destination := Destination { ObjectsPlus } WITH
|
||||
[alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Advanced Visit List Data Object",
|
||||
rule_number := 2011];
|
||||
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
alert_dest := Destination { alert } WITH
|
||||
[alert_type := "warning",
|
||||
short_message := "Order Session Type",
|
||||
priority := "high",
|
||||
scope := "chart",
|
||||
rule_group := "Order Session Type",
|
||||
rule_number := 15042,
|
||||
send_with_order := send_alert,
|
||||
alert_dialog_settings := "No Override Allowed",
|
||||
display_alert := true];
|
||||
|
||||
//******************Do Not Make Changes Below This Section*******************
|
||||
|
||||
// Specify which .NET assemblies need to be loaded for ObjectsPlus
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
if called_by_editor then
|
||||
EvokingObject := read last { HealthIssue : This };
|
||||
endif;
|
||||
|
||||
// DETERMINE IF PROCESSING SHOULD CONTINUE SECTION
|
||||
|
||||
If EvokingEventType = healthissue_enter_event.type then
|
||||
evokevent := "Health Issue Enter Event";
|
||||
(VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID
|
||||
REFERENCING EvokingObject };
|
||||
endif;
|
||||
|
||||
If EvokingEventType = healthissue_modify_event.type then
|
||||
evokevent := "Health Issue Modify Event";
|
||||
(VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID
|
||||
REFERENCING EvokingObject };
|
||||
endif;
|
||||
|
||||
If EvokingEventType = healthissue_delete_event.type then
|
||||
evokevent := "Health Issue Delete Event";
|
||||
(VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID
|
||||
REFERENCING EvokingObject };
|
||||
endif;
|
||||
|
||||
If EvokingEventType = healthissue_discontinue_event.type then
|
||||
evokevent := "Health Issue Discontinue Event";
|
||||
(VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID
|
||||
REFERENCING EvokingObject };
|
||||
endif;
|
||||
|
||||
IF EvokingEventType = clientvisit_enter_event.type then
|
||||
evokevent := "New Visit Event";
|
||||
(VisitGUID, ChartGUID, ClientGUID) := read last {ClientVisit: GUID, ChartGUID, ClientGUID
|
||||
REFERENCING EvokingObject};
|
||||
endif;
|
||||
|
||||
IF EvokingEventType = clientvisit_modify_event.type then
|
||||
evokevent := "Change to Inpatient Event";
|
||||
(VisitGUID, ChartGUID, ClientGUID) := read last {ClientVisit: GUID, ChartGUID, ClientGUID
|
||||
REFERENCING EvokingObject};
|
||||
endif;
|
||||
|
||||
PatientType := read last {"SELECT TypeCode "
|
||||
|| "FROM CV3ClientVisit with (nolock) "
|
||||
|| "WHERE TypeCode IN ({{{SINGLE-QUOTE}}}Inpatient{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Observation{{{SINGLE-QUOTE}}}) "
|
||||
|| " AND ClientGUID = " || Sql(ClientGUID)
|
||||
|| " AND ChartGUID = " || Sql(ChartGUID)
|
||||
|| " AND guid = " || Sql(VisitGUID) };
|
||||
|
||||
NonCOPDAdmittingDx := read last {"SELECT Description "
|
||||
|| "FROM CV3HealthIssueDeclaration with (nolock) "
|
||||
|| "WHERE TypeCode = {{{SINGLE-QUOTE}}}ADMITTING DX{{{SINGLE-QUOTE}}} "
|
||||
|| " AND Active = 1 "
|
||||
|| " AND ShortName not like {{{SINGLE-QUOTE}}}%COPD%{{{SINGLE-QUOTE}}} "
|
||||
|| " AND Text not like {{{SINGLE-QUOTE}}}%COPD%{{{SINGLE-QUOTE}}} "
|
||||
|| " AND ClientGuid = " || Sql(ClientGuid)
|
||||
|| " AND ChartGuid = " || Sql(ChartGuid)
|
||||
|| " AND ClientVisitGUID = " || Sql(VisitGUID) };
|
||||
|
||||
PastCOPDAdmittingDx := read last {"SELECT Description "
|
||||
|| " FROM CV3HealthIssueDeclaration with (nolock) "
|
||||
|| " WHERE Active = 1 "
|
||||
|| " AND TypeCode <> {{{SINGLE-QUOTE}}}Admitting DX{{{SINGLE-QUOTE}}} "
|
||||
|| " AND ShortName like ({{{SINGLE-QUOTE}}}%COPD%{{{SINGLE-QUOTE}}}) "
|
||||
|| " AND ClientGuid = " || Sql(ClientGuid) };
|
||||
|
||||
WasBeddedPriorToModify := read last {"SELECT l.shortname "
|
||||
|| " FROM CV3ClientVisitLocation cvl with (nolock) JOIN CV3Location l with (nolock) "
|
||||
|| " ON l.guid = cvl.locationguid "
|
||||
|| " WHERE l.typecode = {{{SINGLE-QUOTE}}}bed{{{SINGLE-QUOTE}}} "
|
||||
|| " AND cvl.status <> {{{SINGLE-QUOTE}}}cur{{{SINGLE-QUOTE}}} "
|
||||
|| " AND cvl.clientguid = " || Sql(ClientGuid)
|
||||
|| " AND cvl.clientvisitguid = " || Sql(VisitGUID) };
|
||||
|
||||
If ((EvokingEventType = healthissue_enter_event.type
|
||||
or EvokingEventType = healthissue_modify_event.type
|
||||
or EvokingEventType = healthissue_delete_event.type
|
||||
or EvokingEventType = healthissue_discontinue_event.type )
|
||||
and PatientType is not null)
|
||||
or ((EvokingEventType = clientvisit_modify_event.type
|
||||
or clientvisit_enter_event.type)
|
||||
and (not exists NonCOPDAdmittingDx
|
||||
and not exists WasBeddedPriorToModify
|
||||
and (exists PastCOPDAdmittingDx) ) )
|
||||
then
|
||||
|
||||
//INPATIENT/OBSERVATION PATIENT PROCEED SECTION
|
||||
//VISIT EVENT SECTION
|
||||
If (EvokingEventType = clientvisit_enter_event.type or EvokingEventType = clientvisit_modify_event.type) then
|
||||
//Attain the patient{{{SINGLE-QUOTE}}}s admitting dx guid for use as patient health issue guid
|
||||
current_health_issue_id := read last{"SELECT GUID "
|
||||
|| " FROM CV3HealthIssueDeclaration with (nolock) "
|
||||
|| " WHERE TypeCode = {{{SINGLE-QUOTE}}}Admitting Dx{{{SINGLE-QUOTE}}} "
|
||||
|| " AND ClientVisitGUID = " || Sql(VisitGuid) };
|
||||
|
||||
//HEALTH ISSUE EVENT SECTION
|
||||
else
|
||||
//Get data from the evoking Health Issue
|
||||
(current_coded_health_issue_id,
|
||||
current_onset_day_num,
|
||||
current_onset_month_num,
|
||||
current_onset_year_num,
|
||||
current_health_issue_id,
|
||||
current_status,
|
||||
existing_health_issue_obj) := read last { HealthIssue: CodedHealthIssueGUID, OnsetDayNum, OnsetMonthNum,
|
||||
OnsetYearNum, GUID, Status, Backup
|
||||
REFERENCING EvokingObject };
|
||||
|
||||
endif; // If Patient Type or Health Issue event
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
continue_processing:= true;
|
||||
log_execution_info := false;
|
||||
is_closed := false;
|
||||
is_active := false;
|
||||
|
||||
//HEALTH HEALTH ISSUE MODIFY SECTION
|
||||
if( EvokingEventType = healthissue_modify_event.type ) then
|
||||
if(existing_health_issue_obj is not null) then
|
||||
health_issue_onset_date_obj := existing_health_issue_obj.OnsetDate;
|
||||
|
||||
// processing only continues if status or onset date changes
|
||||
if( existing_health_issue_obj.Status = current_status AND
|
||||
( health_issue_onset_date_obj.Day = current_onset_day_num AND
|
||||
health_issue_onset_date_obj.Month = current_onset_month_num AND
|
||||
health_issue_onset_date_obj.Year = current_onset_year_num ) ) then
|
||||
|
||||
continue_processing:= false;
|
||||
|
||||
elseif (existing_health_issue_obj.Status <> current_status ) then
|
||||
|
||||
( is_closed, is_active ) := read { "EXEC SCMGetHealthIssueStatusSelPr " || SQL(current_status) };
|
||||
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
//CONTINUE PROCESSING (except for Health Issue Modify event where something other than status or onset date changed)
|
||||
if continue_processing then
|
||||
try
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((VisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
|
||||
// Create the AdvancedVisitListData object.
|
||||
advanced_visit_list_data_obj := call {{{SINGLE-QUOTE}}}AdvancedVisitListData{{{SINGLE-QUOTE}}}.CreateAdvancedVisitListData
|
||||
with (client_visit_obj, AVL_Name, AVL_External_ID) ;
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
if ( advanced_visit_list_data_obj is NOT NULL ) then
|
||||
void:= call advanced_visit_list_data_obj.Dispose;
|
||||
advanced_visit_list_data_obj:= null;
|
||||
endif;
|
||||
|
||||
if ( client_visit_obj is NOT NULL ) then
|
||||
void:= call client_visit_obj.Dispose;
|
||||
client_visit_obj:= null;
|
||||
endif;
|
||||
|
||||
endcatch;
|
||||
endif;
|
||||
|
||||
//End of INPATIENT/OBSERVATION PATIENT PROCEED SECTION
|
||||
else
|
||||
//DO NOT PROCEED SECTION
|
||||
continue_processing:= false;
|
||||
endif; // If PatientType
|
||||
|
||||
;;
|
||||
|
||||
priority: 50
|
||||
;;
|
||||
|
||||
evoke:
|
||||
|
||||
|
||||
1 minutes after time of clientvisit_enter_event;
|
||||
1 minutes after time of clientvisit_modify_event;
|
||||
0 minutes after time of healthissue_enter_event;
|
||||
0 minutes after time of healthissue_modify_event;
|
||||
0 minutes after time of healthissue_delete_event;
|
||||
0 minutes after time of healthissue_discontinue_event;
|
||||
|
||||
;;
|
||||
|
||||
logic:
|
||||
|
||||
if( EvokingObject is null or continue_processing = false ) then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
try
|
||||
if( is_closed AND is_active ) then
|
||||
void := call advanced_visit_list_data_obj.Deactivate;
|
||||
// don{{{SINGLE-QUOTE}}}t conclude false as we still need to return true to OP destination
|
||||
continue_processing:= false;
|
||||
endif;
|
||||
|
||||
if( continue_processing ) then
|
||||
|
||||
//HEALTH ISSUE ENTER OR HEALTH ISSUE MODIFY SECTION
|
||||
// Client Visit Event
|
||||
if (EvokingEventType = clientvisit_enter_event.type or EvokingEventType = clientvisit_modify_event.type) then
|
||||
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<Nullable<Int64>>{{{SINGLE-QUOTE}}}
|
||||
with (AVL_HI_GUID_Patient, (current_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
|
||||
|
||||
else
|
||||
|
||||
|
||||
// Health Issue Enter or Modify Event
|
||||
if( EvokingEventType = healthissue_enter_event.type or EvokingEventType = healthissue_modify_event.type) then
|
||||
|
||||
// Set the Patient Health Issue GUID.
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<Nullable<Int64>>{{{SINGLE-QUOTE}}}
|
||||
with (AVL_HI_GUID_Patient, (current_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
// Set the Coded Health Issue.
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<Nullable<Int64>>{{{SINGLE-QUOTE}}}
|
||||
with (AVL_HI_GUID_Coded,(current_coded_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
// Set the Onset Date if available.
|
||||
if( current_onset_year_num is not null and current_onset_year_num > 0 ) then
|
||||
if( current_onset_month_num is null or current_onset_month_num <= 0 ) then
|
||||
current_onset_month_num:= 1;
|
||||
else
|
||||
if ( current_onset_day_num is null or current_onset_day_num <= 0 ) then
|
||||
current_onset_day_num:= 1;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
onset_date_string := (current_onset_year_num as String) || "-" || (current_onset_month_num as String) || "-" || (current_onset_day_num as String);
|
||||
onset_date := onset_date_string as time;
|
||||
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<Nullable<DateTime>>{{{SINGLE-QUOTE}}}
|
||||
with (AVL_HI_OnsetDate, onset_date as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}});
|
||||
endif;
|
||||
|
||||
|
||||
//HEALTH ISSUE DELETE SECTION
|
||||
// Deactivate then delete the Advanced Visit List Data
|
||||
elseif ( EvokingEventType = healthissue_delete_event.type ) then
|
||||
void := call advanced_visit_list_data_obj.Deactivate;
|
||||
void := call advanced_visit_list_data_obj.Purge;
|
||||
//HEALTH ISSUE DISCONTINUE SECTION
|
||||
// Deactivate the Advanced Visit List Data
|
||||
elseif ( EvokingEventType = healthissue_discontinue_event.type ) then
|
||||
void := call advanced_visit_list_data_obj.Deactivate;
|
||||
// note: since Deactivate and Delete both permenantly remove the HI from the list,
|
||||
// we will treat them the same and purge the row
|
||||
void := call advanced_visit_list_data_obj.Purge;
|
||||
endif; // if( EvokingEventType = health_issue_enter_event.type or health_issue_modify_event.type )
|
||||
objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
|
||||
|
||||
endif; // If Health Issue Enter etc...
|
||||
|
||||
endif; // if( continue_processing )
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
if ( advanced_visit_list_data_obj is NOT NULL ) then
|
||||
void:= call advanced_visit_list_data_obj.Dispose;
|
||||
advanced_visit_list_data_obj:= null;
|
||||
endif;
|
||||
|
||||
if ( client_visit_obj is NOT NULL ) then
|
||||
void:= call client_visit_obj.Dispose;
|
||||
client_visit_obj:= null;
|
||||
endif;
|
||||
endcatch;
|
||||
|
||||
if ( client_visit_obj is NOT NULL ) then
|
||||
void:= call client_visit_obj.Dispose;
|
||||
client_visit_obj:= null;
|
||||
endif;
|
||||
|
||||
conclude true;
|
||||
;;
|
||||
|
||||
action:
|
||||
|
||||
if error_occurred then
|
||||
|
||||
write "An error has occured in the MLM " ||
|
||||
"{{+B}}MLM SC_AVL_POTENTIAL_COPD {{-B}} " ||
|
||||
"Please notify your System Administrators that an error message has " ||
|
||||
"occurred for this patient. They will review the following error " ||
|
||||
"message: \n" at alert_dest;
|
||||
|
||||
write error_message at alert_dest;
|
||||
endif;
|
||||
|
||||
if exists objects_plus_destination then
|
||||
write true at objects_plus_destination;
|
||||
endif;
|
||||
/*
|
||||
write " Messages " || " List Name.: " || AVL_Name
|
||||
|| " Evoking Event: " || evokevent
|
||||
|| " ObjectGUID1: " || current_health_issue_id
|
||||
|| " ObjectGUID2: " || current_coded_health_issue_id
|
||||
|| " onset_date: " || onset_date
|
||||
|| " ClientVisitGUID: " || VisitGUID
|
||||
|| " PatientType: " || PatientType
|
||||
|| " NonCHFAdmittingDx: " || NonCOPDAdmittingDx
|
||||
|| " PastCHFAdmittingDx: " || PastCOPDAdmittingDx
|
||||
|| " WasBeddedPriorToModify: " || WasBeddedPriorToModify
|
||||
|| " continue_processing : " || continue_processing
|
||||
at alert_dest;
|
||||
*/
|
||||
;;
|
||||
|
||||
urgency: 50;;
|
||||
end:
|
||||
257
MLMStripper/bin/Debug/SCH/SCH_AVL_DIABETES_ONSET.mlm
Normal file
257
MLMStripper/bin/Debug/SCH/SCH_AVL_DIABETES_ONSET.mlm
Normal file
@@ -0,0 +1,257 @@
|
||||
maintenance:
|
||||
|
||||
title: Maintain Advanced Visit List of patients with onset of diabetes;;
|
||||
mlmname: SCH_AVL_DIABETES_ONSET;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: St.Clair Hospital;;
|
||||
author: Debbie Eiler;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2013-07-01;;
|
||||
validation: Testing;;
|
||||
|
||||
library:
|
||||
purpose: Maintains Diabetes Onset Visit List data
|
||||
;;
|
||||
|
||||
explanation: This MLM maintains the Diabetes Onset Advanced Visit List
|
||||
Change history
|
||||
|
||||
07.01.2013 DW CSR# 31622 Created from the Potential Heart Failure Advance Visit List
|
||||
10.07.2013 JL 6.1 upgrade - Corrected ambibuous code field in Health Issue query
|
||||
|
||||
;;
|
||||
|
||||
keywords: ObjectsPlus, Advanced Visit List Data, Diabetes Onset
|
||||
;;
|
||||
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
// Advanced Visit List Item Names
|
||||
|
||||
AVL_Name := "Potential Diabetes Onset";
|
||||
AVL_External_ID := "003";
|
||||
AVL_Result := "ResultValue" ;
|
||||
|
||||
// Triggers
|
||||
|
||||
clientvisit_modify_event := Event {ClientVisitModify BATCH ClientVisit: where typecode = "Inpatient" or typecode = "Observation"};
|
||||
lab_result_enter_event := EVENT {ObservationEnter ANY Observation: WHERE Itemname matches pattern "%A1C%"};
|
||||
|
||||
// Destinations
|
||||
|
||||
objects_plus_destination := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Advanced Visit List Data Object",
|
||||
rule_number := 2010];
|
||||
|
||||
send_alert := "DoNotSend";
|
||||
alert_dest := destination { Alert: warning, "Order Session Type", high, chart, "Order Session Type", 15042, send_alert, "No Override Allowed" };
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
if called_by_editor then
|
||||
EvokingObject := read last {HealthIssue: THIS };
|
||||
endif;
|
||||
|
||||
|
||||
// DETERMINE IF PROCESSING SHOULD CONTINUE SECTION
|
||||
|
||||
If EvokingEventType = lab_result_enter_event.type
|
||||
then
|
||||
evokevent := "Lab Event";
|
||||
(VisitGUID, ChartGUID, ClientGUID) := read last { Observation: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject };
|
||||
endif;
|
||||
|
||||
IF EvokingEventType = clientvisit_modify_event.type
|
||||
then
|
||||
evokevent := "Change to Inpatient Event";
|
||||
(VisitGUID, ChartGUID, ClientGUID) := read last {ClientVisit: GUID, ChartGUID, ClientGUID REFERENCING EvokingObject};
|
||||
endif;
|
||||
|
||||
|
||||
PatientType := read last {"select typecode from CV3ClientVisit with (nolock) where typecode in ({{{SINGLE-QUOTE}}}inpatient{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}observation{{{SINGLE-QUOTE}}}) and
|
||||
ClientGUID = " || ClientGUID || " and ChartGUID = " || ChartGUID || " and guid = " || VisitGUID || " "};
|
||||
|
||||
(Lab_Value, abnormalitycode, ArrivalDtm) := read last {"select bo.value, bo.abnormalitycode, convert(varchar(10), bo.ArrivalDtm,101)
|
||||
from cv3order o with (nolock)
|
||||
join cv3basicobservation as bo with (nolock) on bo.ClientGUID = o.ClientGUID and bo.ChartGUID = o.ChartGUID and bo.clientvisitguid = o.clientvisitguid and bo.orderguid = o.guid and bo.ishistory = 0
|
||||
where o.ClientGUID = " || ClientGUID || " and o.ChartGUID = " || ChartGUID || " and o.clientvisitguid = " || VisitGUID || " and o.name = {{{SINGLE-QUOTE}}}Hemoglobin A1C{{{SINGLE-QUOTE}}} and bo.ItemName = {{{SINGLE-QUOTE}}}Hemoglobin A1C Percent{{{SINGLE-QUOTE}}}
|
||||
and CAST (bo.value as float) >= 6.5"};
|
||||
|
||||
(DiabeticHealthIssue) := read last {"select hi.description
|
||||
from CV3HealthIssueDeclaration hi with (nolock)
|
||||
join CV3CodedHealthIssue h with (nolock) on h.GUID = hi.CodedHealthIssueGUID
|
||||
where hi.Active = 1
|
||||
and (case when h.typecode = {{{SINGLE-QUOTE}}}imo{{{SINGLE-QUOTE}}} then substring(h.code, 5, 20) when h.TypeCode = {{{SINGLE-QUOTE}}}icd9{{{SINGLE-QUOTE}}} then h.code end) > {{{SINGLE-QUOTE}}}250.0{{{SINGLE-QUOTE}}}
|
||||
and (case when h.typecode = {{{SINGLE-QUOTE}}}imo{{{SINGLE-QUOTE}}} then substring(h.code, 5, 20) when h.TypeCode = {{{SINGLE-QUOTE}}}icd9{{{SINGLE-QUOTE}}} then h.code end) < {{{SINGLE-QUOTE}}}250.93{{{SINGLE-QUOTE}}}
|
||||
and ClientGuid = " || ClientGUID || " "};
|
||||
|
||||
|
||||
// If Criteria are met Proceed
|
||||
|
||||
If (EvokingEventType = lab_result_enter_event.type and PatientType is not null and exists Lab_Value and not exists DiabeticHealthIssue)
|
||||
or
|
||||
(EvokingEventType = clientvisit_modify_event.type and exists Lab_Value and not exists DiabeticHealthIssue)
|
||||
|
||||
then
|
||||
|
||||
|
||||
// Lab event section
|
||||
|
||||
|
||||
If EvokingEventType = lab_result_enter_event.type
|
||||
|
||||
then
|
||||
LabValue, abnormalitycode, ArrivalDtm := read last { Observation: value, abnormalitycode, ArrivalDtm REFERENCING EvokingObject };
|
||||
|
||||
// Reformat the Result Date
|
||||
ResultMonth:= EXTRACT Month ArrivalDtm;
|
||||
ResultDay:= EXTRACT Day ArrivalDtm;
|
||||
if ResultMonth < 10 then ResultMonth:= "0" || ResultMonth; endif;
|
||||
if ResultDay < 10 then ResultDay:= "0" || ResultDay; endif;
|
||||
ResultDate := ResultMonth || "/" || ResultDay || "/" || EXTRACT YEAR ArrivalDtm;
|
||||
|
||||
if abnormalitycode = "H" then Lab_Value := LabValue || " (H) " || ResultDate;
|
||||
else Lab_Value := LabValue || " " || ResultDate;
|
||||
endif;
|
||||
|
||||
// Attain patient{{{SINGLE-QUOTE}}}s existing Advanced Visit List Data for re-entry
|
||||
|
||||
(ClientVisitGUID):= read last{"select ClientVisitGUID from CV3AdvancedVisitListData with (nolock)
|
||||
where externalid = " || AVL_External_ID || " and ClientVisitGUID = " || VisitGUID || " "};
|
||||
|
||||
|
||||
// Visit event section
|
||||
|
||||
ElseIf (EvokingEventType = clientvisit_modify_event.type) then
|
||||
|
||||
// Populate Lab data found in the patient record
|
||||
|
||||
if exists Lab_Value then
|
||||
if abnormalitycode = "H" then Lab_Value := Lab_Value || " (H) " || ArrivalDtm ; else Lab_Value := Lab_Value || " " || ArrivalDtm ; endif;
|
||||
else Lab_Value := " ";
|
||||
endif;
|
||||
|
||||
endif; // If Proceed
|
||||
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
continue_processing:= true;
|
||||
log_execution_info := false;
|
||||
is_closed := false;
|
||||
is_active := false;
|
||||
|
||||
// CONTINUE PROCESSING (except for Health Issue Modify event where something other than status or onset date changed)
|
||||
|
||||
if continue_processing
|
||||
then
|
||||
try
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((VisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
|
||||
// Create the AdvancedVisitListData object.
|
||||
|
||||
advanced_visit_list_data_obj := call {{{SINGLE-QUOTE}}}AdvancedVisitListData{{{SINGLE-QUOTE}}}.CreateAdvancedVisitListData
|
||||
with (client_visit_obj, AVL_Name, AVL_External_ID) ;
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
|
||||
if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
endcatch;
|
||||
endif;
|
||||
|
||||
|
||||
// End of INPATIENT/OBSERVATION PATIENT PROCEED SECTION
|
||||
|
||||
|
||||
else
|
||||
|
||||
// DO NOT PROCEED SECTION
|
||||
|
||||
continue_processing:= false;
|
||||
|
||||
|
||||
endif; // If PatientType
|
||||
|
||||
;;
|
||||
|
||||
priority: 50
|
||||
;;
|
||||
|
||||
evoke:
|
||||
|
||||
1 minutes after time of lab_result_enter_event;
|
||||
1 minutes after time of clientvisit_modify_event;
|
||||
;;
|
||||
|
||||
logic:
|
||||
|
||||
|
||||
if( EvokingObject is null or continue_processing = false ) then conclude false; endif;
|
||||
|
||||
try
|
||||
if( is_closed AND is_active )
|
||||
then
|
||||
void := call advanced_visit_list_data_obj.Deactivate;
|
||||
// don{{{SINGLE-QUOTE}}}t conclude false as we still need to return true to OP destination
|
||||
continue_processing:= false;
|
||||
endif;
|
||||
|
||||
if( continue_processing )
|
||||
then
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<String>{{{SINGLE-QUOTE}}} with AVL_Result , Lab_Value ;
|
||||
objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
|
||||
if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
endcatch;
|
||||
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
|
||||
action:
|
||||
|
||||
if error_occurred
|
||||
then
|
||||
|
||||
write "An error has occured in the MLM " ||
|
||||
"{{+B}}MLM SCH_AVL_DIABETES_ONSET {{-B}} " ||
|
||||
"Please notify your System Administrators that an error message has " ||
|
||||
"occurred for this patient. They will review the following error " ||
|
||||
"message: \n" at alert_dest;
|
||||
write error_message at alert_dest;
|
||||
endif;
|
||||
|
||||
if exists objects_plus_destination then write true at objects_plus_destination; endif;
|
||||
|
||||
write " Messages " || " Version 1.. List Name : " || AVL_Name
|
||||
|| " Evoking Event: " || evokevent
|
||||
|| " Lab Value: " || Lab_Value
|
||||
|| " ClientVisitGUID: " || ClientVisitGUID
|
||||
|| " PatientType: " || PatientType
|
||||
|| " DiabetesHI: " || DiabeticHealthIssue
|
||||
|| " continue_processing : " || continue_processing
|
||||
at alert_dest;
|
||||
|
||||
;;
|
||||
|
||||
urgency: 50;;
|
||||
end:
|
||||
211
MLMStripper/bin/Debug/SCH/SCH_AVL_HIGHMARK_GATEWAY.mlm
Normal file
211
MLMStripper/bin/Debug/SCH/SCH_AVL_HIGHMARK_GATEWAY.mlm
Normal file
@@ -0,0 +1,211 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_AVL_HIGHMARK_GATEWAY;;
|
||||
mlmname: SCH_AVL_HIGHMARK_GATEWAY;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: St. Cair Hospital;;
|
||||
author: Janet Nordin;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2018-08-03;;
|
||||
validation: Testing;;
|
||||
|
||||
library:
|
||||
purpose: Maintains ACO patients Advanced Visit List data
|
||||
;;
|
||||
|
||||
explanation: This MLM maintains the ACO Advanced Visit List
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
12.10.2018 DW CSR# 37677 - Create and AVL of Highmark and Gateway paients for Care Director users
|
||||
01.08.2019 DW CSR# 37677 - User requested us to exclude insurance 119B post activation
|
||||
01.16.2019 DW HD#3582632 - Needed to add insurance 786B
|
||||
|
||||
;;
|
||||
|
||||
keywords: ObjectsPlus, Advanced Visit List Data
|
||||
;;
|
||||
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
// Advanced Visit List Item Names
|
||||
|
||||
AVL_Name := "Insurance Plans";
|
||||
AVL_External_ID := "010";
|
||||
AVL_1 := "InsuranceTypes";
|
||||
AVL_2 := "InsurancePlans";
|
||||
|
||||
continue_processing:= true;
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
log_execution_info := false;
|
||||
|
||||
// Trigger
|
||||
|
||||
clientvisit_enter_event := event {ClientVisitEnter ANY ClientVisit: where typecode in ("Inpatient", "Observation", "Emergency") };
|
||||
|
||||
insurance_enter_event := event{InsuranceEnter ANY ClientVisit};
|
||||
insurance_modify_event:= event{InsuranceModify ANY ClientVisit};
|
||||
|
||||
if EvokingEventType = "ClientVisitEnter"
|
||||
then
|
||||
(clientguid, visitguid, visittype) := read last {ClientVisit: clientguid, guid, typecode REFERENCING EvokingObject};
|
||||
else
|
||||
(ClientGuid, visitguid) := read last {Insurance: ClientGuid, ClientVisitGUID REFERENCING EvokingObject};
|
||||
EvokingInsuranceType:= EVOKINGOBJECT.FRPName;
|
||||
visittype := read last { " select typecode from cv3clientvisit with (nolock) where clientguid = " || clientguid || " and guid = " || visitguid || " " };
|
||||
endif;
|
||||
|
||||
|
||||
// Destinations
|
||||
|
||||
|
||||
objects_plus_destination := destination {ObjectsPlus} with [ alert_type:= "Warning",short_message:= "Object created by MLM",priority := "low",scope:= "chart",rule_group:= "Advanced Visit List Data Object",rule_number:= 2010];
|
||||
|
||||
send_alert := "DoNotSend";
|
||||
alert_dest := destination { Alert: Informational, "Diagnostic", low, chart, "Diagnostic", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
|
||||
// Check for Existing Record to Remove
|
||||
|
||||
ExistingRecord := read last {"
|
||||
select avld.AdvancedVisitListDataGUID
|
||||
from CV3AdvancedVisitListData avld with (nolock)
|
||||
where avld.ClientVisitGUID = " || VisitGUID || " and avld.ExternalID = " || AVL_External_ID || " "
|
||||
};
|
||||
|
||||
|
||||
if exists ExistingRecord or EvokingInsuranceType not in ("BLUE CROSS","GATEWAY" ) or visittype not in ("Inpatient", "Observation", "Emergency")
|
||||
|
||||
then
|
||||
|
||||
// Stop processing if the patient is already on the list of if the insurance type is not one of interest
|
||||
|
||||
continue_processing := false;
|
||||
|
||||
|
||||
else
|
||||
|
||||
|
||||
// Gather Visit Insurance plan information
|
||||
|
||||
|
||||
InsuranceType, InsurancePlan := read first {"
|
||||
select f.Name, ic.name
|
||||
from CV3FRPContract fc with (nolock)
|
||||
join CV3FRP f with (nolock) on f.GUID = fc.FRPGUID
|
||||
join SXAAMInsuranceCarrier ic with (nolock) on ic.InsuranceCarrierID = f.InsuranceCarrierID
|
||||
where fc.ClientGUID = " || ClientGUID || " and fc.ClientVisitGUID = " || VisitGUID || "
|
||||
and fc.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} and ic.CarrierCode in ({{{SINGLE-QUOTE}}}709B{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}753B{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}141B{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}786B{{{SINGLE-QUOTE}}})
|
||||
order by fc.SequenceNum
|
||||
"};
|
||||
|
||||
|
||||
// Stop processing if the insurance plan is not one of interest
|
||||
|
||||
|
||||
if not exists InsuranceType then continue_processing := false; endif;
|
||||
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if continue_processing
|
||||
|
||||
then
|
||||
|
||||
// Create Objecs for Add, Update, or Removal of a record
|
||||
|
||||
try
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((VisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
advanced_visit_list_data_obj := call {{{SINGLE-QUOTE}}}AdvancedVisitListData{{{SINGLE-QUOTE}}}.CreateAdvancedVisitListData with (client_visit_obj, AVL_Name, AVL_External_ID) ;
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
|
||||
if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
endcatch;
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
|
||||
priority: 50
|
||||
;;
|
||||
|
||||
evoke:
|
||||
|
||||
4 seconds after time of insurance_enter_event;
|
||||
4 seconds after time of insurance_modify_event;
|
||||
|
||||
|
||||
;;
|
||||
|
||||
logic:
|
||||
|
||||
if continue_processing = false
|
||||
|
||||
then
|
||||
conclude false;
|
||||
else
|
||||
|
||||
try
|
||||
// Add or Update - Update the Advance Visit List Object with data
|
||||
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<String>{{{SINGLE-QUOTE}}} with AVL_1 , InsuranceType ;
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<String>{{{SINGLE-QUOTE}}} with AVL_2 , InsurancePlan ;
|
||||
objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
|
||||
if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
endcatch;
|
||||
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
|
||||
conclude true;
|
||||
|
||||
endif;
|
||||
|
||||
;;
|
||||
|
||||
action:
|
||||
|
||||
if error_occurred
|
||||
then
|
||||
write "An error has occured in the MLM {{+B}}MLM SCH_AVL_HIGHMARK_GATEWAY {{-B}} Please notify your System Administrators that an error message has occurred for this patient. They will review the following error message: \n" at alert_dest;
|
||||
write error_message at alert_dest;
|
||||
endif;
|
||||
|
||||
if exists objects_plus_destination then write true at objects_plus_destination; endif;
|
||||
|
||||
|
||||
// Write Diagnostic Alert Message in PatientIfo/Alerts (remove prior to Production deployment)
|
||||
/*
|
||||
write " Messages "
|
||||
|| " List Name.: " || AVL_Name
|
||||
|| " Evoking Event: " || EvokingEventType
|
||||
|| " Evoking Insurance Type: " || EvokingInsuranceType
|
||||
|| " InsuranceType: " || InsuranceType
|
||||
|| " InsurancePlan: " || InsurancePlan
|
||||
|| " ExistingRecord: " || ExistingRecord
|
||||
|| " continue_processing : " || continue_processing
|
||||
at alert_dest;
|
||||
*/
|
||||
|
||||
|
||||
;;
|
||||
|
||||
urgency: 50;;
|
||||
end:
|
||||
490
MLMStripper/bin/Debug/SCH/SCH_AVL_POTENTIAL_HEART_FAILURE.mlm
Normal file
490
MLMStripper/bin/Debug/SCH/SCH_AVL_POTENTIAL_HEART_FAILURE.mlm
Normal file
@@ -0,0 +1,490 @@
|
||||
maintenance:
|
||||
|
||||
title: Maintain Advanced Visit List Potential Heart Failure;;
|
||||
mlmname: SCH_AVL_POTENTIAL_HEART_FAILURE;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: Eclipsys, Sample MLM;;
|
||||
author: Eclipsys Corporation;;
|
||||
specialist: ;;
|
||||
date: 2011-06-01;;
|
||||
validation: Testing;;
|
||||
|
||||
library:
|
||||
purpose: Maintains Potential Heart Failure Advanced Visit List data
|
||||
;;
|
||||
|
||||
explanation: This MLM maintains the Potential Heart Failure Advanced Visit List
|
||||
|
||||
;;
|
||||
|
||||
keywords: ObjectsPlus, Advanced Visit List Data, Potential Heart Failure
|
||||
;;
|
||||
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
//****************Make Changes To Spelling And Flags In This Section****************
|
||||
|
||||
|
||||
// Advanced Visit List Item Names
|
||||
|
||||
AVL_Name := "Potential Heart Failure";
|
||||
AVL_External_ID := "001";
|
||||
AVL_HI_GUID_Coded := "HealthIssue_GUID_Coded";
|
||||
AVL_HI_OnsetDate := "HealthIssue_OnsetDate";
|
||||
AVL_HI_GUID_Patient:= "HealthIssue_GUID_Patient";
|
||||
AVL_Result := "ResultValue" ;
|
||||
|
||||
|
||||
// Triggers
|
||||
|
||||
clientvisit_enter_event := Event {ClientVisitEnter ANY ClientVisit: where typecode = "Inpatient" or typecode = "Observation"};
|
||||
|
||||
clientvisit_modify_event := Event {ClientVisitModify BATCH ClientVisit: where typecode = "Inpatient" or typecode = "Observation"};
|
||||
|
||||
bnp_result_enter_event:= EVENT {ObservationEnter ANY Observation: WHERE Itemname matches pattern "%BNP%"};
|
||||
|
||||
health_issue_enter_event:= event { HealthIssueEnter Any HealthIssue:
|
||||
where typecode = "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart%") or text matches pattern ("%CHF%") or text matches pattern ("%Heart%"))
|
||||
or typecode <> "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart Failure%"))};
|
||||
|
||||
health_issue_modify_event:= event { HealthIssueModify Any HealthIssue:
|
||||
where typecode = "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart%") or text matches pattern ("%CHF%") or text matches pattern ("%Heart%"))
|
||||
or typecode <> "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart Failure%"))};
|
||||
|
||||
|
||||
health_issue_delete_event:= event { HealthIssueDelete Any HealthIssue:
|
||||
where typecode = "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart%") or text matches pattern ("%CHF%") or text matches pattern ("%Heart%"))
|
||||
or typecode <> "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart Failure%"))};
|
||||
|
||||
|
||||
health_issue_discontinue_event:= event { HealthIssueDiscontinue Any HealthIssue:
|
||||
where typecode = "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart%") or text matches pattern ("%CHF%") or text matches pattern ("%Heart%"))
|
||||
or typecode <> "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart Failure%"))};
|
||||
|
||||
|
||||
// Destinations
|
||||
|
||||
|
||||
objects_plus_destination := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Advanced Visit List Data Object",
|
||||
rule_number := 2010];
|
||||
|
||||
send_alert := "DoNotSend";
|
||||
alert_dest := destination { Alert: warning, "Order Session Type", high, chart, "Order Session Type", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
|
||||
//******************Do Not Make Changes Below This Section*******************
|
||||
|
||||
// Specify which .NET assemblies need to be loaded for ObjectsPlus
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
if called_by_editor then EvokingObject := read last {HealthIssue: THIS }; endif;
|
||||
|
||||
|
||||
// DETERMINE IF PROCESSING SHOULD CONTINUE SECTION
|
||||
|
||||
If EvokingEventType = bnp_result_enter_event.type then evokevent := "BNP Event"; (VisitGUID, ChartGUID, ClientGUID) := read last { Observation: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject }; endif;
|
||||
If EvokingEventType = health_issue_enter_event.type then evokevent := "Health Issue Enter Event"; (VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject }; endif;
|
||||
If EvokingEventType = health_issue_modify_event.type then evokevent := "Health Issue Modify Event"; (VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject }; endif;
|
||||
If EvokingEventType = health_issue_delete_event.type then evokevent := "Health Issue Delete Event"; (VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject }; endif;
|
||||
If EvokingEventType = health_issue_discontinue_event.type then evokevent := "Health Issue Discontinue Event"; (VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject }; endif;
|
||||
IF EvokingEventType = clientvisit_enter_event.type then evokevent := "New Visit Event"; (VisitGUID, ChartGUID, ClientGUID) := read last {ClientVisit: GUID, ChartGUID, ClientGUID REFERENCING EvokingObject}; endif;
|
||||
IF EvokingEventType = clientvisit_modify_event.type then evokevent := "Change to Inpatient Event"; (VisitGUID, ChartGUID, ClientGUID) := read last {ClientVisit: GUID, ChartGUID, ClientGUID REFERENCING EvokingObject}; endif;
|
||||
|
||||
|
||||
PatientType := read last {"select typecode from CV3ClientVisit with (nolock) where typecode in ({{{SINGLE-QUOTE}}}inpatient{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}observation{{{SINGLE-QUOTE}}}) and
|
||||
ClientGUID = " || ClientGUID || " and ChartGUID = " || ChartGUID || " and guid = " || VisitGUID || " "};
|
||||
|
||||
NonCHFAdmittingDx := read last {"Select description from CV3HealthIssueDeclaration with (nolock) where TypeCode = {{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}} and Active = 1
|
||||
and ShortName not like {{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}} and ShortName not like {{{SINGLE-QUOTE}}}%Heart%{{{SINGLE-QUOTE}}} and text not like {{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}} and text not like {{{SINGLE-QUOTE}}}%Heart%{{{SINGLE-QUOTE}}}
|
||||
and ClientGuid = " || ClientGuid || " and ChartGuid = " || ChartGuid || " and ClientVisitGUID = " || VisitGUID};
|
||||
|
||||
PastCHFAdmittingDx := read last {"Select description from CV3HealthIssueDeclaration with (nolock) where Active = 1
|
||||
and typecode <> {{{SINGLE-QUOTE}}}Admitting DX{{{SINGLE-QUOTE}}} and (ShortName like ({{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}}) or ShortName like({{{SINGLE-QUOTE}}}%Heart Failure%{{{SINGLE-QUOTE}}}))
|
||||
and ClientGuid = " || ClientGuid};
|
||||
|
||||
WasBeddedPriorToModify := read last {"Select l.shortname from cv3clientvisitlocation cvl with (nolock)
|
||||
join cv3location l with (nolock) on l.guid = cvl.locationguid
|
||||
where l.typecode = {{{SINGLE-QUOTE}}}bed{{{SINGLE-QUOTE}}} and cvl.status <> {{{SINGLE-QUOTE}}}cur{{{SINGLE-QUOTE}}} and
|
||||
cvl.clientguid = " || ClientGuid || " and cvl.clientvisitguid = " || VisitGUID};
|
||||
|
||||
(BNP_Value, abnormalitycode, ArrivalDtm) := read last {"select bo.value, bo.abnormalitycode, convert(varchar(10), bo.ArrivalDtm,101)
|
||||
from cv3order o with (nolock)
|
||||
join cv3basicobservation as bo with (nolock) on bo.ClientGUID = o.ClientGUID and bo.ChartGUID = o.ChartGUID and bo.clientvisitguid = o.clientvisitguid and bo.orderguid = o.guid and bo.ishistory = 0
|
||||
where o.ClientGUID = " || ClientGUID || " and o.ChartGUID = " || ChartGUID || " and o.clientvisitguid = " || VisitGUID || " and o.name like {{{SINGLE-QUOTE}}}%NT Pro BNP%{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
|
||||
If ((EvokingEventType = bnp_result_enter_event.type or EvokingEventType = health_issue_enter_event.type or EvokingEventType = health_issue_modify_event.type or
|
||||
EvokingEventType = health_issue_delete_event.type or EvokingEventType = health_issue_discontinue_event.type )
|
||||
and PatientType is not null)
|
||||
|
||||
or ((EvokingEventType = clientvisit_modify_event.type or clientvisit_enter_event.type)
|
||||
and (not exists NonCHFAdmittingDx and not exists WasBeddedPriorToModify and (exists PastCHFAdmittingDx or exists BNP_Value) ) )
|
||||
|
||||
then
|
||||
|
||||
|
||||
|
||||
// INPATIENT/OBSERVATION PATIENT PROCEED SECTION
|
||||
|
||||
|
||||
|
||||
// BNP EVENT SECTION
|
||||
|
||||
|
||||
If EvokingEventType = bnp_result_enter_event.type
|
||||
|
||||
then
|
||||
|
||||
BNPValue, abnormalitycode, ArrivalDtm := read last { Observation: value, abnormalitycode, ArrivalDtm REFERENCING EvokingObject };
|
||||
|
||||
ResultMonth:= EXTRACT Month ArrivalDtm;
|
||||
if ResultMonth < 10 then ResultMonth:= "0" || ResultMonth; endif;
|
||||
|
||||
ResultDay:= EXTRACT Day ArrivalDtm;
|
||||
if ResultDay < 10 then ResultDay:= "0" || ResultDay; endif;
|
||||
|
||||
ResultDate := ResultMonth || "/" || ResultDay || "/" || EXTRACT YEAR ArrivalDtm;
|
||||
|
||||
if abnormalitycode = "H" then BNP_Value := BNPValue || " (H) " || ResultDate;
|
||||
else BNP_Value := BNPValue || " " || ResultDate;
|
||||
endif;
|
||||
|
||||
// Attain patient{{{SINGLE-QUOTE}}}s existing Advanced Visit List Data for re-entry
|
||||
|
||||
(onset_date,current_coded_health_issue_id,ObjectGUID2Text, current_health_issue_id,ObjectGUID1Text,ClientVisitGUID)
|
||||
:= read last{"select Date2, ObjectGUID2, ObjectGUID2Text, ObjectGUID1, ObjectGUID1Text,ClientVisitGUID
|
||||
from CV3AdvancedVisitListData with (nolock)
|
||||
where externalid = " || AVL_External_ID || " and ClientVisitGUID = " || VisitGUID || " "};
|
||||
|
||||
// Attain the patient{{{SINGLE-QUOTE}}}s admitting dx guid for use as patient health issue guid when there is no existing relavent health issue
|
||||
|
||||
(current_health_issue_id_admitting)
|
||||
:= read last{" select guid from CV3HealthIssueDeclaration with (nolock) where TypeCode = {{{SINGLE-QUOTE}}}Admitting Dx{{{SINGLE-QUOTE}}} and ClientVisitGUID = " || VisitGUID || " "};
|
||||
|
||||
if not exists current_health_issue_id then current_health_issue_id := current_health_issue_id_admitting; endif;
|
||||
|
||||
|
||||
|
||||
// VISIT EVENT SECTION
|
||||
|
||||
|
||||
ElseIf (EvokingEventType = clientvisit_enter_event.type or EvokingEventType = clientvisit_modify_event.type) then
|
||||
|
||||
|
||||
// Populate BNP data found in the patient record
|
||||
|
||||
if exists BNP_Value then
|
||||
if abnormalitycode = "H" then BNP_Value := BNP_Value || " (H) " || ArrivalDtm ; else BNP_Value := BNP_Value || " " || ArrivalDtm ; endif;
|
||||
else BNP_Value := " "; endif;
|
||||
|
||||
// Attain the patient{{{SINGLE-QUOTE}}}s admitting dx guid for use as patient health issue guid
|
||||
|
||||
current_health_issue_id := read last{" select guid from CV3HealthIssueDeclaration with (nolock) where TypeCode = {{{SINGLE-QUOTE}}}Admitting Dx{{{SINGLE-QUOTE}}} and ClientVisitGUID = " || VisitGuid || " "};
|
||||
|
||||
|
||||
|
||||
// HEALTH ISSUE EVENT SECTION
|
||||
|
||||
|
||||
else
|
||||
|
||||
|
||||
// Get data from the evoking Health Issue
|
||||
|
||||
|
||||
(current_coded_health_issue_id, current_onset_day_num, current_onset_month_num, current_onset_year_num, current_health_issue_id, current_status, existing_health_issue_obj)
|
||||
:= read last { HealthIssue: CodedHealthIssueGUID, OnsetDayNum, OnsetMonthNum, OnsetYearNum, GUID, Status, Backup REFERENCING EvokingObject };
|
||||
|
||||
// Populate BNP data found in the patient record
|
||||
|
||||
if exists BNP_Value then
|
||||
if abnormalitycode = "H" then BNP_Value := BNP_Value || " (H) " || ArrivalDtm ; else BNP_Value := BNP_Value || " " || ArrivalDtm ; endif;
|
||||
else BNP_Value := " "; endif;
|
||||
|
||||
|
||||
|
||||
|
||||
endif; // If BNP or Patient Type or Health Issue event
|
||||
|
||||
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
continue_processing:= true;
|
||||
log_execution_info := false;
|
||||
is_closed := false;
|
||||
is_active := false;
|
||||
|
||||
|
||||
// HEALTH HEALTH ISSUE MODIFY SECTION
|
||||
|
||||
|
||||
if( EvokingEventType = health_issue_modify_event.type )
|
||||
then
|
||||
if(existing_health_issue_obj is not null)
|
||||
then
|
||||
health_issue_onset_date_obj:= existing_health_issue_data_obj.OnsetDate;
|
||||
// processing only continues if status or onset date changes
|
||||
if( existing_health_issue_data_obj.Status = current_status AND
|
||||
( health_issue_onset_date_obj.Day = current_onset_day_num AND
|
||||
health_issue_onset_date_obj.Month = current_onset_month_num AND
|
||||
health_issue_onset_date_obj.Year = current_onset_year_num ) )
|
||||
then
|
||||
continue_processing:= false;
|
||||
elseif (existing_health_issue_data_obj.Status <> current_status )
|
||||
then
|
||||
( is_closed, is_active ) := read { "EXEC SCMGetHealthIssueStatusSelPr " || SQL(current_status) };
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
// CONTINUE PROCESSING (except for Health Issue Modify event where something other than status or onset date changed)
|
||||
|
||||
|
||||
if continue_processing
|
||||
then
|
||||
try
|
||||
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((VisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
|
||||
// Create the AdvancedVisitListData object.
|
||||
|
||||
advanced_visit_list_data_obj := call {{{SINGLE-QUOTE}}}AdvancedVisitListData{{{SINGLE-QUOTE}}}.CreateAdvancedVisitListData
|
||||
with (client_visit_obj, AVL_Name, AVL_External_ID) ;
|
||||
// with (client_visit_obj, AVL_Name, current_health_issue_id) ; /*permits mult of each patient on this list */
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
|
||||
error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
|
||||
endcatch;
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
// End of INPATIENT/OBSERVATION PATIENT PROCEED SECTION
|
||||
|
||||
|
||||
else
|
||||
|
||||
|
||||
// DO NOT PROCEED SECTION
|
||||
|
||||
continue_processing:= false;
|
||||
|
||||
|
||||
|
||||
endif; // If PatientType
|
||||
|
||||
;;
|
||||
|
||||
priority: 50
|
||||
;;
|
||||
|
||||
evoke:
|
||||
|
||||
1 minutes after time of bnp_result_enter_event;
|
||||
1 minutes after time of clientvisit_enter_event;
|
||||
1 minutes after time of clientvisit_modify_event;
|
||||
0 minutes after time of health_issue_enter_event;
|
||||
0 minutes after time of health_issue_modify_event;
|
||||
0 minutes after time of health_issue_delete_event;
|
||||
0 minutes after time of health_issue_discontinue_event;
|
||||
|
||||
;;
|
||||
|
||||
logic:
|
||||
|
||||
|
||||
if( EvokingObject is null or continue_processing = false ) then conclude false; endif;
|
||||
|
||||
try
|
||||
if( is_closed AND is_active )
|
||||
then
|
||||
void := call advanced_visit_list_data_obj.Deactivate;
|
||||
// don{{{SINGLE-QUOTE}}}t conclude false as we still need to return true to OP destination
|
||||
continue_processing:= false;
|
||||
endif;
|
||||
|
||||
if( continue_processing )
|
||||
then
|
||||
|
||||
|
||||
// BNP Enter or HEALTH ISSUE ENTER OR HEALTH ISSUE MODIFY SECTION
|
||||
|
||||
// BNP Enter Event
|
||||
|
||||
If EvokingEventType = bnp_result_enter_event.type then
|
||||
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<Nullable<Int64>>{{{SINGLE-QUOTE}}}
|
||||
with (AVL_HI_GUID_Patient, (current_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<Nullable<Int64>>{{{SINGLE-QUOTE}}}
|
||||
with (AVL_HI_GUID_Coded,(current_coded_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<String>{{{SINGLE-QUOTE}}}
|
||||
with AVL_Result , BNP_Value ;
|
||||
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<Nullable<DateTime>>{{{SINGLE-QUOTE}}}
|
||||
with (AVL_HI_OnsetDate, onset_date as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}});
|
||||
|
||||
objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
|
||||
|
||||
|
||||
|
||||
// Client Visit Event
|
||||
|
||||
elseif (EvokingEventType = clientvisit_enter_event.type or EvokingEventType = clientvisit_modify_event.type)then
|
||||
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<Nullable<Int64>>{{{SINGLE-QUOTE}}}
|
||||
with (AVL_HI_GUID_Patient, (current_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<String>{{{SINGLE-QUOTE}}}
|
||||
with AVL_Result , BNP_Value ;
|
||||
|
||||
objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
|
||||
|
||||
|
||||
else
|
||||
|
||||
|
||||
// Health Issue Enter or Modify Event
|
||||
|
||||
if( EvokingEventType = health_issue_enter_event.type or EvokingEventType = health_issue_modify_event.type)
|
||||
|
||||
then
|
||||
|
||||
// Set the Patient Health Issue GUID.
|
||||
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<Nullable<Int64>>{{{SINGLE-QUOTE}}}
|
||||
with (AVL_HI_GUID_Patient, (current_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
// Set the Coded Health Issue.
|
||||
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<Nullable<Int64>>{{{SINGLE-QUOTE}}}
|
||||
with (AVL_HI_GUID_Coded,(current_coded_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
// Set the BNP Value.
|
||||
|
||||
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<String>{{{SINGLE-QUOTE}}}
|
||||
with AVL_Result , BNP_Value ;
|
||||
|
||||
// Set the Onset Date if available.
|
||||
|
||||
if( current_onset_year_num is not null and current_onset_year_num > 0 )
|
||||
then
|
||||
if( current_onset_month_num is null or current_onset_month_num <= 0 ) then current_onset_month_num:= 1;
|
||||
else if ( current_onset_day_num is null or current_onset_day_num <= 0 ) then current_onset_day_num:= 1;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
onset_date_string := (current_onset_year_num as String) || "-" || (current_onset_month_num as String) || "-" || (current_onset_day_num as String);
|
||||
onset_date := onset_date_string as time;
|
||||
|
||||
void := call
|
||||
advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<Nullable<DateTime>>{{{SINGLE-QUOTE}}}
|
||||
with (AVL_HI_OnsetDate, onset_date as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}});
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// HEALTH ISSUE DELETE SECTION
|
||||
|
||||
|
||||
// Deactivate then delete the Advanced Visit List Data
|
||||
|
||||
elseif ( EvokingEventType = health_issue_delete_event.type )
|
||||
then
|
||||
void := call advanced_visit_list_data_obj.Deactivate;
|
||||
void := call advanced_visit_list_data_obj.Purge;
|
||||
|
||||
|
||||
// HEALTH ISSUE DISCONTINUE SECTION
|
||||
|
||||
|
||||
// Deactivate the Advanced Visit List Data
|
||||
|
||||
elseif ( EvokingEventType = health_issue_discontinue_event.type )
|
||||
then
|
||||
void := call advanced_visit_list_data_obj.Deactivate;
|
||||
// note: since Deactivate and Delete both permenantly remove the HI from the list, we will treat them the same and purge the row
|
||||
void := call advanced_visit_list_data_obj.Purge;
|
||||
|
||||
endif; // if( EvokingEventType = health_issue_enter_event.type or health_issue_modify_event.type )
|
||||
|
||||
|
||||
objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
|
||||
|
||||
|
||||
endif; // If BNP Result/Health Issue Enter etc...
|
||||
|
||||
endif; // if( continue_processing )
|
||||
|
||||
|
||||
|
||||
endtry;
|
||||
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
endcatch;
|
||||
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
|
||||
action:
|
||||
|
||||
if error_occurred
|
||||
then
|
||||
|
||||
write "An error has occured in the MLM " ||
|
||||
"{{+B}}MLM SC_AVL_POTENTIAL_HEART_FAILURE {{-B}} " ||
|
||||
"Please notify your System Administrators that an error message has " ||
|
||||
"occurred for this patient. They will review the following error " ||
|
||||
"message: \n" at alert_dest;
|
||||
write error_message at alert_dest;
|
||||
endif;
|
||||
|
||||
if exists objects_plus_destination then write true at objects_plus_destination; endif;
|
||||
|
||||
write " Messages " || " List Name.: " || AVL_Name
|
||||
|| " Evoking Event: " || evokevent
|
||||
|| " ObjectGUID1: " || current_health_issue_id
|
||||
|| " ObjectGUID1Text: " || ObjectGUID1Text
|
||||
|| " ObjectGUID2: " || current_coded_health_issue_id
|
||||
|| " ObjectGUID2Text: " || ObjectGUID1Text
|
||||
|| " onset_date: " || onset_date
|
||||
|| " BNP Value: " || BNP_Value
|
||||
|| " ClientVisitGUID: " || ClientVisitGUID
|
||||
|| " PatientType: " || PatientType
|
||||
|| " NonCHFAdmittingDx: " || NonCHFAdmittingDx
|
||||
|| " PastCHFAdmittingDx: " || PastCHFAdmittingDx
|
||||
|| " WasBeddedPriorToModify: " || WasBeddedPriorToModify
|
||||
|| " continue_processing : " || continue_processing
|
||||
at alert_dest;
|
||||
|
||||
;;
|
||||
|
||||
urgency: 50;;
|
||||
end:
|
||||
267
MLMStripper/bin/Debug/SCH/SCH_BASAL_INSULIN_CHECK.mlm
Normal file
267
MLMStripper/bin/Debug/SCH/SCH_BASAL_INSULIN_CHECK.mlm
Normal file
@@ -0,0 +1,267 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_BASAL_INSULIN_CHECK;;
|
||||
mlmname: SCH_BASAL_INSULIN_CHECK;;
|
||||
arden: version 2;;
|
||||
version: 5.00;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Shawn Head;;
|
||||
specialist: Janet Nordin;;
|
||||
date: 2016-06-27;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Check to see if Basal Insulin alert needs to present to physicians
|
||||
;;
|
||||
explanation:
|
||||
06.21.2016 - STH - CSR#: 34335 - created {Go-Live Scheduled 9/13/2016}
|
||||
10.20.2016 - STH - CSR#: 34335 - Needed to make a few more modifications so the MLM was backed out and re-loaded on 10/20/2016
|
||||
11.10.2016 - STH - CSR#: 34335 - Need to supress the alert for the ER Major patients also per PRISM. loaded on 11/10/2016
|
||||
03.06.2017 - DW - CSR#: 34335 - Remove from production status per requrest of the physicians
|
||||
06.13.2018 - STH - CSR#: 35114 - Update to include new BGM result/item Glucose, BGM confirmation {Go-Live 6/20/2018}
|
||||
10.05.2018 - STH - CSR#: 37415 - Additional updates requested by Dr. Lou. Change the wording, Add new selection options
|
||||
, remove selection option, add last dose administered, moved active orders to right of result values. {Go-Live 10-17-2018}
|
||||
;;
|
||||
keywords: Objects+, Care Provider Visit Role, Auto create care provider, auto DC care provider
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
/* Set to true if logging is needed.*/
|
||||
log_execution_info:= FALSE;
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
on_order_enter := event {OrderWorksheetSubmit User } ;
|
||||
suggest_ordering := false;
|
||||
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid, VisitType, CurrentLoc):=read last {ClientVisit: GUID, ChartGUID, ClientGUID, TypeCode, CurrentLocation};
|
||||
BasalInsulin_alert:= destination { Alert } WITH
|
||||
[alert_type := "Warning",
|
||||
short_message :="Basal Insulin Suggested",
|
||||
Priority :="HIGH",
|
||||
Scope := "chart",
|
||||
Rule_group :="BASALINSULIN",
|
||||
rule_number := 1005,
|
||||
send_with_order := "",
|
||||
display_alert := TRUE,
|
||||
alert_abstract:= "",
|
||||
alert_dialog_settings := "Must Comment",
|
||||
async_alert_dialog_settings := "",
|
||||
document_name := "",
|
||||
document_conditional_text :=
|
||||
(),
|
||||
ack_comment_UDDD := "BasalAckComment",
|
||||
ack_comment_UDDD_is_restricted := true ];
|
||||
|
||||
userguid,user_id :=read last {UserInfo: guid,idcode};
|
||||
|
||||
if(((substring 3 characters from CurrentLoc) = "ICU") or ((substring 4 characters from CurrentLoc) = "CVSU") or (CurrentLoc = "ER Major")) then
|
||||
SupressAlert := true;
|
||||
else
|
||||
SupressAlert := false;
|
||||
endif;
|
||||
|
||||
//SupressAlert := false;
|
||||
|
||||
occcode := read last {" select OccupationCode from CV3USER U with (nolock)"
|
||||
|| " where guid = " || sql(userguid) };
|
||||
if ((SupressAlert = false) and (occcode in ("MD","DO","DMD","DPM","CRNP","PA","PA-C","IT"))) then
|
||||
|
||||
(Basal_OCMI_GUIDs, Basal_OCMI_Names) := read { " select distinct OCMI.guid, ocmi.Name as {{{SINGLE-QUOTE}}}OrderName{{{SINGLE-QUOTE}}}
|
||||
from CV3OrderCatalogMasterItem OCMI
|
||||
join cv3drugmapping dm on ocmi.guid = dm.catalogitemguid
|
||||
join SXAMultumLevelsForDupMedTherapy dup on dup.DrugId = dm.DrugKey
|
||||
|
||||
where dup.LevelOne_Name = {{{SINGLE-QUOTE}}}intermediate- and long-acting insulins{{{SINGLE-QUOTE}}}
|
||||
and ExpiryDate is null " };
|
||||
|
||||
(existing_Basal_orders) := Read {UnsubmittedOrders : Name
|
||||
WHERE Name in (sql(Basal_OCMI_Names)) };
|
||||
|
||||
if(count(existing_Basal_orders)=0) then
|
||||
(glucose_results,Result_Entered, Result_value) := read { " select guid into #tmp_Glucoseitems from CV3ResultCatalogItem with(nolock)
|
||||
where itemname in ({{{SINGLE-QUOTE}}}Glucose, BGM confirmation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Non-Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Bedside{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Bedside.{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Fasting from Blood Gas{{{SINGLE-QUOTE}}}"
|
||||
|| ",{{{SINGLE-QUOTE}}}Glucose from Blood Gas{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose, ABG, POC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose, VBG, POC{{{SINGLE-QUOTE}}})
|
||||
select bo.value
|
||||
, BO.ENTERED
|
||||
into #tmp_GlucoseResults
|
||||
from #tmp_Glucoseitems tg
|
||||
inner join CV3BasicObservation bo with (nolock)
|
||||
on tg.GUID = bo.ResultItemGUID
|
||||
and bo.ClientGUID = " || sql(ClientGuid) || "
|
||||
and bo.ChartGUID = " || sql(ChartGuid) || "
|
||||
and bo.ClientVisitGUID = " || sql(ClientVisitGuid) || "
|
||||
|
||||
|
||||
select top 2 (CASE WHEN ISNULL(BO.VALUE,{{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}}) >= 200 then {{{SINGLE-QUOTE}}}yes{{{SINGLE-QUOTE}}}
|
||||
when isnull(bo.value,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) like {{{SINGLE-QUOTE}}}>%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}yes{{{SINGLE-QUOTE}}}
|
||||
else {{{SINGLE-QUOTE}}}no{{{SINGLE-QUOTE}}} end) as {{{SINGLE-QUOTE}}}high_result{{{SINGLE-QUOTE}}}
|
||||
, bo.entered
|
||||
, case when isnull(bo.value,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}N/A{{{SINGLE-QUOTE}}} else bo.value end as {{{SINGLE-QUOTE}}}ResultValue{{{SINGLE-QUOTE}}}
|
||||
from #tmp_GlucoseResults bo with(nolock)
|
||||
where bo.Entered >= dateadd(hh,-24,getdate())
|
||||
order by bo.Entered desc
|
||||
|
||||
DROP TABLE #tmp_Glucoseresults, #tmp_Glucoseitems "};
|
||||
|
||||
// //this needs added into the above statement before go-live
|
||||
// where bo.Entered >= dateadd(hh,-24,getdate())
|
||||
ResultDTTM1 := Result_Entered[1];
|
||||
ResultDTTM2 := Result_Entered[2];
|
||||
ctgl := count(glucose_results);
|
||||
|
||||
|
||||
if((count(glucose_results)>=2) and ("no" not in glucose_results)) then
|
||||
//GlucoseResultsMessage := "{{+B}}Last 2 Glucose Results:{{-B}}\n " || ResultDTTM1 || " - {{+B}}{{+R}}" || Result_value[1] || "{{-R}}{{-B}}\n " || ResultDTTM2 || " - {{+B}}{{+R}}" || Result_value[2] || "{{-R}}{{-B}}";
|
||||
|
||||
abc123 := "step1";
|
||||
(Alert_Previous_Fired,Alert_Fired_Dttm,Suppress) := read { " select {{{SINGLE-QUOTE}}}true{{{SINGLE-QUOTE}}}, Entered, (case when alertcomments in ({{{SINGLE-QUOTE}}}Clinical Adjustments Made{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Patient not a candidate for tight glycemic control.{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}I have consulted PCP/Endocrinologist.{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}NO{{{SINGLE-QUOTE}}} end) as {{{SINGLE-QUOTE}}}full_suppress{{{SINGLE-QUOTE}}} from CV3AlertDeclaration WITH (NOLOCK)
|
||||
where ClientGUID = " || sql(ClientGuid) || "
|
||||
and ChartGUID = " || sql(ChartGuid) || "
|
||||
and ClientVisitGUID = " || sql(ClientVisitGuid) || "
|
||||
and description like {{{SINGLE-QUOTE}}}%BASAL INSULIN SUGGESTED%{{{SINGLE-QUOTE}}}
|
||||
and userguid = " || sql(userguid) || "
|
||||
order by entered desc "};
|
||||
/*--REMOVED BECAUSE WE RESTRICTED THE ALERT COMMENT SELECTION TO BE DROP DOWN LIST ONLY, NO FREETEXT ENTRY ALLOWED.
|
||||
and ((alertcomments like {{{SINGLE-QUOTE}}}%Observe for another 24 hours to see if sugars improve%{{{SINGLE-QUOTE}}})
|
||||
or (alertcomments like {{{SINGLE-QUOTE}}}%Fear of hypoglycemia%{{{SINGLE-QUOTE}}}))
|
||||
*/
|
||||
|
||||
if((count(Alert_Previous_Fired)=0) or (("YES" not in Suppress) and ((Result_Entered[1] > Alert_Fired_Dttm[1]) and (Result_Entered[2] > Alert_Fired_Dttm[1])))) then
|
||||
abc123 := "step2";
|
||||
active_basal_insulin_orders := ();
|
||||
Basal_summary_line := ();
|
||||
Basal_Requested_dttm := ();
|
||||
Basal_Administered_dttm := ();
|
||||
Basal_Administered_name := ();
|
||||
Basal_Administered_summaryline := ();
|
||||
(Basal_Requested_dttm, active_basal_insulin_orders, Basal_summary_line
|
||||
,Basal_Administered_dttm, Basal_Administered_name, Basal_Administered_summaryline) := read { "
|
||||
|
||||
select distinct OCMI.guid, ocmi.Name as {{{SINGLE-QUOTE}}}OrderName{{{SINGLE-QUOTE}}}
|
||||
into #tmp_OCMI
|
||||
from CV3OrderCatalogMasterItem OCMI
|
||||
join cv3drugmapping dm on ocmi.guid = dm.catalogitemguid
|
||||
join SXAMultumLevelsForDupMedTherapy dup on dup.DrugId = dm.DrugKey
|
||||
|
||||
where dup.LevelOne_Name = {{{SINGLE-QUOTE}}}intermediate- and long-acting insulins{{{SINGLE-QUOTE}}}
|
||||
and ExpiryDate is null
|
||||
;with orders as (
|
||||
select distinct o.* from #tmp_OCMI ocmi with (nolock)
|
||||
inner join cv3order o with (nolock) on ocmi.GUID = o.OrderCatalogMasterItemGUID
|
||||
and o.ClientGUID = " || sql(ClientGuid) || "
|
||||
and o.ChartGUID = " || sql(ChartGuid) || "
|
||||
and o.ClientVisitGUID = " || sql(ClientVisitGuid) || "
|
||||
),
|
||||
activeorders as (
|
||||
select distinct o.clientguid, o.requestedDtm, o.name, replace(o.summaryline,char(13)+char(10),{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}) as {{{SINGLE-QUOTE}}}summaryline{{{SINGLE-QUOTE}}} from orders o with (Nolock)
|
||||
where o.OrderStatusLevelNum > {{{SINGLE-QUOTE}}}15{{{SINGLE-QUOTE}}}
|
||||
and o.OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}})
|
||||
),
|
||||
lastadmin as (
|
||||
select TOP 1 o.clientguid, isnull(oto.PerformedFromDtm,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) as {{{SINGLE-QUOTE}}}PerformedFromDtm{{{SINGLE-QUOTE}}} , isnull(o.name,{{{SINGLE-QUOTE}}}NO ADMINISTRATION{{{SINGLE-QUOTE}}}) as {{{SINGLE-QUOTE}}}name{{{SINGLE-QUOTE}}}, isnull(replace(o.summaryline,char(13)+char(10),{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}),{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) as {{{SINGLE-QUOTE}}}summaryline{{{SINGLE-QUOTE}}} from orders o
|
||||
inner join CV3OrderTaskOccurrence oto
|
||||
on o.ClientGUID = oto.ClientGUID
|
||||
and o.GUID = oto.OrderGUID
|
||||
and oto.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}}
|
||||
order by oto.PerformedFromDtm
|
||||
)
|
||||
select ao.RequestedDtm, ao.Name, ao.summaryline, la.PerformedFromDtm,la.name, la.summaryline from activeorders ao
|
||||
left join lastadmin la on ao.ClientGUID = la.ClientGUID
|
||||
order by ao.Name
|
||||
|
||||
drop table #tmp_OCMI
|
||||
|
||||
"};
|
||||
/*
|
||||
(Basal_Requested_dttm, active_basal_insulin_orders, Basal_summary_line) := read { "
|
||||
|
||||
|
||||
select distinct OCMI.guid, ocmi.Name as {{{SINGLE-QUOTE}}}OrderName{{{SINGLE-QUOTE}}}
|
||||
into #tmp_OCMI
|
||||
from CV3OrderCatalogMasterItem OCMI
|
||||
join cv3drugmapping dm on ocmi.guid = dm.catalogitemguid
|
||||
join SXAMultumLevelsForDupMedTherapy dup on dup.DrugId = dm.DrugKey
|
||||
|
||||
where dup.LevelOne_Name = {{{SINGLE-QUOTE}}}intermediate- and long-acting insulins{{{SINGLE-QUOTE}}}
|
||||
and ExpiryDate is null
|
||||
|
||||
select distinct o.requestedDtm, o.name, replace(o.summaryline,char(13)+char(10),{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}) from #tmp_OCMI ocmi with (nolock)
|
||||
inner join cv3order o with (nolock) on ocmi.GUID = o.OrderCatalogMasterItemGUID
|
||||
and o.ClientGUID = " || sql(ClientGuid) || "
|
||||
and o.ChartGUID = " || sql(ChartGuid) || "
|
||||
and o.ClientVisitGUID = " || sql(ClientVisitGuid) || "
|
||||
where o.OrderStatusLevelNum > {{{SINGLE-QUOTE}}}15{{{SINGLE-QUOTE}}}
|
||||
and o.OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}})
|
||||
order by o.Name
|
||||
" };
|
||||
*/
|
||||
BasalOrderNames := "";
|
||||
BasalOrderMessage := "";
|
||||
for x in (1 seqto count(active_basal_insulin_orders)) do
|
||||
if(((Basal_Requested_dttm[x] as time) < (ResultDTTM1 as time))
|
||||
and ((Basal_Requested_dttm[x] as time) < (ResultDTTM2 as time))) then
|
||||
suggest_ordering := true;
|
||||
endif;
|
||||
if (count(BasalOrderNames) <= 0) then
|
||||
BasalOrderNames := Basal_Requested_dttm[x] || " - " || active_basal_insulin_orders[x] || "\n {" || Basal_summary_line[x] || "}\n";
|
||||
else
|
||||
BasalOrderNames := BasalOrderNames || Basal_Requested_dttm[x] || " - " || active_basal_insulin_orders[x] || "\n {" || Basal_summary_line[x] || "}\n";
|
||||
endif;
|
||||
enddo;
|
||||
if(count(active_basal_insulin_orders) = 0) then
|
||||
suggest_ordering := true;
|
||||
BasalOrderMessage := "{{+B}}{{+R}}THERE ARE CURRENTLY NO ACTIVE BASAL ORDERS{{-B}}{{-R}}\n " || BasalOrderNames;
|
||||
else
|
||||
BasalOrderMessage := "{{+B}}Active Basal Order Names:{{-B}}\n " || BasalOrderNames;
|
||||
endif;
|
||||
if(count(Basal_Administered_name) <= 0) then
|
||||
Basal_Administered_dttm := "";
|
||||
Basal_Administered_name := "";
|
||||
Basal_Administered_summaryline := "";
|
||||
Basal_Administered_Header := "{{+R}}No Basal Insulin Administered{{-R}}";
|
||||
else
|
||||
Basal_Administered_Header := "Most Recent Administration of Basal";
|
||||
endif;
|
||||
//GlucoseResultsMessage := "{{+B}}Last 2 Glucose Results:{{-B}}\n " || ResultDTTM1 || " - {{+B}}{{+R}}" || Result_value[1] || "{{-R}}{{-B}}\n " || ResultDTTM2 || " - {{+B}}{{+R}}" || Result_value[2] || "{{-R}}{{-B}}";
|
||||
|
||||
|
||||
|
||||
FinalMessageDetails := "{{+B}}Last 2 Glucose Results: " || Basal_Administered_Header || "{{-B}}\n"
|
||||
|| ResultDTTM1 || " - {{+B}}{{+R}}" || Result_value[1] || "{{-R}}{{-B}} "
|
||||
|| Basal_Administered_dttm[1] || " " || Basal_Administered_name[1] || "\n"
|
||||
|| ResultDTTM2 || " - {{+B}}{{+R}}" || Result_value[2] || "{{-R}}{{-B}} " || Basal_Administered_summaryline[1]
|
||||
|| "\n " || BasalOrderMessage|| "\n";
|
||||
|
||||
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
;;
|
||||
evoke: on_order_enter;
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
if(suggest_ordering) then
|
||||
|
||||
error_destination.short_message := "BASAL INSULIN SUGGESTED";
|
||||
alert_message := "Patient has had {{+B}}2 or more Glucose Levels >200mg/dl in the last 24 hours {{-B}}Please consider initiating or adjusting Basal Insulin.\n\n "
|
||||
|| /*"\n\nConsider ordering ""Diabetic Management Protocol"".\n\n" || */FinalMessageDetails; //GlucoseResultsMessage || "\n\n" || BasalOrderMessage;
|
||||
write alert_message at BasalInsulin_alert;
|
||||
//write error_message at error_destination;
|
||||
endif;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
263
MLMStripper/bin/Debug/SCH/SCH_BGM_FREQ_TICU_COLUMN_UPDATE.mlm
Normal file
263
MLMStripper/bin/Debug/SCH/SCH_BGM_FREQ_TICU_COLUMN_UPDATE.mlm
Normal file
@@ -0,0 +1,263 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_BGM_FREQ_TICU_COLUMN_UPDATE;;
|
||||
mlmname: SCH_BGM_FREQ_TICU_COLUMN_UPDATE;;
|
||||
arden: version 2.50;;
|
||||
version: 5.50;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Juliet M. Law, Allscripts Corp;;
|
||||
specialist: Dean Miklavic;;
|
||||
date: 2012-07-27;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
|
||||
;;
|
||||
|
||||
explanation:
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
07.27.2012 JML CSR #26414 Created
|
||||
05.24.2013 JML WO #158336 - BGM frequency enterprise defined column not updating
|
||||
due to order of new POC orders entered and old POC order being discontinued /
|
||||
completed.
|
||||
|
||||
;;
|
||||
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}}};
|
||||
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 {Order: THIS
|
||||
where Name="POC Testing: Blood Glucose Monitor" };
|
||||
endif;
|
||||
|
||||
//Event Triggers
|
||||
bgmOrderEnter := Event { OrderEnter User Order :
|
||||
WHERE Name = "POC Testing: Blood Glucose Monitor" };
|
||||
|
||||
/* -- Commented By Shami --bgmOrderDiscontinue := Event { OrderDiscontinue User Order :
|
||||
WHERE Name = "POC Testing: Blood Glucose Monitor" };
|
||||
|
||||
bgmOrderComplete := Event { OrderComplete User Order :
|
||||
WHERE Name = "POC Testing: Blood Glucose Monitor" };
|
||||
|
||||
bgmOrderCancel := Event { OrderCancel User Order :
|
||||
WHERE Name = "POC Testing: Blood Glucose Monitor" }; -- Commented By SHAMI */
|
||||
|
||||
bgmOrderRelease := Event { OrderRelease User Order :
|
||||
WHERE Name = "POC Testing: Blood Glucose Monitor" };
|
||||
//------------------------------------------------------------
|
||||
// Define the ObjectsPlus destinations
|
||||
//------------------------------------------------------------
|
||||
|
||||
BGMColumn_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "EnterprisePatientListColumn Object",
|
||||
rule_number := 2020 ];
|
||||
//---------------------------------------------------------------
|
||||
// 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
|
||||
ActiveClientVisit_GUID := EvokingObject.ClientVisitGUID;
|
||||
ActiveClient_GUID := EvokingObject.ClientGUID;
|
||||
ActiveChart_GUID := EvokingObject.ChartGUID;
|
||||
|
||||
if (EvokingEvent = bgmOrderEnter) then
|
||||
//Retrieve Frequency Entered on POC Testing: Blood Glucose Monitor order
|
||||
(name, frequency, sessionType) := read last {Order : Name, FrequencyCode, InitialSessionTypeCode
|
||||
REFERENCING EvokingObject};
|
||||
|
||||
|
||||
//Frequency exists, set boolean true to update TICU status board column and store frequency value
|
||||
if (exists frequency) then
|
||||
if (sessionType = "Standard") then
|
||||
bgmFreq := first of (frequency);
|
||||
colUpdate := true;
|
||||
else
|
||||
bgmFreq := "";
|
||||
colUpdate := false;
|
||||
endif;
|
||||
else
|
||||
bgmFreq := "";
|
||||
colUpdate := false;
|
||||
endif;
|
||||
|
||||
//POC Testing: Blood Glucose Monitor order removal; remove TICU status board column value
|
||||
/* -- commemnted by SHAMI-- elseif (EvokingEvent = bgmOrderDiscontinue OR EvokingEvent = bgmOrderCancel OR EvokingEvent = bgmOrderComplete) then
|
||||
//WO #158336 - BGM frequency column not updating due to the order in which users are dc{{{SINGLE-QUOTE}}}ing / completing POC
|
||||
// orders and creating new ones. When a patient is transferred to a new unit, users are entering POC
|
||||
// orders coinciding with the new unit assignment first and completing / dc{{{SINGLE-QUOTE}}}ing POC orders
|
||||
// from previous unit second. This is causing the BGM freq enterprise defined column to lose the latest
|
||||
// freq from the new order.
|
||||
|
||||
//Adding logic to check for existing active (newest) POC order
|
||||
|
||||
curr_BGMFreq := read {"SELECT TOP 1 o.FrequencyCode "
|
||||
|| " FROM CV3Order o "
|
||||
|| " WHERE o.Name = {{{SINGLE-QUOTE}}}POC Testing: Blood Glucose Monitor{{{SINGLE-QUOTE}}} "
|
||||
|| " AND ((o.OrderStatusLevelNum > 15"
|
||||
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}})) "
|
||||
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}}) "
|
||||
|| " AND o.ClientGUID = " || Sql(ActiveClient_GUID)
|
||||
|| " AND o.ClientVisitGUID = " || Sql(ActiveClientVisit_GUID)
|
||||
|| " AND o.ChartGUID = " || Sql(ActiveChart_GUID)
|
||||
|| " ORDER BY o.CreatedWhen DESC"};
|
||||
|
||||
|
||||
if (exists curr_BGMFreq) then
|
||||
bgmFreq := curr_BGMFreq;
|
||||
colUpdate := true;
|
||||
else
|
||||
bgmFreq := "";
|
||||
colUpdate := false;
|
||||
endif; ---END Commenting */
|
||||
elseif (EvokingEvent = bgmOrderRelease) then
|
||||
(name, frequency) := read last {Order : Name, FrequencyCode REFERENCING EvokingObject };
|
||||
if (exists frequency) then
|
||||
bgmFreq := first of (frequency);
|
||||
colUpdate := true;
|
||||
else
|
||||
bgmFreq := "";
|
||||
colUpdate := false;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
bgmOrderEnter;
|
||||
//bgmOrderDiscontinue;
|
||||
//bgmOrderCancel;
|
||||
//bgmOrderComplete;
|
||||
bgmOrderRelease;
|
||||
|
||||
;;
|
||||
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
|
||||
//Retrieve ClientVisit object
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((ActiveClientVisit_GUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
endtry;
|
||||
|
||||
//Error Handling
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Retrieve client:{{-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;
|
||||
|
||||
conclude true;
|
||||
endcatch;
|
||||
|
||||
try
|
||||
//Set Column name and value
|
||||
BgmColumnName := "BGM Frequency";
|
||||
BgmNewColumnValue := bgmFreq;
|
||||
|
||||
//Retrieve column name and set value
|
||||
BGMFreqDefinedColumn_obj := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName
|
||||
with (client_visit_obj, BgmColumnName);
|
||||
|
||||
colValue := BGMFreqDefinedColumn_obj.Value;
|
||||
|
||||
|
||||
if (colValue <> BgmNewColumnValue) then
|
||||
BGMFreqDefinedColumn_obj.Value := BgmNewColumnValue;
|
||||
BGMColumn_Dest.ObjectsPlus := BGMFreqDefinedColumn_obj;
|
||||
endif;
|
||||
endtry;
|
||||
|
||||
//Error Handling
|
||||
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 (BGMFreqDefinedColumn_obj is not null) then
|
||||
void := call BGMFreqDefinedColumn_obj.Dispose;
|
||||
BGMFreqDefinedColumn_obj := null;
|
||||
endif;
|
||||
|
||||
BGMColumn_Dest := null;
|
||||
|
||||
endcatch;
|
||||
|
||||
//Destroy client visit object
|
||||
if (client_visit_obj is not null) then
|
||||
void := call client_visit_obj.Dispose;
|
||||
client_visit_obj := null;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
conclude true;
|
||||
;;
|
||||
action:
|
||||
|
||||
//Error Handling
|
||||
if error_occurred then
|
||||
write "An error occurred in the MLM {{+B}}SCH_BGM_FREQ_TICU_COLUMN_UPDATE{{-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;
|
||||
|
||||
//Evoke ObjectsPlus destination
|
||||
if exists BGMColumn_dest then
|
||||
write true at BGMColumn_dest;
|
||||
endif;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,235 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_BGM_FREQ_TICU_COLUMN_UPDATE_TEST;;
|
||||
mlmname: SCH_BGM_FREQ_TICU_COLUMN_UPDATE_TEST;;
|
||||
arden: version 2.50;;
|
||||
version: 5.50;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Juliet M. Law, Allscripts Corp;;
|
||||
specialist: Dean Miklavic;;
|
||||
date: 2012-07-27;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
|
||||
;;
|
||||
|
||||
explanation:
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
07.27.2012 JML CSR #26414 Created
|
||||
05.24.2013 JML WO #158336 - BGM frequency enterprise defined column not updating
|
||||
due to order of new POC orders entered and old POC order being discontinued /
|
||||
completed.
|
||||
12.01.2017 JML WO #2975746 - Was not filtering out completed POC orders, which were still displaying
|
||||
as the frequency in the status board. Updated the SQL below to filter out Completed
|
||||
(aka OrderStatusLevelNum = 100) order statuses.
|
||||
|
||||
;;
|
||||
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}}};
|
||||
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 {Order: THIS
|
||||
where Name="POC Testing: Blood Glucose Monitor" };
|
||||
endif;
|
||||
|
||||
//Event Triggers
|
||||
|
||||
bgmOrderDiscontinue := Event { OrderDiscontinue User Order :
|
||||
WHERE Name = "POC Testing: Blood Glucose Monitor" };
|
||||
|
||||
bgmOrderComplete := Event { OrderComplete User Order :
|
||||
WHERE Name = "POC Testing: Blood Glucose Monitor" };
|
||||
|
||||
bgmOrderCancel := Event { OrderCancel User Order :
|
||||
WHERE Name = "POC Testing: Blood Glucose Monitor" };
|
||||
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Define the ObjectsPlus destinations
|
||||
//------------------------------------------------------------
|
||||
|
||||
BGMColumn_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "EnterprisePatientListColumn Object",
|
||||
rule_number := 2020 ];
|
||||
//---------------------------------------------------------------
|
||||
// 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
|
||||
ActiveClientVisit_GUID := EvokingObject.ClientVisitGUID;
|
||||
ActiveClient_GUID := EvokingObject.ClientGUID;
|
||||
ActiveChart_GUID := EvokingObject.ChartGUID;
|
||||
|
||||
|
||||
//WO #158336 - BGM frequency column not updating due to the order in which users are dc{{{SINGLE-QUOTE}}}ing / completing POC
|
||||
// orders and creating new ones. When a patient is transferred to a new unit, users are entering POC
|
||||
// orders coinciding with the new unit assignment first and completing / dc{{{SINGLE-QUOTE}}}ing POC orders
|
||||
// from previous unit second. This is causing the BGM freq enterprise defined column to lose the latest
|
||||
// freq from the new order.
|
||||
|
||||
//Adding logic to check for existing active (newest) POC order
|
||||
|
||||
curr_BGMFreq := read last {"SELECT TOP 1 o.FrequencyCode "
|
||||
|| " FROM CV3Order o "
|
||||
|| " WHERE o.Name = {{{SINGLE-QUOTE}}}POC Testing: Blood Glucose Monitor{{{SINGLE-QUOTE}}} "
|
||||
|| " AND ((o.OrderStatusLevelNum > 15"
|
||||
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}})) "
|
||||
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}}) "
|
||||
|| " AND o.ClientGUID = " || Sql(ActiveClient_GUID)
|
||||
|| " AND o.ClientVisitGUID = " || Sql(ActiveClientVisit_GUID)
|
||||
|| " AND o.ChartGUID = " || Sql(ActiveChart_GUID)
|
||||
|| " ORDER BY o.CreatedWhen DESC "};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (exists curr_BGMFreq) then
|
||||
bgmFreq := curr_BGMFreq;
|
||||
colUpdate := true;
|
||||
endif;
|
||||
If (curr_BGMFreq ="" OR curr_BGMFreq is null) THEN
|
||||
bgmFreq := "";
|
||||
colUpdate := true;
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
1 seconds after time of bgmOrderDiscontinue;
|
||||
1 seconds after time of bgmOrderCancel;
|
||||
1 seconds after time of bgmOrderComplete;
|
||||
|
||||
;;
|
||||
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
|
||||
//Retrieve ClientVisit object
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((ActiveClientVisit_GUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
endtry;
|
||||
|
||||
//Error Handling
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Retrieve client:{{-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;
|
||||
|
||||
conclude true;
|
||||
endcatch;
|
||||
|
||||
try
|
||||
//Set Column name and value
|
||||
BgmColumnName := "BGM Frequency";
|
||||
BgmNewColumnValue := bgmFreq;
|
||||
|
||||
//Retrieve column name and set value
|
||||
BGMFreqDefinedColumn_obj := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName
|
||||
with (client_visit_obj, BgmColumnName);
|
||||
|
||||
colValue := BGMFreqDefinedColumn_obj.Value;
|
||||
|
||||
|
||||
if (colValue <> BgmNewColumnValue) then
|
||||
BGMFreqDefinedColumn_obj.Value := BgmNewColumnValue;
|
||||
BGMColumn_Dest.ObjectsPlus := BGMFreqDefinedColumn_obj;
|
||||
endif;
|
||||
endtry;
|
||||
|
||||
//Error Handling
|
||||
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 (BGMFreqDefinedColumn_obj is not null) then
|
||||
void := call BGMFreqDefinedColumn_obj.Dispose;
|
||||
BGMFreqDefinedColumn_obj := null;
|
||||
endif;
|
||||
|
||||
BGMColumn_Dest := null;
|
||||
|
||||
endcatch;
|
||||
|
||||
//Destroy client visit object
|
||||
if (client_visit_obj is not null) then
|
||||
void := call client_visit_obj.Dispose;
|
||||
client_visit_obj := null;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
conclude true;
|
||||
;;
|
||||
action:
|
||||
|
||||
//Error Handling
|
||||
if error_occurred then
|
||||
write "An error occurred in the MLM {{+B}}SCH_BGM_FREQ_TICU_COLUMN_UPDATE{{-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;
|
||||
|
||||
//Evoke ObjectsPlus destination
|
||||
if exists BGMColumn_dest then
|
||||
write true at BGMColumn_dest;
|
||||
endif;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,118 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_BLOOD_REFUSAL_ALERT_ON_ORDER_ENTRY;;
|
||||
filename: SCH_BLOOD_REFUSAL_ALERT_ON_ORDER_ENTRY;;
|
||||
arden: version 2.50;;
|
||||
version: 15.10;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Juliet M. Law;;
|
||||
specialist: Peggy Leschak;;
|
||||
date: 2016-06-17;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Check to see if patient has a health issue for blood refusal OR comment from AMPFM
|
||||
;;
|
||||
explanation: If patient has a health issue for {{{SINGLE-QUOTE}}}Refusal of blood product{{{SINGLE-QUOTE}}} OR {{{SINGLE-QUOTE}}}Transfusion of blood product refused for religious reason{{{SINGLE-QUOTE}}}, then display a soft stop alert
|
||||
when user tries to enter into the following order sets: Red Cell Product Orders, Platelet Orders, FFP Orders, Cryo Orders.
|
||||
|
||||
Change History
|
||||
06.17.2016 JML CSR 33898 - Original Coding.
|
||||
|
||||
;;
|
||||
keywords: blood refusal, alert
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
/*******************Make Changes To Spelling And Flags In This Section*******************/
|
||||
/* Set to true if logging is needed.*/
|
||||
log_execution_info:= false;
|
||||
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
// Set the text for this variable to indicate whether to send the message or not.
|
||||
send_alert := "DoNotSend";
|
||||
bloodHIExists := false;
|
||||
bloodCommentExists := false;
|
||||
displayAlert := false;
|
||||
|
||||
/* Change the message within the quotes if a different short-message is needed. */
|
||||
|
||||
event_var := Event {OrderSetInit User OrderSet :
|
||||
WHERE OrderSetName IN ("Red Cell Product Orders", "Platelet Orders", "FFP Orders", "Cryo Orders") };
|
||||
|
||||
blood_refusal_dest := destination { Alert } with [
|
||||
alert_type := "Warning",
|
||||
short_message := "Blood Refusal Alert",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
Rule_group := "Blood Refusal Alert Group",
|
||||
Rule_number := 9002,
|
||||
Rule_subgroup := "",
|
||||
Send_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true ];
|
||||
|
||||
ClientGuid := EvokingObject.ClientGUID;
|
||||
VisitGuid := EvokingObject.ClientVisitGUID;
|
||||
ChartGuid := EvokingObject.ChartGUID;
|
||||
/***************************************************************************************/
|
||||
|
||||
|
||||
//Check for blood refusal HI
|
||||
blood_hi_exists := READ LAST { "SELECT 1"
|
||||
|| " FROM CV3HealthIssueDeclaration hi WITH (NOLOCK) JOIN CV3CodedHealthIssue chi WITH (NOLOCK)"
|
||||
|| " ON hi.CodedHealthIssueGUID = chi.GUID"
|
||||
|| " WHERE hi.ClientGUID = " || SQL(ClientGuid)
|
||||
|| " AND hi.ClientVisitGUID = " || SQL(VisitGuid)
|
||||
|| " AND hi.Active = 1"
|
||||
|| " AND hi.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|
||||
|| " AND hi.ICD10Code is Not null "
|
||||
|| " AND hi.TypeCode = {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}"
|
||||
|| " AND ( hi.Text IN ({{{SINGLE-QUOTE}}}Refusal of blood product{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Transfusion of blood product refused for religious reason{{{SINGLE-QUOTE}}})"
|
||||
|| " OR hi.ShortName IN ({{{SINGLE-QUOTE}}}Refusal of blood product{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Transfusion of blood product refused for religious reason{{{SINGLE-QUOTE}}}) )" };
|
||||
|
||||
if ( exists blood_hi_exists ) then
|
||||
bloodHIExists := true;
|
||||
endif;
|
||||
|
||||
//Check for Blood Refusal AMPFM comment
|
||||
blood_comm_exists := READ LAST { "SELECT 1"
|
||||
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3CommentDeclaration cd WITH (NOLOCK)"
|
||||
|| " ON cv.GUID = cd.ClientVisitGUID"
|
||||
|| " AND cv.ClientGUID = cd.ClientGUID"
|
||||
|| " AND cv.ChartGUID = cd.ChartGUID"
|
||||
|| " WHERE cv.ClientGUID = " || SQL(ClientGuid)
|
||||
|| " AND cv.GUID = " || SQL(VisitGuid)
|
||||
|| " AND cv.ChartGUID = " || SQL(ChartGuid)
|
||||
|| " AND cd.TypeCode = {{{SINGLE-QUOTE}}}Blood Refusal{{{SINGLE-QUOTE}}}"
|
||||
|| " AND cd.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}" };
|
||||
|
||||
if ( exists blood_comm_exists ) then
|
||||
bloodCommentExists := true;
|
||||
endif;
|
||||
|
||||
if ( bloodHIExists OR bloodCommentExists ) then
|
||||
displayAlert := true;
|
||||
endif;
|
||||
|
||||
;;
|
||||
evoke:
|
||||
event_var;
|
||||
;;
|
||||
logic:
|
||||
conclude displayAlert;
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
//Display Alert to user
|
||||
if ( displayAlert ) then
|
||||
write "Patient has {{+B}}refused {{+R}}Blood Transfusions{{-R}}{{-B}}" at blood_refusal_dest;
|
||||
endif;
|
||||
;;
|
||||
end:
|
||||
247
MLMStripper/bin/Debug/SCH/SCH_CALLED_AUTO_ORDER_GENERAL.mlm
Normal file
247
MLMStripper/bin/Debug/SCH/SCH_CALLED_AUTO_ORDER_GENERAL.mlm
Normal file
@@ -0,0 +1,247 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Called_Auto_Order_General;;
|
||||
mlmname: SCH_Called_Auto_Order_General;;
|
||||
arden: version 2.5;;
|
||||
version: 6.10;;
|
||||
institution: ;;
|
||||
author: Shubhang Acharya;;
|
||||
specialist: ;;
|
||||
date: 2015-02-18;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: This MLM is being called from other MLMs to automatically place the order based on the input parameters.
|
||||
|
||||
History
|
||||
09.24.2019 TMS CSR # 38444 Add 2 new additional observations.
|
||||
|
||||
;;
|
||||
explanation: This MLM is being called from other MLMs to automatically place the order based on the input parameters.
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
citations:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
(
|
||||
ClientVisitGuid,
|
||||
ChartGuid,
|
||||
ClientGuid,
|
||||
UserGuid,
|
||||
LocationGuid,
|
||||
CatalogItemName,
|
||||
OrderDataItem1,
|
||||
OrderDataItemValue1,
|
||||
OrderDataItem2,
|
||||
OrderDataItemValue2,
|
||||
OrderDataItem3,
|
||||
OrderDataItemValue3,
|
||||
OrderDataItem4,
|
||||
OrderDataItemValue4,
|
||||
OrderDataItem5,
|
||||
OrderDataItemValue5,
|
||||
OrderDataItem6,
|
||||
OrderDataItemValue6,
|
||||
OrderDataItem7,
|
||||
OrderDataItemValue7,
|
||||
OrderDataItem8,
|
||||
OrderDataItemValue8,
|
||||
OrderDataItem9,
|
||||
OrderDataItemValue9,
|
||||
OrderDataItem10,
|
||||
OrderDataItemValue10
|
||||
) := argument;
|
||||
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
error_destination := destination { IntermediateMessage } with [
|
||||
alert_type := "Warning",
|
||||
short_message := "Auto Order MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
Rule_group := "Auto Order MLM",
|
||||
Rule_number := 1001,
|
||||
Rule_subgroup := "",
|
||||
Send_alert_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true ];
|
||||
|
||||
|
||||
user_IDType := "PRIMARY";
|
||||
order_Creation_Reason := "Order Created Form MLM";
|
||||
|
||||
User_IdCode := read last{" select cid.IDCode from CV3User u "
|
||||
||" join CV3CareProvider cp on u.GUID =cp.guid "
|
||||
||" join CV3CareProviderID cid on cp.guid = cid.ProviderGuid "
|
||||
||" where u.Guid = "||sql (UserGuid)};
|
||||
// ||" and cid.ProviderIDTypeCode = {{{SINGLE-QUOTE}}}PRIMARY{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
|
||||
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 := "";
|
||||
WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ( (userGUID as Number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
|
||||
//call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById
|
||||
// with ( user_IDType, user_IDCode );
|
||||
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;
|
||||
endcatch;
|
||||
|
||||
|
||||
|
||||
|
||||
try
|
||||
// get OrderCatalogMasterItem ObjectsPlus object
|
||||
general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
|
||||
with CatalogItemName;
|
||||
|
||||
// Create the prefilled General order
|
||||
GeneralOrder2_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
general_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
||||
order_Creation_Reason, // CreateReason
|
||||
wsRequestedBy_obj, // RequestedBy ObjectsPlus object
|
||||
wsRequestedBySource, // string RequestedBySource (must be in dictionary)
|
||||
wsSessionType, // string SessionType
|
||||
wsSessionReason, // string SessionReason
|
||||
wslocation_obj, // Location ReleaseLocGrpID
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
|
||||
|
||||
IF (EXISTS OrderDataItem1 AND OrderDataItem1 IS NOT NULL AND OrderDataItem1 <> "") THEN
|
||||
Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with
|
||||
OrderDataItem1 , OrderDataItemValue1 ;
|
||||
ENDIF;
|
||||
|
||||
IF (EXISTS OrderDataItem2 AND OrderDataItem2 IS NOT NULL AND OrderDataItem2 <> "") THEN
|
||||
Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with
|
||||
OrderDataItem2 , OrderDataItemValue2 ;
|
||||
ENDIF;
|
||||
|
||||
IF (EXISTS OrderDataItem3 AND OrderDataItem3 IS NOT NULL AND OrderDataItem3 <> "") THEN
|
||||
Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with
|
||||
OrderDataItem3 , OrderDataItemValue3 ;
|
||||
ENDIF;
|
||||
|
||||
IF (EXISTS OrderDataItem4 AND OrderDataItem4 IS NOT NULL AND OrderDataItem4 <> "") THEN
|
||||
Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with
|
||||
OrderDataItem4 , OrderDataItemValue4 ;
|
||||
ENDIF;
|
||||
|
||||
IF (EXISTS OrderDataItem5 AND OrderDataItem5 IS NOT NULL AND OrderDataItem5 <> "") THEN
|
||||
Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with
|
||||
OrderDataItem5 , OrderDataItemValue5 ;
|
||||
ENDIF;
|
||||
|
||||
|
||||
IF (EXISTS OrderDataItem6 AND OrderDataItem6 IS NOT NULL AND OrderDataItem6 <> "") THEN
|
||||
Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with
|
||||
OrderDataItem6 , OrderDataItemValue6 ;
|
||||
ENDIF;
|
||||
|
||||
IF (EXISTS OrderDataItem7 AND OrderDataItem7 IS NOT NULL AND OrderDataItem7 <> "") THEN
|
||||
Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with
|
||||
OrderDataItem7 , OrderDataItemValue7 ;
|
||||
ENDIF;
|
||||
|
||||
IF (EXISTS OrderDataItem8 AND OrderDataItem8 IS NOT NULL AND OrderDataItem8 <> "") THEN
|
||||
Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with
|
||||
OrderDataItem8 , OrderDataItemValue8 ;
|
||||
ENDIF;
|
||||
|
||||
IF (EXISTS OrderDataItem9 AND OrderDataItem9 IS NOT NULL AND OrderDataItem9 <> "") THEN
|
||||
Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with
|
||||
OrderDataItem9 , OrderDataItemValue9 ;
|
||||
ENDIF;
|
||||
|
||||
IF (EXISTS OrderDataItem10 AND OrderDataItem10 IS NOT NULL AND OrderDataItem10 <> "") THEN
|
||||
Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with
|
||||
OrderDataItem10 , OrderDataItemValue10 ;
|
||||
ENDIF;
|
||||
|
||||
if ( general_catalog_item is NOT NULL ) then
|
||||
void:= call general_catalog_item.Dispose;
|
||||
general_catalog_item:= null;
|
||||
endif;
|
||||
|
||||
//GeneralOrder2_dest.ObjectsPlus := GeneralOrder2_obj;
|
||||
empty := Call GeneralOrder2_obj.save;
|
||||
|
||||
endtry;
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := error_message || "{{+R}}New general order:{{-R}}\n" ||
|
||||
ex.Message || "\n\n";
|
||||
|
||||
if ( general_catalog_item is NOT NULL ) then
|
||||
void:= call general_catalog_item.Dispose;
|
||||
general_catalog_item:= null;
|
||||
endif;
|
||||
|
||||
if ( GeneralOrder2_obj is NOT NULL ) then
|
||||
void:= call GeneralOrder2_obj.Dispose;
|
||||
GeneralOrder2_obj:= null;
|
||||
endif;
|
||||
|
||||
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;
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
CONCLUDE true;
|
||||
;;
|
||||
action:
|
||||
if Error_occurred then
|
||||
return ex.Message;
|
||||
else
|
||||
return "1";
|
||||
endif;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
127
MLMStripper/bin/Debug/SCH/SCH_CANCEL_ACCOUNT_ORDER.mlm
Normal file
127
MLMStripper/bin/Debug/SCH/SCH_CANCEL_ACCOUNT_ORDER.mlm
Normal file
@@ -0,0 +1,127 @@
|
||||
maintenance:
|
||||
|
||||
title: Ordering: Check for complete registration when entering a discharge or expire order;;
|
||||
mlmname: SCH_Cancel_Account_Order;;
|
||||
arden: version 2;;
|
||||
version: 5.00;;
|
||||
institution: St Clair Cancel Account Order MLM;;
|
||||
author: Dean Miklavic, Allscripts Corp;;
|
||||
specialist: Kathy Egal;;
|
||||
date: 2010-09-28;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Prevent the Cancel Account Order from being entered if the patient visit contains Orders, Results or Documents.
|
||||
;;
|
||||
explanation: When a user selects the Cancel Account order item and the patients account contains non-cancelled Orders, Results or Documents a hard stop
|
||||
alert will display and not allow the user to proceed with submitting the order.
|
||||
|
||||
Change history
|
||||
|
||||
;;
|
||||
keywords: Cancel Account
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
/* Get the Chart GUID */
|
||||
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid) :=
|
||||
read last {ClientVisit: GUID, ChartGUID, ClientGUID };
|
||||
|
||||
|
||||
|
||||
// Set the text for this variable to indicate whether to send the message or not.
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
order_evoke1:= EVENT {OrderEnter User Order:
|
||||
WHERE Name Matches Pattern "cancel account%"};
|
||||
|
||||
// SQL Code to check for Non-Cancelled Orders, Lab Results, and or Documents.
|
||||
|
||||
ExistingActiveOrders := read last
|
||||
{ " Select top 1 Name"
|
||||
|| " from cv3order "
|
||||
|| " where OrderStatusCode = {{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} and clientguid = " || SQL(ClientGuid) || " and chartguid = " || SQL(ChartGuid) || " and clientvisitguid = " || SQL(ClientVisitGuid)
|
||||
|| " and name <> {{{SINGLE-QUOTE}}}RODS{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
ExistingOtherOrders := read last
|
||||
{ " Select top 1 Name"
|
||||
|| " from cv3order "
|
||||
|| " where OrderStatusCode not in ({{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}}) and clientguid = " || SQL(ClientGuid) || " and chartguid = " || SQL(ChartGuid) || " and clientvisitguid = " || SQL(ClientVisitGuid) };
|
||||
|
||||
ExistingLabs := read last
|
||||
{ " Select top 1 ItemName"
|
||||
|| " from cv3basicobservation "
|
||||
|| " where Status is not null and clientguid = " || SQL(ClientGuid) || " and chartguid = " || SQL(ChartGuid) || " and clientvisitguid = " || SQL(ClientVisitGuid) };
|
||||
|
||||
ExistingDocuments := read last
|
||||
{ " Select top 1 DocumentName"
|
||||
|| " from cv3clientdocument "
|
||||
|| " where IsCanceled is not null and clientguid = " || SQL(ClientGuid) || " and chartguid = " || SQL(ChartGuid) || " and clientvisitguid = " || SQL(ClientVisitGuid) };
|
||||
|
||||
|
||||
// Code to create cumulative message that is displayed in Alert.
|
||||
Message_Accumulator :=" ";
|
||||
Orders_Message := " ";
|
||||
|
||||
|
||||
If exists (ExistingOtherOrders) then Message_Accumulator := Message_Accumulator || " Non-Active Orders, " ;Message_Action := "alert"; endif;
|
||||
|
||||
If exists (ExistingLabs) then Message_Accumulator := Message_Accumulator || " Results, " ;Message_Action := "alert"; endif;
|
||||
|
||||
If exists (ExistingDocuments) then Message_Accumulator := Message_Accumulator || " Documents, " ;Message_Action := "alert" ; endif;
|
||||
|
||||
If exists (ExistingActiveOrders) then Message_Accumulator := Message_Accumulator || " Active Orders, " ;Message_Action := "stop"; endif;
|
||||
|
||||
// Code for messages , alerts
|
||||
|
||||
Orders_Message:= "You have entered a Cancel order on an account that has " ||Message_Accumulator ||
|
||||
"\n\nContact your manager for further direction." ||
|
||||
"\n\nOnce the above have been re-entered on the correct account or have been cancelled, RE-ENTER the Cancel order. .";
|
||||
|
||||
Orders_Message2:= "You have entered a Cancel order on an account that has " ||Message_Accumulator ||
|
||||
"\n\nContact your manager for further direction." ;
|
||||
|
||||
|
||||
alert_details:= destination { Alert: warning, "Not cleared for cancel", high, chart,
|
||||
"Cannot Place Cancel Order", 14005, send_alert, "No Override Allowed" };
|
||||
|
||||
// New second alert 09122011
|
||||
|
||||
alert2_details:= destination { Alert: warning, "Must acknowledege alert", high, chart,
|
||||
"Warning orders exist for patient", 14005, send_alert, "Must Acknowledge" };
|
||||
|
||||
|
||||
;;
|
||||
evoke: order_evoke1;
|
||||
;;
|
||||
logic:
|
||||
If Message_Accumulator <> " " then conclude true ; else conclude false ; endif;
|
||||
;;
|
||||
action:
|
||||
|
||||
// code to determine if user gets a hard stop or warning
|
||||
|
||||
// Warning Message
|
||||
|
||||
If Message_Action = "alert" then write "This patient has {{+B}}{{+R}}" || Message_Accumulator ||
|
||||
"{{-B}}{{-R}} on the account. \n\n {{+B}}{{+R}}" || Orders_Message2 || "{{-B}}{{-R}}" ||
|
||||
" " at alert2_details; endif;
|
||||
|
||||
// Hard Stop Message
|
||||
If Message_Action = "stop" then write "This patient has {{+B}}{{+R}}" || Message_Accumulator ||
|
||||
"{{-B}}{{-R}} on the account and the Cancel order cannot be placed. \n\n {{+B}}{{+R}}" || Orders_Message || "{{-B}}{{-R}}" ||
|
||||
" " at alert_details; endif;
|
||||
|
||||
|
||||
// write "This patient has {{+B}}{{+R}}" || Message_Accumulator ||
|
||||
// "{{-B}}{{-R}} on the account and the Cancel order cannot be placed. \n\n {{+B}}{{+R}}" || Orders_Message || "{{-B}}{{-R}}" ||
|
||||
// " " at alert_details;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
155
MLMStripper/bin/Debug/SCH/SCH_CDIFF_ALERT.mlm
Normal file
155
MLMStripper/bin/Debug/SCH/SCH_CDIFF_ALERT.mlm
Normal file
@@ -0,0 +1,155 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CDiff_Alert;;
|
||||
mlmname: SCH_CDiff_Alert;;
|
||||
arden: version 2.5;;
|
||||
version: 15.3;;
|
||||
institution: ;;
|
||||
author: Shami Sharma;;
|
||||
specialist: ;;
|
||||
date: 2016-06-27;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
;;
|
||||
explanation: Show alert on placing C-Diff order if positive result comes for Toxigenic C Difficile result item for the save visit
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
04.16.2018 DJW CSR# 36594 - Altered to check for existing positive CDiff result in the last 90 days
|
||||
07/10/2019 JML CSR# 38386: Modified logic to auto-check lab test based on ED vs. Inpatient location.
|
||||
|
||||
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
Order_Event_Init := event{OrderSetInit User OrderSet : WHERE OrderSetName IN ("Physician Clostridium Difficile Order Set", "Clostridium Difficile Nursing Standing Order") };
|
||||
|
||||
ClientGuid := EVOKINGOBJECT.ClientGUID;
|
||||
ChartGuid := EVOKINGOBJECT.ChartGUID;
|
||||
userguid := read last {UserInfo: GUID};
|
||||
VisitGuid := EVOKINGOBJECT.ClientVisitGUID;
|
||||
OSName := EvokingObject.OrderSetName;
|
||||
//(this_order_id, this_order) := read last {OrderSet : GUID, OrderSetName Referencing EvokingObject};
|
||||
|
||||
order_alert_dest := destination {alert} with
|
||||
[alert_type := warning,
|
||||
short_message := "Physician Clostridium Difficile Order Set",
|
||||
priority := "High",
|
||||
scope := Chart,
|
||||
rule_group := "Laxatives Order",
|
||||
rule_number := 8050,
|
||||
send_with_order := "DoNotSend",
|
||||
alert_dialog_settings := "Must Comment",
|
||||
display_alert := true];
|
||||
|
||||
|
||||
send_alert:= "DoNotSend";
|
||||
cdiff_alert_dest:= destination { Alert: warning, "C Diff Result Alert", high, chart, "Physician Clostridium Difficile Order Set MLM", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
|
||||
// Determine if the patient has positive cdiff result in the past 90 days
|
||||
CDiffResult := read last
|
||||
{ " Select tol.text + {{{SINGLE-QUOTE}}} - {{{SINGLE-QUOTE}}} + cast (convert(char(10), bo.TouchedWhen,110) as varchar) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + cast (convert(char(5), bo.TouchedWhen,114) as varchar) "
|
||||
|| " from cv3BasicObservation bo with (nolock) "
|
||||
|| " left outer join CV3TextualObservationLine tol with (nolock) on bo.clientguid = tol.clientguid and bo.GUID = tol.ObservationGUID "
|
||||
|| " where bo.TouchedWhen > Convert(date,dateadd(day, -90, getdate())) and "
|
||||
|| " bo.itemname IN ( {{{SINGLE-QUOTE}}}Toxigenic Clostridium Difficile by PCR{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Clostridium Difficile Screening{{{SINGLE-QUOTE}}} ) and tol.Text like {{{SINGLE-QUOTE}}}%positive%{{{SINGLE-QUOTE}}} and bo.IsHistory = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} and "
|
||||
|| " bo.clientguid = " || SQL(ClientGuid) || " "
|
||||
|| " order by bo.TouchedWhen desc "
|
||||
};
|
||||
|
||||
If exists CDiffResult then
|
||||
|
||||
cdiff_alert_message := "This patient was postitive for C.diff within the last 90 days. In a symptomatic patient best practice is to isolate and treat with oral Vancomycin and to not re-test the patient."
|
||||
||" \n\n Please call Infection Prevention at 412-942-2230 with questions."; // \n\n C.diff value = " || CDiffResult || " ";
|
||||
|
||||
else
|
||||
|
||||
DOC := read last { " select count(1) from CV3User U (NOLOCK) "
|
||||
||" INNER JOIN SXAAMCareProviderSpecialtyXREF s (nolock) ON s.CareProviderGUID=u.GUID "
|
||||
||" INNER JOIN CV3Discipline d (nolock) on d.GUID=s.DisciplineGUID "
|
||||
||" WHERE CODE = {{{SINGLE-QUOTE}}}Infectious Diseases{{{SINGLE-QUOTE}}} AND U.GUID = " || SQL(userguid)
|
||||
};
|
||||
|
||||
IF ( DOC = 0 AND OSName = "Physician Clostridium Difficile Order Set" ) THEN
|
||||
|
||||
Result := read last { " SELECT TOP 1 O.Name "
|
||||
||" FROM Cv3Order (NOLOCK) O "
|
||||
||" INNER JOIN CV3OrderTaskOccurrence ot on ot.ClientGUID=O.ClientGUID and ot.OrderGUID=O.GUID and ot.TaskStatusCode={{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
|
||||
||" WHERE ot.PerformedFromDtm >= DATEADD(HOUR, -48, GETDATE())"
|
||||
||" AND O.Status= {{{SINGLE-QUOTE}}}ACTIVE{{{SINGLE-QUOTE}}} AND O.ActivateStatus={{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} "
|
||||
||" AND (NAME LIKE {{{SINGLE-QUOTE}}}%BISACODYL%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%CALCIUM POLYCARBOPHIL%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%DOCUSATE CALCIUM%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%DOCUSATE SODIUM%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%GLYCERIN SUPPOSITORY%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%MAGNESIUM CITRATE%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%MAGNESIUM HYDROXIDE%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%MINERAL OIL%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%POLYETHYLENE GLYCOL%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%PSYLLIUM%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%SENNA%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%SENNA/DOCUSATE SODIUM%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%SODIUM BIPHOSPHATE/SODIUM PHOSPHATE%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%Dulcolax%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%Fibercon%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%Surfak%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%Colace%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%Milk of Magnesia%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%CoLyte%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%GoLYTELY%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%NuLytely%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%OCL Solution%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%MiraLax%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%MoviPrep%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%Hydrocil Instant%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%Senokot%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%Peri-Colace%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%Senokot S%{{{SINGLE-QUOTE}}} OR "
|
||||
||" NAME LIKE {{{SINGLE-QUOTE}}}%Fleets Enema%{{{SINGLE-QUOTE}}} ) "
|
||||
||" AND O.ClientGUID = " || SQL(ClientGuid)
|
||||
||" AND O.ChartGUID = " || SQL(ChartGuid)
|
||||
||" AND O.ClientVisitGUID = " || SQL(VisitGuid)
|
||||
};
|
||||
|
||||
|
||||
alert_message := "This patient has received laxatives in the last 48 hours. "
|
||||
|| "C-diff testing is not recommended in this setting. "
|
||||
|| "If you have valid clinical rationale for ordering C-diff in this context please note your rationale in the box below. ";
|
||||
|
||||
ENDIF; // Doc Exist
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: Order_Event_Init;
|
||||
;;
|
||||
logic:
|
||||
|
||||
Conclude True;
|
||||
;;
|
||||
action:
|
||||
IF(EXISTS Result ) THEN
|
||||
write alert_message at order_alert_dest;
|
||||
ENDIF;
|
||||
|
||||
IF(EXISTS CDiffResult ) THEN
|
||||
write cdiff_alert_message at cdiff_alert_dest;
|
||||
ENDIF;
|
||||
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,361 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CDiff_Vancomycin_Oral_Auto_Order;;
|
||||
mlmname: SCH_CDiff_Vancomycin_Oral_Auto_Order;;
|
||||
arden: version 2;;
|
||||
version: 1;;
|
||||
institution: St Clair;;
|
||||
author: Amy Georgolis, Shawn Roberts;;
|
||||
specialist: Sandy Zhang;;
|
||||
date: 2018-05-09;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Auto-order Vancomycin 125mg PO Q12H for patients with history of C Diff. This MLM applies to antibiotic ORDERS ONLY, not order sets. The order set version is "SCH_CDiff_Vancomycin_Oral_Auto_Order_Order_Sets".
|
||||
Problem: Patients with history of C Diff were not ordered vancomycin oral to prevent recurrent infection with C Diff.
|
||||
Solution: This MLM will increase the number of patients who are ordered prophylactic Vancomycin 125mg BID when they{{{SINGLE-QUOTE}}}ve had a history of C Diff.
|
||||
;;
|
||||
|
||||
explanation: The MLM will create an order for Vancomycin 125mg PO Q12H and add it to the worksheet if a patient is being ordered an antibiotic and they have a history of C. Diff as a problem-chronic.
|
||||
|
||||
Change history
|
||||
05.09.2018 SZ CSR#35839 - Created
|
||||
01.22.2019 SZ Added Fidaxomicin to the list of exempted meds (it{{{SINGLE-QUOTE}}}s used as C Diff treatment)
|
||||
;;
|
||||
keywords: Auto-order Vancomycin 125mg PO Q12H
|
||||
|
||||
;;
|
||||
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;
|
||||
|
||||
if called_by_editor
|
||||
then EvokingObject := read last {OrderSet: THIS where Name="intraabdominal antibiotics" };
|
||||
endif;
|
||||
|
||||
|
||||
// this MLM is evoked by the ordering of any antibiotic that falls into our inclusion criteria set forth by project spec
|
||||
order_enter_event := event { OrderEnter User Order: where TypeCode = "Medication"
|
||||
and InitialSessionTypeCode <> "Discharge"
|
||||
and OrderSetName is null
|
||||
and not (Name matches pattern "%ipro") //excludes ipro meds
|
||||
and not (Name matches pattern "%metronidazole%")
|
||||
and not (Name matches pattern "%vancomycin%soln%")
|
||||
and not (Name matches pattern "%vancomycin%oral%")
|
||||
and not (Name matches pattern "%doxycycline%intrapleural%")
|
||||
and not (Name matches pattern "%vancomycin%enema%")
|
||||
and not (Name matches pattern "%methenamine%")
|
||||
and not (Name matches pattern "%methylene%blue%")
|
||||
and not (Name matches pattern "%sulfasalazine%")
|
||||
and not (Name matches pattern "%fidaxomicin%")
|
||||
};
|
||||
|
||||
medication_extension := EVOKINGOBJECT.MedicationExtension;
|
||||
order_component_types := EVOKINGOBJECT.OrderComponentAllTypes;
|
||||
user_data := EVOKINGOBJECT.OrderUserData;
|
||||
|
||||
// get guids
|
||||
order_additional_info := EVOKINGOBJECT.OrderAdditionalInfo;
|
||||
(CatalogItemObj, FrequencyValue) := read last {Order: OrderCatalogMasterItem, FrequencyCode REFERENCING EvokingObject};
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid, VisitType) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, TypeCode};
|
||||
userguid := read last {UserInfo: guid};
|
||||
create_order := true;
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Filter # 1 - Checks for med orders matching therapeutic category
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Proceed if this is an inpatient/observation patient and the drug is not of certain classes
|
||||
// start of med order inclusion criteria
|
||||
If (VisitType = "inpatient" or VisitType = "observation" or VisitType = "emergency")
|
||||
and CatalogItemObj.TherapeuticCategory matches pattern "anti-infective%"
|
||||
and CatalogItemObj.TherapeuticCategory <> "anti-infectives | antiviral agents"
|
||||
and CatalogItemObj.TherapeuticCategory <> "anti-infectives | antifungals"
|
||||
and CatalogItemObj.TherapeuticCategory <> "anti-infectives | antimalarial agents"
|
||||
and CatalogItemObj.TherapeuticCategory <> "anti-infectives | antituberculosis agents"
|
||||
and CatalogItemObj.TherapeuticCategory <> "anti-infectives | anthelmintics"
|
||||
then
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Filter #2 - Checks for presence of C Diff health issue
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Does patient have problem-chronic of C Diff w/ entered date of last 12 months?
|
||||
(Healthissue, HI_Created_When, HI_Onset_day, HI_Onset_Month, HI_Onset_Year) := read last {
|
||||
"select distinct hid.shortname, hid.CreatedWhen, hid.OnsetDayNum, hid.OnsetMonthNum, hid.OnsetYearNum"
|
||||
||" from cv3healthissuedeclaration hid with (nolock) "
|
||||
||" join cv3codedhealthissue chi on chi.Guid = hid.codedhealthissueguid "
|
||||
||" where hid.clientguid = " || ClientGuid
|
||||
||" and hid.active = 1 and hid.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"
|
||||
||" and (chi.typecode = {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}} or hid.typecode = {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}})"
|
||||
||" and ( chi.Description LIKE {{{SINGLE-QUOTE}}}%c%difficile%{{{SINGLE-QUOTE}}} OR chi.ShortName LIKE {{{SINGLE-QUOTE}}}%c%difficile%{{{SINGLE-QUOTE}}} OR Hid.ShortName LIKE {{{SINGLE-QUOTE}}}%c%difficile%{{{SINGLE-QUOTE}}})"
|
||||
||" and hid.CreatedWhen > DATEADD(YEAR,-1,GETDATE())"
|
||||
};
|
||||
|
||||
|
||||
//if Onset Date for health issue was not within past year, then end and do not add order
|
||||
//if NO onset date then proceed
|
||||
HI_Onset_Date := HI_Onset_Year formatted with "%0.4d" || HI_Onset_Month formatted with "%0.2d" || HI_Onset_day formatted with "%0.2d";
|
||||
HI_Onset_Date_Number := HI_Onset_Date as number;
|
||||
|
||||
if (HI_Onset_Date_Number <> 0) then
|
||||
|
||||
one_year_back := NOW - 1 year;
|
||||
one_year_back_formatted := ( extract year one_year_back ) || (extract month one_year_back ) formatted with "%0.2d" || (extract day one_year_back ) formatted with "%0.2d";
|
||||
one_year_back_number := one_year_back_formatted as number;
|
||||
|
||||
if (one_year_back_number > HI_Onset_Date_Number) then
|
||||
create_order := false;
|
||||
check_0_HI := "health issue onset was not within past year, order was not created";
|
||||
endif;
|
||||
endif; // if (HI_Onset_Date_Number <> 0) then
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Filter #3 - Stop after and frequency filters
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// only proceed if C Diff health issue exists and no other condition stops order creation
|
||||
if (exist Healthissue) and (create_order = true) then
|
||||
|
||||
// check if stop date/time (of abx order) is 24 hours or less from NOW
|
||||
// if so, then end without creating worksheet order
|
||||
twenty_four_hour_time := EVOKINGOBJECT.RequestedDtm + 24 Hour;
|
||||
if (twenty_four_hour_time >= EVOKINGOBJECT.StopDtm) then
|
||||
create_order := false;
|
||||
Check_1_24_hours := "current order has stop date within 24 hours, order was not created";
|
||||
endif; // if (twenty_four_hour_time >= EVOKINGOBJECT.StopDtm) then
|
||||
|
||||
// check stop after fields to evaluate if <= 24 hours
|
||||
// if so, then end without creating worksheet order
|
||||
// stopaftervalue of 1 = "Days"
|
||||
if (order_additional_info.StopAfterOption = 1) then
|
||||
if (order_additional_info.StopAfterValue <= 1) then
|
||||
create_order := false;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
// stopaftervalue of 2 = "Hours"
|
||||
if (order_additional_info.StopAfterOption = 2) then
|
||||
if (order_additional_info.StopAfterValue <= 24) then
|
||||
create_order := false;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
// stopaftervalue of 3 = "Minutes"
|
||||
if (order_additional_info.StopAfterOption = 3) then
|
||||
if (order_additional_info.StopAfterValue <= 1440) then
|
||||
create_order := false;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
// stopaftervalue of 4 = "Times"
|
||||
if (order_additional_info.StopAfterOption = 4) then
|
||||
|
||||
if (order_additional_info.FreqSummaryLine matches pattern "%q1h%") and (order_additional_info.StopAfterValue <= 24) then
|
||||
create_order := false;
|
||||
endif;
|
||||
|
||||
if (order_additional_info.FreqSummaryLine matches pattern "%q2h%") and (order_additional_info.StopAfterValue <= 12) then
|
||||
create_order := false;
|
||||
endif;
|
||||
|
||||
if (order_additional_info.FreqSummaryLine matches pattern "%q4h%") and (order_additional_info.StopAfterValue <= 6) then
|
||||
create_order := false;
|
||||
endif;
|
||||
|
||||
if (order_additional_info.FreqSummaryLine matches pattern "%q6h%") and (order_additional_info.StopAfterValue <= 4) then
|
||||
create_order := false;
|
||||
endif;
|
||||
|
||||
if (order_additional_info.FreqSummaryLine matches pattern "%q8h%") and (order_additional_info.StopAfterValue <= 3) then
|
||||
create_order := false;
|
||||
endif;
|
||||
|
||||
|
||||
if (order_additional_info.FreqSummaryLine matches pattern "%bid%") and (order_additional_info.StopAfterValue <= 2) then
|
||||
create_order := false;
|
||||
endif;
|
||||
|
||||
if (order_additional_info.FreqSummaryLine matches pattern "%q12h%") and (order_additional_info.StopAfterValue <= 2) then
|
||||
create_order := false;
|
||||
endif;
|
||||
|
||||
|
||||
if (order_additional_info.FreqSummaryLine matches pattern "%q24h%") and (order_additional_info.StopAfterValue <= 1) then
|
||||
create_order := false;
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
// if frequencies are one-time doses then do not create order
|
||||
if (order_additional_info.FreqSummaryLine matches pattern "%now%"
|
||||
or order_additional_info.FreqSummaryLine matches pattern "%once%"
|
||||
or order_additional_info.FreqSummaryLine matches pattern "%stat%"
|
||||
or order_additional_info.FreqSummaryLine matches pattern "%pre op%"
|
||||
or order_additional_info.FreqSummaryLine matches pattern "%post op%"
|
||||
or order_additional_info.FreqSummaryLine matches pattern "%pre-Procedure%"
|
||||
or order_additional_info.FreqSummaryLine matches pattern "%post-Procedure%"
|
||||
or order_additional_info.FreqSummaryLine matches pattern "%Post Hemodialysis%"
|
||||
or order_additional_info.FreqSummaryLine matches pattern "%With Dialysis Treatment%"
|
||||
or order_additional_info.FreqSummaryLine matches pattern "%today%"
|
||||
) then
|
||||
create_order := false;
|
||||
endif;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Filter #4 - Active order for vanc/metro filter
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// checks for active vancomycin soln/enema or metronidazole IV or PO order during this visit
|
||||
// If exist, then end without creating worksheet order
|
||||
(ActiveOrderPresent, OrderGuid) := read last {
|
||||
" select o.name, o.guid "
|
||||
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|
||||
|| " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || ClientVisitGuid || " "
|
||||
|| " and (o.name like {{{SINGLE-QUOTE}}}%vancomycin%soln%{{{SINGLE-QUOTE}}} OR o.name like {{{SINGLE-QUOTE}}}%vancomycin%enema%{{{SINGLE-QUOTE}}} OR o.name like {{{SINGLE-QUOTE}}}%metronidazole%tab%{{{SINGLE-QUOTE}}} OR o.Name like {{{SINGLE-QUOTE}}}%metronidazole:%{{{SINGLE-QUOTE}}}) "
|
||||
|| " and o.OrderStatusLevelNum >= 15 "
|
||||
|| " and o.OrderStatusLevelNum not in (69, 70) "
|
||||
};
|
||||
if (exist ActiveOrderPresent) then
|
||||
create_order := false;
|
||||
Check_2_active_order := "active order for vanc soln was detected, order was not created";
|
||||
endif;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Filter #5 - Unsubmitted order for vanc/metro filter
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// check for unsubmitted order of metronidazole PO
|
||||
// If exist, then end without creating worksheet order
|
||||
(unsubmitted_metron_vanc) := READ {UnsubmittedOrders: Name WHERE (Name MATCHES PATTERN "Metronidazole:%"
|
||||
or Name MATCHES PATTERN "%vancomycin%enema%"
|
||||
or Name MATCHES PATTERN "%Metronidazole%tab%"
|
||||
or Name MATCHES PATTERN "%Vancomycin%Soln%"
|
||||
)} ;
|
||||
number_unsub_metro_vanc := count (unsubmitted_metron_vanc);
|
||||
|
||||
if (number_unsub_metro_vanc >= 1) then
|
||||
create_order := false;
|
||||
Check_3_unsub_order := "unsubmitted order for metronidazole or vancomycin was detected, order was not created";
|
||||
endif;
|
||||
|
||||
|
||||
if (create_order = true) then
|
||||
|
||||
// If the user selects another careprovider (Nurse or US entry), pass the requestors user ID
|
||||
if userguid <> EVOKINGOBJECT.CareProviderGUID then
|
||||
userguid := EVOKINGOBJECT.CareProviderGUID;
|
||||
endif;
|
||||
|
||||
|
||||
/********************* create the order here *******************************/
|
||||
// Inform the user of the order to be created using a dialogue box
|
||||
|
||||
|
||||
// if (onset date exists) then
|
||||
// use onset date
|
||||
// else
|
||||
// use entered date
|
||||
if (HI_Onset_Date <> "00000000") then
|
||||
HI_Onset_Date_formatted := HI_Onset_Month formatted with "%0.2d" || "-" || HI_Onset_day formatted with "%0.2d" || "-" || HI_Onset_Year formatted with "%0.4d";
|
||||
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
|
||||
"\nThis patient has met the criteria for prophylactic Oral Vancomycin due to history of C. Diff. within the past 12 months."
|
||||
|| "\n\nHealth issue of {{{SINGLE-QUOTE}}}" || HealthIssue || "{{{SINGLE-QUOTE}}} has an onset date of {{{SINGLE-QUOTE}}}" || HI_Onset_Date_formatted || "{{{SINGLE-QUOTE}}}. Please confirm the illness actually occurred within the past 12 months."
|
||||
|| "\n\nAn order for Vancomycin 125 mg PO BID(09-21) will be automatically added to worksheet. "
|
||||
,"C Diff Protocol Order to be Entered", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
||||
else
|
||||
HI_Entered_Month := extract month HI_Created_When;
|
||||
HI_Entered_Day := extract day HI_Created_When;
|
||||
HI_Entered_Year := extract year HI_Created_When;
|
||||
|
||||
HI_Entered_Date_formatted := HI_Entered_Month formatted with "%0.2d" || "-" || HI_Entered_Day formatted with "%0.2d" || "-" || HI_Entered_Year formatted with "%0.4d";
|
||||
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
|
||||
"\nThis patient has met the criteria for prophylactic Oral Vancomycin due to history of C. Diff. within the past 12 months."
|
||||
|| "\n\nHealth issue of {{{SINGLE-QUOTE}}}" || HealthIssue || "{{{SINGLE-QUOTE}}} was ENTERED on {{{SINGLE-QUOTE}}}" || HI_Entered_Date_formatted || "{{{SINGLE-QUOTE}}}. Please confirm the illness actually occurred within the past 12 months."
|
||||
|| "\n\nAn order for Vancomycin 125 mg PO BID(09-21) will be automatically added to worksheet. "
|
||||
,"C Diff Protocol Order to be Entered", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// gather guids for creating order
|
||||
//Active_ClientVisitGUID := this_communication.ClientVisitGUID;
|
||||
Active_OrderGUID:= PrimaryObjdetail.GUID;
|
||||
location_guid := read last {"select CurrentLocationGUID from CV3ClientVisit where GUID=" || SQL(ClientVisitGuid)};
|
||||
|
||||
// declare MLM that will generate order into worksheet
|
||||
SCH_FUNC_CREATE_MED_ORDER_WORKSHEET := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_MED_ORDER_WORKSHEET{{{SINGLE-QUOTE}}};
|
||||
|
||||
// declare vancomycin order details/variable
|
||||
OrderName := "Vancomycin Soln";
|
||||
ItemModifier := "125mg - C Diff Protocol";
|
||||
ItemVersion := "";
|
||||
creation_reason := "from C Diff Protocol";
|
||||
OrderFrequency := "BID (09-21)";
|
||||
special_instructions_value_Mod := "";
|
||||
|
||||
// call MLM that to generate worksheet order
|
||||
Create_Worksheet_Order := call SCH_FUNC_CREATE_MED_ORDER_WORKSHEET with
|
||||
OrderName,
|
||||
ItemModifier,
|
||||
ItemVersion,
|
||||
creation_reason,
|
||||
OrderFrequency,
|
||||
Active_OrderGUID,
|
||||
ClientVisitGuid,
|
||||
location_guid,
|
||||
UserGuid,
|
||||
special_instructions_value_Mod;
|
||||
|
||||
/*********************************************************/
|
||||
|
||||
|
||||
endif; //if (create_order = true) then
|
||||
endif; //if (exist Healthissue) and (create_order = true) then
|
||||
|
||||
endif; // If (VisitType = "inpatient" or VisitType = "observation" or VisitType = "emergency")
|
||||
|
||||
|
||||
/*
|
||||
if (Called_By_Editor = false) and (userguid = "9000342919401190") then
|
||||
break;
|
||||
endif;
|
||||
|
||||
*/
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
|
||||
order_enter_event;
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
if (called_by_editor) then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
if (EvokingObject is null) then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
return this_communication, this_form;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,578 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CDiff_Vancomycin_Oral_Auto_Order_Order_Sets ;;
|
||||
mlmname: SCH_CDiff_Vancomycin_Oral_Auto_Order_Order_Sets;;
|
||||
arden: version 2.5;;
|
||||
version: 1;;
|
||||
institution: St Clair;;
|
||||
author: Amy Georgolis, Shawn Roberts;;
|
||||
specialist: Sandy Zhang;;
|
||||
date: 2018-05-09;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Auto-order Vancomycin 125mg PO Q12H for patients with history of C Diff. This MLM applies to antibiotic ORDER SETS ONLY, not orders(catalog items). The order version is "SCH_CDiff_Vancomycin_Oral_Auto_Order".
|
||||
Problem: Patients with history of C Diff were not ordered vancomycin oral to prevent recurrent infection with C Diff.
|
||||
Solution: This MLM will increase the number of patients who are ordered prophylactic Vancomycin 125mg BID when they{{{SINGLE-QUOTE}}}ve had a history of C Diff.
|
||||
;;
|
||||
explanation: The MLM will create an order for Vancomycin 125mg PO Q12H and add it to the worksheet if a patient is being ordered an antibiotic and they have a history of C. Diff as a problem-chronic.
|
||||
|
||||
Change history
|
||||
05.09.2018 SZ CSR#35839 - Created
|
||||
01.22.2019 SZ Added Fidaxomicin to the list of exempted meds (it{{{SINGLE-QUOTE}}}s used as C Diff treatment)
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
citations:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
// evoking event is all order sets
|
||||
order_set_enter_event := event {OrderSetEnter User OrderSet};
|
||||
// order_set_enter_event := event {OrderSetEnter User OrderSet : where OrderSetName matches pattern "%antibiotic%"};
|
||||
|
||||
// get guids
|
||||
order_additional_info := EVOKINGOBJECT.OrderAdditionalInfo;
|
||||
(CatalogItemObj, FrequencyValue) := read last {OrderSet: OrderCatalogSet REFERENCING EvokingObject};
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid, VisitType) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, TypeCode};
|
||||
userguid := read last {UserInfo: guid};
|
||||
create_order := true;
|
||||
qualified_abx_list := ();
|
||||
|
||||
medication_extension := EVOKINGOBJECT.MedicationExtension;
|
||||
order_component_types := EVOKINGOBJECT.OrderComponentAllTypes;
|
||||
user_data := EVOKINGOBJECT.OrderUserData;
|
||||
|
||||
// Does patient have problem-chronic of C Diff w/ entered date of last 12 months?
|
||||
(Healthissue, HI_Created_When, HI_Onset_day, HI_Onset_Month, HI_Onset_Year) := read last {
|
||||
"select distinct hid.shortname, hid.CreatedWhen, hid.OnsetDayNum, hid.OnsetMonthNum, hid.OnsetYearNum"
|
||||
||" from cv3healthissuedeclaration hid with (nolock) "
|
||||
||" join cv3codedhealthissue chi on chi.Guid = hid.codedhealthissueguid "
|
||||
||" where hid.clientguid = " || ClientGuid
|
||||
||" and hid.active = 1 and hid.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"
|
||||
||" and (chi.typecode = {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}} or hid.typecode = {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}})"
|
||||
||" and ( chi.Description LIKE {{{SINGLE-QUOTE}}}%c%difficile%{{{SINGLE-QUOTE}}} OR chi.ShortName LIKE {{{SINGLE-QUOTE}}}%c%difficile%{{{SINGLE-QUOTE}}} OR Hid.ShortName LIKE {{{SINGLE-QUOTE}}}%c%difficile%{{{SINGLE-QUOTE}}})"
|
||||
||" and hid.CreatedWhen > DATEADD(YEAR,-1,GETDATE())"
|
||||
};
|
||||
|
||||
//if Onset Date for health issue was not within past year, then end and do not add order
|
||||
//if NO onset date then proceed
|
||||
HI_Onset_Date := HI_Onset_Year formatted with "%0.4d" || HI_Onset_Month formatted with "%0.2d" || HI_Onset_day formatted with "%0.2d";
|
||||
HI_Onset_Date_Number := HI_Onset_Date as number;
|
||||
|
||||
if (HI_Onset_Date_Number <> 0) then
|
||||
|
||||
one_year_back := NOW - 1 year;
|
||||
one_year_back_formatted := ( extract year one_year_back ) || (extract month one_year_back ) formatted with "%0.2d" || (extract day one_year_back ) formatted with "%0.2d";
|
||||
one_year_back_number := one_year_back_formatted as number;
|
||||
|
||||
if (one_year_back_number > HI_Onset_Date_Number) then
|
||||
create_order := false;
|
||||
check_0_HI := "health issue onset was not within past year, order was not created";
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Filter #1 - Checks for presence of C Diff health issue
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
if (exist Healthissue and create_order = true) then
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Filter # 2 - Checks for med orders matching therapeutic category
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// get names of unsubmitted med orders from order set that is being submitted
|
||||
recent_order_name := READ { UnsubmittedOrders : Name WHERE TypeCode = "Medication" };
|
||||
|
||||
recent_order_count := 1 seqto (count recent_order_name);
|
||||
|
||||
// for every recent order, SQL order name to see if it fits our inclusion/exclusioin criteria
|
||||
// if not excluded, then generate order for Vanc 125mg PO Q12H
|
||||
for k in recent_order_count do
|
||||
|
||||
order_sql_name := recent_order_name[k] as string;
|
||||
|
||||
found_qualifying_antibiotic := read last {
|
||||
"Select Name"
|
||||
||" from CV3OrderCatalogMasterItem ocmi (nolock) "
|
||||
||" Where ocmi.TherapeuticCategory Like {{{SINGLE-QUOTE}}}%Anti-infectives%{{{SINGLE-QUOTE}}}"
|
||||
||" and ( ocmi.TherapeuticCategory NOT LIKE {{{SINGLE-QUOTE}}}%anthelmintics%{{{SINGLE-QUOTE}}}"
|
||||
||" and ocmi.TherapeuticCategory not like {{{SINGLE-QUOTE}}}%antifungals%{{{SINGLE-QUOTE}}}"
|
||||
||" and ocmi.TherapeuticCategory not like {{{SINGLE-QUOTE}}}%antiviral agents%{{{SINGLE-QUOTE}}}"
|
||||
||" and ocmi.TherapeuticCategory not like {{{SINGLE-QUOTE}}}%antimalarial agents%{{{SINGLE-QUOTE}}}"
|
||||
||" and ocmi.TherapeuticCategory not like {{{SINGLE-QUOTE}}}%antituberculosis agents%{{{SINGLE-QUOTE}}} "
|
||||
||" and ocmi.TherapeuticCategory not like {{{SINGLE-QUOTE}}}%anthelmintics%{{{SINGLE-QUOTE}}} )"
|
||||
||" and (name not like {{{SINGLE-QUOTE}}}%ipro{{{SINGLE-QUOTE}}} "
|
||||
||" and name not like {{{SINGLE-QUOTE}}}%metronidazole%{{{SINGLE-QUOTE}}} "
|
||||
||" and name not like {{{SINGLE-QUOTE}}}%vancomycin%soln%{{{SINGLE-QUOTE}}} "
|
||||
||" and name not like {{{SINGLE-QUOTE}}}%vancomycin%oral%{{{SINGLE-QUOTE}}} "
|
||||
||" and name not like {{{SINGLE-QUOTE}}}%doxycycline%intrapleural%{{{SINGLE-QUOTE}}}"
|
||||
||" and name not like {{{SINGLE-QUOTE}}}%vancomycin%enema%{{{SINGLE-QUOTE}}}"
|
||||
||" and name not like {{{SINGLE-QUOTE}}}%methenamine%{{{SINGLE-QUOTE}}} "
|
||||
||" and name not like {{{SINGLE-QUOTE}}}%methylene%blue%{{{SINGLE-QUOTE}}} "
|
||||
||" and name not like {{{SINGLE-QUOTE}}}%sulfasalazine%{{{SINGLE-QUOTE}}}"
|
||||
||" and name not like {{{SINGLE-QUOTE}}}%fidaxomicin%{{{SINGLE-QUOTE}}})"
|
||||
||" and name = " || "{{{SINGLE-QUOTE}}}" || order_sql_name || "{{{SINGLE-QUOTE}}}"
|
||||
};
|
||||
|
||||
if (exist found_qualifying_antibiotic) then
|
||||
qualified_abx_list := qualified_abx_list , found_qualifying_antibiotic;
|
||||
endif;
|
||||
|
||||
|
||||
// if any of order is vanc PO/enema or Metronidazole IV/PO then do not continue to creating order
|
||||
if (order_sql_name matches pattern "%vancomycin%enema%") or
|
||||
(order_sql_name matches pattern "metronidazole%tab%") or
|
||||
(order_sql_name matches pattern "%vancomycin%soln%") or
|
||||
(order_sql_name matches pattern "metronidazole:%")
|
||||
then
|
||||
create_order := false;
|
||||
check_vanc_metro := "found metro IV/PO or vanc enema/PO, do not generate order";
|
||||
endif;
|
||||
|
||||
enddo; // for k in recent_order_count do
|
||||
|
||||
// filter #2 - if no qualifying antibiotics were found, then end
|
||||
if (not exist qualified_abx_list) then
|
||||
create_order := false;
|
||||
check_abx_found := "no qualifying antibiotics were found";
|
||||
endif;
|
||||
// end of Filter # 2 - Checks for med orders matching therapeutic category
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Filter #3 - Stop after and frequency filters
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (create_order = true) then
|
||||
|
||||
all_one_time_doses := ();
|
||||
stop_after_true_false_list := (); // a list to keep track of all QXH items, if there are any false items then do not create order
|
||||
qualified_abx_count := 1 seqto (count qualified_abx_list);
|
||||
|
||||
// loop through all frequency codes OF QUALIFIED ABX to see if they are all one-time doses, if so, then end and do not create vanc order
|
||||
for k in qualified_abx_count do
|
||||
|
||||
qualified_abx_order_name := qualified_abx_list[k];
|
||||
|
||||
qualified_order_name, frequency_code, stop_date, summary_line_info := READ { UnsubmittedOrders : Name, FrequencyCode, StopDtm, SummaryLine WHERE TypeCode = "Medication" and Name = qualified_abx_order_name };
|
||||
//summary_line_info := READ { UnsubmittedOrders : SummaryLine WHERE TypeCode = "Medication" };
|
||||
|
||||
// check for one-time doses, if present then add false, else true is added (if it fits criteria) to stop_after_true_false_list
|
||||
// this list allows an order to generate if a true is added (and no create_order := false, which is a hard stop)
|
||||
if (frequency_code[k] matches pattern "%now%"
|
||||
or frequency_code[k] matches pattern "%once%"
|
||||
or frequency_code[k] matches pattern "%stat%"
|
||||
or frequency_code[k] matches pattern "%pre op%"
|
||||
or frequency_code[k] matches pattern "%post op%"
|
||||
or frequency_code[k] matches pattern "%pre-Procedure%"
|
||||
or frequency_code[k] matches pattern "%post-Procedure%"
|
||||
or frequency_code[k] matches pattern "%Post Hemodialysis%"
|
||||
or frequency_code[k] matches pattern "%With Dialysis Treatment%"
|
||||
or frequency_code[k] matches pattern "%today%"
|
||||
) then
|
||||
stop_after_true_false_list := stop_after_true_false_list , false;
|
||||
check_one_time_dose := "one time dose frequency detected";
|
||||
else
|
||||
|
||||
|
||||
// search for position of X, used in several substring statements below
|
||||
position_of_x := FIND "X" IN STRING summary_line_info[k];
|
||||
|
||||
|
||||
// if stopaftervalue of "Minutes" is used
|
||||
// substring 3, because only 3 digits max allowed in stop after field
|
||||
if (summary_line_info[k] matches pattern "%X%Minutes%") then
|
||||
summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
|
||||
|
||||
if (summary_substring_number matches pattern "%M%") then
|
||||
summary_substring_number := SUBSTRING 3 CHARACTERS FROM summary_substring_number;
|
||||
endif;
|
||||
|
||||
if ((summary_substring_number as number) <= 1440) then
|
||||
//create_order := false;
|
||||
stop_after_true_false_list := stop_after_true_false_list , false;
|
||||
check_minutes := "order had a stop after of <= 1440 minutes";
|
||||
else
|
||||
stop_after_true_false_list := stop_after_true_false_list , true;
|
||||
endif;
|
||||
|
||||
endif; //if (summary_line_info[k] matches pattern "%X%Minutes%") then
|
||||
|
||||
|
||||
|
||||
// if stopaftervalue of "Hours" is used
|
||||
// substring 3, because only 3 digits max allowed in stop after field
|
||||
if (summary_line_info[k] matches pattern "%X%Hours%") then
|
||||
summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
|
||||
|
||||
if (summary_substring_number matches pattern "%H%") then
|
||||
summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
|
||||
endif;
|
||||
|
||||
if ((summary_substring_number as number) <= 24) then
|
||||
//create_order := false;
|
||||
stop_after_true_false_list := stop_after_true_false_list , false;
|
||||
check_hours := "order had a stop after of <= 24 hours";
|
||||
else
|
||||
stop_after_true_false_list := stop_after_true_false_list , true;
|
||||
endif;
|
||||
|
||||
endif; //if (summary_line_info[k] matches pattern "%X%Hours%") then
|
||||
|
||||
|
||||
// if stopaftervalue of "Days" is used
|
||||
// substring 3, because only 3 digits max allowed in stop after field
|
||||
if (summary_line_info[k] matches pattern "%X%Days%") then
|
||||
summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
|
||||
|
||||
if (summary_substring_number matches pattern "%D%") then
|
||||
summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
|
||||
endif;
|
||||
|
||||
if ((summary_substring_number as number) <= 1) then
|
||||
//create_order := false;
|
||||
stop_after_true_false_list := stop_after_true_false_list , false;
|
||||
check_days := "order had a stop after of <= 1 day";
|
||||
else
|
||||
stop_after_true_false_list := stop_after_true_false_list , true;
|
||||
endif;
|
||||
|
||||
endif; // if (summary_line_info[k] matches pattern "%X%Days%") then
|
||||
|
||||
|
||||
// if stopaftervalue of "Times" is used
|
||||
if (summary_line_info[k] matches pattern "%X%Times%") then
|
||||
summary_line_pattern_found := "X%Times pattern found for summary line";
|
||||
|
||||
|
||||
if (frequency_code[k] matches pattern "%q1h%") then
|
||||
summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
|
||||
|
||||
if (summary_substring_number matches pattern "%T%") then
|
||||
summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
|
||||
endif;
|
||||
|
||||
|
||||
if ((summary_substring_number as number) <= 24) then
|
||||
//create_order := false;
|
||||
check_Times_Q1H := "order had a stop after of <= 1 day";
|
||||
stop_after_true_false_list := stop_after_true_false_list , false;
|
||||
else
|
||||
stop_after_true_false_list := stop_after_true_false_list , true;
|
||||
endif;
|
||||
endif; // if (frequency_code[k] matches pattern "%q1h%"
|
||||
|
||||
|
||||
|
||||
if (frequency_code[k] matches pattern "%q2h%") then
|
||||
summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
|
||||
|
||||
if (summary_substring_number matches pattern "%T%") then
|
||||
summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
|
||||
endif;
|
||||
|
||||
if ((summary_substring_number as number) <= 12) then
|
||||
//create_order := false;
|
||||
check_Times_Q2H := "order had a stop after of <= 1 day";
|
||||
stop_after_true_false_list := stop_after_true_false_list , false;
|
||||
else
|
||||
stop_after_true_false_list := stop_after_true_false_list , true;
|
||||
endif;
|
||||
endif; // if (frequency_code[k] matches pattern "%q2h%"
|
||||
|
||||
|
||||
if (frequency_code[k] matches pattern "%q3h%") then
|
||||
summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
|
||||
|
||||
if (summary_substring_number matches pattern "%T%") then
|
||||
summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
|
||||
endif;
|
||||
|
||||
if ((summary_substring_number as number) <= 8) then
|
||||
//create_order := false;
|
||||
check_Times_Q3H := "order had a stop after of <= 1 day";
|
||||
stop_after_true_false_list := stop_after_true_false_list , false;
|
||||
else
|
||||
stop_after_true_false_list := stop_after_true_false_list , true;
|
||||
endif;
|
||||
endif; // if (frequency_code[k] matches pattern "%q3h%") then
|
||||
|
||||
|
||||
|
||||
if (frequency_code[k] matches pattern "%q4h%") then
|
||||
summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
|
||||
|
||||
if (summary_substring_number matches pattern "%T%") then
|
||||
summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
|
||||
endif;
|
||||
|
||||
if ((summary_substring_number as number) <= 6) then
|
||||
//create_order := false;
|
||||
check_Times_Q4H := "order had a stop after of <= 1 day";
|
||||
stop_after_true_false_list := stop_after_true_false_list , false;
|
||||
else
|
||||
stop_after_true_false_list := stop_after_true_false_list , true;
|
||||
endif;
|
||||
endif; // if (frequency_code[k] matches pattern "%q4h%"
|
||||
|
||||
|
||||
|
||||
if (frequency_code[k] matches pattern "%q6h%") then
|
||||
summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
|
||||
|
||||
if (summary_substring_number matches pattern "%T%") then
|
||||
summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
|
||||
endif;
|
||||
|
||||
if ((summary_substring_number as number) <= 4) then
|
||||
//create_order := false;
|
||||
check_Times_Q6H := "order had a stop after of <= 1 day";
|
||||
stop_after_true_false_list := stop_after_true_false_list , false;
|
||||
else
|
||||
stop_after_true_false_list := stop_after_true_false_list , true;
|
||||
endif;
|
||||
endif; // if (frequency_code[k] matches pattern "%q6h%"
|
||||
|
||||
|
||||
|
||||
if (frequency_code[k] matches pattern "%q8h%") then
|
||||
summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
|
||||
|
||||
if (summary_substring_number matches pattern "%T%") then
|
||||
summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
|
||||
endif;
|
||||
|
||||
if ((summary_substring_number as number) <= 3) then
|
||||
//create_order := false;
|
||||
check_Times_Q8H := "order had a stop after of <= 1 day";
|
||||
stop_after_true_false_list := stop_after_true_false_list , false;
|
||||
else
|
||||
stop_after_true_false_list := stop_after_true_false_list , true;
|
||||
endif;
|
||||
endif; // if (frequency_code[k] matches pattern "%q8h%"
|
||||
|
||||
|
||||
|
||||
if (frequency_code[k] matches pattern "%bid%") then
|
||||
summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
|
||||
|
||||
if (summary_substring_number matches pattern "%T%") then
|
||||
summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
|
||||
endif;
|
||||
|
||||
if ((summary_substring_number as number) <= 2) then
|
||||
//create_order := false;
|
||||
check_Times_BID := "order had a stop after of <= 1 day";
|
||||
stop_after_true_false_list := stop_after_true_false_list , false;
|
||||
else
|
||||
stop_after_true_false_list := stop_after_true_false_list , true;
|
||||
endif;
|
||||
endif; // if (frequency_code[k] matches pattern "%bid%"
|
||||
|
||||
|
||||
|
||||
if (frequency_code[k] matches pattern "%q12h%") then
|
||||
summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
|
||||
|
||||
if (summary_substring_number matches pattern "%T%") then
|
||||
summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
|
||||
endif;
|
||||
|
||||
if ((summary_substring_number as number) <= 2) then
|
||||
//create_order := false;
|
||||
check_Times_Q12H := "order had a stop after of <= 1 day";
|
||||
stop_after_true_false_list := stop_after_true_false_list , false;
|
||||
else
|
||||
stop_after_true_false_list := stop_after_true_false_list , true;
|
||||
endif;
|
||||
endif; // if (frequency_code[k] matches pattern "%bid%"
|
||||
|
||||
|
||||
|
||||
if (frequency_code[k] matches pattern "%q24h%") then
|
||||
summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
|
||||
|
||||
if (summary_substring_number matches pattern "%T%") then
|
||||
summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
|
||||
endif;
|
||||
|
||||
if ((summary_substring_number as number) <= 1) then
|
||||
//create_order := false;
|
||||
check_Times_Q24H := "order had a stop after of <= 1 day";
|
||||
stop_after_true_false_list := stop_after_true_false_list , false;
|
||||
else
|
||||
stop_after_true_false_list := stop_after_true_false_list , true;
|
||||
endif;
|
||||
endif; // if (frequency_code[k] matches pattern "%q24h%"
|
||||
|
||||
else
|
||||
stop_after_true_false_list := stop_after_true_false_list , true; // if the med order had QXH and no stop after settings used, that would trigger this line
|
||||
check_QXH_no_stop_after := "no stop after settings were detected and order is likely QXH";
|
||||
endif; // if (summary_line_info[k] matches pattern "%X%Times%"
|
||||
|
||||
endif; // if (frequency_code[k] matches pattern "%now%"
|
||||
|
||||
enddo; //for k in qualified_abx_count do
|
||||
|
||||
// if there is no true in the list, then do not create order (this means no orders passed the frequency/stopafter criteria to qualify in creating an order)
|
||||
// each true is added when a qualified order is found in the unsubmitted list
|
||||
if (true is not in stop_after_true_false_list) then
|
||||
create_order := false;
|
||||
check_stop_after_true_false:= "no qualified orders have flagged a true to proceed, so create_order := false";
|
||||
endif;
|
||||
// end of filter #3 - Stop after and frequency filters
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Filter #4 - Active order for vanc/metro filter
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
/*********************************************************************************************************************************/
|
||||
// checks for active vancomycin soln/metronidazole IV or PO order during this visit
|
||||
// If exist, then end without creating worksheet order
|
||||
(ActiveOrderPresent, OrderGuid) := read last {
|
||||
" select o.name, o.guid "
|
||||
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|
||||
|| " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || ClientVisitGuid || " "
|
||||
|| " and (o.name like {{{SINGLE-QUOTE}}}%vancomycin%soln%{{{SINGLE-QUOTE}}} OR o.name like {{{SINGLE-QUOTE}}}%vancomycin%enema%{{{SINGLE-QUOTE}}} OR o.name like {{{SINGLE-QUOTE}}}%metronidazole%tab%{{{SINGLE-QUOTE}}} OR o.Name like {{{SINGLE-QUOTE}}}%metronidazole:%{{{SINGLE-QUOTE}}}) "
|
||||
|| " and o.OrderStatusLevelNum >= 15 "
|
||||
|| " and o.OrderStatusLevelNum not in (69, 70) "
|
||||
};
|
||||
if (exist ActiveOrderPresent) then
|
||||
create_order := false;
|
||||
Check_active_order := "active order for vanc soln was detected, order was not created, so create_order := false";
|
||||
endif;
|
||||
|
||||
|
||||
/*********************************************************************************************************************************/
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Filter #5 - Unsubmitted order for vanc/metro filter
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// check for unsubmitted order of metronidazole PO
|
||||
// If exist, then end without creating worksheet order
|
||||
(unsubmitted_metron_vanc) := READ {UnsubmittedOrders: Name WHERE (Name MATCHES PATTERN "Metronidazole:%"
|
||||
or Name MATCHES PATTERN "%vancomycin%enema%"
|
||||
or Name MATCHES PATTERN "%Metronidazole%tab%"
|
||||
or Name MATCHES PATTERN "%Vancomycin%Soln%"
|
||||
)} ;
|
||||
number_unsub_metro_vanc := count (unsubmitted_metron_vanc);
|
||||
if (number_unsub_metro_vanc >= 1) then
|
||||
create_order := false;
|
||||
Check_unsub_order := "unsubmitted order for metronidazole or vancomycin was detected, order was not created, so create_order := false";
|
||||
endif;
|
||||
|
||||
/*********************************************************************************************************************************/
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// order creation
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (create_order = true) then
|
||||
|
||||
// If the user selects another careprovider (Nurse or US entry), pass the requestors user ID
|
||||
if userguid <> EVOKINGOBJECT.CareProviderGUID then
|
||||
userguid := EVOKINGOBJECT.CareProviderGUID;
|
||||
endif;
|
||||
|
||||
|
||||
/********************* create the order here *******************************/
|
||||
|
||||
// Inform the user of the order to be created using a dialogue box
|
||||
|
||||
// if (onset date exists) then
|
||||
// use onset date
|
||||
// else
|
||||
// use entered date
|
||||
if (HI_Onset_Date <> "00000000") then
|
||||
HI_Onset_Date_formatted := HI_Onset_Month formatted with "%0.2d" || "-" || HI_Onset_day formatted with "%0.2d" || "-" || HI_Onset_Year formatted with "%0.4d";
|
||||
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
|
||||
"\nThis patient has met the criteria for prophylactic Oral Vancomycin due to history of C. Diff. within the past 12 months."
|
||||
|| "\n\nHealth issue of {{{SINGLE-QUOTE}}}" || HealthIssue || "{{{SINGLE-QUOTE}}} has an onset date of {{{SINGLE-QUOTE}}}" || HI_Onset_Date_formatted || "{{{SINGLE-QUOTE}}}. Please confirm the illness actually occurred within the past 12 months."
|
||||
|| "\n\nAn order for Vancomycin 125 mg PO BID(09-21) will be automatically added to worksheet. "
|
||||
,"C Diff Protocol Order to be Entered", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
||||
else
|
||||
HI_Entered_Month := extract month HI_Created_When;
|
||||
HI_Entered_Day := extract day HI_Created_When;
|
||||
HI_Entered_Year := extract year HI_Created_When;
|
||||
|
||||
HI_Entered_Date_formatted := HI_Entered_Month formatted with "%0.2d" || "-" || HI_Entered_Day formatted with "%0.2d" || "-" || HI_Entered_Year formatted with "%0.4d";
|
||||
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
|
||||
"\nThis patient has met the criteria for prophylactic Oral Vancomycin due to history of C. Diff. within the past 12 months."
|
||||
|| "\n\nHealth issue of {{{SINGLE-QUOTE}}}" || HealthIssue || "{{{SINGLE-QUOTE}}} was ENTERED on {{{SINGLE-QUOTE}}}" || HI_Entered_Date_formatted || "{{{SINGLE-QUOTE}}}, please confirm it occured within the past 12 months. "
|
||||
|| "\n\nAn order for Vancomycin 125 mg PO BID(09-21) will be automatically added to worksheet. "
|
||||
,"C Diff Protocol Order to be Entered", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
|
||||
"\nThis patient has met the criteria for prophylactic Oral Vancomycin due to history of C. Diff. "
|
||||
|| "\n\nAn order for Vancomycin 125 mg PO BID (09-21) will be automatically added to worksheet. "
|
||||
,"C Diff Protocol Order to be Entered", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
||||
*/
|
||||
|
||||
// gather guids for creating order
|
||||
//Active_ClientVisitGUID := this_communication.ClientVisitGUID;
|
||||
Active_OrderGUID:= PrimaryObjdetail.GUID;
|
||||
location_guid := read last {"select CurrentLocationGUID from CV3ClientVisit where GUID=" || SQL(ClientVisitGuid)};
|
||||
|
||||
// declare MLM that will generate order into worksheet
|
||||
SCH_FUNC_CREATE_MED_ORDER_WORKSHEET := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_MED_ORDER_WORKSHEET{{{SINGLE-QUOTE}}};
|
||||
|
||||
// declare vancomycin order details/variable
|
||||
OrderName := "Vancomycin Soln";
|
||||
ItemModifier := "125mg - C Diff Protocol";
|
||||
ItemVersion := "";
|
||||
creation_reason := "from C Diff Protocol";
|
||||
OrderFrequency := "BID (09-21)";
|
||||
special_instructions_value_Mod := "";
|
||||
|
||||
// call MLM that to generate worksheet order
|
||||
Create_Worksheet_Order := call SCH_FUNC_CREATE_MED_ORDER_WORKSHEET with
|
||||
OrderName,
|
||||
ItemModifier,
|
||||
ItemVersion,
|
||||
creation_reason,
|
||||
OrderFrequency,
|
||||
Active_OrderGUID,
|
||||
ClientVisitGuid,
|
||||
location_guid,
|
||||
UserGuid,
|
||||
special_instructions_value_Mod;
|
||||
|
||||
/*********************************************************/
|
||||
|
||||
endif; //if (create_order = true) then
|
||||
|
||||
endif; // if (create_order = true) then (starts in filter #3)
|
||||
|
||||
endif; // if (exist Healthissue and create_order = true) then
|
||||
// end of Filter #1 - Checks for presence of C Diff health issue
|
||||
|
||||
|
||||
/*
|
||||
if (Called_By_Editor = false) and (userguid = "9000004416201190") then
|
||||
break;
|
||||
endif;
|
||||
*/
|
||||
|
||||
|
||||
|
||||
;;
|
||||
priority: 40
|
||||
;;
|
||||
evoke: order_set_enter_event;
|
||||
;;
|
||||
logic: conclude true;
|
||||
;;
|
||||
action:
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
373
MLMStripper/bin/Debug/SCH/SCH_CHARTED_HALDOL_24HRS.mlm
Normal file
373
MLMStripper/bin/Debug/SCH/SCH_CHARTED_HALDOL_24HRS.mlm
Normal 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:
|
||||
324
MLMStripper/bin/Debug/SCH/SCH_CHART_TASK_CREATE_HEALTHISSUE.mlm
Normal file
324
MLMStripper/bin/Debug/SCH/SCH_CHART_TASK_CREATE_HEALTHISSUE.mlm
Normal file
@@ -0,0 +1,324 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CHART_TASK_CREATE_HEALTHISSUE;;
|
||||
mlmname: SCH_CHART_TASK_CREATE_HEALTHISSUE;;
|
||||
arden: version 2;;
|
||||
version: 5.00;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Eclipsys;;
|
||||
specialist: ;;
|
||||
date: 2010-03-12;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Chart a Health Issue Of Pneumococcal When Pneumococcal Vaccine Is Charted
|
||||
Either by the interface (batch) or by the user.
|
||||
Remove a health issue if a task on the same day is reset.
|
||||
;;
|
||||
explanation: Pneumococcal Initiative
|
||||
Change history
|
||||
|
||||
09.01.2010 TS Added logic to chart and remove variable vaccines - Diphtheria/Tetanus Toxid, HIB, Hep B,
|
||||
Influenza, Meningococcal, Rubella, and TDAP
|
||||
|
||||
08.22.2011 DW Major rewrite CSR#26269 - changed Pneumococcal HI code from "2" to "V03.82"
|
||||
09.20.2011 DW Major rewrite CSR#26486 - changed Influenza HI code from "1" to "V04.81"
|
||||
01.24.2012 TS Change made to evoke statement to remove the time delay statement that was causing reset of a task
|
||||
or changing a previously charted task to not given to not remove the health issue. HD Ticket 146109
|
||||
02.08.2012 DW CSR# 26307 - changed TDAP HI code from "4" to "V06.1"
|
||||
04.04.2012 DW CSR# 26307 - Àdded new Health Issues for ED TDAP project
|
||||
09.16.2014 TMS CSR# 32748 - Àdded new Catalog Name for Influenza
|
||||
10.28.2014 STH CSR#: 32776 - Modify the "issuename" to pull from the health manager configuration to match the immunization history
|
||||
name when the ordered item/task is setup to write to health manager and send to state for immunization tracking.
|
||||
12.16.2015 - CSR #:33655 - Update for Prevnar 13 {Loaded 1.13.2016 ahead of the target go-live date of the product being available}
|
||||
03.08.2016 - STH CSR#: 33655/ Helpdesk ticket #: - There was a section added to this MLM by GMS that must have been abandoned because it was never moved live.
|
||||
The section was allowing the health issues to create in DEV durning testing; however additional configuration is
|
||||
required in other enviornments for this same logic to work in those enviornments. Reverted the section back to the
|
||||
original logic and the MLM works in all enviornments. Believe the section was a proof of concept for ICD10 that got abandoned.
|
||||
05.31.2019 - DW CSR# 37676 - 18.4 Changed Interface user logic to Services
|
||||
|
||||
;;
|
||||
keywords: Charting, Create Health Issue, Remove HealthIssues;
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
/* Set to true if logging is needed.*/
|
||||
log_execution_info:= FALSE;
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
WhatAmIDoing := "";
|
||||
|
||||
|
||||
any_modified_task:= event {OrderTaskOccurrenceModify
|
||||
Any OrderTaskOccurrence:
|
||||
WHERE TaskName Matches Pattern "Pneumococcal Vaccine Inj (Pneumovax)%"
|
||||
or TaskName Matches Pattern "Pneumococcal 13-Valent Vaccine Inj%"
|
||||
or TaskName Matches Pattern "Influenza Virus Trivalent Vaccine%"
|
||||
or TaskName Matches Pattern "Influenza Virus Vaccine%"
|
||||
or TaskName Matches Pattern "Hepatitis B Virus Vaccine Inj%"
|
||||
or TaskName Matches Pattern "Haemophilus B Conj%"
|
||||
or TaskName Matches Pattern "Diphtheria/Tetanus Toxoid%"
|
||||
or TaskName Matches Pattern "Rubella Vaccine Inj%"
|
||||
or TaskName Matches Pattern "Meningococcal Vaccine Inj%"
|
||||
or TaskName Matches Pattern "Diphtheria, Pertussis, Tetanus Vaccine%" };
|
||||
|
||||
/*
|
||||
if called_by_editor then
|
||||
EvokingObject := read last {OrderTaskOccurrence: THIS
|
||||
where TaskName Matches Pattern "Pneumococcal Vaccine Inj (Pneumovax)%" };
|
||||
endif;
|
||||
*/
|
||||
NewHealthIssue_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Health Issue Object",
|
||||
rule_number := 2010 ];
|
||||
|
||||
Discontinue_HealthIssue_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object deleted by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Health Issue Object",
|
||||
rule_number := 2040 ];
|
||||
|
||||
client_GUID := read last { ClientInfo: GUID };
|
||||
userguid,user_id :=read last {UserInfo: guid,idcode};
|
||||
|
||||
// obtain the location info
|
||||
TaskName,TaskStatusCode,orderguid ,significantdtm:= read last {OrderTaskOccurrence: TaskName,TaskStatusCode,OrderGUID,SignificantDtm REFERENCING EvokingObject};
|
||||
|
||||
Client_Visit_Guid := read last { " select clientvisitguid from cv3order with (nolock) where guid = " || SQL(orderguid)};
|
||||
(backup_obj) := read last {OrderTaskOccurrence: Backup REFERENCING EvokingObject};
|
||||
// new logic to support variable vaccine orders/tasks
|
||||
issuename := "";
|
||||
issuecode := "";
|
||||
if ((taskname matches pattern "Pneumococcal Vaccine Inj%") or (taskname matches pattern "Pneumococcal 13-Valent Vaccine Inj%")) then
|
||||
issuename := "Pneumococcal Vaccine";
|
||||
issuecode := "V03.82";
|
||||
endif;
|
||||
if taskname matches pattern "Influenza Virus Trivalent Vaccine%" then
|
||||
issuename := "Influenza Vaccine";
|
||||
issuecode := "V04.81";
|
||||
endif;
|
||||
if taskname matches pattern "Influenza Virus Vaccine%" then
|
||||
issuename := "Influenza Vaccine";
|
||||
issuecode := "V04.81";
|
||||
endif;
|
||||
if taskname matches pattern "Diphtheria, Pertussis, Tetanus Vaccine%" then
|
||||
issuename := "TDAP- Tetanus,Diptheria, Acellular Pertussis";
|
||||
issuecode := "V06.1";
|
||||
endif;
|
||||
if taskname matches pattern "Hepatitis B Virus Vaccine Inj%" then
|
||||
issuename := "Hepatitis B Vaccine";
|
||||
issuecode := "V05.3";
|
||||
endif;
|
||||
if taskname matches pattern "Rubella Vaccine Inj%" then
|
||||
issuename := "Rubella Vaccine";
|
||||
issuecode := "V04.3";
|
||||
endif;
|
||||
if taskname matches pattern "Haemophilus B Conj%" then
|
||||
issuename := "Haemophilus B Conjugate (HIB) Vaccine";
|
||||
issuecode := "V03.81";
|
||||
endif;
|
||||
if taskname matches pattern "Meningococcal Vaccine Inj%" then
|
||||
issuename := "Meningococcal Vaccine";
|
||||
issuecode := "V03.89";
|
||||
endif;
|
||||
if taskname matches pattern "Diphtheria/Tetanus Toxoid%" then
|
||||
issuename := "Diphtheria/Tetanus Toxoid";
|
||||
issuecode := "V06.5";
|
||||
endif;
|
||||
//Added by STH 10/28/2014 to pull the Immunization Name from Health Manager when there is a CVX Coded added to create the health manager entry for sending to the state.
|
||||
//This same code/logic is used in the SCH_HM_MARK_AS_DONE for creating the health manager entry for the vaccine name given.
|
||||
CodingCVXCode := "HM CVXCode";
|
||||
catalogItemGUID := EvokingObject.CatalogItemTaskGUID;
|
||||
ImmunizationCVXCode := read last {"Select an.Name from CV3AncillaryName an with (nolock) " ||
|
||||
"Where an.MainCatItemGUID = " || SQL(catalogItemGUID) ||
|
||||
" AND an.Active = 1 AND an.CodingStd = " || SQL(CodingCVXCode) };
|
||||
|
||||
if ImmunizationCVXCode is not null and ImmunizationCVXCode <> "" then
|
||||
HMCVXCodeName := read last {"select name from SXAHMVaccineCatalogItem with (nolock) " ||
|
||||
" Where cvxcode = " || sql(ImmunizationCVXCode) ||
|
||||
" and active = 1 " };
|
||||
if HMCVXCodeName is not null and HMCVXCodeName <> "" then
|
||||
issuename := HMCVXCodeName;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
(bk_TaskName,bk_TaskStatusCode,bk_TouchedBy,bk_TouchedWhen,bk_LatestScheduledDtm,
|
||||
bk_EnteredProviderGUID,bk_PerformedProviderGUID,bk_EnteredDtm,bk_PerformedFromDtm,
|
||||
bk_SignificantDtm,bk_TaskReason,bk_TaskComment,bk_BodySite) :=
|
||||
read last {OrderTaskOccurrence: TaskName,TaskStatusCode,TouchedBy,TouchedWhen,
|
||||
LatestScheduledDtm,EnteredProviderGUID,PerformedProviderGUID,EnteredDtm,
|
||||
PerformedFromDtm,SignificantDtm,TaskReason,TaskComment,BodySite REFERENCING backup_obj};
|
||||
if taskstatuscode = "Performed"
|
||||
then
|
||||
yr := extract year significantdtm;
|
||||
mn := extract month significantdtm;
|
||||
dd := extract day significantdtm;
|
||||
else
|
||||
yr := extract year bk_SignificantDtm;
|
||||
mn := extract month bk_SignificantDtm;
|
||||
dd := extract day bk_SignificantDtm;
|
||||
endif;
|
||||
|
||||
HealthIssueTypeCode := "Vaccine History";
|
||||
delete_healthIssue_GUID, delete_ShortName, delete_dd,delete_mn,delete_yr:= read last
|
||||
{ " select GUID,ShortName,OnsetDayNum,OnSetMonthNum,OnSetYearNum from CV3HealthIssueDeclaration with (nolock) " ||
|
||||
" where TypeCode = " || SQL(HealthIssueTypeCode) ||
|
||||
" AND ShortName = " || SQL(issuename) ||
|
||||
" AND Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} AND ClientGUID = " ||
|
||||
SQL(client_GUID) ||
|
||||
" AND OnSetDayNum = " || SQL(dd) ||
|
||||
" AND OnsetMonthNum = " || SQL(mn) ||
|
||||
" AND OnsetYearNum = " || SQL(yr)
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
;;
|
||||
// evoke: 0 minutes after time of any_modified_task;
|
||||
evoke: any_modified_task;
|
||||
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
if bk_TaskStatusCode = TaskStatusCode // I.e the status of the task has not changed. So do nothing
|
||||
then
|
||||
conclude false;
|
||||
else // else, let{{{SINGLE-QUOTE}}}s create or remove some health issues.
|
||||
|
||||
/* dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "So the Task Status Code is Changing"
|
||||
|| "\nYour task is going from " || bk_TaskStatusCode
|
||||
|| "\nTo " || TaskStatusCode
|
||||
,"Tester","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
*/
|
||||
try
|
||||
//get the .NET version of the Client Visit object. Needed to create new
|
||||
//ObjectsPlus objects
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((Client_Visit_Guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
|
||||
endtry;
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Retrieve client:{{-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 the client object cannot be retrieved, do not attempt
|
||||
// to create any ObjectsPlus objects.
|
||||
conclude true;
|
||||
endcatch;
|
||||
|
||||
if ((TaskStatusCode = "Performed") and (not (exists delete_healthIssue_GUID))) // marked as performed
|
||||
// but if already a HI, do nothing.
|
||||
then
|
||||
try
|
||||
//---------------------------------------------------------
|
||||
// New HealthIssue Example
|
||||
//---------------------------------------------------------
|
||||
|
||||
// Type and Code information for creating a new HealthIssue
|
||||
NewHealthIssueHIType := "Vaccine History";
|
||||
NewHealthIssueHICode := issuecode;
|
||||
NewHealthIssueHIScheme := "Vaccine History";
|
||||
|
||||
// Create an instance of a HealthIssue
|
||||
New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue
|
||||
with
|
||||
(client_visit_obj, //ClientVisit
|
||||
NewHealthIssueHIType, // HI Type
|
||||
NewHealthIssueHIScheme, // HI Coding Scheme
|
||||
NewHealthIssueHICode ); // HI Code
|
||||
|
||||
// Set some properties of the healthIssue
|
||||
PartialDate_obj := new net_object {{{SINGLE-QUOTE}}}PartialDate{{{SINGLE-QUOTE}}} with (
|
||||
yr as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, // Year
|
||||
mn as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, // Month
|
||||
dd as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}} ); // Day
|
||||
|
||||
New_HealthIssue_obj.OnsetDate := PartialDate_obj;
|
||||
|
||||
extratext := "";
|
||||
if user_id matches pattern "%services"
|
||||
then
|
||||
extratext := "VeriScan";
|
||||
else
|
||||
extratext := "the eMAR";
|
||||
endif;
|
||||
|
||||
New_HealthIssue_obj.Text := "Created via {{{SINGLE-QUOTE}}}Marked as Done{{{SINGLE-QUOTE}}} from " || extratext;
|
||||
|
||||
New_HealthIssue_obj.Name := issuename;
|
||||
NewHealthIssue_dest.ObjectsPlus := New_HealthIssue_obj;
|
||||
endtry;
|
||||
catch exception ex
|
||||
error_occurred := true;
|
||||
|
||||
if ( New_HealthIssue_obj is NOT NULL ) then
|
||||
void:= call New_HealthIssue_obj.Dispose;
|
||||
New_HealthIssue_obj:= null;
|
||||
endif;
|
||||
|
||||
NewHealthIssue_dest := null;
|
||||
endcatch;
|
||||
elseif bk_TaskStatusCode = "Performed"
|
||||
then
|
||||
|
||||
// else you are resting the task that was performed, so take away the Health Issue
|
||||
// Note we already found the related HI by the delete_healthIssue_GUID in the SQL in the Data element
|
||||
try
|
||||
if exists delete_healthIssue_GUID
|
||||
then
|
||||
Discontinue_HealthIssue_Obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ( (delete_healthIssue_GUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
empty := call Discontinue_HealthIssue_Obj.Discontinue;
|
||||
Discontinue_HealthIssue_dest.ObjectsPlus := Discontinue_HealthIssue_Obj;
|
||||
endif;
|
||||
endtry;
|
||||
catch exception ex
|
||||
error_occurred := true;
|
||||
error_message := error_message || "{{+R}}Discontinue HI {{-R}} \n\n";
|
||||
if ex.InnerException is not null net_object then
|
||||
error_message := error_message || "Inner Exception " || ex.InnerException.Message || "\n\n";
|
||||
endif;
|
||||
|
||||
if (Discontinue_HealthIssue_Obj is not null) then
|
||||
void := call Discontinue_HealthIssue_Obj.Dispose;
|
||||
Discontinue_HealthIssue_Obj := null;
|
||||
endif;
|
||||
Discontinue_HealthIssue_dest := null;
|
||||
endcatch;
|
||||
|
||||
endif;
|
||||
conclude true;
|
||||
endif;
|
||||
;;
|
||||
action:
|
||||
if exists NewHealthIssue_dest then
|
||||
write TRUE at NewHealthIssue_dest;
|
||||
endif;
|
||||
|
||||
if exists Discontinue_HealthIssue_Dest then
|
||||
write TRUE at Discontinue_HealthIssue_Dest;
|
||||
endif;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
210
MLMStripper/bin/Debug/SCH/SCH_CHECK_LAB_ORDERS_HISTORY.mlm
Normal file
210
MLMStripper/bin/Debug/SCH/SCH_CHECK_LAB_ORDERS_HISTORY.mlm
Normal file
@@ -0,0 +1,210 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CHECK_LAB_ORDERS_HISTORY ;;
|
||||
mlmname: SCH_CHECK_LAB_ORDERS_HISTORY ;;
|
||||
arden: version 2.5;;
|
||||
version: 15.3;;
|
||||
institution: ALLSCRIPTS;;
|
||||
author: ANKIT MISTRY;;
|
||||
specialist: ;;
|
||||
date: 2017-09-06;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
;;
|
||||
explanation:
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
citations:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
enter_order_event_hemoglobin := EVENT { OrderEnter User Order: WHERE NAME = "Hemoglobin A1C" };
|
||||
enter_order_event_LipidPanel := EVENT { OrderEnter User Order: WHERE NAME = "Lipid Panel"};
|
||||
enter_order_event_Hepaptitis_Mayo := EVENT { OrderEnter User Order: WHERE NAME = "Hepatitis C Antibody (Mayo)"};
|
||||
enter_order_event_Hepaptitis_IgG := EVENT { OrderEnter User Order: WHERE NAME = "Hepatitis C Antibody IgG"};
|
||||
|
||||
init_order_event_hemoglobin := EVENT { OrderInit User Order: WHERE NAME = "Hemoglobin A1C" };
|
||||
init_order_event_LipidPanel := EVENT { OrderInit User Order: WHERE NAME = "Lipid Panel"};
|
||||
init_order_event_Hepaptitis_Mayo := EVENT { OrderInit User Order: WHERE NAME = "Hepatitis C Antibody (Mayo)"};
|
||||
init_order_event_Hepaptitis_IgG := EVENT { OrderInit User Order: WHERE NAME = "Hepatitis C Antibody IgG"};
|
||||
|
||||
// Start Modified: 09/25/2017 Keyur
|
||||
Is_Order_Set :=0;
|
||||
Event_Type:=EvokingEventType;
|
||||
IF EXISTS (EVOKINGOBJECT.OrderSetName) THEN
|
||||
Is_Order_Set :=1;
|
||||
ENDIF;
|
||||
// End Modified: 09/25/2017 Keyur
|
||||
|
||||
HemoglobinA1C_OrderName := "Hemoglobin A1C";
|
||||
LipidPanel_OrderName := "Lipid Panel";
|
||||
Hepaptitis_Mayo_OrderName := "Hepatitis C Antibody (Mayo)";
|
||||
Hepaptitis_IgG_OrderName := "Hepatitis C Antibody IgG";
|
||||
|
||||
ClientGUID := EVOKINGOBJECT.ClientGUID;
|
||||
ClientVisitGUID := EVOKINGOBJECT.ClientVisitGUID;
|
||||
|
||||
If EVOKINGOBJECT.Name = HemoglobinA1C_OrderName then
|
||||
// STart Modified: 09/26/2017
|
||||
/*(HemoglobinA1C_EnteredDate,
|
||||
HemoglobinA1C_ResultComponent,
|
||||
HemoglobinA1C_ResultValue) := READ FIRST {" SELECT TOP 1 CONVERT(VARCHAR(12),O.Entered,110) AS ENTERED,BO.ITEMNAME,BO.VALUE
|
||||
FROM CV3Order O WITH (NOLOCK)
|
||||
INNER JOIN CV3BasicObservation BO WITH (NOLOCK) ON BO.OrderGUID = O.GUID AND BO.ItemName = {{{SINGLE-QUOTE}}}Hemoglobin A1C Percent{{{SINGLE-QUOTE}}}
|
||||
WHERE (O.Entered > GETDATE()-60) AND O.NAME = " || SQL(HemoglobinA1C_OrderName) || " AND O.ClientGUID = " || SQL(ClientGUID) || "
|
||||
ORDER BY O.CreatedWhen DESC "};*/
|
||||
(HemoglobinA1C_EnteredDate,
|
||||
HemoglobinA1C_ResultComponent,
|
||||
HemoglobinA1C_ResultValue) := READ FIRST {" SELECT TOP 1 CONVERT(VARCHAR(12),O.Entered,110) AS ENTERED,BO.ITEMNAME,BO.VALUE +{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}+BO.UnitOfMeasure "
|
||||
|| " FROM CV3CLIENTVISIT CV WITH (NOLOCK) "
|
||||
|| " INNER JOIN CV3Order O WITH (NOLOCK) ON O.CLIENTGUID = CV.CLIENTGUID AND O.CHARTGUID = CV.CHARTGUID AND O.ClientVisitGUID = CV.GUID AND O.NAME = {{{SINGLE-QUOTE}}}Hemoglobin A1C{{{SINGLE-QUOTE}}} AND (O.Entered > GETDATE()-60) "
|
||||
|| " INNER JOIN CV3BasicObservation BO WITH (NOLOCK) ON BO.ClientGUID = O.ClientGUID AND BO.ChartGUID = O.ChartGUID AND BO.OrderGUID = O.GUID AND BO.ItemName = {{{SINGLE-QUOTE}}}Hemoglobin A1C Percent{{{SINGLE-QUOTE}}} "
|
||||
|| " WHERE O.ClientGUID = " || SQL(ClientGUID)
|
||||
|| " ORDER BY O.CreatedWhen DESC "};
|
||||
// End Modified: 09/26/2017
|
||||
If EXISTS HemoglobinA1C_EnteredDate THEN
|
||||
Hemoglobin_msg := "{{+B}}" || HemoglobinA1C_OrderName || "{{-B}}" || " performed on "|| HemoglobinA1C_EnteredDate ||" with result of {{+R}}"|| HemoglobinA1C_ResultValue ||"{{-R}}.\n"
|
||||
|| "60 day interval between testing recommended. If additional testing required, please call Pathology Office at x3800.";
|
||||
HemoglobinExists := 1;
|
||||
ENDIF;
|
||||
EndIf;
|
||||
|
||||
If EVOKINGOBJECT.Name = LipidPanel_OrderName then
|
||||
// Start Modified: 09/26/2017
|
||||
/*(LipidPanel_Entered,LipidPanel_Cholesterol,
|
||||
LipidPanel_Triglycerides,LipidPanel_HDL,
|
||||
LipidPanel_LDL_Calculated,
|
||||
LipidPanel_VLDL_Calculated) := READ FIRST {" SELECT CONVERT(VARCHAR(12),O.Entered,110) AS ENTERED,BO.ITEMNAME,BO.VALUE
|
||||
INTO #DATA
|
||||
FROM CV3Order O WITH (NOLOCK)
|
||||
INNER JOIN CV3BasicObservation BO WITH (NOLOCK) ON BO.OrderGUID = O.GUID
|
||||
WHERE O.NAME = " || SQL(LipidPanel_OrderName) || " AND O.ClientVisitGUID = " || SQL(ClientVisitGUID) || "
|
||||
ORDER BY O.CreatedWhen DESC
|
||||
SELECT TOP 1 ENTERED,[Cholesterol],[Triglycerides],[HDL],[LDL Calculated],[VLDL Calculated]
|
||||
FROM (SELECT * FROM #DATA) AS [RESULT]
|
||||
PIVOT
|
||||
(
|
||||
MAX(VALUE)
|
||||
FOR ITEMNAME IN ([Cholesterol],[Triglycerides],[HDL],[LDL Calculated],[VLDL Calculated])
|
||||
) AS PVT
|
||||
ORDER BY ENTERED DESC
|
||||
DROP TABLE #DATA "};*/
|
||||
(LipidPanel_Entered,LipidPanel_Cholesterol,
|
||||
LipidPanel_Triglycerides,LipidPanel_HDL,
|
||||
LipidPanel_LDL_Calculated,
|
||||
LipidPanel_VLDL_Calculated) := READ FIRST {" IF OBJECT_ID({{{SINGLE-QUOTE}}}tempdb.dbo.#DATA{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}U{{{SINGLE-QUOTE}}}) IS NOT NULL DROP TABLE #DATA "
|
||||
|| " SELECT CONVERT(VARCHAR(12),O.Entered,110) AS ENTERED,BO.ITEMNAME,BO.VALUE,BO.UnitOfMeasure "
|
||||
|| " INTO #DATA "
|
||||
|| " FROM CV3CLIENTVISIT CV WITH (NOLOCK) "
|
||||
|| " INNER JOIN CV3Order O WITH (NOLOCK) ON O.CLIENTGUID = CV.CLIENTGUID AND O.CHARTGUID = CV.CHARTGUID AND O.ClientVisitGUID = CV.GUID AND O.NAME = {{{SINGLE-QUOTE}}}Lipid Panel{{{SINGLE-QUOTE}}} "
|
||||
|| " INNER JOIN CV3BasicObservation BO WITH (NOLOCK) ON BO.ClientGUID = O.ClientGUID AND BO.ChartGUID = O.ChartGUID AND BO.OrderGUID = O.GUID "
|
||||
|| " WHERE CV.GUID = " || SQL(ClientVisitGUID)
|
||||
|| " ORDER BY O.CreatedWhen DESC "
|
||||
|| " SELECT TOP 1 ENTERED,[Cholesterol]+{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}+UnitOfMeasure,[Triglycerides]+{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}+UnitOfMeasure,[HDL]+{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}+UnitOfMeasure, "
|
||||
|| " [LDL Calculated]+{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}+UnitOfMeasure,[VLDL Calculated]+{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}+UnitOfMeasure "
|
||||
|| " FROM (SELECT * FROM #DATA) AS [RESULT] "
|
||||
|| " PIVOT "
|
||||
|| " ( "
|
||||
|| " MAX(VALUE) "
|
||||
|| " FOR ITEMNAME IN ([Cholesterol],[Triglycerides],[HDL],[LDL Calculated],[VLDL Calculated]) "
|
||||
|| " ) AS PVT "
|
||||
|| " ORDER BY ENTERED DESC "};
|
||||
// End Modified: 09/26/2017
|
||||
|
||||
If EXISTS LipidPanel_Entered THEN
|
||||
LipidPanel_msg := "{{+B}}" || LipidPanel_OrderName || "{{-B}}" || " already performed this admission " || LipidPanel_Entered ||"\n"
|
||||
|| "Cholesterol {{+R}}" || LipidPanel_Cholesterol || "{{-R}}\n"
|
||||
|| "Triglycerides {{+R}}" || LipidPanel_Triglycerides || "{{-R}}\n"
|
||||
|| "HDL {{+R}}" || LipidPanel_HDL || "{{-R}}\n"
|
||||
|| "LDL Calculated {{+R}}" || LipidPanel_LDL_Calculated || "{{-R}}\n"
|
||||
|| "VLDL Calculated {{+R}}" || LipidPanel_VLDL_Calculated || "{{-R}}";
|
||||
LipidPanelExists := 1;
|
||||
ENDIF;
|
||||
EndIf;
|
||||
|
||||
If EVOKINGOBJECT.Name IN (Hepaptitis_Mayo_OrderName,Hepaptitis_IgG_OrderName) then
|
||||
(Hepatitis_C_Antibody_Mayo_Entered,
|
||||
Hepatitis_C_Antibody_Mayo_ResultComponent,
|
||||
Hepatitis_C_Antibody_Mayo_ResultValue) := READ FIRST {" SELECT TOP 1 CONVERT(VARCHAR(12),O.Entered,110) AS ENTERED,BO.ITEMNAME,BO.VALUE "
|
||||
|| " FROM CV3ClientVisit CV WITH (NOLOCK) "
|
||||
|| " INNER JOIN CV3Order O WITH (NOLOCK) ON O.ClientGUID = CV.ClientGUID AND O.ChartGUID = CV.ChartGUID AND O.ClientVisitGUID = CV.GUID AND O.NAME = {{{SINGLE-QUOTE}}}Hepatitis C Antibody (Mayo){{{SINGLE-QUOTE}}} "
|
||||
|| " INNER JOIN CV3BasicObservation BO WITH (NOLOCK) ON BO.ClientGUID = O.ClientGUID AND BO.ChartGUID = O.ChartGUID AND BO.OrderGUID = O.GUID AND BO.ItemName = {{{SINGLE-QUOTE}}}Hepatitis C Antibody Mayo{{{SINGLE-QUOTE}}} "
|
||||
|| " WHERE CV.ClientGUID = " || SQL(ClientGUID)
|
||||
|| " ORDER BY O.CreatedWhen DESC "};
|
||||
//SELECT CONVERT(VARCHAR(20),GETDATE(),110)
|
||||
(Hepatitis_C_Antibody_IgG_Entered,
|
||||
Hepatitis_C_Antibody_IgG_ResultComponent,
|
||||
Hepatitis_C_Antibody_IgG_ResultValue) := READ FIRST {" SELECT TOP 1 CONVERT(VARCHAR(12),O.Entered,110) AS ENTERED,BO.ITEMNAME,BO.VALUE "
|
||||
|| " FROM CV3ClientVisit CV WITH (NOLOCK) "
|
||||
|| " INNER JOIN CV3Order O WITH (NOLOCK) ON O.ClientGUID = CV.ClientGUID AND O.ChartGUID = CV.ChartGUID AND O.ClientVisitGUID = CV.GUID AND O.NAME = {{{SINGLE-QUOTE}}}Hepatitis C Antibody IgG{{{SINGLE-QUOTE}}} "
|
||||
|| " INNER JOIN CV3BasicObservation BO WITH (NOLOCK) ON BO.ClientGUID = O.ClientGUID AND BO.ChartGUID = O.ChartGUID AND BO.OrderGUID = O.GUID AND BO.ItemName = {{{SINGLE-QUOTE}}}Hepatitis C Antibody IgG{{{SINGLE-QUOTE}}} "
|
||||
|| " WHERE CV.ClientGUID = " || SQL(ClientGUID)
|
||||
|| " ORDER BY O.CreatedWhen DESC "};
|
||||
If EXISTS Hepatitis_C_Antibody_Mayo_Entered then
|
||||
Hepatitis_msg := "{{+B}}" || Hepaptitis_Mayo_OrderName || "{{-B}}" || " performed on " || Hepatitis_C_Antibody_Mayo_Entered || " with result of {{+R}}" || Hepatitis_C_Antibody_Mayo_ResultValue || "{{-R}}.\n"
|
||||
|| "If additional Hepatitis C Screening is required, please call Pathology Office at x3800.";
|
||||
HepatitisExists := 1;
|
||||
ElseIf EXISTS Hepatitis_C_Antibody_IgG_Entered then
|
||||
Hepatitis_msg := "{{+B}}" || Hepaptitis_IgG_OrderName || "{{-B}}" || " performed on " || Hepatitis_C_Antibody_IgG_Entered || " with result of {{+R}}" || Hepatitis_C_Antibody_IgG_ResultValue || "{{-R}}.\n"
|
||||
|| "If additional Hepatitis C Screening is required, please call Pathology Office at x3800.";
|
||||
HepatitisExists := 1;
|
||||
EndIf;
|
||||
EndIf;
|
||||
|
||||
Order_Alert := DESTINATION {Alert} WITH
|
||||
[
|
||||
alert_type := "WARNING",
|
||||
Short_Message := "Duplicate Order",
|
||||
Priority := "High",
|
||||
send_with_order := "",
|
||||
Alert_Dialog_Settings := "No Override Allowed"
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
enter_order_event_hemoglobin;
|
||||
enter_order_event_LipidPanel;
|
||||
enter_order_event_Hepaptitis_Mayo;
|
||||
enter_order_event_Hepaptitis_IgG;
|
||||
|
||||
init_order_event_hemoglobin;
|
||||
init_order_event_LipidPanel;
|
||||
init_order_event_Hepaptitis_Mayo;
|
||||
init_order_event_Hepaptitis_IgG;
|
||||
;;
|
||||
logic:
|
||||
// Start Modified: 09/25/2017
|
||||
//CONCLUDE TRUE;
|
||||
if Is_Order_Set=1 and Event_Type="OrderEnter" then
|
||||
CONCLUDE TRUE;
|
||||
endif;
|
||||
if Is_Order_Set=0 and Event_Type="OrderInit" then
|
||||
CONCLUDE TRUE;
|
||||
endif;
|
||||
// End Modified: 09/25/2017
|
||||
;;
|
||||
action:
|
||||
IF HemoglobinExists = 1 THEN
|
||||
WRITE Hemoglobin_msg AT Order_Alert;
|
||||
ENDIF;
|
||||
|
||||
IF LipidPanelExists = 1 THEN
|
||||
WRITE LipidPanel_msg AT Order_Alert;
|
||||
ENDIF;
|
||||
|
||||
IF HepatitisExists = 1 THEN
|
||||
WRITE Hepatitis_msg AT Order_Alert;
|
||||
ENDIF;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,168 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CHF_HealthIssue_Nursing_Order_Weight ;;
|
||||
filename: SCH_CHF_HealthIssue_Nursing_Order_Weight ;;
|
||||
arden: version 2;;
|
||||
version: 4.50;;
|
||||
institution: St Clair;;
|
||||
author: Shivprasad Jadhav;;
|
||||
specialist: Shivprasad Jadhav, Allscripts Corp.;;
|
||||
date: 2015-10-05;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Automate order for a daily weight whenever a diagnosis or health issue of heart failure is noted on chart at any time.
|
||||
On Admission if patient has a diagnosis of Heart Failure or Congestive Heart Failure ( or listed as CHF) or the same as a listing in health issues at any time,
|
||||
create an automatic order "Weight" with the schedule of daily._
|
||||
;;
|
||||
explanation: Do not allow a user, unless they are a doctor to enter non coded health issue
|
||||
|
||||
Change History
|
||||
|
||||
10.05.2015 SJ CSR# 33556 - Created MLM
|
||||
12.03.2019 DW CSR# 38825 - Update Nursing View on Inpatient Status Board (change Weight order to Daily Weight)
|
||||
|
||||
;;
|
||||
keywords: Transfer
|
||||
;;
|
||||
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}}};
|
||||
include standard_libs;
|
||||
|
||||
/* Change the message within the quotes if a different short-message is needed.*/
|
||||
//health_alert:= destination { Alert: warning, "Health Issue Entered", high, chart,
|
||||
// "Health Issue", 7005, send_alert, "No Override Allowed" };
|
||||
|
||||
Health_Issue:= event{HealthIssueEnter Any HealthIssue: Where (ShortName matches pattern "%CHF%" OR ShortName matches pattern "%Heart Failure%") };
|
||||
/***************************************************************************************/
|
||||
|
||||
(guid, shortname):= read last {HealthIssue: codedhealthissueguid , shortname REFERENCING EvokingObject};
|
||||
( careProvider_obj ) := read last{ UserInfo: careProvider };
|
||||
( careProvider_Actaul ) := read last{ UserInfo: This };
|
||||
|
||||
Care_Provider := careprovider_obj.GUID ; //EVOKINGOBJECT.AuthoredProviderGUID;
|
||||
visitGuid := EVOKINGOBJECT.ClientVisitGUID ;
|
||||
(Typecode, Username ) := Read first {" Select Typecode, DisplayName from CV3CareProvider Where GUID = " || Care_Provider || " "} ;
|
||||
location_guid := Read First {" Select CurrentLocationGUID from CV3ClientVisit Where GUID = " || visitGuid || " "} ;
|
||||
|
||||
|
||||
|
||||
GeneralOrder_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Order Object",
|
||||
rule_number := 2010 ];
|
||||
|
||||
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 ];
|
||||
|
||||
|
||||
|
||||
IF(visitGuid IS NOT NULL) THEN
|
||||
try
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
WSSessionType := "Standard";//"Inpatient Orders";//Standard";//"
|
||||
WSSessionReason := "";
|
||||
WSRequestedBySource := "";//"1 Standard";
|
||||
WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( Care_Provider as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
|
||||
WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid 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;
|
||||
|
||||
endcatch;
|
||||
ENDIF;
|
||||
|
||||
if (client_visit_obj is not null) then
|
||||
try
|
||||
|
||||
Catalog_Item_Name := "Weight Daily";
|
||||
order_Creation_Reason := "Order Created From MLM";
|
||||
|
||||
// get OrderCatalogMasterItem ObjectsPlus object
|
||||
General_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, // ClientVisit ObjectsPlus object
|
||||
General_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
||||
order_Creation_Reason, // CreateReason
|
||||
wsRequestedBy_obj, // RequestedBy ObjectsPlus object
|
||||
wsRequestedBySource, // string RequestedBySource (must be in dictionary)
|
||||
wsSessionType, // string SessionType
|
||||
wsSessionReason, // string SessionReason
|
||||
wslocation_obj, // Location ReleaseLocGrpID
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
|
||||
|
||||
// GeneralOrder_obj.Frequency:= "Daily" ; /* removed 12/03/2019 */
|
||||
//local_session.SessionRequestBed := Null ;
|
||||
//void := DiagnosticOrder_obj.save;
|
||||
|
||||
GeneralOrder_dest.ObjectsPlus := GeneralOrder_obj;
|
||||
void := call GeneralOrder_obj.save; ///To Save The Order To SCM
|
||||
|
||||
endtry;
|
||||
catch Exception ex
|
||||
|
||||
error_occurred := true;
|
||||
error_message := error_message || "{{+R}}New general order:{{-R}}\n" ||
|
||||
ex.Message || "\n\n";
|
||||
|
||||
if ( Catalog_Item_Name is NOT NULL ) then
|
||||
void:= call Catalog_Item_Name.Dispose;
|
||||
Catalog_Item_Name:= null;
|
||||
endif;
|
||||
|
||||
if ( GeneralOrder_obj is NOT NULL ) then
|
||||
void:= call GeneralOrder_obj.Dispose;
|
||||
GeneralOrder_obj:= null;
|
||||
endif;
|
||||
|
||||
endcatch;
|
||||
ENDIF;
|
||||
|
||||
;;
|
||||
evoke: Health_Issue;
|
||||
;;
|
||||
logic:
|
||||
// conclude true;
|
||||
conclude True;
|
||||
|
||||
;;
|
||||
action:
|
||||
//write Stop_Message at health_alert;
|
||||
;;
|
||||
end:
|
||||
508
MLMStripper/bin/Debug/SCH/SCH_CITALOPRAM_MEDICATION_ALERTS.mlm
Normal file
508
MLMStripper/bin/Debug/SCH/SCH_CITALOPRAM_MEDICATION_ALERTS.mlm
Normal file
@@ -0,0 +1,508 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CITALOPRAM_MEDICATION_ALERTS;;
|
||||
mlmname: SCH_CITALOPRAM_MEDICATION_ALERTS;;
|
||||
arden: version 2.5;;
|
||||
version: 6.10;;
|
||||
institution: St Clair;;
|
||||
author: Juliet M. Johns, Allscripts Corp;;
|
||||
specialist: Juliet M. Johns;;
|
||||
date: 2015-11-10;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Statin Medication Alerts
|
||||
;;
|
||||
|
||||
explanation: MLM will read user dictionary table and display alerts based on citalopram drug interaction conflicts.
|
||||
|
||||
Change history
|
||||
11.10.2015 JML CSR 33122: Created.
|
||||
12.22.2015 JML Moved to Production.
|
||||
|
||||
;;
|
||||
keywords: citalopram, drug, alerts
|
||||
|
||||
;;
|
||||
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}}};
|
||||
include standard_libs;
|
||||
|
||||
//Additional include MLMs
|
||||
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
||||
create_aoa_object := MLM {{{SINGLE-QUOTE}}}STD_Func_Create_Alert_Action_Object{{{SINGLE-QUOTE}}};
|
||||
|
||||
//Formatting constants
|
||||
SP := " ";
|
||||
CR := 13 formatted with "%c";
|
||||
LF := 10 formatted with "%c";
|
||||
CRLF:= CR||LF;
|
||||
TAB := 9 formatted with "%c";
|
||||
messageA := SP;
|
||||
messageB := SP;
|
||||
messageC := SP;
|
||||
|
||||
//Variable Declaration
|
||||
send_alert := "DoNotSend"; //Send message or not
|
||||
error_occurred := false; //Error handler
|
||||
error_message := ""; //Error message
|
||||
|
||||
log_execution_info := false;
|
||||
|
||||
rule_matches := false;
|
||||
do_alert := false;
|
||||
found_unsubmitted_meds := false;
|
||||
found_existing_meds := false;
|
||||
ordered_citalopram := false;
|
||||
aa_lst := ();
|
||||
msg_string := "";
|
||||
alert_msg_lst := ();
|
||||
|
||||
//Debug via MLM editor
|
||||
if called_by_editor then
|
||||
EvokingObject := read last {Order: THIS
|
||||
where Name="Esomeprazole 20mg DR Cap" };
|
||||
endif;
|
||||
|
||||
//Citalopram list of drug interactions to alert on
|
||||
citalopram_conflict_list := ("A|Citalopram|20|mg|>|esomeprazole|mg",
|
||||
"A|Citalopram|20|mg|>|omeprazole|mg",
|
||||
"A|Citalopram|20|mg|>|lansoprazole|mg",
|
||||
"B|Citalopram|20|mg|>|oxcarbazepine|mg",
|
||||
"B|Citalopram|20|mg|>|letrozole|mg",
|
||||
"C|Citalopram|20|mg|>|fluconazole|mg",
|
||||
"C|Citalopram|20|mg|>|voriconazole|mg",
|
||||
"D|Citalopram|20|mg|>|modafinil|mg",
|
||||
"D|Citalopram|20|mg|>|fluvoxamine|mg",
|
||||
"D|Citalopram|20|mg|>|isoniazid|mg");
|
||||
|
||||
citalopram_order_enter := event { OrderEnter User Order : where TypeCode = "Medication" };
|
||||
|
||||
citalopram_alert_dest := destination {alert} with
|
||||
[alert_type := "Warning",
|
||||
short_message := "Citalopram Medication Alert",
|
||||
priority := "low",
|
||||
scope := "Chart",
|
||||
rule_group := "Citalopram Meds",
|
||||
rule_number := 4056,
|
||||
send_with_order := send_alert,
|
||||
alert_dialog_settings := "",
|
||||
display_alert := true];
|
||||
|
||||
//Retrieve values from evoking object
|
||||
(client_guid, chart_guid, visit_guid,
|
||||
evoking_orderName, evoking_orderGUID,
|
||||
evoking_significantDtm, catalog_item_obj,
|
||||
ordered_uomValue, ordered_doseValue) := READ LAST { Order : ClientGUID, ChartGUID, ClientVisitGUID, Name, GUID, SignificantDtm,
|
||||
OrderCatalogMasterItem, UOM, DosageLow
|
||||
REFERENCING EvokingObject };
|
||||
|
||||
(catalog_classTypeValueObj,
|
||||
evoking_orderCatalogMasterItemGUID) := READ LAST { OrderCatalogMasterItem : CatalogClassTypeValue, GUID
|
||||
REFERENCING catalog_item_obj };
|
||||
|
||||
//Retrieve initial medications involved in citalopram custom user list
|
||||
(classTypeValue_codeList, classTypeValue_valueList) := read { CatalogClassTypeValue : Code, Value
|
||||
REFERENCING catalog_classTypeValueObj WHERE code = "PRX_Citalopram_Medications" };
|
||||
|
||||
//Parse the medications involved in the citalopram custom user list
|
||||
class_valueList := call str_parse WITH classTypeValue_valueList[1], ",";
|
||||
class_value := class_valueList[1];
|
||||
|
||||
//Ordered med exists in the citalopram custom user list
|
||||
if ( class_value is not null ) then
|
||||
|
||||
//Citalopram ordered
|
||||
if ( class_value matches pattern "citalopram%" ) then
|
||||
|
||||
ordered_citalopram := true;
|
||||
|
||||
//Retrieve list of unsubmitted orders that conflict with citalopram
|
||||
(unsub_med_list,
|
||||
unsub_med_dose,
|
||||
unsub_med_uom,
|
||||
unsub_oGUID,
|
||||
unsub_oCatGUID) := READ { Unsubmitted Order : Name, DosageLow, UOM, GUID, OrderCatalogMasterItemGUID
|
||||
WHERE ( ( Name matches pattern "esomeprazole%" AND UOM = "mg" )
|
||||
OR ( Name matches pattern "omeprazole%" AND UOM = "mg" )
|
||||
OR ( Name matches pattern "lansoprazole%" AND UOM = "mg" )
|
||||
OR ( Name matches pattern "oxcarbazepine%" AND UOM = "mg" )
|
||||
OR ( Name matches pattern "letrozole%" AND UOM = "mg" )
|
||||
OR ( Name matches pattern "fluconazole%" AND UOM = "mg" )
|
||||
OR ( Name matches pattern "voriconazole%" AND UOM = "mg" )
|
||||
OR ( Name matches pattern "modafinil%" AND UOM = "mg" )
|
||||
OR ( Name matches pattern "fluvoxamine%" AND UOM = "mg" )
|
||||
OR ( Name matches pattern "isoniazid%" AND UOM = "mg" ) ) };
|
||||
|
||||
if ( exists unsub_med_list ) then
|
||||
found_unsubmitted_meds := true;
|
||||
endif;
|
||||
|
||||
//Now check for existing meds
|
||||
(existing_meds_list,
|
||||
existing_meds_name,
|
||||
existing_meds_dose,
|
||||
existing_meds_UOM,
|
||||
existing_order_guid,
|
||||
existing_order_oCat_guid ) := READ {"SELECT CASE WHEN CHARINDEX({{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}, o.NAME, 1) = 0 THEN LEFT(o.NAME, LEN(o.NAME) - 1)"
|
||||
|| " WHEN CHARINDEX({{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}, o.NAME, 1) > 0 THEN LEFT(o.Name, (CHARINDEX({{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}, o.NAME, 1) - 1))"
|
||||
|| " ELSE o.Name END, o.Name, ot.OrderDosageLow, ot.OrderUom, o.GUID, o.OrderCatalogMasterItemGUID"
|
||||
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
|
||||
|| " ON cv.ClientGUID = o.ClientGUID"
|
||||
|| " AND cv.GUID = o.ClientVisitGUID"
|
||||
|| " AND cv.ChartGUID = o.ChartGUID"
|
||||
|| " JOIN CV3OrderAddnlInfo oai WITH (NOLOCK)"
|
||||
|| " ON o.GUID = oai.GUID"
|
||||
|| " JOIN CV3OrderTask ot WITH (NOLOCK)"
|
||||
|| " ON o.GUID = ot.OrderGUID"
|
||||
|| " WHERE cv.ClientGUID = " || SQL(EvokingObject.ClientGUID)
|
||||
|| " AND cv.GUID = " || SQL(EvokingObject.ClientVisitGUID)
|
||||
|| " AND cv.ChartGUID = " || SQL(EvokingObject.ChartGUID)
|
||||
|| " AND ((o.Name LIKE {{{SINGLE-QUOTE}}}esomeprazole%{{{SINGLE-QUOTE}}} AND ot.OrderUOM = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|
||||
|| " OR (o.Name like {{{SINGLE-QUOTE}}}omeprazole%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|
||||
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}lansoprazole%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|
||||
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}oxcarbazepine%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|
||||
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}letrozole%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|
||||
|| " OR ( o.Name LIKE {{{SINGLE-QUOTE}}}fluconazole%{{{SINGLE-QUOTE}}} AND ot.OrderUOM = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|
||||
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}voriconazole%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|
||||
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}modafinil%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|
||||
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}fluvoxamine%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|
||||
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}isoniazid%{{{SINGLE-QUOTE}}} AND ot.OrderUOM = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}}))"
|
||||
|| " AND ((o.OrderStatusLevelNum > 15"
|
||||
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|
||||
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
|
||||
|
||||
if ( exists existing_meds_list ) then
|
||||
found_existing_meds := true;
|
||||
endif;
|
||||
|
||||
if ( exists existing_meds_list OR exists unsub_med_list ) then
|
||||
rule_matches := true;
|
||||
endif;
|
||||
|
||||
else
|
||||
//Ordered med was not citalopram; look for unsubmitted order
|
||||
(unsub_citalopram_list,
|
||||
unsub_citalopram_dose,
|
||||
unsub_citalopram_uom,
|
||||
unsub_citalopram_oGuid,
|
||||
unsub_citalopram_oCatGuid) := READ { Unsubmitted Order : Name, DosageLow, UOM, Guid, OrderCatalogMasterItemGUID
|
||||
WHERE Name matches pattern "citalopram%" AND UOM = "mg" };
|
||||
|
||||
if ( exists unsub_citalopram_list ) then
|
||||
found_unsubmitted_meds := true;
|
||||
endif;
|
||||
|
||||
//Check patient{{{SINGLE-QUOTE}}}s chart for existing citalopram order
|
||||
(existing_citalopram_list,
|
||||
existing_citalopram_med,
|
||||
existing_citalopram_dose,
|
||||
existing_citalopram_uom,
|
||||
existing_citalopram_oGuid,
|
||||
existing_citalopram_oCatGuid) := READ {"SELECT LEFT(o.Name, (CHARINDEX({{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}, o.NAME, 1) - 1)), o.Name, ot.OrderDosageLow, ot.OrderUom, o.GUID, o.OrderCatalogMasterItemGUID"
|
||||
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
|
||||
|| " ON cv.ClientGUID = o.ClientGUID"
|
||||
|| " AND cv.GUID = o.ClientVisitGUID"
|
||||
|| " AND cv.ChartGUID = o.ChartGUID"
|
||||
|| " JOIN CV3OrderAddnlInfo oai WITH (NOLOCK)"
|
||||
|| " ON o.GUID = oai.GUID"
|
||||
|| " JOIN CV3OrderTask ot WITH (NOLOCK)"
|
||||
|| " ON o.GUID = ot.OrderGUID"
|
||||
|| " WHERE cv.ClientGUID = " || SQL(EvokingObject.ClientGUID)
|
||||
|| " AND cv.GUID = " || SQL(EvokingObject.ClientVisitGUID)
|
||||
|| " AND cv.ChartGUID = " || SQL(EvokingObject.ChartGUID)
|
||||
|| " AND (o.Name LIKE {{{SINGLE-QUOTE}}}citalopram%{{{SINGLE-QUOTE}}} AND ot.OrderUOM = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|
||||
|| " AND ((o.OrderStatusLevelNum > 15"
|
||||
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|
||||
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
|
||||
|
||||
if ( exists existing_citalopram_list ) then
|
||||
found_existing_meds := true;
|
||||
endif;
|
||||
|
||||
if ( exists existing_citalopram_list OR exists unsub_citalopram_list ) then
|
||||
rule_matches := true;
|
||||
endif;
|
||||
|
||||
endif; //End ordered med = citalopram
|
||||
|
||||
if ( rule_matches ) then
|
||||
|
||||
//Loop through citalopram conflict list
|
||||
for i in ( 1 seqto ( count citalopram_conflict_list ) ) do
|
||||
citalopram_rule := call str_parse with citalopram_conflict_list[i], "|";
|
||||
|
||||
rule_class_type := citalopram_rule[1]; //Class Type
|
||||
rule_med := citalopram_rule[2]; //Citalopram med
|
||||
rule_dose := citalopram_rule[3]; //Citalopram dose
|
||||
rule_uom := citalopram_rule[4]; //citalopram uom
|
||||
rule_op := citalopram_rule[5]; //operation for citalopram
|
||||
rule_conflict := citalopram_rule[6]; //Med that conflicts with citalopram
|
||||
rule_conflict_uom := citalopram_rule[7]; //Med uom that conflicts with citalopram
|
||||
|
||||
//Ordered med = citalopram
|
||||
if ( ordered_citalopram ) then
|
||||
|
||||
//does ordered med = appropriate rule
|
||||
if ( rule_med = class_value ) then
|
||||
if ( rule_op = ">" ) then
|
||||
rule_matches := ( (ordered_doseValue as number) > (rule_dose as number) );
|
||||
rule_matches := ( rule_matches AND ( (ordered_uomValue as string) = (rule_uom as string) ) );
|
||||
else
|
||||
rule_matches := false;
|
||||
endif;
|
||||
|
||||
if ( rule_matches ) then
|
||||
|
||||
if ( found_unsubmitted_meds ) then
|
||||
//Conflict med in my unsubmitted order list
|
||||
for k in (1 seqto ( count unsub_med_list )) do
|
||||
found := FIND LOWERCASE rule_conflict IN STRING LOWERCASE unsub_med_list[k] STARTING AT 1;
|
||||
|
||||
if ( (found as number) = 1 ) then
|
||||
if ( rule_conflict_uom = unsub_med_uom[k] ) then
|
||||
do_alert := true;
|
||||
|
||||
msg_string := "Due to increased risk of QT prolongation, please lower {{+B}}{{+R}}" || rule_med
|
||||
|| "{{-R}}{{-B}} to " || rule_dose || rule_uom || " or change {{+B}}{{+R}}" || rule_conflict
|
||||
|| "{{-R}}{{-B}}";
|
||||
|
||||
if ( rule_class_type = "A" ) then
|
||||
msg_string := msg_string || " to another PPI such as pantoprazole.";
|
||||
elseif ( rule_class_type = "B" ) then
|
||||
msg_string := msg_string || " to an alternative agent, if clinically appropriate.";
|
||||
elseif ( rule_class_type = "C" ) then
|
||||
msg_string := msg_string || " to an alternative antifungal.";
|
||||
elseif ( rule_class_type = "D" ) then
|
||||
msg_string := msg_string || " to an alternative agent.";
|
||||
endif;
|
||||
|
||||
alert_msg_lst := alert_msg_lst, msg_string;
|
||||
|
||||
alert_action := call create_aoa_object WITH "CV3Order", "CV3Order";
|
||||
alert_action.EvokingEnterpriseItemID := evoking_orderCatalogMasterItemGUID;
|
||||
alert_action.EvokingObjectID := evoking_orderGUID;
|
||||
alert_action.ObjectName := evoking_orderName;
|
||||
alert_action.ActionItemStatus := "Unsubmitted";
|
||||
alert_action.ActionEvent := "DC-Cancel";
|
||||
alert_action.ActionItemID := unsub_oGuid[k];
|
||||
alert_action.ActionItemName := unsub_med_list[k];
|
||||
alert_action.ActionEnterpriseItemID := unsub_oCatGUID[k];
|
||||
alert_action.MLMName := "SCH_CITALOPRAM_MEDICATION_ALERTS";
|
||||
alert_action.ShortMessage := "This is the UNSUBMITTED Medication to DC-Cancel. This medication conflicts with the Citalopram you are trying to order.";
|
||||
|
||||
aa_lst := aa_lst, alert_action;
|
||||
endif;
|
||||
endif;
|
||||
enddo;
|
||||
endif;
|
||||
|
||||
if ( found_existing_meds ) then
|
||||
//Conflict med in existing med list
|
||||
if ( rule_conflict IN existing_meds_list AND rule_conflict_uom IN existing_meds_uom ) then
|
||||
|
||||
//Loop through existing conflict medications
|
||||
for j IN ( 1 seqto ( count existing_meds_list ) ) do
|
||||
if ( rule_conflict = existing_meds_list[j] ) then
|
||||
do_alert := true;
|
||||
|
||||
msg_string := "Due to increased risk of QT prolongation, please lower {{+B}}{{+R}}" || rule_med
|
||||
|| "{{-R}}{{-B}} to " || rule_dose || rule_uom || " or change {{+B}}{{+R}}" || rule_conflict
|
||||
|| "{{-R}}{{-B}}";
|
||||
|
||||
if ( rule_class_type = "A" ) then
|
||||
msg_string := msg_string || " to another PPI such as pantoprazole.";
|
||||
elseif ( rule_class_type = "B" ) then
|
||||
msg_string := msg_string || " to an alternative agent, if clinically appropriate.";
|
||||
elseif ( rule_class_type = "C" ) then
|
||||
msg_string := msg_string || " to an alternative antifungal.";
|
||||
elseif ( rule_class_type = "D" ) then
|
||||
msg_string := msg_string || " to an alternative agent.";
|
||||
endif;
|
||||
|
||||
alert_msg_lst := alert_msg_lst, msg_string;
|
||||
|
||||
alert_action := call create_aoa_object WITH "CV3Order","CV3Order";
|
||||
alert_action.EvokingEnterpriseItemID := evoking_orderCatalogMasterItemGUID;
|
||||
alert_action.EvokingItemID := evoking_orderGUID;
|
||||
alert_action.ObjectName := evoking_orderName;
|
||||
alert_action.ActionItemStatus := "Existing";
|
||||
alert_action.ActionEvent := "DC-Cancel";
|
||||
alert_action.ActionItemID := existing_order_guid[j];
|
||||
alert_action.ItemName := existing_meds_name[j];
|
||||
alert_action.ActionEnterpriseItemID := existing_order_oCat_guid[j];
|
||||
alert_action.MLMName := "SCH_CITALOPRAM_MEDICATION_ALERTS";
|
||||
alert_action.ShortMessage := "This is the EXISTING Medication to DC-Cancel. This medication conflicts with the Citalopram you are trying to order.";
|
||||
|
||||
aa_lst := aa_lst, alert_action;
|
||||
endif;
|
||||
enddo;
|
||||
endif;
|
||||
|
||||
endif; //end found_unsubmitted_meds = true
|
||||
endif;
|
||||
|
||||
endif; // end rule_med = class_value
|
||||
|
||||
//Ordered med NOT citalopram
|
||||
else
|
||||
|
||||
if ( rule_conflict = class_value AND rule_conflict_uom = ordered_uomValue ) then
|
||||
|
||||
if ( found_unsubmitted_meds ) then
|
||||
|
||||
for m IN ( 1 seqto (count unsub_citalopram_list) ) do
|
||||
|
||||
found := FIND LOWERCASE rule_med IN STRING LOWERCASE unsub_citalopram_list[m] STARTING AT 1;
|
||||
|
||||
if ( (found as number) <> 0 ) then
|
||||
|
||||
if ( rule_op = ">" ) then
|
||||
rule_matches := ( (unsub_citalopram_dose[m] as number) > (rule_dose as number) );
|
||||
rule_matches := ( rule_matches AND ( (unsub_citalopram_uom[m] as string) = (rule_uom as string) ) );
|
||||
else
|
||||
rule_matches := false;
|
||||
endif;
|
||||
|
||||
if ( rule_matches ) then
|
||||
|
||||
do_alert := true;
|
||||
|
||||
msg_string := "Due to increased risk of QT prolongation, please lower {{+B}}{{+R}}" || rule_med
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || rule_dose || rule_uom
|
||||
|| "{{-R}}{{-B}} or change {{+B}}{{+R}}" || rule_conflict || "{{-R}}{{-B}}";
|
||||
|
||||
if ( rule_class_type = "A" ) then
|
||||
msg_string := msg_string || " to another PPI such as pantoprazole.";
|
||||
elseif ( rule_class_type = "B" ) then
|
||||
msg_string := msg_string || " to an alternative agent, if clinically appropriate.";
|
||||
elseif ( rule_class_type = "C" ) then
|
||||
msg_string := msg_string || " to an alternative antifungal.";
|
||||
elseif ( rule_class_type = "D" ) then
|
||||
msg_string := msg_string || " to an alternative agent.";
|
||||
endif;
|
||||
|
||||
alert_msg_lst := alert_msg_lst, msg_string;
|
||||
|
||||
alert_action := call create_aoa_object WITH "CV3Order","CV3Order";
|
||||
alert_action.EvokingEnterpriseItemID := evoking_orderCatalogMasterItemGUID;
|
||||
alert_action.EvokingObjectID := evoking_orderGUID;
|
||||
alert_action.EvokingObjectName := evoking_orderName;
|
||||
alert_action.ActionItemStatus := "Unsubmitted";
|
||||
alert_action.ActionEvent := "DC-Cancel";
|
||||
alert_action.ActionItemID := unsub_citalopram_oGuid[m];
|
||||
alert_action.ActionItemName := unsub_citalopram_list[m];
|
||||
alert_action.ActionEnterpriseItemID := unsub_citalopram_oCatGuid[m];
|
||||
alert_action.MLMName := "SCH_CITALOPRAM_MEDICATION_ALERTS";
|
||||
alert_action.ShortMessage := "This is the UNSUBMITTED citalopram order to DC-Cancel. Citalopram conflicts with the medication that you are trying to order.";
|
||||
|
||||
aa_lst := aa_lst, alert_action;
|
||||
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
enddo;
|
||||
|
||||
endif;
|
||||
|
||||
if ( found_existing_meds ) then
|
||||
|
||||
//No unsubmitted citalopram; check patient{{{SINGLE-QUOTE}}}s chart
|
||||
if ( rule_med IN existing_citalopram_list ) then
|
||||
|
||||
for l IN ( 1 seqto (count existing_citalopram_list) ) do
|
||||
|
||||
if ( rule_op = ">" ) then
|
||||
rule_matches := ( (existing_citalopram_dose[l] as number) > (rule_dose as number) );
|
||||
rule_matches := ( rule_matches AND ( (existing_citalopram_uom[l] as string) = (rule_uom as string) ) );
|
||||
else
|
||||
rule_matches := false;
|
||||
endif;
|
||||
|
||||
if (rule_matches) then
|
||||
do_alert := true;
|
||||
|
||||
msg_string := "Due to increased risk of QT prolongation, please lower {{+B}}{{+R}}" || rule_med
|
||||
|| "{{-R}}{{-B}} to {{+B}}{{+R}}" || rule_dose || rule_uom
|
||||
|| "{{-R}}{{-B}} or change {{+B}}{{+R}}" || rule_conflict || "{{-R}}{{-B}}";
|
||||
|
||||
if ( rule_class_type = "A" ) then
|
||||
msg_string := msg_string || " to another PPI such as pantoprazole.";
|
||||
elseif ( rule_class_type = "B" ) then
|
||||
msg_string := msg_string || " to an alternative agent, if clinically appropriate.";
|
||||
elseif ( rule_class_type = "C" ) then
|
||||
msg_string := msg_string || " to an alternative antifungal.";
|
||||
elseif ( rule_class_type = "D" ) then
|
||||
msg_string := msg_string || " to an alternative agent.";
|
||||
endif;
|
||||
|
||||
alert_msg_lst := alert_msg_lst, msg_string;
|
||||
|
||||
alert_action := call create_aoa_object WITH "CV3Order","CV3Order";
|
||||
alert_action.EvokingEnterpriseItemID := evoking_orderCatalogMasterItemGUID;
|
||||
alert_action.EvokingItemID := evoking_orderGUID;
|
||||
alert_action.EvokingObjectName := evoking_orderName;
|
||||
alert_action.ActionItemStatus := "Existing";
|
||||
alert_action.ActionEvent := "DC-Cancel";
|
||||
alert_action.ActionItemID := existing_citalopram_oGuid[l];
|
||||
alert_action.ActionItemName := existing_citalopram_med[l];
|
||||
alert_action.ActionEnterpriseItemID := existing_citalopram_oCatGUID[l];
|
||||
alert_action.MLMName := "SCH_CITALOPRAM_MEDICATION_ALERTS";
|
||||
alert_action.ShortMessage := "This is the EXISTING citalopram medication to DC-Cancel. Citalopram conflicts with the medication that you are trying to order.";
|
||||
|
||||
aa_lst := aa_lst, alert_action;
|
||||
|
||||
endif;
|
||||
|
||||
enddo;
|
||||
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
endif; //End rule_conflict = class_value
|
||||
|
||||
endif; //End ordered_citalopram = true
|
||||
enddo; //End looping through existing meds
|
||||
endif; //end rule_matches
|
||||
|
||||
endif; //End class_value is not null
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
citalopram_order_enter;
|
||||
;;
|
||||
logic:
|
||||
conclude do_alert;
|
||||
;;
|
||||
action:
|
||||
|
||||
if ( do_alert ) then
|
||||
|
||||
final_msg := "";
|
||||
|
||||
for i IN (1 seqto count alert_msg_lst ) do
|
||||
if ( final_msg = "" ) then
|
||||
final_msg := alert_msg_lst[i];
|
||||
else
|
||||
final_msg := final_msg || "\n\n" || alert_msg_lst[i];
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
write final_msg at citalopram_alert_dest;
|
||||
|
||||
attach aa_lst to citalopram_alert_dest;
|
||||
endif;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
174
MLMStripper/bin/Debug/SCH/SCH_CODE_STATUS_DEFAULT_COMMENT.mlm
Normal file
174
MLMStripper/bin/Debug/SCH/SCH_CODE_STATUS_DEFAULT_COMMENT.mlm
Normal file
@@ -0,0 +1,174 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CODE_STATUS_DEFAULT_COMMENT;;
|
||||
filename: SCH_CODE_STATUS_DEFAULT_COMMENT;;
|
||||
arden: version 2.50;;
|
||||
version: 16.3;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Juliet Law;;
|
||||
specialist: Peggy Leschak;;
|
||||
date: 2017-11-22;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: This MLM will modify the Code Status comment IF "Ethically Unable to Determine" order exists on patient.
|
||||
|
||||
;;
|
||||
explanation: When a code status order is placed on a patient, the interface boomerangs a comment back into SCM so the CPR and Code Status
|
||||
verbiage is visible in the patient header. If "Ethically Unable to Determine" order is included in the code status orders
|
||||
for the patient, the patient header needs to display "(Default)" next to the code status verbiage so physicians have an
|
||||
indicator that this order exists.
|
||||
|
||||
This MLM will trigger when the interface enters the Code Status comment and update the verbiage if the "Ethically Unable to Determine"
|
||||
order exists.
|
||||
|
||||
Change History
|
||||
|
||||
11.22.2017 JML CSR 26413: Created
|
||||
|
||||
;;
|
||||
keywords: Code Status, Patient Comment
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
log_execution_info:= false;
|
||||
continueProcessing := false;
|
||||
|
||||
order_enter_event := EVENT { OrderEnter User Order : WHERE Name = "Code Status: Ethically unable to determine" };
|
||||
order_dc_event := EVENT { OrderDiscontinue User Order : WHERE Name = "Code Status: Ethically unable to determine" };
|
||||
|
||||
( ClientVisitGUID, ChartGUID, ClientGUID ):= read last { Order : ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject };
|
||||
|
||||
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_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true ];
|
||||
|
||||
if ( EvokingEvent = order_dc_event ) then
|
||||
|
||||
//Retrieve GUID for patient header comment
|
||||
discontinueCommentTypeCode := "Code Status Default";
|
||||
discontinue_Comment_GUID := read last { "select GUID from CV3CommentDeclaration "
|
||||
|| "where TypeCode = " || SQL(discontinueCommentTypeCode)
|
||||
|| " AND Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} AND ClientGUID = " || SQL(ClientGUID) } ;
|
||||
endif;
|
||||
;;
|
||||
evoke:
|
||||
order_enter_event;
|
||||
order_dc_event;
|
||||
;;
|
||||
logic:
|
||||
|
||||
try
|
||||
if ( EvokingEvent = order_enter_event ) then
|
||||
|
||||
ClientVisit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( ClientVisitGUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
|
||||
|
||||
CodeStatus_Comment_obj := call {{{SINGLE-QUOTE}}}PatientComment{{{SINGLE-QUOTE}}}.CreatePatientComment WITH ( ClientVisit_obj, "Code Status Default" );
|
||||
|
||||
CodeStatus_Comment_obj.Text := "(Default)";
|
||||
|
||||
void := call CodeStatus_Comment_obj.Save;
|
||||
endif;
|
||||
|
||||
//Destroy object
|
||||
if ( CodeStatus_Comment_obj is NOT NULL ) then
|
||||
void := call CodeStatus_Comment_obj.Dispose;
|
||||
CodeStatus_Comment_obj := null;
|
||||
endif;
|
||||
|
||||
if ( ClientVisit_obj IS NOT NULL ) then
|
||||
void := call ClientVisit_obj.Dispose;
|
||||
ClientVisit_obj := null;
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
|
||||
catch exception ex
|
||||
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}New Comment:{{-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 (CodeStatus_Comment_obj is NOT NULL ) then
|
||||
void:= call CodeStatus_Comment_obj.Dispose;
|
||||
CodeStatus_Comment_obj:= null;
|
||||
endif;
|
||||
|
||||
if ( ClientVisit_obj IS NOT NULL ) then
|
||||
void := call ClientVisit_obj.Dispose;
|
||||
ClientVisit_obj := null;
|
||||
endif;
|
||||
|
||||
endcatch;
|
||||
|
||||
try
|
||||
if ( EvokingEvent = order_dc_event AND exists discontinue_Comment_GUID ) then
|
||||
|
||||
CodeStatus_DiscontinueComment_obj := call {{{SINGLE-QUOTE}}}PatientComment{{{SINGLE-QUOTE}}}.FindByPrimaryKey WITH ( ( discontinue_Comment_GUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
|
||||
|
||||
void := call CodeStatus_DiscontinueComment_obj.Discontinue;
|
||||
|
||||
void := call CodeStatus_DiscontinueComment_obj.Save;
|
||||
|
||||
endif;
|
||||
|
||||
//Destroy object
|
||||
if ( CodeStatus_DiscontinueComment_obj IS NOT NULL ) then
|
||||
void := call CodeStatus_DiscontinueComment_obj.Dispose;
|
||||
CodeStatus_DiscontinueComment_obj := null;
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
|
||||
catch exception ex
|
||||
|
||||
error_occurred := true;
|
||||
|
||||
error_message := "{{+R}}New Comment:{{-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 ( CodeStatus_DiscontinueComment_obj IS NOT NULL ) then
|
||||
void := call CodeStatus_DiscontinueComment_obj.Dispose;
|
||||
CodeStatus_DiscontinueComment_obj := null;
|
||||
endif;
|
||||
|
||||
endcatch;
|
||||
|
||||
conclude true;
|
||||
;;
|
||||
action:
|
||||
|
||||
// write " Messages version 1.2 " at alert_dest;
|
||||
|
||||
if Error_occurred then
|
||||
|
||||
write "An error has occured in the MLM {{+B}}SCH_CODE_STATUS_DEFAULT_COMMENT{{-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;
|
||||
|
||||
;;
|
||||
end:
|
||||
172
MLMStripper/bin/Debug/SCH/SCH_COSIGNATURE_WARNING_ALERT.mlm
Normal file
172
MLMStripper/bin/Debug/SCH/SCH_COSIGNATURE_WARNING_ALERT.mlm
Normal file
@@ -0,0 +1,172 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CoSignature Warning Alert ;;
|
||||
FileName: SCH_CoSignature_Warning_Alert ;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: SCH ;;
|
||||
author: Shivprasad Jadhav;;
|
||||
specialist: ;;
|
||||
date: 2015-03-25;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: 25-03-2015 CSR :33292 - PA CNRP MLM Created.
|
||||
MLM fires a warning alert if note author is PA,PA-C or CRNP .
|
||||
;;
|
||||
explanation:
|
||||
This MLM is evoked on entering a new document in an Outpatient Visit .
|
||||
This MLM checks to see if a Cosignature has been requested for the document.
|
||||
The Phsician progress, eConsult, History and Physical and Discharge Summary e Note note when done by a PA, PA-C or and ust be signed by a physician.
|
||||
If they select save and there is not a doctor selected under authored by other or co-signer then fire and alert.
|
||||
The Alert will state: “A physician must be selected to save this document: Please click the Document Info tab and select your physician.”
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
DEV 02.19.2018 DW CSR# 35320 SSC - Added "IntraOp Nursing Note" to the documents list and "RN" to the occupation type list
|
||||
|
||||
;;
|
||||
keywords: ClientDocument; CoSignature; Outpatient;
|
||||
;;
|
||||
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}}};
|
||||
include standard_libs;
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
|
||||
log_execution_info := false;
|
||||
|
||||
/* Place the triggering event which is the entry of a new Document"Clinic Note"*/
|
||||
|
||||
Document_Enter := event { ClientDocumentEnter User ClientDocument :
|
||||
WHERE DocumentName = "Physician Progress Note"
|
||||
or DocumentName = "Consult eNote"
|
||||
or DocumentName = "History and Physical"
|
||||
or DocumentName = "Discharge Summary eNote"
|
||||
Or DocumentName = "Physician Progress Note - CCM"
|
||||
Or DocumentName = "Physician Progress Note by System-Enhanced"
|
||||
Or DocumentName = "Physician Progress Note- Cardiology"
|
||||
Or DocumentName = "Physician Progress Note- Rehab"
|
||||
Or DocumentName = "Post Procedure Note- Brief"
|
||||
Or DocumentName = "Hospitalist Intervention Note"
|
||||
or DocumentName = "IntraOp Nursing Note"
|
||||
|
||||
};
|
||||
|
||||
//Document_Enter := event {ClientDocumentEnter User ClientDocument: where documentname in ("Readmission Risk Assessment","Adult Patient Profile")};
|
||||
//Document_Modify := event {ClientDocumentModify User ClientDocument: where documentname in ("Readmission Risk Assessment","Adult Patient Profile")};
|
||||
|
||||
|
||||
|
||||
Document_Modify := event { ClientDocumentModify User ClientDocument:
|
||||
WHERE DocumentName = "Physician Progress Note"
|
||||
or DocumentName = "Consult eNote"
|
||||
or DocumentName = "History and Physical"
|
||||
or DocumentName = "Discharge Summary eNote"
|
||||
Or DocumentName = "Physician Progress Note - CCM"
|
||||
Or DocumentName = "Physician Progress Note by System-Enhanced"
|
||||
Or DocumentName = "Physician Progress Note- Cardiology"
|
||||
Or DocumentName = "Physician Progress Note- Rehab"
|
||||
Or DocumentName = "Post Procedure Note- Brief"
|
||||
Or DocumentName = "Hospitalist Intervention Note"
|
||||
or DocumentName = "IntraOp Nursing Note"
|
||||
};
|
||||
|
||||
alert_destination := destination { Alert: Warning, "Reminder: select co-signature box & enter attending MD name",
|
||||
low, chart,"CoSignature",1050,"","No Override Allowed" };
|
||||
|
||||
/* This block executes only when this MLM is called by the editor */
|
||||
if called_by_editor
|
||||
then
|
||||
client_guid:= read last{ClientInfo: GUID};
|
||||
EvokingObject := read last {ClientDocument : THIS
|
||||
WHERE ( DocumentName = "Physician Progress Note"
|
||||
or DocumentName = "Consult eNote"
|
||||
or DocumentName = "History and Physical"
|
||||
or DocumentName = "Discharge Summary eNote"
|
||||
Or DocumentName = "Physician Progress Note - CCM"
|
||||
Or DocumentName = "Physician Progress Note by System-Enhanced"
|
||||
Or DocumentName = "Physician Progress Note- Cardiology"
|
||||
Or DocumentName = "Physician Progress Note- Rehab"
|
||||
Or DocumentName = "Post Procedure Note- Brief"
|
||||
Or DocumentName ="Hospitalist Intervention Note"
|
||||
or DocumentName = "IntraOp Nursing Note"
|
||||
) AND ClientGUID = client_guid AND entrytype = 4};
|
||||
|
||||
endif;
|
||||
|
||||
ToBeSigned_Flag:= read last{ClientDocument: ToBeSigned referencing EvokingObject};
|
||||
|
||||
/* Get the received document{{{SINGLE-QUOTE}}}s name, clientGUID and clientVisitGUID from the evoking or calling object */
|
||||
|
||||
(client_visit_guid,
|
||||
client_guid,
|
||||
Cur_Doc_ToBeSigned,
|
||||
Cur_Doc_AuthoredDateTime) := read Last
|
||||
{ClientDocument : ClientVisitGUID, ClientGUID,ToBeSigned, AuthoredDtm REFERENCING EvokingObject };
|
||||
|
||||
//Get the user name from the object layer
|
||||
(User_GUID, user_name, occupation_code, orderrole_type) := read last { UserInfo: GUID, DisplayName, OccupationCode, OrderRoleType };
|
||||
|
||||
/*
|
||||
isAttending := READ last {"select count(*) from CV3CareProviderVisitRole " ||
|
||||
" where ProviderGUID = " || SQL(User_GUID) ||
|
||||
" and RoleTypeGUID in (select GUID from CV3CareProviderRoleType where TypeCode = {{{SINGLE-QUOTE}}}Physician{{{SINGLE-QUOTE}}} and RoleCode = {{{SINGLE-QUOTE}}}Attending{{{SINGLE-QUOTE}}})"
|
||||
} ;
|
||||
*/
|
||||
|
||||
OrderRole_List := ("CRNP", "PA", "PA-C" , "RN" );
|
||||
//, "Nurse Aid", "Nurse Manager", "Nursing technician", "Physician Therapy", "Physician Assistant", "Medical Assistant", "Medical Student") ;
|
||||
|
||||
|
||||
IF (occupation_code IN OrderRole_List) AND ToBeSigned_Flag = False THEN
|
||||
ReqCoSignature := TRUE;
|
||||
ELSE
|
||||
ReqCoSignature := FALSE;
|
||||
ENDIF;
|
||||
|
||||
;;
|
||||
evoke: Document_Enter ; //or Document_Modify;
|
||||
|
||||
;;
|
||||
LOGIC:
|
||||
|
||||
// IF ReqCoSignature OR ToBeSigned_Flag = False THEN
|
||||
IF ReqCoSignature = True THEN
|
||||
msg := "\n\n\n {{+B}}{{+R}} A physician must be selected to save this document: {{-B}}{{-R}}"
|
||||
|| " \n\n INSTRUCTIONS: Please click the Document Info tab and select your physician. " ;
|
||||
// || " \n\n Please click the Document Info tab and select your physician. " ;
|
||||
//|| "\n" ||
|
||||
//"isAttending: " || isAttending || "\n" ||
|
||||
//"User_GUID: " || User_GUID ;
|
||||
//|| "ToBeSigned_Flag: "|| (ToBeSigned_Flag as string) || "orderrole_type: " || orderrole_type ;
|
||||
|
||||
|
||||
conclude TRUE;
|
||||
ELSE
|
||||
conclude FALSE;
|
||||
ENDIF;
|
||||
|
||||
|
||||
;;
|
||||
|
||||
action:
|
||||
/*---------------------------------------------------*/
|
||||
/* Send messsage to user - cannot enter note as is */
|
||||
/*---------------------------------------------------*/
|
||||
|
||||
//IF ReqCoSignature OR ToBeSigned_Flag = False THEN
|
||||
IF ReqCoSignature = True THEN
|
||||
write "\n"
|
||||
|| msg
|
||||
|| "\n\n" at alert_destination;
|
||||
ENDIF;
|
||||
|
||||
;;
|
||||
end:
|
||||
@@ -0,0 +1,203 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CREATE_ADMISSION_ORDER_CONFIRMATION;;
|
||||
mlmname: SCH_CREATE_ADMISSION_ORDER_CONFIRMATION ;;
|
||||
arden: version 2.5;;
|
||||
version: 16.3;;
|
||||
institution: SCH ;;
|
||||
author: Juliet M. Law ;;
|
||||
specialist: Janet Nordin;;
|
||||
date: 2019-01-22;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Creates {{{SINGLE-QUOTE}}}Admission Order Confirmation{{{SINGLE-QUOTE}}} order when {{{SINGLE-QUOTE}}}Admit to Inpatient{{{SINGLE-QUOTE}}} or {{{SINGLE-QUOTE}}}Place in Observation{{{SINGLE-QUOTE}}} order is entered
|
||||
|
||||
;;
|
||||
explanation: The Admission Order Confirmation order will be created by this MLM upon submittal of the order worksheet
|
||||
|
||||
Change History:
|
||||
2019.01.22 JML CSR 37770 - 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}}};
|
||||
include standard_libs;
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
|
||||
local_session := cds_session.local; // for local_session.SessionRequestBed
|
||||
|
||||
log_execution_info := false;
|
||||
stopProcessing := false;
|
||||
|
||||
|
||||
GeneralOrder_dest := destination { ObjectsPlus } with [
|
||||
alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Order Object",
|
||||
rule_number := 2010 ];
|
||||
|
||||
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 ];
|
||||
|
||||
Order_Submit := event {OrderWorksheetSubmit User ClientVisit } ; //Order : WHERE Name Matches pattern "Place in Observation%" } ;//Order: where Name in ("Place in Observation")};
|
||||
|
||||
(OrdersOnWorksheet,
|
||||
WSOrderGUID) := read { UNSUBMITTED ORDER : Name, GUID WHERE Name IN ( "Place in Observation", "Admit to Inpatient" ) };
|
||||
|
||||
if ( ( "Place in Observation" IN OrdersOnWorksheet ) OR ( "Admit to Inpatient" IN OrdersOnWorksheet ) ) then
|
||||
|
||||
//Get CareProvider object of user entering the order
|
||||
userIDType := "Edstan Number (physician)";
|
||||
( CareProvider_obj ) := read last{ UserInfo : CareProvider };
|
||||
(CareProviderID_Obj ) := read last { CareProvider : CareProviderID REFERENCING CareProvider_obj };
|
||||
CareProviderEdstan := read last { CareProviderID : IDCode REFERENCING CareProviderID_Obj WHERE ProviderIDTypeCode = userIDType };
|
||||
|
||||
//Retrieve Edstan of Attending Physician specified when entering Admission Order
|
||||
AttendingPhysician := local_session.SessionAdmissionOrderAttendingPhysician;
|
||||
AttendingEdstan := SUBSTRING ( ( LENGTH OF AttendingPhysician ) - ( FIND "(" IN STRING AttendingPhysician ) ) CHARACTERS STARTING AT ( FIND "(" IN STRING AttendingPhysician ) FROM AttendingPhysician;
|
||||
AttendingEdstan := Call ( ( AttendingEdstan as string ) as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace WITH "(" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, " " as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
|
||||
|
||||
stopProcessing := ( ( ( TRIM CareProviderEdstan ) as string ) = ( ( TRIM AttendingEdstan ) as string ) );
|
||||
|
||||
if ( stopProcessing = FALSE ) then
|
||||
|
||||
LocationGUID := EvokingObject.CurrentLocationGUID;
|
||||
ClientVisitGUID := EvokingObject.GUID;
|
||||
ClientGUID := EvokingObject.ClientGUID;
|
||||
|
||||
try
|
||||
|
||||
ClientVisit_OBJ := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( ClientVisitGUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
|
||||
WSSessionType := "Standard";
|
||||
WSSessionReason := "";
|
||||
WSRequestedBySource := "Protocol Order";
|
||||
|
||||
WSRequestedCareProvider_OBJ := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByID with ( UserIDType, ( ( TRIM AttendingEdstan ) as STRING ) );
|
||||
|
||||
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 ( ClientVisit_OBJ IS NOT NULL ) then
|
||||
void := call ClientVisit_OBJ.Dispose;
|
||||
ClientVisit_OBJ := null;
|
||||
endif;
|
||||
|
||||
if ( WSRequestedCareProvider_OBJ IS NOT NULL ) then
|
||||
void:= call WSRequestedCareProvider_OBJ.Dispose;
|
||||
WSRequestedCareProvider_OBJ := null;
|
||||
endif;
|
||||
|
||||
if ( WSLocation_OBJ IS NOT NULL ) then
|
||||
void := call WSLocation_OBJ.Dispose;
|
||||
WSLocation_OBJ := null;
|
||||
endif;
|
||||
|
||||
endcatch;
|
||||
|
||||
try
|
||||
|
||||
CatalogItemName := "Admission Order Confirmation";
|
||||
OrderCreationReason := "Order Created from MLM";
|
||||
|
||||
GeneralOrderItem_OBJ := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with CatalogItemName;
|
||||
GeneralOrder_OBJ := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder with
|
||||
ClientVisit_OBJ,
|
||||
GeneralOrderItem_OBJ,
|
||||
OrderCreationReason,
|
||||
WSRequestedCareProvider_OBJ,
|
||||
WSRequestedBySource,
|
||||
WSSessionType,
|
||||
WSSessionReason,
|
||||
WSLocation_OBJ,
|
||||
"Always" AS {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
|
||||
|
||||
//GeneralOrder_OBJ.SpecialInstructions := "\n\n" || local_session.SessionAdmissionOrderConfirmation || "\nAdmit Date/Time: " || AdmitDateTime;
|
||||
dataItemValue := call GeneralOrder_OBJ.{{{SINGLE-QUOTE}}}GetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "Free Text";
|
||||
|
||||
stringValue := dataItemValue || " " || local_session.SessionAdmissionOrderConfirmation || " Admit Date/Time: " || local_session.SessionAdmissionOrderEffectiveDate ;
|
||||
retValue := call GeneralOrder_OBJ.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "Free Text", stringValue;
|
||||
|
||||
local_session.SessionAdmissionOrderConfirmation := "";
|
||||
|
||||
GeneralOrder_dest.ObjectsPlus := GeneralOrder_OBJ;
|
||||
void := call GeneralOrder_OBJ.Save;
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
|
||||
error_occurred := true;
|
||||
error_message := error_message || "{{+R}}New General Order:{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
if ( GeneralOrderItem_OBJ IS NOT NULL ) then
|
||||
void := call GeneralOrderItem_OBJ.Dispose;
|
||||
GeneralOrderItem_OBJ := null;
|
||||
endif;
|
||||
|
||||
if ( GeneralOrder_OBJ IS NOT NULL ) then
|
||||
void := call GeneralOrder_OBJ.Dispose;
|
||||
GeneralOrder_OBJ := null;
|
||||
endif;
|
||||
|
||||
endcatch;
|
||||
|
||||
endif;
|
||||
endif;
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
Order_Submit;
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
if EvokingObject is null
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
if error_occurred then
|
||||
|
||||
write "An error has occurred in the MLM {{+B}}SCH_CREATE_ADMISSION_ORDER_CONFIRMATION{{-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;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
168
MLMStripper/bin/Debug/SCH/SCH_CREATE_AEROCHAMBER.mlm
Normal file
168
MLMStripper/bin/Debug/SCH/SCH_CREATE_AEROCHAMBER.mlm
Normal file
@@ -0,0 +1,168 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CREATE_AEROCHAMBER;;
|
||||
mlmname: SCH_CREATE_AEROCHAMBER;;
|
||||
arden: version 2;;
|
||||
version: 5.00;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Shawn Head;;
|
||||
specialist: Robert Steward;;
|
||||
date: 2016-05-21;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create Aerochamber order when the aerochamber checkbox is selected on an order item that uses one of the 2 forms PRX_IhBnDr orPRX_IhBn
|
||||
;;
|
||||
explanation:
|
||||
06.15.2016 - STH - CSR#: 34074 - created {Go-Live 6/28/2016}
|
||||
;;
|
||||
keywords: Objects+, Aerochamber, Orders
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
/* Set to true if logging is needed.*/
|
||||
log_execution_info:= FALSE;
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
on_order_enter := event {OrderWorksheetSubmit User } ;
|
||||
from_order_name := "";
|
||||
CreateAerochamberOrder := false;
|
||||
UnSub_AeroOrder := read last { UNSUBMITTED Order: Name where name in ("Aerochamber") };
|
||||
if(UnSub_AeroOrder is null) then
|
||||
userguid,user_id :=read last {UserInfo: guid,idcode};
|
||||
AeroOrderNames := read { " select ocmi.name from cv3ordercatalogmasteritem ocmi with (nolock)
|
||||
inner join cv3orderentryform oef with (nolock) on ocmi.EntryFormGUID = oef.GUID
|
||||
where oef.Name in ({{{SINGLE-QUOTE}}}PRX_IhBnDr{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRX_IhBn{{{SINGLE-QUOTE}}})
|
||||
and ocmi.Active = 1
|
||||
and ocmi.ExpiryDate is null " };
|
||||
(ReadUnSub_AeroUD, CP_GUID, OrderName, sessiontype) := read { UNSUBMITTED Order: OrderUserData , careproviderguid , name , InitialSessionTypeCode where name in (AeroOrderNames)};
|
||||
if(count(ReadUnSub_AeroUD) > 0) then
|
||||
(clientGUID, chartGUID, ClientVisitGUID, LocationGUID) := read last { ClientVisit: ClientGUID, ChartGUID, GUID, CurrentLocationGUID };
|
||||
(AeroOrderGUID) := read last { " 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}}}Aerochamber{{{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(AeroOrderGUID is nulL) then
|
||||
for y in (1 seqto(count(ReadUnSub_AeroUD))) do
|
||||
CurOrder_UserDataFields := ReadUnSub_AeroUD[y];
|
||||
(userdatacode, value ) := read last { OrderUserData: UserDataCode, Value REFERENCING CurOrder_UserDataFields where UserDataCode = "PRX_Aerochamber"} ;
|
||||
if(value = "1") then
|
||||
CreateAerochamberOrder := true;
|
||||
from_order_name := OrderName[y];
|
||||
endif;
|
||||
|
||||
enddo;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
if(CreateAerochamberOrder) then
|
||||
try
|
||||
CV_Obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
|
||||
WSSessionType := trim(sessiontype[1]);
|
||||
if(sessiontype[1] = "Hold") then
|
||||
WSSessionReason := "Hold Orders";
|
||||
else
|
||||
WSSessionReason := "";
|
||||
endif;
|
||||
WSRequestedBySource := "";
|
||||
|
||||
|
||||
RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((CP_GUID[1] as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
location_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 ( CV_Obj is NOT NULL ) then
|
||||
void:= call CV_Obj.Dispose;
|
||||
CV_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;
|
||||
|
||||
|
||||
try
|
||||
Catalog_Item_Name := "Aerochamber";
|
||||
order_type := "other";
|
||||
modifier := "";
|
||||
modversion := "";
|
||||
order_Creation_Reason := from_order_name || " ordered with Aerochamber request.";
|
||||
|
||||
|
||||
order_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
|
||||
with Catalog_Item_Name;
|
||||
|
||||
GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
||||
with CV_Obj,
|
||||
order_catalog_item,
|
||||
order_Creation_Reason,
|
||||
RequestedBy_obj,
|
||||
WSRequestedBySource,
|
||||
WSSessionType,
|
||||
WSSessionReason,
|
||||
location_obj,
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
|
||||
|
||||
|
||||
if (Order_catalog_item.Name in ("Aerochamber")) then
|
||||
GeneralOrder_obj.SpecialInstructions := order_Creation_Reason;
|
||||
//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;
|
||||
endif;
|
||||
|
||||
;;
|
||||
evoke: on_order_enter;
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,168 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CREATE_CARDIACMONITOR_FROM_ADMIT;;
|
||||
mlmname: SCH_CREATE_CARDIACMONITOR_FROM_ADMIT;;
|
||||
arden: version 2;;
|
||||
version: 5.00;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Shawn Head;;
|
||||
specialist: Peggy Karish;;
|
||||
date: 2016-05-10;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create cardiac monitor order when the admit to inpatient order has the monitored bed selected
|
||||
;;
|
||||
explanation:
|
||||
05.10.2016 - STH - CSR#: 34074 - created {Go-Live 5/17/2016}
|
||||
;;
|
||||
keywords: Objects+, Care Provider Visit Role, Auto create care provider, auto DC care provider
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
/* Set to true if logging is needed.*/
|
||||
log_execution_info:= FALSE;
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
on_order_enter := event {OrderWorksheetSubmit User } ;
|
||||
from_order_name := "";
|
||||
CreateMonitorOrder := false;
|
||||
UnSub_CardMonOrd := read last { UNSUBMITTED Order: Name where name in ("Monitor: Cardiac") };
|
||||
if(UnSub_CardMonOrd is null) then
|
||||
userguid,user_id :=read last {UserInfo: guid,idcode};
|
||||
(ReadUnSub_AdmitUD, CP_GUID, OrderName, sessiontype) := read { UNSUBMITTED Order: OrderUserData , careproviderguid , name , InitialSessionTypeCode where name in ("Admit to Inpatient","Place in Observation")};
|
||||
if(count(ReadUnSub_AdmitUD) > 0) then
|
||||
(clientGUID, chartGUID, ClientVisitGUID, LocationGUID) := read last { ClientVisit: ClientGUID, ChartGUID, GUID, CurrentLocationGUID };
|
||||
(MonitorOrderGUID) := read last { " 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}}}) " };
|
||||
if(MonitorOrderGUID is nulL) then
|
||||
for y in (1 seqto(count(ReadUnSub_AdmitUD))) do
|
||||
CurOrder_UserDataFields := ReadUnSub_AdmitUD[y];
|
||||
(userdatacode, value ) := read last { OrderUserData: UserDataCode, Value REFERENCING CurOrder_UserDataFields where UserDataCode = "NUR_ADTMonitoredBedCBx"} ;
|
||||
if(value = "1") then
|
||||
CreateMonitorOrder := true;
|
||||
from_order_name := OrderName[y];
|
||||
endif;
|
||||
|
||||
enddo;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
/*
|
||||
if called_by_editor then
|
||||
EvokingObject := read last {Order: THIS
|
||||
WHERE Name in ("Admit to Inpatient","Place in Observation")};
|
||||
endif;
|
||||
*/
|
||||
if(CreateMonitorOrder) then
|
||||
try
|
||||
CV_Obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
|
||||
WSSessionType := trim(sessiontype[1]);
|
||||
if(sessiontype[1] = "Hold") then
|
||||
WSSessionReason := "Hold Orders";
|
||||
else
|
||||
WSSessionReason := "";
|
||||
endif;
|
||||
WSRequestedBySource := "";
|
||||
|
||||
|
||||
RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((CP_GUID[1] as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
location_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 ( CV_Obj is NOT NULL ) then
|
||||
void:= call CV_Obj.Dispose;
|
||||
CV_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;
|
||||
|
||||
|
||||
try
|
||||
Catalog_Item_Name := "Monitor: Cardiac";
|
||||
order_type := "other";
|
||||
modifier := "";
|
||||
modversion := "";
|
||||
order_Creation_Reason := from_order_name || " ordered with Monitor Bed request.";
|
||||
|
||||
|
||||
order_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
|
||||
with Catalog_Item_Name;
|
||||
|
||||
GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
||||
with CV_Obj,
|
||||
order_catalog_item,
|
||||
order_Creation_Reason,
|
||||
RequestedBy_obj,
|
||||
WSRequestedBySource,
|
||||
WSSessionType,
|
||||
WSSessionReason,
|
||||
location_obj,
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
|
||||
|
||||
|
||||
if (Order_catalog_item.Name in ("Monitor: Cardiac")) then
|
||||
GeneralOrder_obj.SpecialInstructions := order_Creation_Reason;
|
||||
//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;
|
||||
endif;
|
||||
|
||||
;;
|
||||
evoke: on_order_enter;
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
194
MLMStripper/bin/Debug/SCH/SCH_CREATE_CONSULT_FROM_ORDER.mlm
Normal file
194
MLMStripper/bin/Debug/SCH/SCH_CREATE_CONSULT_FROM_ORDER.mlm
Normal file
@@ -0,0 +1,194 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CREATE_CONSULT_FROM_ORDER;;
|
||||
mlmname: SCH_CREATE_CONSULT_FROM_ORDER;;
|
||||
arden: version 2;;
|
||||
version: 5.00;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Eclipsys;;
|
||||
specialist: ;;
|
||||
date: 2010-03-12;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create a consult careprovider when entered (either on hold or active)
|
||||
Discontinue / delete careprovider when order DC{{{SINGLE-QUOTE}}}d
|
||||
;;
|
||||
explanation: Med Rec introduction of orders as hold session
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
06.19.2017 DW CSR# 35742 MLM - Introduce Palliative Care Consult form orders
|
||||
|
||||
|
||||
;;
|
||||
keywords: Objects+, Care Provider Visit Role, Auto create care provider, auto DC care provider
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
/* Set to true if logging is needed.*/
|
||||
log_execution_info:= FALSE;
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
/* link_value := "CrClCalc.exe";
|
||||
shell_to_win := INTERFACE
|
||||
{long shell32:ShellExecuteA(long, char*, char*, char*, char*, char*)};
|
||||
x := call shell_to_win with 0, "open",
|
||||
link_value,NULL, NULL, "SW_SHOWNORMAL";
|
||||
*/
|
||||
WhatAmIDoing := "";
|
||||
|
||||
on_order_enter:= event {OrderEnter User Order:
|
||||
WHERE Name in ("Physician Consult", "Anesthesia Consult","Rehabilitation Consult","Palliative Care Consult")};
|
||||
|
||||
on_order_DC := event {OrderDiscontinue User Order:
|
||||
WHERE Name in ("Physician Consult", "Anesthesia Consult","Rehabilitation Consult","Palliative Care Consult")};
|
||||
|
||||
if called_by_editor then
|
||||
EvokingObject := read last {Order: THIS
|
||||
WHERE Name in ("Physician Consult", "Anesthesia Consult","Rehabilitation Consult","Palliative Care Consult")};
|
||||
endif;
|
||||
|
||||
NewConsult_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "CareProviderVisitRole Object",
|
||||
rule_number := 2010 ];
|
||||
|
||||
Discontinue_Consult_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object deleted by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "CareProviderVisitRole Object",
|
||||
rule_number := 2040 ];
|
||||
|
||||
dose_exceeded_alert := destination { Alert: Warning, "Daily Dosage Exceeded", high,
|
||||
chart, "Dosage Administration Alert", 5010,"DoNotSend" };
|
||||
|
||||
client_GUID := read last { ClientInfo: GUID };
|
||||
userguid,user_id :=read last {UserInfo: guid,idcode};
|
||||
|
||||
(order_name,
|
||||
order_summaryline,client_visit_guid
|
||||
) := read last
|
||||
{Order: Name, summaryline,clientvisitguid REFERENCING EvokingObject };
|
||||
|
||||
substring_mlm := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_BETWEEN{{{SINGLE-QUOTE}}};
|
||||
link_value:=CALL substring_mlm with (order_summaryline,"(",")");
|
||||
|
||||
if EvokingEvent = on_order_DC
|
||||
then
|
||||
|
||||
removeprovvisitrole_guid :=
|
||||
read last { " select cpvr.guid from cv3careproviderid as cpi with (nolock) "
|
||||
||" join cv3careprovidervisitrole as cpvr with (nolock) "
|
||||
||" on cpvr.clientguid = " || sql(client_GUID)
|
||||
||" and cpvr.clientvisitguid = " ||sql(client_visit_guid)
|
||||
||" and cpvr.providerguid = cpi.providerguid "
|
||||
||" and cpvr.active = 1 "
|
||||
||" and cpvr.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|
||||
||" and cpvr.fromdtm <= getdate() "
|
||||
||" and (cpvr.todtm is null or cpvr.todtm >= getdate()) "
|
||||
||" and cpvr.rolecode = {{{SINGLE-QUOTE}}}Consulting{{{SINGLE-QUOTE}}} "
|
||||
||" where cpi.IDCode = " ||sql(link_value)
|
||||
||" and cpi.ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}} "
|
||||
};
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
evoke: on_order_enter
|
||||
or
|
||||
on_order_DC ;
|
||||
// on_order_modify;
|
||||
// visit_enter;
|
||||
;;
|
||||
logic:
|
||||
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((Client_Visit_Guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
|
||||
if EvokingEvent = on_order_enter
|
||||
then
|
||||
try
|
||||
|
||||
|
||||
careprovider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById
|
||||
with ("Edstan Number (physician)",link_value);
|
||||
|
||||
careprovidername := careprovider_obj.PrimaryID;
|
||||
|
||||
New_CareProvVisitRole_obj := call {{{SINGLE-QUOTE}}}CareProviderVisitRole{{{SINGLE-QUOTE}}}.CreateCareProviderVisitRole
|
||||
with
|
||||
(client_visit_obj, //ClientVisit
|
||||
careprovider_obj, // provider
|
||||
"Consulting" // Consulting type
|
||||
);
|
||||
|
||||
NewConsult_dest.ObjectsPlus := New_CareProvVisitRole_obj ;
|
||||
endtry;
|
||||
catch exception ex
|
||||
error_occurred := true;
|
||||
|
||||
if ( New_CareProvVisitRole_obj is NOT NULL ) then
|
||||
void:= call New_CareProvVisitRole_obj.Dispose;
|
||||
New_CareProvVisitRole_obj := null;
|
||||
endif;
|
||||
|
||||
NewConsult_dest:= null;
|
||||
endcatch;
|
||||
|
||||
elseif EvokingEvent = on_order_DC
|
||||
then
|
||||
|
||||
try
|
||||
if exists removeprovvisitrole_guid
|
||||
then
|
||||
Discontinue_Consult_Obj := call {{{SINGLE-QUOTE}}}CareProviderVisitRole{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ( (removeprovvisitrole_guid as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
empty := call Discontinue_Consult_Obj.Discontinue;
|
||||
Discontinue_Consult_dest.ObjectsPlus := Discontinue_Consult_Obj;
|
||||
endif;
|
||||
endtry;
|
||||
catch exception ex
|
||||
error_occurred := true;
|
||||
error_message := error_message || "{{+R}}Discontinue HI {{-R}} \n\n";
|
||||
if ex.InnerException is not null net_object then
|
||||
error_message := error_message || "Inner Exception " || ex.InnerException.Message || "\n\n";
|
||||
endif;
|
||||
|
||||
if (Discontinue_Consult_Obj is not null) then
|
||||
void := call Discontinue_Consult_Obj.Dispose;
|
||||
Discontinue_Consult_Obj := null;
|
||||
endif;
|
||||
Discontinue_Consult_dest := null;
|
||||
endcatch;
|
||||
|
||||
endif;
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
if exists NewConsult_dest then
|
||||
write TRUE at NewConsult_dest ;
|
||||
endif;
|
||||
|
||||
if exists Discontinue_Consult_dest then
|
||||
write TRUE at Discontinue_Consult_dest ;
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,520 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CREATE_DRESSING_CHANGE_FROM_LINE_INSERTION_OBS;;
|
||||
mlmname: SCH_CREATE_DRESSING_CHANGE_FROM_LINE_INSERTION_OBS;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: Allscripts;;
|
||||
author: SHAMI SHARMA ;;
|
||||
specialist: ;;
|
||||
date: 2017-12-06;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Generate a Dressing Change order following PICC/Midline Procedure Note.
|
||||
;;
|
||||
explanation: When charting the location of picc Insertion and MidLine insertion then
|
||||
a dressing change order must be created to ensure the infusion team is scheduled for the dressing change.
|
||||
The following Structure Note are affected by this:
|
||||
* PICC/Midline Procedure Note
|
||||
|
||||
The following observations and values are affected by this,
|
||||
generating the following orders:
|
||||
* PICC Insertion and/or Midline Insertion
|
||||
- PICC Line Dressing Change
|
||||
-SCH_PICC Location and SCH_Insert date
|
||||
- Midline Dressing Change
|
||||
- SCH_Midline location and SCH_Midline insert
|
||||
|
||||
|
||||
;;
|
||||
keywords: Structure Note
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
// .Net assemblies need to be loaded for ObjectsPlus
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
|
||||
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
|
||||
bln_createOrder := 0;
|
||||
|
||||
log_execution_info := false;
|
||||
|
||||
|
||||
// Called MLM declaration section
|
||||
// Utility function to parse strings
|
||||
str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
||||
set_cds_vars := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_DEFINITION_MLM{{{SINGLE-QUOTE}}};
|
||||
read_obs_value := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_OBS_VALUE_MLM{{{SINGLE-QUOTE}}};
|
||||
// Default values when creating orders
|
||||
SessionType := "Standard";
|
||||
SessionReason := "";
|
||||
RequestingSource := "";
|
||||
user_IDType := "Primary";
|
||||
order_creation_reason := "From MLM";
|
||||
|
||||
orderPlacedMessage := "";
|
||||
|
||||
orderItemName := NULL;
|
||||
canPlaceOrder := false;
|
||||
chartedDateTime := NULL;
|
||||
triggerValueExists := false;
|
||||
pedsExists := false;
|
||||
cancelProcessing := false;
|
||||
|
||||
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 ];
|
||||
|
||||
Document_Enter := event {ClientDocumentEnter ANY ClientDocument: where DocumentName = "PICC/Midline Procedure Note"};
|
||||
Document_Modify := event {ClientDocumentModify ANY ClientDocument: where DocumentName = "PICC/Midline Procedure Note"};
|
||||
|
||||
|
||||
( ClientDocument_GUID, ClientVisit_GUID, client_guid, Chart_GUID ,USER_GUID) := Read Last { ClientDocument: GUID, ClientVisitGUID, ClientGUID , ChartGUID, USERGUID REFERENCING EvokingObject }; /* Get the ClientObservation object pointer */
|
||||
|
||||
(Client_Observation_Document_Obj, GUID,Document_Name):= read last { ClientDocument: ClientObservationDocument, GUID,DocumentName REFERENCING EvokingObject };
|
||||
|
||||
(Client_Observation_Obj) := read last{ ClientObservationDocument: ClientObservation REFERENCING Client_Observation_Document_Obj };
|
||||
|
||||
//********************** End of USER CONFIGURED CONSTANTS section *********************************
|
||||
(PICCobs_value, PICCobs_Name,PICC_Created) := read last { ClientObservationDocument: ClientObservation, Name ,CREATEDWHEN
|
||||
REFERENCING Client_Observation_Document_Obj
|
||||
Where Name in ("SCH_Insert date" ) };
|
||||
|
||||
(Midlineobs_value, Midlineobs_Name,ML_Created) := read last{ ClientObservationDocument: ClientObservation, Name ,CREATEDWHEN
|
||||
REFERENCING Client_Observation_Document_Obj
|
||||
Where Name in ("SCH_Midline insert" ) };
|
||||
|
||||
|
||||
(PICCloc_value,pcobsvalue, PICCloc_Name,Picclocdate) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
|
||||
REFERENCING Client_Observation_Document_Obj
|
||||
Where Name in ("SCH_PICC Location" ) };
|
||||
|
||||
|
||||
(Midlineloc_value,mlobvalue, Midlineloc_Name,mllocdate) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
|
||||
REFERENCING Client_Observation_Document_Obj
|
||||
Where Name in ("SCH_Midline location" ) };
|
||||
(PICC_obsDate) := PICCobs_value.ValueText;
|
||||
//(PICCFisrtEnetrTime):=PICCobs_value.RecordedDtm;
|
||||
(PICCEnterrTime):= PICC_Created ;
|
||||
//(PiccDisplayName) := PICCobs_value.Name;
|
||||
//(PiccObsName) := PICCobs_Name;
|
||||
|
||||
(PICCloc_ValueText) := pcobsvalue.Value;
|
||||
//(PICClocFisrtEnetrTime):= PICCloc_value.RecordedDtm;
|
||||
(PICClocEnterrTime):= Picclocdate;
|
||||
//(PicclocDisplayName) := PICCloc_value.Name;
|
||||
//(PicclocObsName) := PICCloc_Name;
|
||||
|
||||
(ML_obsDate) := Midlineobs_value.ValueText;
|
||||
//(MLFisrtEnetrTime):=Midlineobs_value.RecordedDtm;
|
||||
(MLEnterrTime):=ML_Created;
|
||||
//(MLDisplayName) := Midlineobs_value.Name;
|
||||
//(MLObsName) := Midlineobs_Name;
|
||||
|
||||
(ML_locValueText):= mlobvalue.Value;
|
||||
//(MLlocFisrtEnetrTime):= Midlineloc_value.RecordedDtm;
|
||||
(MLlocEnterrTime):= mllocdate;
|
||||
//(MLlocDisplayName) := Midlineloc_value.Name;
|
||||
//(MLlocObsName) := Midlineloc_Name;
|
||||
|
||||
IF(EXISTS PICC_obsDate) OR ( EXISTS PICCloc_ValueText) THEN
|
||||
IF( EXISTS PICC_obsDate ) THEN
|
||||
chartedDateTime := PICC_Created;
|
||||
ENDIF;
|
||||
IF(EXISTS PICCloc_ValueText ) THEN
|
||||
chartedDateTime := Picclocdate;
|
||||
ENDIF;
|
||||
|
||||
greaterChartDateTime := chartedDateTime + 1 hour;
|
||||
lessChartDateTime := chartedDateTime - 1 hour;
|
||||
requestYear := year of chartedDateTime as string;
|
||||
if ((month of chartedDateTime >= 1) and (month of chartedDatetime <= 9)) then
|
||||
requestMonth := ("0" || month of chartedDateTime) as string;
|
||||
else
|
||||
requestMonth := month of chartedDateTime as string;
|
||||
endif;
|
||||
if ((day of chartedDateTime >= 1) and (day of chartedDateTime <= 9)) then
|
||||
requestDay := ("0" || day of chartedDateTime) as string;
|
||||
else
|
||||
requestDay := day of chartedDateTime as string;
|
||||
endif;
|
||||
requestDateCheck := (requestMonth || "-" || requestDay || "-" || requestYear) as string;
|
||||
orderRequestDate := (requestYear || "-" || requestMonth || "-" || requestDay) as string;
|
||||
|
||||
//Locate Order
|
||||
orderItemName := "PICC Line Dressing Change";
|
||||
orderSpecInstr := ();
|
||||
existingOrderName := ();
|
||||
(existingOrderName, orderSpecInstr) := read {"SELECT o.Name, oai.SpecialInstructions, o.TouchedWhen"
|
||||
|| " FROM CV3Order as o with (nolock) JOIN"
|
||||
|| " (CV3OrderCatalogMasterItem AS ocmi with (nolock)"
|
||||
|| " JOIN CV3OrderReviewCategory AS orc with (nolock)"
|
||||
|| " ON ocmi.OrderReviewCategoryGUID = orc.GUID)"
|
||||
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
|
||||
|| " JOIN CV3OrderAddnlInfo as oai with (nolock)"
|
||||
|| " ON o.GUID = oai.GUID"
|
||||
|| " WHERE o.ClientGUID = " || client_guid
|
||||
|| " AND o.ClientVisitGUID = " || ClientVisit_GUID
|
||||
|| " AND o.ChartGUID = " || chart_guid
|
||||
|| " AND ("
|
||||
|| " (o.Name = {{{SINGLE-QUOTE}}}" || orderItemName || "{{{SINGLE-QUOTE}}})"
|
||||
|| " )"
|
||||
|| " AND"
|
||||
|| " ((o.OrderStatusLevelNum > 15"
|
||||
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|
||||
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
|
||||
|| " AND ((o.CreatedWhen >= {{{SINGLE-QUOTE}}}" || lessChartDateTime || "{{{SINGLE-QUOTE}}}"
|
||||
|| " and o.CreatedWhen < {{{SINGLE-QUOTE}}}" || greaterChartDateTime || "{{{SINGLE-QUOTE}}})"
|
||||
|| " OR o.RequestedDate = {{{SINGLE-QUOTE}}}" || orderRequestDate || "{{{SINGLE-QUOTE}}}"
|
||||
|| " OR oai.SpecialInstructions LIKE {{{SINGLE-QUOTE}}}%" || PICC_obsDate || "%{{{SINGLE-QUOTE}}})"
|
||||
, primaryTime = touchedWhen};
|
||||
if ((count existingOrderName) = 0) then
|
||||
canPlaceOrder := true;
|
||||
ENDIF;
|
||||
if (canPlaceOrder) then
|
||||
specialInstructions := "";
|
||||
( PICC_len1,PICC_Len2 ) := read last { ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
|
||||
REFERENCING Client_Observation_Document_Obj
|
||||
Where Name in ("SCH_PICC Len ins" ) };
|
||||
|
||||
|
||||
( PICC_Ext1,PICC_Ext2 ) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
|
||||
REFERENCING Client_Observation_Document_Obj
|
||||
Where Name in ("SCH_PICC Ext Len" ) };
|
||||
|
||||
|
||||
( PICC_Size1,Picc_Size2 ) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
|
||||
REFERENCING Client_Observation_Document_Obj
|
||||
Where Name in ("SCH_Size" ) };
|
||||
(insertLength1) := PICC_len1.ValueText;
|
||||
(externalLength1) := PICC_Ext1.ValueText;
|
||||
(piccDevice1):= Picc_Size2.Value;
|
||||
|
||||
|
||||
|
||||
If(EXISTS PICC_obsDate) THEN
|
||||
PICCObsDt := "insertion date " || PICC_obsDate || "; " ;
|
||||
ELSE
|
||||
PICCObsDt := "";
|
||||
ENDIF;
|
||||
|
||||
If(EXISTS PICCloc_ValueText) THEN
|
||||
PICCloc_ValueText := PICCloc_ValueText || "; " ;
|
||||
ELSE
|
||||
PICCloc_ValueText:= "";
|
||||
ENDIF;
|
||||
|
||||
If(EXISTS piccDevice1 ) THEN
|
||||
piccDevice1 := piccDevice1 || "; " ;
|
||||
ELSE
|
||||
piccDevice1 := "";
|
||||
ENDIF;
|
||||
|
||||
If(EXISTS insertLength1 ) THEN
|
||||
insertLength := "Insert Length " || insertLength1 || "; " ;
|
||||
ELSE
|
||||
insertLength :="";
|
||||
ENDIF;
|
||||
|
||||
If(EXISTS externalLength1) THEN
|
||||
externalLength := "External Length " || externalLength1;
|
||||
ELSE
|
||||
externalLength :="";
|
||||
ENDIF;
|
||||
|
||||
specialInstructions := "PICC: " || PICCObsDt || "" || PICCloc_ValueText || "" || piccDevice1
|
||||
|| "" || insertLength || "" || externalLength;
|
||||
|
||||
// Create a GENERAL order from a catalog item
|
||||
try
|
||||
|
||||
// ClientVisit object
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((ClientVisit_GUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
// GENERAL catalog item object
|
||||
general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
|
||||
with orderItemName;
|
||||
|
||||
// CareProvider Object
|
||||
requesting_care_provider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((user_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
// Location Object
|
||||
location_guid := read last {"SELECT CurrentLocationGuid FROM CV3ClientVisit "
|
||||
|| " WHERE ClientGuid = " || client_guid};
|
||||
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
// Create GENERAL order
|
||||
GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
||||
with client_visit_obj,
|
||||
general_catalog_item,
|
||||
order_creation_reason,
|
||||
requesting_care_provider_obj,
|
||||
RequestingSource,
|
||||
SessionType,
|
||||
SessionReason,
|
||||
location_obj,
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
|
||||
|
||||
GeneralOrder_Obj.RequestedDate := orderRequestDate;
|
||||
GeneralOrder_Obj.SpecialInstructions := specialInstructions;
|
||||
|
||||
void := call GeneralOrder_Obj.Save;
|
||||
void := call GeneralOrder_Obj.Dispose;
|
||||
|
||||
orderPlacedMessage := orderPlacedMessage || "\n" || orderItemName;
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Error in saving prefilled auto order :{{-R}}\n" ||
|
||||
ex.Message || "\n\n";
|
||||
|
||||
endcatch;
|
||||
|
||||
// Clean UP
|
||||
if (location_obj IS NOT NULL) then
|
||||
void := call location_obj.Dispose;
|
||||
location_obj := NULL;
|
||||
endif;
|
||||
|
||||
if (requesting_care_provider_obj IS NOT NULL) then
|
||||
void := call requesting_care_provider_obj.Dispose;
|
||||
requesting_care_provider_obj := NULL;
|
||||
endif;
|
||||
|
||||
if (general_catalog_item IS NOT NULL) then
|
||||
void := call general_catalog_item.Dispose;
|
||||
general_catalog_item := NULL;
|
||||
endif;
|
||||
|
||||
if (client_visit_obj IS NOT NULL) then
|
||||
void := call client_visit_obj.Dispose;
|
||||
client_visit_obj := NULL;
|
||||
endif;
|
||||
endif; //canPlaceOrder = True
|
||||
|
||||
endif; //canPlaceOrder = True
|
||||
|
||||
IF(EXISTS ML_obsDate) OR ( EXISTS ML_locValueText) THEN
|
||||
IF( EXISTS ML_obsDate ) THEN
|
||||
chartedDateTime := MLEnterrTime;
|
||||
ENDIF;
|
||||
IF(EXISTS ML_locValueText ) THEN
|
||||
chartedDateTime := MLlocEnterrTime;
|
||||
ENDIF;
|
||||
|
||||
greaterChartDateTime := chartedDateTime + 1 hour;
|
||||
lessChartDateTime := chartedDateTime - 1 hour;
|
||||
requestYear := year of chartedDateTime as string;
|
||||
if ((month of chartedDateTime >= 1) and (month of chartedDatetime <= 9)) then
|
||||
requestMonth := ("0" || month of chartedDateTime) as string;
|
||||
else
|
||||
requestMonth := month of chartedDateTime as string;
|
||||
endif;
|
||||
if ((day of chartedDateTime >= 1) and (day of chartedDateTime <= 9)) then
|
||||
requestDay := ("0" || day of chartedDateTime) as string;
|
||||
else
|
||||
requestDay := day of chartedDateTime as string;
|
||||
endif;
|
||||
requestDateCheck := (requestMonth || "-" || requestDay || "-" || requestYear) as string;
|
||||
orderRequestDate := (requestYear || "-" || requestMonth || "-" || requestDay) as string;
|
||||
|
||||
//Locate Order
|
||||
orderItemName := "Midline Dressing Change";
|
||||
orderSpecInstr := ();
|
||||
existingOrderName := ();
|
||||
(existingOrderName, orderSpecInstr) := read {"SELECT o.Name, oai.SpecialInstructions, o.TouchedWhen"
|
||||
|| " FROM CV3Order as o with (nolock) JOIN"
|
||||
|| " (CV3OrderCatalogMasterItem AS ocmi with (nolock)"
|
||||
|| " JOIN CV3OrderReviewCategory AS orc with (nolock)"
|
||||
|| " ON ocmi.OrderReviewCategoryGUID = orc.GUID)"
|
||||
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
|
||||
|| " JOIN CV3OrderAddnlInfo as oai with (nolock)"
|
||||
|| " ON o.GUID = oai.GUID"
|
||||
|| " WHERE o.ClientGUID = " || client_guid
|
||||
|| " AND o.ClientVisitGUID = " || ClientVisit_GUID
|
||||
|| " AND o.ChartGUID = " || chart_guid
|
||||
|| " AND ("
|
||||
|| " (o.Name = {{{SINGLE-QUOTE}}}" || orderItemName || "{{{SINGLE-QUOTE}}})"
|
||||
|| " )"
|
||||
|| " AND"
|
||||
|| " ((o.OrderStatusLevelNum > 15"
|
||||
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|
||||
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
|
||||
|| " AND ((o.CreatedWhen >= {{{SINGLE-QUOTE}}}" || lessChartDateTime || "{{{SINGLE-QUOTE}}}"
|
||||
|| " and o.CreatedWhen < {{{SINGLE-QUOTE}}}" || greaterChartDateTime || "{{{SINGLE-QUOTE}}})"
|
||||
|| " OR o.RequestedDate = {{{SINGLE-QUOTE}}}" || orderRequestDate || "{{{SINGLE-QUOTE}}}"
|
||||
|| " OR oai.SpecialInstructions LIKE {{{SINGLE-QUOTE}}}%" || ML_obsDate || "%{{{SINGLE-QUOTE}}})"
|
||||
, primaryTime = touchedWhen};
|
||||
if ((count existingOrderName) = 0) then
|
||||
canPlaceOrder := true;
|
||||
ENDIF;
|
||||
if (canPlaceOrder) then
|
||||
specialInstructions := "";
|
||||
( ML_len1,ML_Len2 ) := read last { ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
|
||||
REFERENCING Client_Observation_Document_Obj
|
||||
Where Name in ("SCH_Midline Len ins" ) };
|
||||
|
||||
|
||||
( ML_Ext1,ML_Ext2 ) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
|
||||
REFERENCING Client_Observation_Document_Obj
|
||||
Where Name in ("SCh_Midline Ext len" ) };
|
||||
|
||||
|
||||
( ML_Size1,ML_Size2 ) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
|
||||
REFERENCING Client_Observation_Document_Obj
|
||||
Where Name in ("SCH_Mid line_" ) };
|
||||
|
||||
(MLinsertLength1) := ML_len1.ValueText;
|
||||
(MLexternalLength1) := ML_Ext1.ValueText;
|
||||
(MLpiccDevice1):= ML_Size2.Value;
|
||||
|
||||
|
||||
IF(EXISTS MLexternalLength1)THEN
|
||||
MLexternalLength := "External Length " || MLexternalLength1;
|
||||
ELSE
|
||||
MLexternalLength :="";
|
||||
ENDIF;
|
||||
|
||||
IF(EXISTS MLinsertLength1)THEN
|
||||
MLinsertLength := "Insert Length " || MLinsertLength1 || "; ";
|
||||
ELSE
|
||||
MLinsertLength :="";
|
||||
ENDIF;
|
||||
|
||||
IF(EXISTS ML_obsDate)THEN
|
||||
MLObsdate:= "insertion date " || ML_obsDate || "; ";
|
||||
ELSE
|
||||
MLObsdate:= "";
|
||||
ENDIF;
|
||||
|
||||
IF(EXISTS ML_locValueText)THEN
|
||||
ML_locValueText := ML_locValueText || "; ";
|
||||
ELSE
|
||||
ML_locValueText := "";
|
||||
ENDIF;
|
||||
|
||||
IF(EXISTS MLpiccDevice1)THEN
|
||||
MLpiccDevice1 := MLpiccDevice1 || "; ";
|
||||
ELSE
|
||||
MLpiccDevice1 :="";
|
||||
ENDIF;
|
||||
|
||||
specialInstructions := "MIDLINE: " || MLObsdate || "" || ML_locValueText || "" || MLpiccDevice1
|
||||
|| "" || MLinsertLength || "" || MLexternalLength;
|
||||
|
||||
// Create a GENERAL order from a catalog item
|
||||
try
|
||||
|
||||
// ClientVisit object
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((ClientVisit_GUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
// GENERAL catalog item object
|
||||
general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
|
||||
with orderItemName;
|
||||
|
||||
// CareProvider Object
|
||||
requesting_care_provider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((user_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
// Location Object
|
||||
location_guid := read last {"SELECT CurrentLocationGuid FROM CV3ClientVisit "
|
||||
|| " WHERE ClientGuid = " || client_guid};
|
||||
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
// Create GENERAL order
|
||||
GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
||||
with client_visit_obj,
|
||||
general_catalog_item,
|
||||
order_creation_reason,
|
||||
requesting_care_provider_obj,
|
||||
RequestingSource,
|
||||
SessionType,
|
||||
SessionReason,
|
||||
location_obj,
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
|
||||
|
||||
GeneralOrder_Obj.RequestedDate := orderRequestDate;
|
||||
GeneralOrder_Obj.SpecialInstructions := specialInstructions;
|
||||
|
||||
void := call GeneralOrder_Obj.Save;
|
||||
void := call GeneralOrder_Obj.Dispose;
|
||||
|
||||
orderPlacedMessage := orderPlacedMessage || "\n" || orderItemName;
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Error in saving prefilled auto order :{{-R}}\n" ||
|
||||
ex.Message || "\n\n";
|
||||
|
||||
endcatch;
|
||||
|
||||
// Clean UP
|
||||
if (location_obj IS NOT NULL) then
|
||||
void := call location_obj.Dispose;
|
||||
location_obj := NULL;
|
||||
endif;
|
||||
|
||||
if (requesting_care_provider_obj IS NOT NULL) then
|
||||
void := call requesting_care_provider_obj.Dispose;
|
||||
requesting_care_provider_obj := NULL;
|
||||
endif;
|
||||
|
||||
if (general_catalog_item IS NOT NULL) then
|
||||
void := call general_catalog_item.Dispose;
|
||||
general_catalog_item := NULL;
|
||||
endif;
|
||||
|
||||
if (client_visit_obj IS NOT NULL) then
|
||||
void := call client_visit_obj.Dispose;
|
||||
client_visit_obj := NULL;
|
||||
endif;
|
||||
endif; //canPlaceOrder = True
|
||||
|
||||
endif; //canPlaceOrder = True
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: Document_Enter;Document_Modify;
|
||||
;;
|
||||
logic: conclude true;
|
||||
;;
|
||||
action:
|
||||
if Error_occurred
|
||||
then
|
||||
|
||||
write "An error has occured in the MLM {{+B}}SNCH_CREATE_SOCIAL_WORK_REFERRAL_ORDER{{-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;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
124
MLMStripper/bin/Debug/SCH/SCH_CREATE_ESCORT_ORDER_FROM_ED_CT.mlm
Normal file
124
MLMStripper/bin/Debug/SCH/SCH_CREATE_ESCORT_ORDER_FROM_ED_CT.mlm
Normal file
@@ -0,0 +1,124 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CREATE_ESCORT_ORDER_FROM_ED_CT;;
|
||||
mlmname: SCH_CREATE_ESCORT_ORDER_FROM_ED_CT;;
|
||||
arden: version 2.50;;
|
||||
version: 5.50;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Juliet M Law, Allscripts;;
|
||||
specialist: Peggy Leschak, Allscripts;;
|
||||
date: 2016-02-03;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create a request escort order when an ED Physician enters a CT order that has an Escort class type.
|
||||
|
||||
;;
|
||||
explanation: When an ED physician enters a CT (non-hold) order, this MLM will determine if the order has a ED_Escort Request class type.
|
||||
This MLM will automatically create the Request Escort order and place it on the Order Entry worksheet.
|
||||
|
||||
Change History
|
||||
02.03.2016 JML CSR 33934: Created.
|
||||
04.20.2016 JML Moved to Production.
|
||||
;;
|
||||
keywords: ED, CT, escort
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
/* Set to true if logging is needed.*/
|
||||
log_execution_info:= FALSE;
|
||||
|
||||
ct_order_enter := EVENT { OrderEnter User Order : WHERE Name matches pattern "CT%" AND TypeCode = "Diagnostic" };
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
if ( called_by_editor ) then
|
||||
EvokingObject := read last { Order : THIS WHERE Name matches pattern "CT%" };
|
||||
endif;
|
||||
|
||||
//Assign GUIDs
|
||||
client_guid := EvokingObject.ClientGUID;
|
||||
visit_guid := EvokingObject.ClientVisitGUID;
|
||||
chart_guid := EvokingObject.ChartGUID;
|
||||
|
||||
//Object to create an order to add to Order Entry Worksheet
|
||||
UnsubmittedOrder_obj := OBJECT [order_type,
|
||||
item_name,
|
||||
item_modifier,
|
||||
item_version,
|
||||
coded_time,
|
||||
requested_time_hour,
|
||||
requested_time_min,
|
||||
order_field_name,
|
||||
order_field_value];
|
||||
|
||||
//MLM call to create order to add to Order Entry Worksheet
|
||||
create_escort_order := MLM {{{SINGLE-QUOTE}}}SCH_Func_Create_Unsubmitted_Order{{{SINGLE-QUOTE}}};
|
||||
|
||||
//Retrieve user occupation
|
||||
( orderRoleType, user_guid ) := READ LAST { UserInfo : OrderRoleType, GUID };
|
||||
|
||||
//if ( ( classTypeValue IN ("CT", "yes") ) AND ( orderRoleType IN ("ED Physician", ".none") ) ) then
|
||||
if ( orderRoleType IN ("ED Physician", ".none", "CRNP", "PA", "PA-C" ) ) then
|
||||
//Retrieve order class type
|
||||
( ocmi, orderSessionType, orderSource ) := READ LAST { Order : OrderCatalogMasterItem, InitialSessionTypeCode, SourceCode REFERENCING EvokingObject };
|
||||
( order_classTypeValue ) := READ LAST { OrderCatalogMasterItem : CatalogClassTypeValue REFERENCING ocmi };
|
||||
( classTypeValueCode, classTypeValue ) := READ LAST { CatalogClassTypeValue : Code, Value REFERENCING order_classTypeValue
|
||||
WHERE code = "ED_Escort Request" };
|
||||
if ( ( classTypeValue IN ( "CT", "yes" ) ) AND ( orderSessionType <> "Hold" ) ) then
|
||||
|
||||
//Retrieve client visit information
|
||||
(er_patient) := READ LAST {"SELECT a.ColumnNewValue"
|
||||
|| " FROM CV3Client c WITH (NOLOCK) JOIN CV3ClientVisit cv WITH (NOLOCK)"
|
||||
|| " ON c.GUID = cv.ClientGUID"
|
||||
|| " JOIN SXAEDLOCATIONAUDIT a WITH (NOLOCK)"
|
||||
|| " ON cv.GUID = a.ClientVisitGUID"
|
||||
|| " WHERE c.GUID = " || Sql(client_guid)
|
||||
|| " AND cv.GUID = " || Sql(visit_guid)
|
||||
|| " AND cv.ChartGUID = " || Sql(chart_guid)
|
||||
|| " AND cv.CurrentLocation = {{{SINGLE-QUOTE}}}ER Major{{{SINGLE-QUOTE}}}"
|
||||
|| " AND a.ColumnName = {{{SINGLE-QUOTE}}}location{{{SINGLE-QUOTE}}}"
|
||||
|| " ORDER BY a.TouchedWhen"};
|
||||
|
||||
if ( exists er_patient ) then
|
||||
|
||||
//Check unsubmitted orders for existing escort request (avoid duplicates)
|
||||
existingEscortOrder := READ LAST { UnsubmittedOrders : Name WHERE Name = "Request Escort" };
|
||||
|
||||
if ( NOT ( exists existingEscortOrder ) ) then
|
||||
//Construct Object to pass to Unsubmitted Order Creation MLM
|
||||
edCTOrder := NEW UnsubmittedOrder_obj WITH
|
||||
[order_type := "Diagnostic",
|
||||
item_name := "Request Escort",
|
||||
item_modifier := "",
|
||||
item_version := "",
|
||||
coded_time := "STAT",
|
||||
requested_time_hour := "",
|
||||
requested_time_min := "",
|
||||
order_field_name := ("NUR_Origin","Obj_Plus_EscortDestination"),
|
||||
order_field_value := (er_patient, "CT")];
|
||||
|
||||
return_value := call create_escort_order WITH (visit_guid, user_guid, client_guid, orderSessionType, "", edCTOrder);
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
;;
|
||||
evoke:
|
||||
|
||||
ct_order_enter;
|
||||
|
||||
;;
|
||||
logic:
|
||||
conclude true;
|
||||
;;
|
||||
action:
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
251
MLMStripper/bin/Debug/SCH/SCH_CREATE_GENERAL_ORDER.mlm
Normal file
251
MLMStripper/bin/Debug/SCH/SCH_CREATE_GENERAL_ORDER.mlm
Normal file
@@ -0,0 +1,251 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Create_General_Order ;;
|
||||
mlmname: SCH_Create_General_Order ;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: SCH ;;
|
||||
author: Saurabh patel;;
|
||||
specialist: ;;
|
||||
date: 2012-09-12;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
;;
|
||||
explanation:
|
||||
Change History
|
||||
--------------
|
||||
01.13.2014 JML CSR 31748: Modify to allow Requested Date and Time values to be passed in
|
||||
01.06.2015 DW CSR# 31899 Infusion Center Consult MLM Change
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
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}}};
|
||||
include standard_libs;
|
||||
|
||||
(
|
||||
order_type,
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
Order_catalog_item, // CatalogMasterItem ObjectsPlus object
|
||||
order_Creation_Reason, // string CreateReason
|
||||
WSRequestedBy_obj, // RequestingProvider ObjectsPlus object
|
||||
WSRequestedBySource, // string requestingSource(must be in dict)
|
||||
WSSessionType, // string SessionType
|
||||
WSSessionReason, // string SessionReason
|
||||
WSLocation_obj,
|
||||
RequestedDate, //Requested Date (CSR 31748 change)
|
||||
RequestedTime //Requested Time (CSR 31748 change)
|
||||
|
||||
) := argument;
|
||||
|
||||
|
||||
//break;
|
||||
|
||||
mlm_name := "SCH_Create_General_Order";
|
||||
|
||||
local_session := CDS_SESSION.local;
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
|
||||
GeneralOrder_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Order Object",
|
||||
rule_number := 2010 ];
|
||||
|
||||
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_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true ];
|
||||
|
||||
try
|
||||
|
||||
if Order_type = "Diagnostic" then
|
||||
DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
Order_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
||||
order_Creation_Reason, // Create Reason
|
||||
WSRequestedBy_obj, // RequestedBy ObjectsPlus object
|
||||
WSRequestedBySource, // Requesting Source
|
||||
WSSessionType, // Session type
|
||||
WSSessionReason, // Session reason
|
||||
WSlocation_obj, // Location ReleaseLocGrpID
|
||||
"Never" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
|
||||
|
||||
DiagnosticOrder_Obj.RequestedDate := RequestedDate; //CSR 31748
|
||||
DiagnosticOrder_Obj.RequestedTime := RequestedTime; //CSR 31748
|
||||
|
||||
DiagnosticOrder_dest.ObjectsPlus := DiagnosticOrder_obj;
|
||||
|
||||
elseif Order_type = "other" then
|
||||
// Create the prefilled General order
|
||||
GeneralOrder_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
Order_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
||||
order_Creation_Reason, // Create Reason
|
||||
WSRequestedBy_obj, // RequestedBy ObjectsPlus object
|
||||
WSRequestedBySource, // Requesting Source
|
||||
WSSessionType, // Session type
|
||||
WSSessionReason, // Session reason
|
||||
WSlocation_obj, // Location ReleaseLocGrpID
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
|
||||
|
||||
if (Order_catalog_item.Name = "Catheter: Foley") then
|
||||
val := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
||||
"NUR_Catheter Medical Necessity","Device present on admission, EDand OR" ;
|
||||
GeneralOrder_obj.SpecialInstructions := "Device(s) present on admission, ED, and OR";
|
||||
endif;
|
||||
|
||||
if (Order_catalog_item.Name = "Catheter: Port") then
|
||||
GeneralOrder_obj.SpecialInstructions := "Device(s) present on admission, ED, and OR";
|
||||
endif;
|
||||
|
||||
if (Order_catalog_item.Name = "Catheter: IV") then
|
||||
GeneralOrder_obj.SpecialInstructions := "Device(s) present on admission, ED, and OR";
|
||||
endif;
|
||||
|
||||
if (Order_catalog_item.Name = "Catheter: Central Line") then
|
||||
GeneralOrder_obj.SpecialInstructions := "Device(s) present on admission, ED, and OR";
|
||||
endif;
|
||||
|
||||
if (Order_catalog_item.Name = "Catheter: PICC Line") then
|
||||
GeneralOrder_obj.SpecialInstructions := "Device(s) present on admission, ED, and OR";
|
||||
endif;
|
||||
|
||||
if (Order_catalog_item.Name = "Dietitian Consult") then
|
||||
val1 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
||||
"NUTR_Consult Reasons","New Onset Diabetes" ;
|
||||
endif;
|
||||
|
||||
if (Order_catalog_item.Name = "Infusion Center Consult") then
|
||||
val2 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
||||
"INF_Consult Reason","Device(s) present on admission, ED, OR" ;
|
||||
|
||||
// Changes by Shivprasad Jadhav On 06 Jan 2015
|
||||
|
||||
val9 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
||||
"INF_Reason","Device(s) present on admission, ED, OR" ;
|
||||
Val9.Control_Mandatory := true;
|
||||
|
||||
|
||||
endif;
|
||||
|
||||
if (Order_catalog_item.Name = "Daily Orders:") then
|
||||
|
||||
val3 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
||||
"NUR_DailyOrder","Prealbumin" ;
|
||||
|
||||
val4 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
||||
"NUR_DailySchedule","Every Monday and Thursday" ;
|
||||
|
||||
FromDate := now as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}};
|
||||
val5 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Nullable<DateTime>>{{{SINGLE-QUOTE}}} with
|
||||
"NUR_DateField",FromDate ;
|
||||
|
||||
ToDate := (now + 1 days) as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}};
|
||||
val6 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Nullable<DateTime>>{{{SINGLE-QUOTE}}} with
|
||||
"NUR_ToDate",ToDate ;
|
||||
|
||||
GeneralOrder_obj.SpecialInstructions := "if results are less than 19.";
|
||||
|
||||
endif;
|
||||
|
||||
if (Order_catalog_item.Name = "Pulmonary Health Education Consult") then
|
||||
|
||||
if ( local_session.SessionReadmissionOrder = "Patient uses Tobacco" ) then
|
||||
val7 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
||||
"RESP Pulmonary Health Education","Smoking Cessation" ;
|
||||
elseif ( local_session.SessionReadmissionOrder = "Quit Tobacco Use in the Last 12 months" ) then
|
||||
val8 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
||||
"RESP Pulmonary Health Education","Quit Smoking in Last 12 Months" ;
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
GeneralOrder_dest.ObjectsPlus := GeneralOrder_obj;
|
||||
//VOID := GeneralOrder_obj.Save ;
|
||||
endif;
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := error_message || "{{+R}}New" || order_type || " order:{{-R}}\n" ||
|
||||
ex.Message || "\n\n";
|
||||
|
||||
if ( Order_catalog_item is NOT NULL ) then
|
||||
void:= call Order_catalog_item.Dispose;
|
||||
Order_catalog_item:= null;
|
||||
endif;
|
||||
|
||||
if ( DiagnosticOrder_obj is NOT NULL ) then
|
||||
void:= call DiagnosticOrder_obj.Dispose;
|
||||
DiagnosticOrder_obj:= null;
|
||||
endif;
|
||||
|
||||
if ( GeneralOrder_obj is NOT NULL ) then
|
||||
void:= call GeneralOrder_obj.Dispose;
|
||||
GeneralOrder_obj:= null;
|
||||
endif;
|
||||
|
||||
GeneralOrder_dest := null;
|
||||
DiagnosticOrder_dest := null;
|
||||
|
||||
endcatch;
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
Conclude true;
|
||||
;;
|
||||
action:
|
||||
if Error_occurred
|
||||
then
|
||||
|
||||
write "An error has occured in the MLM {{+B}}SCH_Create_General_Order{{-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;
|
||||
|
||||
if EXISTS GeneralOrder_dest then
|
||||
write true at GeneralOrder_dest;
|
||||
endif;
|
||||
|
||||
if EXISTS DiagnosticOrder_dest then
|
||||
write true at DiagnosticOrder_dest;
|
||||
endif;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,201 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Create_Health_Issue_From_Order_Form;;
|
||||
mlmname: SCH_Create_Health_Issue_From_Order_Form;;
|
||||
arden: version 2;;
|
||||
version: 5.00;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Eclipsys;;
|
||||
specialist: ;;
|
||||
date: 2011-03-23;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create a Health Issue from an Order Form selection.
|
||||
|
||||
;;
|
||||
explanation: Create a Health Issue from an order form
|
||||
|
||||
Change history
|
||||
|
||||
03.23.2011 DW Created
|
||||
07.07.2011 DW Added logic to stop processing early in the MLM when there is no health issue found in the message
|
||||
06.03.2014 DW CSR# 31688 Changes for MU2
|
||||
03.11.2016 DW CSR# 34077 Transitional Care order set (updated the programming for ICD10, as it was unused since before the 10.1.2015 cutover from ICD09)
|
||||
|
||||
;;
|
||||
keywords: Order, Create Health Issue
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
/* Set to true if logging is needed.*/
|
||||
log_execution_info:= FALSE;
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
admit_order_enter_event := EVENT {OrderEnter User Order: WHERE Name in ("Admit to Inpatient","Place in Observation")};
|
||||
|
||||
NewHealthIssue_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Health Issue Object",
|
||||
rule_number := 2010 ];
|
||||
|
||||
|
||||
client_GUID := read last { ClientInfo: GUID };
|
||||
chart_GUID := read last { ClientVisit: chartGUID };
|
||||
Client_Visit_Guid := read last { ClientVisit: GUID };
|
||||
userguid,user_id :=read last {UserInfo: guid,idcode};
|
||||
|
||||
// obtain the location info
|
||||
order, Summary:= read last {Order: Name,Summaryline REFERENCING EvokingObject};
|
||||
|
||||
HealthIssueEntered := Summary matches pattern "%[%" ;
|
||||
|
||||
If HealthIssueEntered = true then
|
||||
|
||||
// Parse the Health Issue selection entered by the user
|
||||
|
||||
|
||||
// Parse out the Name
|
||||
|
||||
substring_mlm := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_BETWEEN{{{SINGLE-QUOTE}}};
|
||||
EnteredNameNumber :=CALL substring_mlm with (Summary,"[","]");
|
||||
|
||||
EndOfName := find "..." in string EnteredNameNumber;
|
||||
EnteredName := SUBSTRING (EndOfName-1) CHARACTERS FROM EnteredNameNumber;
|
||||
|
||||
// Parse out the Number
|
||||
|
||||
EndOfNumber := find "..." in string EnteredNameNumber;
|
||||
DotsandNumber:= SUBSTRING 10 CHARACTERS STARTING AT EndOfNumber from EnteredNameNumber;
|
||||
ICDCode := SUBSTRING 10 CHARACTERS STARTING AT 4 from DotsandNumber;
|
||||
|
||||
Proceed := "Yes";
|
||||
|
||||
HI_Present := read
|
||||
{ " select hi.ICD10Code "
|
||||
|| " from cv3healthissuedeclaration hi with (nolock) "
|
||||
|| " where hi.ICD10Code = {{{SINGLE-QUOTE}}}" || ICDCode || "{{{SINGLE-QUOTE}}} "
|
||||
|| " and hi.clientguid = " || client_GUID || " and hi.ChartGUID = " || chart_GUID || " and hi.ClientVisitGUID = " || Client_Visit_Guid || " "
|
||||
|| " and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} and hi.TypeCode = {{{SINGLE-QUOTE}}}Admit Diag{{{SINGLE-QUOTE}}} "
|
||||
};
|
||||
|
||||
else
|
||||
|
||||
Proceed := "No";
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
evoke: admit_order_enter_event;
|
||||
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
|
||||
If Proceed = "Yes" and not exists HI_Present then
|
||||
|
||||
try
|
||||
//get the .NET version of the Client Visit object. Needed to create new
|
||||
//ObjectsPlus objects
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((Client_Visit_Guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
|
||||
endtry;
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Retrieve client:{{-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 the client object cannot be retrieved, do not attempt
|
||||
// to create any ObjectsPlus objects.
|
||||
conclude true;
|
||||
endcatch;
|
||||
|
||||
try
|
||||
//---------------------------------------------------------
|
||||
// New HealthIssue Example
|
||||
//---------------------------------------------------------
|
||||
|
||||
// Type and Code information for creating a new HealthIssue
|
||||
|
||||
|
||||
issuename := EnteredName;
|
||||
issuecode := ICDCode;
|
||||
|
||||
NewHealthIssueHIType := "Admit Diag";
|
||||
NewHealthIssueHICode := issuecode;
|
||||
NewHealthIssueHIScheme := "ICD10";
|
||||
|
||||
|
||||
Terms := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindIMOTerms with (NewHealthIssueHIScheme,NewHealthIssueHICode);
|
||||
FOR i IN 1 SEQTO (Terms.Count as Number ) DO
|
||||
HI_obj := Terms[i];
|
||||
HI_Name := HI_obj.TermName as string;
|
||||
If HI_Name = issuename then
|
||||
HI_NO := i ;
|
||||
Endif;
|
||||
ENDDO;
|
||||
If HI_NO is Null Then
|
||||
HI_NO :=1 ;
|
||||
Endif;
|
||||
New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with (client_visit_obj, NewHealthIssueHIType, Terms[HI_NO]);
|
||||
|
||||
// Set some properties of the healthIssue
|
||||
|
||||
dd := EXTRACT Day now;
|
||||
mn := EXTRACT Month now;
|
||||
yr := EXTRACT Year now;
|
||||
|
||||
PartialDate_obj := new net_object {{{SINGLE-QUOTE}}}PartialDate{{{SINGLE-QUOTE}}} with (yr as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, mn as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, dd as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}} );
|
||||
New_HealthIssue_obj.OnsetDate := PartialDate_obj;
|
||||
New_HealthIssue_obj.Text := "Created via order set entry " ;
|
||||
New_HealthIssue_obj.Name := issuename;
|
||||
NewHealthIssue_dest.ObjectsPlus := New_HealthIssue_obj;
|
||||
|
||||
|
||||
endtry;
|
||||
catch exception ex
|
||||
error_occurred := true;
|
||||
|
||||
if ( New_HealthIssue_obj is NOT NULL ) then
|
||||
void:= call New_HealthIssue_obj.Dispose;
|
||||
New_HealthIssue_obj:= null;
|
||||
endif;
|
||||
|
||||
NewHealthIssue_dest := null;
|
||||
endcatch;
|
||||
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
|
||||
|
||||
conclude true;
|
||||
|
||||
else
|
||||
|
||||
conclude false;
|
||||
|
||||
endif;
|
||||
|
||||
;;
|
||||
action:
|
||||
if exists NewHealthIssue_dest then
|
||||
write TRUE at NewHealthIssue_dest;
|
||||
endif;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
315
MLMStripper/bin/Debug/SCH/SCH_CREATE_LACTIC_ACID_FROM_RESULT.mlm
Normal file
315
MLMStripper/bin/Debug/SCH/SCH_CREATE_LACTIC_ACID_FROM_RESULT.mlm
Normal file
@@ -0,0 +1,315 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CREATE_LACTIC_ACID_FROM_RESULT;;
|
||||
mlmname: SCH_CREATE_LACTIC_ACID_FROM_RESULT;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: Eclipsys, Test MLM;;
|
||||
author: Dean Miklavic;;
|
||||
specialist: Shawn Head;;
|
||||
date: 2015-11-24;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: This MLM will create a Lactic Acid order when the first Lactic Acid result of the visit has a value greater than 2
|
||||
|
||||
|
||||
;;
|
||||
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.24.2015 STH CSR#: 33871 created (copied from the CPK MLM which is similar) {Go-Live 12/9/2015}
|
||||
01.08.2015 DW CSR#: 33901 Most Wired - add Lactic Acid result to the status board by updating an Enterprise Defined Collumn
|
||||
01.15.2016 STH CSR#: 34007 Updated to ALWAYS create Lactic Acid Venous order, and added new field that will identify that the Order was Repeat per sepsis protocol.
|
||||
02.02.2016 STH CSR#: 34060 New Lactic Acid result Lactate, VBG, POC needs added
|
||||
02.25.2016 STH Ticket#: 2058705 Issue with >20 result value
|
||||
03.20.2017 STH Ticket #: 2520675 Repeat lab orders getting entered on outpatient visit. Added logic to only order on Inpatient, Emergency, and Outpatient in a bed (based on visit type "clinic" and bedlocation like "INFUS-%")
|
||||
;;
|
||||
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 ("Lactate, VBG, POC","Lactate, ABG, POC","LACTATE, ABG POC","Lactic Acid Venous","Lactic Acid Arterial","Lactic Acid Arterial from Blood Gas") AND (IsHistory = FALSE AND Active = TRUE))};
|
||||
|
||||
// If called by the editor
|
||||
|
||||
If called_by_editor then EvokingObject := read last { Observation: This }; 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) };
|
||||
|
||||
|
||||
HighLacticAcidValueEntered := false;
|
||||
if (resultValue = ">20.0") then
|
||||
resultValueNumeric := 3;
|
||||
else
|
||||
resultValueNumeric := resultValue as number;
|
||||
endif;
|
||||
|
||||
if(visittype in ("Inpatient","Emergency","Observation")) then
|
||||
validpatient := true;
|
||||
else
|
||||
validpatient := false;
|
||||
endif;
|
||||
|
||||
if ((resultValueNumeric > 2) and (validpatient)) then
|
||||
|
||||
|
||||
(InitResultGUID_lt2, InitSignificantdtm, OrderDTTM_rnd2wholehr, OrderDTTM_exact4hours) := Read Last {" declare @labresult char (10) set @labresult = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}}
|
||||
select top 1 o.GUID
|
||||
,o.significantdtm , dateadd(hour, 4 + datediff(hour, 0, o.SignificantDtm), 0) as {{{SINGLE-QUOTE}}}orderdate_tohour{{{SINGLE-QUOTE}}}, DATEADD(hh,4,o.significantdtm) as {{{SINGLE-QUOTE}}}orderdate _exact4hours{{{SINGLE-QUOTE}}}
|
||||
from CV3BasicObservation ob with (nolock)
|
||||
inner join CV3Order o with (nolock) on o.GUID = ob.OrderGUID and o.ClientGUID = ob.ClientGUID
|
||||
and o.ChartGUID = ob.ChartGUID and o.ClientVisitGUID = ob.ClientVisitGUID
|
||||
where ob.clientguid = " || sql(ClientGUID) || "
|
||||
and ob.chartguid = " || sql(ChartGUID) || "
|
||||
and ob.clientvisitguid = " || sql(ClientVisitGUID) || "
|
||||
and ob.ishistory = 0
|
||||
and ob.ItemName in ({{{SINGLE-QUOTE}}}Lactate, VBG, POC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lactate, ABG, POC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lactic Acid Arterial{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lactic Acid Arterial from Blood Gas{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lactic Acid Venous{{{SINGLE-QUOTE}}})
|
||||
and (ob.value > @labresult or ob.value = {{{SINGLE-QUOTE}}}>20.0{{{SINGLE-QUOTE}}})
|
||||
order by o.SignificantDtm, o.TouchedWhen, o.Entered asc "};
|
||||
|
||||
//check to see if the result trigger MLM is the same as the oldest result saved to the database with a value > 2.
|
||||
if InitResultGUID_lt2 = OrderGUID 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}}}Blood Gas Venous, Point of Care{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lactic Acid Arterial{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lactic Acid Venous{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lactic Acid Arterial from Blood Gas{{{SINGLE-QUOTE}}})
|
||||
and o.Requesteddtm >= " || sql(InitSignificantdtm) || "
|
||||
and o.RequestedDtm <= " || sql(OrderDTTM_exact4hours) || "
|
||||
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 (OrderDTTM_rnd2wholehr > now)) then
|
||||
/*--removed 1-15-2016 so Lactic Acid Venous is always ordered no matter what
|
||||
if OrderName matches pattern "%Arterial%" then
|
||||
reordername := "Lactic Acid Arterial";
|
||||
reorderpiority := "Collected Specimen Time";
|
||||
else
|
||||
reordername := "Lactic Acid Venous";
|
||||
reorderpiority := "Scheduled Time";
|
||||
endif;
|
||||
*/
|
||||
reordername := "Lactic Acid Venous";
|
||||
reorderpiority := "Scheduled Time";
|
||||
reqdate := (extract year OrderDTTM_rnd2wholehr) || "-" || ((extract month OrderDTTM_rnd2wholehr) formatted with "%0.2d")
|
||||
|| "-" || ((extract day OrderDTTM_rnd2wholehr) formatted with "%0.2d");
|
||||
|
||||
ReqTimeHR := (extract hour OrderDTTM_rnd2wholehr);
|
||||
ReqTimeMin := ((extract minute OrderDTTM_rnd2wholehr) formatted with "%0.2d");
|
||||
HighLacticAcidValueEntered := 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 ((HighLacticAcidValueEntered = true) and (validpatient)) then
|
||||
try
|
||||
SessionType := "Standard";
|
||||
SessionReason := "";
|
||||
RequestedBySource := "";
|
||||
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;
|
||||
|
||||
if (reordername = "Lactic Acid Venous") then
|
||||
retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldMandatory{{{SINGLE-QUOTE}}} with "LAB_Order Priorities",false;
|
||||
endif;
|
||||
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 sepsis 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:
|
||||
|
||||
|
||||
////// Added on 01.08.2015 by DW for CSR#: 33901 //////
|
||||
if(validpatient) then
|
||||
if resultValueNumeric > 2
|
||||
then col_value := "Elevated";
|
||||
else col_value := "";
|
||||
endif;
|
||||
|
||||
Lactic_Collumn:= NEW EDCObj WITH
|
||||
[
|
||||
column_name := "Lactic Acid Result",
|
||||
column_value := col_value,
|
||||
client_guid := ClientGUID,
|
||||
chart_guid := ChartGUID,
|
||||
client_visit_guid := ClientVisitGUID
|
||||
];
|
||||
|
||||
return_value := call create_ED_column with ( Lactic_Collumn );
|
||||
|
||||
conclude true;
|
||||
else
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
////// Added on 01.08.2015 by DW for CSR#: 33901 //////
|
||||
|
||||
|
||||
|
||||
/*
|
||||
if HighLacticAcidValueEntered = true
|
||||
then conclude true;
|
||||
conclusion := "true";
|
||||
|
||||
else
|
||||
conclude false;
|
||||
conclusion := "false";
|
||||
|
||||
endif;
|
||||
*/
|
||||
;;
|
||||
action:
|
||||
|
||||
if Error_occurred
|
||||
then
|
||||
write "An error has occured in the MLM {{+B}}SCH_CREATE_LACTIC_ACID_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:
|
||||
208
MLMStripper/bin/Debug/SCH/SCH_CREATE_MEDICARE44.mlm
Normal file
208
MLMStripper/bin/Debug/SCH/SCH_CREATE_MEDICARE44.mlm
Normal file
@@ -0,0 +1,208 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CREATE_MEDICARE44;;
|
||||
mlmname: SCH_CREATE_MEDICARE44;;
|
||||
arden: version 2.5;;
|
||||
version: 0.00;;
|
||||
institution: St. Clair Hospital ;;
|
||||
author: Shawn Head, Allscripts/St. Clair Hospital x7468;;
|
||||
specialist: Peggy Karish, Allscripts/St. Clair Hospital ;;
|
||||
date: 2017-05-26;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Automatically create a duplicate Code 44 order to be sent to Physician Advison
|
||||
;;
|
||||
explanation: When patients are being changed to a Medicare Code status of 44 Medidare requires 2 signoff{{{SINGLE-QUOTE}}}s (Physician advisor and attending physician).
|
||||
|
||||
***********************CHANGE HISTORY************************
|
||||
05-27-2017 - STH - CSR#: 32795 - created
|
||||
|
||||
*************************************************************
|
||||
|
||||
;;
|
||||
keywords: Create Order, Medicare, Status 44
|
||||
;;
|
||||
citations:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
/*------------------------------BEGIN USER EDIT SECTION------------------------------*/
|
||||
|
||||
|
||||
(UpdateStringFields) := ("NUR_GenAdditionalTxt","CM_Rationale");
|
||||
(UpdateDateFields) := ("CM_ Communcation Date");
|
||||
(UpdateCheckBoxFields) := ("CM_Observation CB");
|
||||
|
||||
|
||||
/*------------------------------END USER EDIT SECTION------------------------------*/
|
||||
|
||||
log_execution_info:= FALSE;
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
on_order_enter := event {OrderWorksheetSubmit User } ;
|
||||
from_order_name := "Code 44 - Attending";
|
||||
CreateCode44Order := false;
|
||||
UnSub_Code44_Attending_order := read last { UNSUBMITTED Order: Name where name = "Code 44 - Physician Advisor" };
|
||||
if(UnSub_Code44_Attending_order is null) then
|
||||
userguid,user_id :=read last {UserInfo: guid,idcode};
|
||||
(ReadUnSub_Code44_AdvisorUD, CP_GUID, OrderName, sessiontype, requesteddate, requestedtime) := read last { UNSUBMITTED Order: OrderUserData , careproviderguid , name , InitialSessionTypeCode, RequestedDate, RequestedTime where name = "Code 44 - Attending"};
|
||||
if(count(ReadUnSub_Code44_AdvisorUD) > 0) then
|
||||
(clientGUID, chartGUID, ClientVisitGUID, LocationGUID) := read last { ClientVisit: ClientGUID, ChartGUID, GUID, CurrentLocationGUID };
|
||||
(Code44_Advisor) := read last { " 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}}}Code 44 - Physician Advisor{{{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(Code44_Advisor is null) then
|
||||
(userdatacode, value ) := read { OrderUserData: UserDataCode, Value REFERENCING ReadUnSub_Code44_AdvisorUD } ;
|
||||
CreateCode44Order := true;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if(CreateCode44Order) then
|
||||
|
||||
try
|
||||
CV_Obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
|
||||
WSSessionType := trim(sessiontype[1]);
|
||||
if(sessiontype[1] = "Hold") then
|
||||
WSSessionReason := "Hold Orders";
|
||||
else
|
||||
WSSessionReason := "";
|
||||
endif;
|
||||
|
||||
|
||||
//This will find the care provider GUID for the "Physician Advisor" user to be used for the auto creatd order.
|
||||
CP_GUID := read last { " select cp.GUID from CV3CareProvider cp with (nolock)
|
||||
inner join cv3user u with (nolock)
|
||||
on cp.guid = u.GUID
|
||||
and u.IDCode = {{{SINGLE-QUOTE}}}zzzpacm{{{SINGLE-QUOTE}}} " };
|
||||
|
||||
RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((CP_GUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
location_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 ( CV_Obj is NOT NULL ) then
|
||||
void:= call CV_Obj.Dispose;
|
||||
CV_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;
|
||||
|
||||
|
||||
try
|
||||
|
||||
Catalog_Item_Name := "Code 44 - Physician Advisor";
|
||||
order_type := "other";
|
||||
modifier := "";
|
||||
modversion := "";
|
||||
WSRequestedBySource := "Protocol Order";
|
||||
order_Creation_Reason := from_order_name || " order.";
|
||||
|
||||
|
||||
order_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
|
||||
with Catalog_Item_Name;
|
||||
|
||||
GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
||||
with CV_Obj,
|
||||
order_catalog_item,
|
||||
order_Creation_Reason,
|
||||
RequestedBy_obj,
|
||||
WSRequestedBySource,
|
||||
WSSessionType,
|
||||
WSSessionReason,
|
||||
location_obj,
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
|
||||
test2 := (extract year requesteddate) formatted with "%04d" || "-" ||
|
||||
(extract month requesteddate) formatted with "%02d" || "-" ||
|
||||
(extract day requesteddate) formatted with "%02d";
|
||||
|
||||
GeneralOrder_obj.RequestedTime := requestedtime;
|
||||
|
||||
RequestedDate := (RequestedDate as time);
|
||||
ModReqDate := (extract year RequestedDate) formatted with "%04d" || "-" ||
|
||||
(extract month RequestedDate) formatted with "%02d" || "-" ||
|
||||
(extract day RequestedDate) formatted with "%02d";
|
||||
ModReqDate := ModReqDate as string;
|
||||
|
||||
|
||||
GeneralOrder_obj.RequestedDate := ModReqDate;
|
||||
|
||||
|
||||
for x in (1 seqto(count(userdatacode))) do
|
||||
ud1 := userdatacode[x];
|
||||
v1 := value[x];
|
||||
if(userdatacode[x] in (UpdateStringFields)) then
|
||||
retval := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
||||
userdatacode[x], value[x] ;
|
||||
endif;
|
||||
if(userdatacode[x] in (UpdateDateFields)) then
|
||||
PatientCommunicationDate := ((value[x] as time) as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}});
|
||||
val6 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Nullable<DateTime>>{{{SINGLE-QUOTE}}} with
|
||||
userdatacode[x],PatientCommunicationDate ;
|
||||
endif;
|
||||
if(userdatacode[x] in (UpdateCheckBoxFields)) then
|
||||
AttendingOrdObsCB := (value[x] as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}});
|
||||
retval := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with
|
||||
userdatacode[x], AttendingOrdObsCB;
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
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;
|
||||
|
||||
endif;
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
on_order_enter;
|
||||
;;
|
||||
logic:
|
||||
;;
|
||||
action:
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
135
MLMStripper/bin/Debug/SCH/SCH_CREATE_OMP_DISCHARGE_MED_ORDER.mlm
Normal file
135
MLMStripper/bin/Debug/SCH/SCH_CREATE_OMP_DISCHARGE_MED_ORDER.mlm
Normal file
@@ -0,0 +1,135 @@
|
||||
maintenance:
|
||||
|
||||
title: ;;
|
||||
mlmname: SCH_Create_OMP_Discharge_Med_Order;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: ;;
|
||||
author: Don Warnick ;;
|
||||
specialist: ;;
|
||||
date: 2011-06-09;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Generate a Discharge Medication order at the time discharge
|
||||
;;
|
||||
explanation: When a discharge occurs, an order is created for each therapeutic class of order found in in the patient{{{SINGLE-QUOTE}}}s
|
||||
OMP. The therapeutic class associated with the order is found in the class type field of the UDDI.
|
||||
Only UDDI{{{SINGLE-QUOTE}}}s with the name beginning with the letters "Dicharge Medications - "
|
||||
|
||||
Change history
|
||||
|
||||
06.09.2011 DW Created
|
||||
07.24.2013 DW HD #159442 Filtered out all but the discharge omp meds and changed from a discharge to a standard session
|
||||
05.31.2019 JML 18.4 SCM Upgrade - changed username {{{SINGLE-QUOTE}}}interfaces{{{SINGLE-QUOTE}}} to {{{SINGLE-QUOTE}}}%services{{{SINGLE-QUOTE}}} as user that enters order.
|
||||
|
||||
;;
|
||||
keywords: OMP Discharge Orders, Meaningful Use
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
error_occurred := false;
|
||||
|
||||
|
||||
clientvisit_enter_event := EVENT{ClientVisitDischarge User ClientVisit };
|
||||
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid) := read last {ClientVisit: GUID, ChartGUID, ClientGUID REFERENCING EvokingObject};
|
||||
// (UserGUID ) := read last { UserInfo: GUID };
|
||||
(UserGUID ) := read last {select guid from CV3User with (nolock) where IDCode like {{{SINGLE-QUOTE}}}%services{{{SINGLE-QUOTE}}}};
|
||||
|
||||
Func_Discharge_Med_Order_MLM := mlm {{{SINGLE-QUOTE}}}SCH_Func_OMP_Discharge_Med_Order{{{SINGLE-QUOTE}}};
|
||||
|
||||
|
||||
(Order_Names, Order_Classes) := read {"select mi.Name, ctv.value from CV3OrderCatalogMasterItem mi with (nolock)
|
||||
join cv3catalogclasstypevalue ctv with (nolock) on ctv.catalogmasterguid = mi.guid
|
||||
join cv3classtype ct with (nolock) on ct.guid = ctv.classtypeguid and ct.code = {{{SINGLE-QUOTE}}}DI_Med Therapeutic Classes{{{SINGLE-QUOTE}}}
|
||||
where mi.Name like {{{SINGLE-QUOTE}}}discharge medication - %{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
|
||||
(Sub_Order_Names, Sub_Order_Classes) := read {"select mi.Name, ctv.value from CV3OrderCatalogMasterItem mi with (nolock)
|
||||
join cv3catalogclasstypevalue ctv with (nolock) on ctv.catalogmasterguid = mi.guid
|
||||
join cv3classtype ct with (nolock) on ct.guid = ctv.classtypeguid and ct.code = {{{SINGLE-QUOTE}}}DI_Med Therapeutic Classes{{{SINGLE-QUOTE}}}
|
||||
where mi.Name like {{{SINGLE-QUOTE}}}discharge medication --%{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
|
||||
|
||||
Order_Accumulator:= " ";
|
||||
|
||||
for i in 1 seqto count Order_Names do
|
||||
ThisOrder_Name := Order_Names [i];
|
||||
Order_Class := Order_Classes[i];
|
||||
|
||||
|
||||
(OMP_Meds) := read {" SET CONCAT_NULL_YIELDS_NULL off select distinct
|
||||
p.DrugName + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + cast (p.DoseAmount AS varchar) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + p.Instructions
|
||||
from sxaambclientprescription p with (nolock)
|
||||
join SXAAMBDrugCategoryXRef xr with (nolock) on xr.GenericNameID = p.GenericNameID
|
||||
join SXAAMBDrugCategory dc with (nolock) on xr.drugcategoryid = dc.DrugCategoryID
|
||||
join SXAAMBDrugCategory dc2 with (nolock) on dc.ParentDrugCategoryID = dc2.DrugCategoryID
|
||||
where p.ClientGuid = " || ClientGuid || " and p.statustype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}
|
||||
and dc2.CategoryName = {{{SINGLE-QUOTE}}}" || Order_Class || "{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
ThisOMP_Med:= " ";
|
||||
SpecialInstructions:= " ";
|
||||
|
||||
for i in 1 seqto count OMP_Meds do
|
||||
ThisOMP_Med := OMP_Meds [i];
|
||||
SpecialInstructions := SpecialInstructions || " \n " || ThisOMP_Med ;
|
||||
enddo;
|
||||
|
||||
If SpecialInstructions <> " " then
|
||||
void := call Func_Discharge_Med_Order_MLM with (ClientVisitGuid, ChartGuid, ClientGuid, UserGUID, SpecialInstructions, ThisOrder_Name);
|
||||
endif;
|
||||
|
||||
enddo;
|
||||
|
||||
|
||||
|
||||
Order_Accumulator:= " ";
|
||||
|
||||
for i in 1 seqto count Sub_Order_Names do
|
||||
ThisOrder_Name := Sub_Order_Names [i];
|
||||
Order_Class := Sub_Order_Classes[i];
|
||||
|
||||
|
||||
(OMP_Meds) := read {" SET CONCAT_NULL_YIELDS_NULL off select distinct
|
||||
p.DrugName + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + cast (p.DoseAmount AS varchar) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + p.Instructions
|
||||
from sxaambclientprescription p with (nolock)
|
||||
join SXAAMBDrugCategoryXRef xr with (nolock) on xr.GenericNameID = p.GenericNameID
|
||||
join SXAAMBDrugCategory dc with (nolock) on xr.drugcategoryid = dc.DrugCategoryID
|
||||
where p.ClientGuid = " || ClientGuid || "
|
||||
and dc.CategoryName = {{{SINGLE-QUOTE}}}" || Order_Class || "{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
ThisOMP_Med:= " ";
|
||||
SpecialInstructions:= " ";
|
||||
|
||||
for i in 1 seqto count OMP_Meds do
|
||||
ThisOMP_Med := OMP_Meds [i];
|
||||
SpecialInstructions := SpecialInstructions || " \n " || ThisOMP_Med ;
|
||||
enddo;
|
||||
|
||||
If SpecialInstructions <> " " then
|
||||
void := call Func_Discharge_Med_Order_MLM with (ClientVisitGuid, ChartGuid, ClientGuid, UserGUID, SpecialInstructions, ThisOrder_Name);
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
|
||||
|
||||
;;
|
||||
evoke: 0 minutes after time of clientvisit_enter_event;
|
||||
// clientvisit_enter_event ;
|
||||
|
||||
;;
|
||||
logic:
|
||||
Conclude true ;
|
||||
;;
|
||||
action:
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
562
MLMStripper/bin/Debug/SCH/SCH_CREATE_RECON_RQMT_MAIN.mlm
Normal file
562
MLMStripper/bin/Debug/SCH/SCH_CREATE_RECON_RQMT_MAIN.mlm
Normal file
@@ -0,0 +1,562 @@
|
||||
maintenance:
|
||||
|
||||
title: Create Order Reconcile Requirement Main MLM;;
|
||||
mlmname: SCH_CREATE_RECON_RQMT_MAIN;;
|
||||
arden: version 2.5;;
|
||||
version: 5.00;; // SP1
|
||||
institution: Eclipsys, Standard MLM;;
|
||||
author: Eclipsys Corporation;;
|
||||
specialist: ;;
|
||||
date: 2008-04-23;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
This MLM creates Requirements for Order Reconciliation based on site defined policies.
|
||||
;;
|
||||
explanation:
|
||||
This MLM creates Order Reconciliation Requirements based on site policies that the site
|
||||
defines in the functional MLMs called by this MLM. Once created these Requirements are
|
||||
used to set a flag on the Patient List to indicate whether Order Reconciliation is due
|
||||
or overdue.
|
||||
When Orders are reconciled, the Reconciliation is linked to the Requirement.
|
||||
|
||||
Note : the Order Reconciliation can occur before the Requirement is created. If this is
|
||||
the case, the application links the Requirement to the Order Reconciliation
|
||||
using the data stored for each requirement created by the MLM.
|
||||
|
||||
|
||||
The CDS Trigger Events where this MLM will be evoked are as follows:
|
||||
. Admit a patient to a specific Facility, Location Function Group or a particular
|
||||
Location Group
|
||||
. Transfer patient from a specific Facility, Location Function Group or a particular
|
||||
Location Group to a specific Facility, Location Function Group or a
|
||||
particular Location Group
|
||||
. Transfer patient to a specific VisitType\Care Level\Service
|
||||
. Transfer patient to a specific Provider on particular units
|
||||
. Discharge a patient from a specific Facility, Location Function Group or a
|
||||
particular Location Group
|
||||
. Enter a ?discharge? order from a specific Facility, Location Function Group or
|
||||
a particular Location Group
|
||||
. Enter a ?transfer? order from a specific Facility, Location Function Group or a
|
||||
particular Location Group to a specific Facility, Location Function Group or
|
||||
a particular Location Group
|
||||
|
||||
This MLM writes to the Destination only when the MLM
|
||||
concludes TRUE to ensure that the Requirement is only created when the user has
|
||||
proceeded beyond any possible Alerts to save the data to the database.
|
||||
|
||||
|
||||
Based on ?rules? defined in this MLM, the logic will determine:
|
||||
. When a Reconciliation Requirement is to be created
|
||||
. What type of Reconciliation can be linked to the Requirement being created
|
||||
. What the time frame is used for linking an Order Reconciliation to a Requirement
|
||||
. When the Reconciliation is to be considered overdue
|
||||
. The locations, Location Function Groups, and Facilities that use a given rule
|
||||
. The various VisitType/CareLevel/Service changes that use a given rule
|
||||
. The various Provider Type and Role changes that use a given rule
|
||||
. Various Orders for transfer and discharge that use a given rule bases on the
|
||||
class associated with the item in the Item Catalog
|
||||
|
||||
To support their own site policies for when Order Reconciliation should be performed,
|
||||
sites must code their preferences for these {{{SINGLE-QUOTE}}}rules{{{SINGLE-QUOTE}}} in the supporting Functional MLMs.
|
||||
The order - class associations must be configured in the Item Catalog.
|
||||
The MLM will create the Requirement using these site policy definitions.
|
||||
|
||||
|
||||
In order to populate the Reconciliation Requirement, the MLM will pass the following
|
||||
information to the Eclipsys function.
|
||||
. The ClientGUID
|
||||
. The ChartGUID
|
||||
. The ClientVisitGUID from the Evoking Object
|
||||
. Type of the reconciliation requirement. Seven types are supported:
|
||||
- Admission,
|
||||
- Location Change
|
||||
- Care Provider Change,
|
||||
- Visit Type\Care Level\Service Change
|
||||
- Discharge
|
||||
- Transfer
|
||||
- Transfer Order
|
||||
- Discharge Order
|
||||
. List of facility defined Reconciliation types.
|
||||
. Precedence for this Requirement.
|
||||
. Timeframe in which this Requirement should be linked.
|
||||
. DateTime after which the Requirement becomes inactive.
|
||||
. Timeframe in which the Requirement and a previous Order Reconciliation can be
|
||||
auto-linked.
|
||||
. DateTime after which the requirement will become overdue.
|
||||
. GUID of the Order that was for a Transfer or Discharge
|
||||
. FromGUID1 and ToGUID1
|
||||
- For Location Change or Transfer Order, this is the LOcationGUID from the
|
||||
backup ClientVisit and the LocationGUID for the Current
|
||||
ClientVisit.
|
||||
- For Care Provider Change, this is the backup CareProviderVisitRoleGUID
|
||||
and the current CareProviderVisitRoleGUID
|
||||
- For Visit Type/Care Level/Service Change, this is the GUID of the
|
||||
VisitType\Care Level\Service for the backup Clientvisit
|
||||
and the GUID of the VisitType\Care Level\Service for the
|
||||
current ClientVisit.
|
||||
;;
|
||||
|
||||
keywords: Order Reconciliation; Policy
|
||||
;;
|
||||
|
||||
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}}};
|
||||
|
||||
include standard_libs;
|
||||
|
||||
/***************Make Changes To Spelling And Flags In This Section*******************/
|
||||
// Set to true if logging is needed.
|
||||
log_execution_info := false;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Event Statements
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
// To enhance efficiency add filtering clauses where ever possible. For example add a
|
||||
// WHERE clause limiting the Event to match the data configured in the supporting
|
||||
// MLM policy definitions.
|
||||
|
||||
|
||||
//Transfer - add the locations defined in the transfer policy to enhance efficiency
|
||||
//Visit Type, Care Level or Service - add various VistTypes to enhance efficiency
|
||||
client_visit_modify_event := EVENT { ClientVisitModify Any ClientVisit};
|
||||
//WHERE TypeCode in ( "Inpatient" )};
|
||||
|
||||
//Discharge - add locations that are defined in the discharge policy.
|
||||
client_visit_discharge_event := EVENT { ClientVisitDischarge Any ClientVisit};
|
||||
//WHERE TypeCode in ( "Inpatient" )};
|
||||
|
||||
order_enter_event := EVENT {OrderEnter Any Order:
|
||||
WHERE first of ( OrderCatalogMasterItem.CatalogClassTypeValue.Records__
|
||||
WHERE
|
||||
OrderCatalogMasterItem.CatalogClassTypeValue.Records__.Code ="ECLP-Reconciliation Order Type" AND
|
||||
OrderCatalogMasterItem.CatalogClassTypeValue.Records__.Value = "Discharge Order"
|
||||
) is not null
|
||||
};
|
||||
|
||||
order_modify_event := EVENT {OrderModify Any Order:
|
||||
WHERE first of ( OrderCatalogMasterItem.CatalogClassTypeValue.Records__
|
||||
WHERE
|
||||
OrderCatalogMasterItem.CatalogClassTypeValue.Records__.Code ="ECLP-Reconciliation Order Type" AND
|
||||
OrderCatalogMasterItem.CatalogClassTypeValue.Records__.Value = "Discharge Order"
|
||||
) is not null
|
||||
};
|
||||
|
||||
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
|
||||
|
||||
|
||||
// Flag on how to handle multiple occurences of the same provider role type
|
||||
// (This flag is only applicable when SCMCareProviderRoleType is configured to allow multiple)
|
||||
// (If SCMCareProviderRoleType does not allow multiple, check for valid policy always happen)
|
||||
// If TRUE - check for valid policy for first occurrence only
|
||||
// If FALSE - check for valid policy for all occurrences
|
||||
handle_first_multi_provider_occurrence_flag := TRUE;
|
||||
|
||||
// Error message text can be editted as needed
|
||||
error_destination := destination { Alert: reminder,
|
||||
"Error in order reconciliation", medium, chart };
|
||||
|
||||
/**************************Do not make changes below this Section**********************/
|
||||
|
||||
|
||||
//A variable used to check if a policy record is found
|
||||
policy_record_found := false;
|
||||
|
||||
//A variable used to store order reconciliation requirement
|
||||
my_req := Null;
|
||||
my_req_list := ();
|
||||
|
||||
//A variable used to store policy definition
|
||||
policy_def := null;
|
||||
policydef_list := ();
|
||||
|
||||
// Used when running from the editor
|
||||
if called_by_editor then
|
||||
EvokingObject := read last { ClientVisit: This};
|
||||
//EvokingEvent := client_visit_enter_event; // Admission Event
|
||||
//EvokingEvent := client_visit_modify_event; // Transfer Event, Service Change Event
|
||||
//EvokingEvent := client_visit_discharge_event; // Discharge Event
|
||||
|
||||
//EvokingObject := read last { Order: This};
|
||||
//EvokingEvent := order_enter_event; // Order Transfer, Order Discharge Event
|
||||
//EvokingEvent := order_modify_event; // Order Transfer, Order Discharge Event
|
||||
//EvokingEvent := order_enter_no_iv_additives_event; // Order Transfer Event
|
||||
//EvokingEvent := order_init_event; // Order Discharge Event
|
||||
|
||||
//EvokingObject := read last { CareProviderVisitRole: This};
|
||||
//EvokingEvent := provider_enter_event; // Care Provider Change
|
||||
endif; // if called_by_editor
|
||||
|
||||
// Declare policy specific MLMs that can be called
|
||||
AdmissionPolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_ADMISSIONPOLICY{{{SINGLE-QUOTE}}};
|
||||
// TransferPolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_TRANSFERPOLICY{{{SINGLE-QUOTE}}};
|
||||
// DischargePolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_DISCHARGEPOLICY{{{SINGLE-QUOTE}}};
|
||||
// CareProviderChangePolicy_MLM
|
||||
// := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_CAREPROVIDERCHANGEPOLICY{{{SINGLE-QUOTE}}};
|
||||
OrderDischargePolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_ORDERDISCHARGEPOLICY{{{SINGLE-QUOTE}}};
|
||||
// OrderTransferPolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_ORDERTRANSFERPOLICY{{{SINGLE-QUOTE}}};
|
||||
// VisitTypeCareLevelServicePolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_VISITTYPECARELEVELSERVICEPOLICY{{{SINGLE-QUOTE}}};
|
||||
|
||||
SelectPatientLocPolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_SelectPatientLocPolicy{{{SINGLE-QUOTE}}};
|
||||
// SelectTransferPolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_SelectTransferPolicy{{{SINGLE-QUOTE}}};
|
||||
// SelectCareProviderPolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_SelectCareProviderPolicy{{{SINGLE-QUOTE}}};
|
||||
// SelectServicePolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_SelectServicePolicy{{{SINGLE-QUOTE}}};
|
||||
|
||||
SetDefault_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_SET_POLICY_DEFAULT{{{SINGLE-QUOTE}}};
|
||||
|
||||
error_occured := false;
|
||||
overridebyloc := false;
|
||||
//Determine the type of event and perform logic for that event
|
||||
|
||||
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 1"
|
||||
// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
//**************************//
|
||||
// //
|
||||
// Admission Event SCH changed to transfer from ER Major only //
|
||||
// //
|
||||
//**************************//
|
||||
if EvokingEvent = client_visit_modify_event
|
||||
then
|
||||
// RS 05/10/2010 Added to find previous location
|
||||
(backup_obj) := read last {ClientVisit: Backup REFERENCING EvokingObject};
|
||||
(Bk_Loc_Name, Bk_Loc_GUID, Bk_VisitStatus,Bk_TypeCode,Bk_TemporaryLocation) :=
|
||||
read last {ClientVisit: CurrentLocation,CurrentLocationGUID,VisitStatus,TypeCode, TemporaryLocation REFERENCING backup_obj};
|
||||
// RS 05/10/2010 end of addition
|
||||
|
||||
//Get Required parameters from the evoking object
|
||||
( visit_client_guid,
|
||||
visit_guid,
|
||||
visit_chart_guid,
|
||||
visit_location_guid,
|
||||
alternate_visit_location_guid,
|
||||
visit_loc_name) := read last
|
||||
{ClientVisit: ClientGUID, GUID, ChartGUID,
|
||||
BusinessRuleLocationGUID, CurrentLocationGUID, currentlocation
|
||||
REFERENCING EvokingObject} ;
|
||||
// RS added to insure that to location is an inpatient bed
|
||||
counter := 0;
|
||||
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "From Location " || Bk_Loc_Name || "\n\n To Location " || visit_loc_name
|
||||
// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
counter := read last {" select count(*) from Cv3Location with (nolock) "
|
||||
|| " where locngrpguid = " || alternate_visit_location_guid
|
||||
|| " and name = " || sql(visit_loc_name)
|
||||
|| " and typecode = {{{SINGLE-QUOTE}}}Bed{{{SINGLE-QUOTE}}} "
|
||||
|| " and active = 1 "
|
||||
};
|
||||
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 2"
|
||||
// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
if ((Bk_Loc_Name <> "ER Major") or (counter =0)) then
|
||||
overridebyloc := true;
|
||||
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "I should not create a flag as from loc is " || Bk_Loc_Name || "\n\n and to bed is " || counter
|
||||
// ,"Tester","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
else
|
||||
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 3"
|
||||
// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "I should create a flag as from loc is " || Bk_Loc_Name || "\n\n and to bed is " || counter
|
||||
// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
// RS 05/10/2010 added to here, note the extra if above
|
||||
// Will only fire if coming from ER Major and going to a bed
|
||||
|
||||
|
||||
//Ensure location guid value is filled in, if not, use alternate value
|
||||
if (visit_location_guid is NULL)
|
||||
then
|
||||
visit_location_guid := alternate_visit_location_guid;
|
||||
endif;
|
||||
|
||||
|
||||
//Check for existing policy definition
|
||||
(AdmissionPolicyListDef, AdmissionPolicyDefaults):= call AdmissionPolicy_MLM;
|
||||
|
||||
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 4"
|
||||
// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
//When a patient is admitted, determine if
|
||||
//order reconciliation requirement needs to be created.
|
||||
policy_def := call SelectPatientLocPolicy_MLM with
|
||||
visit_location_guid,
|
||||
AdmissionPolicyListDef;
|
||||
|
||||
|
||||
|
||||
//check for default values
|
||||
policy_def:= call SetDefault_MLM with
|
||||
policy_def,AdmissionPolicyDefaults;
|
||||
|
||||
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 5"
|
||||
// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
|
||||
//Intentionally left for support purposes
|
||||
//eventName:= "Admission";
|
||||
//break;
|
||||
|
||||
if (policy_def is NOT NULL)
|
||||
then
|
||||
policy_record_found := true;
|
||||
try
|
||||
reconcileList := policy_def.ReconcileType;
|
||||
|
||||
reconcileTypeColl:= new net_object {{{SINGLE-QUOTE}}}ReconcileTypeCollection{{{SINGLE-QUOTE}}};
|
||||
//dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 6"
|
||||
// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
index_list := 1 seqto (count reconcileList);
|
||||
for ind in index_list do
|
||||
void := call reconcileTypeColl.Add with ( reconcileList[ind] as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
|
||||
|
||||
enddo; //ind in index_list do
|
||||
//dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 7"
|
||||
// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
// create ObjectsPlus OrderReconciliationRequirement object
|
||||
my_req := call
|
||||
{{{SINGLE-QUOTE}}}OrderReconciliationRequirement{{{SINGLE-QUOTE}}}.CreateAdmissionRequirement
|
||||
with ((visit_client_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}),
|
||||
((visit_chart_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}),
|
||||
((visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}),
|
||||
reconcileTypeColl;
|
||||
|
||||
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 8"
|
||||
// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
my_req_list := my_req,my_req_list;
|
||||
policydef_list := policy_def,policydef_list;
|
||||
|
||||
endtry;
|
||||
catch exception ex
|
||||
my_exception := ex;
|
||||
error_occured := True;
|
||||
|
||||
endcatch;
|
||||
endif; // override location change
|
||||
endif; // if(policy_def is NOT NULL)
|
||||
|
||||
|
||||
|
||||
//**************************//
|
||||
// //
|
||||
// Discharge Order Event //
|
||||
// //
|
||||
//**************************//
|
||||
elseif ( (EvokingEvent = order_enter_event)
|
||||
OR (EvokingEvent = order_modify_event)
|
||||
)
|
||||
then
|
||||
|
||||
//Gets information from the evoking Order
|
||||
(visit_guid,
|
||||
order_guid,
|
||||
Ord) := read last
|
||||
{Order: ClientVisitGUID,
|
||||
GUID,
|
||||
This
|
||||
REFERENCING EvokingObject};
|
||||
|
||||
transfer_to_location := Ord.OrderAdditionalInfo.TransferToLocnGUID;
|
||||
|
||||
//Get Required parameters from the ClientVisitObject object
|
||||
( type_code) := read last
|
||||
{ClientVisit: TypeCode
|
||||
Where GUID = visit_guid } ;
|
||||
|
||||
( visit_client_guid,
|
||||
visit_chart_guid,
|
||||
visit_location_guid,
|
||||
alternate_visit_location_guid,
|
||||
new_visit_location_guid) := read last
|
||||
{ClientVisit: ClientGUID, ChartGUID,
|
||||
BusinessRuleLocationGUID, CurrentLocationGUID,
|
||||
NextLocnGrpGUID,
|
||||
Where GUID = visit_guid } ;
|
||||
|
||||
//Ensure location guid value is filled in, if not, use alternate value
|
||||
if (visit_location_guid is NULL)
|
||||
then
|
||||
visit_location_guid := alternate_visit_location_guid;
|
||||
endif;
|
||||
|
||||
//Get Order Class Type
|
||||
ocmi := Read last {Order: OrderCatalogMasterItem referencing Ord};
|
||||
|
||||
orderRecCatalogClassTypeValue := first of (ocmi.CatalogClassTypeValue.Records__ where ocmi.CatalogClassTypeValue.Records__.code = "ECLP-Reconciliation Order Type" );
|
||||
classTypeValue := orderRecCatalogClassTypeValue.value;
|
||||
|
||||
if (classTypeValue="Discharge Order")
|
||||
then
|
||||
//Check for existing policy definition
|
||||
(OrderDischargePolicyListDef, OrderDischargePolicyDefaults):= call OrderDischargePolicy_MLM;
|
||||
|
||||
//When a discharge order is placed, determine if
|
||||
//order reconciliation requirement needs to be created.
|
||||
policy_def := call SelectPatientLocPolicy_MLM with
|
||||
visit_location_guid,
|
||||
OrderDischargePolicyListDef;
|
||||
|
||||
//check for default values
|
||||
policy_def:= call SetDefault_MLM with
|
||||
policy_def,OrderDischargePolicyDefaults;
|
||||
|
||||
//Intentionally left for support purposes
|
||||
//eventName:= "Order Discharge";
|
||||
//break;
|
||||
endif;
|
||||
|
||||
if (policy_def is NOT NULL)
|
||||
then
|
||||
policy_record_found := true;
|
||||
try
|
||||
|
||||
// get current client visit object
|
||||
client_visit := call
|
||||
{{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
reconcileTypeColl:= new net_object {{{SINGLE-QUOTE}}}ReconcileTypeCollection{{{SINGLE-QUOTE}}};
|
||||
|
||||
reconcileList := policy_def.ReconcileType;
|
||||
|
||||
index_list := 1 seqto (count reconcileList);
|
||||
for ind in index_list do
|
||||
void := call reconcileTypeColl.Add with ( reconcileList[ind] as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
|
||||
enddo; //ind in index_list do
|
||||
|
||||
if (classTypeValue = "Transfer Order")
|
||||
then
|
||||
my_req := call {{{SINGLE-QUOTE}}}OrderReconciliationRequirement{{{SINGLE-QUOTE}}}.CreateTransferOrderRequirement
|
||||
with client_visit,
|
||||
reconcileTypeColl,
|
||||
((order_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}),
|
||||
((visit_location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}),
|
||||
((transfer_to_location as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
elseif (classTypeValue="Discharge Order")
|
||||
then
|
||||
my_req := call {{{SINGLE-QUOTE}}}OrderReconciliationRequirement{{{SINGLE-QUOTE}}}.CreateDischargeOrderRequirement
|
||||
with client_visit,
|
||||
reconcileTypeColl,
|
||||
((order_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
endif;
|
||||
|
||||
if ( client_visit is NOT NULL ) then
|
||||
void:= call client_visit.Dispose;
|
||||
client_visit:= null;
|
||||
endif;
|
||||
|
||||
my_req_list := my_req,my_req_list;
|
||||
policydef_list := policy_def,policydef_list;
|
||||
|
||||
endtry;
|
||||
catch exception ex
|
||||
my_exception := ex;
|
||||
|
||||
if ( client_visit is NOT NULL ) then
|
||||
void:= call client_visit.Dispose;
|
||||
client_visit:= null;
|
||||
endif;
|
||||
|
||||
index_list := 1 seqto (count my_req_list);
|
||||
for ind in index_list do
|
||||
req_obj := my_req_list[ind];
|
||||
if ( req_obj is NOT NULL ) then
|
||||
void:= call req_obj.Dispose;
|
||||
req_obj:= null;
|
||||
endif;
|
||||
enddo;
|
||||
endcatch;
|
||||
|
||||
endif; // if(policy_def is NOT NULL)
|
||||
|
||||
endif; //if EvokingEvent = client_visit_enter_event
|
||||
|
||||
//******************************//
|
||||
// //
|
||||
// Populate Requirement //
|
||||
// //
|
||||
//******************************//
|
||||
//populate order reconciliation requirement with values
|
||||
if (policy_record_found)
|
||||
then
|
||||
index_list := 1 seqto count(my_req_list);
|
||||
for ind in index_list do
|
||||
req := my_req_list[ind];
|
||||
def := policydef_list[ind];
|
||||
|
||||
if (def.AutoLinkTimeFrame is not Null)
|
||||
then
|
||||
req.AutoLinkTimeframeHours := def.AutoLinkTimeFrame as {{{SINGLE-QUOTE}}}System.Int32{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if (def.RequirementPrecedence is not Null)
|
||||
then
|
||||
req.Precedence := def.RequirementPrecedence as {{{SINGLE-QUOTE}}}System.Int32{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if (def.RequirementPrecedenceTime is not Null)
|
||||
then
|
||||
req.PrecedenceTimeframeHours := def.RequirementPrecedenceTime
|
||||
as {{{SINGLE-QUOTE}}}System.Int32{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if (def.OverDueDtmHours is not Null)
|
||||
then
|
||||
req.OverdueAfter := (NOW + (def.OverDueDtmHours hours))
|
||||
as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if (def.RequirementCleanupDtmHours is not Null)
|
||||
then
|
||||
req.InactivateAfter := (NOW + (def.RequirementCleanupDtmHours hours))
|
||||
as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
//Define the XA Object Destination for Requirement
|
||||
Reqt_Destination:= destination { XAObject } with [xaobject := req];
|
||||
|
||||
enddo; // ind in index_list do
|
||||
endif; //if(policy_record_found)
|
||||
|
||||
|
||||
;;
|
||||
evoke:
|
||||
|
||||
// client_visit_modify_event OR
|
||||
//client_visit_discharge_event OR
|
||||
order_enter_event OR
|
||||
order_modify_event
|
||||
|
||||
;;
|
||||
|
||||
logic:
|
||||
if (policy_record_found) and (overridebyloc = false)
|
||||
then
|
||||
conclude TRUE;
|
||||
else
|
||||
conclude FALSE;
|
||||
endif //(policy_record_found)
|
||||
;;
|
||||
action:
|
||||
|
||||
if (error_occured)
|
||||
then
|
||||
write my_exception at error_destination;
|
||||
else
|
||||
Write true at Reqt_Destination ;
|
||||
|
||||
endif; //(error_occured)
|
||||
|
||||
;;
|
||||
|
||||
Urgency: 50;;
|
||||
end:
|
||||
236
MLMStripper/bin/Debug/SCH/SCH_CREATE_REQUEST_BED_ORDER.mlm
Normal file
236
MLMStripper/bin/Debug/SCH/SCH_CREATE_REQUEST_BED_ORDER.mlm
Normal file
@@ -0,0 +1,236 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Create_Request_Bed_Order ;;
|
||||
mlmname: SCH_Create_Request_Bed_Order ;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;; // FP1
|
||||
institution: SCH ;;
|
||||
author: Shivprasad Jadhav ;;
|
||||
specialist: ;;
|
||||
date: 2014-03-13;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Creates and saves prefilled and standard orders using ObjectsPlus.
|
||||
Each order will be saved directly to the database once the order on the
|
||||
worksheet is saved.
|
||||
|
||||
;;
|
||||
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.
|
||||
|
||||
;;
|
||||
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}}};
|
||||
include standard_libs;
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
// References the LOCAL SESSION object
|
||||
local_session := cds_session.local; // for local_session.SessionRequestBed
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
|
||||
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 := read { UNSUBMITTED ORDER: Name};
|
||||
//Document_Modify := event {ClientDocumentModify User ClientDocument: where documentname in ("Pediatric Patient Profile")};
|
||||
|
||||
|
||||
|
||||
( careProvider_obj ) := read last{ UserInfo: careProvider };
|
||||
( careProvider_Actaul ) := read last{ UserInfo: This };
|
||||
|
||||
/*user_IDType := "Primary";
|
||||
|
||||
CareProviderIDs_obj := read last
|
||||
{ CareProvider: CareProviderID
|
||||
REFERENCING careProvider_obj };
|
||||
|
||||
user_IDCode := read last
|
||||
{ CareProviderID: IDCode
|
||||
REFERENCING CareProviderIDs_obj
|
||||
where ProviderIDTypeCode = user_IDType }; */
|
||||
|
||||
|
||||
(location_guid, Active_ClientVisitGUID, client_guid) := read last
|
||||
{ ClientVisit: CurrentLocationGUID, GUID, clientguid };
|
||||
|
||||
Care_Provider := local_session.SessionRequestedGUID; // careprovider_obj.GUID ; //EVOKINGOBJECT.AuthoredProviderGUID;
|
||||
visitGuid := EVOKINGOBJECT.GUID ;
|
||||
|
||||
|
||||
(LocationLevelCode) := read last { "select Top 1 case when cc.typecode = {{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then cc.levelcode when b.typecode={{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then b.levelcode when a.typecode={{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then a.levelcode "
|
||||
|| " when cv3l.typecode={{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then cv3l.levelcode else null end as Unit From CV3ClientVisit CV With (nolock) "
|
||||
|| " Inner Join Cv3Location L With (nolock) On L.Guid=CV.CurrentLocationGUID AND CV.Active=1 AND CV.VisitStatus={{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}} "
|
||||
|| " Left Join Cv3ClientVisitLocation CVL With (nolock) ON CVL.ClientVisitGUID=CV.GUID Left Join CV3Location CV3L On CV3L.GUID=CVL.LocationGUID "
|
||||
|| " Left Join CV3Location a With (nolock) on CV3L.parentguid= a.guid Left Join CV3Location b With (nolock) on a.parentguid = b.guid "
|
||||
|| " left join cv3location cc With (nolock) on b.parentguid = cc.guid "
|
||||
|| " WHERE CVL.Status={{{SINGLE-QUOTE}}}CUR{{{SINGLE-QUOTE}}} and CV.GUID = " || visitGuid || " " };
|
||||
|
||||
|
||||
//If (EVOKINGOBJECT.TypeCode = "EMERGENCY" or EVOKINGOBJECT.TypeCode = "Observation" ) Then
|
||||
If LocationLevelCode In ("5","6","ER") Then
|
||||
If ( "Place in Observation" In onames ) or ( "Admit to Inpatient" In onames ) Then
|
||||
|
||||
|
||||
(Typecode, Username ) := Read first {" Select Typecode, DisplayName from CV3CareProvider With (nolock) Where GUID = " || Care_Provider || " "} ;
|
||||
location_guid := Read First {" Select CurrentLocationGUID from CV3ClientVisit With (nolock) Where GUID = " || visitGuid || " "} ;
|
||||
|
||||
If Typecode is Not in ("PA","CRNP") Then
|
||||
CareProvider_GUID := Care_Provider ;
|
||||
Else
|
||||
CareProvider_GUID := Read First {" Select GUID from CV3CareProvider With (nolock) Where DisplayName = {{{SINGLE-QUOTE}}}Biggs, Jason {{{SINGLE-QUOTE}}} "} ;
|
||||
Endif;
|
||||
|
||||
|
||||
|
||||
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 ];
|
||||
|
||||
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 ];
|
||||
|
||||
|
||||
|
||||
IF(visitGuid IS NOT NULL) THEN
|
||||
try
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
WSSessionType := "Standard";//"Inpatient Orders";//Standard";//"
|
||||
WSSessionReason := "";
|
||||
WSRequestedBySource := "";//"1 Standard";
|
||||
|
||||
WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( CareProvider_GUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
|
||||
|
||||
WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid 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;
|
||||
|
||||
endcatch;
|
||||
ENDIF;
|
||||
|
||||
if (client_visit_obj is not null) then
|
||||
try
|
||||
|
||||
Catalog_Item_Name := "Request Bed";
|
||||
order_Creation_Reason := "Order Created From MLM";
|
||||
|
||||
// get OrderCatalogMasterItem ObjectsPlus object
|
||||
diagnostic_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
|
||||
DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
diagnostic_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
||||
order_Creation_Reason, // CreateReason
|
||||
wsRequestedBy_obj, // RequestedBy ObjectsPlus object
|
||||
wsRequestedBySource, // string RequestedBySource (must be in dictionary)
|
||||
wsSessionType, // string SessionType
|
||||
wsSessionReason, // string SessionReason
|
||||
wslocation_obj, // Location ReleaseLocGrpID
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
|
||||
|
||||
|
||||
|
||||
DiagnosticOrder_obj.SpecialInstructions := local_session.SessionRequestBed ; //"ABCD" ; //StrFinal ; //"Instruction text from MLM";
|
||||
local_session.SessionRequestBed := Null ;
|
||||
//void := DiagnosticOrder_obj.save;
|
||||
|
||||
DiagnosticOrder_dest.ObjectsPlus := DiagnosticOrder_obj;
|
||||
void := call DiagnosticOrder_obj.save; ///To Save The Order To SCM
|
||||
|
||||
|
||||
endtry;
|
||||
catch Exception ex
|
||||
|
||||
error_occurred := true;
|
||||
error_message := error_message || "{{+R}}New general order:{{-R}}\n" ||
|
||||
ex.Message || "\n\n";
|
||||
|
||||
if ( Catalog_Item_Name is NOT NULL ) then
|
||||
void:= call Catalog_Item_Name.Dispose;
|
||||
Catalog_Item_Name:= null;
|
||||
endif;
|
||||
|
||||
if ( DiagnosticOrder_obj is NOT NULL ) then
|
||||
void:= call DiagnosticOrder_obj.Dispose;
|
||||
DiagnosticOrder_obj:= null;
|
||||
endif;
|
||||
|
||||
endcatch;
|
||||
ENDIF;
|
||||
|
||||
Endif;
|
||||
//Else
|
||||
|
||||
//dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " We Cannot Place the {{{SINGLE-QUOTE}}}Request Bed{{{SINGLE-QUOTE}}} order in "|| EVOKINGOBJECT.TypeCode || " Visit type ", "Important Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
Endif;
|
||||
|
||||
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: Order_Submit;
|
||||
//Document_Modify;
|
||||
;;
|
||||
logic:
|
||||
|
||||
if EvokingObject is null
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,157 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Create_RODS_Order_From_ED_Registration_Event;;
|
||||
mlmname: SCH_Create_RODS_Order_From_ED_Registration_Event;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: St Clair Cancel Account Order MLM;;
|
||||
author: Don Warnick, Allscripts Corp;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2011-05-19;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: purpose: Generate a RODS order at the time of an ED registration
|
||||
;;
|
||||
explanation: When an ED Registration occurs, a RODS order is created
|
||||
|
||||
Change history
|
||||
|
||||
05.19.2011 DW Created
|
||||
|
||||
;;
|
||||
keywords: RODS Order, HL7, Asynchronous Alert
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
error_occurred := false;
|
||||
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid) := read last {ClientVisit: GUID, ChartGUID, ClientGUID REFERENCING EvokingObject};
|
||||
(UserGUID ) := read last { UserInfo: GUID };
|
||||
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
|
||||
clientvisit_enter_event := Event {ClientVisitEnter ANY ClientVisit: where TypeCode = "emergency"};
|
||||
|
||||
rods_alert := destination { Alert: warning, "RODS Order Created", high, chart, "RODS Order Created", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
|
||||
GeneralOrder_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Order Object",
|
||||
rule_number := 2010 ];
|
||||
|
||||
|
||||
orderItemName := "RODS";
|
||||
|
||||
IF exists orderItemName THEN
|
||||
|
||||
try
|
||||
|
||||
SessionType := "Standard";
|
||||
SessionReason := "";
|
||||
RequestingSource := "";
|
||||
user_IDType := "Edstan Number (physician)";
|
||||
order_Creation_Reason := "From Test MLM";
|
||||
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
user_IDCode := read last {"SELECT IDCode FROM CV3User with (nolock) " || " where GUID = " || UserGUID};
|
||||
RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
|
||||
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit with (nolock) where ClientGUID = " || ClientGUID};
|
||||
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
AdmittingDx := read last {"Select text from CV3HealthIssueDeclaration with (nolock) where TypeCode = {{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}} and Active = 1
|
||||
and ClientGuid = " || ClientGuid || " and ChartGuid = " || ChartGuid || " and ClientVisitGuid = " || ClientVisitGuid};
|
||||
|
||||
EmployerZip := read last {"Select a.postalcode from SXAAMClientEmployment ce with (nolock)
|
||||
join SXAAMEmployer e with (nolock) on e.employerid = ce.employerid
|
||||
join SXAAMEmployerAddress ea with (nolock) on ea.employerid = e.employerid
|
||||
join cv3Address a with (nolock) on a.guid = ea.AddressGUID
|
||||
where ce.clientvisitguid = " || ClientVisitGuid || " and a.Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
PatientZip := read last {"select postalcode from cv3Address with (nolock)
|
||||
where ParentGUID = " || ClientGuid || " and Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
SpecialInstructions := AdmittingDx || "...." || PatientZip || "...." || EmployerZip;
|
||||
|
||||
|
||||
general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with orderItemName;
|
||||
|
||||
GeneralOrder_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
general_catalog_item, // CatalogMasterItem ObjectsPlus
|
||||
//object
|
||||
order_Creation_Reason, // CreateReason
|
||||
RequestingCareProvider_obj, // RequestingProvider
|
||||
//ObjectsPlus object
|
||||
RequestingSource, // string requestingSource
|
||||
//(must be in dictionary)
|
||||
SessionType, // string SessionType
|
||||
SessionReason, // string SessionReason
|
||||
location_obj, // Location ReleaseLocGrpID
|
||||
"Never" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
|
||||
//"NoOverride" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
|
||||
//AvailabilityOverride eAvailabilityOverride
|
||||
|
||||
// Set standard fields on the order entry form
|
||||
GeneralOrder_obj.RequestedDate := "T";
|
||||
GeneralOrder_obj.SpecialInstructions := SpecialInstructions;
|
||||
|
||||
GeneralOrder_dest.ObjectsPlus := GeneralOrder_obj;
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
debugFlag := TRUE;
|
||||
messageText := messageText || "New general order:\n" ||
|
||||
ex.Message || "\n\n";
|
||||
|
||||
if ( general_catalog_item is NOT NULL ) then void:= call general_catalog_item.Dispose; general_catalog_item:= null; endif;
|
||||
if ( GeneralOrder_obj is NOT NULL ) then void:= call GeneralOrder_obj.Dispose; GeneralOrder_obj:= null; endif;
|
||||
GeneralOrder_dest := null;
|
||||
endcatch;
|
||||
|
||||
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
|
||||
if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj:= null; endif;
|
||||
|
||||
|
||||
ENDIF; // end of orderItemName
|
||||
|
||||
|
||||
;;
|
||||
evoke: 1 minutes after time of clientvisit_enter_event;
|
||||
;;
|
||||
logic:
|
||||
Conclude true ;
|
||||
;;
|
||||
action:
|
||||
|
||||
if error_occurred then
|
||||
write "An error has occured in the MLM {{+B}}SCH_Create_RODS_Order_From_ED_Registration_Event{{-B}} " ||
|
||||
"Please notify your System Administrators that an error message has occurred " ||
|
||||
"message: \n" at rods_alert;
|
||||
write messageText at rods_alert;
|
||||
endif;
|
||||
|
||||
if EXISTS GeneralOrder_dest then
|
||||
write true at GeneralOrder_dest;
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,495 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CREATE_SIGNIFICANT_EVENT_FROM_TRANSFUSE_ORDER;;
|
||||
mlmname: SCH_CREATE_SIGNIFICANT_EVENT_FROM_TRANSFUSE_ORDER;;
|
||||
arden: version 2;;
|
||||
version: 5.50;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Eclipsys;;
|
||||
specialist: ;;
|
||||
date: 2011-12-13;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Chart a Significant Event when an order is initiated for transfusion with attributes.
|
||||
;;
|
||||
explanation: Transfusion Attributes
|
||||
Change history
|
||||
|
||||
12.14.2011 TS Created for CSR 26619
|
||||
2.26.2016 STH CSR#: 32165 - Update Order name, remove CMV code, and test with new order sets
|
||||
|
||||
;;
|
||||
keywords: Create Significant Event, Transfusion Attributes;
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
/* Set to true if logging is needed.*/
|
||||
log_execution_info:= FALSE;
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
// Use String parse
|
||||
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
||||
|
||||
any_transfusion_order:= event { OrderEnter User Order:
|
||||
WHERE Name in ("Nursing Transfusion Order", "Platelet Products","Red Cell Products")};
|
||||
|
||||
(order_name,order_summaryline) := read last
|
||||
{Order: Name, summaryline REFERENCING EvokingObject };
|
||||
|
||||
leuk_att := "Leukocyte Reduction Filter";
|
||||
//cmv_att := "CMV Negative";
|
||||
hemo_att := "Hemoglobin S Negative";
|
||||
irr_att := "Irradiated";
|
||||
Unsub_HemoSNegative := False;
|
||||
//Unsub_CMV_NegProInd := False;
|
||||
Unsub_IrradiatedInd := False;
|
||||
Unsub_LeukReduction :=False;
|
||||
|
||||
|
||||
|
||||
if called_by_editor then
|
||||
ClientGuid := 9000001923700200;
|
||||
ClientVisitGuid := 9000002931500270;
|
||||
//EvokingObject := read last {Order: THIS
|
||||
// WHERE Name = ("Nursing Transfusion Order") };
|
||||
endif;
|
||||
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Define the ObjectsPlus destinations
|
||||
//------------------------------------------------------------
|
||||
|
||||
LeukRedSignificantEvent_dest:= destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "General",
|
||||
rule_group := "Significant Event Object",
|
||||
rule_number := 2010 ];
|
||||
|
||||
HemSNegSignificantEvent_dest:= destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "General",
|
||||
rule_group := "Significant Event Object",
|
||||
rule_number := 2011 ];
|
||||
|
||||
|
||||
IrradSignificantEvent_dest:= destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "General",
|
||||
rule_group := "Significant Event Object",
|
||||
rule_number := 2012 ];
|
||||
|
||||
/*
|
||||
CMVNegSignificantEvent_dest:= destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "General",
|
||||
rule_group := "Significant Event Object",
|
||||
rule_number := 2013 ];
|
||||
*/
|
||||
//---------------------------------------------------------------
|
||||
// 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 ];
|
||||
|
||||
|
||||
clientGUID := read last { ClientInfo: GUID };
|
||||
ClientVisitGuid := read last { ClientVisit: GUID };
|
||||
|
||||
|
||||
(ProductIndList) := read
|
||||
{
|
||||
" select description "
|
||||
|| "from cv3ClientEventDeclaration with (nolock) "
|
||||
|| "where clientguid = " || ClientGuid || " and status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|
||||
|| "and typecode = {{{SINGLE-QUOTE}}}Blood Transfusion{{{SINGLE-QUOTE}}} "
|
||||
};
|
||||
|
||||
|
||||
/* Get the list of UNSUBMITTED ORDERS */
|
||||
( order_name_list, unsub_summaryline) := read
|
||||
{ UNSUBMITTED Order: Name, SummaryLine };
|
||||
|
||||
/* check for presence of attributes in current order summary line */
|
||||
If order_summaryline Matches Pattern "%-Leukocyte Reduction Filter%" then
|
||||
LeukReduction := True;
|
||||
Else LeukReduction := False;
|
||||
Endif;
|
||||
|
||||
If order_summaryline Matches Pattern "%-Irradiated%" then
|
||||
IrradiatedInd := True;
|
||||
Else IrradiatedInd := False;
|
||||
Endif;
|
||||
/*
|
||||
If order_summaryline Matches Pattern "%-CMV Negative%" then
|
||||
CMV_NegProInd := True;
|
||||
Else CMV_NegProInd := False;
|
||||
Endif;
|
||||
*/
|
||||
If order_summaryline Matches Pattern "%-Hemoglobin S Negative%" then
|
||||
HemoSNegative := True;
|
||||
Else HemoSNegative := False;
|
||||
Endif;
|
||||
|
||||
/* check for presence of attributes in unsubmitted orders summary line */
|
||||
|
||||
findleuk := FIND leuk_att IN STRING unsub_summaryline;
|
||||
//findcmv := FIND cmv_att IN STRING unsub_summaryline;
|
||||
findhemo := FIND hemo_att IN STRING unsub_summaryline;
|
||||
findirr := FIND irr_att IN STRING unsub_summaryline;
|
||||
|
||||
|
||||
for j in 1 seqto count findleuk do
|
||||
If findleuk [j] > 0 then
|
||||
Unsub_LeukReduction := True;
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
for r in 1 seqto count findhemo do
|
||||
If findhemo [r] > 0 then
|
||||
Unsub_HemoSNegative := True;
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
for s in 1 seqto count findirr do
|
||||
If findirr [s] > 0 then
|
||||
Unsub_IrradiatedInd := True;
|
||||
endif;
|
||||
enddo;
|
||||
/*
|
||||
for l in 1 seqto count findcmv do
|
||||
If findcmv [l] > 0 then
|
||||
Unsub_CMV_NegProInd := True;
|
||||
endif;
|
||||
enddo;
|
||||
*/
|
||||
|
||||
//dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Unsub_IrradiatedInd : " || Unsub_IrradiatedInd || "\n Unsub_HemoSNegative : " || Unsub_HemoSNegative || "\n Unsub_LeukReduction : " || Unsub_LeukReduction || "\n Unsub_CMV_NegProInd: " || Unsub_CMV_NegProInd ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
/*check for attributes already listed as significant events */
|
||||
|
||||
If "Leukoreduced Products Indicated" in ProductIndList then
|
||||
SE_LeukReduction := True;
|
||||
Else SE_LeukReduction := False;
|
||||
endif;
|
||||
|
||||
If "Hemoglobin S Negative Products Indicated" in ProductIndList then
|
||||
SE_HemoSNegative := True;
|
||||
Else SE_HemoSNegative := False;
|
||||
endif;
|
||||
|
||||
If "Irradiated Products Indicated" in ProductIndList then
|
||||
SE_IrradiatedInd := True;
|
||||
Else SE_IrradiatedInd := False;
|
||||
endif;
|
||||
/*
|
||||
If "CMV Negative Products Indicated" in ProductIndList then
|
||||
SE_CMV_NegProInd := True;
|
||||
Else SE_CMV_NegProInd := False;
|
||||
endif;
|
||||
*/
|
||||
/* Set flag to create attribute for current order only if no exisiting significant event exists and previous unsubmitted order did not set flag */
|
||||
/*
|
||||
If (CMV_NegProInd = True and SE_CMV_NegProInd = False and Unsub_CMV_NegProInd = False) then
|
||||
Create_CMV_NegProInd := True;
|
||||
Else Create_CMV_NegProInd := False;
|
||||
Endif;
|
||||
*/
|
||||
If (HemoSNegative = True and SE_HemoSNegative = False and Unsub_HemoSNegative = False) then
|
||||
Create_HemoSNegative := True;
|
||||
Else Create_HemoSNegative := False;
|
||||
Endif;
|
||||
|
||||
If (IrradiatedInd = True and SE_IrradiatedInd = False and Unsub_IrradiatedInd = False) then
|
||||
Create_IrradiatedInd := True;
|
||||
Else Create_IrradiatedInd := false;
|
||||
Endif;
|
||||
|
||||
If (LeukReduction = True and SE_LeukReduction = False and Unsub_LeukReduction = False) then
|
||||
Create_LeukReduction:= True;
|
||||
Else Create_LeukReduction := false;
|
||||
Endif;
|
||||
|
||||
|
||||
|
||||
;;
|
||||
evoke: any_transfusion_order;
|
||||
|
||||
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
|
||||
if called_by_editor then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
try
|
||||
|
||||
//get the .NET version of the Client Visit object. Needed to create new ObjectsPlus objects
|
||||
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((EvokingObject.ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Retrieve client:{{-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 the client object cannot be retrieved, do not attempt
|
||||
// to create any ObjectsPlus objects.
|
||||
endcatch;
|
||||
|
||||
|
||||
if ((Create_HemoSNegative = False) and (Create_IrradiatedInd = False) and
|
||||
/*(Create_CMV_NegProInd = False) and */(Create_LeukReduction = False))
|
||||
then
|
||||
conclude false;
|
||||
else
|
||||
TimeOfEntry := now ;
|
||||
|
||||
yr := extract year TimeOfEntry;
|
||||
mn := extract month TimeOfEntry;
|
||||
dd := extract day TimeOfEntry;
|
||||
|
||||
PartialDate_obj := new net_object {{{SINGLE-QUOTE}}}PartialDate{{{SINGLE-QUOTE}}} with (
|
||||
yr as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, // Year
|
||||
mn as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, // Month
|
||||
dd as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}} ); // Day
|
||||
|
||||
BBEventTypeCode := "Blood Transfusion";
|
||||
BBEventText := "Entered from Transfuse Order";
|
||||
|
||||
endif;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// New Significant Event for Leukoreduced Products
|
||||
//-------------------------------------------------------------
|
||||
try
|
||||
If Create_LeukReduction = True then
|
||||
LeukRedEventText := "Leukoreduced Products Indicated";
|
||||
|
||||
// Create an Instance for Significant Event
|
||||
LeukRedEvent_obj := call {{{SINGLE-QUOTE}}}SignificantEvent{{{SINGLE-QUOTE}}}.CreateSignificantEvent
|
||||
with
|
||||
(client_visit_obj, //ClientVisit
|
||||
BBEventTypeCode, //TypeCode
|
||||
LeukRedEventText); //Event
|
||||
|
||||
// Add more to the data to be inserted
|
||||
LeukRedEvent_obj.Text := BBEventText;
|
||||
LeukRedEvent_obj.OnsetDate := PartialDate_obj;
|
||||
LeukRedSignificantEvent_dest.ObjectsPlus := LeukRedEvent_obj;
|
||||
endif;
|
||||
endtry;
|
||||
|
||||
catch exception ex
|
||||
error_occurred := true;
|
||||
error_message := error_message ||
|
||||
"{{+R}}New Significant Event{{-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 ( LeukRedEvent_obj is NOT NULL ) then
|
||||
void:= call LeukRedEvent_obj.Dispose;
|
||||
LeukRedEvent_obj:= null;
|
||||
endif;
|
||||
|
||||
LeukRedSignificantEvent_dest := null;
|
||||
endcatch;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// New Significant Event for Hemoglobin S Negative
|
||||
//-------------------------------------------------------------
|
||||
try
|
||||
If Create_HemoSNegative = True then
|
||||
|
||||
HemSNegEventText := "Hemoglobin S Negative Products Indicated";
|
||||
|
||||
// Create an Instance for Significant Event
|
||||
HemSNegEvent_obj := call {{{SINGLE-QUOTE}}}SignificantEvent{{{SINGLE-QUOTE}}}.CreateSignificantEvent
|
||||
with
|
||||
(client_visit_obj, //ClientVisit
|
||||
BBEventTypeCode, //TypeCode
|
||||
HemSNegEventText); //Event
|
||||
|
||||
// Add more to the data to be inserted
|
||||
HemSNegEvent_obj.Text := BBEventText;
|
||||
HemSNegEvent_obj.OnsetDate := PartialDate_obj;
|
||||
HemSNegSignificantEvent_dest.ObjectsPlus := HemSNegEvent_obj;
|
||||
endif;
|
||||
endtry;
|
||||
|
||||
catch exception ex
|
||||
error_occurred := true;
|
||||
error_message := error_message ||
|
||||
"{{+R}}New Significant Event{{-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 ( HemSNegEvent_obj is NOT NULL ) then
|
||||
void:= call HemSNegEvent_obj.Dispose;
|
||||
HemSNegEvent_obj:= null;
|
||||
endif;
|
||||
|
||||
HemSNegSignificantEvent_dest := null;
|
||||
endcatch;
|
||||
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// New Significant Event for Irradiated Products
|
||||
//-------------------------------------------------------------
|
||||
|
||||
try
|
||||
If Create_IrradiatedInd = True then
|
||||
IrradEventText := "Irradiated Products Indicated";
|
||||
|
||||
// Create an Instance for Significant Event
|
||||
IrradEvent_obj := call {{{SINGLE-QUOTE}}}SignificantEvent{{{SINGLE-QUOTE}}}.CreateSignificantEvent
|
||||
with
|
||||
(client_visit_obj, //ClientVisit
|
||||
BBEventTypeCode, //TypeCode
|
||||
IrradEventText); //Event
|
||||
|
||||
|
||||
// Add more to the data to be inserted
|
||||
IrradEvent_obj.Text := BBEventText;
|
||||
IrradEvent_obj.OnsetDate := PartialDate_obj;
|
||||
IrradSignificantEvent_dest.ObjectsPlus := IrradEvent_obj;
|
||||
endif;
|
||||
endtry;
|
||||
|
||||
catch exception ex
|
||||
error_occurred := true;
|
||||
error_message := error_message ||
|
||||
"{{+R}}New Significant Event{{-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 ( IrradEvent_obj is NOT NULL ) then
|
||||
void:= call IrradEvent_obj.Dispose;
|
||||
IrradEvent_obj:= null;
|
||||
endif;
|
||||
|
||||
IrradSignificantEvent_dest := null;
|
||||
endcatch;
|
||||
/*
|
||||
try
|
||||
if Create_CMV_NegProInd = true then
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// New Significant Event for CMV Negative Products
|
||||
//-------------------------------------------------------------
|
||||
|
||||
CMVNegEventText := "CMV Negative Products Indicated";
|
||||
|
||||
// Create an Instance for Significant Event
|
||||
CMVNegEvent_obj := call {{{SINGLE-QUOTE}}}SignificantEvent{{{SINGLE-QUOTE}}}.CreateSignificantEvent
|
||||
with
|
||||
(client_visit_obj, //ClientVisit
|
||||
BBEventTypeCode, //TypeCode
|
||||
CMVNegEventText); //Event
|
||||
|
||||
// Add more to the data to be inserted
|
||||
CMVNegEvent_obj.Text := BBEventText;
|
||||
CMVNegEvent_obj.OnsetDate := PartialDate_obj;
|
||||
CMVNegSignificantEvent_dest.ObjectsPlus := CMVNegEvent_obj;
|
||||
|
||||
endif;
|
||||
endtry;
|
||||
|
||||
catch exception ex
|
||||
error_occurred := true;
|
||||
error_message := error_message ||
|
||||
"{{+R}}New Significant Event{{-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 ( CMVNegEvent_obj is NOT NULL ) then
|
||||
void:= call CMVNegEvent_obj.Dispose;
|
||||
CMVNegEvent_obj:= null;
|
||||
endif;
|
||||
|
||||
CMVNegSignificantEvent_dest := null;
|
||||
endcatch;
|
||||
*/
|
||||
if ( client_visit_obj is NOT NULL ) then
|
||||
void:= call client_visit_obj.Dispose;
|
||||
client_visit_obj:= null;
|
||||
endif;
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
if Error_occurred
|
||||
then
|
||||
write "An error has occured in the MLM {{+B}}SCH_CREATE_SIGNIFICANT_EVENT_FROM_ORDER{{-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;
|
||||
|
||||
|
||||
if EXISTS LeukRedSignificantEvent_dest then
|
||||
write true at LeukRedSignificantEvent_dest;
|
||||
endif;
|
||||
|
||||
if EXISTS HemSNegSignificantEvent_dest then
|
||||
write true at HemSNegSignificantEvent_dest;
|
||||
endif;
|
||||
|
||||
if EXISTS IrradSignificantEvent_dest then
|
||||
write true at IrradSignificantEvent_dest;
|
||||
endif;
|
||||
/*
|
||||
if EXISTS CMVNegSignificantEvent_dest then
|
||||
write true at CMVNegSignificantEvent_dest;
|
||||
endif;
|
||||
*/
|
||||
;;
|
||||
|
||||
Urgency: 50;;
|
||||
end:
|
||||
253
MLMStripper/bin/Debug/SCH/SCH_CREATE_SODIUM_FROM_RESULT.mlm
Normal file
253
MLMStripper/bin/Debug/SCH/SCH_CREATE_SODIUM_FROM_RESULT.mlm
Normal 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:
|
||||
138
MLMStripper/bin/Debug/SCH/SCH_CRP_ESR_LIPASE_AMYLASE_ALERT.mlm
Normal file
138
MLMStripper/bin/Debug/SCH/SCH_CRP_ESR_LIPASE_AMYLASE_ALERT.mlm
Normal file
@@ -0,0 +1,138 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CRP_ESR_Lipase_Amylase_Alert;;
|
||||
mlmname: SCH_CRP_ESR_Lipase_Amylase_Alert;;
|
||||
arden: version 2.5;;
|
||||
version: 15.3;;
|
||||
institution: ;;
|
||||
author: Maria Pest;;
|
||||
specialist: ;;
|
||||
date: 2018-04-17;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
;;
|
||||
explanation:
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
04.17.2018 DJW CSR# 36318 - Created
|
||||
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
Order_Event_Init := event{OrderInit User Order : WHERE Name IN ("Sedimentation Rate","Amylase Plasma/Serum") };
|
||||
|
||||
ClientGuid := EVOKINGOBJECT.ClientGUID;
|
||||
ChartGuid := EVOKINGOBJECT.ChartGUID;
|
||||
VisitGuid := EVOKINGOBJECT.ClientVisitGUID;
|
||||
|
||||
send_alert:= "DoNotSend";
|
||||
alert_dest:= destination { Alert: warning, "Test Utilization Alert", high, chart, "CRP ESR Lipase Amylase Alert MLM", 15042, send_alert, "" };
|
||||
|
||||
alert_prefix := "";
|
||||
|
||||
|
||||
// Look for current orders on file
|
||||
|
||||
CurrentOrderOnFile:= read
|
||||
{ "
|
||||
select ocmi.Description
|
||||
from CV3OrderCatalogMasterItem ocmi with (nolock)
|
||||
join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = ocmi.guid
|
||||
where ocmi.Description in ({{{SINGLE-QUOTE}}}C-Reactive Protein, Acute Phase{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lipase{{{SINGLE-QUOTE}}})
|
||||
and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) and
|
||||
o.ClientGUID = " || ClientGuid || " and o.chartguid = " || ChartGuid || " and o.clientvisitguid = " || VisitGuid || "
|
||||
"};
|
||||
|
||||
// and convert(char(10), o.createdwhen ,20) = convert(char(10), getdate(),20)
|
||||
|
||||
CreactiveFound := "no";
|
||||
AcutephaseFound:= "no";
|
||||
|
||||
for i in 1 seqto count (CurrentOrderOnFile) do
|
||||
ordername := CurrentOrderOnFile[i];
|
||||
if ordername = "C-Reactive Protein, Acute Phase" then CreactiveFound := "yes"; endif;
|
||||
if ordername = "Lipase" then AcutephaseFound := "yes"; endif;
|
||||
enddo;
|
||||
|
||||
// Look for unsubmitted orders
|
||||
|
||||
UnsubmittedCreactiveOrder:= READ {UnsubmittedOrders: Name WHERE Name = "C-Reactive Protein, Acute Phase"};
|
||||
UnsubmittedLipaseOrder := READ {UnsubmittedOrders: Name WHERE Name = "Lipase"};
|
||||
|
||||
|
||||
if EVOKINGOBJECT.Name = "Sedimentation Rate"
|
||||
|
||||
|
||||
then // Sedimentation Rate order was entered
|
||||
|
||||
|
||||
|
||||
// Customize the first sentence
|
||||
If CreactiveFound = "yes" then alert_prefix := "A CRP order has already been placed on this patient.\n\n"; endif;
|
||||
If exists UnsubmittedCreactiveOrder then alert_prefix := "A CRP order has been found amongst your unsubmitted orders.\n\n"; endif;
|
||||
If CreactiveFound = "yes" and exists UnsubmittedCreactiveOrder then alert_prefix := "A CRP order has already been placed on this patient and has been found amongst your unsubmitted orders .\n\n"; endif;
|
||||
|
||||
|
||||
// Append the rest of the message
|
||||
If alert_prefix <> ""
|
||||
|
||||
then
|
||||
|
||||
alert_message := alert_prefix
|
||||
|| "CRP is the preferred marker as it is more sensitive and specific in the acute phase of inflammation.\n\n"
|
||||
|| "Also CRP returns to normal if the source of inflammation is removed while the ESR will remain elevated for several days.\n\n"
|
||||
|| "Do you wish to proceed with the ESR order?";
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
else // Amylase Plasma/Serum order was entered
|
||||
|
||||
|
||||
// Customize the first sentence
|
||||
If AcutephaseFound = "yes" then alert_prefix := "A Lipase order has already been placed on this patient.\n\n"; endif;
|
||||
If exists UnsubmittedLipaseOrder then alert_prefix := "A Lipase order has been found amongst your unsubmitted orders.\n\n"; endif;
|
||||
If AcutephaseFound = "yes" and exists UnsubmittedLipaseOrder then alert_prefix := "A Lipase order has already been placed on this patient and has been found amongst your unsubmitted orders .\n\n"; endif;
|
||||
|
||||
|
||||
// Append the rest of the message
|
||||
If alert_prefix <> ""
|
||||
|
||||
then
|
||||
|
||||
alert_message := alert_prefix
|
||||
|| "Lipase is now the preferred test due to its improved sensitivity and its wider diagnostic window.\n\n"
|
||||
|| "Testing for both of these enzymes only marginally improves diagnostic efficiency.\n\n"
|
||||
|| "Do you wish to proceed with the Amylase order?";
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: Order_Event_Init;
|
||||
;;
|
||||
logic:
|
||||
Conclude True;
|
||||
;;
|
||||
action:
|
||||
|
||||
|
||||
If alert_prefix <> "" then write alert_message at alert_dest; endif;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
219
MLMStripper/bin/Debug/SCH/SCH_C_DIFFICILE_ORDERDISCONTINUE.mlm
Normal file
219
MLMStripper/bin/Debug/SCH/SCH_C_DIFFICILE_ORDERDISCONTINUE.mlm
Normal 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:
|
||||
325
MLMStripper/bin/Debug/SCH/SCH_DAY_OF_DISCHARGE_ALERT.mlm
Normal file
325
MLMStripper/bin/Debug/SCH/SCH_DAY_OF_DISCHARGE_ALERT.mlm
Normal file
@@ -0,0 +1,325 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_DAY_OF_DISCHARGE_ALERT;;
|
||||
mlmname: SCH_DAY_OF_DISCHARGE_ALERT;;
|
||||
arden: version 2.5;;
|
||||
version: 16.3;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Juliet M. Law;;
|
||||
specialist: Peggy Leschak;;
|
||||
date: 2019-04-12;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Alert the physician to missing DOH required information on Day of Discharge Summary eNote
|
||||
;;
|
||||
explanation: When filling out the Day of Discharge Summary eNote, the following fields are required by the DOH to contain values:
|
||||
* Hospital Course and Significant History
|
||||
* Results, Testing, Findings
|
||||
* Procedures and Treatments
|
||||
|
||||
If one or more of these fields are empty at time of document save, then the physician will receive an alert.
|
||||
|
||||
Change History
|
||||
---------------
|
||||
2019.04.12 JML CSR 38075: Created
|
||||
|
||||
;;
|
||||
keywords: ClientDocument; Day of Discharge; DOH;
|
||||
;;
|
||||
citations:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
/*******************Make Changes To Spelling And Flags In This Section*******************/
|
||||
|
||||
/* Set to true if logging is needed.*/
|
||||
log_execution_info := false;
|
||||
|
||||
/* What is the name of the Flowsheet (Clinical Document)? */
|
||||
/* If the name is changed here, it must also be changed in the EVENT statement */
|
||||
clinical_document_name := "Day of Discharge Summary eNote";
|
||||
|
||||
/* What is the name of the Observation that will be used to chart Suspected Abuse? */
|
||||
DOD_HospCourse_observation := "SCH_MDPN_DS_HospCourse";
|
||||
DOD_ReasonHosp_observation := "SCH_MDPN_DS_ReasonHospital";
|
||||
DOD_ResultReview_observation := "SCH_MDPN_Review";
|
||||
DOD_OtherResults_observation := "SCH_MDPN_Other Results";
|
||||
DOD_ProcTxReason_observation := "SCH_MDPN_DS_Proc Tx Reason";
|
||||
DOD_ProcTxFT_observation := "SCH_MDPN_DS_Proc Tx FT";
|
||||
|
||||
/* What will the user chart to indicate a positive response? */
|
||||
display_alert := false;
|
||||
check_hospital_course := false;
|
||||
check_results := false;
|
||||
check_procedures := false;
|
||||
alert_msg := "According to hospital bylaws charting is required in the following sections:";
|
||||
|
||||
|
||||
Day_of_Discharge_doc_enter := event { ClientDocumentEnter User ClientDocument:
|
||||
WHERE DocumentName = "Day of Discharge Summary eNote"};
|
||||
Day_of_Discharge_doc_modify := event { ClientDocumentModify User ClientDocument:
|
||||
WHERE DocumentName = "Day of Discharge Summary eNote"};
|
||||
|
||||
day_of_discharge_alert := destination { Alert: Warning, "Day of Discharge Alert",
|
||||
High, chart, "Day of Discharge Missing Information", 7500 };
|
||||
|
||||
|
||||
/***************************************************************************************/
|
||||
|
||||
/* This block executes only when this MLM is called by the editor */
|
||||
if called_by_editor
|
||||
then
|
||||
EvokingObject := read last {ClientDocument : THIS};
|
||||
endif;
|
||||
|
||||
/* Get the patient{{{SINGLE-QUOTE}}}s name*/
|
||||
pat_name := read last
|
||||
{ClientInfo: DisplayName };
|
||||
|
||||
/* Get the patient{{{SINGLE-QUOTE}}}s current location and ClientVisitGUID */
|
||||
(pat_location,
|
||||
pat_visit_guid ) := read last
|
||||
{ClientVisit: CurrentLocation, GUID };
|
||||
|
||||
/* Get the received document{{{SINGLE-QUOTE}}}s name, and the pointers to the PatientCareDocument, */
|
||||
/* to the flowsheet, and to the ClientObservation object */
|
||||
(received_doc_name,
|
||||
PatientCareDocObj,
|
||||
ChartFlowsheetObj,
|
||||
ClientObservationDocumentObj ) := read last
|
||||
{ClientDocument : DocumentName, PatientCareDocument, ChartFlowsheet, ClientObservationDocument
|
||||
REFERENCING EvokingObject };
|
||||
|
||||
/* Get the name of the results review observation and the pointer to */
|
||||
/* the object that has the patient{{{SINGLE-QUOTE}}}s answer to the results review */
|
||||
( HospReason_ObservationObj ) := read last { ClientObservationDocument : ClientObservation
|
||||
REFERENCING ClientObservationDocumentObj
|
||||
Where Name = DOD_ReasonHosp_observation };
|
||||
|
||||
(hosp_course_obs_display_name,
|
||||
Hosp_Course_FSListValues_obj) := read last
|
||||
{ClientObservationDocument: Name, ObsFSListValues
|
||||
REFERENCING ClientObservationDocumentObj
|
||||
WHERE Name = DOD_HospCourse_observation
|
||||
};
|
||||
|
||||
( Other_Results_ObservationObj ) := read last { ClientObservationDocument : ClientObservation
|
||||
REFERENCING ClientObservationDocumentObj
|
||||
Where Name = DOD_OtherResults_observation
|
||||
};
|
||||
|
||||
(results_review_obs_display_name,
|
||||
Results_Review_FSListValues_obj):= read last
|
||||
{ClientObservationDocument: Name, ObsFSListValues
|
||||
REFERENCING ClientObservationDocumentObj
|
||||
Where Name = DOD_ResultReview_observation
|
||||
};
|
||||
|
||||
(ProcTreatment_ObservationObj ) := read last { ClientObservationDocument : ClientObservation
|
||||
REFERENCING ClientObservationDocumentObj
|
||||
Where Name = DOD_ProcTxFT_observation };
|
||||
|
||||
(proc_reason_obs_display_name,
|
||||
Proc_Reason_FSListValues_obj) := read last
|
||||
{ClientObservationDocument : Name, ObsFSListValues
|
||||
REFERENCING ClientObservationDocumentObj
|
||||
WHERE Name = DOD_ProcTxReason_observation
|
||||
};
|
||||
|
||||
|
||||
hosp_course_list := read
|
||||
{ObsFSListValues : Value
|
||||
REFERENCING Hosp_Course_FSListValues_obj };
|
||||
|
||||
hosp_reason_value := read last { ClientObservation : ValueText
|
||||
REFERENCING HospReason_ObservationObj };
|
||||
|
||||
result_review_list := read
|
||||
{ObsFSListValues: Value
|
||||
REFERENCING Results_Review_FSListValues_obj };
|
||||
|
||||
other_results_value := read last { ClientObservation : ValueText
|
||||
REFERENCING Other_Results_ObservationObj };
|
||||
|
||||
proc_reason_list := read
|
||||
{ObsFSListValues : Value
|
||||
REFERENCING Proc_Reason_FSListValues_obj };
|
||||
|
||||
proc_treatment_value := read last { ClientObservation : ValueText
|
||||
REFERENCING ProcTreatment_ObservationObj };
|
||||
|
||||
if ( EvokingEventType = "ClientDocumentEnter" ) then
|
||||
|
||||
if ( ( count hosp_course_list = 0 ) AND ( hosp_reason_value IS NULL ) ) then
|
||||
display_alert := true;
|
||||
alert_msg := alert_msg || "\n\nHospital Course and Significant History";
|
||||
endif;
|
||||
|
||||
if ( ( count result_review_list = 0 ) AND ( other_results_value IS NULL ) ) then
|
||||
display_alert := true;
|
||||
alert_msg := alert_msg || "\n\nResults, Tests, Finding";
|
||||
endif;
|
||||
|
||||
if ( ( count proc_reason_list = 0 ) AND ( proc_treatment_value IS NULL ) ) then
|
||||
display_alert := true;
|
||||
alert_msg := alert_msg || "\n\nProcedures and Treatments";
|
||||
endif;
|
||||
|
||||
elseif ( EvokingEventType = "ClientDocumentModify" ) then
|
||||
|
||||
//Determine which required observations have already been charted
|
||||
( obsName,
|
||||
obsValueText,
|
||||
obsValueList ) := read { " SELECT ocmi.Name, obsparam.ValueText, SOBS.Value"
|
||||
|| " FROM CV3ClientDocumentCUR cd WITH (NOLOCK) JOIN CV3OBSERVATIONDOCUMENTCUR od WITH (NOLOCK)"
|
||||
|| " ON cd.GUID = od.OWNERGUID"
|
||||
|| " AND cd.ArcType = od.ArcType"
|
||||
|| " AND cd.ArcType = 0"
|
||||
|| " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
|
||||
|| " ON od.ObsMasterItemGUID = ocmi.GUID"
|
||||
|| " JOIN SXACDObservationParameter obsparam WITH (NOLOCK)"
|
||||
|| " ON cd.GUID = obsparam.OwnerGUID"
|
||||
|| " AND od.ObservationDocumentGUID = obsparam.ObservationDocumentGUID"
|
||||
|| " AND ocmi.GUID = obsparam.ObsMasterItemGUID"
|
||||
|| " LEFT JOIN SCMObsFSListValues SOBS WITH (NOLOCK)"
|
||||
|| " ON obsparam.ObservationDocumentGUID = SOBS.ParentGUID"
|
||||
|| " AND obsparam.ClientGUID = SOBS.ClientGUID"
|
||||
|| " WHERE cd.GUID = " || SQL(EVOKINGOBJECT.GUID)
|
||||
|| " AND ocmi.Name IN ({{{SINGLE-QUOTE}}}SCH_MDPN_DS_HospCourse{{{SINGLE-QUOTE}}}"
|
||||
|| " ,{{{SINGLE-QUOTE}}}SCH_MDPN_DS_ReasonHospital{{{SINGLE-QUOTE}}}"
|
||||
|| " ,{{{SINGLE-QUOTE}}}SCH_MDPN_Review{{{SINGLE-QUOTE}}}"
|
||||
|| " ,{{{SINGLE-QUOTE}}}SCH_MDPN_Other Results{{{SINGLE-QUOTE}}}"
|
||||
|| " ,{{{SINGLE-QUOTE}}}SCH_MDPN_DS_Proc Tx Reason{{{SINGLE-QUOTE}}}"
|
||||
|| " ,{{{SINGLE-QUOTE}}}SCH_MDPN_DS_Proc Tx FT{{{SINGLE-QUOTE}}}) "};
|
||||
|
||||
if ( ( NOT DOD_HospCourse_observation IN obsName ) AND ( NOT DOD_ReasonHosp_observation IN obsName ) ) then
|
||||
check_hospital_course := true;
|
||||
else
|
||||
|
||||
hosp_course_unanswered := false;
|
||||
reason_hosp_unanswered := false;
|
||||
|
||||
for i IN 1 seqto count obsName do
|
||||
if ( obsName[i] = DOD_HospCourse_observation ) then
|
||||
if ( obsValueList[i] IS NULL ) then
|
||||
hosp_course_unanswered := true;
|
||||
endif;
|
||||
endif;
|
||||
if ( obsName[i] = DOD_ReasonHosp_observation ) then
|
||||
if ( obsValueText[i] IS NULL ) then
|
||||
reason_hosp_unanswered := true;
|
||||
endif;
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
if ( ( hosp_course_unanswered = true ) AND ( reason_hosp_unanswered = true ) ) then
|
||||
check_hospital_course := true;
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
if ( ( NOT DOD_ResultReview_observation IN obsName ) AND ( NOT DOD_OtherResults_observation IN obsName ) ) then
|
||||
check_results := true;
|
||||
else
|
||||
|
||||
result_review_unanswered := false;
|
||||
other_result_unanswered := false;
|
||||
|
||||
for j IN 1 seqto count obsName do
|
||||
if ( obsName[j] = DOD_ResultReview_observation ) then
|
||||
if ( obsValueList[j] IS NULL ) then
|
||||
result_review_unanswered := true;
|
||||
endif;
|
||||
endif;
|
||||
if ( obsName[j] = DOD_OtherResults_observation ) then
|
||||
if ( obsValueText[j] IS NULL ) then
|
||||
other_result_unanswered := true;
|
||||
endif;
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
if ( ( result_review_unanswered = true ) AND ( other_result_unanswered = true ) ) then
|
||||
check_results := true;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( ( NOT DOD_ProcTxReason_observation IN obsName ) AND ( NOT DOD_ProcTxFT_observation IN obsName ) ) then
|
||||
check_procedures := true;
|
||||
else
|
||||
|
||||
proc_tx_reason_unanswered := false;
|
||||
proc_tx_ft_unanswered := false;
|
||||
|
||||
for k IN 1 seqto count obsName do
|
||||
if ( obsName[k] = DOD_ProcTxReason_observation ) then
|
||||
if ( obsValueList[k] IS NULL ) then
|
||||
proc_tx_reason_unanswered := true;
|
||||
endif;
|
||||
endif;
|
||||
if ( obsName[k] = DOD_ProcTxFT_observation ) then
|
||||
if ( obsValueText[k] IS NULL ) then
|
||||
proc_tx_ft_unanswered := true;
|
||||
endif;
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
if ( ( proc_tx_reason_unanswered = true ) AND ( proc_tx_ft_unanswered = true ) ) then
|
||||
check_procedures := true;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
//If Observation was not previously charted, check to see if it was charted this time
|
||||
if ( check_hospital_course = true ) then
|
||||
|
||||
if ( ( count hosp_course_list = 0 ) AND ( hosp_reason_value IS NULL ) ) then
|
||||
display_alert := true;
|
||||
alert_msg := alert_msg || "\n\nHospital Course and Significant History";
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
if ( check_results = true ) then
|
||||
|
||||
if ( ( count result_review_list = 0 ) AND ( other_results_value IS NULL ) ) then
|
||||
display_alert := true;
|
||||
alert_msg := alert_msg || "\n\nResults, Tests, Finding";
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
if ( check_procedures = true ) then
|
||||
|
||||
if ( ( count proc_reason_list = 0 ) AND ( proc_treatment_value IS NULL ) ) then
|
||||
display_alert := true;
|
||||
alert_msg := alert_msg || "\n\nProcedures and Treatments";
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
|
||||
evoke: Day_of_Discharge_doc_enter ;
|
||||
Day_of_Discharge_doc_modify;
|
||||
;;
|
||||
|
||||
logic: conclude true;
|
||||
;;
|
||||
|
||||
action:
|
||||
/*---------------------------------------------------*/
|
||||
/* Always write an asynchronous alert to the chart */
|
||||
/*---------------------------------------------------*/
|
||||
if ( display_alert = true ) then
|
||||
write alert_msg
|
||||
at day_of_discharge_alert;
|
||||
endif;
|
||||
|
||||
;;
|
||||
end:
|
||||
198
MLMStripper/bin/Debug/SCH/SCH_DIAG_WRITE_ORDER.mlm
Normal file
198
MLMStripper/bin/Debug/SCH/SCH_DIAG_WRITE_ORDER.mlm
Normal file
@@ -0,0 +1,198 @@
|
||||
maintenance:
|
||||
|
||||
title: Writes a repeating lab order to the worksheet ;;
|
||||
mlmname: SCH_DIAG_WRITE_ORDER;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: SCH ;;
|
||||
author: ;;
|
||||
specialist: ;;
|
||||
date: 2012-06-15;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Receive destination and write it.
|
||||
Makes for multiple calls and hence writes on the order submit button.
|
||||
;;
|
||||
|
||||
explanation:
|
||||
Called from FORM_SET_REPEAT_LAB_ORDERS to create diagnostic order and place on worksheet.
|
||||
Change history
|
||||
06.15.2012 TMS Created in DEV
|
||||
11.26.2012 TMS Moved to Production
|
||||
02.25.2013 TMS Added logic to look for heparin orders for APTT heparin status
|
||||
Missing from first repeat order, identified during AM Rounds project. HD Ticket 156616
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
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}}};
|
||||
include standard_libs;
|
||||
local_session := CDS_SESSION.local;
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
|
||||
log_execution_info := false;
|
||||
(ordername, modname,vername, worksheetInfo, stime1, stimehr, stimemin, hepstatus,
|
||||
//Active_OrderGUID,
|
||||
//Active_SignificiantDtm,
|
||||
client_visit_obj
|
||||
) := argument;
|
||||
|
||||
|
||||
|
||||
DiagnosticOrder_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM, placed on worksheet",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Order Object",
|
||||
rule_number := 2010
|
||||
];
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// 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 := 1004,
|
||||
Rule_subgroup := "",
|
||||
Send_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true
|
||||
];
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Create a new Laboratory order from a Pre-Filled item
|
||||
// Place the order onto the order entry worksheet
|
||||
//---------------------------------------------------------------
|
||||
try
|
||||
|
||||
Catalog_Item_Name := (ordername as String);
|
||||
Catalog_Item_Modifier := (modname as String);
|
||||
Catalog_Item_Version := (vername as String);
|
||||
order_Creation_Reason := "Repeat Lab Orders";
|
||||
|
||||
// get OrderCatalogMasterItem ObjectsPlus object
|
||||
Laboratory_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
|
||||
with Catalog_Item_Name;
|
||||
|
||||
// Create the prefilled Medication order
|
||||
// Session information has been retrieved from the current worksheet if there
|
||||
// already exists unsubmitted orders.
|
||||
// AvailabilityOverride is set to Always.
|
||||
DiagnosticOrder_obj := call worksheetInfo.CreateDiagnosticOrder
|
||||
with
|
||||
Laboratory_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
||||
Catalog_Item_Modifier, // string Name Modifier for prefill
|
||||
Catalog_Item_Version, // string Name modifier version for prefill
|
||||
order_Creation_Reason, // string Create Reason
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}, // AvailabilityOverride
|
||||
false, // suppress messages
|
||||
(Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}, // Companion order primary key
|
||||
false; // Mandatory on Worksheet
|
||||
|
||||
|
||||
|
||||
if( Laboratory_catalog_item is NOT NULL ) then
|
||||
void := call Laboratory_catalog_item.Dispose;
|
||||
Laboratory_catalog_item:= null;
|
||||
endif;
|
||||
|
||||
// answer heparin questions on order form
|
||||
if OrderName = "APTT" then
|
||||
|
||||
If hepstatus = true then
|
||||
heparinstatus:= "Yes";
|
||||
heparinlabinfo:= "Continuous Heparin";
|
||||
else heparinstatus:= "No";
|
||||
heparinlabinfo:= "";
|
||||
endif;
|
||||
|
||||
LabHepStatus := call DiagnosticOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
||||
"LAB_VO_DI_Coag_Heparin Status",( heparinlabinfo AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
|
||||
LabHepQuestion := call DiagnosticOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
||||
"Lab_ContHep_Question",( heparinstatus AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
|
||||
|
||||
endif;
|
||||
|
||||
requestedTime_obj := new net_object {{{SINGLE-QUOTE}}}RequestedTime{{{SINGLE-QUOTE}}};
|
||||
requestedTime_obj.CodedTime := stime1;
|
||||
|
||||
if stime1 <> "AM Rounds" then
|
||||
time_obj := new net_object {{{SINGLE-QUOTE}}}Time{{{SINGLE-QUOTE}}} with (stimehr As Number) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, (stimemin As Number) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}};
|
||||
requestedTime_obj.Time := time_obj;
|
||||
DiagnosticOrder_obj.RequestedTime := requestedTime_obj;
|
||||
endif;
|
||||
|
||||
|
||||
void := call DiagnosticOrder_Obj.Save;
|
||||
void := call DiagnosticOrder_Obj.Dispose;
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
if( Laboratory_catalog_item is NOT NULL ) then
|
||||
void := call Laboratory_catalog_item.Dispose;
|
||||
Laboratory_catalog_item:= null;
|
||||
endif;
|
||||
|
||||
if( DiagnosticOrder_obj is NOT NULL ) then
|
||||
void := call DiagnosticOrder_obj.Dispose;
|
||||
DiagnosticOrder_obj:= null;
|
||||
endif;
|
||||
|
||||
DiagnosticOrder_dest := null;
|
||||
endcatch;
|
||||
|
||||
conclude true;
|
||||
|
||||
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
if error_occurred
|
||||
then
|
||||
|
||||
write "An error has occurred in the MLM {{+B}}SCH_DIAG_WRITE_ORDER{{-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 DiagnosticOrder_dest then
|
||||
write true at DiagnosticOrder_dest;
|
||||
endif;
|
||||
|
||||
return error_occurred;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
212
MLMStripper/bin/Debug/SCH/SCH_DIALOG_OPERATIONS.mlm
Normal file
212
MLMStripper/bin/Debug/SCH/SCH_DIALOG_OPERATIONS.mlm
Normal file
@@ -0,0 +1,212 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Dialog_Operations;;
|
||||
mlmname: SCH_Dialog_Operations;;
|
||||
arden: version 2.5;;
|
||||
version: 6.10;;
|
||||
institution: SCH ;;
|
||||
author: Shivprasad Jadhav(Allscripts);;
|
||||
specialist: ;;
|
||||
date: 2015-05-12;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: To Launch Different Dialogbox.
|
||||
|
||||
Argument Required ::
|
||||
1) Client visit GUID
|
||||
2) Operations ( Pass anyone from below three value based on performing operation )
|
||||
A. SignatureManager
|
||||
B. ExitCare
|
||||
C. OrderReconciliationManager
|
||||
D. HealthIssueManager
|
||||
E. OrderEntry
|
||||
|
||||
|
||||
Sample Argument ::
|
||||
MLM_Name := MLM {{{SINGLE-QUOTE}}}GMS_Dialog_Operations{{{SINGLE-QUOTE}}}; // MLM name
|
||||
1) SignatureManager
|
||||
Status := call MLM_Name with ClientVisitGUID,"SignatureManager";
|
||||
2) ExitCare
|
||||
Status := call MLM_Name with ClientVisitGUID,"ExitCare";
|
||||
3) OrderReconciliationManager
|
||||
Status := call MLM_Name with ClientVisitGUID,"OrderReconciliationManager";
|
||||
4) HealthIssueManager
|
||||
Status := call MLM_Name with ClientVisitGUID,"HealthIssueManager";
|
||||
5) OrderEntry
|
||||
Status := call MLM_Name with ClientVisitGUID,"OrderEntry";
|
||||
|
||||
Return Type ::
|
||||
MLM wil return Success if operation performs Successfully.
|
||||
MLM wil return error_message if any error generate while performing operation Insert/Discontinue/Delete.
|
||||
|
||||
;;
|
||||
explanation:
|
||||
|
||||
;;
|
||||
keywords: ObjectsPlus, Orders
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
//Set to true if a decision.log is needed.
|
||||
log_execution_info:= FALSE; //Set to FALSE for Production
|
||||
|
||||
(ClientVisitGUID,Dialog_Name // ClientVisit ObjectsPlus object
|
||||
):= argument;
|
||||
|
||||
// Specify which .NET assemblies need to be loaded for ObjectsPlus
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "ObjectsPlusXA.SCM.Common";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Common";
|
||||
using namespace "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
using "SXA.Framework" ;
|
||||
using "SCMLib";
|
||||
using namespace "SCMLib.Dialogs";
|
||||
using namespace "SCMLib.Context";
|
||||
using namespace "Eclipsys.SunriseXA.Framework.SCMSXAInterop";
|
||||
|
||||
If Not Called_By_Editor Then
|
||||
|
||||
mlm_name := "GMS_Dialog_Operations";
|
||||
error_occurred := false;
|
||||
|
||||
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 ];
|
||||
|
||||
try
|
||||
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
if Dialog_Name = "SignatureManager" then
|
||||
sxaDialog := new NET_OBJECT {{{SINGLE-QUOTE}}}SXADialog{{{SINGLE-QUOTE}}};
|
||||
void := call sxaDialog.ShowSXADialog with "SXADialogType_SignatureManager" as {{{SINGLE-QUOTE}}}SXADialogType{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if Dialog_Name = "ExitCare" then
|
||||
try
|
||||
using "SCMLib";
|
||||
using namespace "SCMLib.HVCLogon";
|
||||
using "SXA.ED.DischargeInstructions";
|
||||
using namespace "SXA.ED.DischargeInstructions";
|
||||
|
||||
using "SXA.Framework" ;
|
||||
using Namespace "Eclipsys.SunriseXA.Framework.WinClient" ;
|
||||
shellinterface := new NET_OBJECT {{{SINGLE-QUOTE}}}XAShellInterface{{{SINGLE-QUOTE}}} ;
|
||||
shellinterface := new NET_OBJECT {{{SINGLE-QUOTE}}}XAShellInterface{{{SINGLE-QUOTE}}} ;
|
||||
connstring := call {{{SINGLE-QUOTE}}}HVCLogonObj{{{SINGLE-QUOTE}}}.GetConnectionString;
|
||||
dis_instr := new NET_OBJECT {{{SINGLE-QUOTE}}}DischargeInstructions{{{SINGLE-QUOTE}}} ;
|
||||
Exit_Care_Diaglog := call dis_instr.LaunchDischargeInstructions
|
||||
with (shellinterface, true) ;
|
||||
|
||||
endtry;
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Cannot start ExitCare Application: {{-R}}\n"
|
||||
|| ex.Message || "\n\n";
|
||||
msg := error_message || msg;
|
||||
|
||||
if ( dis_instr is NOT NULL ) then
|
||||
void:= call dis_instr.Dispose;
|
||||
dis_instr:= null;
|
||||
endif;
|
||||
endcatch;
|
||||
endif;
|
||||
|
||||
if Dialog_Name = "OrderReconciliationManager" then
|
||||
try
|
||||
// Create the Order Reconciliation Manager object
|
||||
order_rec_mgr_obj:= new NET_OBJECT {{{SINGLE-QUOTE}}}OrderReconciliationManager{{{SINGLE-QUOTE}}};
|
||||
order_rec_mgr_obj.ClientVisitPrimaryKey := ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
void := call order_rec_mgr_obj.ShowDialog;
|
||||
endtry;
|
||||
catch exception ex
|
||||
if ( order_rec_mgr_obj is NOT NULL ) then
|
||||
void:= call order_rec_mgr_obj.Dispose;
|
||||
order_rec_mgr_obj:= NULL;
|
||||
endif;
|
||||
endcatch;
|
||||
endif;
|
||||
|
||||
if Dialog_Name = "HealthIssueManager" then
|
||||
try
|
||||
// Create the Order Reconciliation Manager object
|
||||
order_rec_mgr_obj:= new NET_OBJECT {{{SINGLE-QUOTE}}}HealthIssueManager{{{SINGLE-QUOTE}}};
|
||||
order_rec_mgr_obj.ClientVisitPrimaryKey := ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
void := call order_rec_mgr_obj.ShowDialog;
|
||||
endtry;
|
||||
catch exception ex
|
||||
if ( order_rec_mgr_obj is NOT NULL ) then
|
||||
void:= call order_rec_mgr_obj.Dispose;
|
||||
order_rec_mgr_obj:= NULL;
|
||||
endif;
|
||||
endcatch;
|
||||
endif;
|
||||
|
||||
if Dialog_Name = "OrderEntry" then
|
||||
try
|
||||
using "OpenDialogBoxManager";
|
||||
using namespace "OpenDialogBoxManager";
|
||||
DialogBox_obj:= new NET_OBJECT {{{SINGLE-QUOTE}}}OpenDialogBoxManager.OpenDialogBoxManager{{{SINGLE-QUOTE}}} With 1 as {{{SINGLE-QUOTE}}}System.Int64{{{SINGLE-QUOTE}}};
|
||||
endtry;
|
||||
catch exception ex
|
||||
if ( DialogBox_obj is NOT NULL ) then
|
||||
void:= call DialogBox_obj.Dispose;
|
||||
DialogBox_obj := NULL;
|
||||
endif;
|
||||
endcatch;
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
catch exception ex
|
||||
error_occurred := true;
|
||||
error_message := error_message ||
|
||||
"{{+R}} Dialog Box {{-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;
|
||||
endcatch;
|
||||
endif;
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
conclude true;
|
||||
;;
|
||||
action:
|
||||
if Error_occurred then
|
||||
write "An error has occured in the MLM "
|
||||
|| "{{+B}}" || mlm_name || "{{-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;
|
||||
|
||||
if Error_occurred then
|
||||
return error_message;
|
||||
else
|
||||
return "Success";
|
||||
endif;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
110
MLMStripper/bin/Debug/SCH/SCH_DIET_NPO_HARD_STOP_ALERT.mlm
Normal file
110
MLMStripper/bin/Debug/SCH/SCH_DIET_NPO_HARD_STOP_ALERT.mlm
Normal file
@@ -0,0 +1,110 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Diet_NPO_Hard_Stop_Alert;;
|
||||
mlmname: SCH_Diet_NPO_Hard_Stop_Alert;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Shivprasad Jadhav, Allscripts ;;
|
||||
specialist: Shivprasad Jadhav, Allscripts;;
|
||||
date: 2015-11-17;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: This MLM is called from [Diet-Add to Current Diet] Orders as Event Based Order forms to Restrict the User to place order who have Active NPO Order on Patient
|
||||
;;
|
||||
|
||||
explanation:
|
||||
Change History
|
||||
--------------------------------------
|
||||
2015-11-06 CSR-32228 : Created MLM
|
||||
;;
|
||||
keywords: Called MLMs
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
|
||||
|
||||
event_OSInit := event{OrderInit User Order: WHERE Name = "Diet" And Modifier = "(Add to current diet)" }; //
|
||||
|
||||
/* Executes only when this MLM is called by the editor */
|
||||
|
||||
if called_by_editor then
|
||||
if eventName = "OrderSetInit" Then
|
||||
order_obj:= read last {Order: This };
|
||||
EvokingObject:= order_obj;
|
||||
EndIf;
|
||||
endif;
|
||||
|
||||
(clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
|
||||
VisitGuid := read last {ClientVisit : GUID};
|
||||
|
||||
/*****************************************************************************************************************/
|
||||
//Set to true if logging needed
|
||||
log_execution_info := false;
|
||||
|
||||
//Set the text for this variable to indicate whether to send the message or not
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
//Set the stop message
|
||||
stop_message := false;
|
||||
|
||||
//Set Stop
|
||||
hard_stop := false;
|
||||
found_unsubmitted_orders := false;
|
||||
existing_orders := ();
|
||||
alert_priority := "High";
|
||||
|
||||
alert_dialog := "No Override Allowed";
|
||||
alert_message := "{{+B}}Patient has Active {{+R}} NPO {{-R}} order.{{-B}}";
|
||||
|
||||
|
||||
order_alert_dest := destination {alert} with
|
||||
[alert_type := warning,
|
||||
short_message := "Patient has Active NPO order",
|
||||
priority := alert_priority,
|
||||
scope := Chart,
|
||||
rule_group := "Patient has Active NPO order",
|
||||
rule_number := 9000,
|
||||
send_with_order := send_alert,
|
||||
alert_dialog_settings := alert_dialog,
|
||||
display_alert := true];
|
||||
|
||||
/************************************************************************************************************/
|
||||
|
||||
|
||||
NPOGuid := 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}}}NPO{{{SINGLE-QUOTE}}} "
|
||||
|| " And o1.OrderStatusLevelNum = 50 And cv.guid = " || VisitGuid || " Order By O1.CreatedWhen Desc "} ;
|
||||
|
||||
|
||||
|
||||
If exists NPOGuid Then
|
||||
|
||||
hard_stop := True;
|
||||
Else
|
||||
hard_stop := False;
|
||||
|
||||
Endif;
|
||||
|
||||
|
||||
|
||||
|
||||
;;
|
||||
evoke: event_OSInit; // No evoke statement
|
||||
;;
|
||||
logic:
|
||||
|
||||
conclude hard_stop;
|
||||
;;
|
||||
action:
|
||||
write alert_message at order_alert_dest;
|
||||
|
||||
;;
|
||||
end:
|
||||
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:
|
||||
94
MLMStripper/bin/Debug/SCH/SCH_DISCONTINUE_HELD_ORDERS.mlm
Normal file
94
MLMStripper/bin/Debug/SCH/SCH_DISCONTINUE_HELD_ORDERS.mlm
Normal file
@@ -0,0 +1,94 @@
|
||||
maintenance:
|
||||
|
||||
title: Discontinue of held ordersRelease check for orders without schedules;;
|
||||
filename: SCH_Discontinue_Held_Orders;;
|
||||
arden: version 4.5;;
|
||||
version: 2.00;;
|
||||
institution: St Clair;;
|
||||
author: Teresa Spicuzza;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2010-10-19;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: When discontinuing a held order, alert the user
|
||||
;;
|
||||
explanation: Returns a message box to the user when a held order is discontinued.
|
||||
|
||||
change history
|
||||
|
||||
10.19.2010 DW Created
|
||||
08.27.2018 TMS HD #3351839 Added logic to ignore alert if order being discontinued is part of the Anesthesia Post Op Orders.
|
||||
|
||||
;;
|
||||
keywords: Discontinue, hold, order
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
/*******************Make Changes To Spelling And Flags In This Section*******************/
|
||||
/* Set to true if logging is needed.*/
|
||||
log_execution_info:= false;
|
||||
|
||||
// Set the text for this variable to indicate whether to send the message or not.
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// local_session := cds_session.local;
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
visit_alert:= destination { Alert: Warning, "DC/Cancel Held Order", high, chart, "DC/Cancel Held Order", 14005, send_alert};
|
||||
|
||||
on_order_Cancel := event { OrderCancel Any Order };
|
||||
on_order_DC := event { OrderDiscontinue Any Order };
|
||||
|
||||
(backup_obj) := read last {Order: Backup REFERENCING EvokingObject};
|
||||
(Bk_VisitStatus) := read last {Order: OrderStatusCode REFERENCING backup_obj};
|
||||
|
||||
if Bk_VisitStatus = "HOLD" then
|
||||
|
||||
SurgOrder:= read last {" Select uod.value from CV3Order o
|
||||
join CV3OrderUserData uod on uod.OrderGUID = o.GUID
|
||||
where o.guid = " || evokingobject.guid ||" and o.ClientGUID = " ||EVOKINGOBJECT.ClientGUID ||" and o.ClientVisitGuid = " || EVOKINGOBJECT.ClientVisitGUID || "
|
||||
and ((uod.UserDataCode = {{{SINGLE-QUOTE}}}MLM_OpsuOrderfor AutoDC{{{SINGLE-QUOTE}}} or uod.UserDataCode = {{{SINGLE-QUOTE}}}MLM_SurgOrderfor AutoDC{{{SINGLE-QUOTE}}}) and uod.Value = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}})
|
||||
and o.TypeCode in ({{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Other{{{SINGLE-QUOTE}}})
|
||||
and o.OrderStatusCode not in ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}COMP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}})"};
|
||||
|
||||
endif;
|
||||
|
||||
;;
|
||||
evoke: on_order_DC or on_order_Cancel ;
|
||||
;;
|
||||
logic:
|
||||
/*
|
||||
if local_session.SessionReleseOrderAlertFired is null then
|
||||
local_session.SessionReleseOrderAlertFired := "has fired";
|
||||
conclude true;
|
||||
endif;
|
||||
|
||||
*/
|
||||
if Bk_VisitStatus = "HOLD" and SurgOrder is null then
|
||||
|
||||
conclude true;
|
||||
|
||||
endif;
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
|
||||
|
||||
write "You are discontinuing a held order. \n\n {{+B}}Go Back:{{-B}} This is a held order that needs an administration date/ time change; select Go Back and use the Release and Change Date function. \n\n {{+B}}Proceed:{{-B}} If the intention is to discontinue this order for example it is a duplicate order; select Proceed. " at visit_alert;
|
||||
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "You are discontinuing a held order." ,"Discontinue Held Order Reminder","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
;;
|
||||
|
||||
end:
|
||||
315
MLMStripper/bin/Debug/SCH/SCH_DRUGLEVELMONITORING.mlm
Normal file
315
MLMStripper/bin/Debug/SCH/SCH_DRUGLEVELMONITORING.mlm
Normal file
@@ -0,0 +1,315 @@
|
||||
maintenance:
|
||||
|
||||
title: Drug Level Monitoring Alerts for Select Drugs;;
|
||||
mlmname: SCH_DrugLevelMonitoring;;
|
||||
arden: version 2;;
|
||||
version: 5.50;;
|
||||
institution: St Clair;;
|
||||
author: Teresa Spicuzza, Allscripts Corp;;
|
||||
specialist: Teresa Spicuzza;;
|
||||
date: 2012-08-20;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Recommendations for Drug Level Monitoring Alerts for Select Drugs
|
||||
;;
|
||||
|
||||
explanation: MLM will alert user to monitor patient for therapeutic drug levels for select medications
|
||||
identified with a class type of PRX_DrugMonitoring.
|
||||
|
||||
Change history
|
||||
06.10.2013 TMS Created CSR CSR 31334
|
||||
01.07.2016 TMS Update call to SCH_Func_Creatinine_Clearance to include 5 parameters in the argument
|
||||
being returned. Changed from CrCl_Message, Crcl_Value, wt, patientage to
|
||||
CrCl_Message, Crcl_Value, SCRfromMLM, wt, patientage HD Ticket: 1994073
|
||||
06.07.2016 TMS Update to change Valproic Acid and Phenytoin and add Carbamazepine to not alert
|
||||
if levels done during this admission, not only past 48 hours. CSR 34690
|
||||
09.30.2019 TMS Updated alert to require reason when alert presented to user not in physician/physician extender
|
||||
group. CSR 37977
|
||||
|
||||
;;
|
||||
keywords: Monitoring
|
||||
|
||||
;;
|
||||
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}}};
|
||||
include standard_libs;
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
||||
CrCl_info:= mlm {{{SINGLE-QUOTE}}}SCH_Func_Creatinine_Clearance{{{SINGLE-QUOTE}}};
|
||||
log_execution_info := false;
|
||||
|
||||
//Set the text for this variable to indicate whether to send the message or not
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
if called_by_editor
|
||||
then
|
||||
EvokingObject := read last {Order: THIS
|
||||
where Name="Metformin 500mg Tab" };
|
||||
endif;
|
||||
|
||||
doalert := false;
|
||||
order_enter_event := event { OrderEnter User Order: where TypeCode = "Medication"};
|
||||
|
||||
(CatalogItemObj, FrequencyValue, UOMValue, DoseValue, OrderName, AdminIns, UserSchedType ,UserSchedDays, UserSchedDoses) := read last {Order: OrderCatalogMasterItem, FrequencyCode, UOM, DosageLow, Name, AdminInstructions, Interval, DaysInInterval, DoseMultiplier
|
||||
REFERENCING EvokingObject};
|
||||
|
||||
CatalogClassTypeValueObj := read last {OrderCatalogMasterItem: CatalogClassTypeValue,
|
||||
REFERENCING CatalogItemObj};
|
||||
|
||||
ClassTypeValue_code_list, ClassTypeValue_value_list := read last {CatalogClassTypeValue: Code, Value
|
||||
REFERENCING CatalogClassTypeValueObj where code = "PRX_DrugMonitoring"};
|
||||
|
||||
fire_on_UserCPOE := ("MD","DO","DDS","DPM","PA","PA-C","CRNP","IT");
|
||||
fire_on_User := ("RN","RPh");
|
||||
|
||||
/* Get the current user{{{SINGLE-QUOTE}}}s occupation*/
|
||||
(user_id,userguid) :=read last {UserInfo: idcode, guid};
|
||||
|
||||
UserCode := read last
|
||||
{"Select occupationcode "
|
||||
||" From cv3user with (nolock) "
|
||||
||" Where Guid = " || SQL(userguid) };
|
||||
|
||||
If usercode in fire_on_UserCPOE then
|
||||
alert_settings := "";
|
||||
UDDD_dictionary_name := "";
|
||||
UDDD_is_restricted := FALSE;
|
||||
continue_processing := true;
|
||||
elseif usercode in fire_on_User then
|
||||
alert_settings := "Must Comment";
|
||||
UDDD_dictionary_name := "AlertAckComment";
|
||||
UDDD_is_restricted := TRUE;
|
||||
continue_processing := true;
|
||||
else continue_processing := false;
|
||||
endif;
|
||||
|
||||
|
||||
dose_alert_dest := destination {alert} with
|
||||
[alert_type := "Warning",
|
||||
short_message := "Monitoring Recommendation",
|
||||
priority := "Low",
|
||||
scope := "Chart",
|
||||
rule_group := "Drug Monitoring",
|
||||
rule_number := 4080,
|
||||
send_with_order := send_alert,
|
||||
alert_dialog_settings :=alert_settings,
|
||||
ack_comment_UDDD := UDDD_dictionary_name,
|
||||
ack_comment_UDDD_is_restricted := UDDD_is_restricted,
|
||||
display_alert := true];
|
||||
|
||||
|
||||
// continue_processing:= user_id in fire_on_User;
|
||||
// continue_processing:= usercode in fire_on_User;
|
||||
|
||||
if EvokingEvent = order_enter_event and continue_processing = true and "PRX_DrugMonitoring" in ClassTypeValue_code_list then
|
||||
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, LocationGuid, VisitStatus, AdmitDtm) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, CurrentLocationGUID, VisitStatus, AdmitDtm };
|
||||
|
||||
(UserGUID ) := read last { UserInfo: GUID };
|
||||
|
||||
patientgender := read last { ClientInfo: Gendercode };
|
||||
|
||||
Creatinine, Creatdtm := read last
|
||||
{"Select top 1 bo.value, o.performeddtm "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(clientguid)
|
||||
// || " and o.chartguid = " || SQL(chartguid)
|
||||
|| " and o.performeddtm >= " || SQL(AdmitDtm)
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Creatinine Plasma/Serum{{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
if ClassTypeValue_value_list = "Digoxin" and Creatinine is not Null then
|
||||
(CrCl_Message, Crcl_Value, SCRfromMLM, wt, patientage) := call CrCl_info with (ClientVisitGuid, ChartGuid, ClientGuid, Creatinine);
|
||||
endif;
|
||||
|
||||
Digoxin := read last
|
||||
{"Select top 1 bo.value "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(clientguid)
|
||||
// || " and o.chartguid = " || SQL(chartguid)
|
||||
|| " and o.performeddtm >= (DATEADD(hour, -48, getdate())) "
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Digoxin Plasma/Serum{{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
Phenytoin := read last
|
||||
{"Select top 1 bo.value "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(clientguid)
|
||||
|| " and o.performeddtm >= " || SQL(AdmitDtm)
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Dilantin Serum (Phenytoin){{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
Theophylline := read last
|
||||
{"Select top 1 bo.value "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(clientguid)
|
||||
// || " and o.chartguid = " || SQL(chartguid)
|
||||
|| " and o.performeddtm >= (DATEADD(hour, -48, getdate())) "
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Theophylline Plasma/Serum{{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
Valproic := read last
|
||||
{"Select top 1 bo.value "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(clientguid)
|
||||
|| " and o.performeddtm >= " || SQL(AdmitDtm)
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Valproic Acid Plasma (Depakote Plasma){{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
Carbamazepine := read last
|
||||
{"Select top 1 bo.value "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(clientguid)
|
||||
|| " and o.performeddtm >= " || SQL(AdmitDtm)
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Carbamazepine Serum (Tegretol){{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
|
||||
If ClassTypeValue_value_list = "Phenytoin" then
|
||||
If Phenytoin is Null then
|
||||
// alert_message := "{{+B}}{{+R}}Ordered: " || OrderName || "{{-R}} \n\n Last Phenytoin level was > 48 hours ago. Monitor phenytoin levels closely especially when changing the dose or frequency. {{-B}}";
|
||||
alert_message := "{{+B}}{{+R}}Ordered: " || OrderName || "{{-R}} \n\n No Phenytoin levels available for this admission. Monitor phenytoin levels closely especially when changing the dose or frequency. {{-B}}";
|
||||
doalert := true;
|
||||
endif;
|
||||
endif;
|
||||
If ClassTypeValue_value_list = "Theophylline" then
|
||||
If Theophylline is Null then
|
||||
alert_message := "{{+B}}{{+R}}Ordered: " || OrderName || "{{-R}} \n\n Last Theophylline level was > 48 hours ago. Monitor theophylline levels closely especially when changing the dose or frequency. {{-B}}";
|
||||
doalert := true;
|
||||
endif;
|
||||
endif;
|
||||
If ClassTypeValue_value_list = "Valproic" then
|
||||
If Valproic is Null then
|
||||
// alert_message := "{{+B}}{{+R}}Ordered: " || OrderName || "{{-R}} \n\n Last Valproic Acid level was > 48 hours ago. Monitor valproic acid levels closely especially when changing the dose or frequency. {{-B}}";
|
||||
alert_message := "{{+B}}{{+R}}Ordered: " || OrderName || "{{-R}} \n\n No Valproic Acid levels available for this admission. Monitor valproic acid levels closely especially when changing the dose or frequency. {{-B}}";
|
||||
doalert := true;
|
||||
endif;
|
||||
endif;
|
||||
If ClassTypeValue_value_list = "Carbamazepine" then
|
||||
If Carbamazepine is Null then
|
||||
alert_message := "{{+B}}{{+R}}Ordered: " || OrderName || "{{-R}} \n\n No Carbamazepine levels available for this admission. Monitor carbamazepine levels closely especially when changing the dose or frequency. {{-B}}";
|
||||
doalert := true;
|
||||
endif;
|
||||
endif;
|
||||
If ClassTypeValue_value_list = "Digoxin" then
|
||||
|
||||
If Digoxin is Null and ((CRCL_Value as number) < 50) then
|
||||
alert_message := "{{+B}} This patient{{{SINGLE-QUOTE}}}s estimated CrCl is " || CrCl_Value || "ml/min. "
|
||||
|| " \n Calculated with a Serum Creatinine of: " || Creatinine || "mg/dl "
|
||||
|| " \n\n {{+R}} Ordered: " || OrderName || "{{-R}} \n\n Last Digoxin level was > 48 hours ago. Monitor digoxin levels closely in patients with renal dysfunction escpecially when changing the dose or frequency. {{-B}}"
|
||||
|| "\n\n\n Calculation Information: " || CrCl_Message;
|
||||
doalert := true;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
doalert := false;
|
||||
endif;
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: order_enter_event;
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
if called_by_editor
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// If there is no evoking object then do nothing, this can
|
||||
// only be true for the MLM Editor
|
||||
//----------------------------------------------------------------
|
||||
if EvokingObject is null
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
if continue_processing = false
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
|
||||
conclude doalert;
|
||||
|
||||
;;
|
||||
action:
|
||||
write alert_message at dose_alert_dest
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
652
MLMStripper/bin/Debug/SCH/SCH_DRUG_LAB_ALERTS.mlm
Normal file
652
MLMStripper/bin/Debug/SCH/SCH_DRUG_LAB_ALERTS.mlm
Normal file
@@ -0,0 +1,652 @@
|
||||
maintenance:
|
||||
|
||||
title: Dosing alerts for out of range lab values;;
|
||||
mlmname: SCH_Drug_Lab_Alerts;;
|
||||
arden: version 2;;
|
||||
version: 5.50;;
|
||||
institution: St Clair;;
|
||||
author: Teresa Spicuzza, Allscripts Corp;;
|
||||
specialist: Teresa Spicuzza;;
|
||||
date: 2012-07-02;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Renal Dosing Recommendations
|
||||
;;
|
||||
|
||||
explanation: MLM will read table and provide dosing alerts based upon medication and specific lab values.
|
||||
|
||||
Change history
|
||||
06.06.2013 TMS Created for CSR 31334
|
||||
06.25.2014 TMS Modify retrieval of class type to correct issue with mlm not always firing.
|
||||
06.09.2015 TMS Added rules E, F, G, and H as well as retrievals for Argatroban
|
||||
and potassium medications, active and unsubmitted. CSR 33467
|
||||
06.03.2016 TMS Added drug levels for Valproic Acid, Phenytoin, and Carbamazepine. CSR 34690
|
||||
04.18.2017 TMS added exclusion for Hi CPK with Statin Drugs if patient has diagnosis
|
||||
of STEMI or NSTEM for this visit CSR 34043
|
||||
05.08.2017 TMS Updated with additional rules for potassium and products containing
|
||||
trimethoprim. CSR 35636
|
||||
09.30.2019 TMS Updated alert to require reason when alert presented to user not in physician/physician extender
|
||||
group. CSR 37977
|
||||
|
||||
;;
|
||||
keywords: Drug Lab Dosing
|
||||
|
||||
;;
|
||||
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}}};
|
||||
include standard_libs;
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
||||
log_execution_info := false;
|
||||
|
||||
//Set the text for this variable to indicate whether to send the message or not
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
if called_by_editor
|
||||
then
|
||||
EvokingObject := read last {Order: THIS
|
||||
where Name="Loratadine 10mg Tab" };
|
||||
endif;
|
||||
SP := " ";
|
||||
CR := 13 formatted with "%c";
|
||||
LF := 10 formatted with "%c";
|
||||
CRLF:= CR||LF;
|
||||
TAB := 9 formatted with "%c";
|
||||
messageA := SP;
|
||||
messageB := SP;
|
||||
messageC := SP;
|
||||
doalert := false;
|
||||
order_enter_event := event { OrderEnter User Order: where TypeCode = "Medication"};
|
||||
|
||||
(CatalogItemObj, FrequencyValue, UOMValue, DoseValue, OrderName, OrderRoute, AdminIns,
|
||||
UserSchedType ,UserSchedDays, UserSchedDoses, PRN, OrderSummaryLine, OrdComponentObj, OrderGuid) := read last {Order: OrderCatalogMasterItem, FrequencyCode,
|
||||
UOM, DosageLow, Name, OrderRouteCode, AdminInstructions, Interval, DaysInInterval, DoseMultiplier, IsPRN, SummaryLine, OrderComponent, Guid
|
||||
REFERENCING EvokingObject};
|
||||
ClassTypeGuid := read last
|
||||
{ " select guid from CV3ClassType where Code = {{{SINGLE-QUOTE}}}PRX_DrugLabAlerts{{{SINGLE-QUOTE}}}" };
|
||||
|
||||
ClassValue := read last { " select value from CV3CatalogClassTypeValue "
|
||||
|| " where CatalogMasterGuid = " || SQL (CatalogItemObj.GUID) || " and classtypeguid = " || SQL (classtypeguid) };
|
||||
|
||||
|
||||
xComponentCatalogGuidList := read {OrderComponent: OrderCatalogMasterItemGUID
|
||||
REFERENCING OrdComponentObj};
|
||||
ComponentCatalogGuidList := (999);
|
||||
for i in 1 seqto count xComponentCatalogGuidList do
|
||||
ComponentCatalogGuidList := ComponentCatalogGuidList ||"," || xComponentCatalogGuidList [i];
|
||||
enddo;
|
||||
|
||||
If count (ComponentCatalogGuidList) > 0 then
|
||||
|
||||
CompClassValue := read last
|
||||
{ " Select ctv.value from CV3CatalogClassTypeValue ctv "
|
||||
|| " join CV3OrderCatalogMasterItem ocmi on ocmi.GUID = ctv.CatalogMasterGUID "
|
||||
|| " where ctv.ClassTypeGUID = " || SQL(ClassTypeGuid) || " and ocmi.Guid in (" || ComponentCatalogGuidList ||")" };
|
||||
|
||||
endif;
|
||||
|
||||
If classvalue is null and compclassvalue is null then
|
||||
continue := "no";
|
||||
else
|
||||
continue := "yes";
|
||||
endif;
|
||||
|
||||
if continue = "yes" then
|
||||
/* Get the OrderAdditionalInfo object pointer */
|
||||
OrderAdditionalInfoObj := read last { Order: OrderAdditionalInfo
|
||||
REFERENCING EvokingObject };
|
||||
|
||||
/* Get information from the OrderAdditionalInfo object */
|
||||
(SummaryLine, FreqfromTime,FreqUOM ) := read last { OrderAdditionalInfo: FreqSummaryLine ,FreqFromTime, FreqUOM
|
||||
REFERENCING OrderAdditionalInfoObj };
|
||||
|
||||
|
||||
|
||||
fire_on_UserCPOE := ("MD","DO","DDS","DPM","PA","PA-C","CRNP","IT");
|
||||
fire_on_User := ("RN","RPh");
|
||||
|
||||
/* Get the current user{{{SINGLE-QUOTE}}}s occupation*/
|
||||
(user_id,userguid) :=read last {UserInfo: idcode, guid};
|
||||
|
||||
UserCode := read last
|
||||
{"Select occupationcode "
|
||||
||" From cv3user with (nolock) "
|
||||
||" Where Guid = " || SQL(userguid) };
|
||||
|
||||
If usercode in fire_on_UserCPOE then
|
||||
alert_settings := "";
|
||||
UDDD_dictionary_name := "";
|
||||
UDDD_is_restricted := FALSE;
|
||||
continue_processing := true;
|
||||
elseif usercode in fire_on_User then
|
||||
alert_settings := "Must Comment";
|
||||
UDDD_dictionary_name := "AlertAckComment";
|
||||
UDDD_is_restricted := TRUE;
|
||||
continue_processing := true;
|
||||
else continue_processing := false;
|
||||
endif;
|
||||
|
||||
dose_alert_dest := destination {alert} with
|
||||
[alert_type := "Warning",
|
||||
short_message := "Dosing Recommendation",
|
||||
priority := "Low",
|
||||
scope := "Chart",
|
||||
rule_group := "Adjust Dosing",
|
||||
rule_number := 4052,
|
||||
send_with_order := send_alert,
|
||||
alert_dialog_settings := alert_settings,
|
||||
ack_comment_UDDD := UDDD_dictionary_name,
|
||||
ack_comment_UDDD_is_restricted := UDDD_is_restricted,
|
||||
display_alert := true];
|
||||
|
||||
|
||||
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, LocationGuid, VisitStatus, AdmitDtm) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, CurrentLocationGUID, VisitStatus, AdmitDtm };
|
||||
(UserGUID ) := read last { UserInfo: GUID };
|
||||
|
||||
//Check for existence of STEMI or NSTEMI health issue for this visit
|
||||
Stemi_Nstemi := READ LAST {"SELECT 1 "
|
||||
|| " FROM CV3HealthIssueDeclaration hid WITH (NOLOCK) JOIN CV3CodedHealthIssue chi WITH (NOLOCK)"
|
||||
|| " ON hid.CodedHealthIssueGUID = chi.GUID"
|
||||
|| " WHERE hid.ClientGUID = " || SQL(ClientGUID)
|
||||
|| " AND hid.ClientVisitGUID = " || SQL(ClientVisitGuid)
|
||||
|| " AND hid.ChartGUID = " || SQL(ChartGUID)
|
||||
|| " AND hid.Active = 1"
|
||||
|| " AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"
|
||||
|| " AND hid.TypeCode = {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}"
|
||||
|| " AND ( ( chi.Description LIKE {{{SINGLE-QUOTE}}}%STEMI%{{{SINGLE-QUOTE}}} OR chi.ShortName LIKE {{{SINGLE-QUOTE}}}%STEMI%{{{SINGLE-QUOTE}}} ) "
|
||||
|| " OR ( chi.Description LIKE {{{SINGLE-QUOTE}}}%NSTEMI%{{{SINGLE-QUOTE}}} OR chi.ShortName LIKE {{{SINGLE-QUOTE}}}%NSTEMI%{{{SINGLE-QUOTE}}} ) )" };
|
||||
|
||||
|
||||
KName, KValue, KUom, KDone, KAbn := read last
|
||||
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(ClientGuid)
|
||||
|| " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Potassium Plasma/Serum{{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
If (KValue as number) >= 5.0 or KAbn = "HH" then Hi_K := true; else Hi_K := false; endif;
|
||||
If (KValue as number) > 4.5 and (KValue as number) < 5.0 then Mid_K := true; else Mid_K := false; endif;
|
||||
If (KValue as number) < 3.5 or KAbn = "LL" then Lo_K := true; else Lo_K := false; endif;
|
||||
|
||||
NaName, NaValue, NaUom, NaDone, NaAbn := read last
|
||||
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(ClientGuid)
|
||||
|| " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Sodium Plasma/Serum{{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
If (NaValue as number) < 133.0 or NaAbn = "LL" then Lo_Na := true; else Lo_Na := false; endif;
|
||||
|
||||
AstName, AstValue, AstUom, AstDone := read last
|
||||
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(ClientGuid)
|
||||
|| " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}AST/SGOT{{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
If (ASTValue as number) > 150 or ASTValue = ">150.0" then Hi_AST := true; else Hi_AST := false; endif;
|
||||
|
||||
AltName, AltValue, AltUom, AltDone := read last
|
||||
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(ClientGuid)
|
||||
|| " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}ALT/SGPT{{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
|
||||
If (ALTValue as number) > 150 then Hi_ALT := true; else Hi_ALT := false; endif;
|
||||
|
||||
|
||||
PhenytoinName, PhenytoinValue, PhenytoinUom, PhenytoinDone, PhenytoinAbn:= read last
|
||||
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(ClientGuid)
|
||||
|| " and o.performeddtm >= " || SQL(AdmitDtm)
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Dilantin Serum (Phenytoin){{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
|
||||
If (PhenytoinValue as number) > 20 or PhenytoinAbn = "HH" then Hi_Phenytoin := true; else Hi_Phenytoin := false; endif;
|
||||
|
||||
CarbamazepineName, CarbamazepineValue, CarbamazepineUom, CarbamazepineDone, CarbamazepineAbn := read last
|
||||
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(ClientGuid)
|
||||
|| " and o.performeddtm >= " || SQL(AdmitDtm)
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Carbamazepine Serum (Tegretol){{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
|
||||
If (CarbamazepineValue as number) > 15 or CarbamazepineAbn = "HH" then Hi_Carbamazepine := true; else Hi_Carbamazepine := false; endif;
|
||||
|
||||
ValproicName, ValproicValue, ValproicUom, ValproicDone, ValproicAbn := read last
|
||||
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(ClientGuid)
|
||||
|| " and o.performeddtm >= " || SQL(AdmitDtm)
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Valproic Acid Plasma (Depakote Plasma){{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
|
||||
If (ValproicValue as number) > 125 or ValproicValue = ">150.0" then Hi_Valproic := true; else Hi_Valproic := false; endif;
|
||||
|
||||
|
||||
DigName, DigValue, DigUom, DigDone, DigAbn := read last
|
||||
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(ClientGuid)
|
||||
|| " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Digoxin Plasma/Serum{{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
If (DigValue as number) > 2.2 or DigAbn = "HH" then Hi_Dig := true; else Hi_Dig := false; endif;
|
||||
Digibind_Addendum := "**NOTE** Digibind can falsely elevate serum digoxin levels for several days or even longer in patients with renal dysfunction. "
|
||||
|| "If your patient has recently received digibind, digoxin levels cannot be reliably interpreted.";
|
||||
|
||||
CPKName, CPKValue, CPKUom, CPKDone, CPKAbn := read last
|
||||
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(ClientGuid)
|
||||
|| " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}CPK Total{{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
If CPKAbn = "H" or CPKABn = "HH" then Hi_CPK := true; else Hi_CPK := false; endif;
|
||||
|
||||
|
||||
INRName, INRValue, INRDone, INRAbn := read last
|
||||
{"Select top 1 bo.ItemName, bo.value, o.performeddtm, bo.AbnormalityCode "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(ClientGuid)
|
||||
|| " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}INR{{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
If (INRValue as number) >= 3.3 or INRAbn = "HH" then Hi_INR := true; else Hi_INR := false; endif;
|
||||
|
||||
|
||||
If (Hi_ALT = true) or (Hi_AST = true) or (Hi_K = true) or (Mid_K = true) or (Lo_K = true) or (Lo_Na = true) or (Hi_Dig = true)
|
||||
or (Hi_INR = true) or (Hi_CPK = true) or (Hi_Phenytoin = true) or (Hi_Carbamazepine = true) or (Hi_Valproic = true) then
|
||||
|
||||
continue := "Yes";
|
||||
|
||||
else continue := "No";
|
||||
endif;
|
||||
|
||||
|
||||
KSupplement := read last
|
||||
{"Select top 1 o.name "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " where (o.name like {{{SINGLE-QUOTE}}}%Potassium Chloride%{{{SINGLE-QUOTE}}} "
|
||||
|| " or o.name = {{{SINGLE-QUOTE}}}Phosphorous Supplement 1.25gm Packet{{{SINGLE-QUOTE}}} "
|
||||
|| " or o.name like {{{SINGLE-QUOTE}}}%Potassium Phosphate%{{{SINGLE-QUOTE}}}) "
|
||||
|| " and ClientGUID = " || SQL(ClientGuid)
|
||||
|| " and ClientVisitGUID= " || SQL(ClientVisitGuid)
|
||||
|| " and OrderStatusLevelNum > 15 "
|
||||
|| " and OrderStatusLevelNum not in (69, 70) "
|
||||
};
|
||||
Argatroban := read last
|
||||
{"Select top 1 o.name "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " where o.name like {{{SINGLE-QUOTE}}}%Argatroban%{{{SINGLE-QUOTE}}} "
|
||||
|| " and ClientGUID = " || SQL(ClientGuid)
|
||||
|| " and ClientVisitGUID= " || SQL(ClientVisitGuid)
|
||||
|| " and OrderStatusLevelNum > 15 "
|
||||
|| " and OrderStatusLevelNum not in (69, 70) "
|
||||
};
|
||||
|
||||
(unsubmitted_KCL) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "%potassium chloride%"};
|
||||
(unsubmitted_KCL_IV) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "% KCl %"};
|
||||
(unsubmitted_KPhos) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "%Phosphorous Supplement 1.25gm Packet%"};
|
||||
(unsubmitted_KPhos_IV) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "%Potassium Phosphate%"};
|
||||
(unsubmitted_Argatroban) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "%Argatroban %"};
|
||||
KCL_Ordered := count (unsubmitted_KCL) + count (unsubmitted_KCL_IV) + count (unsubmitted_KPhos) + count (unsubmitted_KPhos_IV);
|
||||
Argatroban_Ordered := count (unsubmitted_Argatroban);
|
||||
|
||||
If ((KCL_Ordered as number) > 0 ) or (KSupplement is not null) then
|
||||
|
||||
Pt_on_KCL := "yes";
|
||||
else
|
||||
Pt_on_KCL := "no";
|
||||
endif;
|
||||
|
||||
If ((Argatroban_Ordered as number) > 0 ) or (Argatroban is not null) then
|
||||
|
||||
Pt_On_Argatroban := "yes";
|
||||
else
|
||||
Pt_on_Argatroban := "no";
|
||||
endif;
|
||||
else continue := "No";
|
||||
endif;
|
||||
|
||||
if continue = "yes" then
|
||||
|
||||
alert_message := "";
|
||||
medlist := ();
|
||||
medlist := read { "select value from cv3userdictionaryvalue v with (nolock)"
|
||||
|| " where userdictionarycode = {{{SINGLE-QUOTE}}}PRX_DrugLabAlerts{{{SINGLE-QUOTE}}} "
|
||||
|| " and active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
|
||||
};
|
||||
|
||||
|
||||
|
||||
NumRules:= count medlist;
|
||||
for k in (1 seqto (NumRules)) do
|
||||
rules := call str_parse with medlist[k],"|";
|
||||
|
||||
RuleClass := rules[1];
|
||||
RuleType := rules[2];
|
||||
RuleTestName := rules[3];
|
||||
RuleParam := rules[4];
|
||||
RuleLabValue := rules[5];
|
||||
RuleLabUom := rules[6];
|
||||
RuleMsg := rules[7];
|
||||
|
||||
|
||||
|
||||
|
||||
If (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "A" and Lo_Na = true then
|
||||
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||NaName ||" on " || NaDone || " is " || NaValue || SP || NaUom
|
||||
|| " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
|
||||
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
||||
|
||||
doalert := true;
|
||||
|
||||
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "B" and Hi_K = true then
|
||||
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||KName ||" on " || KDone || " is " || KValue || SP || KUom
|
||||
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
||||
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
||||
|
||||
doalert := true;
|
||||
|
||||
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "C" and (Hi_AST = true or Hi_ALT = true) and Stemi_NStemi is null then
|
||||
|
||||
If Hi_AST = true and Hi_ALT = false then
|
||||
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AstName ||" on " || AstDone || " is " || AstValue || SP || AstUom
|
||||
|| " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
|
||||
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
||||
|
||||
elseif Hi_AST = false and Hi_ALT = true then
|
||||
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AltName ||" on " || AltDone || " is " || AltValue || SP || AltUom
|
||||
|| " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
|
||||
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
||||
|
||||
elseif Hi_AST = true and Hi_ALT = true then
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AltName ||" on " || AltDone || " is " || AltValue || SP || AltUom
|
||||
|| " and " || AstName ||" on " || AstDone || " is " || AstValue || SP || AstUom
|
||||
|| " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
|
||||
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
||||
|
||||
|
||||
|
||||
else
|
||||
alert_message := " ";
|
||||
endif;
|
||||
|
||||
doalert := true;
|
||||
|
||||
|
||||
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "D" and (Hi_AST = true or Hi_ALT = true) then
|
||||
|
||||
If Hi_AST = true and Hi_ALT = false then
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AstName ||" on " || AstDone || " is " || AstValue || SP || AstUom
|
||||
|| " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
|
||||
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
||||
|
||||
elseif Hi_AST = false and Hi_ALT = true then
|
||||
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AltName ||" on " || AltDone || " is " || AltValue || SP || AltUom
|
||||
|| " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
|
||||
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
||||
|
||||
elseif Hi_AST = true and Hi_ALT = true then
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AltName ||" on " || AltDone || " is " || AltValue || SP || AltUom
|
||||
|| " and " || AstName ||" on " || AstDone || " is " || AstValue || SP || AstUom
|
||||
|| " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
|
||||
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
||||
|
||||
else
|
||||
alert_message := " ";
|
||||
endif;
|
||||
|
||||
doalert := true;
|
||||
|
||||
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "E" and Lo_K = true and Pt_on_KCL = "no" then
|
||||
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||KName ||" on " || KDone || " is " || KValue || SP || KUom
|
||||
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
||||
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
||||
|
||||
doalert := true;
|
||||
|
||||
|
||||
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "F" and Hi_CPK = true and Stemi_NStemi is null then
|
||||
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||CPKName ||" on " || CPKDone || " is " || CPKValue || SP || CPKUom
|
||||
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
||||
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
||||
|
||||
doalert := true;
|
||||
|
||||
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "G" and Hi_Dig = true then
|
||||
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||DigName ||" on " || DigDone || " is " || DigValue || SP || DigUom
|
||||
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
||||
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" || CRLF || Digibind_Addendum ;
|
||||
|
||||
doalert := true;
|
||||
|
||||
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "H" and Hi_INR = true and Pt_On_Argatroban = "no" then
|
||||
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||INRName ||" on " || INRDone || " is " || INRValue || SP
|
||||
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
||||
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
||||
|
||||
doalert := true;
|
||||
|
||||
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "I" and Hi_Phenytoin = true then
|
||||
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||PhenytoinName ||" on " || PhenytoinDone || " is " || PhenytoinValue || SP || PhenytoinUOM
|
||||
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
||||
|| "\n\n " || PhenytoinName || " " || Rulemsg || "{{-R}} {{-B}}" ;
|
||||
|
||||
doalert := true;
|
||||
|
||||
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "J" and Hi_Carbamazepine = true then
|
||||
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||CarbamazepineName ||" on " || CarbamazepineDone || " is " || CarbamazepineValue || SP || CarbamazepineUOM
|
||||
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
||||
|| "\n\n " || CarbamazepineName || " " || Rulemsg || "{{-R}} {{-B}}" ;
|
||||
|
||||
doalert := true;
|
||||
|
||||
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "K" and Hi_Valproic = true then
|
||||
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||ValproicName ||" on " || ValproicDone || " is " || ValproicValue || SP || ValproicUOM
|
||||
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
||||
|| "\n\n " || ValproicName || " " || Rulemsg || "{{-R}} {{-B}}" ;
|
||||
|
||||
doalert := true;
|
||||
|
||||
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "L" and Mid_K = true then
|
||||
If classvalue = "Trimethoprim" or classvalue = "Sulfamethoxazole/trimethoprim" then AddtoMsg := "Consider alternative antibiotic therapy OR use with caution and monitor potassium levels closely "
|
||||
|| "ESPECIALLY if the patient is also ordered other medications that increase potassium levels such as an ACEI, ARB, spironolactone, or potassium supplements.";
|
||||
else AddtoMsg := " ";
|
||||
endif;
|
||||
|
||||
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||KName ||" on " || KDone || " is " || KValue || SP || KUom
|
||||
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
||||
|| "\n\n " || Rulemsg ||" "||AddtoMsg|| "{{-R}} {{-B}}" ;
|
||||
|
||||
doalert := true;
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
|
||||
nomessage := "";
|
||||
endif;
|
||||
|
||||
|
||||
enddo;
|
||||
|
||||
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: order_enter_event;
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
if called_by_editor
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// If there is no evoking object then do nothing, this can
|
||||
// only be true for the MLM Editor
|
||||
//----------------------------------------------------------------
|
||||
if EvokingObject is null
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
if continue = "no"
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
|
||||
conclude doalert;
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
write alert_message at dose_alert_dest
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
221
MLMStripper/bin/Debug/SCH/SCH_DUP_CODE_STATUS_STOP.mlm
Normal file
221
MLMStripper/bin/Debug/SCH/SCH_DUP_CODE_STATUS_STOP.mlm
Normal file
@@ -0,0 +1,221 @@
|
||||
maintenance:
|
||||
|
||||
title: Duplicate Code Status Hard Stop;;
|
||||
mlmname: SCH_dup_code_status_stop;;
|
||||
arden: version 2;;
|
||||
version: 4.50;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Deborah Eiler, Debbie.Eiler@stclair.org, 866-248-4500 ext. 1318, Robert Spence Ext 1034;;
|
||||
specialist: Eclipsys Corporation;;
|
||||
date: 2006-12-07;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
If the patient has an existing code status I would like for an MLM to fire an
|
||||
alert to stop the order entry. If the comment type of an existing Code Status
|
||||
is active, fire an alert to Stop the order.
|
||||
;;
|
||||
explanation:
|
||||
|
||||
IMPORTANT NOTE: Each time this MLM is updated, FORM_PREVENT_DUP_CODE_STATUS may also need to be updated
|
||||
|
||||
Change history
|
||||
|
||||
11.09.2012 DJW CSR# 26830 - Simplification of Code Status classifications. Reduced from 7 to 3 choices
|
||||
07.30.2012 - DJW CSR# 30963 - Altered logic to prevent duplicate status order even if in Discharge Session
|
||||
10.05.2012 - DJW CSR# 30963 - Revert to prior logic - allow duplicate status order even if in Discharge Session
|
||||
12.18.2012 - DJW CSR# 31242 - Change "...Full Treatment" to "...Full Code". Remove CPR/DNR codes
|
||||
01.24.2013 - DJW CSR# 31242 - Altered code again {{{SINGLE-QUOTE}}}Code Status: DNR/Limited Interventions{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Code Status: DNR/Comfort Measures Only (CMO){{{SINGLE-QUOTE}}}
|
||||
02.09.2016 - DJW CSR# 33949 - Change to wording of Code Status and CPR orders
|
||||
09.27.2017 - JML CSR# 26413 - Modified evoking event to not fire on "Code Status: Ethically unable to determine" order
|
||||
|
||||
(D Eiler, 10-2-06): Code Status order is currently configured to display in the
|
||||
Patient Header as a comment. I have added duplicate checking alerts. If the user
|
||||
keeps the new order and discontinues the current order from the duplicate check
|
||||
alert, the new order will overlay what is displayed in the Patient Header. This
|
||||
is what we want to happen. But… if the user ignores the duplicate checking alert
|
||||
and proceeds with the order entry, the new code status will overlay in the Patient
|
||||
Header but there will be two code status orders on the order tab. If the user
|
||||
discontinues one of these code status orders the code status in the Patient
|
||||
Header is removed. This is a problem. We must be able to rely on the display of
|
||||
the code status in the Patient Header. I have a warning message at the onset of
|
||||
code status order entry but it does not stop the process.
|
||||
|
||||
THIS MLM:
|
||||
- TRIGGERS ON CODE STATUS ORDER INITIALIZATION
|
||||
- LOOKS UP ANY ACTIVE EXISTING or UNSUBMITTED CODE STATUS ORDERS
|
||||
- IF EXISTING ORDER THEN PRESENTS THEM TO THE USER FOR DC{{{SINGLE-QUOTE}}}ING.
|
||||
- IF UNSUBMITTED ORDERS THEN PRESENTS A HARD STOP
|
||||
|
||||
IT DOES NOT CREATE A "HARD STOP". THAT IS DONE BY ANOTHER MLM ATTACHED TO THE
|
||||
FORM: FORM_RS_prevent_dup_code_status.MLM.
|
||||
|
||||
|
||||
|
||||
;;
|
||||
keywords: action on alerts, duplicate code status;
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
/******************Make Changes To Spelling And Flags In This Section******************/
|
||||
|
||||
//Triggering event: duplicate order
|
||||
|
||||
// 11/30/2011 - Don Warnick - ok to have duplicate for discharge order reconcilliation
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
|
||||
if worksheetinfo.sessiontype = "Discharge" then sessiontype := "Discharge"; else sessiontype := "Other"; endif;
|
||||
/*
|
||||
code_status_order := event{orderInit user order:
|
||||
where typecode = "other"
|
||||
and name in ("Code Status: DNR/Limited Interventions" , "Code Status: DNR/Comfort Measures Only (CMO)", "Code Status: Full Treatment" , "Code Status: Full Code",
|
||||
"Code Status: Limited Interventions", "Code Status: Comfort Measures Only (CMO)")};
|
||||
|
||||
code_status_order_enter := event{orderEnter user order:
|
||||
where typecode = "other"
|
||||
and name in ("Code Status: DNR/Limited Interventions" , "Code Status: DNR/Comfort Measures Only (CMO)", "Code Status: Full Treatment" , "Code Status: Full Code",
|
||||
"Code Status: Limited Interventions", "Code Status: Comfort Measures Only (CMO)")
|
||||
};
|
||||
*/
|
||||
code_status_order := event{orderInit user order: where typecode = "other" and ( ( Name matches pattern "Code Status: %" or Name matches pattern "CPR%" or Name matches pattern "DNR%" ) AND Name <> "Code Status: Ethically unable to determine" ) };
|
||||
code_status_order_enter := event{orderEnter user order: where typecode = "other" and ( ( Name matches pattern "Code Status: %" or Name matches pattern "CPR%" or Name matches pattern "DNR%" ) AND Name <> "Code Status: Ethically unable to determine" ) };
|
||||
|
||||
|
||||
//Popup destination with ACTIONS ON ALERTS:
|
||||
dup_existing_alert := destination{alert: reminder, "Duplicate Active Code Status!", high, chart, "Code Status Rule Group", 1};
|
||||
|
||||
//Popup destination with HARD STOP:
|
||||
dup_unsubmitted_alert := destination{alert: reminder, "Duplicate Active Code Status!", high, chart, "Code Status Rule Group", 1, "", "No Override Allowed"};
|
||||
|
||||
//Message to display to the user:
|
||||
dup_existing_msg := "{{+B}}{{+R}}Sorry, but you cannot proceed while there is an existing active code status order.{{-R}}{{-B}}{{+C}}\n\n"
|
||||
|| "Please click the {{+B}}{{+U}}View Actions...{{-U}}{{-B}} button below, then dc the earlier Code Status order(s) or cancel this order, altogether." ;
|
||||
|
||||
dup_unsubmitted_msg := "{{+B}}{{+R}}Sorry, but only one patient code status order is permitted.{{-R}}{{-B}}{{+C}}\n\n"
|
||||
|| "You have already added a code staus order in this Order Entry Session. Please remove the Code Status order you already entered or do not add this order." ;
|
||||
|
||||
|
||||
/***************************************************************************JAB********/
|
||||
|
||||
// Declare the MLM that can be called by this MLM
|
||||
create_aa_object := MLM {{{SINGLE-QUOTE}}}STD_Func_Create_Alert_Action_Object{{{SINGLE-QUOTE}}};
|
||||
|
||||
if called_by_editor then
|
||||
evokingobject := read last {order:this where typecode = "other" and name = "code status:"};
|
||||
endif;
|
||||
|
||||
// Get the Client GUID and Evoking Object parameters:
|
||||
(client_guid, chart_guid, visit_guid, evoking_order_name, evoking_order_guid, evoking_order_catalog_master_item_guid, evoking_significant_dtm )
|
||||
:= read last { Order: clientguid, chartguid, clientvisitguid, Name, GUID, OrderCatalogMasterItemGUID, SignificantDtm REFERENCING EvokingObject };
|
||||
|
||||
|
||||
ordername_substring := SUBSTRING 12 CHARACTERS STARTING AT 1 FROM evoking_order_name;
|
||||
|
||||
/*
|
||||
// find unsubmitted code status orders rom this Order Entry Session
|
||||
(unsub_name_list, unsub_guid_list, unsub_ocmi_guid_list ) := READ
|
||||
{UnsubmittedOrders: Name, GUID, OrderCatalogMasterItemGUID WHERE TypeCode = "Other" AND (ClientGUID = client_guid)
|
||||
and name in ("Code Status: DNR/Limited Interventions" , "Code Status: DNR/Comfort Measures Only (CMO)", "Code Status: Full Treatment" , "Code Status: Full Code",
|
||||
"Code Status: Limited Interventions", "Code Status: Comfort Measures Only (CMO)"
|
||||
)};
|
||||
*/
|
||||
|
||||
|
||||
if ordername_substring = "Code Status:"
|
||||
|
||||
then
|
||||
|
||||
dup_lookup_items := " name like {{{SINGLE-QUOTE}}}Code Status: %{{{SINGLE-QUOTE}}} ";
|
||||
|
||||
// find unsubmitted code status orders rom this Order Entry Session
|
||||
(unsub_name_list, unsub_guid_list, unsub_ocmi_guid_list ) := READ
|
||||
{UnsubmittedOrders: Name, GUID, OrderCatalogMasterItemGUID WHERE TypeCode = "Other" AND (ClientGUID = client_guid) and name matches pattern "Code Status: %" };
|
||||
|
||||
else
|
||||
|
||||
dup_lookup_items := " ( name in ({{{SINGLE-QUOTE}}}Code Status: Full Code{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: DNR/Limited Interventions{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: DNR/Comfort Measures Only (CMO){{{SINGLE-QUOTE}}}) or name like {{{SINGLE-QUOTE}}}cpr%{{{SINGLE-QUOTE}}} or name like {{{SINGLE-QUOTE}}}dnr%{{{SINGLE-QUOTE}}} )";
|
||||
|
||||
// find unsubmitted code status orders rom this Order Entry Session
|
||||
(unsub_name_list, unsub_guid_list, unsub_ocmi_guid_list ) := READ
|
||||
{UnsubmittedOrders: Name, GUID, OrderCatalogMasterItemGUID WHERE TypeCode = "Other" AND (ClientGUID = client_guid) and (name matches pattern "CPR%" or name matches pattern "DNR%") };
|
||||
|
||||
endif;
|
||||
|
||||
// if found unsubmitted orders
|
||||
if exist unsub_name_list then
|
||||
found_unsubmitted_orders := true;
|
||||
// if no unsubmitted orders then lets check database for existing orders
|
||||
else
|
||||
// check for existing active code status orders for the patient for this visit
|
||||
(old_cs_lst, old_cs_ord_guid_lst, old_cs_ocmi_guid_lst ) := read
|
||||
{" select name, GUID, OrderCatalogMasterItemGUID"
|
||||
||" from cv3order "
|
||||
||" where clientguid = " || sql(client_guid)
|
||||
||" and chartguid = " || sql(chart_guid)
|
||||
||" and clientvisitguid = " || sql(visit_guid)
|
||||
||" and ( name <> {{{SINGLE-QUOTE}}}Code Status: Ethically unable to determine{{{SINGLE-QUOTE}}} AND " || dup_lookup_items || ")"
|
||||
||" and typecode like {{{SINGLE-QUOTE}}}other{{{SINGLE-QUOTE}}} and status like {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} and orderstatuslevelnum <= 50 and active = 1 "
|
||||
, primarytime = significandtm};
|
||||
|
||||
// Create actionable object list and populate with old code status orders:
|
||||
if exist old_cs_lst then
|
||||
found_existing_orders := true;
|
||||
aa_lst := ();
|
||||
|
||||
for i in 1 seqto count old_cs_lst do
|
||||
|
||||
//Create an AlertAction Object
|
||||
alert_action := call create_aa_object with "CV3Order", "CV3Order";
|
||||
|
||||
// Set values for AlertAction Object
|
||||
alert_action.EvokingEnterpriseItemID := evoking_order_catalog_master_item_guid;
|
||||
alert_action.EvokingObjectID := evoking_order_guid;
|
||||
alert_action.EvokingObjectName := evoking_order_name;
|
||||
alert_action.ActionItemStatus := "Existing";
|
||||
alert_action.ActionEvent := "DC-Cancel";
|
||||
alert_action.ActionItemID := old_cs_ord_guid_lst[i];
|
||||
alert_action.ActionItemName := old_cs_lst[i];
|
||||
alert_action.ActionEnterpriseItemID := old_cs_ocmi_guid_lst[i] ;
|
||||
alert_action.MLMName := "SCH_dup_code_status_stop";
|
||||
alert_action.ShortMessage := "This is the EXISTING Code status Order to DC-Cancel";
|
||||
|
||||
aa_lst := aa_lst, alert_action;
|
||||
|
||||
enddo; //i in 1 seqto count old_cs_lst
|
||||
|
||||
endif; // exist old_cs_lst
|
||||
|
||||
endif; // if found unsubmitted
|
||||
|
||||
|
||||
;;
|
||||
evoke:
|
||||
code_status_order or code_status_order_enter ;
|
||||
;;
|
||||
logic:
|
||||
|
||||
// 11/30/2011 - Don Warnick - ok to have duplicate for discharge order reconcilliation
|
||||
// 07/30/2012 - Don Warnick - reversed the logic......now not ok to have a duplicate
|
||||
// 10/05/2012 - Don Warnick - reversed the reversal...now ok to have a duplicate in discharge session
|
||||
|
||||
|
||||
// if found_existing_orders or found_unsubmitted_orders then
|
||||
if (found_existing_orders or found_unsubmitted_orders) and sessiontype <> "Discharge" then
|
||||
|
||||
conclude true;
|
||||
endif;
|
||||
;;
|
||||
action:
|
||||
if found_existing_orders then
|
||||
write dup_existing_msg at dup_existing_alert;
|
||||
attach aa_lst to dup_existing_alert;
|
||||
elseif found_unsubmitted_orders then
|
||||
write dup_unsubmitted_msg at dup_unsubmitted_alert;
|
||||
endif;
|
||||
;;
|
||||
Urgency: 99;;
|
||||
end:
|
||||
543
MLMStripper/bin/Debug/SCH/SCH_ED_TAMIFLU_AUTO_ORDER.mlm
Normal file
543
MLMStripper/bin/Debug/SCH/SCH_ED_TAMIFLU_AUTO_ORDER.mlm
Normal file
@@ -0,0 +1,543 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_ED_TAMIFLU_AUTO_ORDER ;;
|
||||
mlmname: SCH_ED_TAMIFLU_AUTO_ORDER;;
|
||||
arden: version 2.5;;
|
||||
version: 0.00;;
|
||||
institution: St. Clair Hospital ;;
|
||||
author: Sandy Zhang ;;
|
||||
specialist: Amy Georgulis ;;
|
||||
date: 2018-09-18;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Patients who came through the ED with Flu would receive a STAT/Now/Once dose of Tamiflu and remaining doses would be neglected due to disconnect in transition of care.
|
||||
This MLM will auto-order Tamiflu for a patient based on our algorithm below.
|
||||
|
||||
;;
|
||||
explanation:
|
||||
|
||||
Change History:
|
||||
09-18-2018 SZ CSR #36408 - Tamiflu transition orders
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
citations:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
||||
CrCl_info:= mlm {{{SINGLE-QUOTE}}}SCH_Func_Creatinine_Clearance{{{SINGLE-QUOTE}}};
|
||||
log_execution_info := false;
|
||||
|
||||
// declare MLM that will generate order into worksheet
|
||||
SCH_FUNC_CREATE_MED_ORDER_WORKSHEET := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_MED_ORDER_WORKSHEET{{{SINGLE-QUOTE}}};
|
||||
|
||||
// Can be evoked by any {{{SINGLE-QUOTE}}}transition orders{{{SINGLE-QUOTE}}} order sets, but not the hospitalist one
|
||||
order_set_enter_event := event {OrderSetEnter User OrderSet : where OrderSetName matches pattern "%transition orders%"
|
||||
and OrderSetName <> "Transition Orders- Hospitalist"
|
||||
};
|
||||
|
||||
// get guids
|
||||
userguid := read last {UserInfo: guid};
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, LocationGuid, VisitStatus, AdmitDtm) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, CurrentLocationGUID, VisitStatus, AdmitDtm };
|
||||
create_order := False;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Filter #1 - STAT/Now/Once order for Tamiflu
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
/*********************************************************************************************************************************/
|
||||
// checks for active oseltamivir (Tamiflu) STAT order during this visit
|
||||
// If exist, then that means patient was given a treatment dose of Tamiflu for strong evidence of flu
|
||||
(STAT_Order, STAT_Order_freq) := read last {
|
||||
" select o.name, o.FrequencyCode"
|
||||
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|
||||
|| " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || ClientVisitGuid || " "
|
||||
|| " and (o.name like {{{SINGLE-QUOTE}}}%oseltamivir%{{{SINGLE-QUOTE}}}) "
|
||||
|| " and (o.FrequencyCode = {{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}}"
|
||||
|| " or o.FrequencyCode = {{{SINGLE-QUOTE}}}Now{{{SINGLE-QUOTE}}}"
|
||||
|| " or o.FrequencyCode = {{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}})"
|
||||
|| " and o.OrderStatusLevelNum >= 15 "
|
||||
|| " and o.SignificantDtm > getdate()-2"
|
||||
// || " and o.OrderStatusLevelNum not in (69, 70) " // STAT order of Tamiflu does not need to be active, b/c it may be d/ced after it{{{SINGLE-QUOTE}}}s taken?
|
||||
};
|
||||
|
||||
if (exist STAT_Order) then
|
||||
create_order := True;
|
||||
Check_active_STAT_order := "active STAT/Now/Once order for Tamiflu was detected, patient might need inpatient Tamiflu orders";
|
||||
endif;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Filter #2 - If patient is < 18 years old, give alert to have user create the order
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
/*********************************************************************************************************************************/
|
||||
/* Get the patient{{{SINGLE-QUOTE}}}s age */
|
||||
(client_birthdatetime):= read last { ClientInfo: Birthdatetime};
|
||||
|
||||
client_age_in_seconds:= Now - client_birthdatetime;
|
||||
client_age:= truncate( client_age_in_seconds / (1 year) );
|
||||
|
||||
if (client_age < 18) and (create_order = true) then
|
||||
|
||||
// By this point we have decided an order needs to be created, give user the dialogue message to decide if they want the order
|
||||
Messagetext := "This patient received a dose of oseltamivir (Tamiflu) while in the ED. Please order ongoing oseltamivir for this patient to prevent an interruption of antiviral therapy." ||
|
||||
"\n\nPatient is " || client_age || " year(s) old, please manually place oseltamivir (Tamiflu) order based off weight and age."
|
||||
;
|
||||
|
||||
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with Messagetext ,"Oseltamivir (Tamiflu) Auto-order","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
create_order := False;
|
||||
|
||||
endif; //if (client_age < 18) and (create_order = true) and then
|
||||
|
||||
// if a stat order of Tamiflu exists, then continue
|
||||
if (create_order = true) then
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Filter #3 - Active nonSTAT order for Tamiflu
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
/*********************************************************************************************************************************/
|
||||
// Check for active non-stat order (anything with frequency that{{{SINGLE-QUOTE}}}s not STAT, Now, or Once) within past 2 days.
|
||||
(Active_nonSTAT_Order, Active_nonSTAT_Order_freq) := read last {
|
||||
" select o.name, o.FrequencyCode"
|
||||
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|
||||
|| " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || ClientVisitGuid || " "
|
||||
|| " and (o.name like {{{SINGLE-QUOTE}}}%oseltamivir%{{{SINGLE-QUOTE}}}) "
|
||||
|| " and (o.FrequencyCode <> {{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}})"
|
||||
|| " and (o.FrequencyCode <> {{{SINGLE-QUOTE}}}Now{{{SINGLE-QUOTE}}})"
|
||||
|| " and (o.FrequencyCode <> {{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}})"
|
||||
|| " and o.OrderStatusLevelNum >= 15 "
|
||||
|| " and o.OrderStatusLevelNum not in (69, 70) "
|
||||
|| " and o.SignificantDtm > getdate()-2"
|
||||
};
|
||||
|
||||
if (exist Active_nonSTAT_Order) then
|
||||
create_order := False;
|
||||
Check_active_nonSTAT_order := "active STAT order for Tamiflu was detected, patient will need inpatient Tamiflu orders";
|
||||
endif;
|
||||
|
||||
/*********************************************************************************************************************************/
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// order creation
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
/*********************************************************************************************************************************/
|
||||
if (create_order = true) then
|
||||
|
||||
// If the user selects another careprovider (Nurse or US entry), pass the requestors user ID
|
||||
if userguid <> EVOKINGOBJECT.CareProviderGUID then
|
||||
userguid := EVOKINGOBJECT.CareProviderGUID;
|
||||
endif;
|
||||
|
||||
/***********************************************************/
|
||||
// Version 1 from SCH_DrugLevelMonitoring
|
||||
Creatinine, CreateDTM := read last
|
||||
{"Select top 1 bo.value, o.performeddtm "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(clientguid)
|
||||
|| " and o.performeddtm >= " || SQL(AdmitDtm)
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Creatinine Plasma/Serum{{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
|
||||
creatinine_number := Creatinine as number;
|
||||
|
||||
if Creatinine is not Null then
|
||||
(CrCl_Message, Crcl_Value, SCRfromMLM, wt, patientage) := call CrCl_info with (ClientVisitGuid, ChartGuid, ClientGuid, creatinine_number);
|
||||
// get doses of meds based off this CrCl dose
|
||||
endif;
|
||||
|
||||
if (Crcl_Value > 60) or (Crcl_Value is null) then
|
||||
|
||||
// declare Tamiflu order details/variable
|
||||
OrderName := "Oseltamivir 75mg Cap";
|
||||
ItemModifier := "- CrCl > 60, Q12H, x 9 doses";
|
||||
ItemVersion := "";
|
||||
creation_reason := "from Tamiflu Protocol";
|
||||
OrderFrequency := "Q12H";
|
||||
special_instructions_value_Mod := "";
|
||||
|
||||
new_order_desc := "75mg Q12H x 9 doses";
|
||||
|
||||
// Default dosing is Q12H
|
||||
DosesPerDay := 2;
|
||||
FrequencyInterval := 12;
|
||||
FrequencyTimeUOM := "hr(s)";
|
||||
|
||||
endif; // if (Crcl_Value > 60) or (Crcl_Value is null) then
|
||||
|
||||
if (Crcl_Value >= 30) and (Crcl_Value <= 60) then
|
||||
|
||||
// declare Tamiflu order details/variable
|
||||
OrderName := "Oseltamivir 30mg Cap";
|
||||
ItemModifier := "- CrCl 30-60, Q12H, x 9 doses";
|
||||
ItemVersion := "";
|
||||
creation_reason := "from Tamiflu Protocol";
|
||||
OrderFrequency := "Q12H";
|
||||
special_instructions_value_Mod := "";
|
||||
|
||||
new_order_desc := "30mg Q12H x 9 doses";
|
||||
|
||||
// Q12H frequency
|
||||
DosesPerDay := 2;
|
||||
FrequencyInterval := 12;
|
||||
FrequencyTimeUOM := "hr(s)";
|
||||
|
||||
endif; // if (Crcl_Value >= 30) or (Crcl_Value <= 60) then
|
||||
|
||||
|
||||
if (Crcl_Value >= 10) and (Crcl_Value <= 29.9) then
|
||||
|
||||
// declare Tamiflu order details/variable
|
||||
OrderName := "Oseltamivir 30mg Cap";
|
||||
ItemModifier := "- CrCl 10-29.9, Q24H, x 4 doses";
|
||||
ItemVersion := "";
|
||||
creation_reason := "from Tamiflu Protocol";
|
||||
OrderFrequency := "Q24H";
|
||||
special_instructions_value_Mod := "";
|
||||
|
||||
new_order_desc := "30mg Q24H x 4 doses";
|
||||
|
||||
// Q24H frequency
|
||||
DosesPerDay := 1;
|
||||
FrequencyInterval := 24;
|
||||
FrequencyTimeUOM := "hr(s)";
|
||||
|
||||
endif; // if (Crcl_Value >= 10) or (Crcl_Value <= 29.9) then
|
||||
|
||||
if (Crcl_Value < 10) then
|
||||
|
||||
// declare Tamiflu order details/variable
|
||||
OrderName := "Oseltamivir 30mg Cap";
|
||||
ItemModifier := "- CrCl < 10, Q48H, x 2 doses";
|
||||
ItemVersion := "";
|
||||
creation_reason := "from Tamiflu Protocol";
|
||||
OrderFrequency := "Q48H";
|
||||
special_instructions_value_Mod := "";
|
||||
|
||||
new_order_desc := "30mg Q48H x 2 doses";
|
||||
|
||||
// Q48H frequency
|
||||
DosesPerDay := 1;
|
||||
FrequencyInterval := 48;
|
||||
FrequencyTimeUOM := "hr(s)";
|
||||
|
||||
endif; // if (Crcl_Value < 10) then
|
||||
|
||||
|
||||
// gather guids for creating order
|
||||
//Active_ClientVisitGUID := this_communication.ClientVisitGUID;
|
||||
Active_OrderGUID:= PrimaryObjdetail.GUID;
|
||||
location_guid := read last {"select CurrentLocationGUID from CV3ClientVisit where GUID=" || SQL(ClientVisitGuid)};
|
||||
|
||||
|
||||
// By this point we have decided an order needs to be created, give user the dialogue message to decide if they want the order
|
||||
Messagetext := "This patient received a dose of oseltamivir (Tamiflu) while in the ED. Please order ongoing oseltamivir for this patient to prevent an interruption of antiviral therapy." ||
|
||||
" Recommended oseltamivir dose for this patient based on renal function is " || new_order_desc ||
|
||||
"\n\nDo you want to order oseltamivir " || new_order_desc || " ?" ||
|
||||
"\n\nSelecting {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} will add it to the order worksheet."
|
||||
;
|
||||
|
||||
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with Messagetext ,"Oseltamivir (Tamiflu) Auto-order","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
if((dialogResult as string) = "Yes") then
|
||||
|
||||
|
||||
/*****************************************************************************************************/
|
||||
/*****************************************************************************************************/
|
||||
// Imported from FORM_Antibiotic_Scheduling
|
||||
// Purpose: to auto-schedule tamiflu dose the same way other abx are being auto-scheduled
|
||||
// example: if 14:46, then schedule for 16:00 start time
|
||||
/*****************************************************************************************************/
|
||||
/*****************************************************************************************************/
|
||||
|
||||
// GATHER INFORMATION ABOUT MOST RECENTLY ADMINISTERED ORDER (past 2 days) OF Tamiflu
|
||||
(ExistingOrderLastGiven, ExistingOrderFrequency, ExistingOrderHoursSinceGiven,
|
||||
ExistingOrderName, ExistingOrderTherapeuticCategory, ExistingOrderDrugKey,
|
||||
ExistingRoute, ExistingNextTaskPending, ExistingNextTaskCanceled) := read last
|
||||
{
|
||||
" select oto.performedfromdtm, o.FrequencyCode, datediff (HH, oto.performedfromdtm, getdate()), "
|
||||
|| " o.name, ocmi.TherapeuticCategory, dm.DrugKey, ot.OrderRoute "
|
||||
|| " ,(select top 1 oto2.SignificantDtm from cv3ordertaskoccurrence oto2 with (nolock) "
|
||||
|| " where oto2.clientguid = ot.clientguid and oto2.orderguid = o.guid and oto2.ordertaskguid = ot.guid "
|
||||
|| " and oto2.SignificantDtm > getdate()-2 and oto2.taskstatuscode = {{{SINGLE-QUOTE}}}Pending{{{SINGLE-QUOTE}}}) "
|
||||
|| " ,(select top 1 oto2.SignificantDtm from cv3ordertaskoccurrence oto2 with (nolock) "
|
||||
|| " where oto2.clientguid = ot.clientguid and oto2.orderguid = o.guid and oto2.ordertaskguid = ot.guid "
|
||||
|| " and oto2.SignificantDtm > getdate()-2 and oto2.taskstatuscode = {{{SINGLE-QUOTE}}}Canceled{{{SINGLE-QUOTE}}}) "
|
||||
|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
|
||||
|| " join cv3drugmapping dm with (nolock) on dm.catalogitemguid = ocmi.guid "
|
||||
|| " join cv3order o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|
||||
|| " and o.ClientGUID = " || ClientGuid || " "
|
||||
|| " and o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}anti-infectives | antiviral agents{{{SINGLE-QUOTE}}}"
|
||||
|| " and o.Name like {{{SINGLE-QUOTE}}}%oseltamivir%{{{SINGLE-QUOTE}}}"
|
||||
|| " join cv3ordertask ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid "
|
||||
|| " join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid "
|
||||
|| " and oto.ordertaskguid = ot.guid and oto.SignificantDtm > getdate()-2 and oto.taskstatuscode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
|
||||
|| " order by oto.performedfromdtm "
|
||||
};
|
||||
|
||||
CurrentMinute:= extract minute NOW;
|
||||
CurrentHour := extract hour NOW;
|
||||
NextHour := extract hour NOW + 1;
|
||||
HourAfterNext:= extract hour NOW + 2;
|
||||
CalculatedHour := NextHour;
|
||||
|
||||
yesterday := extract day NOW - 1;
|
||||
today := extract day NOW;
|
||||
tomorrow := extract day NOW + 1;
|
||||
dayafter := extract day NOW + 2;
|
||||
|
||||
LastGivenMin := extract minute ExistingOrderLastGiven;
|
||||
LastGivenHour := extract hour ExistingOrderLastGiven;
|
||||
LastGivenDay := extract day ExistingOrderLastGiven;
|
||||
|
||||
TargetHour := extract hour ExistingOrderLastGiven + FrequencyInterval;
|
||||
|
||||
TargetDate := ExistingOrderLastGiven;
|
||||
|
||||
|
||||
// SCHEDULED TIME ADJUSTMENTS - for variable start time frequencies
|
||||
If TargetHour is not null and FrequencyTimeUOM = "hr(s)" then
|
||||
|
||||
If (LastGivenMin >= 45) then
|
||||
TargetHour := TargetHour + 1;
|
||||
endif;
|
||||
|
||||
// Adjust for Calculated Dose Hour greater than 24 (next dose falls after midnight today)
|
||||
If TargetHour < 24 then
|
||||
TargetHour := TargetHour;
|
||||
ElseIf TargetHour >= 24 and TargetHour < 48 then
|
||||
TargetHour := TargetHour - 24;
|
||||
TargetDate := TargetDate + 1 day;
|
||||
ElseIf TargetHour >= 48 then
|
||||
TargetHour := TargetHour - 48;
|
||||
TargetDate := TargetDate + 2 day;
|
||||
endif;
|
||||
|
||||
|
||||
// Adjust for Calculated Dose Time that is in the past...begin now (existing med has missed recent doses)
|
||||
TimeNow := (extract year NOW) FORMATTED WITH "%2.2d" || (extract month NOW) FORMATTED WITH "%2.2d" ||
|
||||
(extract day NOW) FORMATTED WITH "%2.2d" || (extract hour NOW) FORMATTED WITH "%2.2d" ||
|
||||
(extract minute NOW) FORMATTED WITH "%2.2d";
|
||||
|
||||
TimeScheduled:= (extract year TargetDate) FORMATTED WITH "%2.2d" || (extract month TargetDate) FORMATTED WITH "%2.2d" ||
|
||||
(extract day TargetDate) FORMATTED WITH "%2.2d" || TargetHour FORMATTED WITH "%2.2d" || "00";
|
||||
|
||||
|
||||
// This means we are already past the time for which the dose should have been scheduled
|
||||
// Set the dose to be scheduled ASAP to the nearest hour
|
||||
if (TimeScheduled <= TimeNow) then
|
||||
|
||||
CalculatedHour := NextHour;
|
||||
TargetDate := NOW;
|
||||
|
||||
if (CurrentMinute >= 45) then
|
||||
CalculatedHour := CalculatedHour + 1;
|
||||
endif;
|
||||
|
||||
|
||||
If (CalculatedHour >= 24) then
|
||||
CalculatedHour := CalculatedHour - 24;
|
||||
TargetDate := TargetDate + 1 day;
|
||||
endif;
|
||||
|
||||
checkpoint := "TimeScheduled <= TimeNow (This means we are already past the time for which the dose should have been scheduled, so schedule for next hour)";
|
||||
|
||||
// adjust hours if calculatedhour lands within the bedtime window of 0:00-05:59 or
|
||||
If (CalculatedHour >= 0 and CalculatedHour <= 5) then
|
||||
CalculatedHour := 06;
|
||||
ElseIf (CalculatedHour >= 12 and CalculatedHour <= 17 and FrequencyInterval = 12) then
|
||||
CalculatedHour := 18;
|
||||
endif;
|
||||
|
||||
|
||||
else // If TimeScheduled > TimeNow is true then (dose should be scheduled in future)
|
||||
CalculatedHour := TargetHour;
|
||||
TargetDate := TargetDate;
|
||||
checkpoint := "TimeScheduled > TimeNow (dose should be scheduled in future)";
|
||||
|
||||
if (FrequencyInterval = 12) then
|
||||
|
||||
// adjust hours if calculatedhour lands within the bedtime window of 0:00-05:59 or 12:00-17:59 (b/c Q12H would cause subsequent doses to be in the bedtime window, ex. 14:30 -> 02:30)
|
||||
If (TargetHour >= 0 and TargetHour <= 2) then
|
||||
if (CurrentHour < 23) then
|
||||
CalculatedHour := 23;
|
||||
TargetDate := TargetDate - 1 day;
|
||||
else
|
||||
CalculatedHour := 06;
|
||||
endif;
|
||||
path := "A";
|
||||
ElseIf (TargetHour >= 3 and TargetHour <= 5) then
|
||||
CalculatedHour := 06;
|
||||
path := "B";
|
||||
ElseIf (TargetHour >= 12 and TargetHour <= 14) then
|
||||
if (CurrentHour < 11) then
|
||||
CalculatedHour := 11;
|
||||
else
|
||||
CalculatedHour := 18;
|
||||
endif;
|
||||
path := "C";
|
||||
ElseIf (TargetHour >= 15 and TargetHour <= 17) then
|
||||
CalculatedHour := 18;
|
||||
path := "D";
|
||||
endif; // If (TargetHour >= 0 and TargetHour <= 2) then
|
||||
|
||||
ElseIf (FrequencyInterval = 24 or FrequencyInterval = 48) then
|
||||
|
||||
// adjust hours if calculatedhour lands within the bedtime window of 0:00-05:59
|
||||
If (TargetHour >= 0 and TargetHour <= 2) then
|
||||
if (CurrentHour < 23) then
|
||||
CalculatedHour := 23;
|
||||
TargetDate := TargetDate - 1 day;
|
||||
else
|
||||
CalculatedHour := 06;
|
||||
endif;
|
||||
path := "A";
|
||||
ElseIf (TargetHour >= 3 and TargetHour <= 5) then
|
||||
CalculatedHour := 06;
|
||||
path := "B";
|
||||
endif; // If (TargetHour >= 0 and TargetHour <= 2) then
|
||||
|
||||
endif; // if (FrequencyInterval = 12) then
|
||||
|
||||
endif; //if (TimeScheduled <= TimeNow) then
|
||||
|
||||
|
||||
// Format the date and time as required for worksheet order creation
|
||||
CalculatedTime := CalculatedHour || ":00";
|
||||
RequestedTime := CalculatedTime;
|
||||
|
||||
TargetDAY := extract day TargetDate;
|
||||
|
||||
// translate day to the right term for worksheet order creation
|
||||
if (TargetDAY = today) then
|
||||
RequestedDate := "T";
|
||||
endif;
|
||||
|
||||
if (TargetDAY = tomorrow) then
|
||||
RequestedDate := "T+1";
|
||||
endif;
|
||||
|
||||
if (TargetDAY = dayafter) then
|
||||
RequestedDate := "T+2";
|
||||
endif;
|
||||
|
||||
|
||||
// call MLM that to generate worksheet order
|
||||
Create_Worksheet_Order := call SCH_FUNC_CREATE_MED_ORDER_WORKSHEET with
|
||||
OrderName,
|
||||
ItemModifier,
|
||||
ItemVersion,
|
||||
creation_reason,
|
||||
OrderFrequency,
|
||||
Active_OrderGUID,
|
||||
ClientVisitGuid,
|
||||
location_guid,
|
||||
UserGuid,
|
||||
special_instructions_value_Mod,
|
||||
RequestedDate,
|
||||
RequestedTime
|
||||
;
|
||||
/*********************************************************/
|
||||
|
||||
else // If TargetHour is not null and FrequencyTimeUOM = "hr(s)" then
|
||||
// This means TargetHour is null because our query did not find a lastgiven dose (Tamiflu stat order is on file for pt, but not charted as given)
|
||||
// Action: default new order to next hour, make sure it{{{SINGLE-QUOTE}}}s not in bedtime dose range and adjust start time if needed
|
||||
|
||||
CalculatedHour := NextHour;
|
||||
TargetDate := NOW;
|
||||
|
||||
if (CurrentMinute >= 45) then
|
||||
CalculatedHour := CalculatedHour + 1;
|
||||
endif;
|
||||
|
||||
|
||||
If (CalculatedHour >= 24) then
|
||||
CalculatedHour := CalculatedHour - 24;
|
||||
TargetDate := TargetDate + 1 day;
|
||||
endif;
|
||||
|
||||
// adjust hours if calculatedhour lands within the bedtime window of 0:00-05:59 or
|
||||
If (CalculatedHour >= 0 and CalculatedHour <= 5) then
|
||||
CalculatedHour := 06;
|
||||
ElseIf (CalculatedHour >= 12 and CalculatedHour <= 17 and FrequencyInterval = 12) then
|
||||
CalculatedHour := 18;
|
||||
endif;
|
||||
|
||||
|
||||
// Format the date and time as required for worksheet order creation
|
||||
CalculatedTime := CalculatedHour || ":00";
|
||||
RequestedTime := CalculatedTime;
|
||||
|
||||
TargetDAY := extract day TargetDate;
|
||||
|
||||
// translate day to the right term for worksheet order creation
|
||||
if (TargetDAY = today) then
|
||||
RequestedDate := "T";
|
||||
endif;
|
||||
|
||||
if (TargetDAY = tomorrow) then
|
||||
RequestedDate := "T+1";
|
||||
endif;
|
||||
|
||||
if (TargetDAY = dayafter) then
|
||||
RequestedDate := "T+2";
|
||||
endif;
|
||||
|
||||
|
||||
// call MLM that to generate worksheet order
|
||||
Create_Worksheet_Order := call SCH_FUNC_CREATE_MED_ORDER_WORKSHEET with
|
||||
OrderName,
|
||||
ItemModifier,
|
||||
ItemVersion,
|
||||
creation_reason,
|
||||
OrderFrequency,
|
||||
Active_OrderGUID,
|
||||
ClientVisitGuid,
|
||||
location_guid,
|
||||
UserGuid,
|
||||
special_instructions_value_Mod,
|
||||
RequestedDate,
|
||||
RequestedTime
|
||||
;
|
||||
/*********************************************************/
|
||||
|
||||
endif; // If TargetHour is not null and FrequencyTimeUOM = "hr(s)" then
|
||||
|
||||
endif; //if((dialogResult as string) = "Yes") then
|
||||
|
||||
endif; //if (create_order = true) then
|
||||
|
||||
endif; //if (create_order = true) then
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: order_set_enter_event;
|
||||
;;
|
||||
logic: conclude true;
|
||||
;;
|
||||
action:
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
276
MLMStripper/bin/Debug/SCH/SCH_FUNC_CCDA_CREATE_AND_TRANSPORT.mlm
Normal file
276
MLMStripper/bin/Debug/SCH/SCH_FUNC_CCDA_CREATE_AND_TRANSPORT.mlm
Normal file
@@ -0,0 +1,276 @@
|
||||
maintenance:
|
||||
|
||||
title: Test the creation of a CCD_for DirectID CCDA generation;;
|
||||
mlmname: SCH_FUNC_CCDA_CREATE_AND_TRANSPORT;;
|
||||
arden: version 2.5;;
|
||||
version: 6.10;;
|
||||
institution: Allscripts, Standard MLM;;
|
||||
author: Allscripts Healthcare Solutions, Inc.;;
|
||||
specialist: ;;
|
||||
date: 2014-06-11;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
This called MLM creates and transports a CCD to an HIE or a File
|
||||
;;
|
||||
explanation:
|
||||
This MLM can create and then transport a CCD based on the supplied configuartion.
|
||||
|
||||
Change history
|
||||
|
||||
06.11.2014 DW CSR# 31688 - MU2 The MLM was copied from SMP_Create_And_Tranport_CCDA_Autoprint
|
||||
08.25.2014 DW CSR# 31688 - Added Concordia as a recipient
|
||||
09.24.2014 DW CSR# 31688 - Added Family Home Health as a recipient
|
||||
08.14.2015 DW CSR# 33555 - SCM 15.1 Upgrade - Found that Test SCM was pointing to the Production Affinity domain which prevented transmission (boomerang back to our queue)
|
||||
08.18.2015 DW CSR# 26006 - Transport CCDA to CCHIE via XDS protocol
|
||||
12.18.2015 DW CSR# 26006 - Changed destination of CCHIE database from Stage to Prod
|
||||
04.19.2018 DW CSR# 36577 - Concordia Visiting Nurses office in South Hills - request for change in direct messaging destination (temporary changed MLM to also send to prior address)
|
||||
05.24.2018 DW CSR# 36577 - Concordia Visiting Nurses office in South Hills - request for change in direct messaging destination (removed temporary change to also send to prior address)
|
||||
09.20.2019 DW CSR# 35638 - MU3 - Transmit to physician direct address (redisign....pass direct address to create and transport MLM instead of discharge location)
|
||||
|
||||
;;
|
||||
keywords: CCD; HIE;
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
if called_by_editor then EvokingObject := read last { Order: This }; endif;
|
||||
log_execution_info := false;
|
||||
|
||||
|
||||
(ClientGuid,ChartGuid,VisitGuid,CCDAReport,Transport,SCMEnvironment,DirectAddress,TransportType) := ARGUMENT;
|
||||
|
||||
GENERATION_DOCUMENT_NAME := CCDAReport;
|
||||
STORAGE_DOCUMENT_NAME := "";
|
||||
AUTHOR_USER_NAME := "autocreateccda";
|
||||
AFFINITY_DOMAIN := "Allscripts Community Direct Messaging";
|
||||
PATIENT_IDENTIFIER_TYPE := "VisitIDCode";
|
||||
FILE_PATH := "\\SC1EFS1\ClientData\CCDA documents\";
|
||||
TRANSPORT_TYPE := TransportType;
|
||||
RECIPIENT_DIRECT_IDS := DirectAddress;
|
||||
|
||||
|
||||
if TRANSPORT_TYPE <> "DIRECT" and TRANSPORT_TYPE <> "XDS"
|
||||
then
|
||||
TRANSPORT_TYPE := "FILE";
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// DIRECT TRANSPORT
|
||||
|
||||
|
||||
if TRANSPORT_TYPE = "DIRECT"
|
||||
|
||||
then
|
||||
|
||||
If SCMEnvironment = "Test"
|
||||
then
|
||||
RECIPIENT_DIRECT_IDS := ("geraldsandidge@sch.direct.medalliesdirectstage.com");
|
||||
AFFINITY_DOMAIN := "Test Allscripts Community Direct Messaging";
|
||||
|
||||
endif; // SCMEnvironment
|
||||
|
||||
endif; // TransportType = Direct
|
||||
|
||||
|
||||
// XDS TRANSPORT
|
||||
|
||||
|
||||
if TRANSPORT_TYPE = "XDS"
|
||||
|
||||
|
||||
then
|
||||
|
||||
If SCMEnvironment = "Development"
|
||||
then
|
||||
AFFINITY_DOMAIN := "SC_Clinical Connect HIE Test";
|
||||
|
||||
|
||||
Elseif SCMEnvironment = "Production"
|
||||
|
||||
then
|
||||
AFFINITY_DOMAIN := "SC_Clinical Connect HIE Prod";
|
||||
|
||||
endif; // SCM Environment
|
||||
|
||||
|
||||
endif; // TransportType = XDS
|
||||
|
||||
|
||||
|
||||
ASSIGNING_AUTHORITY_OID := read last {"SELECT Value FROM HVCEnvProfile WHERE Code = {{{SINGLE-QUOTE}}}AssigningAuthorityOID{{{SINGLE-QUOTE}}} AND HierarchyCode = {{{SINGLE-QUOTE}}}Documents|Continuity of Care{{{SINGLE-QUOTE}}}"};
|
||||
AUTHOR_USER_GUID := read last {"SELECT GUID FROM CV3User WHERE IDCode = " || SQL(AUTHOR_USER_NAME)};
|
||||
HAS_ERROR_OCCURRED := FALSE;
|
||||
ERROR_MESSAGE := "";
|
||||
|
||||
|
||||
IF NOT EXISTS AUTHOR_USER_GUID
|
||||
THEN
|
||||
HAS_ERROR_OCCURRED := TRUE;
|
||||
ERROR_MESSAGE := ERROR_MESSAGE || "The supplied AUTHOR_USER_NAME of " || AUTHOR_USER_NAME || " is not a valid user.\n";
|
||||
ENDIF; // Exists AUTHOR_USER_GUID
|
||||
|
||||
|
||||
|
||||
// CCDA Creation
|
||||
|
||||
|
||||
|
||||
USING "Sunrise.DocEx.API";
|
||||
|
||||
TRY
|
||||
patientContext := new NET_OBJECT {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.Context.PatientContext{{{SINGLE-QUOTE}}};
|
||||
|
||||
patientContext.ClientGuid:= (ClientGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}};
|
||||
patientContext.ChartGuid := (ChartGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}};
|
||||
patientContext.VisitGuid := (VisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}};
|
||||
|
||||
documentContext := new NET_OBJECT {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.Context.DocumentContext{{{SINGLE-QUOTE}}};
|
||||
documentContext.CreationDocumentName := GENERATION_DOCUMENT_NAME as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
|
||||
documentContext.DocumentStorageName := STORAGE_DOCUMENT_NAME as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
|
||||
|
||||
authorContext := new NET_OBJECT {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.Context.AuthorContext{{{SINGLE-QUOTE}}};
|
||||
authorContext.AuthorGuid := (AUTHOR_USER_GUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}};
|
||||
authorContext.AuthorUserName := AUTHOR_USER_NAME as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
|
||||
|
||||
|
||||
// Gather the Transport_Patient_Identifier (ClientIDCode)
|
||||
|
||||
|
||||
IF TRANSPORT_TYPE IN ("XDS", "DIRECT")
|
||||
|
||||
THEN
|
||||
|
||||
IF PATIENT_IDENTIFIER_TYPE = "VisitIDCode"
|
||||
THEN TRANSPORT_PATIENT_IDENTIFIER := EvokingObject.VisitIDCode;
|
||||
|
||||
ELSEIF PATIENT_IDENTIFIER_TYPE = "ClientIDCode"
|
||||
THEN TRANSPORT_PATIENT_IDENTIFIER := EvokingObject.IDCode;
|
||||
|
||||
ELSE TRANSPORT_PATIENT_IDENTIFIER := read last
|
||||
{
|
||||
"SELECT ClientIDCode FROM CV3ClientID "
|
||||
||"WHERE ClientGUID = " || SQL(ClientGUID) || " "
|
||||
||"AND TypeCode = " || SQL(PATIENT_IDENTIFIER_TYPE) || " "
|
||||
||"AND Active = 1 AND IDStatus = {{{SINGLE-QUOTE}}}ACT{{{SINGLE-QUOTE}}}"
|
||||
};
|
||||
ENDIF; // PATIENT_IDENTIFIER_TYPE
|
||||
|
||||
|
||||
IF NOT EXISTS TRANSPORT_PATIENT_IDENTIFIER
|
||||
THEN
|
||||
HAS_ERROR_OCCURRED:= TRUE;
|
||||
ERROR_MESSAGE := ERROR_MESSAGE || "Unable to obtain the patient identity for this patient. Cannot proceed with transporting the CCD via XDS.b.\n";
|
||||
ENDIF; //EXISTS TRANSPORT_PATIENT_IDENTIFIER
|
||||
|
||||
|
||||
IF NOT EXISTS ASSIGNING_AUTHORITY_OID
|
||||
THEN
|
||||
HAS_ERROR_OCCURRED:= TRUE;
|
||||
ERROR_MESSAGE := ERROR_MESSAGE || "The ASSIGNING_AUTHORITY_OID value must be set in order to transport the CCD via XDS.b.\n";
|
||||
ENDIF; // EXISTS ASSIGNING_AUTHORITY_OID
|
||||
|
||||
|
||||
|
||||
|
||||
IF TRANSPORT_TYPE = "XDS"
|
||||
|
||||
THEN
|
||||
transportContext := new NET_OBJECT {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.Context.XdsTransportContext{{{SINGLE-QUOTE}}};
|
||||
|
||||
|
||||
ELSEIF TRANSPORT_TYPE = "DIRECT"
|
||||
|
||||
THEN
|
||||
transportContext := new NET_OBJECT {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.Context.DirectTransportContext{{{SINGLE-QUOTE}}};
|
||||
directIDCollection := new NET_OBJECT {{{SINGLE-QUOTE}}}System.Collections.ObjectModel.Collection<String>{{{SINGLE-QUOTE}}};
|
||||
index_list := 1 seqto (count RECIPIENT_DIRECT_IDS);
|
||||
|
||||
for ind in index_list do
|
||||
void := call directIDCollection.Add with (RECIPIENT_DIRECT_IDS[ind] as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
|
||||
enddo; //ind in index_list do
|
||||
|
||||
transportContext.RecipientDirectIDs := directIDCollection AS {{{SINGLE-QUOTE}}}System.Collections.ObjectModel.Collection<String>{{{SINGLE-QUOTE}}};
|
||||
|
||||
Endif; // TRANSPORT_TYPE = "XDS" or "DIRECT"
|
||||
|
||||
|
||||
transportContext.AffinityDomainName := AFFINITY_DOMAIN as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
|
||||
transportContext.PatientAssigningAuthorityOid := ASSIGNING_AUTHORITY_OID as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
|
||||
transportContext.PatientIdentifier := TRANSPORT_PATIENT_IDENTIFIER as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
|
||||
|
||||
|
||||
|
||||
ELSEIF TRANSPORT_TYPE = "FILE"
|
||||
|
||||
THEN
|
||||
|
||||
transportContext := new NET_OBJECT {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.Context.FileTransportContext{{{SINGLE-QUOTE}}};
|
||||
transportContext.FilePath := FILE_PATH as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
|
||||
|
||||
ELSE
|
||||
|
||||
transportContext := new NET_OBJECT {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.Context.NullTransportContext{{{SINGLE-QUOTE}}};
|
||||
|
||||
|
||||
|
||||
ENDIF; // TRANSPORT_TYPE
|
||||
|
||||
|
||||
|
||||
// TRANSPORT SECTION
|
||||
|
||||
|
||||
|
||||
|
||||
IF NOT HAS_ERROR_OCCURRED THEN
|
||||
|
||||
void := CALL {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.ContinuityOfCareDocument{{{SINGLE-QUOTE}}}.CreateAndTransportDocument WITH (
|
||||
documentContext, patientContext, authorContext, transportContext);
|
||||
|
||||
ENDIF;
|
||||
|
||||
ENDTRY;
|
||||
|
||||
CATCH EXCEPTION ex
|
||||
|
||||
HAS_ERROR_OCCURRED:= TRUE;
|
||||
ERROR_MESSAGE := ERROR_MESSAGE || "An error occurred using the Sunrise.DocEx.API:\n" || ex;
|
||||
|
||||
|
||||
|
||||
ENDCATCH;
|
||||
|
||||
|
||||
|
||||
// Diagnostic Alert - Can be enabled if needed
|
||||
// send_alert := "DoNotSend";
|
||||
// alert_dest := destination { Alert: warning, "Informational", high, chart, "Informational", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
IF (NOT HAS_ERROR_OCCURRED)
|
||||
THEN
|
||||
conclude TRUE;
|
||||
ELSE
|
||||
conclude FALSE;
|
||||
ENDIF;
|
||||
;;
|
||||
action:
|
||||
|
||||
// Diagnostic Alert - Can be enabled if needed
|
||||
// write " Messages " || " Exectue the CREATE MLM - " || NOW || " " at alert_dest;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
170
MLMStripper/bin/Debug/SCH/SCH_FUNC_CCDA_PRINT.mlm
Normal file
170
MLMStripper/bin/Debug/SCH/SCH_FUNC_CCDA_PRINT.mlm
Normal file
@@ -0,0 +1,170 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_FUNC_CCDA_PRINT;;
|
||||
mlmname: SCH_FUNC_CCDA_PRINT;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: Allscripts;;
|
||||
author: Renish Bhimani;;
|
||||
specialist: ;;
|
||||
date: 2014-05-21;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: print CCD-A document report from MLM
|
||||
|
||||
;;
|
||||
explanation: This called MLM uses ReportRequest class to print CCD-A document report.
|
||||
It also set report{{{SINGLE-QUOTE}}}s parameter values and distribution information
|
||||
|
||||
Change history
|
||||
|
||||
06.25.2014 DW CSR# 31688 - MU2 Created from ACS_CCDA_DocumentAutoPrint
|
||||
07.08.2014 DW CSR# 31688 - MU2 Corrected routing issue with code attained from JT Mather which updates destination info to the Report Request object
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "SCMLib";
|
||||
using "SCM.Common.Interfaces";
|
||||
using namespace "SCMLib";
|
||||
using namespace "SCM.Common.Interfaces";
|
||||
|
||||
|
||||
(ClientGuid,ChartGuid,VisitGuid,CCDAReport) := ARGUMENT;
|
||||
|
||||
|
||||
ClientDocumentGUID := read first
|
||||
{
|
||||
" Select GUID from CV3ClientDocument with (nolock) WHERE DocumentName = " || SQL(CCDAReport)
|
||||
|| " AND ClientGUID = " || sql(ClientGUID) || " AND ChartGUID = " || SQL(ChartGuid)
|
||||
|| " AND ClientVisitGUID = " || SQL(VisitGuid)
|
||||
|| " ORDER BY TouchedWhen DESC"
|
||||
};
|
||||
|
||||
|
||||
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 ];
|
||||
|
||||
|
||||
if (ClientDocumentGUID <> "" OR ClientDocumentGUID is not null)
|
||||
then
|
||||
try
|
||||
|
||||
report_request_obj := call {{{SINGLE-QUOTE}}}ObjectsPlusXA.SunriseClinicalManager.ReportRequest{{{SINGLE-QUOTE}}}.CreateReportRequest with ("ACS CCDA Document Auto Print" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
|
||||
|
||||
if (report_request_obj.Parameters is not null and report_request_obj.Parameters.Count > 0)
|
||||
then
|
||||
report_parameter_list := ();
|
||||
for parameterIndex in (1 seqto report_request_obj.Parameters.Count)
|
||||
do
|
||||
report_parameter_list := report_parameter_list, report_request_obj.Parameters[parameterIndex];
|
||||
enddo;
|
||||
endif;
|
||||
|
||||
parameter0 := first (report_parameter_list where report_parameter_list.Name = "varClientDocumentGUID");
|
||||
if parameter0.AllowModification then
|
||||
void := call parameter0.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(ClientDocumentGUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
(user_workstation_name) := read last {StateInfo: WorkstationName};
|
||||
|
||||
print_job_destination := read last {"Select TOP(01) lpl.PrinterAddress
|
||||
From CV3Workstation ws
|
||||
JOIN CV3Location l on l.GUID = ws.LocationGUID
|
||||
JOIN HVCLogicalPrintLocation lpl on lpl.LocnGUID = l.GUID
|
||||
Where ws.IDCode = " || SQL(user_workstation_name) || "
|
||||
AND ws.Active = 1
|
||||
AND l.Active = 1
|
||||
AND lpl.Active = 1
|
||||
AND lpl.LogicalPrinter = {{{SINGLE-QUOTE}}}default report printer{{{SINGLE-QUOTE}}} "};
|
||||
|
||||
print_policy := "PhysicalPrinter";//"WorkstationLocation" ;
|
||||
process_report_locally := true;//false;
|
||||
print_job_destination := print_job_destination; // "\\sc1erp1\scmip"; "\\sc1erp1\PDF_HIS_DEV";
|
||||
|
||||
report_request_obj.PrintPolicy := print_policy as {{{SINGLE-QUOTE}}}PrintPolicy{{{SINGLE-QUOTE}}};
|
||||
report_request_obj.ProcessReportLocally := process_report_locally ;
|
||||
report_request_obj.PrintJobDestination := print_job_destination ;
|
||||
reportRequest.PrintJobPriority := Print_job_priority as {{{SINGLE-QUOTE}}}PrintJobPriority{{{SINGLE-QUOTE}}};
|
||||
report_request_obj.NumberOfCopies := 1;
|
||||
|
||||
// print the report
|
||||
void := call report_request_obj.Save;
|
||||
|
||||
// Call Dispose on report_request_obj to clean it up
|
||||
if report_request_obj is not null
|
||||
then
|
||||
void := call report_request_obj.Dispose;
|
||||
report_request_obj := null;
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
|
||||
catch exception ex
|
||||
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Auto Print:{{-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;
|
||||
|
||||
// Call Dispose on report_request_obj to clean it up
|
||||
if report_request_obj is not null
|
||||
then
|
||||
void := call report_request_obj.Dispose;
|
||||
report_request_obj := null;
|
||||
endif;
|
||||
|
||||
endcatch;
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
// Diagnostic Alert - Can be enabled if needed
|
||||
// send_alert := "DoNotSend";
|
||||
// alert_dest := destination { Alert: warning, "Informational", high, chart, "Informational", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
conclude true;
|
||||
;;
|
||||
action:
|
||||
if Error_occurred
|
||||
then
|
||||
write "An error has occured in the MLM {{+B}}ACS_CCDA_DocumentAutoPrint{{-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;
|
||||
|
||||
// Diagnostic Alert - Can be enabled if needed
|
||||
// write " Messages " || " Execute the Called PRINT MLM - " || NOW || " " || ClientDocumentGUID at alert_dest;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,151 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN;;
|
||||
mlmname: SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN;;
|
||||
arden: version 2.5;;
|
||||
version: 6.10;;
|
||||
institution: ;;
|
||||
author: Juliet Law, Allscripts Corp, x7461;;
|
||||
specialist: ;;
|
||||
date: 2014-10-22;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Creates an Enterprise Defined Column object to update with desired passed in value.
|
||||
;;
|
||||
explanation: Called MLM that updates an enterprised defined column.
|
||||
|
||||
Change history
|
||||
|
||||
10.22.2014 JML CSR #32720 Created
|
||||
01.28.2015 JML Moved to Production.
|
||||
;;
|
||||
keywords: Called MLM, Generic, Enterprise Defined Column
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
(TriggerObj) := ARGUMENT;
|
||||
|
||||
//Error Handling vars for ObjectsPlus Method calls
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
|
||||
//Destination Objects
|
||||
EDColumn_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "EnterprisePatientListColumn Object",
|
||||
rule_number := 2021 ];
|
||||
|
||||
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 ];
|
||||
|
||||
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
|
||||
//Create Client Visit Object
|
||||
try
|
||||
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with
|
||||
( ( TriggerObj.client_visit_guid as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} ) ;
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Retrieve client:{{-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 ( client_visit_obj is NOT NULL ) then
|
||||
void:= call client_visit_obj.Dispose;
|
||||
client_visit_obj:= null;
|
||||
endif;
|
||||
|
||||
endcatch;
|
||||
|
||||
//Create Enterprise Defined Column based on parameter values
|
||||
|
||||
try
|
||||
|
||||
//Retrieve Enterprise Defined Column object
|
||||
EntDefinedColumn_obj := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName
|
||||
with ( client_visit_obj, TriggerObj.column_name );
|
||||
|
||||
EntDefinedColumn_obj.Value := TriggerObj.column_value;
|
||||
//EDColumn_Dest.ObjectsPlus := EntDefinedColumn_obj;
|
||||
void := call EntDefinedColumn_obj.Save;
|
||||
|
||||
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;
|
||||
|
||||
//Destroy EDColumn Obj
|
||||
if ( EntDefinedColumn_obj is not null ) then
|
||||
void := call EntDefinedColumn_obj.Dispose;
|
||||
EntDefinedColumn_obj := null;
|
||||
endif;
|
||||
|
||||
//Destroy Client Visit Obj
|
||||
if ( client_visit_obj is not null ) then
|
||||
void := call client_visit_obj.Dispose;
|
||||
client_visit_obj := null;
|
||||
endif;
|
||||
|
||||
Conclude true ;
|
||||
;;
|
||||
action:
|
||||
//Error Handling
|
||||
if error_occurred then
|
||||
write "An error occurred in the MLM {{+B}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{-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;
|
||||
|
||||
//Evoke ObjectsPlus destination
|
||||
if exists EDColumn_Dest then
|
||||
write true at EDColumn_Dest;
|
||||
endif;
|
||||
|
||||
return error_occurred;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,209 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN_MULTIPLE ;;
|
||||
mlmname: SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN_MULTIPLE;;
|
||||
arden: version 2.5;;
|
||||
version: 16.3;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Courtney Carr;;
|
||||
specialist: Don Warnick ;;
|
||||
date: 2018-02-12;;
|
||||
validation: testing;;
|
||||
|
||||
|
||||
library:
|
||||
purpose:
|
||||
|
||||
This functional MLM will update case list or enterprise defined column.
|
||||
;;
|
||||
explanation:
|
||||
|
||||
This MLM that will update a column evoked by a new entry in the CV3AlertDeclaration table.
|
||||
|
||||
It is a work-around for a system limitation that prevents multiple columns from being updated by a single MLM call. (also an issue... order + column and health issue + column in single MLM)
|
||||
|
||||
The limitation will be resolved in SCM release 17.3. At that time this MLM will not be needed and can be removed.
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
02.12.2018 DW CSR# 35320 SSC - Created
|
||||
|
||||
|
||||
;;
|
||||
keywords: Functional MLM, Column Creation
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
using "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
|
||||
using "ObjectsPlusXA.Surgery";
|
||||
|
||||
using namespace "ObjectsPlusXA.Surgery";
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
log_execution_info := false;
|
||||
error_occurred:= false;
|
||||
error_message := "";
|
||||
|
||||
// Destinations and Evokes
|
||||
|
||||
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 ];
|
||||
alert_destination := destination { Alert }WITH [alert_type := "FUNCTIONAL_MLM_EVOKE", short_message:="Column Update", Priority:="high",scope:="chart",rule_group:="Call MLM Group",rule_number:=9050,send_with_order:= "DoNotSend",alert_abstract:= "",alert_dialog_settings:= ""];
|
||||
|
||||
alert_enter_event := EVENT {AlertEnter Any Alert: where TypeCode = "FUNCTIONAL_MLM_EVOKE" and Description = "Column Update"};
|
||||
|
||||
if called_by_editor then EvokingObject := read last { Alert: THIS }; endif;
|
||||
|
||||
|
||||
// Process the entered CV3AlertDeclaration record
|
||||
|
||||
|
||||
MessageString := EVOKINGOBJECT.Text; // contains the first 255 characters stored in CV3AlertDeclaration.Text
|
||||
|
||||
|
||||
// If the text exceeds 255 characters, the overflow is stored in CV3AlertMessage.TextLine and must be suffixed to the MessageString
|
||||
|
||||
|
||||
if EVOKINGOBJECT.HasLongText = true
|
||||
|
||||
then
|
||||
|
||||
ClientGUID := EVOKINGOBJECT.ClientGUID;
|
||||
AlertGUID := EVOKINGOBJECT.GUID;
|
||||
|
||||
(AdditionalText) := read
|
||||
{
|
||||
"
|
||||
select textline
|
||||
from CV3AlertMessage with (nolock)
|
||||
where ClientGUID = " || ClientGuid || " and parentguid = " || AlertGUID ||
|
||||
" order by LineNumber "
|
||||
};
|
||||
|
||||
// Suffix the Additional TextLine(s) to the MessageString
|
||||
|
||||
for i in 1 seqto count AdditionalText do
|
||||
AdditionalTextRecords := AdditionalText[i];
|
||||
MessageString := MessageString || AdditionalTextRecords;
|
||||
enddo;
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
// Parse the first message from the rest of the string
|
||||
|
||||
|
||||
FirstPipe := find "|" in string MessageString;
|
||||
FirstMessage:= substring (FirstPipe -1) characters starting at 1 from MessageString; // First message - process immediately
|
||||
|
||||
if FirstPipe <> 0
|
||||
then
|
||||
SubsequentMessageString:= substring 5000 characters starting at (FirstPipe +1) from MessageString; // Susequent messages - write to CV3AlertDeclaration
|
||||
endif;
|
||||
|
||||
|
||||
// Process the First Message in the string
|
||||
|
||||
|
||||
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
||||
|
||||
FirstMessageParsed:= call str_parse with FirstMessage,"^";
|
||||
|
||||
for i in 1 seqto count FirstMessageParsed do
|
||||
MessageCompenent := FirstMessageParsed[i];
|
||||
if i = 1 then column_type := MessageCompenent; // Case List or Visit List
|
||||
elseif i = 2 then patient_id := MessageCompenent as number; // Case ID or Visit Guid
|
||||
elseif i = 3 then column_name := MessageCompenent; // Column Name
|
||||
elseif i = 4 then column_value:= MessageCompenent; // Column Value
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
|
||||
if exists column_type and exists patient_id and exists column_name and exists column_value // All components must be present
|
||||
|
||||
then
|
||||
|
||||
if column_type = "CL" // Column List processing
|
||||
then
|
||||
try
|
||||
case_list_user_defined_column_value_object := call {{{SINGLE-QUOTE}}}CaseListUserDefinedBasicColumnValue{{{SINGLE-QUOTE}}}.FindByColumnName with (patient_id as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}, column_name as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
|
||||
case_list_user_defined_column_value_object.Value := column_value;
|
||||
void := call case_list_user_defined_column_value_object.Save;
|
||||
endtry;
|
||||
|
||||
catch exception ex
|
||||
error_occurred:= true;
|
||||
error_message := "{{+R}}Case List User Defined 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 (case_list_user_defined_column_value_object is not null) then case_list_user_defined_column_value_object := null; endif;
|
||||
endcatch;
|
||||
|
||||
elseif column_type = "VL" // Visit List processing
|
||||
|
||||
then
|
||||
|
||||
try
|
||||
client_visit_object := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with (( patient_id as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
patient_list_column_object := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName with ( client_visit_object, column_name);
|
||||
patient_list_column_object.Value := column_value;
|
||||
void := call patient_list_column_object.Save;
|
||||
endtry;
|
||||
|
||||
catch exception ex
|
||||
error_occurred:= true;
|
||||
error_message := "{{+R}}Case List User Defined 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 patient_list_column_object is not null then patient_list_column_object:= null; void:= call patient_list_column_object.Dispose; endif;
|
||||
if client_visit_object is not null then client_visit_object := null; void:= call client_visit_object.Dispose; endif;
|
||||
endcatch;
|
||||
|
||||
endif;
|
||||
|
||||
// Dispose of objects
|
||||
|
||||
if patient_list_column_object is not null then patient_list_column_object:= null; void:= call patient_list_column_object.Dispose; endif;
|
||||
if client_visit_object is not null then client_visit_object := null; void:= call client_visit_object.Dispose; endif;
|
||||
|
||||
endif;
|
||||
;;
|
||||
|
||||
priority: 50
|
||||
;;
|
||||
|
||||
evoke:
|
||||
|
||||
1 seconds after time of alert_enter_event;
|
||||
|
||||
;;
|
||||
|
||||
logic:
|
||||
|
||||
conclude true;
|
||||
;;
|
||||
|
||||
action:
|
||||
|
||||
if error_occurred
|
||||
then
|
||||
write "An error has occured in the MLM {{+B}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN_MULTIPLE {{-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;
|
||||
|
||||
// Create a new row for subsequent message string
|
||||
|
||||
if exists SubsequentMessageString and SubsequentMessageString <> ""
|
||||
then
|
||||
write SubsequentMessageString at alert_destination;
|
||||
endif;
|
||||
|
||||
;;
|
||||
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,188 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_FUNC_CREATE_GENERAL_ORDER_ON_WORKSHEET;;
|
||||
mlmname: SCH_FUNC_CREATE_GENERAL_ORDER_ON_WORKSHEET;;
|
||||
arden: version 2.5;;
|
||||
version: 16.3;;
|
||||
institution: St. Clair Hospital ;;
|
||||
author: Teresa Spicuzza;;
|
||||
specialist: Teresa Spicuzza;;
|
||||
date: 2018-01-11;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
Creates General Order and adds it to the order worksheet.
|
||||
;;
|
||||
explanation:
|
||||
Called from Form_Haloperidol_IV_Orders to create a cardiac monitor order for doses over 2mg IV, but can be used generically
|
||||
for other orders.
|
||||
|
||||
Change History
|
||||
01.11.2018 TMS CSR 37432 Created to add a cardiac monitor order to worksheet when haloperidol IV dose > 2mg added
|
||||
from post anesthesia order sets.
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
|
||||
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}}};
|
||||
include standard_libs;
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
|
||||
log_execution_info := false;
|
||||
|
||||
|
||||
(
|
||||
order_type,
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
GenOrder_catalog_item, // CatalogMasterItem ObjectsPlus object
|
||||
order_Create_Reason, // string CreateReason
|
||||
worksheetInfo,
|
||||
AdditionalInfo, // User Defined Data Item
|
||||
WSRequestedBy_obj, // RequestingProvider ObjectsPlus object
|
||||
WSRequestedBySource, // string requestingSource(must be in dict)
|
||||
WSSessionType, // string SessionType
|
||||
WSSessionReason, // string SessionReason
|
||||
WSLocation_obj
|
||||
|
||||
) := argument;
|
||||
|
||||
GeneralOrder_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM, placed on worksheet",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Order Object",
|
||||
rule_number := 2019 ];
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// 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 := 1019,
|
||||
Rule_subgroup := "",
|
||||
Send_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true ];
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
|
||||
;;
|
||||
|
||||
evoke:
|
||||
|
||||
;;
|
||||
|
||||
logic:
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Create a new GENERAL order from a catalog item
|
||||
// Place the order onto the order entry worksheet
|
||||
//---------------------------------------------------------------
|
||||
try
|
||||
|
||||
Catalog_Item_Name := GenOrder_catalog_item;
|
||||
Catalog_Item_Modifier := "";
|
||||
Catalog_Item_Version := "";
|
||||
order_Creation_Reason := order_Create_Reason;
|
||||
|
||||
// get OrderCatalogMasterItem ObjectsPlus object
|
||||
Order_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
|
||||
with Catalog_Item_Name;
|
||||
|
||||
// Create the order
|
||||
// Session information has been retrieved from the current worksheet if there
|
||||
// already exists unsubmitted orders.
|
||||
// AvailabilityOverride is set to prompt. This can display a popup dialog if
|
||||
// this order has an availability policy set that defines this item as not
|
||||
// available in the current location. The user still needs to have the
|
||||
// correct override right.
|
||||
|
||||
GeneralOrder_obj := call worksheetInfo.CreateGeneralOrder
|
||||
with
|
||||
Order_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
||||
order_Creation_Reason, // string Create Reason
|
||||
"Prompt" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}, // AvailabilityOverride
|
||||
false, // suppress messages
|
||||
(Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}, // Companion order primary key
|
||||
false; // Mandatory on Worksheet
|
||||
|
||||
|
||||
if( Order_catalog_item is NOT NULL ) then
|
||||
void := call Order_catalog_item.Dispose;
|
||||
Order_catalog_item:= null;
|
||||
endif;
|
||||
|
||||
// Value User Defined Data Item on order with text sent from calling MLM.
|
||||
If AdditionalInfo is not Null then
|
||||
|
||||
SetAdditionalInfo := call GeneralOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
||||
"NUR_NurIntervFreeText", (AdditionalInfo AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
|
||||
endif;
|
||||
|
||||
|
||||
GeneralOrder_obj.RequestedTime := "Routine";
|
||||
|
||||
void := call GeneralOrder_Obj.Save;
|
||||
void := call GeneralOrder_Obj.Dispose;
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := error_message || "{{+R}}New general order :{{-R}}\n" ||
|
||||
ex.Message || "\n\n";
|
||||
|
||||
msg := "Exception #1"
|
||||
|| "\nerror = " || ex.Message;
|
||||
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg, "Info", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
if( Order_catalog_item is NOT NULL ) then
|
||||
void := call Order_catalog_item.Dispose;
|
||||
Order_catalog_item:= null;
|
||||
endif;
|
||||
|
||||
if( GeneralOrder_obj is NOT NULL ) then
|
||||
void := call GeneralOrder_obj.Dispose;
|
||||
GeneralOrder_obj:= null;
|
||||
endif;
|
||||
|
||||
GeneralOrder_dest := null;
|
||||
endcatch;
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
if error_occurred then
|
||||
|
||||
write "An error has occurred in the MLM {{+B}}SCH_FUNC_CREATE_GENERAL_ORDER_ON_WORKSHEET{{-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 GeneralOrder_dest then
|
||||
write true at GeneralOrder_dest;
|
||||
endif;
|
||||
|
||||
return error_occurred;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
113
MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_HEALTH_ISSUE.mlm
Normal file
113
MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_HEALTH_ISSUE.mlm
Normal file
@@ -0,0 +1,113 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Func_Create_Health_Issue;;
|
||||
mlmname: SCH_Func_Create_Health_Issue;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: ;;
|
||||
author: Don Warnick ;;
|
||||
specialist: ;;
|
||||
date: 2012-04-05;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create a Health Issue using the information passed from the calling MLM.
|
||||
;;
|
||||
explanation: Called MLM that builds health issues for a patient.
|
||||
|
||||
Change history
|
||||
|
||||
04.05.2012 DW CSR# - Created
|
||||
04.30.2013 DW CSR# 31334 - Adjusted to be more generic, enabling it to be called from any MLMs
|
||||
09.30.2015 GOS CSR#23359 - Made change in MLM for ICD9-ICD10 HI Dynamic Creation with all details Like ICD10 Code, Snowmed Code etc .
|
||||
|
||||
;;
|
||||
keywords: Called MLM, Create Health Issue
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
error_occurred := false;
|
||||
|
||||
(visitGuid,issuename,issuecode,issuetext,issuetype,issuescheme) := ARGUMENT;
|
||||
|
||||
send_alert := "DoNotSend";
|
||||
alert_dest := destination { Alert: warning, "Health Issue Create", high, chart, "Health Issue Create", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
// Create the Client Visit Object
|
||||
|
||||
try
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Retrieve client:{{-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 ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
endcatch;
|
||||
|
||||
// Create the Health Issue Object and Generate the Health Issue
|
||||
|
||||
try
|
||||
|
||||
NewHealthIssueHIType := issuetype;
|
||||
NewHealthIssueHICode := issuecode;
|
||||
NewHealthIssueHIScheme := issuescheme;
|
||||
|
||||
dd := EXTRACT Day now;
|
||||
mn := EXTRACT Month now;
|
||||
yr := EXTRACT Year now;
|
||||
|
||||
//--Start: CSR 23359-ICD9-ICD10 HI Change Added By shivprasad
|
||||
Terms := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindIMOTerms with (NewHealthIssueHIScheme,NewHealthIssueHICode);
|
||||
FOR i IN 1 SEQTO (Terms.Count as Number ) DO
|
||||
HI_obj := Terms[i];
|
||||
HI_Name := HI_obj.TermName as string;
|
||||
If HI_Name = issuename then
|
||||
HI_NO := i ;
|
||||
Endif;
|
||||
ENDDO;
|
||||
If HI_NO is Null Then
|
||||
HI_NO :=1 ;
|
||||
Endif;
|
||||
New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with (client_visit_obj, NewHealthIssueHIType, Terms[HI_NO]);
|
||||
|
||||
//--End Added by Shivprasad
|
||||
|
||||
//New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with (client_visit_obj, NewHealthIssueHIType, NewHealthIssueHIScheme, NewHealthIssueHICode );
|
||||
PartialDate_obj := new net_object {{{SINGLE-QUOTE}}}PartialDate{{{SINGLE-QUOTE}}} with (yr as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, mn as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, dd as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}} );
|
||||
New_HealthIssue_obj.OnsetDate := PartialDate_obj;
|
||||
New_HealthIssue_obj.Name := issuename;
|
||||
New_HealthIssue_obj.Text := issuetext;
|
||||
|
||||
if ( New_HealthIssue_obj is NOT NULL ) then void := call New_HealthIssue_obj.Save; void := call New_HealthIssue_obj.Dispose; endif;
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
|
||||
endtry;
|
||||
|
||||
catch exception ex
|
||||
error_occurred := true;
|
||||
if ( New_HealthIssue_obj is NOT NULL ) then void:= call New_HealthIssue_obj.Dispose; New_HealthIssue_obj:= null; endif;
|
||||
endcatch;
|
||||
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
Conclude true ;
|
||||
;;
|
||||
action:
|
||||
|
||||
if error_occurred then
|
||||
write "An error has occured in the MLM {{+B}}SCH_Func_Create_Health_Issue{{-B}} " || "Please notify your System Administrators that an error message has occurred " ||
|
||||
"message: \n" at alert_dest;
|
||||
write messageText at alert_dest;
|
||||
endif;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
143
MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_MED_ORDER.mlm
Normal file
143
MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_MED_ORDER.mlm
Normal file
@@ -0,0 +1,143 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Func_Create_Med_Order;;
|
||||
mlmname: SCH_Func_Create_Med_Order;;
|
||||
arden: version 2.5;;
|
||||
version: 16.30;;
|
||||
institution: ;;
|
||||
author: Teresa Spicuzza;;
|
||||
specialist: ;;
|
||||
date: 2017-11-13;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create an Order using the information passed from the calling MLM.
|
||||
;;
|
||||
explanation: Called MLM that builds orders for a patient.
|
||||
|
||||
Change history
|
||||
|
||||
11.10.2017 TMS CSR# 35723 Created
|
||||
|
||||
|
||||
;;
|
||||
keywords: Called MLM, Generic, Create Order
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
error_occurred := false;
|
||||
|
||||
(visitGuid,UserGuid,ClientGUID,SessionType,OrderSource,ItemName,ItemModifier,OrderType,CareProviderGuid,OrderFrequency) := ARGUMENT;
|
||||
|
||||
send_alert := "DoNotSend";
|
||||
alert_dest := destination { Alert: warning, "Order Create", high, chart, "Order Create", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
user_IDType := "Edstan Number (physician)";
|
||||
RequestingSource := OrderSource;
|
||||
order_Creation_Reason := "Protocol Order";
|
||||
|
||||
If SessionType = "Hold"
|
||||
then SessionReason := "Hold Orders";
|
||||
Else SessionReason := ""; // Session type is Standard
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// Create Objects
|
||||
|
||||
try
|
||||
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
user_IDCode := read last {"SELECT IDCode FROM CV3CAREPROVIDERID " || " where ProviderGUID = " || CareProviderGuid
|
||||
|| " and ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}}"};
|
||||
RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
|
||||
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || ClientGUID};
|
||||
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Retrieve client:{{-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 ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
|
||||
if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj := null; endif;
|
||||
endcatch;
|
||||
|
||||
try
|
||||
|
||||
Catalog_Item_Name := ItemName;
|
||||
Catalog_Item_Modifier := ItemModifier;
|
||||
Catalog_Item_Version := "";
|
||||
Medication_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
|
||||
|
||||
PreFilled_MedicationOrder_obj := call {{{SINGLE-QUOTE}}}MedicationOrder{{{SINGLE-QUOTE}}}.CreateMedicationOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
Medication_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
||||
Catalog_Item_Modifier, // string ItemNameModifier
|
||||
Catalog_Item_Version, // string ItemNameModifierVersion
|
||||
order_Creation_Reason, // string CreateReason
|
||||
RequestingCareProvider_obj , // RequestedBy ObjectsPlus object
|
||||
RequestingSource, // 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
|
||||
|
||||
if (exists OrderFrequency) then
|
||||
|
||||
frequencyCode_obj := new net_object {{{SINGLE-QUOTE}}}Frequency{{{SINGLE-QUOTE}}};
|
||||
frequencyCode_obj.code := OrderFrequency;
|
||||
PreFilled_MedicationOrder_obj.frequency := frequencyCode_obj;
|
||||
Endif;
|
||||
|
||||
if ( Medication_catalog_item is NOT NULL ) then
|
||||
void := call PreFilled_MedicationOrder_obj.Save;
|
||||
void := call PreFilled_MedicationOrder_obj.Dispose;
|
||||
void:= call Medication_catalog_item.Dispose;
|
||||
Medication_catalog_item:= null;
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}New prefilled medication order:{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
if ( Medication_catalog_item is NOT NULL ) then void:= call Medication_catalog_item.Dispose; Medication_catalog_item:= null; endif;
|
||||
if ( PreFilled_MedicationOrder_obj is NOT NULL ) then void:= call PreFilled_MedicationOrder_obj.Dispose; PreFilled_MedicationOrder_obj:= null; endif;
|
||||
|
||||
Prefilled_MedicationOrder_dest := null;
|
||||
endcatch;
|
||||
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
|
||||
if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj:= null; endif;
|
||||
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
Conclude true ;
|
||||
;;
|
||||
action:
|
||||
|
||||
if error_occurred then
|
||||
write "An error has occured in the MLM {{+B}}SCH_Func_Create_Order{{-B}} " || "Please notify your System Administrators that an error message has occurred " ||
|
||||
"message: \n" at alert_dest;
|
||||
write messageText at alert_dest;
|
||||
endif;
|
||||
|
||||
return error_occurred;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,270 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_FUNC_CREATE_MED_ORDER_WORKSHEET;;
|
||||
mlmname: SCH_FUNC_CREATE_MED_ORDER_WORKSHEET;;
|
||||
arden: version 2.5;;
|
||||
version: 1.00;;
|
||||
institution: ;;
|
||||
author: ;;
|
||||
specialist: Sandy Zhang ;;
|
||||
date: 2018-02-22;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
Creates medication order that is added to worksheet. The worksheet is the queue of orders that are selected but not yet submitted.
|
||||
;;
|
||||
explanation:
|
||||
|
||||
Change History
|
||||
02.22.2018 SZ CSR #35939 - Created
|
||||
09.18.2018 SZ CSR #36408 - Modified to fit the needs of project: Tamiflu transition orders
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
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}}};
|
||||
include standard_libs;
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
|
||||
log_execution_info := false;
|
||||
|
||||
|
||||
|
||||
(OrderName,
|
||||
ItemModifier,
|
||||
ItemVersion,
|
||||
creation_reason,
|
||||
OrderFrequency,
|
||||
Active_OrderGUID,
|
||||
Active_ClientVisitGUID,
|
||||
location_guid,
|
||||
UserGuid,
|
||||
special_instructions,
|
||||
RequestedDate,
|
||||
RequestedTime,
|
||||
RequestedTimeHour,
|
||||
RequestedTimeMin
|
||||
) := argument;
|
||||
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Define the ObjectsPlus destinations
|
||||
//------------------------------------------------------------
|
||||
Prefilled_MedicationOrder_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM, placed on worksheet",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Order Object",
|
||||
rule_number := 2010 ];
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// 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 := 1004,
|
||||
Rule_subgroup := "",
|
||||
Send_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true ];
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
if (called_by_editor) then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
|
||||
try
|
||||
//-----------------------------------------------------------
|
||||
// Retrieve current order entry batch.
|
||||
// The companion order can be added only if the parent order
|
||||
// belongs to the order entry batch
|
||||
// object owned by the OrderEntryWorksheet.
|
||||
//-----------------------------------------------------------
|
||||
worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
|
||||
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Get the .NET version of the Client Visit object.
|
||||
// Needed to create new ObjectsPlus object
|
||||
//------------------------------------------------------------
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((Active_ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
|
||||
|
||||
// Get the CareProviderInfo object for user and requested by
|
||||
careProviderInfo_requestedBy_obj := call {{{SINGLE-QUOTE}}}CareProviderInfo{{{SINGLE-QUOTE}}}.FindByPrimaryKey with (UserGuid 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( worksheetInfo is NOT NULL ) then
|
||||
void := call worksheetInfo.Dispose;
|
||||
worksheetInfo:= null;
|
||||
endif;
|
||||
|
||||
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 ( order_form_obj is NOT NULL ) then
|
||||
void:= call order_form_obj.Dispose;
|
||||
order_form_obj := null;
|
||||
endif;
|
||||
|
||||
// If unable to initialize starting data, do not continue
|
||||
// with the creation of any orders.
|
||||
// Still conclude true as the error message needs to
|
||||
// be displayed as an error.
|
||||
conclude true;
|
||||
|
||||
endcatch;
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Create a new MEDICATION order from a Pre-Filled item
|
||||
// Place the order onto the order entry worksheet
|
||||
//---------------------------------------------------------------
|
||||
try
|
||||
|
||||
Catalog_Item_Name := OrderName;
|
||||
Catalog_Item_Modifier := ItemModifier;
|
||||
Catalog_Item_Version := ItemVersion;
|
||||
order_Creation_Reason := creation_reason;
|
||||
|
||||
// get OrderCatalogMasterItem ObjectsPlus object
|
||||
Medication_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
|
||||
with Catalog_Item_Name;
|
||||
|
||||
// Create the prefilled Medication order
|
||||
// Session information has been retrieved from the current worksheet if there
|
||||
// already exists unsubmitted orders.
|
||||
// AvailabilityOverride is set to prompt. This can display a popup dialog if
|
||||
// this order has an availability policy set that defines this item as not
|
||||
// available in the current location. The user still needs to have the
|
||||
// correct override right.
|
||||
PreFilled_MedicationOrder_obj := call worksheetInfo.CreateMedicationOrder
|
||||
with
|
||||
Medication_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
||||
Catalog_Item_Modifier, // string Name Modifier for prefill
|
||||
Catalog_Item_Version, // string Name modifier version for prefill
|
||||
order_Creation_Reason, // string Create Reason
|
||||
"Prompt" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}, // AvailabilityOverride
|
||||
false, // suppress messages
|
||||
(Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}, // Companion order primary key
|
||||
false; // Mandatory on Worksheet
|
||||
|
||||
if( Medication_catalog_item is NOT NULL ) then
|
||||
void := call Medication_catalog_item.Dispose;
|
||||
Medication_catalog_item:= null;
|
||||
endif;
|
||||
//-----------------------------------------------------------------------------
|
||||
// Change order frequency
|
||||
//-----------------------------------------------------------------------------
|
||||
freqCodeValue_obj := new net_object {{{SINGLE-QUOTE}}}Frequency{{{SINGLE-QUOTE}}};
|
||||
freqCodeValue_Obj.Code := (OrderFrequency As string);
|
||||
PreFilled_MedicationOrder_obj.Frequency := freqCodeValue_obj;
|
||||
|
||||
if (exist RequestedDate) then
|
||||
PreFilled_MedicationOrder_obj.RequestedDate := RequestedDate;
|
||||
endif;
|
||||
|
||||
if (exist RequestedTime) then
|
||||
PreFilled_MedicationOrder_obj.RequestedTime := RequestedTime;
|
||||
endif;
|
||||
|
||||
|
||||
PreFilled_MedicationOrder_obj.AdministrationInstructions := special_instructions;
|
||||
|
||||
void := call PreFilled_MedicationOrder_obj.Save;
|
||||
|
||||
endtry;
|
||||
catch Exception ex
|
||||
|
||||
error_occurred := true;
|
||||
error_message := error_message || "{{+R}}New prefilled medication order :{{-R}}\n" ||
|
||||
ex.Message || "\n\n";
|
||||
|
||||
if( Medication_catalog_item is NOT NULL ) then
|
||||
void := call Medication_catalog_item.Dispose;
|
||||
Medication_catalog_item:= null;
|
||||
endif;
|
||||
|
||||
if( PreFilled_MedicationOrder_obj is NOT NULL ) then
|
||||
void := call PreFilled_MedicationOrder_obj.Dispose;
|
||||
PreFilled_MedicationOrder_obj:= null;
|
||||
endif;
|
||||
|
||||
Prefilled_MedicationOrder_dest := null;
|
||||
endcatch;
|
||||
|
||||
|
||||
// Dispose client visit objects
|
||||
if( client_visit_obj is NOT NULL ) then
|
||||
void := call client_visit_obj.Dispose;
|
||||
client_visit_obj:= null;
|
||||
endif;
|
||||
|
||||
// Dispose order entry batch object
|
||||
if( worksheetInfo is NOT NULL ) then
|
||||
void := call worksheetInfo.Dispose;
|
||||
worksheetInfo:= null;
|
||||
endif;
|
||||
|
||||
//break;
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
/*
|
||||
if error_occurred
|
||||
then
|
||||
|
||||
write "An error has occurred in the MLM {{+B}}SCH_FUNC_CREATE_MED_ORDER_WORKSHEET{{-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;
|
||||
|
||||
return error_occurred;
|
||||
*/
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
147
MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_ORDER.mlm
Normal file
147
MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_ORDER.mlm
Normal file
@@ -0,0 +1,147 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Func_Create_Order;;
|
||||
mlmname: SCH_Func_Create_Order;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: ;;
|
||||
author: Don Warnick ;;
|
||||
specialist: ;;
|
||||
date: 2012-04-05;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create an Order using the information passed from the calling MLM.
|
||||
;;
|
||||
explanation: Called MLM that builds orders for a patient.
|
||||
|
||||
Change history
|
||||
|
||||
04.12.2012 DW CSR# 26409 Created
|
||||
10.21.2013 DW CSR#31693 Altered the Order "Reason" from "From Test MLM" to "Protocol Order"
|
||||
10.24.2013 DW CSR# 31693 - Now the calling MLM supplies the session type
|
||||
11.11.2013 TMS CSR# 31693 Added qualifier to SQL to retrieve the UserIDCode to only
|
||||
retrieve the last ProviderIDTypeCode for the Edstan Number.
|
||||
11.13.2013 DW CSR# 31693 Accept Order Source Value from calling MLM
|
||||
|
||||
;;
|
||||
keywords: Called MLM, Generic, Create Order
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
error_occurred := false;
|
||||
|
||||
(visitGuid,UserGuid,ClientGUID,SessionType,OrderSource,ItemName,ItemModifier,OrderType,OrderFrequency) := ARGUMENT;
|
||||
|
||||
send_alert := "DoNotSend";
|
||||
alert_dest := destination { Alert: warning, "Order Create", high, chart, "Order Create", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
user_IDType := "Edstan Number (physician)";
|
||||
RequestingSource := OrderSource;
|
||||
order_Creation_Reason := "Protocol Order";
|
||||
|
||||
If SessionType = "Hold"
|
||||
then SessionReason := "Hold Orders";
|
||||
Else SessionReason := ""; // Session type is Standard
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// Create Objects
|
||||
|
||||
try
|
||||
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
user_IDCode := read last {"SELECT IDCode FROM CV3CAREPROVIDERID " || " where ProviderGUID = " || UserGUID
|
||||
|| " and ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}}"};
|
||||
RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
|
||||
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || ClientGUID};
|
||||
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Retrieve client:{{-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 ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
|
||||
if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj := null; endif;
|
||||
endcatch;
|
||||
|
||||
try
|
||||
|
||||
Catalog_Item_Name := ItemName;
|
||||
Catalog_Item_Modifier := ItemModifier;
|
||||
Catalog_Item_Version := "";
|
||||
Medication_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
|
||||
|
||||
PreFilled_MedicationOrder_obj := call {{{SINGLE-QUOTE}}}MedicationOrder{{{SINGLE-QUOTE}}}.CreateMedicationOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
Medication_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
||||
Catalog_Item_Modifier, // string ItemNameModifier
|
||||
Catalog_Item_Version, // string ItemNameModifierVersion
|
||||
order_Creation_Reason, // string CreateReason
|
||||
RequestingCareProvider_obj , // RequestedBy ObjectsPlus object
|
||||
RequestingSource, // 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
|
||||
|
||||
if (exists OrderFrequency) then
|
||||
|
||||
frequencyCode_obj := new net_object {{{SINGLE-QUOTE}}}Frequency{{{SINGLE-QUOTE}}};
|
||||
frequencyCode_obj.code := OrderFrequency;
|
||||
PreFilled_MedicationOrder_obj.frequency := frequencyCode_obj;
|
||||
Endif;
|
||||
|
||||
if ( Medication_catalog_item is NOT NULL ) then
|
||||
void := call PreFilled_MedicationOrder_obj.Save;
|
||||
void := call PreFilled_MedicationOrder_obj.Dispose;
|
||||
void:= call Medication_catalog_item.Dispose;
|
||||
Medication_catalog_item:= null;
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}New prefilled medication order:{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
if ( Medication_catalog_item is NOT NULL ) then void:= call Medication_catalog_item.Dispose; Medication_catalog_item:= null; endif;
|
||||
if ( PreFilled_MedicationOrder_obj is NOT NULL ) then void:= call PreFilled_MedicationOrder_obj.Dispose; PreFilled_MedicationOrder_obj:= null; endif;
|
||||
|
||||
Prefilled_MedicationOrder_dest := null;
|
||||
endcatch;
|
||||
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
|
||||
if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj:= null; endif;
|
||||
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
Conclude true ;
|
||||
;;
|
||||
action:
|
||||
|
||||
if error_occurred then
|
||||
write "An error has occured in the MLM {{+B}}SCH_Func_Create_Order{{-B}} " || "Please notify your System Administrators that an error message has occurred " ||
|
||||
"message: \n" at alert_dest;
|
||||
write messageText at alert_dest;
|
||||
endif;
|
||||
|
||||
return error_occurred;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
208
MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_UNSUBMITTED_ORDER.mlm
Normal file
208
MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_UNSUBMITTED_ORDER.mlm
Normal file
@@ -0,0 +1,208 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Func_Create_Unsubmitted_Order;;
|
||||
mlmname: SCH_Func_Create_Unsubmitted_Order;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: ;;
|
||||
author: Don Warnick ;;
|
||||
specialist: ;;
|
||||
date: 2012-10-06;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create an Unsubmitted Order using the information passed from the calling MLM.
|
||||
;;
|
||||
explanation: Called MLM that builds orders for a patient.
|
||||
|
||||
NOTE: This MLM is initially built to create Prefilled Medication Orders.
|
||||
Additional routines (i.e. Diagnostic Orders etc...) may be added using the
|
||||
Allscripts supplied MLM, "Test ObjectsPlus Orders Using A Worksheet" for reference.
|
||||
|
||||
Change history
|
||||
|
||||
10.06.2014 DW CSR# 31964 Created
|
||||
02.03.2016 JML CSR# 33934: Created
|
||||
04.20.2016 JML Moved to Production
|
||||
|
||||
;;
|
||||
keywords: Called MLM, Generic, Create Order
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
(visitGuid, userGuid, clientGuid, orderSessionType, orderSource, triggerObj) := ARGUMENT;
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
log_execution_info := false;
|
||||
|
||||
user_IDType := "Edstan Number (physician)";
|
||||
|
||||
user_IDCode := read last {"SELECT IDCode FROM CV3CAREPROVIDERID " || " where ProviderGUID = " || userGUID
|
||||
|| " and ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}}"};
|
||||
|
||||
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || clientGUID};
|
||||
|
||||
TriggerObj_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM, placed on worksheet",
|
||||
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 := 1004,
|
||||
Rule_subgroup := "",
|
||||
Send_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true ];
|
||||
|
||||
;;
|
||||
|
||||
priority: 50
|
||||
;;
|
||||
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
|
||||
|
||||
if called_by_editor
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
try
|
||||
|
||||
worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
|
||||
|
||||
if worksheetInfo is NULL OR "OrderEntryWorksheet" <> (worksheetInfo.OrderBatchOwner as String)
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
|
||||
WSSessionType := orderSessionType;
|
||||
WSSessionReason := "";
|
||||
WSRequestedBySource := orderSource;
|
||||
WSRequestedBy_obj := worksheetInfo.RequestedBy;
|
||||
WSlocation_obj := worksheetInfo.ExpectedReleaseLocationGroup;
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred:= true;
|
||||
error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
// Dispose
|
||||
|
||||
if( worksheetInfo is NOT NULL ) then void := call worksheetInfo.Dispose; worksheetInfo:= null; endif;
|
||||
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;
|
||||
|
||||
endcatch;
|
||||
|
||||
try
|
||||
|
||||
Catalog_Item_Name := triggerObj.item_name;
|
||||
Catalog_Item_Modifier := triggerObj.item_modifier;
|
||||
Catalog_Item_Version := triggerObj.item_version;
|
||||
Order_Creation_Reason := "Protocol Order";
|
||||
|
||||
CatalogItem_obj := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName WITH ( Catalog_Item_Name as string ) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
|
||||
if ( triggerObj.order_type = "Diagnostic" ) then
|
||||
DiagnosticOrder_obj := call worksheetInfo.CreateDiagnosticOrder WITH
|
||||
CatalogItem_obj,
|
||||
Order_Creation_Reason,
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}},
|
||||
false,
|
||||
(Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}},
|
||||
true;
|
||||
|
||||
if ( CatalogItem_obj IS NOT NULL ) then
|
||||
void := call CatalogItem_obj.Dispose;
|
||||
CatalogItem_obj := null;
|
||||
endif;
|
||||
|
||||
RequestedTime_obj := new net_object "RequestedTime";
|
||||
RequestedTime_obj.CodedTime := triggerObj.coded_time;
|
||||
|
||||
if ( triggerObj.coded_time <> "STAT" AND triggerObj.coded_time <> "AM Rounds" ) then
|
||||
time_obj := new net_object {{{SINGLE-QUOTE}}}Time{{{SINGLE-QUOTE}}} WITH ( triggerObj.requested_time_hour as number ) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, ( triggerObj.requested_time_min as number ) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}};
|
||||
RequestedTime_obj.Time := time_obj;
|
||||
endif;
|
||||
|
||||
DiagnosticOrder_obj.RequestedTime := RequestedTime_obj;
|
||||
|
||||
if ( count triggerObj.order_field_name > 0 ) then
|
||||
|
||||
for i IN 1 seqto ( count triggerObj.order_field_name ) do
|
||||
diagField_obj := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} WITH
|
||||
triggerObj.order_field_name[i], ( triggerObj.order_field_value[i] as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}} );
|
||||
enddo;
|
||||
|
||||
endif;
|
||||
|
||||
void := call DiagnosticOrder_obj.Save;
|
||||
void := call DiagnosticOrder_obj.Dispose;
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := error_message || "{{+R}}New " || triggerObj.order_type || " order :{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
// Dispose
|
||||
if( CatalogItem_obj is NOT NULL ) then void := call CatalogItem_obj.Dispose; CatalogItem_obj := null; endif;
|
||||
if( DiagnosticOrder_obj is NOT NULL ) then void := call DiagnosticOrder_obj.Dispose; DiagnosticOrder_obj:= null; endif;
|
||||
TriggerObj_dest := null;
|
||||
|
||||
endcatch;
|
||||
|
||||
// Dispose
|
||||
if( client_visit_obj is NOT NULL ) then void := call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
if( worksheetInfo is NOT NULL ) then void := call worksheetInfo.Dispose; worksheetInfo:= null; endif;
|
||||
|
||||
|
||||
|
||||
Conclude true ;
|
||||
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
if Error_occurred
|
||||
then
|
||||
|
||||
write "An error has occurred in the MLM {{+B}}TEST_OBJECTSPLUS_ORDERS_WITH_WORKSHEET{{-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 TriggerObj_dest then write true at TriggerObj_dest; endif;
|
||||
|
||||
return Error_occurred;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,220 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Func_Create_Unsubmitted_Order_Diagnostic_Prefilled;;
|
||||
mlmname: SCH_Func_Create_Unsubmitted_Order_Diagnostic_Prefilled;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: ;;
|
||||
author: Sandy Zhang ;;
|
||||
specialist: ;;
|
||||
date: 2018-09-13;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create an Unsubmitted Diagnostic/Lab Order that{{{SINGLE-QUOTE}}}s Pre-filled using the information passed from the calling MLM.
|
||||
;;
|
||||
explanation: Called MLM that builds orders for a patient.
|
||||
|
||||
Change history
|
||||
|
||||
09.13.2018 SZ CSR 36407 Created based off Don{{{SINGLE-QUOTE}}}s MLM: SCH_Func_Create_Unsubmitted_Order.
|
||||
This one is slightly modified to fit the needs for a pre-filled diagnostic/lab order.
|
||||
Don{{{SINGLE-QUOTE}}}s version was for non-prefilled diagnostic/lab orders.
|
||||
|
||||
;;
|
||||
keywords: Called MLM, Generic, Create Order
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
(visitGuid, userGuid, clientGuid, orderSessionType, orderSource, triggerObj, requested_date) := ARGUMENT;
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
log_execution_info := false;
|
||||
|
||||
user_IDType := "Edstan Number (physician)";
|
||||
|
||||
user_IDCode := read last {"SELECT IDCode FROM CV3CAREPROVIDERID " || " where ProviderGUID = " || userGUID
|
||||
|| " and ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}}"};
|
||||
|
||||
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || clientGUID};
|
||||
|
||||
TriggerObj_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM, placed on worksheet",
|
||||
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 := 1004,
|
||||
Rule_subgroup := "",
|
||||
Send_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true ];
|
||||
|
||||
;;
|
||||
|
||||
priority: 50
|
||||
;;
|
||||
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
|
||||
|
||||
if called_by_editor
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
try
|
||||
|
||||
worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
|
||||
|
||||
if worksheetInfo is NULL OR "OrderEntryWorksheet" <> (worksheetInfo.OrderBatchOwner as String)
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
|
||||
WSSessionType := orderSessionType;
|
||||
WSSessionReason := "";
|
||||
WSRequestedBySource := orderSource;
|
||||
WSRequestedBy_obj := worksheetInfo.RequestedBy;
|
||||
WSlocation_obj := worksheetInfo.ExpectedReleaseLocationGroup;
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred:= true;
|
||||
error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
// Dispose
|
||||
|
||||
if( worksheetInfo is NOT NULL ) then void := call worksheetInfo.Dispose; worksheetInfo:= null; endif;
|
||||
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;
|
||||
|
||||
endcatch;
|
||||
|
||||
try
|
||||
|
||||
Catalog_Item_Name := triggerObj.item_name;
|
||||
Catalog_Item_Modifier := triggerObj.item_modifier;
|
||||
Catalog_Item_Version := triggerObj.item_version;
|
||||
Order_Creation_Reason := "Protocol Order";
|
||||
|
||||
CatalogItem_obj := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName WITH ( Catalog_Item_Name as string ) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
|
||||
if ( triggerObj.order_type = "Diagnostic" ) then
|
||||
DiagnosticOrder_obj := call worksheetInfo.CreateDiagnosticOrder WITH
|
||||
CatalogItem_obj,
|
||||
Catalog_Item_Modifier, // Name Modifier for prefill
|
||||
Catalog_Item_Version, // Name modifier version for prefill
|
||||
Order_Creation_Reason,
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}},
|
||||
false,
|
||||
(Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}},
|
||||
true;
|
||||
|
||||
if ( CatalogItem_obj IS NOT NULL ) then
|
||||
void := call CatalogItem_obj.Dispose;
|
||||
CatalogItem_obj := null;
|
||||
endif;
|
||||
|
||||
RequestedTime_obj := new net_object "RequestedTime";
|
||||
RequestedTime_obj.CodedTime := triggerObj.coded_time;
|
||||
|
||||
if ( triggerObj.coded_time <> "STAT" AND triggerObj.coded_time <> "AM Rounds" ) then
|
||||
time_obj := new net_object {{{SINGLE-QUOTE}}}Time{{{SINGLE-QUOTE}}} WITH ( triggerObj.requested_time_hour as number ) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, ( triggerObj.requested_time_min as number ) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}};
|
||||
RequestedTime_obj.Time := time_obj;
|
||||
endif;
|
||||
|
||||
DiagnosticOrder_obj.RequestedTime := RequestedTime_obj;
|
||||
|
||||
/**** Date must be in ISO Format or in format of "T + 1" etc.
|
||||
|
||||
Active_SignificiantDtm := requested_date;
|
||||
|
||||
//Active_Significant := (Active_SignificiantDtm);
|
||||
Active_Significant := (extract year Active_SignificiantDtm) formatted with "%04d" || "-" ||
|
||||
(extract month Active_SignificiantDtm) formatted with "%02d" || "-" ||
|
||||
(extract day Active_SignificiantDtm) formatted with "%02d";
|
||||
*/
|
||||
|
||||
// Remove time portion for the Requested Date
|
||||
DiagnosticOrder_obj.RequestedDate := requested_date;
|
||||
|
||||
|
||||
|
||||
if ( count triggerObj.order_field_name > 0 ) then
|
||||
|
||||
for i IN 1 seqto ( count triggerObj.order_field_name ) do
|
||||
diagField_obj := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} WITH
|
||||
triggerObj.order_field_name[i], ( triggerObj.order_field_value[i] as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}} );
|
||||
enddo;
|
||||
|
||||
endif;
|
||||
|
||||
void := call DiagnosticOrder_obj.Save;
|
||||
void := call DiagnosticOrder_obj.Dispose;
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := error_message || "{{+R}}New " || triggerObj.order_type || " order :{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
// Dispose
|
||||
if( CatalogItem_obj is NOT NULL ) then void := call CatalogItem_obj.Dispose; CatalogItem_obj := null; endif;
|
||||
if( DiagnosticOrder_obj is NOT NULL ) then void := call DiagnosticOrder_obj.Dispose; DiagnosticOrder_obj:= null; endif;
|
||||
TriggerObj_dest := null;
|
||||
|
||||
endcatch;
|
||||
|
||||
// Dispose
|
||||
if( client_visit_obj is NOT NULL ) then void := call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
if( worksheetInfo is NOT NULL ) then void := call worksheetInfo.Dispose; worksheetInfo:= null; endif;
|
||||
|
||||
|
||||
|
||||
Conclude true ;
|
||||
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
if Error_occurred
|
||||
then
|
||||
|
||||
write "An error has occurred in the MLM {{+B}}SCH_Func_Create_Unsubmitted_Order_Diagnostic_Prefilled{{-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 TriggerObj_dest then write true at TriggerObj_dest; endif;
|
||||
|
||||
return Error_occurred;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
215
MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATININE_CLEARANCE.mlm
Normal file
215
MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATININE_CLEARANCE.mlm
Normal file
@@ -0,0 +1,215 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Func_Creatinine_Clearance;;
|
||||
mlmname: SCH_Func_Creatinine_Clearance;;
|
||||
arden: version 2;;
|
||||
version: 5.50;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Teresa Spicuzza, Allscripts;;
|
||||
specialist: ;;
|
||||
date: 2012-07-11;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: This MLM Calcualtes Creatinine Clearance based on SCH Guidelines. Adapted from Form_MLM_Creatinine_Clearance
|
||||
|
||||
;;
|
||||
explanation: Uses SCH guidelines to choose the correct weight, round serum where necessary and calculate creatinine
|
||||
Uses SCH modified cockcrauft gault formula
|
||||
|
||||
;;
|
||||
keywords: Called MLMs, Form fields, Cockcrauft Gault, Creatinine
|
||||
|
||||
03.16.2018 TMS CSR 36322 Updated to use only actual body weight for Dabigatran (Pradaxa) and Rivaroxaban (Xarelto) renal
|
||||
dosing alerts.
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
// This MLM is passed three arguments, ...
|
||||
|
||||
(client_visit_guid, chart_guid, client_guid, CPSVal) := ARGUMENT;
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
|
||||
/*******************Make Changes To Spelling And Flags In This Section*******************/
|
||||
|
||||
/* Set to true if a decision.log is needed.*/
|
||||
log_execution_info := FALSE;
|
||||
|
||||
|
||||
|
||||
/***************************************************************************************/
|
||||
|
||||
// Initialize error message
|
||||
error_message:="";
|
||||
|
||||
|
||||
/* What is the HEIGHT limit for using the Ideal weight calculation? */
|
||||
/* The calculation will be done if the height is GREATER THAN OR EQUAL TO this number listed below */
|
||||
ideal_WT_height_limit:= 150; /* cm */
|
||||
|
||||
|
||||
|
||||
wtgm := read last
|
||||
{ " Select Text from CV3PhysicalNoteDeclaration "
|
||||
|| " where ClientGUID = " || SQL(client_guid)
|
||||
|| " and ClientVisitGUID = " || SQL(client_visit_guid)
|
||||
|| " and TypeCode = {{{SINGLE-QUOTE}}}weight{{{SINGLE-QUOTE}}} "
|
||||
|| " order by Entered asc "
|
||||
};
|
||||
|
||||
wt := (wtgm as number) / 1000;
|
||||
htcm := read last
|
||||
{ " Select Text from CV3PhysicalNoteDeclaration "
|
||||
|| " where ClientGUID = " || SQL(client_guid)
|
||||
|| " and ClientVisitGUID = " || SQL(client_visit_guid)
|
||||
|| " and TypeCode = {{{SINGLE-QUOTE}}}height{{{SINGLE-QUOTE}}} "
|
||||
|| " order by Entered asc "
|
||||
};
|
||||
ht := htcm as number;
|
||||
|
||||
If CPSVal is null then
|
||||
CPSVal := read last
|
||||
{"Select top 1 bo.value "
|
||||
|| " From cv3order as o with (nolock) "
|
||||
|| " join cv3basicobservation as bo with (nolock) "
|
||||
|| " on o.clientguid = bo.clientguid "
|
||||
|| " and o.chartguid = bo.chartguid "
|
||||
|| " and o.guid = bo.orderguid "
|
||||
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
||||
|| " and bo.Active = 1 "
|
||||
|| " And bo.IsHistory = 0 "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.active = 1 "
|
||||
|| " where o.clientguid = " || SQL(client_guid)
|
||||
// || " and o.chartguid = " || SQL(chart_guid)
|
||||
|| " and o.performeddtm >= (DATEADD(hour, -24, getdate())) "
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Creatinine Plasma/Serum{{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.performeddtm desc "
|
||||
};
|
||||
endif;
|
||||
|
||||
// use for testing on patient with no serum creat TESTING only remove for PROD
|
||||
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n cpsval: " || cpsval ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
// if not exist CPSVal then
|
||||
// if tempcreat is not null then
|
||||
// cpsval := tempcreat as number;
|
||||
// endif; endif;
|
||||
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n cpsvalTEST: " || cpsval ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
// end of value for serum creatinine for TESTING only
|
||||
|
||||
CPSValNum := CPSVal As Number;
|
||||
If exist CPSVal then
|
||||
crclmgdl := (int ((CPSValNum + 0.05) * 10))/10;
|
||||
crclumoll := (int (((crclmgdl * 88.4) + 0.05) * 10))/10;
|
||||
endif;
|
||||
|
||||
domore := true;
|
||||
// Get the patient age
|
||||
|
||||
(birthdate,dobM,dobD,birth_year, patientgender ) := read last { ClientInfo: BirthDate, BirthMonthNum, BirthDayNum, BirthYearNum, gendercode };
|
||||
patientAge := (NOW - birthdate) / (1 year);
|
||||
patientage:= (int (patientage));
|
||||
|
||||
;;
|
||||
evoke: // No evoke statement
|
||||
;;
|
||||
logic:
|
||||
|
||||
|
||||
|
||||
|
||||
If not exist wt or not exist ht or not exist crclmgdl then
|
||||
domore := false; endif;
|
||||
|
||||
|
||||
if patientage < 18 then
|
||||
domore := false;
|
||||
else
|
||||
|
||||
|
||||
actualwt:= wt;
|
||||
|
||||
// now ideal
|
||||
|
||||
if patientgender = "Female"
|
||||
then
|
||||
WeightKg:= ((((ht /2.54)-60)* 2.3)+45.5);
|
||||
else
|
||||
WeightKg:= ((((ht /2.54)-60)* 2.3)+50);
|
||||
endif; //if patientgender = "F"
|
||||
|
||||
idealwt := (int ((WeightKg+ 0.005) * 100))/100;
|
||||
|
||||
extraideal := "";
|
||||
if ht < ideal_WT_height_limit
|
||||
then
|
||||
extraideal := "(Patient < 60 inches)";
|
||||
if patientgender = "Female"
|
||||
then
|
||||
idealwt := 45.5;
|
||||
else
|
||||
idealwt := 50;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
// now adjusted
|
||||
|
||||
adjustedwt := ((actualwt - idealwt)* 0.4) + idealwt;
|
||||
|
||||
|
||||
// now round all
|
||||
actualwt := (int ((actualwt + 0.005) * 100))/100;
|
||||
idealwt := (int ((idealwt + 0.005) * 100))/100;
|
||||
adjustedwt := (int ((adjustedwt + 0.005) * 100))/100;
|
||||
|
||||
commfield:="Calculated with age of " || patientage || ", Actual Weight:" || actualwt ||
|
||||
", Ideal Weight:" || idealwt || ", Adjusted Weight " || adjustedwt || " Gender:" || patientgender;
|
||||
|
||||
// Added "ActualWeightOnly" TMS CSR 36322
|
||||
|
||||
If evokingobject.name matches pattern "Dabigatran%" or evokingobject.name matches pattern "Rivaroxaban%" then
|
||||
ActualWeightOnly := true;
|
||||
else
|
||||
ActualWeightOnly := false;
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if actualwt < idealwt or ActualWeightOnly = true then
|
||||
weightused:= actualwt;
|
||||
else
|
||||
weightused:= adjustedwt;
|
||||
endif;
|
||||
|
||||
commfield := commfield || ", WEIGHT USED:" || weightused;
|
||||
|
||||
EstCrClval := ((140 - patientage) * weightused )
|
||||
/ (72 * crclmgdl);
|
||||
|
||||
commfield := commfield || ", FORMULA USED:((140 - Age) x Wt / (72 x SerumCreat))";
|
||||
if patientgender = "Female"
|
||||
then
|
||||
EstCrClval := EstCrClval * 0.85;
|
||||
commfield := commfield || " x 0.85";
|
||||
endif; //gender = "F"
|
||||
|
||||
EstCrClval := (int ((EstCrClval + 0.05) * 10))/ 10;
|
||||
|
||||
crclestd:= EstCrClval;
|
||||
|
||||
endif;
|
||||
|
||||
conclude domore;
|
||||
;;
|
||||
action:
|
||||
// This MLM returns two parameters, of types communication_type and form_type respectively.
|
||||
return commfield, crclestd, cpsval, wt, patientage;
|
||||
// return commfield, EstCrClval;
|
||||
;;
|
||||
end:
|
||||
151
MLMStripper/bin/Debug/SCH/SCH_FUNC_CUSTOM_MSGBOX.mlm
Normal file
151
MLMStripper/bin/Debug/SCH/SCH_FUNC_CUSTOM_MSGBOX.mlm
Normal file
@@ -0,0 +1,151 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_FUNC_CUSTOM_MSGBOX;;
|
||||
mlmname: SCH_FUNC_CUSTOM_MSGBOX;;
|
||||
arden: version 2;;
|
||||
version: 4.00;;
|
||||
institution: St Clair Memorial Hospital;;
|
||||
author: Shawn Head;;
|
||||
specialist: ;;
|
||||
date: 2016-09-06;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: This MLM calls an Objects+ DLL (Custom_MsgBox.dll)which can dislay a custom SCM message box
|
||||
;;
|
||||
explanation:
|
||||
|
||||
Change history
|
||||
|
||||
09.06.2016 STH Created {Go-Live 10/4/2016}
|
||||
10.6.2018 STH CSR#: 36715 & 35594 - Updated Objects+ to allow for resizing of window, positioning of font, added extra box for "relevant information" associated with alert, buttons resize based on font, center alert
|
||||
on the screen, removed the title bar/min,max,close buttons. {Go-Live 11/7/2018}
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
/* TO USE THIS MLM YOU CAN ADD THE CODE BELOW TO ANY OTHER MLM. THEN USING THE dlg_result YOU CAN LOOK AT WHICH BUTTON THE USER SELECTED
|
||||
//THIS CODE SHOULD BE PLACED TOWARDS THE TOP OF THE MLM IN THE USER EDIT SECTIONS
|
||||
Custom_Msg_Box := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_CUSTOM_MSGBOX{{{SINGLE-QUOTE}}};
|
||||
|
||||
AlertWindowHeight := "250"; //This will be the hight of the window. Minimum is 250.
|
||||
AlertWindowWidth := "500"; //This will be the width of the window. Minimum is 480;
|
||||
|
||||
MsgBoxButtons := ();
|
||||
MsgBoxButtons := ("THE BUTTONS WILL", "GROW IN SIZE","BASED","ON TEXT IN BUTTON"); //THESE LIST ITEMS WILL BE PASSSED TO THE THE MESSAGE BOX BUTTON LABEL/TEXT/CAPTION AS THE SELECTABLE BUTTON VALUE. YOU CAN HAVE UP TO 4 BUTTONS.
|
||||
MsgBoxContent := "This will populate the primary message window on the alert.\n\nThe windows is set to automatically wordwrap so if you have a really long sentance or message it will automatically word wrap for you.\n\n"
|
||||
|| "There is no scoll bar so if your information spans further than the message box available it will get cut off and not be visual to the user."
|
||||
|| "you must adjust the window size to accomidate the information you want to present to the user";
|
||||
MB_VAlign := "CENTER"; //Options are TOP, BOTTOM, CENTER. This will vertically align the text in the primary message box.
|
||||
MB_HAlign := "CENTER"; //Options are LEFT, RIGHT, CENTER. This will horizontially align the message box textual content in the primary message box.
|
||||
|
||||
AdditionalInfoBox := "This is an additional info box. There are times where there is supporting evidence related to the message box being show. Sometimes this could be orders, results, demographics, etc...."
|
||||
|| "\n\nIn the event you want to use this additional window you can set the AdditionalInfoBox to have information and the window will be automatically sized to 35% of the window size"
|
||||
|| "******you can pass empty string if you dont need this box";
|
||||
ADINFO_VAlign := "CENTER"; //Options are TOP, BOTTOM, CENTER. This will vertically align the text in the additional info message box.
|
||||
ADINFO_HAlign := "CENTER"; //Options are LEFT, RIGHT, CENTER. This will horizontially align the message box textual content in the additional info message box.
|
||||
//THIS CODE CAN BE ENTERED INTO THE MLM WHERE YOU EXPECT THE MESSAGE BOX TO APPEAR. WHAT EVER THE LABEL/TEXT OF THE BUTTON IS CLICKED WILL BE RETURNED
|
||||
//TO THE dlb_result FOR YOU TO CODE YOU MLM BASED ON THE USERS SELECTION.
|
||||
dlg_result := call Custom_Msg_Box with (AlertWindowHeight,AlertWindowWidth,MsgBoxContent,MB_VAlign,MB_HAlign,MsgBoxButtons,AdditionalInfoBox,ADINFO_VAlign,ADINFO_HAlign);
|
||||
*/
|
||||
log_execution_info:=FALSE;
|
||||
(MSG_BOX_HEIGHT, MSG_BOX_WIDTH, MSG_BOX_CONTENT, MSG_BOX_V_ALIGN, MSG_BOX_H_ALIGN, MSG_BOX_BUTTON_LABELS, MSG_BOX_ADDITIONAL_INFO, MSG_BOX_ADDITIONAL_INFO_V_ALIGN, MSG_BOX_ADDITIONAL_INFO_H_ALIGN) := ARGUMENT;
|
||||
// (MESSAGE_BOX_DETAILED_MSG, MSG_BOX_LABEL , MSG_BOX_BUTTON_LABELS, MSG_BOX_HEIGHT, MSG_BOX_WIDTH, RTF_MSG_BOX_HEIGHT) := ARGUMENT;
|
||||
if (Called_By_Editor = true) then
|
||||
triggerme := false;
|
||||
listvalues := ();
|
||||
listvalues := ("THE BUTTONS WILL GROWN IN SIZE", "BASED","ON THE TEXT INCLUDED IN" ,"THE BUTTON"); //THESE LIST ITEMS WILL BE PASSSED TO THE THE MESSAGE BOX BUTTON LABEL/TEXT/CAPTION AS THE SELECTABLE BUTTON VALUE. YOU CAN HAVE UP TO 4 BUTTONS.
|
||||
|
||||
MSG_BOX_CONTENT := "This will populate the primary message window on the alert.\n\nThe windows is set to automatically wordwrap so if you have a really long sentance or message it will automatically word wrap for you.\n\n"
|
||||
|| "There is no scoll bar so if your information spans further than the message box available it will get cut off and not be visual to the user."
|
||||
|| "you must adjust the window size to accomidate the information you want to present to the user";
|
||||
MSG_BOX_V_ALIGN := "TOP"; //TOP, CENTER BOTTOM
|
||||
MSG_BOX_H_ALIGN := "LEFT"; //LEFT, RIGHT OR CENTER
|
||||
|
||||
MSG_BOX_ADDITIONAL_INFO := "This is an additional info box. There are times where there is supporting evidence related to the message box being shown. Sometimes this could be orders, results, demographics, etc...."
|
||||
|| "\n\nIn the event you want to use this additional window you can set the AdditionalInfoBox to have information and the window will be automatically sized to 35% of the window size"
|
||||
|| "******you can pass empty string if you dont need this box";
|
||||
MSG_BOX_ADDITIONAL_INFO_V_ALIGN := "TOP";
|
||||
MSG_BOX_ADDITIONAL_INFO_H_ALIGN := "LEFT";
|
||||
|
||||
MSG_BOX_BUTTON_LABELS := "" || listvalues;
|
||||
//MINIMUM HEIGHT IS 250 -- try 500 height to make this sample look better
|
||||
MSG_BOX_HEIGHT := "250";
|
||||
//MINIMUM WIDTH IS 480 -- try 1000 width to make this sample look better
|
||||
MSG_BOX_WIDTH := "480";
|
||||
|
||||
else
|
||||
triggerme := true;
|
||||
MSG_BOX_LABEL := "" || MSG_BOX_LABEL;
|
||||
MESSAGE_BOX_DETAILED_MSG := "" || MESSAGE_BOX_DETAILED_MSG;
|
||||
MSG_BOX_BUTTON_LABELS := "" || MSG_BOX_BUTTON_LABELS;
|
||||
MSG_BOX_HEIGHT := "" || MSG_BOX_HEIGHT;
|
||||
MSG_BOX_WIDTH := "" || MSG_BOX_WIDTH;
|
||||
|
||||
MSG_BOX_CONTENT := "" || MSG_BOX_CONTENT;
|
||||
MSG_BOX_V_ALIGN := "" || MSG_BOX_V_ALIGN; //TOP, CENTER BOTTOM
|
||||
MSG_BOX_H_ALIGN := "" || MSG_BOX_H_ALIGN; //LEFT, RIGHT OR CENTER
|
||||
|
||||
MSG_BOX_ADDITIONAL_INFO := "" || MSG_BOX_ADDITIONAL_INFO;
|
||||
MSG_BOX_ADDITIONAL_INFO_V_ALIGN := "" || MSG_BOX_ADDITIONAL_INFO_V_ALIGN;
|
||||
MSG_BOX_ADDITIONAL_INFO_H_ALIGN := "" || MSG_BOX_ADDITIONAL_INFO_H_ALIGN;
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
using "Custom_MsgBox"; /* DLL Name */
|
||||
using namespace "wpfMsgBox"; /* Do not understand purpose...DLL funcional even if this is misspelled */
|
||||
/* Namespace.Form */
|
||||
//test:= new net_object {{{SINGLE-QUOTE}}}wpfMsgBox_sth.MsgBox_Load{{{SINGLE-QUOTE}}} with (MSG_BOX_LABEL , MESSAGE_BOX_DETAILED_MSG , MSG_BOX_BUTTON_LABELS, MSG_BOX_HEIGHT, MSG_BOX_WIDTH,RTF_MSG_BOX_HEIGHT);
|
||||
test:= new net_object {{{SINGLE-QUOTE}}}wpfMsgBox.MsgBox_Load{{{SINGLE-QUOTE}}} with (MSG_BOX_HEIGHT, MSG_BOX_WIDTH, MSG_BOX_CONTENT, MSG_BOX_V_ALIGN, MSG_BOX_H_ALIGN, MSG_BOX_BUTTON_LABELS, MSG_BOX_ADDITIONAL_INFO, MSG_BOX_ADDITIONAL_INFO_V_ALIGN, MSG_BOX_ADDITIONAL_INFO_H_ALIGN);
|
||||
;;
|
||||
evoke: /* Call MLM */
|
||||
;;
|
||||
logic:
|
||||
try
|
||||
oeUnsigned:=CALL test.ShowDialog;
|
||||
MsgBoxAnswer := test.MsgBoxSelected;
|
||||
|
||||
|
||||
|
||||
endtry;
|
||||
catch exception ex
|
||||
|
||||
debugFlag := true;
|
||||
messageText := messageText || "New General Order:\n" || ex.Message || "\n\n";
|
||||
endcatch;
|
||||
if(messagetext is null) then
|
||||
|
||||
conclude true;
|
||||
else
|
||||
conclude false;
|
||||
endif;
|
||||
/*
|
||||
if (triggerme = true)
|
||||
then
|
||||
oeUnsigned:=CALL test.ShowDialog;
|
||||
// oeUnsigned:=CALL test.Show;
|
||||
conclude true;
|
||||
else
|
||||
conclude false;
|
||||
endif;
|
||||
*/
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
return(MsgBoxAnswer);//all of the action is done by the call to the FFI
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
238
MLMStripper/bin/Debug/SCH/SCH_FUNC_DCSUMMARY_PRINT.mlm
Normal file
238
MLMStripper/bin/Debug/SCH/SCH_FUNC_DCSUMMARY_PRINT.mlm
Normal file
@@ -0,0 +1,238 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_FUNC_DCSUMMARY_PRINT;;
|
||||
mlmname: SCH_FUNC_DCSUMMARY_PRINT;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: Allscripts;;
|
||||
author: Shawn Head;;
|
||||
specialist: ;;
|
||||
date: 2015-05-11;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: print electronic DC Summary document report from MLM
|
||||
|
||||
;;
|
||||
explanation: This called MLM uses ReportRequest class to print discharge summary document report.
|
||||
It also set report{{{SINGLE-QUOTE}}}s parameter values and distribution information
|
||||
|
||||
Change history
|
||||
|
||||
05.11.2015 STH CSR# 32070 go-live 6/9/2015 - Create electronic Discharge Summary report that will be sent to PDF, then converted to interface message
|
||||
(DEV) 7.7.2015 STH CSR#: 32070 - Testing for missing reports.
|
||||
|
||||
;;
|
||||
keywords:
|
||||
Discharge Summary, Day of Discharge Note, DC Summary
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "SCMLib";
|
||||
using "SCM.Common.Interfaces";
|
||||
using namespace "SCMLib";
|
||||
using namespace "SCM.Common.Interfaces";
|
||||
|
||||
|
||||
(ClientGuid,ChartGuid,VisitGuid,DCSummary,DCSummaryGUID) := ARGUMENT;
|
||||
|
||||
|
||||
(VisitID, MRN) := read last { " select visitidcode, idcode from cv3clientvisit with (nolock) "
|
||||
|| " where clientguid = " || sql(ClientGuid)
|
||||
|| " and chartguid = " || sql(ChartGuid)
|
||||
|| " and guid = " || sql(VisitGuid) };
|
||||
ClientDocumentGUID := ();
|
||||
if DCSummaryGUID is null then
|
||||
ClientDocumentGUID := read
|
||||
{ " Select cd.guid from CV3ClientDocument cd with (nolock) "
|
||||
|| " WHERE cd.ClientGUID = " || sql(ClientGuid)
|
||||
|| " AND cd.ChartGUID = " || sql(ChartGuid)
|
||||
|| " AND cd.ClientVisitGUID = " || sql(VisitGuid)
|
||||
|| " and cd.DocumentName like " || sql(DCSummary)
|
||||
|| " and cd.IsCanceled = 0 "
|
||||
|| " and cd.Active = 1 "
|
||||
|| " and cd.guid not in (select FillerDocumentID from CV3ClientDocument cd2 with (nolock) "
|
||||
|| " where cd2.ClientGUID = cd.ClientGUID and cd2.ChartGUID = cd.ChartGUID and cd2.ClientVisitGUID = cd.ClientVisitGUID "
|
||||
|| " and cd2.documentname like {{{SINGLE-QUOTE}}}discharge summary%{{{SINGLE-QUOTE}}} and cd2.Active = 1 and cd2.IsCanceled = 0 and cast(isnull(cd2.FillerDocumentID,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) as varchar) = cast(cd.guid as varchar) "
|
||||
|| " and cd2.AuthoredDtm = cast(convert(varchar(19),cd.touchedwhen,20) as datetime)) "};
|
||||
else
|
||||
ClientDocumentGUID := DCSummaryGUID;
|
||||
endif;
|
||||
|
||||
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 ];
|
||||
|
||||
|
||||
|
||||
PhoneNumber := read last {" set concat_null_yields_null off select p.AreaCode + p.PhoneNumber from CV3User u with (nolock) join Cv3Phone p with (nolock) on p.PersonGUID = u.GUID " ||
|
||||
" where u.displayname = {{{SINGLE-QUOTE}}}SCM, Text Messaging{{{SINGLE-QUOTE}}} and p.PhoneNote = {{{SINGLE-QUOTE}}}HIS Test{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
abc123 := abc123 || "\n\n" || "PRODUCTION";
|
||||
|
||||
for x in (1 seqto count(ClientDocumentGUID)) do
|
||||
CD_GUID := ClientDocumentGUID[x];
|
||||
|
||||
|
||||
if (CD_GUID <> "" OR CD_GUID is not null)
|
||||
then
|
||||
try
|
||||
abc123 := abc123 || "\n\n" || "Enter Try";
|
||||
|
||||
|
||||
|
||||
|
||||
report_request_obj := call {{{SINGLE-QUOTE}}}ObjectsPlusXA.SunriseClinicalManager.ReportRequest{{{SINGLE-QUOTE}}}.CreateReportRequest with ("DischargeSummary_PDF" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
|
||||
abc123 := abc123 || "\n\n" || "Created Report Object";
|
||||
if (report_request_obj.Parameters is not null and report_request_obj.Parameters.Count > 0)
|
||||
then
|
||||
abc123 := abc123 || "\n\n" || "Entered If parameters exists section";
|
||||
report_parameter_list := ();
|
||||
for parameterIndex in (1 seqto report_request_obj.Parameters.Count)
|
||||
do
|
||||
abc123 := abc123 || "\n\n" || "Entered for parameterindex loop count #:" || parameterIndex;
|
||||
report_parameter_list := report_parameter_list, report_request_obj.Parameters[parameterIndex];
|
||||
enddo;
|
||||
endif;
|
||||
abc123 := abc123 || "\n\n" || "set report parameter list";
|
||||
param_ClientDocGUID := first (report_parameter_list where report_parameter_list.Label = "varClientDocumentGUID");
|
||||
param_ClientGUID:= first (report_parameter_list where report_parameter_list.Label = "varClientGUID");
|
||||
param_ChartGUID := first(report_parameter_list where report_parameter_list.Label = "varClientChartGUID");
|
||||
param_VisitGUID := first(report_parameter_list where report_parameter_list.Label = "varClientVisitGUID");
|
||||
param_VisitID := first(report_parameter_list where report_parameter_list.Label = "varVisitID");
|
||||
param_VisitMRN := first(report_parameter_list where report_parameter_list.Label = "varVisitMRN");
|
||||
abc123 := abc123 || "\n\n" || "set report parameter values";
|
||||
|
||||
if param_VisitID.AllowModification then
|
||||
void := call param_VisitID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(VisitID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if param_VisitMRN.AllowModification then
|
||||
void := call param_VisitMRN.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(MRN) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
|
||||
if param_ClientDocGUID.AllowModification then
|
||||
void := call param_ClientDocGUID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(CD_GUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if param_ClientGUID.AllowModification then
|
||||
void := call param_ClientGUID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(ClientGUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if param_ChartGUID.AllowModification then
|
||||
void := call param_ChartGUID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(ChartGUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if param_VisitGUID.AllowModification then
|
||||
void := call param_VisitGUID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(VisitGUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
abc123 := abc123 || "\n\n" || "check parameters for modify and set them to desired values";
|
||||
report_request_obj.PrintPolicy := "Broadcast" as {{{SINGLE-QUOTE}}}PrintPolicy{{{SINGLE-QUOTE}}};
|
||||
report_request_obj.ProcessReportLocally := false;
|
||||
report_request_obj.PrintJobDestination := "PDFHL7";
|
||||
reportRequest.PrintJobPriority := "Normal" as {{{SINGLE-QUOTE}}}PrintJobPriority{{{SINGLE-QUOTE}}};
|
||||
report_request_obj.NumberOfCopies := 1;
|
||||
|
||||
abc123 := abc123 || "\n\n" || "set other report vales";
|
||||
// print the report
|
||||
void := call report_request_obj.Save;
|
||||
abc123 := abc123 || "\n\n" || "save and print report";
|
||||
// Call Dispose on report_request_obj to clean it up
|
||||
if report_request_obj is not null
|
||||
then
|
||||
void := call report_request_obj.Dispose;
|
||||
report_request_obj := null;
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
|
||||
catch exception ex
|
||||
abc123 := abc123 || "\n\n" || "entered catch error exception";
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Auto Print:{{-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;
|
||||
abc123 := abc123 || "\n\n" || error_message;
|
||||
// Send a Text Message Section
|
||||
|
||||
// Call Dispose on report_request_obj to clean it up
|
||||
if report_request_obj is not null
|
||||
then
|
||||
void := call report_request_obj.Dispose;
|
||||
report_request_obj := null;
|
||||
endif;
|
||||
|
||||
endcatch;
|
||||
|
||||
endif;
|
||||
enddo;
|
||||
// Send a Text Message Section
|
||||
|
||||
|
||||
Page_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_PAGE{{{SINGLE-QUOTE}}};
|
||||
MessageSubject:= "Discharge Summary MLM Alert";
|
||||
MessageBody := " ClientGUID: " || ClientGuid || "\n\n "
|
||||
|| "ChartGUID: " || ChartGuid || "\n\n "
|
||||
|| "ClientVisitGUID: " || VisitGuid || "\n\n"
|
||||
|| "DCSummaryGUID: " || DCSummaryGUID || "\n\n"
|
||||
|| "DCSummary: " || DCSummary
|
||||
|| "ClientDocGUID: " || ClientDocumentGUID || "\n\n"
|
||||
|| "cd_guid: " || CD_GUID || "\n\n"
|
||||
/*
|
||||
|| "param_VisitID: " || param_VisitID.Value || "\n\n"
|
||||
|| "param_ClientGUID " || param_ClientGUID.Value || "\n\n"
|
||||
|| "param_ChartGUID: " || param_ChartGUID.Value || "\n\n"
|
||||
|| "param_ClientDocGUID: " || param_ClientDocGUID.Value || "\n\n"
|
||||
|| "report_request_obj.Parameters: " || report_request_obj.Parameters
|
||||
*/
|
||||
|| "abc123: " || abc123;
|
||||
if error_occurred then
|
||||
void := call Page_MLM with(PhoneNumber, MessageSubject, MessageBody);
|
||||
endif;
|
||||
|
||||
// Diagnostic Alert - Can be enabled if needed
|
||||
// send_alert := "DoNotSend";
|
||||
// alert_dest := destination { Alert: warning, "Informational", high, chart, "Informational", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
conclude true;
|
||||
;;
|
||||
action:
|
||||
if Error_occurred
|
||||
then
|
||||
write "An error has occured in the MLM {{+B}}SCH_FUNC_DCSUMMARY_PRINT{{-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;
|
||||
|
||||
// Diagnostic Alert - Can be enabled if needed
|
||||
// write " Messages " || " Execute the Called PRINT MLM - " || NOW || " " || ClientDocumentGUID at alert_dest;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,329 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_FUNC_DCSUMMARY_PRINT_STHTESTING;;
|
||||
mlmname: SCH_FUNC_DCSUMMARY_PRINT_STHTESTING;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: Allscripts;;
|
||||
author: Shawn Head;;
|
||||
specialist: ;;
|
||||
date: 2015-05-11;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: print electronic DC Summary document report from MLM
|
||||
|
||||
;;
|
||||
explanation: This called MLM uses ReportRequest class to print discharge summary document report.
|
||||
It also set report{{{SINGLE-QUOTE}}}s parameter values and distribution information
|
||||
|
||||
Change history
|
||||
|
||||
05.11.2015 STH CSR# 32070 go-live 6/9/2015 - Create electronic Discharge Summary report that will be sent to PDF, then converted to interface message
|
||||
(DEV) 7.7.2015 STH CSR#: 32070 - Testing for missing reports.
|
||||
|
||||
;;
|
||||
keywords:
|
||||
Discharge Summary, Day of Discharge Note, DC Summary
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "SCMLib";
|
||||
using "SCM.Common.Interfaces";
|
||||
using namespace "SCMLib";
|
||||
using namespace "SCM.Common.Interfaces";
|
||||
|
||||
|
||||
//(ClientGuid,ChartGuid,VisitGuid,DCSummary,DCSummaryGUID) := ARGUMENT;
|
||||
/*
|
||||
clientguid := "20526020001";
|
||||
chartguid := "9000443888100170";
|
||||
visitguid := "9000443888100270";
|
||||
DCSummaryGUID := null;
|
||||
dcSummary := "Day of Discharge%";
|
||||
(VisitID, MRN) := read last { " select visitidcode, idcode from cv3clientvisit with (nolock) "
|
||||
|| " where clientguid = " || sql(ClientGuid)
|
||||
|| " and chartguid = " || sql(ChartGuid)
|
||||
|| " and guid = " || sql(VisitGuid) };
|
||||
*/
|
||||
/*
|
||||
(idcode,visitidcode,clientguid,chartguid,visitguid,ClientDocumentGUID) := read { "
|
||||
select
|
||||
cv.ClientGUID
|
||||
,cv.ChartGUID
|
||||
,cv.GUID as {{{SINGLE-QUOTE}}}cv_guid{{{SINGLE-QUOTE}}}
|
||||
,cv.ClientDisplayName
|
||||
,cv.IDCode
|
||||
,cv.VisitIDCode
|
||||
,cv.TypeCode
|
||||
,cv.AdmitDtm
|
||||
,cv.DischargeDtm
|
||||
,(select name from CV3Location where guid = cv.CurrentLocationGUID) as {{{SINGLE-QUOTE}}}UNIT{{{SINGLE-QUOTE}}}
|
||||
,cv.DischargeDisposition
|
||||
,(select dbo.SXACalculateAgeByDatePartsFN(c.BirthDayNum,c.BirthMonthNum,c.BirthYearNum,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}},isnull(cv.dischargedtm,cv.admitdtm))) as {{{SINGLE-QUOTE}}}age{{{SINGLE-QUOTE}}}
|
||||
,DateDiff(hh,cv.AdmitDtm, isnull(cv.dischargedtm,getdate())) as {{{SINGLE-QUOTE}}}LOS_HOURS{{{SINGLE-QUOTE}}}
|
||||
,cv.VisitStatus
|
||||
into #tmp_cv
|
||||
from CV3ClientVisit cv with (Nolock)
|
||||
inner join CV3Client c with (Nolock)
|
||||
on cv.ClientGUID = c.GUID
|
||||
where
|
||||
(typecode in ({{{SINGLE-QUOTE}}}INPATIENT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}OBSERVATION{{{SINGLE-QUOTE}}})
|
||||
and VisitStatus in ({{{SINGLE-QUOTE}}}adm{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}dsc{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CLS{{{SINGLE-QUOTE}}})
|
||||
and isnull(DischargeDtm,admitdtm) >= {{{SINGLE-QUOTE}}}2019-01-01 00:00:00.000{{{SINGLE-QUOTE}}}
|
||||
and (DischargeDtm <= getdate()
|
||||
or DischargeDtm is null))
|
||||
|
||||
|
||||
|
||||
select distinct
|
||||
cv.*
|
||||
,cd.GUID as {{{SINGLE-QUOTE}}}cd_guid{{{SINGLE-QUOTE}}}
|
||||
,cd.Entered
|
||||
,cd.CreatedWhen
|
||||
,cd.tobesigned
|
||||
,cdh.historydtm
|
||||
,cdh.historyreason
|
||||
,cdh.historytype
|
||||
,cu.displayname
|
||||
,cd.DocumentName
|
||||
into #tmp_documents
|
||||
from #tmp_cv cv
|
||||
left join cv3clientdocument as cd
|
||||
on cv.clientguid = cd.clientguid
|
||||
and cv.chartguid = cd.chartguid
|
||||
and cv.cv_guid = cd.clientvisitguid
|
||||
and cd.PatCareDocGUID = {{{SINGLE-QUOTE}}}5000001002202001{{{SINGLE-QUOTE}}}
|
||||
and cd.IsCanceled = 0
|
||||
|
||||
|
||||
left join cv3clientdochistory as cdh
|
||||
on cd.clientguid = cdh.clientguid
|
||||
and cd.guid = cdh.clientdocguid
|
||||
and cdh.historyType = 1
|
||||
|
||||
left join cv3user as cu
|
||||
on cd.authoredproviderguid= cu.guid
|
||||
|
||||
left join cv3patientcaredocument as pcd
|
||||
on cd.patcaredocguid = pcd.guid
|
||||
left join cv3organizationalunit as ou
|
||||
on pcd.orgunitguid = ou.guid
|
||||
where cd.ToBeSigned = 1
|
||||
or cd.GUID is null
|
||||
|
||||
|
||||
select convert(varchar(5),DateDiff(s, cv.DischargeDtm,getdate())/86400) as {{{SINGLE-QUOTE}}}DC_Days{{{SINGLE-QUOTE}}},
|
||||
convert(varchar(5),DateDiff(s,cv.DischargeDtm, getdate())%86400/3600) as {{{SINGLE-QUOTE}}}DC_hours{{{SINGLE-QUOTE}}},
|
||||
convert(varchar(5),DateDiff(s, cv.DischargeDtm,getdate())%3600/60) as {{{SINGLE-QUOTE}}}DC_minutes{{{SINGLE-QUOTE}}},
|
||||
case when d.DocumentName is null then {{{SINGLE-QUOTE}}}MISSING{{{SINGLE-QUOTE}}}
|
||||
else {{{SINGLE-QUOTE}}}ON CHART{{{SINGLE-QUOTE}}} END as{{{SINGLE-QUOTE}}}DischargeSummary{{{SINGLE-QUOTE}}}
|
||||
,case when cd.DocumentName is null then {{{SINGLE-QUOTE}}}NO{{{SINGLE-QUOTE}}}
|
||||
else {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} end as {{{SINGLE-QUOTE}}}SCM_DC_NOTE_PRESENT{{{SINGLE-QUOTE}}}
|
||||
,d.ToBeSigned
|
||||
,d.CreatedWhen
|
||||
,CD.ENTERED
|
||||
,cd.guid
|
||||
,cv.*
|
||||
into #tmp_final
|
||||
from #tmp_documents d with (nolock)
|
||||
left join CV3ClientDocument cd with (Nolock)
|
||||
on d.ClientGUID = cd.ClientGUID
|
||||
and d.ChartGUID = cd.ChartGUID
|
||||
and d.cv_guid = cd.ClientVisitGUID
|
||||
and cd.PatCareDocGUID = {{{SINGLE-QUOTE}}}9000001101102020{{{SINGLE-QUOTE}}}
|
||||
INNER JOIN #tmp_cv CV
|
||||
ON d.CLIENTGUID = CV.CLIENTGUID
|
||||
AND D.CHARTGUID = CV.CHARTGUID
|
||||
AND D.cv_guid = CV.cv_guid
|
||||
|
||||
select top 1
|
||||
idcode
|
||||
,visitidcode
|
||||
,clientguid
|
||||
,ChartGUID
|
||||
,cv_guid
|
||||
,GUID
|
||||
from #tmp_final
|
||||
where SCM_DC_NOTE_PRESENT = {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}}
|
||||
AND ToBeSigned IS NULL
|
||||
|
||||
DROP TABLE #tmp_final,#tmp_cv, #tmp_documents "};
|
||||
*/
|
||||
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 ];
|
||||
|
||||
|
||||
PhoneNumber := read last {" set concat_null_yields_null off select p.AreaCode + p.PhoneNumber from CV3User u with (nolock) join Cv3Phone p with (nolock) on p.PersonGUID = u.GUID " ||
|
||||
" where u.displayname = {{{SINGLE-QUOTE}}}SCM, Text Messaging{{{SINGLE-QUOTE}}} and p.PhoneNote = {{{SINGLE-QUOTE}}}HIS Test{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
abc123 := abc123 || "\n\n" || "PRODUCTION";
|
||||
|
||||
for x in (1 seqto count(ClientDocumentGUID)) do
|
||||
CD_GUID := ClientDocumentGUID[x];
|
||||
CV_GUID := VisitGUID[x];
|
||||
C_GUID := ClientGUID[x];
|
||||
CT_GUID := ChartGUID[x];
|
||||
acct := VisitIDCode[x];
|
||||
MRN := IDCode[x];
|
||||
|
||||
|
||||
if (CD_GUID <> "" OR CD_GUID is not null)
|
||||
then
|
||||
try
|
||||
abc123 := abc123 || "\n\n" || "Enter Try";
|
||||
|
||||
|
||||
|
||||
|
||||
report_request_obj := call {{{SINGLE-QUOTE}}}ObjectsPlusXA.SunriseClinicalManager.ReportRequest{{{SINGLE-QUOTE}}}.CreateReportRequest with ("DischargeSummary_PDF" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
|
||||
abc123 := abc123 || "\n\n" || "Created Report Object";
|
||||
if (report_request_obj.Parameters is not null and report_request_obj.Parameters.Count > 0)
|
||||
then
|
||||
abc123 := abc123 || "\n\n" || "Entered If parameters exists section";
|
||||
report_parameter_list := ();
|
||||
for parameterIndex in (1 seqto report_request_obj.Parameters.Count)
|
||||
do
|
||||
abc123 := abc123 || "\n\n" || "Entered for parameterindex loop count #:" || parameterIndex;
|
||||
report_parameter_list := report_parameter_list, report_request_obj.Parameters[parameterIndex];
|
||||
enddo;
|
||||
endif;
|
||||
abc123 := abc123 || "\n\n" || "set report parameter list";
|
||||
param_ClientDocGUID := first (report_parameter_list where report_parameter_list.Label = "varClientDocumentGUID");
|
||||
param_ClientGUID:= first (report_parameter_list where report_parameter_list.Label = "varClientGUID");
|
||||
param_ChartGUID := first(report_parameter_list where report_parameter_list.Label = "varClientChartGUID");
|
||||
param_VisitGUID := first(report_parameter_list where report_parameter_list.Label = "varClientVisitGUID");
|
||||
param_VisitID := first(report_parameter_list where report_parameter_list.Label = "varVisitID");
|
||||
param_VisitMRN := first(report_parameter_list where report_parameter_list.Label = "varVisitMRN");
|
||||
abc123 := abc123 || "\n\n" || "set report parameter values";
|
||||
|
||||
if param_VisitID.AllowModification then
|
||||
void := call param_VisitID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(acct) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if param_VisitMRN.AllowModification then
|
||||
void := call param_VisitMRN.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(MRN) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
|
||||
if param_ClientDocGUID.AllowModification then
|
||||
void := call param_ClientDocGUID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(CD_GUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if param_ClientGUID.AllowModification then
|
||||
void := call param_ClientGUID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(C_GUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if param_ChartGUID.AllowModification then
|
||||
void := call param_ChartGUID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(CT_GUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if param_VisitGUID.AllowModification then
|
||||
void := call param_VisitGUID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(CV_GUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
abc123 := abc123 || "\n\n" || "check parameters for modify and set them to desired values";
|
||||
report_request_obj.PrintPolicy := "Broadcast" as {{{SINGLE-QUOTE}}}PrintPolicy{{{SINGLE-QUOTE}}};
|
||||
report_request_obj.ProcessReportLocally := false;
|
||||
report_request_obj.PrintJobDestination := "PDFHL7";
|
||||
reportRequest.PrintJobPriority := "Normal" as {{{SINGLE-QUOTE}}}PrintJobPriority{{{SINGLE-QUOTE}}};
|
||||
report_request_obj.NumberOfCopies := 1;
|
||||
|
||||
abc123 := abc123 || "\n\n" || "set other report vales";
|
||||
// print the report
|
||||
|
||||
void := call report_request_obj.Save;
|
||||
abc123 := abc123 || "\n\n" || "save and print report";
|
||||
// Call Dispose on report_request_obj to clean it up
|
||||
if report_request_obj is not null
|
||||
then
|
||||
void := call report_request_obj.Dispose;
|
||||
report_request_obj := null;
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
|
||||
catch exception ex
|
||||
abc123 := abc123 || "\n\n" || "entered catch error exception";
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Auto Print:{{-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;
|
||||
|
||||
// Send a Text Message Section
|
||||
|
||||
// Call Dispose on report_request_obj to clean it up
|
||||
if report_request_obj is not null
|
||||
then
|
||||
void := call report_request_obj.Dispose;
|
||||
report_request_obj := null;
|
||||
endif;
|
||||
|
||||
endcatch;
|
||||
|
||||
endif;
|
||||
enddo;
|
||||
// Send a Text Message Section
|
||||
|
||||
|
||||
Page_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_PAGE{{{SINGLE-QUOTE}}};
|
||||
MessageSubject:= "Discharge Summary MLM Alert";
|
||||
MessageBody := " ClientGUID: " || ClientGuid || "\n\n "
|
||||
|| "ChartGUID: " || ChartGuid || "\n\n "
|
||||
|| "ClientVisitGUID: " || VisitGuid || "\n\n"
|
||||
|| "DCSummaryGUID: " || DCSummaryGUID || "\n\n"
|
||||
|| "DCSummary: " || DCSummary
|
||||
|| "ClientDocGUID: " || ClientDocumentGUID || "\n\n"
|
||||
|| "cd_guid: " || CD_GUID || "\n\n"
|
||||
|| "abc123: " || abc123;
|
||||
|
||||
if error_occurred then
|
||||
void := call Page_MLM with(PhoneNumber, MessageSubject, MessageBody);
|
||||
endif;
|
||||
|
||||
// Diagnostic Alert - Can be enabled if needed
|
||||
// send_alert := "DoNotSend";
|
||||
// alert_dest := destination { Alert: warning, "Informational", high, chart, "Informational", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
conclude true;
|
||||
;;
|
||||
action:
|
||||
|
||||
if Error_occurred
|
||||
then
|
||||
write "An error has occured in the MLM {{+B}}SCH_FUNC_DCSUMMARY_PRINT{{-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;
|
||||
|
||||
// Diagnostic Alert - Can be enabled if needed
|
||||
// write " Messages " || " Execute the Called PRINT MLM - " || NOW || " " || ClientDocumentGUID at alert_dest;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
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:
|
||||
157
MLMStripper/bin/Debug/SCH/SCH_FUNC_DISCONTINUE_ORDER.mlm
Normal file
157
MLMStripper/bin/Debug/SCH/SCH_FUNC_DISCONTINUE_ORDER.mlm
Normal file
@@ -0,0 +1,157 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_FUNC_DISCONTINUE_ORDER;;
|
||||
mlmname: SCH_FUNC_DISCONTINUE_ORDER;;
|
||||
arden: version 2.5;;
|
||||
version: 16.30;;
|
||||
institution: ;;
|
||||
author: Juliet M. Law;;
|
||||
specialist: St. Clair Hospital;;
|
||||
date: 2017-09-25;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Discontinue an Order using the information passed from the calling MLM.
|
||||
;;
|
||||
explanation: Called MLM that discontinues orders for a patient. Copied from SCH_FUNC_CREATE_ORDER MLM.
|
||||
|
||||
Change history
|
||||
|
||||
09.25.2017 JML CSR# 26413 Created
|
||||
|
||||
;;
|
||||
keywords: Called MLM, Generic, Discontinue Order
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
(visitGUID, userGUID, orderGUID, orderDCReason) := ARGUMENT;
|
||||
|
||||
// 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_msg := "";
|
||||
|
||||
//Error Destination Object
|
||||
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_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true ];
|
||||
|
||||
user_IDType := "Edstan Number (physician)";
|
||||
|
||||
user_IDCode := read last {"SELECT IDCode FROM CV3CAREPROVIDERID " || " where ProviderGUID = " || SQL(userGUID)
|
||||
|| " and ProviderIDTypeCode = " || SQL(user_IDType) };
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
|
||||
if called_by_editor then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
try
|
||||
|
||||
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}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
|
||||
|
||||
endtry;
|
||||
|
||||
catch exception ex
|
||||
|
||||
error_occurred := true;
|
||||
error_msg := "{{+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 Hospital Policy";
|
||||
OrderDiscontinueReason := orderDCReason;
|
||||
|
||||
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";
|
||||
|
||||
careProviderGUID := ( RequestedBy_OBJ.PrimaryKey as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} ) as string;
|
||||
|
||||
dcOrder_OBJ := call Order_OBJ.Discontinue with OrderDiscontinueReason, date_str, time_str, RequestedBySource, careProviderGUID;
|
||||
|
||||
endtry;
|
||||
catch exception ex
|
||||
|
||||
error_occurred := true;
|
||||
error_msg := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
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;
|
||||
Conclude true;
|
||||
;;
|
||||
action:
|
||||
|
||||
if error_occurred then
|
||||
write "An error has occured in the MLM {{+B}}SCH_FUNC_DISCONTINUE_ORDER{{-B}} " || "Please notify your System Administrators that an error message has occurred " ||
|
||||
"message: \n" at error_destination;
|
||||
write error_msg at error_destination;
|
||||
endif;
|
||||
|
||||
return error_occurred;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
152
MLMStripper/bin/Debug/SCH/SCH_FUNC_MRSA_ORDER.mlm
Normal file
152
MLMStripper/bin/Debug/SCH/SCH_FUNC_MRSA_ORDER.mlm
Normal file
@@ -0,0 +1,152 @@
|
||||
maintenance:
|
||||
|
||||
title: Called MLM that determines if an MRSA order is to be placed ;;
|
||||
mlmname: SCH_Func_MRSA_Order;;
|
||||
arden: version 4.5;;
|
||||
version: 2.00;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: ;;
|
||||
specialist: ;;
|
||||
date: 2010-12-16;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
Called from the MRSA related MLM{{{SINGLE-QUOTE}}}s. It analyzes the patient{{{SINGLE-QUOTE}}}s record and returns data points.
|
||||
|
||||
;;
|
||||
explanation: This MLM was written to be called from ED Order Set MLMs, but can be called from others as well.
|
||||
|
||||
Change history
|
||||
|
||||
12.16.2010 DW Created
|
||||
05.04.2011 DW Logic to obtain result value split from order retrieval. Sort added to both on significant
|
||||
date and time.
|
||||
04.26.2011 TMS Moved fsl.value like {{{SINGLE-QUOTE}}}yes%{{{SINGLE-QUOTE}}} from left join statement down to where clause when retrieving NursingHome
|
||||
info to only get last yes value. Added clientvisit to only use information from current visit for
|
||||
Nursing Home info. HD Ticket 149146
|
||||
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation) := ARGUMENT;
|
||||
|
||||
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
|
||||
// Determine if Patient is on a Screening Unit
|
||||
|
||||
Unit:= Substring (find "-" in string CurrentLocation)-1 CHARACTERS From CurrentLocation;
|
||||
If Unit in ("ICU","CVSU","IRU","5A","5E","6E","5G") then ScreeningUnit := "Yes"; else ScreeningUnit := "No"; endif;
|
||||
|
||||
|
||||
// Attain MRSA Order History
|
||||
|
||||
/*
|
||||
(OrderName, SignificantDTM, StatusCode, ResultValue) := read last
|
||||
{"SELECT o.name, o.significantdtm, o.orderstatuscode, tol.text "
|
||||
|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
|
||||
|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid and o.clientguid = " || SQL(clientguid) || " and o.chartguid = " || SQL(chartguid) || " and o.clientvisitguid = " || SQL(clientvisitguid)
|
||||
|| " and o.orderstatuscode Not In ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}}) "
|
||||
|| " and o.name = {{{SINGLE-QUOTE}}}Nasal Screen for MRSA (Infection Control){{{SINGLE-QUOTE}}} "
|
||||
|| " left join cv3BasicObservation bo with (nolock) on bo.OrderGuid = o.guid and bo.clientguid = " || SQL(clientguid) || " and bo.chartguid = " || SQL(chartguid) || " and bo.clientvisitguid = " || SQL(clientvisitguid)
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}culture{{{SINGLE-QUOTE}}} "
|
||||
|| " left join cv3textualobservationline tol with (nolock) on tol.observationguid = bo.guid and tol.clientguid = " || SQL(clientguid) };
|
||||
*/
|
||||
|
||||
(OrderName, SignificantDTM, StatusCode) := read last
|
||||
{"SELECT o.name, o.significantdtm, o.orderstatuscode "
|
||||
|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
|
||||
|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid and o.clientguid = " || SQL(clientguid) || " and o.chartguid = " || SQL(chartguid) || " and o.clientvisitguid = " || SQL(clientvisitguid)
|
||||
|| " and o.orderstatuscode Not In ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}}) "
|
||||
|| " and o.name = {{{SINGLE-QUOTE}}}Nasal Screen for MRSA (Infection Control){{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.significantdtm " };
|
||||
|
||||
// Attain MRSA Result History
|
||||
|
||||
(ResultValue) := read last
|
||||
{"SELECT tol.text "
|
||||
|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
|
||||
|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid and o.clientguid = " || SQL(clientguid) || " and o.chartguid = " || SQL(chartguid) || " and o.clientvisitguid = " || SQL(clientvisitguid)
|
||||
|| " and o.orderstatuscode In ({{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}}) "
|
||||
|| " and o.name = {{{SINGLE-QUOTE}}}Nasal Screen for MRSA (Infection Control){{{SINGLE-QUOTE}}} "
|
||||
|| " left join cv3BasicObservation bo with (nolock) on bo.OrderGuid = o.guid and bo.clientguid = " || SQL(clientguid) || " and bo.chartguid = " || SQL(chartguid) || " and bo.clientvisitguid = " || SQL(clientvisitguid)
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}culture{{{SINGLE-QUOTE}}} "
|
||||
|| " left join cv3textualobservationline tol with (nolock) on tol.observationguid = bo.guid and tol.clientguid = " || SQL(clientguid)
|
||||
|| " order by o.significantdtm " };
|
||||
|
||||
|
||||
// Attain MRSA Flag History
|
||||
|
||||
|
||||
(MRSAHist) := read last
|
||||
{ " select case when EnterpriseClientcol8 in ({{{SINGLE-QUOTE}}}MRSA{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Both{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} end "
|
||||
|| " from cv3enterpriseclientdata where clientguid = " || SQL(clientguid) || " " };
|
||||
|
||||
|
||||
if exist MRSAHist then MRSAHistory := "Yes"; else MRSAHistory := "No"; endif;
|
||||
|
||||
|
||||
// Attain patient nursing home residency status from patient profile
|
||||
|
||||
|
||||
(NursingHome) := read last
|
||||
{"select fsl.value "
|
||||
|| " from CV3ClientDocument cd with (nolock) "
|
||||
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || SQL(clientguid) || " and cdd.active = 1) "
|
||||
|| " left join CV3ObservationDocument od with (nolock) ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|
||||
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID and ocmi.name in ({{{SINGLE-QUOTE}}}SCHCK_MRSA nursing home{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}sch_edtriage_arrive nrsg home{{{SINGLE-QUOTE}}}) "
|
||||
|| " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || SQL(clientguid) || ") "
|
||||
|| " where cd.clientguid = " || SQL(clientguid) || " and cd.clientvisitguid = " || SQL(clientvisitguid)
|
||||
|| " and fsl.value like {{{SINGLE-QUOTE}}}yes%{{{SINGLE-QUOTE}}} "
|
||||
|| " and cd.documentname in ({{{SINGLE-QUOTE}}}ED Triage Note{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}adult patient profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}OB Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pediatric Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Newborn Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Test{{{SINGLE-QUOTE}}}) " };
|
||||
|
||||
if exist NursingHome then NursingHomeResidency := "Yes"; else NursingHomeResidency := "No"; endif;
|
||||
|
||||
|
||||
// Attain anti-infective charting within past 7 days
|
||||
|
||||
|
||||
(AntiInfectivedate) := read last
|
||||
{"select oto.performedfromdtm "
|
||||
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid and o.ClientGUID = " || SQL(clientguid) || " "
|
||||
|| " join cv3ordertask as ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid "
|
||||
|| " join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid "
|
||||
|| " and oto.ordertaskguid = ot.guid and oto.taskstatuscode ={{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
|
||||
|| " where ocmi.therapeuticcategory like {{{SINGLE-QUOTE}}}anti-infectives%{{{SINGLE-QUOTE}}} "
|
||||
|| " order by oto.performedfromdtm " };
|
||||
|
||||
if (AntiInfectivedate as time) is within the past 7 days then AntiInfectivewithin7 := "Yes"; else AntiInfectivewithin7 := "No"; endif;
|
||||
|
||||
|
||||
|
||||
// Value the MRSA Order Rules Flags
|
||||
|
||||
if (SignificantDTM as time) is within the past 24 hours then orderedtoday := "Yes"; else orderedtoday := "No"; endif;
|
||||
if (SignificantDTM as time) is within the past 72 hours then orderedwithin3 := "Yes"; else orderedwithin3 := "No"; endif;
|
||||
if ResultValue = "METHICILLIN RESISTANT STAPHYLOCOCCUS AUREUS" then positivescreen := "Yes"; else positivescreen := "No"; endif;
|
||||
|
||||
|
||||
;;
|
||||
evoke: /* Call MLM */
|
||||
;;
|
||||
logic:
|
||||
|
||||
conclude true;
|
||||
;;
|
||||
action:
|
||||
|
||||
return (ScreeningUnit, OrderedToday, OrderedWithin3, Positivescreen, SignificantDTM, StatusCode, ResultValue, MRSAHistory, NursingHomeResidency, AntiInfectivewithin7) ;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
138
MLMStripper/bin/Debug/SCH/SCH_FUNC_OMP_DISCHARGE_MED_ORDER.mlm
Normal file
138
MLMStripper/bin/Debug/SCH/SCH_FUNC_OMP_DISCHARGE_MED_ORDER.mlm
Normal file
@@ -0,0 +1,138 @@
|
||||
maintenance:
|
||||
|
||||
title: ;;
|
||||
mlmname: SCH_Func_OMP_Discharge_Med_Order;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: ;;
|
||||
author: Don Warnick ;;
|
||||
specialist: ;;
|
||||
date: 2011-06-09;;
|
||||
validation: testing;;
|
||||
|
||||
|
||||
library:
|
||||
purpose: Generate a Discharge Medication order at the time discharge
|
||||
;;
|
||||
explanation: When a discharge occurs, an order is created for each therapeutic class of order found in in the patient{{{SINGLE-QUOTE}}}s
|
||||
OMP. The therapeutic class associated with the order is found in the class type field of the UDDI.
|
||||
Only UDDI{{{SINGLE-QUOTE}}}s with the name beginning with the letters "Dicharge Medications - "
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
06.09.2011 DW Created
|
||||
07.24.2013 DW HD #159442 Filtered out all but the discharge omp meds and changed from a discharge to a standard session
|
||||
|
||||
|
||||
;;
|
||||
keywords: OMP Discharge Orders, Meaningful Use
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
error_occurred := false;
|
||||
|
||||
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid, UserGUID, SpecialInstructions, ThisOrder_Name) := ARGUMENT;
|
||||
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
alert_dest := destination { Alert: warning, "Discharge Medication Order", high, chart, "Discharge Medication Order", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
|
||||
GeneralOrder_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Order Object",
|
||||
rule_number := 2010 ];
|
||||
|
||||
|
||||
orderItemName := ThisOrder_Name;
|
||||
|
||||
IF exists orderItemName THEN
|
||||
|
||||
try
|
||||
|
||||
SessionType := "Standard";
|
||||
SessionReason := "";
|
||||
RequestingSource := "";
|
||||
user_IDType := "Edstan Number (physician)";
|
||||
order_Creation_Reason := "From Test MLM";
|
||||
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
user_IDCode := read last {"SELECT IDCode FROM CV3User with (nolock) " || " where GUID = " || UserGUID};
|
||||
RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
|
||||
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit with (nolock) where ClientGUID = " || ClientGUID};
|
||||
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with orderItemName;
|
||||
|
||||
|
||||
GeneralOrder_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
general_catalog_item, // CatalogMasterItem ObjectsPlus object
|
||||
order_Creation_Reason, // CreateReason
|
||||
RequestingCareProvider_obj, // RequestingProvider ObjectsPlus object
|
||||
RequestingSource, // string requestingSource (must be in dictionary)
|
||||
SessionType, // string SessionType
|
||||
SessionReason, // string SessionReason
|
||||
location_obj, // Location ReleaseLocGrpID
|
||||
"Never" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
|
||||
// Set standard fields on the order entry form
|
||||
GeneralOrder_obj.RequestedDate := "T";
|
||||
GeneralOrder_obj.SpecialInstructions := SpecialInstructions;
|
||||
GeneralOrder_dest.ObjectsPlus := GeneralOrder_obj;
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
debugFlag := TRUE;
|
||||
messageText := messageText || "New general order:\n" ||
|
||||
ex.Message || "\n\n";
|
||||
|
||||
if ( general_catalog_item is NOT NULL ) then void:= call general_catalog_item.Dispose; general_catalog_item:= null; endif;
|
||||
if ( GeneralOrder_obj is NOT NULL ) then void:= call GeneralOrder_obj.Dispose; GeneralOrder_obj:= null; endif;
|
||||
GeneralOrder_dest := null;
|
||||
endcatch;
|
||||
|
||||
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
|
||||
if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj:= null; endif;
|
||||
|
||||
|
||||
ENDIF; // end of orderItemName
|
||||
|
||||
|
||||
;;
|
||||
evoke:
|
||||
|
||||
;;
|
||||
logic:
|
||||
Conclude true ;
|
||||
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
|
||||
if error_occurred then
|
||||
write "An error has occured in the MLM {{+B}}SCH_Func_OMP_Discharge_Med_Order{{-B}} " ||
|
||||
"Please notify your System Administrators that an error message has occurred " ||
|
||||
"message: \n" at alert_dest;
|
||||
write messageText at alert_dest;
|
||||
endif;
|
||||
|
||||
if EXISTS GeneralOrder_dest then write true at GeneralOrder_dest; endif;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
68
MLMStripper/bin/Debug/SCH/SCH_FUNC_PAGE.mlm
Normal file
68
MLMStripper/bin/Debug/SCH/SCH_FUNC_PAGE.mlm
Normal file
@@ -0,0 +1,68 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_FUNC_PAGE;;
|
||||
mlmname: SCH_FUNC_PAGE;;
|
||||
arden: version 2;;
|
||||
version: 4.00;;
|
||||
institution: St Clair Memorial Hospital;;
|
||||
author: Don Warnick;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2014-12-01;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: This MLM calls an Objects+ DLL (SCMPage.DLL)which processes SCM paging requests
|
||||
;;
|
||||
explanation:
|
||||
|
||||
Change history
|
||||
|
||||
12.01.2014 DW CSR# 32793 - Foreign Travel Alert (created this new generic alert to be used for future SCM text messaging processess)
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
log_execution_info:=FALSE;
|
||||
if (Called_By_Editor = true) then triggerme := false; else triggerme := true; endif;
|
||||
|
||||
(PhoneNumber, MessageSubject, MessageBody) := ARGUMENT;
|
||||
|
||||
PhoneNumber := "" || PhoneNumber;
|
||||
MessageSubject:= "" || MessageSubject;
|
||||
MessageBody := "" || MessageBody;
|
||||
|
||||
using "SCMPage"; /* DLL Name */
|
||||
using namespace "ResultsQuickViewerx"; /* Do not understand purpose...DLL funcional even if this is misspelled */
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
/* Namespace.Form */
|
||||
test:= new net_object {{{SINGLE-QUOTE}}}SCMPageFromMLM.SCMPageForm{{{SINGLE-QUOTE}}} with (PhoneNumber , MessageSubject , MessageBody);
|
||||
|
||||
;;
|
||||
evoke: /* Call MLM */
|
||||
;;
|
||||
logic:
|
||||
|
||||
if (triggerme = true)
|
||||
then
|
||||
oeUnsigned:=CALL test.ShowDialog;
|
||||
// oeUnsigned:=CALL test.Show;
|
||||
conclude true;
|
||||
else
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
action: //all of the action is done by the call to the FFI
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
70
MLMStripper/bin/Debug/SCH/SCH_FUNC_PRINT.mlm
Normal file
70
MLMStripper/bin/Debug/SCH/SCH_FUNC_PRINT.mlm
Normal file
@@ -0,0 +1,70 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_FUNC_PRINT;;
|
||||
mlmname: SCH_FUNC_PRINT;;
|
||||
arden: version 2;;
|
||||
version: 4.00;;
|
||||
institution: St Clair Memorial Hospital;;
|
||||
author: Don Warnick;;
|
||||
specialist: ;;
|
||||
date: 2012-10-25;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: This MLM calls an Objects+ DLL (SCMPRINT.DLL)which processes SCM report requests
|
||||
;;
|
||||
explanation:
|
||||
|
||||
Change history
|
||||
|
||||
10.25.2012 DW Created
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
log_execution_info:=FALSE;
|
||||
if (Called_By_Editor = true) then triggerme := false; else triggerme := true; endif;
|
||||
|
||||
(reportname, logicalprinter, physicalprinter) := ARGUMENT;
|
||||
|
||||
reportname := "" || reportname;
|
||||
logicalprinter := "" || logicalprinter;
|
||||
physicalprinter:= "" || physicalprinter;
|
||||
|
||||
if physicalprinter <> "" then physicalprinter:= "\\sc1drp1\" || physicalprinter; endif;
|
||||
|
||||
using "SCMPrint"; /* DLL Name */
|
||||
using namespace "ResultsQuickViewerx"; /* Do not understand purpose...DLL funcional even if this is misspelled */
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
/* Namespace.Form */
|
||||
test:= new net_object {{{SINGLE-QUOTE}}}SCMPrintFromMLM.SCMPrintForm{{{SINGLE-QUOTE}}} with (reportname , logicalprinter , physicalprinter);
|
||||
|
||||
;;
|
||||
evoke: /* Call MLM */
|
||||
;;
|
||||
logic:
|
||||
|
||||
if (triggerme = true)
|
||||
then
|
||||
oeUnsigned:=CALL test.ShowDialog;
|
||||
// oeUnsigned:=CALL test.Show;
|
||||
conclude true;
|
||||
else
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
action: //all of the action is done by the call to the FFI
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
122
MLMStripper/bin/Debug/SCH/SCH_HALOPERIDOL_HELD_ORDERS.mlm
Normal file
122
MLMStripper/bin/Debug/SCH/SCH_HALOPERIDOL_HELD_ORDERS.mlm
Normal file
@@ -0,0 +1,122 @@
|
||||
maintenance:
|
||||
|
||||
title: Check for Release of Haloperidol IV orders;;
|
||||
filename: SCH_Haloperidol_Held_Orders;;
|
||||
arden: version 5.5;;
|
||||
version: 2.00;;
|
||||
institution: St Clair;;
|
||||
author: Teresa Spicuzza;;
|
||||
specialist: Teresa Spicuzza;;
|
||||
date: 2012-06-05;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: When releasing a held order for haloperidol IV, check to see if patient in monitored bed/unit, if not alert the user
|
||||
;;
|
||||
explanation: Returns a message box to the user when a held order for haloperidol iv is released for a patient in a non-moitored bed.
|
||||
|
||||
change history
|
||||
|
||||
06.05.2012 TMS Created CSR 30783 To Production on 9/25/2012
|
||||
|
||||
;;
|
||||
keywords: Release, hold, order, Haloperidol, monitored bed
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
/*******************Make Changes To Spelling And Flags In This Section*******************/
|
||||
/* Set to true if logging is needed.*/
|
||||
log_execution_info:= false;
|
||||
|
||||
// Set the text for this variable to indicate whether to send the message or not.
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
|
||||
|
||||
MonitoredBed := ("03 CCU","06 SP/Monitored","02 ICU","14 CVSU", "04 IMC");
|
||||
|
||||
(ClientVisitGuid, ClientGuid, CurrentLocation, LocationGuid, VisitStatus) := read last
|
||||
{ClientVisit: GUID, ClientGUID, CurrentLocation, CurrentLocationGUID, VisitStatus };
|
||||
|
||||
|
||||
|
||||
// Get patient current accomodation
|
||||
CurrentAccom := read last
|
||||
{"Select ac.Code "
|
||||
||" From CV3ClientVisitLocation cvl"
|
||||
||" Join SXAAMAccommodation ac on ac.AccommodationID = cvl.AccommodationID "
|
||||
||" Where ClientGuid = " || SQL(ClientGuid)
|
||||
||" and ClientVisitGuid = " || SQL(ClientVisitGuid)
|
||||
||" and cvl.Status = {{{SINGLE-QUOTE}}}CUR{{{SINGLE-QUOTE}}}" };
|
||||
|
||||
|
||||
|
||||
/* Set EvokingObject in editor */
|
||||
If called_by_editor then
|
||||
EvokingObject := read last { Order: This };
|
||||
endif;
|
||||
|
||||
/* Get Order data and pointer to MedicationExtension object */
|
||||
(Order_Name, HaldolReason, MedicationExtension_obj) := read last
|
||||
{Order: Name, SummaryLine, MedicationExtension
|
||||
REFERENCING EvokingObject };
|
||||
|
||||
/* Get data from the MedicationExtension object */
|
||||
(HaldolRoute) := read last
|
||||
{MedicationExtension: OrderRouteCode
|
||||
REFERENCING MedicationExtension_obj };
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// local_session := cds_session.local;
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
|
||||
drug_alert:= destination {Alert} with
|
||||
[alert_type := "Warning",
|
||||
short_message := "Drug Requiring Monitoring",
|
||||
Priority := "HIGH",
|
||||
Scope := "chart",
|
||||
Rule_group := "Monitored Meds",
|
||||
rule_number := 18005,
|
||||
send_with_order := send_alert,
|
||||
display_alert := TRUE,
|
||||
alert_dialog_settings := "No Override Allowed" ];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Release_Haldol_trigger:= event {OrderRelease User Order:
|
||||
where TypeCode = "Medication"
|
||||
and Name = "Haloperidol Inj" or Name = "Haloperidol:"};
|
||||
|
||||
|
||||
;;
|
||||
evoke: Release_Haldol_trigger;
|
||||
;;
|
||||
logic:
|
||||
|
||||
If CurrentAccom in MonitoredBed or HaldolReason matches pattern "%End of Life%" or HaldolRoute = "IM" then
|
||||
conclude false; else conclude true;
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
|
||||
write "You are releasing a held order for Haloperidol (Haldol) by IV Push or IVPB. Only orders for {{{SINGLE-QUOTE}}}End of Life{{{SINGLE-QUOTE}}} care may administered in a non-monitored bed. \n\n {{+B}}Go Back:{{-B}} Select Go Back and Verify patient has correct accommodation code or Indication for order is {{{SINGLE-QUOTE}}}End of Life Agitation{{{SINGLE-QUOTE}}} or Clarify order with Physician. " at drug_alert;
|
||||
|
||||
;;
|
||||
end:
|
||||
157
MLMStripper/bin/Debug/SCH/SCH_HALOPERIDOL_ORDER_ALERT.mlm
Normal file
157
MLMStripper/bin/Debug/SCH/SCH_HALOPERIDOL_ORDER_ALERT.mlm
Normal file
@@ -0,0 +1,157 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_HALOPERIDOL_ORDER_ALERT;;
|
||||
mlmname: SCH_HALOPERIDOL_ORDER_ALERT;;
|
||||
arden: version 2.50;;
|
||||
version: 15.1;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Bryan Berkeybile, Allscripts Corp;;
|
||||
specialist: Bryan Berkeybile;;
|
||||
date: 2016-04-28;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
;;
|
||||
explanation: Fire an alert to nurses and unit secretaries (in addition to prescribers
|
||||
and pharmacists) when haloperidol is ordered for a patient with a health issue/diagnosis of
|
||||
Parkinson{{{SINGLE-QUOTE}}}s Disease.
|
||||
|
||||
Change History
|
||||
|
||||
08.02.2016 BB CSR#34186 Created CSR# 34186
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
//Logging level of execution information
|
||||
log_execution_info:=FALSE;
|
||||
|
||||
// Set the text for this variable to indicate whether to send the message or not.
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
//BB
|
||||
|
||||
soft_message := false;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Set stop
|
||||
sync_alert_dialog := "Must Comment";
|
||||
hard_stop := false;
|
||||
found_unsubmitted_orders := false;
|
||||
existing_orders := ();
|
||||
alert_priority := "HIGH";
|
||||
include_generic_msg := true;
|
||||
include_trans_msg := false;
|
||||
|
||||
//Destination Object Properties
|
||||
alert_dialog := "Must Acknowledge";
|
||||
alert_message := "";
|
||||
alert_override_msg := "";
|
||||
ok_to_show_aoa := false;
|
||||
|
||||
//BB
|
||||
|
||||
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid) := read last {ClientVisit: GUID, ChartGUID, ClientGUID};
|
||||
(UserGUID ) := read last { UserInfo: GUID };
|
||||
|
||||
|
||||
|
||||
|
||||
HealthIssue := read last
|
||||
{"SELECT cv.ClientGuid " //,cv.IDCode,cv.VisitIDCode "
|
||||
// || " ,chi.Code,hid.ShortName,chi.TypeCode ,hid.TypeCode "
|
||||
|| " FROM CV3ClientVisit cv "
|
||||
|| " JOIN CV3HealthIssueDeclaration hid ON hid.ClientVisitGUID = cv.GUID "
|
||||
|| " left JOIN CV3CodedHealthIssue chi ON hid.CodedHealthIssueGUID = chi.GUID "
|
||||
|| " WHERE hid.ShortName like {{{SINGLE-QUOTE}}}%park%{{{SINGLE-QUOTE}}} AND hid.active=1 "
|
||||
|| " AND cv.clientGuid = " || SQL(ClientGuid)
|
||||
};
|
||||
|
||||
|
||||
//endif;
|
||||
|
||||
If healthissue is null then
|
||||
continue := "no";
|
||||
else
|
||||
continue := "yes";
|
||||
endif;
|
||||
|
||||
if continue = "yes" then
|
||||
|
||||
|
||||
|
||||
// Use String parse
|
||||
// str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; ???? BB
|
||||
|
||||
//The evoking event for this MLM is OrderInit
|
||||
evoking_event_order:=EVENT {OrderInit User Order:
|
||||
Where Name Matches Pattern "Haloperidol%" };
|
||||
|
||||
// BB Added 5/2/16 : Used for testing
|
||||
Haloperidol_Order_Event := event{ OrderInit User Order :
|
||||
WHERE Name = "Haloperidol 1mg Tab"};
|
||||
|
||||
|
||||
// BB Added 5/2/16
|
||||
order_alert_dest := destination {alert} with
|
||||
[alert_type := warning,
|
||||
short_message := "Haloperidol Order Conflict",
|
||||
priority := alert_priority,
|
||||
scope := Chart,
|
||||
rule_group := "Haloperidol Order Group",
|
||||
rule_number := 9010,
|
||||
send_with_order := send_alert,
|
||||
// alert_dialog_settings := alert_dialog,
|
||||
alert_dialog_settings := sync_alert_dialog,
|
||||
display_alert := true];
|
||||
|
||||
|
||||
|
||||
//if ((EvokingEvent = Haloperidol_Order_event)) then
|
||||
// existing
|
||||
if ((EvokingEvent = Haloperidol_Order_event)) then
|
||||
soft_message := true;
|
||||
order_name := orderItem;
|
||||
//alert_dialog := "No Override Allowed";
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
order_alert_dest.Priority := alert_priority;
|
||||
order_alert_dest.Alert_Dialog_Settings := sync_alert_dialog; //was: alert_dialog;
|
||||
|
||||
|
||||
//if (stop_message) then
|
||||
order_alert_message := "Haloperidol is CONTRAINDICATED in Parkinsons Disease since it may cause a worsening of the patient’s Parkinsons symptoms. Recommend Quetiapine 25mg PO, NOW and QHS";
|
||||
|
||||
|
||||
Endif;
|
||||
;;
|
||||
evoke: evoking_event_order // or Haloperidol_Order_Event
|
||||
|
||||
|
||||
;;
|
||||
logic:
|
||||
if continue = "no"
|
||||
then
|
||||
conclude false;
|
||||
else conclude true ;
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
action:
|
||||
Write order_alert_message at order_alert_dest;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
177
MLMStripper/bin/Debug/SCH/SCH_HEPARIN_MAINT_NO_INITIAL.mlm
Normal file
177
MLMStripper/bin/Debug/SCH/SCH_HEPARIN_MAINT_NO_INITIAL.mlm
Normal file
@@ -0,0 +1,177 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_HEPARIN_MAINT_NO_INITIAL;;
|
||||
mlmname: SCH_HEPARIN_MAINT_NO_INITIAL;;
|
||||
arden: version 2;;
|
||||
version: 4.50;;
|
||||
institution: St Clair Memorial Hospital;;
|
||||
author: Robert Spence;;
|
||||
specialist: Teresa Spicuzza Ext 7448 ;;
|
||||
date: 2009-06-01;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
;;
|
||||
explanation: Stop any heparin maintenance order without an initial
|
||||
First uses order set check, then by the orderable if like ordersets not found
|
||||
If list order set and orderables not found, alert will fire
|
||||
|
||||
Change history
|
||||
|
||||
07.13.2009 RS Added secondary list, must be same size and order as primary
|
||||
If orderset is not found this secondary list is used.
|
||||
Different ordersets if you started in the ED then went to the floor.
|
||||
09.24.2015 TMS Added new Low Intensity Heparin Protocol (Initial and Maintenance) to the logic. CSR 33670
|
||||
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
//Logging level of execution information
|
||||
log_execution_info:=FALSE;
|
||||
|
||||
|
||||
|
||||
//The evoking event for this MLM is OrderInit
|
||||
evoking_event_order:=EVENT{OrderSetInit User Order:
|
||||
where OrderSetName is in ("Weight Based Heparin Protocol (Maint.)",
|
||||
"Cardiac/CCM Heparin Protocol (Maint)",
|
||||
"Post Op Vascular Heparin (Maintenance)",
|
||||
"Low Intensity Heparin Protocol (Maint)" )};
|
||||
|
||||
order_alert:= destination { Alert: Warning, "Heparin Maintenace No Intial", high, chart,
|
||||
"Heparin Maintenace No Intial", 9005};
|
||||
|
||||
|
||||
|
||||
(order_set_name,
|
||||
client_guid,
|
||||
chart_guid,
|
||||
clientvisit_guid ) := read last
|
||||
{OrderSet: OrderSetName, ClientGUID, ChartGUID, ClientVisitGUID
|
||||
REFERENCING EvokingObject};
|
||||
|
||||
//Retrieves additional information from the first order
|
||||
|
||||
|
||||
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
||||
|
||||
should_fire := false;
|
||||
MessageText:= "You have selected the {{+B}}" || order_set_name ||
|
||||
"{{-B}} Order Set which is to be used to adjust and maintain heparin therapy." ||
|
||||
"\n\nPlease choose the ";
|
||||
|
||||
|
||||
initial_of_maint_list :=
|
||||
(
|
||||
"Weight Based Heparin Protocol (Maint.)|Weight Based Heparin Protocol (Initial)"
|
||||
,"Cardiac/CCM Heparin Protocol (Maint)|Cardiac/CCM Heparin Protocol (Initial)"
|
||||
,"Post Op Vascular Heparin (Maintenance)|Post Op Vascular Heparin (Initial)"
|
||||
,"Low Intensity Heparin Protocol (Maint)|Low Intensity Heparin Protocol (Init)"
|
||||
);
|
||||
|
||||
|
||||
secondary_List :=
|
||||
(
|
||||
"Weight Based Heparin Protocol (Maint.)|({{{SINGLE-QUOTE}}}Heparin 25,000 Units + D5W 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units + 0.9% NaCl 500ml{{{SINGLE-QUOTE}}})"
|
||||
,"Cardiac/CCM Heparin Protocol (Maint)|({{{SINGLE-QUOTE}}}Heparin 25,000 Units+ D5W 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units+ 0.9% NaCl 500ml{{{SINGLE-QUOTE}}})"
|
||||
,"Post Op Vascular Heparin (Maintenance)|({{{SINGLE-QUOTE}}}Heparin 25,000 Units + D5W 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units + 0.9% NaCl 500ml{{{SINGLE-QUOTE}}})"
|
||||
,"Low Intensity Heparin Protocol (Maint)|({{{SINGLE-QUOTE}}}Heparin 25,000 Units + D5W 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units + 0.9% NaCl 500ml{{{SINGLE-QUOTE}}})"
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
found_set :=false;
|
||||
breakloop := false;
|
||||
counter := count initial_of_maint_list;
|
||||
|
||||
i := 0;
|
||||
|
||||
while (breakloop= false) do
|
||||
i:=i+1;
|
||||
|
||||
|
||||
if i = counter then
|
||||
breakloop := true;
|
||||
endif;
|
||||
|
||||
singleelement:= call str_parse with initial_of_maint_list[i], "|"; //makes string i in list into its own list
|
||||
sing_orderset:= singleelement[1];
|
||||
|
||||
singorderelement := call str_parse with secondary_list[i],"|";
|
||||
|
||||
|
||||
if (sing_orderset = order_set_name) then
|
||||
/// see if there was an initial order on this account
|
||||
match_ordeset := singleelement[2];
|
||||
|
||||
match_orderable :=singorderelement[2];
|
||||
|
||||
stringmatch := call str_parse with match_ordeset, "(";
|
||||
|
||||
MessageText:= MessageText || "{{+B}}" || stringmatch[1] || "{{+R}}(" || stringmatch[2] ||
|
||||
"{{-B}}{{-R}} Order Set to begin therapy.";
|
||||
|
||||
initial_count := 0;
|
||||
initial_count := read last {" select count(*) "
|
||||
|| " from cv3orderset as os with (nolock) "
|
||||
|| " where os.clientguid = " || SQL(client_guid)
|
||||
|| " and os.chartguid = " || SQL(chart_guid)
|
||||
|| " and os.clientvisitguid = " || SQL(clientvisit_guid)
|
||||
|| " and os.ordersetname = " || SQL(match_ordeset)
|
||||
} ;
|
||||
|
||||
tsql:= "select count(*) "
|
||||
|| " from cv3orderset as os with (nolock) "
|
||||
|| " where os.clientguid = " || SQL(client_guid)
|
||||
|| " and os.chartguid = " || SQL(chart_guid)
|
||||
|| " and os.clientvisitguid = " || SQL(clientvisit_guid)
|
||||
|| " and os.ordersetname = " || SQL(match_ordeset);
|
||||
breakloop := true;
|
||||
if (initial_count > 0) then
|
||||
found_set := true;
|
||||
endif;
|
||||
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
secondarycheck := false;
|
||||
|
||||
if (found_set = false) and (exists match_orderable) and (order_set_name <> "Post Op Vascular Heparin (Maintenance)") then
|
||||
// do secondary check
|
||||
orderable_count := read last {" select count(*) "
|
||||
|| " from cv3order as o with (nolock) "
|
||||
|| " where o.clientguid = " || SQL(client_guid)
|
||||
|| " and o.chartguid = " || SQL(chart_guid)
|
||||
|| " and o.clientvisitguid = " || SQL(clientvisit_guid)
|
||||
|| " and o.name in " || match_orderable
|
||||
|| " and o.summaryline like {{{SINGLE-QUOTE}}}%initial%{{{SINGLE-QUOTE}}} "
|
||||
} ;
|
||||
if (orderable_count >0) then
|
||||
secondarycheck := true;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if (found_set = false) and (secondarycheck = false) then
|
||||
should_fire := true;
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
evoke: evoking_event_order
|
||||
;;
|
||||
logic:
|
||||
|
||||
conclude should_fire ;
|
||||
;;
|
||||
action:
|
||||
Write MessageText at order_alert
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
@@ -0,0 +1,68 @@
|
||||
maintenance:
|
||||
|
||||
title: Check If Heparin Ordered Without OrderSet;;
|
||||
mlmname: SCH_HEPARIN_ORDERED_NON_ORDERSET;;
|
||||
arden: version 2;;
|
||||
version: 4.50;;
|
||||
institution: SCH ;;
|
||||
author: Robert Spence Ext 7461;;
|
||||
specialist: Teresa Spicuzza Ext 7448 ;;
|
||||
date: 2009-05-12;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Stop users from using reorder of this order. Should be ordered from the orderset.
|
||||
;;
|
||||
explanation: Stop users from using reorder of this order. Should be ordered from the orderset.
|
||||
;;
|
||||
keywords: Heparin, reorder, Order set only
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
// Set the text for this variable to indicate whether to send the message or not.
|
||||
send_alert := "DoNotSend";
|
||||
|
||||
order_evoke1:= EVENT {OrderInit User Order:
|
||||
WHERE TypeCode = "Medication"
|
||||
And Name Matches Pattern "Heparin 25,000%"};
|
||||
|
||||
order_evoke2:= EVENT {OrderEnter User Order:
|
||||
WHERE TypeCode = "Medication"
|
||||
And Name Matches Pattern "Heparin 25,000%"};
|
||||
|
||||
|
||||
|
||||
heparin_alert:= destination { Alert: warning, "Heparin Reordered", high, chart,
|
||||
"Heparin Reordered", 14005, send_alert, "No Override Allowed" };
|
||||
|
||||
|
||||
Hard_Stop := false;
|
||||
|
||||
(orderset_guid, order_name) := read last
|
||||
{ Order: OrderSetGUID, name
|
||||
REFERENCING EvokingObject };
|
||||
|
||||
if exists(orderset_guid)
|
||||
then
|
||||
Hard_Stop := false;
|
||||
else
|
||||
Hard_Stop := true;
|
||||
endif;
|
||||
;;
|
||||
evoke: order_evoke1 or order_evoke2;
|
||||
;;
|
||||
logic:
|
||||
conclude Hard_Stop ;
|
||||
;;
|
||||
action:
|
||||
|
||||
write "You have selected the {{+B}}{{+R}}Reorder{{-B}}{{-R}} function for the {{+B}}{{+R}}" || order_name ||
|
||||
"{{-B}}{{-R}} order. " ||
|
||||
" \n\nDosing maintenance and rate adjustment calculations can only be made " ||
|
||||
"within the appropriate Heparin Maintenance order set as a {{+B}}{{+R}}new {{-B}}{{-R}}order." at heparin_alert;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
383
MLMStripper/bin/Debug/SCH/SCH_HEPATITIS_C_SCREEN_ALERT.mlm
Normal file
383
MLMStripper/bin/Debug/SCH/SCH_HEPATITIS_C_SCREEN_ALERT.mlm
Normal file
@@ -0,0 +1,383 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Hepatitis_C_Screen_Alert;;
|
||||
mlmname: SCH_Hepatitis_C_Screen_Alert;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;; // FP1
|
||||
institution: SCH ;;
|
||||
author: SHAMI SHARMA ;;
|
||||
specialist: ;;
|
||||
date: 2017-12-27;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
;;
|
||||
explanation:
|
||||
;;
|
||||
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}}};
|
||||
include standard_libs;
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
Observation_Name_list := "SCH_Hep C _Hep Education","SCH_Hep C _Hep Verbalize understanding","SCH_Hep C_Have you had prior screening","SCH_Hep C_Patient born between 1945-1965","SCH_Hep C _Testing NEW";
|
||||
log_execution_info := false;
|
||||
|
||||
hepC_alert_dest := destination {alert} with
|
||||
[alert_type := "Warning",
|
||||
short_message := " Hepatitis C Screening/Education Alert",
|
||||
priority := "Low",
|
||||
scope := "Chart",
|
||||
rule_group := "Hepatitis C Screening",
|
||||
rule_number := 4065,
|
||||
send_with_order := send_alert,
|
||||
alert_dialog_settings := "",
|
||||
display_alert := true];
|
||||
|
||||
|
||||
Document_Enter := event {ClientDocumentEnter User ClientDocument: where documentname in
|
||||
("Adult Patient Profile", "Adult Patient Profile - Observation", "Adult Patient Profile - Behavioral Health","2. Adult Assessment/Intervention")};
|
||||
Document_Modify := event {ClientDocumentModify User ClientDocument: where documentname in
|
||||
("Adult Patient Profile", "Adult Patient Profile - Observation", "Adult Patient Profile - Behavioral Health","2. Adult Assessment/Intervention")};
|
||||
|
||||
|
||||
(ClientDocument_GUID, ClientVisit_GUID, client_guid, Chart_GUID ,USER_GUID) := Read Last { ClientDocument: GUID, ClientVisitGUID, ClientGUID , ChartGUID, USERGUID REFERENCING EvokingObject };
|
||||
(Client_Observation_Document_Obj, GUID,Document_Name):= read last { ClientDocument: ClientObservationDocument, GUID,DocumentName REFERENCING EvokingObject };
|
||||
|
||||
(Client_Observation_Obj_List) := read last{ ClientObservationDocument: ClientObservation REFERENCING Client_Observation_Document_Obj};
|
||||
|
||||
(case_participants_list ) := Client_Observation_Document_Obj.records__;
|
||||
|
||||
|
||||
IF(EvokingEventType = "ClientDocumentEnter") THEN
|
||||
Obs1 := False;
|
||||
Obs2 := False;
|
||||
Obs3 := False;
|
||||
Obs4 := False;
|
||||
Obs5 := False;
|
||||
for i in 1 seqto count case_participants_list do
|
||||
|
||||
IF(case_participants_list.Name [i] = "SCH_Hep C _Hep Education") THEN
|
||||
Obs1 := true;
|
||||
ENDIF;
|
||||
IF(case_participants_list.Name [i] ="SCH_Hep C _Hep Verbalize understanding") THEN
|
||||
Obs2 := true;
|
||||
ENDIF;
|
||||
IF(case_participants_list.Name [i] = "SCH_Hep C_Have you had prior screening") THEN
|
||||
Obs3 := true;
|
||||
ENDIF;
|
||||
IF(case_participants_list.Name [i] = "SCH_Hep C_Patient born between 1945-1965") THEN
|
||||
Obs4 := true;
|
||||
ENDIF;
|
||||
IF(case_participants_list.Name [i] = "SCH_Hep C _Testing NEW") THEN
|
||||
Obs5 := true;
|
||||
ENDIF;
|
||||
|
||||
|
||||
|
||||
enddo;
|
||||
ComponentCatalogGuidList := "";
|
||||
ComponentCatalogGuid := "";
|
||||
IF Obs1= FALSE THEN
|
||||
IF ComponentCatalogGuidList = "" then
|
||||
ComponentCatalogGuidList := ". Education Given" ;
|
||||
ELSE
|
||||
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Education Given" ;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
IF Obs2= FALSE THEN
|
||||
IF ComponentCatalogGuidList = "" then
|
||||
ComponentCatalogGuidList := ". Patient/SO verbalized understanding" ;
|
||||
ELSE
|
||||
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient/SO verbalized understanding" ;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
IF Obs3= FALSE THEN
|
||||
IF ComponentCatalogGuidList = "" then
|
||||
ComponentCatalogGuidList := ". Have you had prior Hepatitis C Screening" ;
|
||||
ELSE
|
||||
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Have you had prior Hepatitis C Screening" ;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
IF Obs4= FALSE THEN
|
||||
IF ComponentCatalogGuidList = "" then
|
||||
ComponentCatalogGuidList := ". Patient born between 1945-1965" ;
|
||||
ELSE
|
||||
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient born between 1945-1965" ;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
IF Obs5= FALSE THEN
|
||||
IF ComponentCatalogGuidList = "" then
|
||||
ComponentCatalogGuidList := ". Patient agrees to testing?" ;
|
||||
ELSE
|
||||
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient agrees to testing?" ;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
|
||||
(BornValue,BornObs, BornName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C_Patient born between 1945-1965")};
|
||||
(PriorValue,PriorObs, PriorName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C_Have you had prior screening")};
|
||||
(EduValue,EduObs, EduName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C _Hep Education")};
|
||||
(VerbValue,VerbObs, VerbName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C _Hep Verbalize understanding")};
|
||||
(TestValue,TestObs, TestName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C _Testing NEW")};
|
||||
(OrderValue,OrderObs, OrderName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C Screening Order")};
|
||||
Born_Value := BornObs.Value;
|
||||
|
||||
Prior_Value := PriorObs.Value;
|
||||
|
||||
Edu_Value := EduObs.Value;
|
||||
|
||||
Verb_Value := VerbObs.Value;
|
||||
|
||||
Test_Value := TestObs.Value;
|
||||
|
||||
Order_Value := OrderObs.Value;
|
||||
|
||||
|
||||
ENDIF;
|
||||
|
||||
IF(EvokingEventType = "ClientDocumentModify") THEN
|
||||
|
||||
(Born_Value1) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
|
||||
Where Name = "SCH_Hep C_Patient born between 1945-1965" };
|
||||
Born_Value:=Born_Value1.Value;
|
||||
IF Born_Value IS null then
|
||||
Born_Value:= read last {"select top 1 OFLV.Value
|
||||
FROM CV3CLientVisit cv (NoLock)
|
||||
INNER JOIN CV3ClientDocument cd (nolock)
|
||||
ON CV.GUID = CD.CLientVIsitGUID
|
||||
AND CV.ChartGUID = CD.ChartGUID
|
||||
AND CV.ClientGUID = CD.ClientGUID
|
||||
AND cd.GUID = " || sql(ClientDocument_GUID) || "
|
||||
AND cv.clientguid = " || sql(client_guid) || "
|
||||
and cv.ChartGUID = " || sql(Chart_GUID ) || "
|
||||
and cv.GUID = " || sql(ClientVisit_GUID) || "
|
||||
ANd cd.Active = 1
|
||||
AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
|
||||
INNER JOIN CV3PatientCareDocument PCD (NoLock)
|
||||
ON CD.PatCareDocGUID = PCD.GUID
|
||||
AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}})
|
||||
INNER JOIN CV3ObservationDocument obd (nolock) ON
|
||||
cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
|
||||
AND obd.ArcType = cd.ArcType
|
||||
inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
|
||||
AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C_Patient born between 1945-1965{{{SINGLE-QUOTE}}}
|
||||
inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
|
||||
AND OFLV.ClientGUID = cv.CLientGUID
|
||||
AND OFLV.Active = 1
|
||||
order by OFLV.CreatedWhen desc"};
|
||||
endif;
|
||||
|
||||
(Prior_Value2) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
|
||||
Where Name = "SCH_Hep C_Have you had prior screening" };
|
||||
Prior_Value:=Prior_Value2.Value;
|
||||
IF Prior_Value IS null then
|
||||
Prior_Value:= read last {"select top 1 OFLV.Value
|
||||
FROM CV3CLientVisit cv (NoLock)
|
||||
INNER JOIN CV3ClientDocument cd (nolock)
|
||||
ON CV.GUID = CD.CLientVIsitGUID
|
||||
AND CV.ChartGUID = CD.ChartGUID
|
||||
AND CV.ClientGUID = CD.ClientGUID
|
||||
AND cd.GUID = " || sql(ClientDocument_GUID) || "
|
||||
AND cv.clientguid = " || sql(client_guid) || "
|
||||
and cv.ChartGUID = " || sql(Chart_GUID ) || "
|
||||
and cv.GUID = " || sql(ClientVisit_GUID) || "
|
||||
ANd cd.Active = 1
|
||||
AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
|
||||
INNER JOIN CV3PatientCareDocument PCD (NoLock)
|
||||
ON CD.PatCareDocGUID = PCD.GUID
|
||||
AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}})
|
||||
INNER JOIN CV3ObservationDocument obd (nolock) ON
|
||||
cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
|
||||
AND obd.ArcType = cd.ArcType
|
||||
inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
|
||||
AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C_Have you had prior screening{{{SINGLE-QUOTE}}}
|
||||
inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
|
||||
AND OFLV.ClientGUID = cv.CLientGUID
|
||||
AND OFLV.Active = 1
|
||||
order by OFLV.CreatedWhen desc"};
|
||||
endif;
|
||||
(Edu_Value2) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
|
||||
Where Name = "SCH_Hep C _Hep Education" };
|
||||
Edu_Value:=Edu_Value2.Value;
|
||||
IF Edu_Value IS null then
|
||||
Edu_Value:= read last {"select top 1 OFLV.Value
|
||||
FROM CV3CLientVisit cv (NoLock)
|
||||
INNER JOIN CV3ClientDocument cd (nolock)
|
||||
ON CV.GUID = CD.CLientVIsitGUID
|
||||
AND CV.ChartGUID = CD.ChartGUID
|
||||
AND CV.ClientGUID = CD.ClientGUID
|
||||
AND cd.GUID = " || sql(ClientDocument_GUID) || "
|
||||
AND cv.clientguid = " || sql(client_guid) || "
|
||||
and cv.ChartGUID = " || sql(Chart_GUID ) || "
|
||||
and cv.GUID = " || sql(ClientVisit_GUID) || "
|
||||
ANd cd.Active = 1
|
||||
AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
|
||||
INNER JOIN CV3PatientCareDocument PCD (NoLock)
|
||||
ON CD.PatCareDocGUID = PCD.GUID
|
||||
AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}})
|
||||
INNER JOIN CV3ObservationDocument obd (nolock) ON
|
||||
cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
|
||||
AND obd.ArcType = cd.ArcType
|
||||
inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
|
||||
AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C _Hep Education{{{SINGLE-QUOTE}}}
|
||||
inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
|
||||
AND OFLV.ClientGUID = cv.CLientGUID
|
||||
AND OFLV.Active = 1
|
||||
order by OFLV.CreatedWhen desc"};
|
||||
endif;
|
||||
(Verb_Value2) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
|
||||
Where Name = "SCH_Hep C _Hep Verbalize understanding" };
|
||||
Verb_Value:=Verb_Value2.Value;
|
||||
IF Verb_Value IS null then
|
||||
Verb_Value:= read last {"select top 1 OFLV.Value
|
||||
FROM CV3CLientVisit cv (NoLock)
|
||||
INNER JOIN CV3ClientDocument cd (nolock)
|
||||
ON CV.GUID = CD.CLientVIsitGUID
|
||||
AND CV.ChartGUID = CD.ChartGUID
|
||||
AND CV.ClientGUID = CD.ClientGUID
|
||||
AND cd.GUID = " || sql(ClientDocument_GUID) || "
|
||||
AND cv.clientguid = " || sql(client_guid) || "
|
||||
and cv.ChartGUID = " || sql(Chart_GUID ) || "
|
||||
and cv.GUID = " || sql(ClientVisit_GUID) || "
|
||||
ANd cd.Active = 1
|
||||
AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
|
||||
INNER JOIN CV3PatientCareDocument PCD (NoLock)
|
||||
ON CD.PatCareDocGUID = PCD.GUID
|
||||
AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}})
|
||||
INNER JOIN CV3ObservationDocument obd (nolock) ON
|
||||
cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
|
||||
AND obd.ArcType = cd.ArcType
|
||||
inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
|
||||
AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C _Hep Verbalize understanding{{{SINGLE-QUOTE}}}
|
||||
inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
|
||||
AND OFLV.ClientGUID = cv.CLientGUID
|
||||
AND OFLV.Active = 1
|
||||
order by OFLV.CreatedWhen desc"};
|
||||
endif;
|
||||
(Test_Value2) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
|
||||
Where Name = "SCH_Hep C _Testing NEW" };
|
||||
Test_Value:=Test_Value2.Value;
|
||||
IF Test_Value IS null then
|
||||
Test_Value:= read last {"select top 1 OFLV.Value
|
||||
FROM CV3CLientVisit cv (NoLock)
|
||||
INNER JOIN CV3ClientDocument cd (nolock)
|
||||
ON CV.GUID = CD.CLientVIsitGUID
|
||||
AND CV.ChartGUID = CD.ChartGUID
|
||||
AND CV.ClientGUID = CD.ClientGUID
|
||||
AND cd.GUID = " || sql(ClientDocument_GUID) || "
|
||||
AND cv.clientguid = " || sql(client_guid) || "
|
||||
and cv.ChartGUID = " || sql(Chart_GUID ) || "
|
||||
and cv.GUID = " || sql(ClientVisit_GUID) || "
|
||||
ANd cd.Active = 1
|
||||
AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
|
||||
INNER JOIN CV3PatientCareDocument PCD (NoLock)
|
||||
ON CD.PatCareDocGUID = PCD.GUID
|
||||
AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}})
|
||||
INNER JOIN CV3ObservationDocument obd (nolock) ON
|
||||
cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
|
||||
AND obd.ArcType = cd.ArcType
|
||||
inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
|
||||
AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C _Testing NEW{{{SINGLE-QUOTE}}}
|
||||
inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
|
||||
AND OFLV.ClientGUID = cv.CLientGUID
|
||||
AND OFLV.Active = 1
|
||||
order by OFLV.CreatedWhen desc"};
|
||||
endif;
|
||||
ComponentCatalogGuidList := "";
|
||||
ComponentCatalogGuid := "";
|
||||
IF Edu_Value is NULL THEN
|
||||
IF ComponentCatalogGuidList = "" then
|
||||
ComponentCatalogGuidList := ". Education Given" ;
|
||||
ELSE
|
||||
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Education Given" ;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
IF Verb_Value is NULL THEN
|
||||
IF ComponentCatalogGuidList = "" then
|
||||
ComponentCatalogGuidList := ". Patient/SO verbalized understanding" ;
|
||||
ELSE
|
||||
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient/SO verbalized understanding" ;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
IF Prior_Value is NULL THEN
|
||||
IF ComponentCatalogGuidList = "" then
|
||||
ComponentCatalogGuidList := ". Have you had prior Hepatitis C Screening" ;
|
||||
ELSE
|
||||
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Have you had prior Hepatitis C Screening" ;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
IF Born_Value is NULL THEN
|
||||
IF ComponentCatalogGuidList = "" then
|
||||
ComponentCatalogGuidList := ". Patient born between 1945-1965" ;
|
||||
ELSE
|
||||
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient born between 1945-1965" ;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
IF Test_Value is NULL THEN
|
||||
IF ComponentCatalogGuidList = "" then
|
||||
ComponentCatalogGuidList := ". Patient agrees to testing?" ;
|
||||
ELSE
|
||||
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient agrees to testing?" ;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
|
||||
|
||||
ENDIF;
|
||||
|
||||
BornValue1 :="";
|
||||
PriorValue1:="";
|
||||
|
||||
for i in 1 seqto count Born_Value do
|
||||
BornValue1 := Born_Value [i];
|
||||
Enddo;
|
||||
for i in 1 seqto count Prior_Value do
|
||||
PriorValue1 := Prior_Value[i];
|
||||
Enddo;
|
||||
|
||||
|
||||
IF( BornValue1 ="Yes") THEN
|
||||
|
||||
IF( PriorValue1= "No/Unknown" OR PriorValue1= "No") THEN
|
||||
IF(NOT EXISTS Edu_Value OR NOT EXISTS Verb_Value OR NOT EXISTS Test_Value ) THEN
|
||||
alert_message := "Hepatitis C Screening/Education Reminder. \n"
|
||||
||"You have not completed the Hep C Risk Assessment: \n"
|
||||
||"The following questions need addressed. \n"
|
||||
|| ComponentCatalogGuidList ||"\n" ;
|
||||
//|| ComponentCatalogGuid ||"\n" ;
|
||||
|
||||
|
||||
Result:= TRUE;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
|
||||
ENDIF;
|
||||
|
||||
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: Document_Enter;
|
||||
Document_Modify;
|
||||
;;
|
||||
logic:
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
IF( Result = TRUE) THEN
|
||||
write alert_message at hepC_alert_dest;
|
||||
ENDIF;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
1015
MLMStripper/bin/Debug/SCH/SCH_HM_MARK_AS_DONE.mlm
Normal file
1015
MLMStripper/bin/Debug/SCH/SCH_HM_MARK_AS_DONE.mlm
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,235 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_INFECTIOUS_DISEASE_VISIT_COLUMN_UDPATE;;
|
||||
mlmname: SCH_INFECTIOUS_DISEASE_VISIT_COLUMN_UPDATE;;
|
||||
arden: version 2.50;;
|
||||
version: 6.10;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Juliet M. Law, Allscripts Corp, x7461;;
|
||||
specialist: Maria Pest, Allscripts Corp, x7443;;
|
||||
date: 2015-04-23;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Add value to Enterprise Defined Column on Infection Control Visit List when a document is entered on a patient.
|
||||
|
||||
;;
|
||||
|
||||
explanation: When a user with a specialty of "Infectious Disease" saves a Consult eNote or Physician Progress Note document, update the Infection
|
||||
Control Visit List "Infectious Disease" Enterprise Defined Column with the value "Patient Seen".
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
04.23.2015 JML CSR #32980 Created
|
||||
06.11.2015 JML WO #1765855: Infectious Disease column was erroneously displaying value due to other EDC updating;
|
||||
fixed to only display value when Infectious Disease document existed on patient{{{SINGLE-QUOTE}}}s chart
|
||||
for current day.
|
||||
11.26.2018 JML WO #3528490: Remove logic for document updates due to date / time conflict.
|
||||
02.12.2019 JML WO #3565687: Removed ClientGUID filter from query of CV3EnterpriseVisitData table due to instances
|
||||
where this value is not populated.
|
||||
;;
|
||||
keywords: ObjectsPlus/XA, Infectious, Enterprise Defined Column
|
||||
|
||||
;;
|
||||
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}}};
|
||||
include standard_libs;
|
||||
|
||||
//Include parsing MLM
|
||||
//str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
||||
|
||||
//Include generic function to update enterprise defined column
|
||||
create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
|
||||
|
||||
log_execution_info := false;
|
||||
update_column := false;
|
||||
infect_col_value := "";
|
||||
|
||||
//Create Enterprise Defined Column Obj
|
||||
EDCObj := OBJECT [
|
||||
column_name,
|
||||
column_value,
|
||||
client_guid,
|
||||
chart_guid,
|
||||
client_visit_guid
|
||||
];
|
||||
|
||||
//Event Triggers
|
||||
client_doc_enter := event {ClientDocumentEnter User ClientDocument :
|
||||
WHERE DocumentName = "Physician Progress Note"
|
||||
OR DocumentName = "Consult eNote"};
|
||||
client_doc_modify := event {ClientDocumentModify User ClientDocument :
|
||||
WHERE DocumentName = "Physician Progress Note"
|
||||
OR DocumentName = "Consult eNote"};
|
||||
|
||||
user_logon := event { ActivateApplication User UserInfo :
|
||||
WHERE CareProvider IS NOT NULL
|
||||
AND OrderRoleType matches pattern "%Physician%" };
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
if called_by_editor
|
||||
then
|
||||
EvokingObject := read last { UserInfo : THIS };
|
||||
endif;
|
||||
|
||||
|
||||
//Retrieve relevant GUIDs
|
||||
ActiveClient_Visit_GUID := EvokingObject.ClientVisitGUID;
|
||||
ActiveClient_GUID := EvokingObject.ClientGUID;
|
||||
ActiveChart_GUID := EvokingObject.ChartGUID;
|
||||
|
||||
care_prov_obj := read last { UserInfo : CareProvider };
|
||||
|
||||
user_discipline := care_prov_obj.Discipline;
|
||||
|
||||
if ( user_discipline = "Infectious Disease" OR user_discipline = "Infectious Diseases" ) then
|
||||
if ( EvokingEvent = user_logon ) then
|
||||
//Retrieve a list of patient{{{SINGLE-QUOTE}}}s that have the Infectious Disease column value
|
||||
(col_client_guid,
|
||||
col_visit_guid) := read {"Declare @colName varchar(50)"
|
||||
|| ""
|
||||
|| "SELECT @colName = DataColumnName"
|
||||
|| " FROM CV3EnterpriseColumnDef ecd WITH (NOLOCK) JOIN CV3EnterpriseColumnData ecd2 WITH (NOLOCK)"
|
||||
|| " ON ecd.GUID = ecd2.ColumnDefinitionGUID"
|
||||
|| " WHERE ColumnLabel = {{{SINGLE-QUOTE}}}Infectious Disease{{{SINGLE-QUOTE}}}"
|
||||
|| ""
|
||||
|| " EXEC ({{{SINGLE-QUOTE}}}SELECT cv.ClientGUID, evd.VisitGUID{{{SINGLE-QUOTE}}} + "
|
||||
|| " {{{SINGLE-QUOTE}}} FROM CV3EnterpriseVisitData evd WITH (NOLOCK) JOIN CV3CLIENTVISIT cv WITH (NOLOCK){{{SINGLE-QUOTE}}} +"
|
||||
|| " {{{SINGLE-QUOTE}}} ON evd.VisitGUID = cv.GUID{{{SINGLE-QUOTE}}} +"
|
||||
|| " {{{SINGLE-QUOTE}}} WHERE {{{SINGLE-QUOTE}}} + @colName + {{{SINGLE-QUOTE}}} = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}Patient Seen{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}"
|
||||
|| " AND VisitGUID is not null"
|
||||
|| " ORDER BY evd.touchedWhen{{{SINGLE-QUOTE}}})"};
|
||||
|
||||
if ( ( count col_client_guid ) > 0 ) then
|
||||
|
||||
update_column := true;
|
||||
infect_col_value := ();
|
||||
infect_client_guid := ();
|
||||
infect_visit_guid := ();
|
||||
|
||||
//Loop through patients that have Infectious Disease column value
|
||||
for i IN 1 seqto ( count col_client_guid ) do
|
||||
//Check for last time Infectious Disease column was valued
|
||||
doc_client_guid := col_client_guid[i];
|
||||
doc_visit_guid := col_visit_guid[i];
|
||||
|
||||
last_doc_update := read last {"SELECT cd.AuthoredDtm"
|
||||
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientDocumentCUR cd WITH (NOLOCK)"
|
||||
|| " ON cv.CLIENTGUID = cd.ClientGUID"
|
||||
|| " AND cv.GUID = cd.ClientVisitGUID"
|
||||
|| " AND cv.ChartGUID = cd.ChartGUID"
|
||||
|| " JOIN CV3ClientDocDetailCUR cdd WITH (NOLOCK)"
|
||||
|| " ON cd.GUID = cdd.ClientDocumentGUID"
|
||||
|| " AND cd.ClientGUID = cdd.ClientGUID"
|
||||
|| " WHERE cv.ClientGUID = " || Sql(doc_client_guid)
|
||||
|| " AND cv.GUID = " || Sql(doc_visit_guid)
|
||||
|| " AND ( cd.DocumentName IN ({{{SINGLE-QUOTE}}}Physician Progress Note-Infectious Diseases{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}Physician Progress Note-Infectious Disease{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}Consult eNote-Infectious Diseases{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}Consult eNote-Infectious Disease{{{SINGLE-QUOTE}}}))"
|
||||
|| " ORDER BY cd.AuthoredDtm ASC"};
|
||||
|
||||
//Format dates to strings for easier comparision cuz dates/time in Arden stink
|
||||
//last_str_date := extract month last_col_update[i] || "-" || extract day last_col_update[i] || "-" || extract year last_col_update[i];
|
||||
last_str_date := extract month last_doc_update || "-" || extract day last_doc_update || "-" || extract year last_doc_update;
|
||||
curr_str_date := extract month now || "-" || extract day now || "-" || extract year now;
|
||||
|
||||
//If Infectious Disease document was entered today, then keep column value
|
||||
//If Infectious Disease document was entered yesterday, then clear column value
|
||||
if ( ( last_str_date as string ) = ( curr_str_date as string ) ) then
|
||||
infect_col_value := (infect_col_value, "Patient Seen");
|
||||
infect_client_guid := ( infect_client_guid, doc_client_guid);
|
||||
infect_visit_guid := ( infect_visit_guid, doc_visit_guid);
|
||||
|
||||
elseif ( ( last_str_date as string ) <> ( curr_str_date as string ) ) then
|
||||
infect_col_value := (infect_col_value, "");
|
||||
infect_client_guid := ( infect_client_guid, doc_client_guid);
|
||||
infect_visit_guid := ( infect_visit_guid, doc_visit_guid);
|
||||
endif;
|
||||
|
||||
enddo;
|
||||
|
||||
else
|
||||
update_column := false;
|
||||
endif;
|
||||
else
|
||||
|
||||
//WO #3528490: Add logic to only display Patient Seen IF authored Dtm = current day
|
||||
if ( EvokingEvent = client_doc_modify ) then
|
||||
//Extract authored DateTime from document currently being modified
|
||||
curr_doc_authored := extract month EvokingObject.AuthoredDtm || "-" || extract day EvokingObject.AuthoredDtm || "-" || extract year EvokingObject.AuthoredDtm;
|
||||
curr_str_date := extract month now || "-" || extract day now || "-" || extract year now;
|
||||
|
||||
if ( ( last_str_date as string ) = ( curr_str_date as string ) ) then
|
||||
update_column := true;
|
||||
infect_col_value := "Patient Seen";
|
||||
elseif ( ( last_str_date as string ) <> ( curr_str_date as string ) ) then
|
||||
update_column := false;
|
||||
infect_col_value := "";
|
||||
endif;
|
||||
|
||||
else
|
||||
update_column := true;
|
||||
infect_col_value := "Patient Seen";
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
client_doc_enter;
|
||||
client_doc_modify;
|
||||
user_logon;
|
||||
;;
|
||||
logic:
|
||||
if ( EvokingObject is null ) then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
|
||||
if ( update_column = true AND ( EvokingEvent = client_doc_enter OR EvokingEvent = client_doc_modify ) ) then
|
||||
|
||||
Infect_Col := NEW EDCObj WITH [
|
||||
column_name := "Infectious Disease",
|
||||
column_value := infect_col_value,
|
||||
client_guid := ActiveClient_GUID,
|
||||
chart_guid := ActiveChart_GUID,
|
||||
client_visit_guid := ActiveClient_Visit_GUID
|
||||
];
|
||||
|
||||
return_value := call create_ED_column with ( Infect_Col );
|
||||
conclude true;
|
||||
|
||||
elseif ( update_column = true AND EvokingEvent = user_logon ) then
|
||||
|
||||
//Loop through the Infectious Disease column values and update
|
||||
for j IN 1 seqto ( count infect_col_value ) do
|
||||
|
||||
Infect_Col := NEW EDCObj WITH [
|
||||
column_name := "Infectious Disease",
|
||||
column_value := infect_col_value[j],
|
||||
client_guid := infect_client_guid[j],
|
||||
chart_guid := "",
|
||||
client_visit_guid := infect_visit_guid[j]
|
||||
];
|
||||
|
||||
return_value := call create_ED_column WITH ( Infect_Col );
|
||||
enddo;
|
||||
|
||||
conclude true;
|
||||
endif;
|
||||
|
||||
;;
|
||||
action:
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user