Initial Checking with all 820 MLMs
This commit is contained in:
115
MLMStripper/bin/Debug/SCH/SCH_PREV_ACC_HOSPICE.mlm
Normal file
115
MLMStripper/bin/Debug/SCH/SCH_PREV_ACC_HOSPICE.mlm
Normal file
@@ -0,0 +1,115 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_PREV_ACC_HOSPICE;;
|
||||
mlmname: SCH_PREV_ACC_HOSPICE;;
|
||||
arden: version 2;;
|
||||
version: 4.00;;
|
||||
institution: St Clair Memorial Hospital;;
|
||||
author: Robert Spence;;
|
||||
specialist: ;;
|
||||
date: 2009-06-01;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
;;
|
||||
explanation:
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
//Logging level of execution information
|
||||
log_execution_info:=FALSE;
|
||||
|
||||
|
||||
|
||||
//The evoking event for this MLM is OrderInit
|
||||
evoking_event_order:=EVENT{OrderInit User Order: where name <> "Infusion Center Consult"};
|
||||
|
||||
order_alert:= destination { Alert: Warning, "Previous Hospice Patient With Infusion Consult", high, chart,
|
||||
"Previous Hospice Patient", 9005};
|
||||
|
||||
|
||||
//Retreives a list of order GUIDs for unsubmitted orders
|
||||
unsub_ord:=read {UnsubmittedOrders: GUID};
|
||||
|
||||
//Provides a count of unsubmitted orders
|
||||
unsub_ord_count:= count(unsub_ord) As Number;
|
||||
|
||||
|
||||
//Retrieves additional information from the first order
|
||||
|
||||
(client_guid, chart_guid, client_visit_guid, user_guid):= read last {Order: ClientGUID, chartguid, ClientVisitGUID, UserGUID
|
||||
REFERENCING EvokingObject};
|
||||
should_fire := false;
|
||||
|
||||
|
||||
if unsub_ord_count = 0 then
|
||||
|
||||
// does this chart already have an infusion order?
|
||||
infus_curr := 0;
|
||||
infus_curr := read last {" select count(*) "
|
||||
|| " from cv3order as o with (nolock) "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.name ={{{SINGLE-QUOTE}}}Infusion Center Consult{{{SINGLE-QUOTE}}} "
|
||||
|| " where o.clientguid = " || SQL(client_guid)
|
||||
|| " and o.chartguid = " || SQL(chart_guid) } ;
|
||||
|
||||
if (infus_curr=0) then
|
||||
|
||||
// has patient been discharged to hospice in the last day? and have a Infusion order ordered?
|
||||
hosp_count := 0;
|
||||
hosp_count := read last {" select count(*) "
|
||||
|| " from cv3clientvisit as cv with (nolock) "
|
||||
|| " join cv3order as o with (nolock) "
|
||||
|| " on o.clientguid = cv.clientguid "
|
||||
|| " and o.chartguid = cv.chartguid "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.name ={{{SINGLE-QUOTE}}}Infusion Center Consult{{{SINGLE-QUOTE}}} "
|
||||
|| " where cv.clientguid = " || SQL(client_guid)
|
||||
|| " and cv.dischargedtm >= getdate() -1 "
|
||||
|| " and cv.DischargeDisposition like {{{SINGLE-QUOTE}}}%Hospice%{{{SINGLE-QUOTE}}} "
|
||||
};
|
||||
|
||||
|
||||
if hosp_count >0 then
|
||||
should_fire := true;
|
||||
|
||||
(hosp_acc, hosp_location, hosp_admitdtm, hosp_disdtm)
|
||||
:= read last {" select visitidcode, currentlocation, convert(varchar(20), admitdtm , 9), convert(varchar(20), dischargedtm , 9)"
|
||||
|| " from cv3clientvisit as cv with (nolock) "
|
||||
|| " join cv3order as o with (nolock) "
|
||||
|| " on o.clientguid = cv.clientguid "
|
||||
|| " and o.chartguid = cv.chartguid "
|
||||
|| " join cv3ordercatalogmasteritem as ocmi "
|
||||
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
||||
|| " and ocmi.name ={{{SINGLE-QUOTE}}}Infusion Center Consult{{{SINGLE-QUOTE}}} "
|
||||
|| " where cv.clientguid = " || SQL(client_guid)
|
||||
|| " and cv.dischargedtm >= getdate() -1 "
|
||||
|| " and cv.DischargeDisposition like {{{SINGLE-QUOTE}}}%Hospice%{{{SINGLE-QUOTE}}} "
|
||||
};
|
||||
MessageText := "This Patient was Discharged to Hospice on " || hosp_disdtm || " from " || hosp_location || "\n" ||
|
||||
" Account Number " || hosp_acc || " Admitted " || hosp_admitdtm || "\n\n" ||
|
||||
"Please remember to reenter an {{+B}}{{+R}}Infusion Center Consult On This Patient{{-B}}{{-R}}";
|
||||
endif;
|
||||
|
||||
endif; // infus_curr
|
||||
|
||||
endif; // unsub_ord_count
|
||||
|
||||
;;
|
||||
evoke: evoking_event_order
|
||||
;;
|
||||
logic:
|
||||
|
||||
conclude should_fire ;
|
||||
;;
|
||||
action:
|
||||
Write MessageText at order_alert
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user