Initial Checking with all 820 MLMs
This commit is contained in:
626
MLMStripper/bin/Debug/DOC/DOC_FUNC_HEP_C_SCREENING.mlm
Normal file
626
MLMStripper/bin/Debug/DOC/DOC_FUNC_HEP_C_SCREENING.mlm
Normal file
@@ -0,0 +1,626 @@
|
||||
maintenance:
|
||||
|
||||
title: DOC_FUNC_HEP_C_SCREENING;;
|
||||
mlmname: DOC_FUNC_HEP_C_SCREENING;;
|
||||
arden: version 5.5;;
|
||||
version: 15.10;;
|
||||
institution: St.Clair Hospital;;
|
||||
author: Shawn Head x7468;;
|
||||
specialist: Janet Nordin;;
|
||||
date: 2017-02-13;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: When patient is being evaluated for Hep C. on the Adult Patient Profile and also the Adult Patient Profile - Behavioraly Health
|
||||
;;
|
||||
explanation: This MLM will fire on the following structured note documents:
|
||||
* Adult Patient Profile
|
||||
* Adult Patient Profile - Behavioral Health
|
||||
* Adult Patient Profile - Observation
|
||||
|
||||
*********Details to be outline here.********
|
||||
|
||||
Change history
|
||||
|
||||
02.13.2017 STH CSR 35129: Created
|
||||
04.11.2017 STH CSR 35129: Issue with configuration of flowsheet observation and also auto ordering the lab due to nurses not having the proper security. {Go-Live 4/13/2017}
|
||||
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
FireOnAdultPatProfiles := ();
|
||||
FireOnAssessmentPlanFS := ();
|
||||
|
||||
/*------------------MAKE CHANGES IN THIS SECTION ONLY----------------------------*/
|
||||
|
||||
HepCPatient := "SCH_Hep C_Patient born between 1945-1965";
|
||||
HepCPriorScreening := "SCH_Hep C_Have you had prior screening";
|
||||
HepCScreen_PatApproval := ("SCH_Hep C _Testing","SCH_Hep C _Testing NEW","SCH_Hep C Screening New"); // Added By Shami for FS logic
|
||||
//created new SQL variable as we had to keep re-creating observations after go-live that we had to account for. MLM{{{SINGLE-QUOTE}}}s like lists one way and SQL likes them another.
|
||||
HepCScreen_PatApproval_SQL := "({{{SINGLE-QUOTE}}}SCH_Hep C _Testing{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Hep C _Testing NEW{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Hep C Screening New{{{SINGLE-QUOTE}}})"; // Added By Shami for FS logic
|
||||
HepCScreen_AutoOrder := "SCH_Hep C Screening Order";
|
||||
HepCordername := "Hepatitis C Antibody IgG";
|
||||
HepCFSCharting := "({{{SINGLE-QUOTE}}}SCH_Hep C Screening New{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Hep C_Screening{{{SINGLE-QUOTE}}})";
|
||||
(FireOnAdultPatProfiles) := ("Adult Patient Profile","Adult Patient Profile - Observation","Adult Patient Profile - Behavioral Health");
|
||||
(FireOnAssessmentPlanFS) := ("2. Adult Assessment/Intervention");
|
||||
|
||||
//Depending on lab inventory to complete the Hep C testing the order that needs placed may change.
|
||||
//the standard order will be the StClair order; however if anyone every "unexpires" the Mayo order the MLM
|
||||
//will automatically start ordering the Mayo order instead of the StClair order. According ot Maria they
|
||||
//will only unexpire the Mayo order when the St. Clair order is out of stock.
|
||||
Catalog_Item_Name_StClair := "Hepatitis C Antibody IgG";
|
||||
Catalog_Item_Name_Mayo := "Hepatitis C Antibody (Mayo)";
|
||||
|
||||
/*-----------------END EDIT SECTION---------------------------------------------*/
|
||||
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
// Order and Error Destinations
|
||||
|
||||
DiagnosticOrder_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "Order Object",
|
||||
rule_number := 2010 ];
|
||||
|
||||
error_destination := destination { Alert } with [
|
||||
alert_type := "Warning",
|
||||
short_message := "ObjectsPlus Error from MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
Rule_group := "ObjectsPlus Error from MLM",
|
||||
Rule_number := 1003,
|
||||
Rule_subgroup := "",
|
||||
Send_alert_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true ];
|
||||
// Recieve arguments from the structured note
|
||||
(thisDocumentCommunication) := argument;
|
||||
|
||||
// Extract interesting parts of the object model
|
||||
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
|
||||
(thisParameters) := thisStructuredNoteDoc.ParametersList;
|
||||
(this_currentObs) := thisDocumentCommunication.CurrentObservationObj;
|
||||
(this_cols) := thisStructuredNoteDoc.ColumnsList;
|
||||
(this_curr_col) := thisStructuredNoteDoc.CurrentColumn;
|
||||
(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];
|
||||
|
||||
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;
|
||||
|
||||
currentlocationGUID := read last { "select currentlocationguid from cv3clientvisit where clientguid = " || sql(clientGuid) || " and guid = " || sql(visitGuid) || " "};
|
||||
|
||||
DocEventType := thisDocumentCommunication.EventType;
|
||||
ChartPatAge := false;
|
||||
ChartPriorScreen := false;
|
||||
ChartAutoOrder := false;
|
||||
|
||||
|
||||
(birth_year) := read last { " select cast (birthyearnum as varchar) from cv3client with (nolock) where guid = " || sql(ClientGuid) };
|
||||
|
||||
if(((birth_year as number) >= 1945) and ((birth_year as number) <= 1965)) then
|
||||
RightAgeyes := true;
|
||||
RightAgeNo := false;
|
||||
else
|
||||
RightAgeYes := false;
|
||||
RightAgeNo := true;
|
||||
endif;
|
||||
|
||||
|
||||
if((RightAgeyes) or (DocEventType = "ChartObservation")) then
|
||||
//Ran this SQL logic against a PROD patient that had over 1400 visits and dated back to 2002. The SQL returned on 0 seconds. With that being said
|
||||
//there is always the potential this SQL logic can cause a delay if it is slow to return data. Always check this SQL logic as it is required every time
|
||||
//this MLM is called and looks across all charts for a specific order.
|
||||
HepCScreeningOrders := read { " select clientguid, ChartGUID, guid as {{{SINGLE-QUOTE}}}clientvisitguid{{{SINGLE-QUOTE}}} into #tmp_cv from cv3clientvisit cv with (nolocK)
|
||||
where ClientGUID = " || sql(clientGuid) || "
|
||||
|
||||
select ocmi.guid,ocmi.name, ocmi.OrderReviewCategoryGUID, rci.ItemName, rci.GUID as {{{SINGLE-QUOTE}}}rci_guid{{{SINGLE-QUOTE}}}, rci.ResultCategoriesGUID
|
||||
into #tmp_ocmi
|
||||
from cv3ordercatalogmasteritem ocmi with (nolock)
|
||||
inner join CV3ResultCatalogItem rci with (nolock) on ocmi.guid = rci.OrderMasterItemGUID
|
||||
where ocmi.Name like {{{SINGLE-QUOTE}}}%Hepatitis C%{{{SINGLE-QUOTE}}} or ocmi.Name like {{{SINGLE-QUOTE}}}%hep c%{{{SINGLE-QUOTE}}}
|
||||
|
||||
|
||||
select cv.*, o.guid as {{{SINGLE-QUOTE}}}orderGUID{{{SINGLE-QUOTE}}}, o.OrderStatusCode, o.OrderStatusLevelNum, o.SignificantDtm from #tmp_cv cv with (nolock)
|
||||
inner join CV3Order o with (nolock) on cv.clientguid = o.clientguid and cv.chartguid = o.chartguid
|
||||
left join CV3BasicObservation bo with (nolock)
|
||||
on cv.ClientGUID = bo.ClientGUID
|
||||
and cv.ChartGUID = bo.ChartGUID
|
||||
and cv.clientvisitguid = bo.ClientVisitGUID
|
||||
and bo.OrderGUID = o.GUID
|
||||
|
||||
inner join #tmp_ocmi ocmi with (nolock) on ((bo.ResultItemGUID = ocmi.rci_guid and bo.ItemName = ocmi.ItemName) or (o.OrderCatalogMasterItemGUID = ocmi.guid))
|
||||
where (
|
||||
(o.ClientGUID = " || sql(clientGuid) || "
|
||||
and o.ChartGUID = " || sql(chartGuid) || "
|
||||
and o.ClientVisitGUID = " || sql(visitGuid) || "
|
||||
and OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))
|
||||
or
|
||||
(o.ClientGUID = " || sql(clientGuid) || "
|
||||
and o.ClientVisitGUID <> " || sql(visitGuid) || "
|
||||
and o.OrderStatusLevelNum >= {{{SINGLE-QUOTE}}}60{{{SINGLE-QUOTE}}}
|
||||
and OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))
|
||||
or
|
||||
(o.ClientGUID = " || sql(clientGuid) || "
|
||||
and OrderStatusLevelNum = {{{SINGLE-QUOTE}}}83{{{SINGLE-QUOTE}}})
|
||||
)
|
||||
drop table #tmp_cv, #tmp_ocmi "}; //clientGuid, visitGuid, chartGuid
|
||||
|
||||
|
||||
|
||||
endif;
|
||||
|
||||
/*--########################################### BEGINING OF ASSESSMENT AND PLAN FLOWSHEET LOGIC####################################################--*/
|
||||
/* -- START: COMMENTED AS IT WAS SLOWING DOWN THE FS
|
||||
if(trim(thisDocumentCommunication.DocumentName as string) in FireOnAssessmentPlanFS) then
|
||||
if (count(HepCScreeningOrders)>0 AND HepCScreeningOrders is not NULL) then
|
||||
|
||||
FSAlert := false;
|
||||
else
|
||||
FSAlert := true;
|
||||
endif;
|
||||
|
||||
if((DocEventType = "DocumentOpening") and (FSAlert)) then
|
||||
|
||||
HepC_FS_Charting := read last {" select guid as {{{SINGLE-QUOTE}}}clientvisitguid{{{SINGLE-QUOTE}}}, clientguid, chartguid into #tmp_patients from cv3clientvisit with (nolock)
|
||||
where ClientGuid = " || sql(clientGuid)
|
||||
|| " and ChartGUID = " || sql(ChartGuid)
|
||||
|| " and guid = " || sql(VisitGuid)
|
||||
|
||||
|| " Select guid into #tmp_obnames from CV3ObsCatalogMasterItem with (nolock)
|
||||
where name in " || HepCFSCharting || "
|
||||
|
||||
select top 1 isnull(oflv.value,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) as {{{SINGLE-QUOTE}}}obsvalue{{{SINGLE-QUOTE}}}
|
||||
from #tmp_patients cv with (nolock)
|
||||
inner join SXACDObservationParameter ObsParam with (nolock)
|
||||
on cv.ClientGUID = ObsParam.ClientGUID
|
||||
and cv.chartguid = ObsParam.ChartGUID
|
||||
and cv.clientvisitguid = ObsParam.clientvisitguid
|
||||
AND ObsParam.IsCanceled = 0
|
||||
and ObsParam.ObsMasterItemGUID in (select guid from #tmp_obnames)
|
||||
inner join SCMObsFSListValues oflv with (nolock)
|
||||
on obsparam.clientguid = oflv.clientguid
|
||||
and obsparam.ObservationDocumentGUID = oflv.ParentGUID
|
||||
and oflv.active = 1
|
||||
order by RecordedDtm desc
|
||||
|
||||
drop table #tmp_obnames, #tmp_patients " };
|
||||
|
||||
|
||||
AlertShow := read last {" SELECT Distinct
|
||||
OD.CreatedWhen AS ObsDate
|
||||
FROM CV3Clientvisit CV
|
||||
INNER JOIN CV3ClientDocument CD WITH (NOLOCK)
|
||||
ON CV.GUID = CD.ClientVisitGUID And CD.ClientGUID = CV.ClientGUID
|
||||
And CD.DocumentName = {{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}}
|
||||
AND CD.Active = 1
|
||||
AND CD.IsCanceled = 0
|
||||
INNER JOIN CV3ObservationDocument OD WITH (NOLOCK)
|
||||
ON CD.GUID = OD.OwnerGUID
|
||||
AND OD.Active = 1
|
||||
|
||||
INNER JOIN CV3ObsCatalogMasterItem OCMI WITH (NOLOCK)
|
||||
ON OCMI.GUID = OD.ObsMasterItemGUID
|
||||
AND OCMI.Name IN ({{{SINGLE-QUOTE}}}SCH_Hep C _Testing NEW{{{SINGLE-QUOTE}}},
|
||||
{{{SINGLE-QUOTE}}}SCH_Hep C Screening New{{{SINGLE-QUOTE}}},
|
||||
{{{SINGLE-QUOTE}}}SCH_Hep C _Hep Education{{{SINGLE-QUOTE}}},
|
||||
{{{SINGLE-QUOTE}}}SCH_Hep C _Hep Verbalize understanding{{{SINGLE-QUOTE}}})
|
||||
|
||||
LEFT JOIN CV3Observation O With (NoLock)
|
||||
ON OD.ObservationGUID = O.GUID
|
||||
|
||||
LEFT JOIN SCMObsFSListValues SFV WITH (NOLOCK)
|
||||
ON SFV.ParentGUID = OD.ObservationDocumentGUID
|
||||
AND SFV.ClientGUID = CD.ClientGUID
|
||||
AND SFV.Active = 1
|
||||
WHERE (OD.CreatedWhen BETWEEN DATEADD(HOUR,7,CONVERT(VARCHAR(10), GETDATE(),110)) AND
|
||||
DATEADD(HOUR,19,CONVERT(VARCHAR(10), GETDATE(),110)) ) AND
|
||||
CV.ClientGuid = " || sql(clientGuid)
|
||||
|| " and CV.ChartGUID = " || sql(ChartGuid)
|
||||
|| " and CV.guid = " || sql(VisitGuid)
|
||||
|
||||
|
||||
|| " ORDER BY OD.CreatedWhen DESC" };
|
||||
|
||||
CHARTED_DATA_OBJ := OBJECT [DocumentNameOBJ,OBSNAME,OBSVALUE];
|
||||
(CHARTED_DATA_LIST) := READ AS CHARTED_DATA_OBJ { " SELECT CD.DocumentName,OCMI.Name,ISNULL(sp.ValueText,dbo.SXAGetFSListValsFn(OD.ObservationDocumentGUID,CD.ClientGUID)) AS Value, " ||
|
||||
" ROW_NUMBER() OVER(PARTITION BY OCMI.NAME ORDER BY SP.RecordedDtm DESC) AS R " ||
|
||||
" INTO #TEST " ||
|
||||
" FROM CV3ClientDocument CD WITH (NOLOCK) " ||
|
||||
" INNER JOIN CV3ObservationDocument OD WITH (NOLOCK) ON OD.OwnerGUID = CD.GUID AND OD.ArcType = CD.ArcType AND OD.Active = 1 AND CD.IsCanceled = 0 " ||
|
||||
" INNER JOIN CV3ObsCatalogMasterItem OCMI WITH (NOLOCK) ON OCMI.GUID = OD.ObsMasterItemGUID " ||
|
||||
" AND OCMI.Name IN ({{{SINGLE-QUOTE}}}SCH_Hep C _Hep Education{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Hep C _Hep Verbalize understanding{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Hep C_Have you had prior screening{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Hep C_Patient born between 1945-1965{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Hep C _Testing NEW{{{SINGLE-QUOTE}}}) " ||
|
||||
" INNER JOIN SXACDObservationParameter SP WITH (NOLOCK) ON SP.ClientGUID = CD.ClientGUID " ||
|
||||
" AND SP.ChartGUID = CD.ChartGUID AND SP.PatCareDocGUID = CD.PatCareDocGUID " ||
|
||||
" AND SP.ObservationDocumentGUID = OD.ObservationDocumentGUID " ||
|
||||
" WHERE CD.ClientVisitGUID = " || SQL(VisitGuid) || " AND CD.ClientGUID = " || SQL(clientGuid) || " AND CD.ChartGUID = " || SQL(ChartGuid) || " AND CD.Active = 1 " ||
|
||||
" AND ISNULL(sp.ValueText,dbo.SXAGetFSListValsFn(OD.ObservationDocumentGUID,CD.ClientGUID)) IS NOT NULL " ||
|
||||
" SELECT DocumentName,NAME,Value FROM #TEST WHERE R = 1 " };
|
||||
FOR V IN 1 SEQTO COUNT OF CHARTED_DATA_LIST DO
|
||||
DocumentName := CHARTED_DATA_LIST[V].DocumentNameOBJ;
|
||||
IF CHARTED_DATA_LIST[V].OBSNAME = "SCH_Hep C _Hep Education" THEN
|
||||
Edu := CHARTED_DATA_LIST[V].OBSVALUE;
|
||||
ELSEIF CHARTED_DATA_LIST[V].OBSNAME = "SCH_Hep C _Hep Verbalize understanding" THEN
|
||||
verb := CHARTED_DATA_LIST[V].OBSVALUE;
|
||||
ELSEIF CHARTED_DATA_LIST[V].OBSNAME = "SCH_Hep C_Have you had prior screening" THEN
|
||||
prior := CHARTED_DATA_LIST[V].OBSVALUE;
|
||||
ELSEIF CHARTED_DATA_LIST[V].OBSNAME = "SCH_Hep C_Patient born between 1945-1965" THEN
|
||||
Born := CHARTED_DATA_LIST[V].OBSVALUE;
|
||||
ELSEIF CHARTED_DATA_LIST[V].OBSNAME = "SCH_Hep C _Testing NEW" THEN
|
||||
Test := CHARTED_DATA_LIST[V].OBSVALUE;
|
||||
ENDIF;
|
||||
ENDDO;
|
||||
|
||||
ComponentCatalogGuidList := "";
|
||||
IF Edu is NULL THEN
|
||||
IF ComponentCatalogGuidList = "" then
|
||||
ComponentCatalogGuidList := ". Education Given" ;
|
||||
ELSE
|
||||
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Education Given" ;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
IF Verb is NULL THEN
|
||||
IF ComponentCatalogGuidList = "" then
|
||||
ComponentCatalogGuidList := ". Patient/SO verbalized understanding" ;
|
||||
ELSE
|
||||
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient/SO verbalized understanding" ;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
IF Test is NULL THEN
|
||||
IF ComponentCatalogGuidList = "" then
|
||||
ComponentCatalogGuidList := ". Patient agrees to testing?" ;
|
||||
ELSE
|
||||
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient agrees to testing?" ;
|
||||
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
IF(AlertShow is NULL) THEN
|
||||
IF( Born ="Yes") THEN
|
||||
IF( Prior = "No/Unknown" OR Prior= "No") THEN
|
||||
IF((NOT EXISTS Edu OR NOT EXISTS Verb ) AND (trim(Test as string) = "Undecided") or (trim(Test as string) = "Unable to Consent")) THEN
|
||||
voiddialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
|
||||
(DocumentName as string) || " does not have the following Hepatitis C Questions answered \n" ||""|| (ComponentCatalogGuidList as string) || "\n and has the patient{{{SINGLE-QUOTE}}}s consent listed as " || (Test as string) || "\n Please update the "||(DocumentName as string) || " or chart on this flowsheet.",
|
||||
"Hepatitis C Screening Questions", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
||||
|
||||
ELSEIF( NOT Exists Test OR NOT EXISTS Edu OR NOT EXISTS Verb) then
|
||||
voiddialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
|
||||
(DocumentName as string) || " does not have the following Hepatitis C Questions answered \n" ||""|| (ComponentCatalogGuidList as string) || "\n Please update the "||(DocumentName as string) || " or chart on this flowsheet. ",
|
||||
"Hepatitis C Screening Questions", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
||||
|
||||
ELSEIF ( (trim(Test as string) = "Undecided") or (trim(Test as string) = "Unable to Consent") ) THEN
|
||||
voiddialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
|
||||
(DocumentName as string) || " currently Does Not have the patients consent for Testing Completed.",
|
||||
"Hepatitis C Patient Consent Required", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
||||
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
ENDIF;
|
||||
-- END: COMMENTED AS IT WAS SLOWING DOWN THE FS */
|
||||
/*--########################################### END OF ASSESSMENT AND PLAN FLOWSHEET LOGIC####################################################--*/
|
||||
|
||||
/*--########################################### BEGINING OF ADULT PATIENT PROFILE LOGIC####################################################--*/
|
||||
|
||||
|
||||
|
||||
/*--########################################### BEGINING OF ADULT PATIENT PROFILE LOGIC####################################################--*/
|
||||
if(trim(thisDocumentCommunication.DocumentName as string) in FireOnAdultPatProfiles OR trim(thisDocumentCommunication.DocumentName as string) in FireOnAssessmentPlanFS) then
|
||||
|
||||
if(DocEventType = "DocumentOpening") then
|
||||
if(RightAgeYes) then
|
||||
ChartPriorScreen := true;
|
||||
if (count(HepCScreeningOrders)>0) then
|
||||
PriorScreenYes := true;
|
||||
PriorScreenNo := false;
|
||||
else
|
||||
PriorScreenYes := false;
|
||||
PriorScreenNo := true;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
ChartPatAge := true;
|
||||
|
||||
endif;
|
||||
|
||||
// Identify the calling observation item
|
||||
callingobsvals := thisDocumentCommunication.CurrentObservationObj;
|
||||
callingobsname := first of (thisParameters where thisParameters.ParameterGUID = callingobsvals.ParameterGUID);
|
||||
callingobs := first of (thisobservations where thisobservations.ParameterGUID = callingobsname.ParameterGUID);
|
||||
|
||||
if(callingobs.DataType = "ListValue") then
|
||||
callingobsval := (callingobs.ValueObj.ListItemsList.Value where callingobs.ValueObj.ListItemsList.IsSelected = true);
|
||||
else
|
||||
callingobsval := callingobs.ValueObj.Value;
|
||||
endif;
|
||||
|
||||
ListSetValueType := OBJECT [ListValuesList];
|
||||
ListValueType := OBJECT [ListGUID, ListItemsList, SuggestedTextValue];
|
||||
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
|
||||
|
||||
Obs_ListSet := callingobsvals.ValueObj.ListItemsList;
|
||||
//Obs_ListItem := Obs_ListSet.ListItemsList ;
|
||||
Obs_Value := Obs_ListSet.value ;
|
||||
FOR item IN Obs_ListSet DO
|
||||
if item.IsSelected = true then
|
||||
msg1:= item.value;
|
||||
endif;
|
||||
ENDDo;
|
||||
//z:= Obs_ListSet.Records__;
|
||||
|
||||
|
||||
|
||||
if (DocEventType = "ChartObservation") Then
|
||||
|
||||
|
||||
/*------BEGIN-SECTION---PATIENT HAS HAD PRIOR SCREENING-------------------------------------*/
|
||||
IF(callingobsname.Name = HepCPatient) then
|
||||
if("Yes..." in callingobsval) then
|
||||
RightAgeyes := true;
|
||||
RightAgeNo := false;
|
||||
else
|
||||
RightAgeYes := false;
|
||||
RightAgeNo := true;
|
||||
PriorScreenYes := false;
|
||||
PriorScreenNo := false;
|
||||
endif;
|
||||
|
||||
if((RightAgeYes) and (count(HepCScreeningOrders>0)) and ("Yes..." in callingobsval)) then
|
||||
PriorScreenYes := true;
|
||||
PriorScreenNo := false;
|
||||
elseif("Yes..." in callingobsval) then
|
||||
PriorScreenYes := false;
|
||||
PriorScreenNo := true;
|
||||
else
|
||||
PriorScreenYes := false;
|
||||
PriorScreenNo := false;
|
||||
endif;
|
||||
|
||||
ChartPatAge := true;
|
||||
ChartPriorScreen := true;
|
||||
endif;
|
||||
|
||||
/*------BEGIN-SECTION---PATIENT HAS HAD PRIOR SCREENING-------------------------------------*/
|
||||
|
||||
|
||||
|
||||
/*------BEGIN-SECTION--PATIENT APPROVAL FOR HEP C SCREEN SECTION-----------------------------*/
|
||||
if(callingobsname.Name in HepCScreen_PatApproval) then
|
||||
|
||||
if ("Yes" in callingobsval) OR ("Place order for Hepatitis C Antibody" in msg1 ) then
|
||||
selectorderyes := true;
|
||||
selectorderno := false;
|
||||
else
|
||||
selectorderyes := false;
|
||||
selectorderno := true;
|
||||
endif;
|
||||
ChartAutoOrder := true;
|
||||
|
||||
endif;
|
||||
/*------END-SECTION----PATIENT APPROVAL FOR HEP C SCREEN SEC/TION-----------------------------*/
|
||||
|
||||
endif;
|
||||
//ChartPatAge, ChartPriorScreen, ChartAutoOrder
|
||||
|
||||
if(ChartPatAge) then
|
||||
HepCPatient_Param := first of (thisParameters where thisParameters.Name = HepCPatient);
|
||||
if (exists HepCPatient_Param) then
|
||||
this_currentObj := NEW ObservationType;
|
||||
this_currentObj.ClientDocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
|
||||
this_currentObj.ParameterGUID := HepCPatient_Param.ParameterGUID;
|
||||
this_currentObj.DataType := "ListValue";
|
||||
this_currentObj.ValueObj := NEW ListValueType;
|
||||
this_currentObj.ValueObj.ListGUID := HepCPatient_Param.ConfigurationObj.ListGUID;
|
||||
listItems := ();
|
||||
for item IN HepCPatient_Param.ConfigurationObj.ListItemsList Do
|
||||
selectedItem := NEW ListValueListItemType;
|
||||
selectedItem.ListItemGUID := item.ListItemGUID;
|
||||
selectedItem.Value := item.Value;
|
||||
if(item.Value = "Yes...") then
|
||||
selectedItem.IsSelected := RightAgeYes;
|
||||
else
|
||||
selectedItem.IsSelected := RightAgeNo;
|
||||
endif;
|
||||
listItems := (listItems, selectedItem);
|
||||
enddo;
|
||||
this_currentObj.ValueObj.ListItemsList := listItems;
|
||||
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if(ChartPriorScreen) then
|
||||
HepCPriorScreening_Param := first of (thisParameters where thisParameters.Name = HepCPriorScreening);
|
||||
if (exists HepCPriorScreening_Param) then
|
||||
this_currentObj := NEW ObservationType;
|
||||
this_currentObj.ClientDocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
|
||||
this_currentObj.ParameterGUID := HepCPriorScreening_Param.ParameterGUID;
|
||||
this_currentObj.DataType := "ListValue";
|
||||
this_currentObj.ValueObj := NEW ListValueType;
|
||||
this_currentObj.ValueObj.ListGUID := HepCPriorScreening_Param.ConfigurationObj.ListGUID;
|
||||
listItems := ();
|
||||
for item IN HepCPriorScreening_Param.ConfigurationObj.ListItemsList Do
|
||||
selectedItem := NEW ListValueListItemType;
|
||||
selectedItem.ListItemGUID := item.ListItemGUID;
|
||||
selectedItem.Value := item.Value;
|
||||
if(item.Value = "Yes") then
|
||||
selectedItem.IsSelected := PriorScreenYes;
|
||||
else
|
||||
selectedItem.IsSelected := PriorScreenNo;
|
||||
endif;
|
||||
listItems := (listItems, selectedItem);
|
||||
enddo;
|
||||
this_currentObj.ValueObj.ListItemsList := listItems;
|
||||
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if(ChartAutoOrder) then
|
||||
if((selectorderyes) and (count(HepCScreeningOrders)<=0)) then
|
||||
|
||||
MayoOrderActive := read first { " select case when ExpiryDate is null then {{{SINGLE-QUOTE}}}true{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}false{{{SINGLE-QUOTE}}} end as {{{SINGLE-QUOTE}}}MayoExpired{{{SINGLE-QUOTE}}}
|
||||
from CV3OrderCatalogMasterItem
|
||||
where name = " || sql(Catalog_Item_Name_Mayo) || " "};
|
||||
|
||||
if(MayoOrderActive = "true") then
|
||||
Laboratory_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name_Mayo;
|
||||
else
|
||||
Laboratory_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name_StClair;
|
||||
endif;
|
||||
|
||||
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
|
||||
"Clicking Yes will automatically place an order for " || (Laboratory_catalog_item.Name as string) || " which will be scheduled for AM rounds. \n\nAre you sure you want to place the order now?",
|
||||
"Auto Order Hepatitis C Antibody IgG?", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
||||
|
||||
If ((dialogResult as string) in ("Yes")) then
|
||||
|
||||
|
||||
SessionType := "Standard";
|
||||
SessionReason := "";
|
||||
RequestingSource := "Standing Order";
|
||||
user_IDType := "Edstan Number (physician)";
|
||||
order_Creation_Reason := "From Hep C Screening MLM";
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((thisdocumentCommunication.ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
user_IDCode := read last {"SELECT IDCode FROM CV3User " || " where GUID = " || thisdocumentCommunication.UserGUID};
|
||||
//RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
|
||||
|
||||
CP_GUID := read last {" select ProviderGUID from CV3CareProviderVisitRole
|
||||
where ClientGUID = " || sql(clientGuid) || "
|
||||
and ChartGUID = " || sql(chartGuid) || "
|
||||
and ClientVisitGUID = " || sql(visitGuid) || "
|
||||
and Active = 1
|
||||
and status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}
|
||||
and RoleCode = {{{SINGLE-QUOTE}}}Attending{{{SINGLE-QUOTE}}} "};
|
||||
RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( CP_GUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} ); //Int64
|
||||
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((currentlocationGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
try
|
||||
|
||||
Parent_DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
|
||||
// PreFilled_MedicationOrder_obj := call {{{SINGLE-QUOTE}}}MedicationOrder{{{SINGLE-QUOTE}}}.CreateMedicationOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
Laboratory_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
||||
order_Creation_Reason, // string CreateReason
|
||||
RequestingCareProvider_obj , // RequestedBy ObjectsPlus object
|
||||
RequestingSource, // string RequestedBySource (must be in dictionary)
|
||||
SessionType, // string SessionType
|
||||
SessionReason, // string SessionReason
|
||||
location_obj, // Location ReleaseLocGrpID
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
|
||||
ReqTime_obj := new net_object {{{SINGLE-QUOTE}}}RequestedTime{{{SINGLE-QUOTE}}};
|
||||
ReqTime_obj.CodedTime := "AM Rounds";
|
||||
Parent_DiagnosticOrder_obj.RequestedTime := ReqTime_obj;
|
||||
Parent_DiagnosticOrder_obj.RequestedDate := "T+1";
|
||||
if ( Parent_DiagnosticOrder_obj is NOT NULL ) then
|
||||
try
|
||||
void := call Parent_DiagnosticOrder_obj.Save;
|
||||
selectorderyes := true;
|
||||
selectorderno := false;
|
||||
void := call Parent_DiagnosticOrder_obj.Dispose;
|
||||
void:= call Laboratory_catalog_item.Dispose;
|
||||
Laboratory_catalog_item:= null;
|
||||
endtry;
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}New Parent Diagnostic order:{{-R}}\n" || ex.Message || "\n\n";
|
||||
Endcatch;
|
||||
|
||||
|
||||
endif;
|
||||
endtry;
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}New Parent Diagnostic order:{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
if ( Laboratory_catalog_item is NOT NULL ) then void:= call Laboratory_catalog_item.Dispose; Laboratory_catalog_item:= null; endif;
|
||||
if ( Parent_DiagnosticOrder_obj is NOT NULL ) then void:= call Parent_DiagnosticOrder_obj.Dispose; Parent_DiagnosticOrder_obj:= null; endif;
|
||||
selectorderyes := false;
|
||||
selectorderno := true;
|
||||
Parent_DiagnosticOrder_dest := null;
|
||||
|
||||
endcatch;
|
||||
|
||||
|
||||
// Dispose
|
||||
|
||||
if ( ClientVisit_obj is NOT NULL ) then void:= call ClientVisit_obj.Dispose; ClientVisit_obj:= null; endif;
|
||||
if ( RequestedBy_obj is NOT NULL ) then void:= call RequestedBy_obj.Dispose; RequestedBy_obj:= null; endif;
|
||||
if ( Location_obj is NOT NULL ) then void:= call Location_obj.Dispose; Location_obj:= null; endif;
|
||||
else
|
||||
selectorderyes := false;
|
||||
selectorderno := true;
|
||||
endif;
|
||||
endif;
|
||||
HepC_AutoOrderParam := first of (thisParameters where thisParameters.Name = HepCScreen_AutoOrder);
|
||||
if (exists HepC_AutoOrderParam) then
|
||||
this_currentObj := NEW ObservationType;
|
||||
this_currentObj.ClientDocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
|
||||
this_currentObj.ParameterGUID := HepC_AutoOrderParam.ParameterGUID;
|
||||
this_currentObj.DataType := "ListValue";
|
||||
this_currentObj.ValueObj := NEW ListValueType;
|
||||
this_currentObj.ValueObj.ListGUID := HepC_AutoOrderParam.ConfigurationObj.ListGUID;
|
||||
listItems := ();
|
||||
for item IN HepC_AutoOrderParam.ConfigurationObj.ListItemsList Do
|
||||
abc123 := item.Value;
|
||||
selectedItem := NEW ListValueListItemType;
|
||||
selectedItem.ListItemGUID := item.ListItemGUID;
|
||||
selectedItem.Value := item.Value;
|
||||
if(item.Value = "Yes") then
|
||||
selectedItem.IsSelected := selectorderyes;
|
||||
else
|
||||
selectedItem.IsSelected := selectorderno;
|
||||
endif;
|
||||
listItems := (listItems, selectedItem);
|
||||
enddo;
|
||||
this_currentObj.ValueObj.ListItemsList := listItems;
|
||||
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
/*--########################################### END OF ADULT PATIENT PROFILE LOGIC####################################################--*/
|
||||
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
if Error_occurred
|
||||
then
|
||||
write "An error has occured in the MLM {{+B}}DOC_FUNC_HEP_C_SCREENING{{-B}} " ||
|
||||
"Please notify your System Administrators that an error message has " ||
|
||||
"occurred for this patient. They will review the following error " ||
|
||||
"message: \n" at error_destination;
|
||||
|
||||
write "1. " || error_message at error_destination;
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
return thisDocumentCommunication;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user