232 lines
8.5 KiB
Plaintext
232 lines
8.5 KiB
Plaintext
maintenance:
|
|
|
|
title: SCH_PULMONARY_VISIT_COLUMN_UDPATE;;
|
|
mlmname: SCH_PULMONARY_VISIT_COLUMN_UPDATE;;
|
|
arden: version 2.50;;
|
|
version: 16.3;;
|
|
institution: St. Clair Hospital;;
|
|
author: Juliet M. Law, Allscripts Corp, x7461;;
|
|
specialist: Janet Nordin, Allscripts Corp, x7428;;
|
|
date: 2019-03-12;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Add value to Enterprise Defined Column on Pulmonary Visit List when a document is entered on a patient.
|
|
|
|
;;
|
|
|
|
explanation: When a user with a specialty of "Pulmonary" saves a Consult eNote or Physician Progress Note or Discharge Summary document, update the Pulmonary
|
|
Visit List "Pulmonary" Enterprise Defined Column with the value "Patient Seen".
|
|
|
|
|
|
Change history
|
|
|
|
03.12.2019 JML CSR #35844 Created
|
|
|
|
;;
|
|
keywords: ObjectsPlus/XA, Pulmonary, Enterprise Defined Column
|
|
|
|
;;
|
|
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;
|
|
|
|
//Include parsing MLM
|
|
//str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
|
|
|
//Include generic function to update enterprise defined column
|
|
create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
|
|
|
|
log_execution_info := false;
|
|
update_column := false;
|
|
pulmonary_col_value := "";
|
|
|
|
//Create Enterprise Defined Column Obj
|
|
EDCObj := OBJECT [
|
|
column_name,
|
|
column_value,
|
|
client_guid,
|
|
chart_guid,
|
|
client_visit_guid
|
|
];
|
|
|
|
//Event Triggers
|
|
client_doc_enter := event {ClientDocumentEnter User ClientDocument :
|
|
WHERE DocumentName = "Physician Progress Note"
|
|
OR DocumentName = "Consult eNote"
|
|
OR DocumentName = "Day of Discharge Summary eNote" };
|
|
client_doc_modify := event {ClientDocumentModify User ClientDocument :
|
|
WHERE DocumentName = "Physician Progress Note"
|
|
OR DocumentName = "Consult eNote"
|
|
OR DocumentName = "Day of Discharge Summary eNote" };
|
|
|
|
user_logon := event { ActivateApplication User UserInfo :
|
|
WHERE CareProvider IS NOT NULL
|
|
AND ( OrderRoleType matches pattern "%Physician%"
|
|
OR OrderRoleType = "CRNP" ) };
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
if called_by_editor
|
|
then
|
|
EvokingObject := read last { UserInfo : THIS };
|
|
endif;
|
|
|
|
|
|
//Retrieve relevant GUIDs
|
|
ActiveClient_Visit_GUID := EvokingObject.ClientVisitGUID;
|
|
ActiveClient_GUID := EvokingObject.ClientGUID;
|
|
ActiveChart_GUID := EvokingObject.ChartGUID;
|
|
|
|
care_prov_obj := read last { UserInfo : CareProvider };
|
|
|
|
user_discipline := care_prov_obj.Discipline;
|
|
|
|
|
|
if ( user_discipline = "Pulmonary" ) then
|
|
if ( EvokingEvent = user_logon ) then
|
|
//Retrieve a list of patient{{{SINGLE-QUOTE}}}s that have the Infectious Disease column value
|
|
(col_client_guid,
|
|
col_visit_guid) := read {"Declare @colName varchar(50)"
|
|
|| ""
|
|
|| "SELECT @colName = DataColumnName"
|
|
|| " FROM CV3EnterpriseColumnDef ecd WITH (NOLOCK) JOIN CV3EnterpriseColumnData ecd2 WITH (NOLOCK)"
|
|
|| " ON ecd.GUID = ecd2.ColumnDefinitionGUID"
|
|
|| " WHERE ColumnLabel = {{{SINGLE-QUOTE}}}Pulmonary{{{SINGLE-QUOTE}}}"
|
|
|| ""
|
|
|| " EXEC ({{{SINGLE-QUOTE}}}SELECT cv.ClientGUID, evd.VisitGUID{{{SINGLE-QUOTE}}} + "
|
|
|| " {{{SINGLE-QUOTE}}} FROM CV3EnterpriseVisitData evd WITH (NOLOCK) JOIN CV3CLIENTVISIT cv WITH (NOLOCK){{{SINGLE-QUOTE}}} +"
|
|
|| " {{{SINGLE-QUOTE}}} ON evd.VisitGUID = cv.GUID{{{SINGLE-QUOTE}}} +"
|
|
|| " {{{SINGLE-QUOTE}}} WHERE {{{SINGLE-QUOTE}}} + @colName + {{{SINGLE-QUOTE}}} = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}Patient Seen{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}"
|
|
|| " AND VisitGUID is not null"
|
|
|| " ORDER BY evd.touchedWhen{{{SINGLE-QUOTE}}})"};
|
|
|
|
if ( ( count col_client_guid ) > 0 ) then
|
|
|
|
update_column := true;
|
|
pulmonary_col_value := ();
|
|
pulmonary_client_guid := ();
|
|
pulmonary_visit_guid := ();
|
|
|
|
//Loop through patients that have Infectious Disease column value
|
|
for i IN 1 seqto ( count col_client_guid ) do
|
|
//Check for last time Infectious Disease column was valued
|
|
doc_client_guid := col_client_guid[i];
|
|
doc_visit_guid := col_visit_guid[i];
|
|
|
|
last_doc_update := read last {"SELECT 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"
|
|
|| " WHERE cv.ClientGUID = " || Sql(doc_client_guid)
|
|
|| " AND cv.GUID = " || Sql(doc_visit_guid)
|
|
|| " AND ( cd.DocumentName IN ( {{{SINGLE-QUOTE}}}Physician Progress Note-Pulmonary{{{SINGLE-QUOTE}}},"
|
|
|| " {{{SINGLE-QUOTE}}}Consult eNote-Pulmonary{{{SINGLE-QUOTE}}},"
|
|
|| " {{{SINGLE-QUOTE}}}Day of Discharge Summary eNote-Pulmonary{{{SINGLE-QUOTE}}} ))"
|
|
|| " ORDER BY cd.AuthoredDtm ASC"};
|
|
|
|
//Format dates to strings for easier comparision cuz dates/time in Arden stink
|
|
//last_str_date := extract month last_col_update[i] || "-" || extract day last_col_update[i] || "-" || extract year last_col_update[i];
|
|
last_str_date := extract month last_doc_update || "-" || extract day last_doc_update || "-" || extract year last_doc_update;
|
|
curr_str_date := extract month now || "-" || extract day now || "-" || extract year now;
|
|
|
|
//If Pulmonary document was entered today, then keep column value
|
|
//If Pulmnary document was entered yesterday, then clear column value
|
|
if ( ( last_str_date as string ) = ( curr_str_date as string ) ) then
|
|
pulmonary_col_value := (pulmonary_col_value, "Patient Seen");
|
|
pulmonary_client_guid := ( pulmonary_client_guid, doc_client_guid);
|
|
pulmonary_visit_guid := ( pulmonary_visit_guid, doc_visit_guid);
|
|
|
|
elseif ( ( last_str_date as string ) <> ( curr_str_date as string ) ) then
|
|
pulmonary_col_value := (pulmonary_col_value, "");
|
|
pulmonary_client_guid := ( pulmonary_client_guid, doc_client_guid);
|
|
pulmonary_visit_guid := ( pulmonary_visit_guid, doc_visit_guid);
|
|
endif;
|
|
|
|
enddo;
|
|
|
|
else
|
|
update_column := false;
|
|
endif;
|
|
else
|
|
|
|
if ( EvokingEvent = client_doc_modify ) then
|
|
//Extract authored DateTime from document currently being modified
|
|
curr_doc_authored := extract month EvokingObject.AuthoredDtm || "-" || extract day EvokingObject.AuthoredDtm || "-" || extract year EvokingObject.AuthoredDtm;
|
|
curr_str_date := extract month now || "-" || extract day now || "-" || extract year now;
|
|
|
|
if ( ( last_str_date as string ) = ( curr_str_date as string ) ) then
|
|
update_column := true;
|
|
pulmonary_col_value := "Patient Seen";
|
|
elseif ( ( last_str_date as string ) <> ( curr_str_date as string ) ) then
|
|
update_column := false;
|
|
pulmonary_col_value := "";
|
|
endif;
|
|
|
|
else
|
|
update_column := true;
|
|
pulmonary_col_value := "Patient Seen";
|
|
endif;
|
|
endif;
|
|
endif;
|
|
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke:
|
|
client_doc_enter;
|
|
client_doc_modify;
|
|
user_logon;
|
|
;;
|
|
logic:
|
|
if ( EvokingObject is null ) then
|
|
conclude false;
|
|
endif;
|
|
|
|
if ( update_column = true AND ( EvokingEvent = client_doc_enter OR EvokingEvent = client_doc_modify ) ) then
|
|
|
|
Pulmonary_Col := NEW EDCObj WITH [
|
|
column_name := "Pulmonary",
|
|
column_value := pulmonary_col_value,
|
|
client_guid := ActiveClient_GUID,
|
|
chart_guid := ActiveChart_GUID,
|
|
client_visit_guid := ActiveClient_Visit_GUID
|
|
];
|
|
|
|
return_value := call create_ED_column with ( Pulmonary_Col );
|
|
conclude true;
|
|
|
|
elseif ( update_column = true AND EvokingEvent = user_logon ) then
|
|
|
|
//Loop through the Infectious Disease column values and update
|
|
for j IN 1 seqto ( count pulmonary_col_value ) do
|
|
|
|
Pulmonary_Col := NEW EDCObj WITH [
|
|
column_name := "Pulmonary",
|
|
column_value := pulmonary_col_value[j],
|
|
client_guid := pulmonary_client_guid[j],
|
|
chart_guid := "",
|
|
client_visit_guid := pulmonary_visit_guid[j]
|
|
];
|
|
|
|
return_value := call create_ED_column WITH ( Pulmonary_Col );
|
|
enddo;
|
|
|
|
conclude true;
|
|
endif;
|
|
|
|
;;
|
|
action:
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|