281 lines
12 KiB
Plaintext
281 lines
12 KiB
Plaintext
maintenance:
|
||
|
||
title: DOC_FUNC_SUICIDE_RISK;;
|
||
mlmname: DOC_FUNC_SUICIDE_RISK;;
|
||
arden: version 5.0;;
|
||
version: 2.00;;
|
||
institution: St.Clair Hospital;;
|
||
author: GMS;;
|
||
specialist: Don Warnick ;;
|
||
date: 2016-08-02;;
|
||
validation: testing;;
|
||
|
||
library:
|
||
purpose:
|
||
;;
|
||
explanation: This MLM will create physician notification and nurse intervention orders if the patient is identified as at risk for suicide during the patient profile or ed triage interview
|
||
|
||
|
||
Change history
|
||
|
||
08.02.2016 DW CSR# 34885 - Created
|
||
06.15.2018 DW CSR# 36510 - Harm to Self or Others - look for risk score instead of single simplistic observation
|
||
|
||
;;
|
||
keywords:
|
||
;;
|
||
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";
|
||
|
||
// Recieve arguments from the structured note
|
||
(thisDocumentCommunication) := argument;
|
||
|
||
// Extract interesting parts of the object model
|
||
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
|
||
(thisParameters) := thisStructuredNoteDoc.ParametersList;
|
||
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
|
||
|
||
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
|
||
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
|
||
FreeTextValueType := OBJECT [Value];
|
||
DateValueType := OBJECT [Value];
|
||
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
|
||
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
|
||
|
||
// Get the client and visit GUIDs
|
||
clientGuid := thisDocumentCommunication.ClientGUID;
|
||
visitGuid := thisDocumentCommunication.ClientVisitGUID;
|
||
chartGuid := thisDocumentCommunication.ChartGUID;
|
||
userGuid := thisDocumentCommunication.UserGUID;
|
||
|
||
|
||
|
||
// CHART OBSERVATION SECTION
|
||
|
||
|
||
|
||
IF thisdocumentCommunication.EventType = "ChartObservation"
|
||
|
||
then
|
||
|
||
// Determine if patient is at risk for suicide in the patient profiles
|
||
|
||
theParameter := first of (thisparameters where thisparameters.Name = "sch_adult patient_hurt RD");
|
||
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
||
|
||
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes") then suiciderisk := "yes"; endif;
|
||
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "no") then suiciderisk := "no"; endif;
|
||
|
||
|
||
// Determine if the patient was identified in the ED and if a Mental Health order was placed
|
||
|
||
If suiciderisk = "no"
|
||
|
||
then
|
||
|
||
|
||
// replaced - 06.15.2018 DW CSR# 36510 - Harm to Self or Others - look for risk score instead of single simplistic observation
|
||
/*
|
||
edtriageriskfound := read last
|
||
{
|
||
" select "
|
||
||" fsl.value "
|
||
||" from CV3ClientDocument cd with (nolock) "
|
||
||" join CV3ClientDocDetail cdd with (nolock) on cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || clientGuid || " "
|
||
||" join CV3ObservationDocument od with (nolock) on cdd.CLientDocumentGUID = od.OwnerGUID "
|
||
||" join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|
||
||" join SCMObsFSListValues fsl with (nolock) on fsl.ParentGUID = od.ObservationDocumentGUID and fsl.ClientGUID = " || clientGuid || " "
|
||
||" where cd.clientguid = " || clientGuid || " and cd.ChartGUID = " || chartGuid || " and cd.ClientVisitGUID = " || visitGuid || " "
|
||
||" and od.active = 1 and cdd.active = 1 and cd.DocumentName = {{{SINGLE-QUOTE}}}ED Triage Note{{{SINGLE-QUOTE}}} and ocmi.name = {{{SINGLE-QUOTE}}}sch_edtriage_hurt{{{SINGLE-QUOTE}}} and fsl.value = {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} "
|
||
};
|
||
*/
|
||
|
||
edtriageriskfound := read last
|
||
{"
|
||
select obsparam.ValueText
|
||
from CV3ObsCatalogMasterItem ocmi with (nolock)
|
||
inner join SXACDObservationParameter obsparam with (nolock) on obsparam.ClientGUID = " || ClientGuid || " and obsparam.ChartGUID = " || ChartGuid || " and obsparam.ClientVisitGUID = " || visitGuid || " and obsparam.ObsMasterItemGUID = ocmi.GUID and obsparam.IsCanceled = 0
|
||
where ocmi.name = {{{SINGLE-QUOTE}}}SCH_PSY_Columbia Risk Score{{{SINGLE-QUOTE}}} and obsparam.ValueText not in ({{{SINGLE-QUOTE}}}No Risk{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Low Risk{{{SINGLE-QUOTE}}})
|
||
"};
|
||
|
||
|
||
mhorder := read last
|
||
{
|
||
" select ocmi.name "
|
||
|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
|
||
|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid "
|
||
|| " where "
|
||
|| " o.clientguid = " || clientGuid || " and o.chartguid = " || chartGuid || " and o.clientvisitguid = " || visitGuid || " and "
|
||
|| " o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) and ocmi.name = {{{SINGLE-QUOTE}}}Mental Health Nurse Consult{{{SINGLE-QUOTE}}} "
|
||
};
|
||
|
||
|
||
endif;
|
||
|
||
|
||
nurinstruct := read last
|
||
{
|
||
" select ocmi.name "
|
||
|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
|
||
|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid "
|
||
|| " where "
|
||
|| " o.clientguid = {{{SINGLE-QUOTE}}}" || clientGuid || "{{{SINGLE-QUOTE}}} and o.chartguid = {{{SINGLE-QUOTE}}}" || chartGuid || "{{{SINGLE-QUOTE}}} and o.clientvisitguid = {{{SINGLE-QUOTE}}}" || visitGuid || "{{{SINGLE-QUOTE}}} and "
|
||
|| " o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) and ocmi.name = {{{SINGLE-QUOTE}}}Nurse Intervention:{{{SINGLE-QUOTE}}} and o.SummaryLine like {{{SINGLE-QUOTE}}}%Initiate Self Harm Precautions{{{SINGLE-QUOTE}}} "
|
||
};
|
||
|
||
|
||
// Create the orders if ...
|
||
//
|
||
// 1 the patient was identifed as a suicide risk in the patinet profile
|
||
// 2 the patient was not identifed as a suicide risk in the patinet profile , but were identified as a risk in the ED triage note, but no mental health consult was entered
|
||
|
||
// replaced - 06.15.2018 DW CSR# 36510 - Harm to Self or Others - no longer look for MH consult as one is auto-ordered if Columbia Score = Medim or High
|
||
|
||
// If (suiciderisk = "yes" and not exists nurinstruct) or (suiciderisk = "no" and exists edtriageriskfound and not exists mhorder and not exists nurinstruct)
|
||
If (suiciderisk = "yes" and not exists nurinstruct) or (suiciderisk = "no" and exists edtriageriskfound and not exists nurinstruct)
|
||
|
||
|
||
then
|
||
|
||
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
|
||
"\nEither you or the ED Triage note has selected ‘Yes’ to the Suicide Risk " ||
|
||
"\n\n 1.Please call the physician for further direction regarding mental health consult " ||
|
||
"\n\n 2.Initiate Self Harm Precautions \n " ||
|
||
"\n Click ‘Yes’ to confirm your selection \n" ||
|
||
"\n Click ‘No’ if you wish to change your selection ",
|
||
"Confirm Suicide Risk Selection ", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
||
|
||
|
||
If (dialogResult as string) = "Yes"
|
||
|
||
then
|
||
|
||
|
||
// Create "common" objects shared by the 2 orders
|
||
|
||
|
||
try
|
||
locationGuid := read last {"SELECT CurrentLocationGUID, touchedWhen"
|
||
|| " FROM CV3ClientVisit with (nolock)"
|
||
|| " WHERE GUID = " || Sql(visitGuid)
|
||
|| " AND ClientGUID = " || Sql(clientGuid)
|
||
, primaryTime = touchedWhen};
|
||
|
||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||
care_provider_obj:= call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((userGuid 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}}});
|
||
|
||
Order_Creation_Reason := "Created per protocol";
|
||
RequestingSource := "";
|
||
SessionType := "Standard";
|
||
SessionReason := "";
|
||
endtry;
|
||
|
||
catch Exception ex
|
||
error_occurred := true;
|
||
error_message := "{{+R}}CommonData: {{-R}}\n" || ex.Message || "\n\n";
|
||
|
||
if location_obj IS NOT Null then void := call location_obj.Dispose; location_obj := null; endif;
|
||
if care_provider_obj IS NOT Null then void := call care_provider_obj.Dispose; care_provider_obj := null; endif;
|
||
if client_visit_obj IS NOT Null then void := call client_visit_obj.Dispose; client_visit_obj := null; endif;
|
||
endcatch;
|
||
|
||
|
||
|
||
// Create the Nurse Intervention Order
|
||
|
||
|
||
try
|
||
order_catalog_obj:= call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with ("Nurse Intervention:");
|
||
|
||
Order_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
||
with client_visit_obj,
|
||
order_catalog_obj,
|
||
Order_Creation_Reason,
|
||
care_provider_obj,
|
||
RequestingSource,
|
||
SessionType,
|
||
SessionReason,
|
||
location_obj,
|
||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
|
||
|
||
order_obj.SpecialInstructions := "Initiate Self Harm Precautions";
|
||
|
||
void := call Order_Obj.Save;
|
||
|
||
if order_catalog_obj IS NOT Null then void := call order_catalog_obj.Dispose; order_catalog_obj := null; endif;
|
||
endtry;
|
||
|
||
catch Exception ex
|
||
error_occurred := true;
|
||
error_message := "{{+R}}New Other Order: {{-R}}\n" || ex.Message || "\n\n";
|
||
if Order_Obj IS NOT Null then void := call Order_Obj.Dispose; Order_Obj := null; endif;
|
||
endcatch;
|
||
|
||
|
||
|
||
// Create the Call Physician Order
|
||
|
||
|
||
try
|
||
order_catalog_obj:= call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with ("Call Physician");
|
||
|
||
Order_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
||
with client_visit_obj,
|
||
order_catalog_obj,
|
||
Order_Creation_Reason,
|
||
care_provider_obj,
|
||
RequestingSource,
|
||
SessionType,
|
||
SessionReason,
|
||
location_obj,
|
||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
|
||
|
||
order_obj.SpecialInstructions := "Further direction regarding mental health consult";
|
||
retval := call order_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "NUR_NotifyType", "Physician" ;
|
||
|
||
void := call Order_Obj.Save;
|
||
|
||
if order_catalog_obj IS NOT Null then void := call order_catalog_obj.Dispose; order_catalog_obj := null; endif;
|
||
endtry;
|
||
|
||
catch Exception ex
|
||
error_occurred := true;
|
||
error_message := "{{+R}}New Other Order: {{-R}}\n" || ex.Message || "\n\n";
|
||
if Order_Obj IS NOT Null then void := call Order_Obj.Dispose; Order_Obj := null; endif;
|
||
endcatch;
|
||
|
||
|
||
// Dispose of the "common" objects shared by the 2 orders
|
||
|
||
|
||
if location_obj IS NOT Null then void := call location_obj.Dispose; location_obj := null; endif;
|
||
if care_provider_obj IS NOT Null then void := call care_provider_obj.Dispose; care_provider_obj := null; endif;
|
||
if client_visit_obj IS NOT Null then void := call client_visit_obj.Dispose; client_visit_obj := null; endif;
|
||
|
||
|
||
endif; // Confirm OK to enter the order
|
||
|
||
|
||
endif; // create the order
|
||
|
||
|
||
endif; // EventType = "ChartObservation"
|
||
|
||
;;
|
||
evoke:
|
||
;;
|
||
logic: conclude true;
|
||
;;
|
||
action: return thisDocumentCommunication;
|
||
;;
|
||
Urgency: 50;;
|
||
end:
|