Initial Checking with all 820 MLMs
This commit is contained in:
152
MLMStripper/bin/Debug/SCH/SCH_FUNC_MRSA_ORDER.mlm
Normal file
152
MLMStripper/bin/Debug/SCH/SCH_FUNC_MRSA_ORDER.mlm
Normal file
@@ -0,0 +1,152 @@
|
||||
maintenance:
|
||||
|
||||
title: Called MLM that determines if an MRSA order is to be placed ;;
|
||||
mlmname: SCH_Func_MRSA_Order;;
|
||||
arden: version 4.5;;
|
||||
version: 2.00;;
|
||||
institution: St. Clair Hospital;;
|
||||
author: ;;
|
||||
specialist: ;;
|
||||
date: 2010-12-16;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
Called from the MRSA related MLM{{{SINGLE-QUOTE}}}s. It analyzes the patient{{{SINGLE-QUOTE}}}s record and returns data points.
|
||||
|
||||
;;
|
||||
explanation: This MLM was written to be called from ED Order Set MLMs, but can be called from others as well.
|
||||
|
||||
Change history
|
||||
|
||||
12.16.2010 DW Created
|
||||
05.04.2011 DW Logic to obtain result value split from order retrieval. Sort added to both on significant
|
||||
date and time.
|
||||
04.26.2011 TMS Moved fsl.value like {{{SINGLE-QUOTE}}}yes%{{{SINGLE-QUOTE}}} from left join statement down to where clause when retrieving NursingHome
|
||||
info to only get last yes value. Added clientvisit to only use information from current visit for
|
||||
Nursing Home info. HD Ticket 149146
|
||||
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
(ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation) := ARGUMENT;
|
||||
|
||||
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
|
||||
// Determine if Patient is on a Screening Unit
|
||||
|
||||
Unit:= Substring (find "-" in string CurrentLocation)-1 CHARACTERS From CurrentLocation;
|
||||
If Unit in ("ICU","CVSU","IRU","5A","5E","6E","5G") then ScreeningUnit := "Yes"; else ScreeningUnit := "No"; endif;
|
||||
|
||||
|
||||
// Attain MRSA Order History
|
||||
|
||||
/*
|
||||
(OrderName, SignificantDTM, StatusCode, ResultValue) := read last
|
||||
{"SELECT o.name, o.significantdtm, o.orderstatuscode, tol.text "
|
||||
|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
|
||||
|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid and o.clientguid = " || SQL(clientguid) || " and o.chartguid = " || SQL(chartguid) || " and o.clientvisitguid = " || SQL(clientvisitguid)
|
||||
|| " and o.orderstatuscode Not In ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}}) "
|
||||
|| " and o.name = {{{SINGLE-QUOTE}}}Nasal Screen for MRSA (Infection Control){{{SINGLE-QUOTE}}} "
|
||||
|| " left join cv3BasicObservation bo with (nolock) on bo.OrderGuid = o.guid and bo.clientguid = " || SQL(clientguid) || " and bo.chartguid = " || SQL(chartguid) || " and bo.clientvisitguid = " || SQL(clientvisitguid)
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}culture{{{SINGLE-QUOTE}}} "
|
||||
|| " left join cv3textualobservationline tol with (nolock) on tol.observationguid = bo.guid and tol.clientguid = " || SQL(clientguid) };
|
||||
*/
|
||||
|
||||
(OrderName, SignificantDTM, StatusCode) := read last
|
||||
{"SELECT o.name, o.significantdtm, o.orderstatuscode "
|
||||
|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
|
||||
|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid and o.clientguid = " || SQL(clientguid) || " and o.chartguid = " || SQL(chartguid) || " and o.clientvisitguid = " || SQL(clientvisitguid)
|
||||
|| " and o.orderstatuscode Not In ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}}) "
|
||||
|| " and o.name = {{{SINGLE-QUOTE}}}Nasal Screen for MRSA (Infection Control){{{SINGLE-QUOTE}}} "
|
||||
|| " order by o.significantdtm " };
|
||||
|
||||
// Attain MRSA Result History
|
||||
|
||||
(ResultValue) := read last
|
||||
{"SELECT tol.text "
|
||||
|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
|
||||
|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid and o.clientguid = " || SQL(clientguid) || " and o.chartguid = " || SQL(chartguid) || " and o.clientvisitguid = " || SQL(clientvisitguid)
|
||||
|| " and o.orderstatuscode In ({{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}}) "
|
||||
|| " and o.name = {{{SINGLE-QUOTE}}}Nasal Screen for MRSA (Infection Control){{{SINGLE-QUOTE}}} "
|
||||
|| " left join cv3BasicObservation bo with (nolock) on bo.OrderGuid = o.guid and bo.clientguid = " || SQL(clientguid) || " and bo.chartguid = " || SQL(chartguid) || " and bo.clientvisitguid = " || SQL(clientvisitguid)
|
||||
|| " and bo.itemname = {{{SINGLE-QUOTE}}}culture{{{SINGLE-QUOTE}}} "
|
||||
|| " left join cv3textualobservationline tol with (nolock) on tol.observationguid = bo.guid and tol.clientguid = " || SQL(clientguid)
|
||||
|| " order by o.significantdtm " };
|
||||
|
||||
|
||||
// Attain MRSA Flag History
|
||||
|
||||
|
||||
(MRSAHist) := read last
|
||||
{ " select case when EnterpriseClientcol8 in ({{{SINGLE-QUOTE}}}MRSA{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Both{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} end "
|
||||
|| " from cv3enterpriseclientdata where clientguid = " || SQL(clientguid) || " " };
|
||||
|
||||
|
||||
if exist MRSAHist then MRSAHistory := "Yes"; else MRSAHistory := "No"; endif;
|
||||
|
||||
|
||||
// Attain patient nursing home residency status from patient profile
|
||||
|
||||
|
||||
(NursingHome) := read last
|
||||
{"select fsl.value "
|
||||
|| " from CV3ClientDocument cd with (nolock) "
|
||||
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || SQL(clientguid) || " and cdd.active = 1) "
|
||||
|| " left join CV3ObservationDocument od with (nolock) ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|
||||
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID and ocmi.name in ({{{SINGLE-QUOTE}}}SCHCK_MRSA nursing home{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}sch_edtriage_arrive nrsg home{{{SINGLE-QUOTE}}}) "
|
||||
|| " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || SQL(clientguid) || ") "
|
||||
|| " where cd.clientguid = " || SQL(clientguid) || " and cd.clientvisitguid = " || SQL(clientvisitguid)
|
||||
|| " and fsl.value like {{{SINGLE-QUOTE}}}yes%{{{SINGLE-QUOTE}}} "
|
||||
|| " and cd.documentname in ({{{SINGLE-QUOTE}}}ED Triage Note{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}adult patient profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}OB Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pediatric Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Newborn Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Test{{{SINGLE-QUOTE}}}) " };
|
||||
|
||||
if exist NursingHome then NursingHomeResidency := "Yes"; else NursingHomeResidency := "No"; endif;
|
||||
|
||||
|
||||
// Attain anti-infective charting within past 7 days
|
||||
|
||||
|
||||
(AntiInfectivedate) := read last
|
||||
{"select oto.performedfromdtm "
|
||||
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid and o.ClientGUID = " || SQL(clientguid) || " "
|
||||
|| " join cv3ordertask as ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid "
|
||||
|| " join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid "
|
||||
|| " and oto.ordertaskguid = ot.guid and oto.taskstatuscode ={{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
|
||||
|| " where ocmi.therapeuticcategory like {{{SINGLE-QUOTE}}}anti-infectives%{{{SINGLE-QUOTE}}} "
|
||||
|| " order by oto.performedfromdtm " };
|
||||
|
||||
if (AntiInfectivedate as time) is within the past 7 days then AntiInfectivewithin7 := "Yes"; else AntiInfectivewithin7 := "No"; endif;
|
||||
|
||||
|
||||
|
||||
// Value the MRSA Order Rules Flags
|
||||
|
||||
if (SignificantDTM as time) is within the past 24 hours then orderedtoday := "Yes"; else orderedtoday := "No"; endif;
|
||||
if (SignificantDTM as time) is within the past 72 hours then orderedwithin3 := "Yes"; else orderedwithin3 := "No"; endif;
|
||||
if ResultValue = "METHICILLIN RESISTANT STAPHYLOCOCCUS AUREUS" then positivescreen := "Yes"; else positivescreen := "No"; endif;
|
||||
|
||||
|
||||
;;
|
||||
evoke: /* Call MLM */
|
||||
;;
|
||||
logic:
|
||||
|
||||
conclude true;
|
||||
;;
|
||||
action:
|
||||
|
||||
return (ScreeningUnit, OrderedToday, OrderedWithin3, Positivescreen, SignificantDTM, StatusCode, ResultValue, MRSAHistory, NursingHomeResidency, AntiInfectivewithin7) ;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user