246 lines
9.3 KiB
Plaintext
246 lines
9.3 KiB
Plaintext
maintenance:
|
|
|
|
title: DOC_SCH_Readmission_Risk_Assessments;;
|
|
mlmname: DOC_SCH_Readmission_Risk_Assessments;;
|
|
arden: version 2.5;;
|
|
version: 5.50;;
|
|
institution: SCH ;;
|
|
author: Chintan Tilwa ;;
|
|
specialist: ;;
|
|
date: 2012-10-10;;
|
|
validation: testing;;
|
|
library:
|
|
purpose:
|
|
;;
|
|
explanation:
|
|
|
|
Change history
|
|
|
|
10.15.2012 CT CSR# 30880 - Created by GOS for Readmission Initiative Project
|
|
04.30.2013 DW CSR# 31334 - Adjusted to support the re-configuration of Pregnancy & Lactation questions
|
|
|
|
;;
|
|
keywords:
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
(this_documentCommunication) := argument;
|
|
|
|
//Get The Structure Note
|
|
(this_FS_doc) := this_documentCommunication.DocumentConfigurationObj;
|
|
//Get the Parameter List
|
|
(this_parms) := this_FS_doc.ParametersList;
|
|
//Paramters defination
|
|
(this_cols) := this_FS_doc.ColumnsList;
|
|
(this_curr_col) := this_FS_doc.Currentcolumn;
|
|
(this_currentObs) := this_documentCommunication.CurrentObservationObj;
|
|
(this_observations) := this_FS_doc.ChartedObservationsList;
|
|
(this_curr_valobj) := this_currentObs.valueobj;
|
|
|
|
if ((this_documentCommunication.DocumentName = "Adult Patient Profile") OR
|
|
(this_documentCommunication.DocumentName = "Adult Patient Profile - Observation")) then
|
|
|
|
MLM_DIPA := MLM {{{SINGLE-QUOTE}}}UTIL_OBJECT_Customize_DIPA_MLM{{{SINGLE-QUOTE}}};
|
|
|
|
Client_GUID := this_documentCommunication.ClientGUID;
|
|
Client_Visit_GUID := this_documentCommunication.ClientVisitGUID;
|
|
|
|
prm1 := first of (this_parms where this_parms.Name = "SCH_CK_Prior Pattern_2");
|
|
Obs := first of (this_observations where this_observations.ParameterGUID = prm1.ParameterGUID );
|
|
lst1 := Obs.valueObj.ListItemsList ;
|
|
|
|
(Pre_Visit) := Read Last {"select COUNT(1) as No_Visit from CV3ClientVisit where ClientGUID = " || SQL(Client_GUID) || " and GUID <> " || SQL(Client_Visit_GUID) || " and TypeCode in ({{{SINGLE-QUOTE}}}Inpatient{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Emergency{{{SINGLE-QUOTE}}}) and (AdmitDtm between GETDATE()-90 and GETDATE())"};
|
|
|
|
(Pat_Falls) := Read Last {"select Description from CV3ClientEventDeclaration where ClientGUID = " || SQL(Client_GUID) || " and TypeCode = {{{SINGLE-QUOTE}}}Fall History{{{SINGLE-QUOTE}}} and Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"};
|
|
|
|
|
|
//sel1 := last of( lst1.Value where lst1.IsSelected = true );
|
|
|
|
final_List := ();
|
|
|
|
If Pre_Visit > 3 Then
|
|
|
|
final_List := final_List , ">3 hospitalizations or ER Visits in past 3 months" ;
|
|
|
|
endif;
|
|
|
|
If exist Pat_Falls Then
|
|
|
|
final_List := final_List , "History of Falls" ;
|
|
|
|
endif;
|
|
|
|
for i in lst1 do
|
|
if i.Isselected = true then
|
|
final_List := final_List , i.Value ;
|
|
endif;
|
|
enddo;
|
|
|
|
obs1 := CALL MLM_DIPA WITH this_DocumentCommunication, prm1, final_List;
|
|
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := (
|
|
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList, obs1);
|
|
|
|
|
|
MLM_Score := MLM {{{SINGLE-QUOTE}}}DOC_SCH_Readmission_Risk_Score{{{SINGLE-QUOTE}}};
|
|
obs_Score := Call MLM_Score With this_documentCommunication;
|
|
|
|
MLM_Obs_Score := MLM {{{SINGLE-QUOTE}}}DOC_SCH_Readmission_Risk_Observation_Score{{{SINGLE-QUOTE}}};
|
|
obs1_Score := Call MLM_Obs_Score With this_documentCommunication;
|
|
|
|
|
|
//Clear Session variables
|
|
local_session := CDS_SESSION.local;
|
|
local_session.SessionReadmissionPharmacy := "";
|
|
local_session.SessionReadmissionDiagnosis := "";
|
|
local_session.SessionReadmissionDischarge := "";
|
|
local_session.SessionReadmissionFunctional := "";
|
|
local_session.SessionReadmissionDevice := "";
|
|
local_session.SessionReadmissionNutritional := "";
|
|
local_session.SessionReadmissionSmoking := "";
|
|
local_session.SessionReadmissionDiagnosisForMessage := "";
|
|
local_session.SessionNutritionalForMessage := "";
|
|
//local_session.SessionReadmissionScore := "";
|
|
local_session.SessionDeviceMessage := "";
|
|
local_session.SessionSmokingForMessage := "";
|
|
|
|
|
|
// Set session object for risks that are selected
|
|
|
|
|
|
prm := first of (this_parms where this_parms.Name = "SCH_CK_Nutritional Risk");
|
|
Obs := first of (this_observations where this_observations.ParameterGUID = prm.ParameterGUID);
|
|
lst1 := Obs.valueObj.ListItemsList ;
|
|
|
|
strSelectedNut := "";
|
|
for i in lst1 do
|
|
if i.Isselected = true Then
|
|
If i.value <> "No Nutritional Risk Criteria" then
|
|
List1 := List1 , i.Value ;
|
|
EndIF;
|
|
strSelectedNut := strSelectedNut || "`" || i.Value;
|
|
endif;
|
|
enddo;
|
|
local_session.SessionNutritionalForMessage := strSelectedNut;
|
|
|
|
|
|
prm := first of (this_parms where this_parms.Name = "SCH_CK_Device(s) on admission, ED, and OR");
|
|
Obs := first of (this_observations where this_observations.ParameterGUID = prm.ParameterGUID);
|
|
lst1 := Obs.valueObj.ListItemsList ;
|
|
|
|
SessionDeviceMessage := local_session.sessionDeviceMessage ;
|
|
|
|
for i in lst1 do
|
|
if i.Isselected = true Then
|
|
strSelectedDev := strSelectedDev || ", " || i.Value;
|
|
endif;
|
|
|
|
enddo;
|
|
local_session.sessionDeviceMessage := strSelectedDev;
|
|
|
|
strSelectedNut := "";
|
|
prm := first of (this_parms where this_parms.Name = "SCH_CK_Smoking Risk");
|
|
Obs := first of (this_observations where this_observations.ParameterGUID = prm.ParameterGUID);
|
|
lst1 := Obs.valueObj.ListItemsList ;
|
|
|
|
for i in lst1 do
|
|
if i.Isselected = true Then
|
|
strSelectedNut := strSelectedNut || "`" || i.Value;
|
|
endif;
|
|
enddo;
|
|
local_session.SessionSmokingForMessage := strSelectedNut;
|
|
|
|
|
|
prm := first of (this_parms where this_parms.Name = "SCH_CK_Diagnosis Risk");
|
|
Obs := first of (this_observations where this_observations.ParameterGUID = prm.ParameterGUID);
|
|
lst1 := Obs.valueObj.ListItemsList ;
|
|
sel1Col := lst1.Value where lst1.IsSelected = true ;
|
|
|
|
if "New Onset Diabetes" in sel1Col then
|
|
local_session.SessionReadmissionDiagnosisForMessage := "New Onset Diabetes";
|
|
EndIF;
|
|
|
|
|
|
|
|
// Determine if the patient Pregnacy Risk is N/A (males and females not of child bearing age)
|
|
|
|
|
|
(gender, patientage) := read last
|
|
{
|
|
" select "
|
|
||" gendercode, case when "
|
|
||" right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (datepart (MM,getdate()) as varchar),2) + right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (datepart (DD,getdate()) as varchar),2) < "
|
|
||" right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (birthmonthnum as varchar),2) + right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (birthdaynum as varchar),2) "
|
|
||" then datediff (yy, cast (birthyearnum as varchar) ,getdate()) -1 "
|
|
||" else datediff (yy, cast (birthyearnum as varchar) ,getdate()) "
|
|
||" end "
|
|
||" from cv3client with (nolock) where guid = " || Client_GUID || " "
|
|
};
|
|
|
|
if (patientage as number) <= 9 or (patientage as number) >= 56 or gender = "male"
|
|
then
|
|
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
|
|
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
|
|
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
|
|
|
|
// Set Pregnant to N/A
|
|
|
|
this_parametername := first of (this_parms where this_parms.Name = "SCH_PRO fem repro pg yn");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= this_FS_doc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "ListValue";
|
|
this_currentObj.ValueObj := New ListValueType;
|
|
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
|
|
|
|
listItems := ();
|
|
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
|
|
selectedItem := NEW ListValueListItemType;
|
|
selectedItem.ListItemGUID := item.ListItemGUID;
|
|
selectedItem.Value := item.Value;
|
|
if selectedItem.Value = "not applicable" then selectedItem.IsSelected := true; endif;
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
this_FS_doc.ChartedObservationsList := (this_FS_doc.ChartedObservationsList, this_currentObj);
|
|
|
|
// Set Breast Feeding to N/A
|
|
|
|
this_parametername := first of (this_parms where this_parms.Name = "SCH_PRO fem repro breastfeed yn");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= this_FS_doc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "ListValue";
|
|
this_currentObj.ValueObj := New ListValueType;
|
|
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
|
|
|
|
listItems := ();
|
|
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
|
|
selectedItem := NEW ListValueListItemType;
|
|
selectedItem.ListItemGUID := item.ListItemGUID;
|
|
selectedItem.Value := item.Value;
|
|
if selectedItem.Value = "not applicable" then selectedItem.IsSelected := true; endif;
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
this_FS_doc.ChartedObservationsList := (this_FS_doc.ChartedObservationsList, this_currentObj);
|
|
|
|
|
|
endif;
|
|
|
|
endif;
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke:
|
|
;;
|
|
logic:
|
|
Conclude true;
|
|
;;
|
|
action:
|
|
return this_documentCommunication;
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|