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

326 lines
11 KiB
Plaintext

maintenance:
title: SCH_DAY_OF_DISCHARGE_ALERT;;
mlmname: SCH_DAY_OF_DISCHARGE_ALERT;;
arden: version 2.5;;
version: 16.3;;
institution: St. Clair Hospital;;
author: Juliet M. Law;;
specialist: Peggy Leschak;;
date: 2019-04-12;;
validation: testing;;
library:
purpose: Alert the physician to missing DOH required information on Day of Discharge Summary eNote
;;
explanation: When filling out the Day of Discharge Summary eNote, the following fields are required by the DOH to contain values:
* Hospital Course and Significant History
* Results, Testing, Findings
* Procedures and Treatments
If one or more of these fields are empty at time of document save, then the physician will receive an alert.
Change History
---------------
2019.04.12 JML CSR 38075: Created
;;
keywords: ClientDocument; Day of Discharge; DOH;
;;
citations:
;;
knowledge:
type: data-driven;;
data:
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if logging is needed.*/
log_execution_info := false;
/* What is the name of the Flowsheet (Clinical Document)? */
/* If the name is changed here, it must also be changed in the EVENT statement */
clinical_document_name := "Day of Discharge Summary eNote";
/* What is the name of the Observation that will be used to chart Suspected Abuse? */
DOD_HospCourse_observation := "SCH_MDPN_DS_HospCourse";
DOD_ReasonHosp_observation := "SCH_MDPN_DS_ReasonHospital";
DOD_ResultReview_observation := "SCH_MDPN_Review";
DOD_OtherResults_observation := "SCH_MDPN_Other Results";
DOD_ProcTxReason_observation := "SCH_MDPN_DS_Proc Tx Reason";
DOD_ProcTxFT_observation := "SCH_MDPN_DS_Proc Tx FT";
/* What will the user chart to indicate a positive response? */
display_alert := false;
check_hospital_course := false;
check_results := false;
check_procedures := false;
alert_msg := "According to hospital bylaws charting is required in the following sections:";
Day_of_Discharge_doc_enter := event { ClientDocumentEnter User ClientDocument:
WHERE DocumentName = "Day of Discharge Summary eNote"};
Day_of_Discharge_doc_modify := event { ClientDocumentModify User ClientDocument:
WHERE DocumentName = "Day of Discharge Summary eNote"};
day_of_discharge_alert := destination { Alert: Warning, "Day of Discharge Alert",
High, chart, "Day of Discharge Missing Information", 7500 };
/***************************************************************************************/
/* This block executes only when this MLM is called by the editor */
if called_by_editor
then
EvokingObject := read last {ClientDocument : THIS};
endif;
/* Get the patient{{{SINGLE-QUOTE}}}s name*/
pat_name := read last
{ClientInfo: DisplayName };
/* Get the patient{{{SINGLE-QUOTE}}}s current location and ClientVisitGUID */
(pat_location,
pat_visit_guid ) := read last
{ClientVisit: CurrentLocation, GUID };
/* Get the received document{{{SINGLE-QUOTE}}}s name, and the pointers to the PatientCareDocument, */
/* to the flowsheet, and to the ClientObservation object */
(received_doc_name,
PatientCareDocObj,
ChartFlowsheetObj,
ClientObservationDocumentObj ) := read last
{ClientDocument : DocumentName, PatientCareDocument, ChartFlowsheet, ClientObservationDocument
REFERENCING EvokingObject };
/* Get the name of the results review observation and the pointer to */
/* the object that has the patient{{{SINGLE-QUOTE}}}s answer to the results review */
( HospReason_ObservationObj ) := read last { ClientObservationDocument : ClientObservation
REFERENCING ClientObservationDocumentObj
Where Name = DOD_ReasonHosp_observation };
(hosp_course_obs_display_name,
Hosp_Course_FSListValues_obj) := read last
{ClientObservationDocument: Name, ObsFSListValues
REFERENCING ClientObservationDocumentObj
WHERE Name = DOD_HospCourse_observation
};
( Other_Results_ObservationObj ) := read last { ClientObservationDocument : ClientObservation
REFERENCING ClientObservationDocumentObj
Where Name = DOD_OtherResults_observation
};
(results_review_obs_display_name,
Results_Review_FSListValues_obj):= read last
{ClientObservationDocument: Name, ObsFSListValues
REFERENCING ClientObservationDocumentObj
Where Name = DOD_ResultReview_observation
};
(ProcTreatment_ObservationObj ) := read last { ClientObservationDocument : ClientObservation
REFERENCING ClientObservationDocumentObj
Where Name = DOD_ProcTxFT_observation };
(proc_reason_obs_display_name,
Proc_Reason_FSListValues_obj) := read last
{ClientObservationDocument : Name, ObsFSListValues
REFERENCING ClientObservationDocumentObj
WHERE Name = DOD_ProcTxReason_observation
};
hosp_course_list := read
{ObsFSListValues : Value
REFERENCING Hosp_Course_FSListValues_obj };
hosp_reason_value := read last { ClientObservation : ValueText
REFERENCING HospReason_ObservationObj };
result_review_list := read
{ObsFSListValues: Value
REFERENCING Results_Review_FSListValues_obj };
other_results_value := read last { ClientObservation : ValueText
REFERENCING Other_Results_ObservationObj };
proc_reason_list := read
{ObsFSListValues : Value
REFERENCING Proc_Reason_FSListValues_obj };
proc_treatment_value := read last { ClientObservation : ValueText
REFERENCING ProcTreatment_ObservationObj };
if ( EvokingEventType = "ClientDocumentEnter" ) then
if ( ( count hosp_course_list = 0 ) AND ( hosp_reason_value IS NULL ) ) then
display_alert := true;
alert_msg := alert_msg || "\n\nHospital Course and Significant History";
endif;
if ( ( count result_review_list = 0 ) AND ( other_results_value IS NULL ) ) then
display_alert := true;
alert_msg := alert_msg || "\n\nResults, Tests, Finding";
endif;
if ( ( count proc_reason_list = 0 ) AND ( proc_treatment_value IS NULL ) ) then
display_alert := true;
alert_msg := alert_msg || "\n\nProcedures and Treatments";
endif;
elseif ( EvokingEventType = "ClientDocumentModify" ) then
//Determine which required observations have already been charted
( obsName,
obsValueText,
obsValueList ) := read { " SELECT ocmi.Name, obsparam.ValueText, SOBS.Value"
|| " FROM CV3ClientDocumentCUR cd WITH (NOLOCK) JOIN CV3OBSERVATIONDOCUMENTCUR od WITH (NOLOCK)"
|| " ON cd.GUID = od.OWNERGUID"
|| " AND cd.ArcType = od.ArcType"
|| " AND cd.ArcType = 0"
|| " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
|| " ON od.ObsMasterItemGUID = ocmi.GUID"
|| " JOIN SXACDObservationParameter obsparam WITH (NOLOCK)"
|| " ON cd.GUID = obsparam.OwnerGUID"
|| " AND od.ObservationDocumentGUID = obsparam.ObservationDocumentGUID"
|| " AND ocmi.GUID = obsparam.ObsMasterItemGUID"
|| " LEFT JOIN SCMObsFSListValues SOBS WITH (NOLOCK)"
|| " ON obsparam.ObservationDocumentGUID = SOBS.ParentGUID"
|| " AND obsparam.ClientGUID = SOBS.ClientGUID"
|| " WHERE cd.GUID = " || SQL(EVOKINGOBJECT.GUID)
|| " AND ocmi.Name IN ({{{SINGLE-QUOTE}}}SCH_MDPN_DS_HospCourse{{{SINGLE-QUOTE}}}"
|| " ,{{{SINGLE-QUOTE}}}SCH_MDPN_DS_ReasonHospital{{{SINGLE-QUOTE}}}"
|| " ,{{{SINGLE-QUOTE}}}SCH_MDPN_Review{{{SINGLE-QUOTE}}}"
|| " ,{{{SINGLE-QUOTE}}}SCH_MDPN_Other Results{{{SINGLE-QUOTE}}}"
|| " ,{{{SINGLE-QUOTE}}}SCH_MDPN_DS_Proc Tx Reason{{{SINGLE-QUOTE}}}"
|| " ,{{{SINGLE-QUOTE}}}SCH_MDPN_DS_Proc Tx FT{{{SINGLE-QUOTE}}}) "};
if ( ( NOT DOD_HospCourse_observation IN obsName ) AND ( NOT DOD_ReasonHosp_observation IN obsName ) ) then
check_hospital_course := true;
else
hosp_course_unanswered := false;
reason_hosp_unanswered := false;
for i IN 1 seqto count obsName do
if ( obsName[i] = DOD_HospCourse_observation ) then
if ( obsValueList[i] IS NULL ) then
hosp_course_unanswered := true;
endif;
endif;
if ( obsName[i] = DOD_ReasonHosp_observation ) then
if ( obsValueText[i] IS NULL ) then
reason_hosp_unanswered := true;
endif;
endif;
enddo;
if ( ( hosp_course_unanswered = true ) AND ( reason_hosp_unanswered = true ) ) then
check_hospital_course := true;
endif;
endif;
if ( ( NOT DOD_ResultReview_observation IN obsName ) AND ( NOT DOD_OtherResults_observation IN obsName ) ) then
check_results := true;
else
result_review_unanswered := false;
other_result_unanswered := false;
for j IN 1 seqto count obsName do
if ( obsName[j] = DOD_ResultReview_observation ) then
if ( obsValueList[j] IS NULL ) then
result_review_unanswered := true;
endif;
endif;
if ( obsName[j] = DOD_OtherResults_observation ) then
if ( obsValueText[j] IS NULL ) then
other_result_unanswered := true;
endif;
endif;
enddo;
if ( ( result_review_unanswered = true ) AND ( other_result_unanswered = true ) ) then
check_results := true;
endif;
endif;
if ( ( NOT DOD_ProcTxReason_observation IN obsName ) AND ( NOT DOD_ProcTxFT_observation IN obsName ) ) then
check_procedures := true;
else
proc_tx_reason_unanswered := false;
proc_tx_ft_unanswered := false;
for k IN 1 seqto count obsName do
if ( obsName[k] = DOD_ProcTxReason_observation ) then
if ( obsValueList[k] IS NULL ) then
proc_tx_reason_unanswered := true;
endif;
endif;
if ( obsName[k] = DOD_ProcTxFT_observation ) then
if ( obsValueText[k] IS NULL ) then
proc_tx_ft_unanswered := true;
endif;
endif;
enddo;
if ( ( proc_tx_reason_unanswered = true ) AND ( proc_tx_ft_unanswered = true ) ) then
check_procedures := true;
endif;
endif;
//If Observation was not previously charted, check to see if it was charted this time
if ( check_hospital_course = true ) then
if ( ( count hosp_course_list = 0 ) AND ( hosp_reason_value IS NULL ) ) then
display_alert := true;
alert_msg := alert_msg || "\n\nHospital Course and Significant History";
endif;
endif;
if ( check_results = true ) then
if ( ( count result_review_list = 0 ) AND ( other_results_value IS NULL ) ) then
display_alert := true;
alert_msg := alert_msg || "\n\nResults, Tests, Finding";
endif;
endif;
if ( check_procedures = true ) then
if ( ( count proc_reason_list = 0 ) AND ( proc_treatment_value IS NULL ) ) then
display_alert := true;
alert_msg := alert_msg || "\n\nProcedures and Treatments";
endif;
endif;
endif;
;;
evoke: Day_of_Discharge_doc_enter ;
Day_of_Discharge_doc_modify;
;;
logic: conclude true;
;;
action:
/*---------------------------------------------------*/
/* Always write an asynchronous alert to the chart */
/*---------------------------------------------------*/
if ( display_alert = true ) then
write alert_msg
at day_of_discharge_alert;
endif;
;;
end: