209 lines
10 KiB
Plaintext
209 lines
10 KiB
Plaintext
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:
|