302 lines
13 KiB
Plaintext
302 lines
13 KiB
Plaintext
maintenance:
|
|
|
|
title: DOC_FUNC_POLST;;
|
|
mlmname: DOC_FUNC_POLST;;
|
|
arden: version 5.0;;
|
|
version: 2.00;;
|
|
institution: St.Clair Hospital;;
|
|
author: Don Warnick;;
|
|
specialist: ;;
|
|
date: 2012-08-13;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose:
|
|
;;
|
|
explanation: This MLM manages the POLST portion of the Patient Profiles.
|
|
It will make an order if a request for infomration is charted....this makes a worklist task
|
|
|
|
|
|
Change history
|
|
|
|
08.13.2012 DW CSR# 30902 - Copied from Doc_Func_Advance_Directive
|
|
10.23.2017 JML CSR# 26413 - Modified to include POLST scanning
|
|
|
|
;;
|
|
keywords:
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
// RS ADD Message box
|
|
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
using "ObjectsPlusXA.SCM.Forms";
|
|
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
|
|
|
|
|
// Recieve arguments from the structured note
|
|
(thisDocumentCommunication) := argument;
|
|
|
|
// Extract interesting parts of the object model
|
|
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
|
|
(thisParameters) := thisStructuredNoteDoc.ParametersList;
|
|
(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];
|
|
DateValueType := 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;
|
|
userGuid := thisDocumentCommunication.UserGUID;
|
|
|
|
|
|
// DOCUMENT OPENING SECTION
|
|
IF thisdocumentCommunication.EventType = "DocumentOpening" then
|
|
|
|
// Initialize the "POLST Order" button
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_POLST Order Patient Profile");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.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 = "-" then
|
|
selectedItem.IsSelected := false;
|
|
endif;
|
|
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
// Check to see if there is a POLST on file comment = Y on file
|
|
(POLSTOnFile) := read {" select text from CV3CommentDeclaration with (nolock) where TypeCode = {{{SINGLE-QUOTE}}}POLSTONFILE{{{SINGLE-QUOTE}}} and clientguid = " || ClientGuid || " and TEXT = {{{SINGLE-QUOTE}}}Y{{{SINGLE-QUOTE}}}" };
|
|
|
|
// Check to see if the "on file at on file at St. Clair Hospital" button was previously checked. If so set Onfilechecked_before = yes.
|
|
Onfilechecked_before:= "no";
|
|
Onfilechecked_after := "no";
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Yes_POLST");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "on file at St. Clair Hospital") then
|
|
Onfilechecked_before := "yes";
|
|
else
|
|
Onfilechecked_before := "no";
|
|
endif;
|
|
|
|
// If there is an Advance Directive comment = Y on file the select the appropriate radio buttons and set Onfilechecked_after = "yes"
|
|
if exist POLSTOnFile then
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_POLST_Question");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.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 = "Has Penna Orders for Life Sustaining Treatment (POLST)" then
|
|
selectedItem.IsSelected := true;
|
|
endif;
|
|
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Yes_POLST");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.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 = "on file at St Clair Hospital" then
|
|
selectedItem.IsSelected := true;
|
|
Onfilechecked_after := "yes";
|
|
endif;
|
|
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
// Determine the Document name and whether the user is a nurse
|
|
DocumentName:= thisDocumentCommunication.documentname;
|
|
|
|
if DocumentName in ("Adult Patient Profile - Behavioral Health Outpatient","Adult Patient Profile - Infusion") then
|
|
suppressforthisdocument := "yes";
|
|
else
|
|
suppressforthisdocument := "no";
|
|
endif;
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "sch_notmandatory1");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes") then
|
|
nurse := "yes";
|
|
else
|
|
nurse := "no";
|
|
endif;
|
|
|
|
// Display message box reminder if approriate Document Name, User is RN, and the "request for info button" was changed from no to yes
|
|
if Onfilechecked_before = "no" and Onfilechecked_after = "yes" and nurse = "yes" and suppressforthisdocument = "no" then
|
|
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n There is a scanned POLST document on file. \n\n Retrieve the most current document, print it and place it on the chart" , "Reminder","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
|
endif;
|
|
endif;
|
|
endif;
|
|
|
|
|
|
// CHART OBSERVATION SECTION
|
|
|
|
|
|
IF thisdocumentCommunication.EventType = "ChartObservation" then
|
|
|
|
// "No POLST" Buttons Section
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_No_Polst");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
if thisDocumentCommunication.CurrentObservationObj.parameterguid = theParameter.ParameterGUID
|
|
then
|
|
|
|
// "Requests Information on how to complete polst" button Section (Update the "POLST Order" button)
|
|
a := theObservation.ValueObj.ListItemsList.IsSelected;
|
|
|
|
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "requests information on how to complete polst")
|
|
then RequestForInformationSelected := "yes"; else RequestForInformationSelected := "no"; endif;
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_POLST Order Patient Profile");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.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 = "-" and RequestForInformationSelected = "yes" then selectedItem.IsSelected := true; else selectedItem.IsSelected := false; endif;
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
endif; // "Requests information..." button is selected
|
|
|
|
endif; // CHART OBSERVATION SECTION
|
|
|
|
|
|
|
|
// DOCUMENT CLOSING SECTION
|
|
|
|
|
|
IF thisdocumentCommunication.EventType = "DocumentClosing" then
|
|
|
|
// If the "POLST Order" button is set to "Yes", then make a new order
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_POLST Order Patient Profile");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "-")
|
|
then placeorder := "yes"; else placeorder := "no";
|
|
endif;
|
|
|
|
If placeorder = "yes"
|
|
then
|
|
try
|
|
|
|
NextHour:= EXTRACT HOUR currenttime + 1 || ":00";
|
|
|
|
SessionType := "Standard";
|
|
SessionReason := "";
|
|
RequestingSource := "";
|
|
user_IDType := "Edstan Number (physician)";
|
|
order_Creation_Reason := "From Test MLM";
|
|
orderItemName := "Patient requests information on completing POLST";
|
|
Catalog_Item_Modifier := NextHour;
|
|
Catalog_Item_Version := "";
|
|
|
|
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) );
|
|
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || thisdocumentCommunication.ClientGUID};
|
|
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
|
general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with orderItemName;
|
|
|
|
GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
|
with client_visit_obj,
|
|
general_catalog_item,
|
|
Catalog_Item_Modifier,
|
|
Catalog_Item_Version,
|
|
order_creation_reason,
|
|
RequestingCareProvider_obj,
|
|
RequestingSource,
|
|
SessionType,
|
|
SessionReason,
|
|
location_obj,
|
|
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
|
|
|
|
void := call GeneralOrder_Obj.Save;
|
|
void := call GeneralOrder_Obj.Dispose;
|
|
|
|
endtry;
|
|
|
|
// Exception Handling
|
|
catch Exception ex
|
|
debugFlag := true;
|
|
messageText := messageText || "New General Order:\n" || ex.Message || "\n\n";
|
|
endcatch;
|
|
|
|
// Clean UP
|
|
if (location_obj IS NOT NULL) then void := call location_obj.Dispose; location_obj := NULL; endif;
|
|
if (requesting_care_provider_obj IS NOT NULL) then void := call requesting_care_provider_obj.Dispose; requesting_care_provider_obj := NULL; endif;
|
|
if (general_catalog_item IS NOT NULL) then void := call general_catalog_item.Dispose; general_catalog_item := NULL; endif;
|
|
if (client_visit_obj IS NOT NULL) then void := call client_visit_obj.Dispose; client_visit_obj := NULL; endif;
|
|
|
|
endif; // End of Place Order = Yes section
|
|
|
|
endif; // End of Close Document
|
|
|
|
;;
|
|
evoke:
|
|
;;
|
|
logic: conclude true;
|
|
;;
|
|
action: return thisDocumentCommunication;
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|