306 lines
13 KiB
Plaintext
306 lines
13 KiB
Plaintext
maintenance:
|
|
|
|
title: DOC_FUNC_IRU_PREADMISSION_SCREEN;;
|
|
mlmname: DOC_FUNC_IRU_PREADMISSION_SCREEN;;
|
|
arden: version 15.1;;
|
|
version: 2.50;;
|
|
institution: St.Clair Hospital;;
|
|
author: Juliet Law;;
|
|
specialist: Shubha Rai / Debbie Eiler;;
|
|
date: 2016-02-29;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose:
|
|
;;
|
|
explanation:
|
|
|
|
Change history
|
|
|
|
02.29.2016 JML CSR 33994: Create date.
|
|
|
|
;;
|
|
keywords:
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
// Receive arguments from the structured note
|
|
(this_documentCommunication) := argument;
|
|
|
|
// .Net assemblies required for ObjectsPlus
|
|
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
|
|
//Include MLM
|
|
str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
|
|
|
//Include Called MLM to setup CDS objects
|
|
set_cds_vars := MLM {{{SINGLE-QUOTE}}}Called_RPM_DOM_Get_Definition_MLM{{{SINGLE-QUOTE}}};
|
|
|
|
Get_result_impression_lookup := MLM {{{SINGLE-QUOTE}}}ACS_result_impression_Lookup{{{SINGLE-QUOTE}}};
|
|
|
|
//Document Types
|
|
STRUCTUREDNOTE := "StructuredNote";
|
|
|
|
//Event Types
|
|
DOCUMENTCLOSING := "DocumentClosing";
|
|
CHARTOBSERVATION := "ChartObservation";
|
|
DOCUMENTOPENING := "DocumentOpening";
|
|
|
|
//Setting debugFlag to True will allow popup dialogs containing debug information to appear
|
|
debugFlag := false;
|
|
|
|
//Tab definitions and formating
|
|
TAB := 9 FORMATTED WITH "%C" ;
|
|
TAB2 := TAB || TAB ;
|
|
TAB3 := TAB || TAB || TAB;
|
|
CR := 13 formatted with "%c";
|
|
LF := 10 formatted with "%c";
|
|
CRLF:= CR||LF;
|
|
CRLF2 := CR||LF||LF;
|
|
SP:= 32 formatted with "%c";
|
|
SP2:= SP||SP;
|
|
SP3:= SP||SP||SP;
|
|
|
|
//Initialize CDS objects via MLM call
|
|
(this_documentCommunication, client_guid, client_visit_guid, client_chart_guid, user_guid,
|
|
document_type, document_name, event_type, configuration_guid, this_currentObj, CancelEventFlag,
|
|
this_structuredNoteDoc, authored_date_time, authored_by_guid, client_document_guid, document_date_time,
|
|
isNewFlag, isIncompleteFlag, isResultsPendingFlag, isPriorityFlag, this_parameters,
|
|
this_chartedObservationsList, this_parameters_display_name, current_parameter, current_parameter_name,
|
|
current_parameter_guid, current_parameter_DataType, selectedItems, selectedItems_value, current_value,
|
|
diagnosticMessage, displayMessageFlag, CoSigner1, CoSigner2, DocumentTopic) := CALL set_cds_vars WITH
|
|
(this_documentCommunication);
|
|
|
|
//Set up debugging information to be captured
|
|
messageText := "";
|
|
if (debugFlag = true) then
|
|
messageText := "Debug Information:\n\n";
|
|
messageText := messageText || " DOC_FUNC_IRU_PREADMISSION_SCREEN mlm called.\n\n";
|
|
endif;
|
|
|
|
//Local Variables
|
|
theDocumentName := "Inpatient Rehabilitation Unit Pre-Admission Screen";
|
|
|
|
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
|
|
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
|
|
FreeTextValueType := OBJECT [Value];
|
|
NumericValueType := OBJECT [Value];
|
|
DateValueType := OBJECT [Value];
|
|
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
|
|
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
|
|
|
|
if ( event_type = DOCUMENTOPENING AND document_name = theDocumentName ) then
|
|
|
|
vital_sign_msg := "Vital Signs in last Past 24 Hours - Last Charted";
|
|
//Retrieve last 24 hours of vital signs
|
|
|
|
( vital_sign,
|
|
vital_value,
|
|
vital_date ) := READ {"SELECT oci.Name, o.ValueText, cd.AuthoredDtm"
|
|
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientDocumentCUR cd WITH (NOLOCK)"
|
|
|| " ON cv.ClientGUID = cd.ClientGUID"
|
|
|| " AND cv.GUID = cd.ClientVisitGUID"
|
|
|| " AND cv.ChartGUID = cd.ChartGUID"
|
|
|| " JOIN CV3ClientDocDetailCUR cdd WITH (NOLOCK) "
|
|
|| " ON cd.GUID = cdd.ClientDocumentGUID"
|
|
|| " AND cd.ClientGUID = cdd.ClientGUID"
|
|
|| " JOIN CV3ObservationDocumentCUR od WITH (NOLOCK)"
|
|
|| " ON cdd.ClientDocumentGUID = od.OwnerGUID "
|
|
|| " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
|
|
|| " ON od.ObsMasterItemGUID = ocmi.GUID"
|
|
|| " JOIN CV3ObservationCUR o WITH (NOLOCK)"
|
|
|| " ON o.GUID = od.ObservationGUID"
|
|
|| " JOIN CV3ObsCatalogItem oci WITH (NOLOCK)"
|
|
|| " ON oci.guid = o.ObsItemGUID"
|
|
|| " WHERE cd.ClientGUID = " || Sql(client_guid)
|
|
|| " AND cd.ChartGUID = " || Sql(client_chart_guid)
|
|
|| " AND cd.ClientVisitGUID = " || Sql(client_visit_guid)
|
|
|| " AND cd.DocumentName = {{{SINGLE-QUOTE}}}1.Vital Signs - Basic{{{SINGLE-QUOTE}}}"
|
|
|| " AND o.ValueText is not null"
|
|
|| " AND oci.Name IN ({{{SINGLE-QUOTE}}}Farenheit{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}},"
|
|
|| " {{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}},"
|
|
|| " {{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}})"
|
|
|| " AND DateDiff(HOUR, cd.AuthoredDtm, GETDATE()) <= 24"
|
|
|| " AND od.Active = 1"
|
|
|| " AND cdd.Active = 1"
|
|
|| " ORDER BY cd.AuthoredDtm"};
|
|
|
|
|
|
if ( exists vital_sign ) then
|
|
pulse_ox := "Pulse Ox: "; pulse_ox_value := ""; pulse_ox_datediff := 0;
|
|
temp := "T: "; temp_value := ""; temp_datediff := 0;
|
|
hr := "HR: "; hr_value := ""; hr_datediff := 0;
|
|
resp_rate := "R: "; resp_rate_value := ""; resp_rate_datediff := 0;
|
|
bp := "BP: "; bp_sys_value := ""; bp_sys_datediff := 0;
|
|
bp_dia_value := ""; bp_dia_datediff := 0;
|
|
|
|
for i IN 1 seqto ( count vital_sign ) do
|
|
|
|
if ( vital_sign[i] = "SCH_vs_pulse ox saturation" AND pulse_ox_datediff = 0 ) then
|
|
pulse_ox_value := vital_value[i];
|
|
pulse_ox_datediff := ( now - vital_date[i] );
|
|
elseif ( vital_sign[i] = "SCH_vs_pulse ox saturation" AND ( ( now - vital_date[i] ) <= pulse_ox_datediff ) ) then
|
|
pulse_ox_value := vital_value[i];
|
|
else
|
|
pulse_ox_datediff := ( now - vital_date[i] );
|
|
endif;
|
|
|
|
if ( vital_sign[i] = "Farenheit" AND temp_datediff = 0 ) then
|
|
temp_value := vital_value[i];
|
|
temp_datediff := ( now - vital_date[i] );
|
|
elseif ( vital_sign[i] = "Farenheit" AND ( ( now - vital_date[i] ) <= temp_datediff ) ) then
|
|
temp_value := vital_value[i];
|
|
else
|
|
temp_datediff := ( now - vital_date[i] );
|
|
endif;
|
|
|
|
if ( vital_sign[i] = "Heart Rate" AND hr_datediff = 0 ) then
|
|
hr_value := vital_value[i];
|
|
hr_datediff := ( now - vital_date[i] );
|
|
elseif ( vital_sign[i] = "Heart Rate" AND ( ( now - vital_date[i] ) <= hr_datediff ) ) then
|
|
hr_value := vital_value[i];
|
|
else
|
|
hr_datediff := ( now - vital_date[i] );
|
|
endif;
|
|
|
|
if ( vital_sign[i] = "Resp Rate" AND resp_rate_datediff = 0 ) then
|
|
resp_rate_value := vital_value[i];
|
|
resp_rate_datediff := ( now - vital_date[i] );
|
|
elseif ( vital_sign[i] = "Resp Rate" AND ( ( now - vital_date[i] ) <= resp_rate_datediff ) ) then
|
|
resp_rate_value := vital_value[i];
|
|
else
|
|
resp_rate_datediff := ( now - vital_date[i] );
|
|
endif;
|
|
|
|
if ( vital_sign[i] = "Noninvasive Systolic BP" AND bp_sys_datediff = 0 ) then
|
|
bp_sys_value := vital_value[i];
|
|
bp_sys_datediff := ( now - vital_date[i] );
|
|
elseif ( vital_sign[i] = "Noninvasive Systolic BP" AND ( ( now - vital_date[i] ) <= bp_sys_datediff ) ) then
|
|
bp_sys_value := vital_value[i];
|
|
else
|
|
bp_sys_datediff := ( now - vital_date[i] );
|
|
endif;
|
|
|
|
if ( vital_sign[i] = "Noninvasive Diastolic BP" AND bp_dia_datediff = 0 ) then
|
|
bp_dia_value := vital_value[i];
|
|
bp_dia_datediff := ( now - vital_date[i] );
|
|
elseif ( vital_sign[i] = "Noninvasive Diastolic BP" AND ( ( now - vital_date[i] ) <= bp_dia_datediff ) ) then
|
|
bp_dia_value := vital_value[i];
|
|
else
|
|
bp_dia_datediff := ( now - vital_date[i] );
|
|
endif;
|
|
|
|
enddo;
|
|
|
|
vital_sign_msg := vital_sign_msg || CRLF2 || TAB || vital_date[i] || SP2 || temp || temp_value
|
|
|| SP2 || hr || hr_value
|
|
|| SP2 || resp_rate || resp_rate_value
|
|
|| SP2 || bp || bp_sys_value || "/" || bp_dia_value
|
|
|| SP2 || pulse_ox || pulse_ox_value;
|
|
|
|
else
|
|
|
|
vital_sign_msg := vital_sign_msg || CRLF2 || TAB || "No vital signs charted in the last 24 hours.";
|
|
endif;
|
|
|
|
VitalParameterName := "SCH_FB_IRU Vital Signs";
|
|
VitalParameter := first of ( this_parameters WHERE this_parameters.Name = VitalParameterName );
|
|
|
|
this_currentVitalsObs := NEW ObservationType;
|
|
this_currentVitalsObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
|
|
this_currentVitalsObs.ParameterGUID := VitalParameter.ParameterGUID;
|
|
this_currentVitalsObs.DataType := "FreeTextValue";
|
|
this_currentVitalsObs.ValueObj := NEW FreeTextValueType;
|
|
this_currentVitalsObs.ValueObj.Value := vital_sign_msg;
|
|
|
|
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentVitalsObs );
|
|
|
|
|
|
//Retrieve applicable diagnostic MI / Cardiac results
|
|
medical_imaging_msg := "Medical Imaging Results in last 7 days";
|
|
|
|
( order_name,
|
|
order_dttm ) := READ {"SELECT DISTINCT {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} + o.Name + {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}, osh.CreatedWhen"
|
|
|| " FROM CV3ClientVisit v WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK) "
|
|
|| " ON v.GUID = o.ClientVisitGUID"
|
|
|| " AND v.ClientGUID = o.ClientGUID"
|
|
|| " AND v.ChartGUID = o.ChartGUID"
|
|
|| " JOIN CV3OrderStatusHistory osh WITH (NOLOCK)"
|
|
|| " ON o.GUID = osh.OrderGUID"
|
|
|| " AND o.ClientGUID = osh.ClientGUID"
|
|
|| " JOIN CV3OrderCatalogMasterItem om WITH (NOLOCK) "
|
|
|| " ON o.OrderCatalogMasterItemGUID = om.GUID"
|
|
|| " JOIN CV3OrganizationalUnit org WITH (NOLOCK) "
|
|
|| " ON om.OrgUnitGUID = org.GUID"
|
|
|| " WHERE v.ClientGUID = " || Sql(client_guid)
|
|
|| " AND v.GUID = " || Sql(client_visit_guid)
|
|
|| " AND v.ChartGUID = " || Sql(client_chart_guid)
|
|
|| " AND o.CreatedWhen >= dateadd(day, -7, getdate())"
|
|
|| " and o.CreatedWhen < DATEADD(day, 0, getdate())"
|
|
|| " AND o.TypeCode = {{{SINGLE-QUOTE}}}Diagnostic{{{SINGLE-QUOTE}}}"
|
|
|| " AND osh.FunctionCodeNum = {{{SINGLE-QUOTE}}}10{{{SINGLE-QUOTE}}}"
|
|
|| " AND ( org.code LIKE {{{SINGLE-QUOTE}}}%medical imaging%{{{SINGLE-QUOTE}}}"
|
|
|| " OR org.Code like {{{SINGLE-QUOTE}}}%cardiology%{{{SINGLE-QUOTE}}}"
|
|
|| " OR org.Code like {{{SINGLE-QUOTE}}}%cardiac%{{{SINGLE-QUOTE}}}"
|
|
|| " OR org.Code like {{{SINGLE-QUOTE}}}%eeg%{{{SINGLE-QUOTE}}})"};
|
|
|
|
if ( exists order_name ) then
|
|
|
|
Retreive_Attribute := "text_val";
|
|
Retreive_Object := "Results";
|
|
Filterable_Attribute := "itemname";
|
|
Filterable_Operator := "IN" ;
|
|
|
|
if ( count order_name = 1 ) then
|
|
Filterable_Value := first of ( order_name );
|
|
else
|
|
Filterable_Value := order_name;
|
|
endif;
|
|
|
|
Additional_condition := "";
|
|
|
|
// Call Impression Lookup MLM to get patient data
|
|
(All_Attributes_Lst, All_Med_Rel_Dttm_Lst, All_Values_Lst) := CALL Get_result_impression_lookup WITH
|
|
(client_guid, client_visit_guid, client_chart_guid, Is_Historical, Retreive_Object, Retreive_Attribute,
|
|
Filterable_Attribute, Filterable_Operator, Filterable_Value, Additional_condition);
|
|
|
|
if ( exists All_Values_Lst ) then
|
|
for i IN 1 seqto ( count All_Attributes_Lst ) do
|
|
medical_imaging_msg := medical_imaging_msg || CRLF2 || TAB || All_Attributes_Lst[i] || SP
|
|
|| All_Med_Rel_Dttm_Lst[i] || ": " || All_Values_Lst[i];
|
|
enddo;
|
|
else
|
|
medical_imaging_msg := medical_imaging_msg || CRLF2 || TAB || "No IMAGE diagnostic impressios Recorded.";
|
|
endif;
|
|
else
|
|
medical_imaging_msg := medical_imaging_msg || CRLF2 || TAB || "No IMAGE diagnostic impressions Recorded.";
|
|
endif;
|
|
|
|
MIParameterName := "SCH_FB_IRU_Diagnosis";
|
|
MIParameter := first of ( this_parameters WHERE this_parameters.Name = MIParameterName );
|
|
|
|
this_currentMIObs := NEW ObservationType;
|
|
this_currentMIObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
|
|
this_currentMIObs.ParameterGUID := MIParameter.ParameterGUID;
|
|
this_currentMIObs.DataType := "FreeTextValue";
|
|
this_currentMIObs.ValueObj := NEW FreeTextValueType;
|
|
this_currentMIObs.ValueObj.Value := medical_imaging_msg;
|
|
|
|
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentMIObs );
|
|
|
|
|
|
endif;
|
|
;;
|
|
evoke:
|
|
;;
|
|
logic: conclude true;
|
|
;;
|
|
action: return this_documentCommunication;
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|