Initial Checking with all 820 MLMs
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_SIGNIFICANT_EVENT_VIOLENCE_RISK;;
|
||||
mlmname: SCH_SIGNIFICANT_EVENT_VIOLENCE_RISK;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: Peggy Karish;;
|
||||
specialist: Don Warnick;;
|
||||
date: 2018-05-29;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Called from registraion event
|
||||
;;
|
||||
explanation: When a Violence significant event is entered, this MLM will update the Suicide Violence status board column with the latest information.
|
||||
|
||||
Change history
|
||||
|
||||
05.29.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: Significant 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, "MLM Alert", high, chart, "MLM Issue", 15042, send_alert, "No Override Allowed" };
|
||||
|
||||
|
||||
significant_event_enter := Event {SignificantEventEnter ANY ClientEventDeclaration: where TypeCode in ("Violence-Clinical Support Team","Behavioral Health")};
|
||||
significant_event_discontinue:= Event {SignificantEventDiscontinue ANY ClientEventDeclaration: where TypeCode in ("Violence-Clinical Support Team","Behavioral Health")};
|
||||
significant_event_delete := Event {SignificantEventDelete ANY ClientEventDeclaration: where TypeCode in ("Violence-Clinical Support Team","Behavioral Health")};
|
||||
significant_event_modify := Event {SignificantEventModify ANY ClientEventDeclaration: where TypeCode in ("Violence-Clinical Support Team","Behavioral Health")};
|
||||
|
||||
(ClientGuid, ChartGuid, ClientVisitGuid) := read last {ClientEventDeclaration: clientguid, chartguid,clientvisitguid REFERENCING EvokingObject};
|
||||
|
||||
/*
|
||||
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;
|
||||
*/
|
||||
|
||||
|
||||
// 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
|
||||
"};
|
||||
|
||||
|
||||
|
||||
// Update the Enterprise Defined 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";
|
||||
else columnvalue := ".";
|
||||
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 );
|
||||
|
||||
;;
|
||||
evoke:
|
||||
|
||||
0 seconds after time of significant_event_enter;
|
||||
0 seconds after time of significant_event_delete;
|
||||
0 seconds after time of significant_event_discontinue;
|
||||
0 seconds after time of significant_event_modify;
|
||||
|
||||
;;
|
||||
logic:
|
||||
|
||||
Conclude true ;
|
||||
;;
|
||||
action:
|
||||
|
||||
|
||||
if error_occurred then
|
||||
write "An error has occured in the MLM {{+B}} SCH_SIGNIFICANT_EVENT_VIOLENCE_RISK {{-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:
|
||||
Reference in New Issue
Block a user