195 lines
9.4 KiB
Plaintext
195 lines
9.4 KiB
Plaintext
maintenance:
|
|
|
|
title: BMI Checking;;
|
|
mlmname: DOC_FUNC_ANTICOAG_PLATELET_ALERT;;
|
|
arden: version 5.0;;
|
|
version: 2.00;;
|
|
institution: St.Clair Hospital;;
|
|
author: Shawn Head;;
|
|
specialist: ;;
|
|
date: 2013-02-15;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose:
|
|
;;
|
|
explanation:
|
|
Change history
|
|
|
|
02-15-2013 - CSR #: 31409 new alert for patients with anticoag order(s) AND have a platelet count less than 50 (50,000)
|
|
8-30-2013 - HelpDesk issue - Updated to use better SQL logic to extract data from database. MLM was taking 60-90 seconds to open flowsheet for a specific patient.
|
|
11-14-2013 - HelpDesk issue #: 162093 - Updated to more accuratly identify synonyms .
|
|
1-28-2014 - CSR #: 31957 - Update observation item for fall harm for the new observation created.
|
|
;;
|
|
keywords: platelet, count, anticoag, anticoagulant
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
//Message box
|
|
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
using "ObjectsPlusXA.SCM.Forms";
|
|
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
|
|
|
|
|
// Receive arguments from the structured note
|
|
(thisDocumentCommunication) := argument;
|
|
|
|
// Get the user, charte, client and visit GUIDs
|
|
userGuid := thisDocumentCommunication.UserGUID;
|
|
clientGuid := thisDocumentCommunication.ClientGUID;
|
|
clientvisitGuid := thisDocumentCommunication.ClientVisitGUID;
|
|
chartGuid := thisDocumentCommunication.ChartGUID;
|
|
|
|
|
|
// Chart Observation Section
|
|
|
|
//only trigger on document open
|
|
IF thisdocumentCommunication.EventType ="DocumentOpening" then
|
|
|
|
latestplatetctdttm := read last {"select MAX(entered) "
|
|
|| " from CV3BasicObservation bo with (nolock) "
|
|
|| " where bo.ClientGUID = " || SQL(clientGuid)
|
|
|| " and bo.ClientVisitGUID = " || SQL(clientvisitGuid) //{{{SINGLE-QUOTE}}}9000003475300270{{{SINGLE-QUOTE}}}
|
|
|| " and (bo.itemname in ({{{SINGLE-QUOTE}}}Platelet Count{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Platelet Count.{{{SINGLE-QUOTE}}})) " };
|
|
|
|
if latestplatetctdttm is not null then
|
|
//get the latest platelet count result for patients that have
|
|
//an active order for one of the defined anticoag medications listed.
|
|
//Medication names or synonyms like {{{SINGLE-QUOTE}}}%lovenox%{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}%Heparin%{{{SINGLE-QUOTE}}}
|
|
//%Coumadin%, {{{SINGLE-QUOTE}}}%Pradaxa%{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}%Xarelto%{{{SINGLE-QUOTE}}}
|
|
//If they dont have an anticoag order OR if they dont have any platelet count
|
|
//results this should return NULL preventing the next section from executing
|
|
//saving processing time and logic checking that is not required.
|
|
plateletct := read last {"select top 1 bo.Value "
|
|
|| " from CV3ClientVisit cv with (nolock) "
|
|
|| " inner join CV3BasicObservation bo with (nolock) on (cv.clientguid = bo.clientguid "
|
|
|| " and cv.GUID = bo.ClientVisitGUID "
|
|
|| " and bo.clientguid = " || SQL(clientGuid) //{{{SINGLE-QUOTE}}}9000064583200200{{{SINGLE-QUOTE}}}
|
|
|| " and bo.ClientVisitGUID = " || SQL(clientvisitGuid) //{{{SINGLE-QUOTE}}}9000003475300270{{{SINGLE-QUOTE}}}
|
|
|| " and (bo.itemname in ({{{SINGLE-QUOTE}}}Platelet Count{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Platelet Count.{{{SINGLE-QUOTE}}})) "
|
|
|| " and bo.Entered = " || SQL(latestplatetctdttm) || ") " // {{{SINGLE-QUOTE}}}2013-02-20 14:11:43.433{{{SINGLE-QUOTE}}})
|
|
|| " inner join CV3Order o with (nolock) on bo.ClientGuid = o.ClientGuid and bo.ClientVisitGUID = o.ClientVisitGUID "
|
|
|| " inner join CV3CatalogItemName cin with (nolock) on o.OrderCatalogMasterItemGUID = cin.OrderMasterItemGUID "
|
|
|| " where "
|
|
|| " (o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} "
|
|
|| " and o.Name is not null "
|
|
|| " and o.Active = 1 "
|
|
|| " and (o.OrderStatusCode like {{{SINGLE-QUOTE}}}AU%{{{SINGLE-QUOTE}}} or o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}}) "
|
|
|| " and (cin.Name like {{{SINGLE-QUOTE}}}%Enoxaparin%{{{SINGLE-QUOTE}}} "
|
|
|| " or cin.Name like {{{SINGLE-QUOTE}}}%Heparin%{{{SINGLE-QUOTE}}} "
|
|
|| " or cin.Name like {{{SINGLE-QUOTE}}}%Warfarin%{{{SINGLE-QUOTE}}} "
|
|
|| " or cin.Name like {{{SINGLE-QUOTE}}}%Dabigatran%{{{SINGLE-QUOTE}}} "
|
|
|| " or cin.Name like {{{SINGLE-QUOTE}}}%Rivaroxaban%{{{SINGLE-QUOTE}}} "
|
|
|| " or cin.Name like {{{SINGLE-QUOTE}}}%lovenox%{{{SINGLE-QUOTE}}} "
|
|
|| " or cin.Name like {{{SINGLE-QUOTE}}}%Coumadin%{{{SINGLE-QUOTE}}} "
|
|
|| " or cin.Name like {{{SINGLE-QUOTE}}}%Pradaxa%{{{SINGLE-QUOTE}}} "
|
|
|| " or cin.Name like {{{SINGLE-QUOTE}}}%Xarelto%{{{SINGLE-QUOTE}}} "
|
|
|| " or o.Name like {{{SINGLE-QUOTE}}}%Enoxaparin%{{{SINGLE-QUOTE}}} "
|
|
|| " or o.Name like {{{SINGLE-QUOTE}}}%Heparin%{{{SINGLE-QUOTE}}} "
|
|
|| " or o.Name like {{{SINGLE-QUOTE}}}%Warfarin%{{{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}}}%lovenox%{{{SINGLE-QUOTE}}} "
|
|
|| " or o.Name like {{{SINGLE-QUOTE}}}%Coumadin%{{{SINGLE-QUOTE}}} "
|
|
|| " or o.Name like {{{SINGLE-QUOTE}}}%Pradaxa%{{{SINGLE-QUOTE}}} "
|
|
|| " or o.Name like {{{SINGLE-QUOTE}}}%Xarelto%{{{SINGLE-QUOTE}}})) " };
|
|
|
|
endif;
|
|
|
|
|
|
//this if statement will prevent unnecessary code from being executed if
|
|
//there is no platelet count on this patients chart OR if they dont have
|
|
//an anticoag order on their chart
|
|
If plateletct is not null and (plateletct as number) <= 50 then
|
|
//get the most curernt observation date/time
|
|
//for the observation name {{{SINGLE-QUOTE}}}SCHCK_AS harm risk indicators{{{SINGLE-QUOTE}}} for the harm risk assessment
|
|
obsdttm := read last { " SELECT Distinct "
|
|
|| " isnull(MAX(cd.authoreddtm),{{{SINGLE-QUOTE}}}1900-01-01{{{SINGLE-QUOTE}}}) "
|
|
|| " FROM CV3ClientDocument CD WITH (NOLOCK) "
|
|
|| " JOIN CV3ObservationDocument OD WITH (NOLOCK) "
|
|
|| " ON OD.OwnerGUID = CD.GUID "
|
|
|| " and OD.Arctype = CD.Arctype "
|
|
|| " JOIN CV3Observation Obs WITH (NOLOCK) "
|
|
|| " ON OD.ObservationGUID = Obs.GUID "
|
|
|| " AND OD.Arctype = Obs.Arctype "
|
|
|| " left JOIN CV3ObservationXInfo OXI WITH (NOLOCK) "
|
|
|| " ON obs.GUID = OXI.observationXInfoGUID "
|
|
|| " and obs.Arctype = OXI.Arctype "
|
|
|| " LEFT JOIN CV3ObservationEntryItem OEI with (nolock) "
|
|
|| " ON OEI.GUID = OD.ParameterGUID "
|
|
|| " JOIN CV3ObsCatalogMasterItem OCMI with (nolock) "
|
|
|| " on OCMI.GUID = OD.ObsMasterItemGUID "
|
|
|| " join cv3obscatalogitem oci with (nolock) "
|
|
|| " on oci.guid = obs.obsitemguid "
|
|
|| " WHERE CD.ClientGUID = " || sql(clientguid)
|
|
|| " and cd.ClientVisitGUID = " || sql(clientvisitguid)
|
|
|| " and cd.ChartGUID = " || sql(chartguid)
|
|
|| " and oci.name in ({{{SINGLE-QUOTE}}}SCHCK_AS harm risk indicators{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCHCK_AS Harm Risk Assm{{{SINGLE-QUOTE}}})"
|
|
|| " AND OD.Active = 1 "
|
|
|| " AND CD.Active = 1 " };
|
|
|
|
|
|
|
|
//get the latest observation value from both the current and archive tables that matches the
|
|
//date/time set in the above if statement for variable obsdttm
|
|
findanticoagobsval := read last { " SELECT oflv.value "
|
|
|| " FROM CV3ClientDocument CD WITH (NOLOCK) "
|
|
|| " JOIN CV3ObservationDocument OD WITH (NOLOCK) "
|
|
|| " ON OD.OwnerGUID = CD.GUID "
|
|
|| " and OD.Arctype = CD.Arctype "
|
|
|| " JOIN CV3Observation Obs WITH (NOLOCK) "
|
|
|| " ON OD.ObservationGUID = Obs.GUID "
|
|
|| " AND OD.Arctype = Obs.Arctype "
|
|
|| " join SCMObsFSListValues oflv with (nolock) "
|
|
|| " on od.observationdocumentguid = oflv.ParentGUID "
|
|
|| " and cd.clientguid = oflv.clientguid "
|
|
|| " left JOIN CV3ObservationXInfo OXI WITH (NOLOCK) "
|
|
|| " ON obs.GUID = OXI.observationXInfoGUID "
|
|
|| " and obs.Arctype = OXI.Arctype "
|
|
|| " LEFT JOIN CV3ObservationEntryItem OEI with (nolock) "
|
|
|| " ON OEI.GUID = OD.ParameterGUID "
|
|
|| " JOIN CV3ObsCatalogMasterItem OCMI with (nolock) "
|
|
|| " on OCMI.GUID = OD.ObsMasterItemGUID "
|
|
|| " join cv3obscatalogitem oci with (nolock) "
|
|
|| " on oci.guid = obs.obsitemguid "
|
|
|| " and oci.name in ({{{SINGLE-QUOTE}}}SCHCK_AS harm risk indicators{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCHCK_AS Harm Risk Assm{{{SINGLE-QUOTE}}})"
|
|
|| " AND oflv.Value like {{{SINGLE-QUOTE}}}%50,000%{{{SINGLE-QUOTE}}} "
|
|
|| " WHERE CD.ClientGUID = " || sql(clientguid)
|
|
|| " and cd.ClientVisitGUID = " || sql(clientvisitguid)
|
|
|| " and cd.ChartGUID = " || sql(chartguid)
|
|
|| " and cd.AuthoredDtm = " || SQL(obsdttm)
|
|
|| " AND OD.Active = 1 "
|
|
|| " AND CD.Active = 1 " };
|
|
|
|
|
|
//This section checks to if there was a documented observation on the
|
|
//A/I flowsheet with a vlue like {{{SINGLE-QUOTE}}}%50,000%{{{SINGLE-QUOTE}}}. If one is not documented
|
|
//AND if the plateletct is less than 50 (indicating less than 50,000)
|
|
//then the warning message will fire; otherwise it will not display the
|
|
//warning message to the user.
|
|
|
|
if findanticoagobsval is null and (plateletct as number) <= 50 then
|
|
msg:= "This patient has an increased risk of harm should a fall occur due to a Platelet Count less than 50,000 "
|
|
|| "AND an active Anticoag order."
|
|
|| "\n\nPlease reassess the harm risk indicators and consider appropriate interventions aimed at reducing harm.";
|
|
|
|
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
|
endif;
|
|
endif;
|
|
|
|
endif;
|
|
|
|
;;
|
|
evoke:
|
|
;;
|
|
logic: conclude true;
|
|
;;
|
|
action: return thisDocumentCommunication;
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|