Files
St.Clair/MLMStripper/bin/Debug/SCH/SCH_OON_INSURANCE.mlm

274 lines
9.8 KiB
Plaintext

maintenance:
title: SCH_OON_INSURANCE;;
mlmname: SCH_OON_INSURANCE;;
arden: version 2.50;;
version: 5.50;;
institution: St. Clair Hospital;;
author: Shawn Head, Allscripts Corp;;
specialist: Peggy Karish, Allscripts Corp;;
date: 2016-05-26;;
validation: testing;;
library:
purpose: Update an Enterprise Defined Patient List Column with UPMC Out of Network Coverage alert.
;;
explanation: For patients that are currently on the UPCM Out Of Network coverage. The patient is covered in the ED; however if we admit them their plan will not cover any of the costs.
The column will be updated and flash/display in a color that alerts the users that the patient is not covered for admission.
Change history
05.25.2016 STH CSR #34119 - Created from a copy of SCH_MEDICARE_PLAN_B_COLUMN_UPDATE {Go-Live 7/12/2016}
10.15.2018 STH CSR#: 34119 & 37522/CA SERVICE DESK#: 3202435 - Issue identified post go-live of reg/sched where insurnace column was not consistently updating.
Made changes to fire on Insurance enter/modify instead of visit enter/modify {Go-Live 11/7/2018}
;;
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;
InsuranceColumn_dest := destination { ObjectsPlus } with
[ alert_type := "Warning",
short_message := "Object created by MLM",
priority := "low",
scope := "chart",
rule_group := "EnterprisePatientListColumn Object",
rule_number := 2025 ];
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 ];
send_alert := "DoNotSend";
alert_dialog := "Must Acknowledge";
alert_message := "{{+B}}Patient Primary Insurance is {{+R}}OUT OF NETWORK{{-R}}.{{-B}}";
alert_Priority := "High";
alert_dest := destination {alert} with
[alert_type := warning,
short_message := "Out Of Network Insurance",
priority := alert_Priority,
scope := Chart,
rule_group := "Out Of Network Insurance",
rule_number := 8000,
send_with_alert := send_alert,
alert_dialog_settings := alert_dialog,
display_alert := true];
//--------------------------------------------------------------------
if called_by_editor
then
EvokingObject := read last {ClientVisit: THIS
where TypeCode = "Emergency"};
endif;
//Event Trigger
//VisitEnter := Event { ClientVisitEnter Any ClientVisit : WHERE TypeCode = "Emergency" };
//VisitModify := Event { ClientVisitModify Any ClientVisit : WHERE TypeCode = "Emergency" };
InsuranceEnter := event{InsuranceEnter User ClientVisit};
InsuranceModify := event{InsuranceModify User ClientVisit};
OrdInit := EVENT {OrderInit User Order:
where Name in ("Admit to Inpatient","Place In Observation") };
OrdSetInit:= event{OrderSetInit User OrderSet:
WHERE OrderSetName matches pattern "Transition%"
or OrderSetName matches pattern "Admission%"
or OrderSetName matches pattern "Post Op%"
};
InsUpdate := false;
if(EvokingEventType = OrdInit.Type) then
(ClientVisitGuid, ClientGuid) := read last {Order : ClientVisitGuid, ClientGuid REFERENCING EvokingObject};
VisitType := read last { " select typecode from cv3clientvisit with (nolock) where clientguid = " || sql(ClientGuid) || " and guid = " || sql(ClientVisitGuid) || " " };
elseif(EvokingEventType = OrdSetInit.Type) then
(ClientVisitGuid, ClientGuid) := read last {OrderSet : ClientVisitGuid, ClientGuid REFERENCING EvokingObject};
VisitType := read last { " select typecode from cv3clientvisit with (nolock) where clientguid = " || sql(ClientGuid) || " and guid = " || sql(ClientVisitGuid) || " " };
//elseif ((EvokingEventType = VisitEnter.Type) or (EvokingEventType = VisitModify.type)) then
// (ClientVisitGuid, ClientGuid, VisitType) := read last {ClientVisit : GUID, ClientGuid, TypeCode REFERENCING EvokingObject};
elseif((EvokingEventType = InsuranceEnter.Type) or (EvokingEventType = InsuranceModify.Type)) then
( FRP_Name, FRP_Code,Policy_Num, Subscriber_relationship,ClientVisitGuid, ClientGuid ) := read last
{ Insurance: FRPName,FRPCode, PolicyNum, RelationshipCode,ClientVisitGuid, ClientGuid
REFERENCING EvokingObject };
VisitType := read last { " select typecode from cv3clientvisit with (nolock) where clientguid = " || sql(ClientGuid) || " and guid = " || sql(ClientVisitGuid) || " " };
InsuranceCarrierID := EVOKINGOBJECT.Insurer.InsuranceCarrierID;
InsuranceSequence := EVOKINGOBJECT.SequenceNum;
if(InsuranceSequence = 1) then
ICfromObj := read last {" select ic.Name
from SXAAMInsuranceCarrier ic with (nolock)
where ic.InsuranceCarrierID = " || sql(InsuranceCarrierID)
|| " AND ((ic.Name like {{{SINGLE-QUOTE}}}%OUT OF NETWORK%{{{SINGLE-QUOTE}}})
OR (ic.name like {{{SINGLE-QUOTE}}}% OON %{{{SINGLE-QUOTE}}})) "};
endif;
endif;
if(trim(VisitType) = "Emergency") then
if(EvokingEventType not in (InsuranceEnter.Type,InsuranceModify.Type)) then
(UPMCOON_Val) := read {" SELECT ic.Name
FROM CV3FRPContract fc with (nolock)
JOIN CV3FRP f with (nolock)
ON fc.FRPGUID = f.GUID
JOIN SXAAMInsuranceCarrier ic with (nolock)
ON f.InsuranceCarrierID = ic.InsuranceCarrierID
WHERE fc.ClientGUID = " || Sql(ClientGuid) || "
AND fc.ClientVisitGUID = " || Sql(ClientVisitGuid) || "
AND FC.SequenceNum = 1
AND fc.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}
AND ((ic.Name like {{{SINGLE-QUOTE}}}%OUT OF NETWORK%{{{SINGLE-QUOTE}}})
OR (ic.name like {{{SINGLE-QUOTE}}}% OON %{{{SINGLE-QUOTE}}})) "};
endif;
if ((exists UPMCOON_Val) or (ICfromObj <> "")) then
InsuranceValue := "Yes";
else
InsuranceValue := "";
endif;
if((EvokingEventType in (OrdInit.Type,OrdSetInit.Type)) AND (InsuranceValue = "Yes")) then
AlertFire := true;
else
AlertFire := false;
endif;
endif;
;;
priority: 50
;;
evoke:
//22 second after time of VisitEnter;
//22 second after time of VisitModify;
InsuranceEnter;
InsuranceModify;
OrdInit;
OrdSetInit;
;;
logic:
//BEGIN OF VISIT ENTER/VISIT MODIFIY SECTION
if (EvokingEventType in (/*VisitEnter.Type,VisitModify.Type,*/InsuranceEnter.Type,InsuranceModify.Type)) then
if (EvokingObject is null) then
conclude false;
else
//if (updateColumn = true) then
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;
conclude true;
endcatch;
try
eColumnValue := InsuranceValue;
InsuranceDefinedColumn_Obj := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName
with (client_visit_obj, "Insurance OON");
colValue := InsuranceDefinedColumn_Obj.Value;
if ((colValue <> eColumnValue) and (InsuranceSequence=1)) then
//or (EvokingEventType in (VisitEnter.Type,VisitModify.Type))) then
InsuranceDefinedColumn_Obj.Value := eColumnValue;
//InsuranceColumn_dest.ObjectsPlus := InsuranceDefinedColumn_Obj;
void := call InsuranceDefinedColumn_Obj.Save;
void := call InsuranceDefinedColumn_Obj.Dispose;
InsuranceDefinedColumn_Obj := null;
endif;
endtry;
catch Exception ex
error_occurred := true;
error_message := error_message || "{{+R}}Enterprise Out Of Network Insurance 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 (InsuranceDefinedColumn_Obj is not null) then
void := call InsuranceDefinedColumn_Obj.Dispose;
InsuranceDefinedColumn_Obj := null;
endif;
InsuranceColumn_dest := null;
endcatch;
if (client_visit_obj is not null) then
void := call client_visit_obj.Dispose;
client_visit_obj := null;
endif;
conclude true;
endif;
elseif ((EvokingEventType in (OrdInit.Type,OrdSetInit.Type)) and (AlertFire)) then
conclude true;
else
conclude false;
endif;
//END OF VISIT ENTER/VISIT MODIFIY SECTION
;;
action:
//BEGIN OF VISIT ENTER/VISIT MODIFIY SECTION
if ((EvokingEventType in (InsuranceEnter.Type,InsuranceModify.Type))) then
if (error_occurred) then
write "An error occurred in the MLM {{+B}}SCH_OON_INSURANCE{{-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;
if (exists InsuranceColumn_dest) then
write true at InsuranceColumn_dest;
endif;
ENDIF;
if((EvokingEventType in (OrdInit.Type,OrdSetInit.Type)) and (AlertFire)) then
write alert_message at alert_dest;
endif;
;;
Urgency: 50;;
end: