Files
St.Clair/MLMStripper/bin/Debug/SCH/SCH_HEPATITIS_C_SCREEN_ALERT.mlm

384 lines
22 KiB
Plaintext

maintenance:
title: SCH_Hepatitis_C_Screen_Alert;;
mlmname: SCH_Hepatitis_C_Screen_Alert;;
arden: version 2.5;;
version: 5.50;; // FP1
institution: SCH ;;
author: SHAMI SHARMA ;;
specialist: ;;
date: 2017-12-27;;
validation: testing;;
library:
purpose:
;;
explanation:
;;
keywords: ObjectsPlus, Orders
;;
knowledge:
type: data-driven;;
data:
// Specify which .NET assemblies need to be loaded for ObjectsPlus
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
error_occurred := false;
error_message := "";
Observation_Name_list := "SCH_Hep C _Hep Education","SCH_Hep C _Hep Verbalize understanding","SCH_Hep C_Have you had prior screening","SCH_Hep C_Patient born between 1945-1965","SCH_Hep C _Testing NEW";
log_execution_info := false;
hepC_alert_dest := destination {alert} with
[alert_type := "Warning",
short_message := " Hepatitis C Screening/Education Alert",
priority := "Low",
scope := "Chart",
rule_group := "Hepatitis C Screening",
rule_number := 4065,
send_with_order := send_alert,
alert_dialog_settings := "",
display_alert := true];
Document_Enter := event {ClientDocumentEnter User ClientDocument: where documentname in
("Adult Patient Profile", "Adult Patient Profile - Observation", "Adult Patient Profile - Behavioral Health","2. Adult Assessment/Intervention")};
Document_Modify := event {ClientDocumentModify User ClientDocument: where documentname in
("Adult Patient Profile", "Adult Patient Profile - Observation", "Adult Patient Profile - Behavioral Health","2. Adult Assessment/Intervention")};
(ClientDocument_GUID, ClientVisit_GUID, client_guid, Chart_GUID ,USER_GUID) := Read Last { ClientDocument: GUID, ClientVisitGUID, ClientGUID , ChartGUID, USERGUID REFERENCING EvokingObject };
(Client_Observation_Document_Obj, GUID,Document_Name):= read last { ClientDocument: ClientObservationDocument, GUID,DocumentName REFERENCING EvokingObject };
(Client_Observation_Obj_List) := read last{ ClientObservationDocument: ClientObservation REFERENCING Client_Observation_Document_Obj};
(case_participants_list ) := Client_Observation_Document_Obj.records__;
IF(EvokingEventType = "ClientDocumentEnter") THEN
Obs1 := False;
Obs2 := False;
Obs3 := False;
Obs4 := False;
Obs5 := False;
for i in 1 seqto count case_participants_list do
IF(case_participants_list.Name [i] = "SCH_Hep C _Hep Education") THEN
Obs1 := true;
ENDIF;
IF(case_participants_list.Name [i] ="SCH_Hep C _Hep Verbalize understanding") THEN
Obs2 := true;
ENDIF;
IF(case_participants_list.Name [i] = "SCH_Hep C_Have you had prior screening") THEN
Obs3 := true;
ENDIF;
IF(case_participants_list.Name [i] = "SCH_Hep C_Patient born between 1945-1965") THEN
Obs4 := true;
ENDIF;
IF(case_participants_list.Name [i] = "SCH_Hep C _Testing NEW") THEN
Obs5 := true;
ENDIF;
enddo;
ComponentCatalogGuidList := "";
ComponentCatalogGuid := "";
IF Obs1= FALSE THEN
IF ComponentCatalogGuidList = "" then
ComponentCatalogGuidList := ". Education Given" ;
ELSE
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Education Given" ;
ENDIF;
ENDIF;
IF Obs2= FALSE THEN
IF ComponentCatalogGuidList = "" then
ComponentCatalogGuidList := ". Patient/SO verbalized understanding" ;
ELSE
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient/SO verbalized understanding" ;
ENDIF;
ENDIF;
IF Obs3= FALSE THEN
IF ComponentCatalogGuidList = "" then
ComponentCatalogGuidList := ". Have you had prior Hepatitis C Screening" ;
ELSE
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Have you had prior Hepatitis C Screening" ;
ENDIF;
ENDIF;
IF Obs4= FALSE THEN
IF ComponentCatalogGuidList = "" then
ComponentCatalogGuidList := ". Patient born between 1945-1965" ;
ELSE
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient born between 1945-1965" ;
ENDIF;
ENDIF;
IF Obs5= FALSE THEN
IF ComponentCatalogGuidList = "" then
ComponentCatalogGuidList := ". Patient agrees to testing?" ;
ELSE
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient agrees to testing?" ;
ENDIF;
ENDIF;
(BornValue,BornObs, BornName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C_Patient born between 1945-1965")};
(PriorValue,PriorObs, PriorName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C_Have you had prior screening")};
(EduValue,EduObs, EduName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C _Hep Education")};
(VerbValue,VerbObs, VerbName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C _Hep Verbalize understanding")};
(TestValue,TestObs, TestName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C _Testing NEW")};
(OrderValue,OrderObs, OrderName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C Screening Order")};
Born_Value := BornObs.Value;
Prior_Value := PriorObs.Value;
Edu_Value := EduObs.Value;
Verb_Value := VerbObs.Value;
Test_Value := TestObs.Value;
Order_Value := OrderObs.Value;
ENDIF;
IF(EvokingEventType = "ClientDocumentModify") THEN
(Born_Value1) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
Where Name = "SCH_Hep C_Patient born between 1945-1965" };
Born_Value:=Born_Value1.Value;
IF Born_Value IS null then
Born_Value:= read last {"select top 1 OFLV.Value
FROM CV3CLientVisit cv (NoLock)
INNER JOIN CV3ClientDocument cd (nolock)
ON CV.GUID = CD.CLientVIsitGUID
AND CV.ChartGUID = CD.ChartGUID
AND CV.ClientGUID = CD.ClientGUID
AND cd.GUID = " || sql(ClientDocument_GUID) || "
AND cv.clientguid = " || sql(client_guid) || "
and cv.ChartGUID = " || sql(Chart_GUID ) || "
and cv.GUID = " || sql(ClientVisit_GUID) || "
ANd cd.Active = 1
AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
INNER JOIN CV3PatientCareDocument PCD (NoLock)
ON CD.PatCareDocGUID = PCD.GUID
AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}})
INNER JOIN CV3ObservationDocument obd (nolock) ON
cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
AND obd.ArcType = cd.ArcType
inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C_Patient born between 1945-1965{{{SINGLE-QUOTE}}}
inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
AND OFLV.ClientGUID = cv.CLientGUID
AND OFLV.Active = 1
order by OFLV.CreatedWhen desc"};
endif;
(Prior_Value2) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
Where Name = "SCH_Hep C_Have you had prior screening" };
Prior_Value:=Prior_Value2.Value;
IF Prior_Value IS null then
Prior_Value:= read last {"select top 1 OFLV.Value
FROM CV3CLientVisit cv (NoLock)
INNER JOIN CV3ClientDocument cd (nolock)
ON CV.GUID = CD.CLientVIsitGUID
AND CV.ChartGUID = CD.ChartGUID
AND CV.ClientGUID = CD.ClientGUID
AND cd.GUID = " || sql(ClientDocument_GUID) || "
AND cv.clientguid = " || sql(client_guid) || "
and cv.ChartGUID = " || sql(Chart_GUID ) || "
and cv.GUID = " || sql(ClientVisit_GUID) || "
ANd cd.Active = 1
AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
INNER JOIN CV3PatientCareDocument PCD (NoLock)
ON CD.PatCareDocGUID = PCD.GUID
AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}})
INNER JOIN CV3ObservationDocument obd (nolock) ON
cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
AND obd.ArcType = cd.ArcType
inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C_Have you had prior screening{{{SINGLE-QUOTE}}}
inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
AND OFLV.ClientGUID = cv.CLientGUID
AND OFLV.Active = 1
order by OFLV.CreatedWhen desc"};
endif;
(Edu_Value2) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
Where Name = "SCH_Hep C _Hep Education" };
Edu_Value:=Edu_Value2.Value;
IF Edu_Value IS null then
Edu_Value:= read last {"select top 1 OFLV.Value
FROM CV3CLientVisit cv (NoLock)
INNER JOIN CV3ClientDocument cd (nolock)
ON CV.GUID = CD.CLientVIsitGUID
AND CV.ChartGUID = CD.ChartGUID
AND CV.ClientGUID = CD.ClientGUID
AND cd.GUID = " || sql(ClientDocument_GUID) || "
AND cv.clientguid = " || sql(client_guid) || "
and cv.ChartGUID = " || sql(Chart_GUID ) || "
and cv.GUID = " || sql(ClientVisit_GUID) || "
ANd cd.Active = 1
AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
INNER JOIN CV3PatientCareDocument PCD (NoLock)
ON CD.PatCareDocGUID = PCD.GUID
AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}})
INNER JOIN CV3ObservationDocument obd (nolock) ON
cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
AND obd.ArcType = cd.ArcType
inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C _Hep Education{{{SINGLE-QUOTE}}}
inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
AND OFLV.ClientGUID = cv.CLientGUID
AND OFLV.Active = 1
order by OFLV.CreatedWhen desc"};
endif;
(Verb_Value2) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
Where Name = "SCH_Hep C _Hep Verbalize understanding" };
Verb_Value:=Verb_Value2.Value;
IF Verb_Value IS null then
Verb_Value:= read last {"select top 1 OFLV.Value
FROM CV3CLientVisit cv (NoLock)
INNER JOIN CV3ClientDocument cd (nolock)
ON CV.GUID = CD.CLientVIsitGUID
AND CV.ChartGUID = CD.ChartGUID
AND CV.ClientGUID = CD.ClientGUID
AND cd.GUID = " || sql(ClientDocument_GUID) || "
AND cv.clientguid = " || sql(client_guid) || "
and cv.ChartGUID = " || sql(Chart_GUID ) || "
and cv.GUID = " || sql(ClientVisit_GUID) || "
ANd cd.Active = 1
AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
INNER JOIN CV3PatientCareDocument PCD (NoLock)
ON CD.PatCareDocGUID = PCD.GUID
AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}})
INNER JOIN CV3ObservationDocument obd (nolock) ON
cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
AND obd.ArcType = cd.ArcType
inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C _Hep Verbalize understanding{{{SINGLE-QUOTE}}}
inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
AND OFLV.ClientGUID = cv.CLientGUID
AND OFLV.Active = 1
order by OFLV.CreatedWhen desc"};
endif;
(Test_Value2) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
Where Name = "SCH_Hep C _Testing NEW" };
Test_Value:=Test_Value2.Value;
IF Test_Value IS null then
Test_Value:= read last {"select top 1 OFLV.Value
FROM CV3CLientVisit cv (NoLock)
INNER JOIN CV3ClientDocument cd (nolock)
ON CV.GUID = CD.CLientVIsitGUID
AND CV.ChartGUID = CD.ChartGUID
AND CV.ClientGUID = CD.ClientGUID
AND cd.GUID = " || sql(ClientDocument_GUID) || "
AND cv.clientguid = " || sql(client_guid) || "
and cv.ChartGUID = " || sql(Chart_GUID ) || "
and cv.GUID = " || sql(ClientVisit_GUID) || "
ANd cd.Active = 1
AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
INNER JOIN CV3PatientCareDocument PCD (NoLock)
ON CD.PatCareDocGUID = PCD.GUID
AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}})
INNER JOIN CV3ObservationDocument obd (nolock) ON
cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
AND obd.ArcType = cd.ArcType
inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C _Testing NEW{{{SINGLE-QUOTE}}}
inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
AND OFLV.ClientGUID = cv.CLientGUID
AND OFLV.Active = 1
order by OFLV.CreatedWhen desc"};
endif;
ComponentCatalogGuidList := "";
ComponentCatalogGuid := "";
IF Edu_Value is NULL THEN
IF ComponentCatalogGuidList = "" then
ComponentCatalogGuidList := ". Education Given" ;
ELSE
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Education Given" ;
ENDIF;
ENDIF;
IF Verb_Value is NULL THEN
IF ComponentCatalogGuidList = "" then
ComponentCatalogGuidList := ". Patient/SO verbalized understanding" ;
ELSE
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient/SO verbalized understanding" ;
ENDIF;
ENDIF;
IF Prior_Value is NULL THEN
IF ComponentCatalogGuidList = "" then
ComponentCatalogGuidList := ". Have you had prior Hepatitis C Screening" ;
ELSE
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Have you had prior Hepatitis C Screening" ;
ENDIF;
ENDIF;
IF Born_Value is NULL THEN
IF ComponentCatalogGuidList = "" then
ComponentCatalogGuidList := ". Patient born between 1945-1965" ;
ELSE
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient born between 1945-1965" ;
ENDIF;
ENDIF;
IF Test_Value is NULL THEN
IF ComponentCatalogGuidList = "" then
ComponentCatalogGuidList := ". Patient agrees to testing?" ;
ELSE
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient agrees to testing?" ;
ENDIF;
ENDIF;
ENDIF;
BornValue1 :="";
PriorValue1:="";
for i in 1 seqto count Born_Value do
BornValue1 := Born_Value [i];
Enddo;
for i in 1 seqto count Prior_Value do
PriorValue1 := Prior_Value[i];
Enddo;
IF( BornValue1 ="Yes") THEN
IF( PriorValue1= "No/Unknown" OR PriorValue1= "No") THEN
IF(NOT EXISTS Edu_Value OR NOT EXISTS Verb_Value OR NOT EXISTS Test_Value ) THEN
alert_message := "Hepatitis C Screening/Education Reminder. \n"
||"You have not completed the Hep C Risk Assessment: \n"
||"The following questions need addressed. \n"
|| ComponentCatalogGuidList ||"\n" ;
//|| ComponentCatalogGuid ||"\n" ;
Result:= TRUE;
ENDIF;
ENDIF;
ENDIF;
;;
priority: 50
;;
evoke: Document_Enter;
Document_Modify;
;;
logic:
conclude true;
;;
action:
IF( Result = TRUE) THEN
write alert_message at hepC_alert_dest;
ENDIF;
;;
Urgency: 50;;
end: