267 lines
9.3 KiB
Plaintext
267 lines
9.3 KiB
Plaintext
maintenance:
|
|
|
|
title: DOC_FUNC_PAWSS;;
|
|
mlmname: DOC_FUNC_PAWSS;;
|
|
arden: version 2.5;;
|
|
version: 5.50;;
|
|
institution: Allscripts;;
|
|
author: Peggy Karish;;
|
|
specialist: Don Warnick;;
|
|
date: 2011-07-18;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Support PAWSS assessment in the Patient Profile
|
|
;;
|
|
explanation: Support PAWSS assessment in the Patient Profile
|
|
|
|
Change history
|
|
|
|
05.23.2016 DJW CSR#34250 PAWSS - Created
|
|
|
|
;;
|
|
keywords: pawss
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
|
|
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
using "ObjectsPlusXA.SCM.Forms";
|
|
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
|
|
|
msg := "";
|
|
|
|
(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;
|
|
|
|
|
|
TaskRoleType := read { " select cp.TaskRoleType from CV3USER u with (nolock) "
|
|
|| " join CV3CareProvider cp with (nolock) on cp.GUID = u.guid "
|
|
|| " where u.guid = " || sql(userGuid) || " and cp.TaskRoleType like {{{SINGLE-QUOTE}}}%infusion%{{{SINGLE-QUOTE}}} "
|
|
};
|
|
|
|
|
|
If not exists TaskRoleType
|
|
|
|
|
|
then
|
|
|
|
|
|
|
|
// DOCUMENT OPENING SECTION
|
|
|
|
|
|
IF thisdocumentCommunication.EventType = "DocumentOpening" then
|
|
|
|
// Retrieve Alcohol Level Plasma Serum
|
|
|
|
(Result) := read last
|
|
{
|
|
" select ov.value "
|
|
|| " from CV3BasicObservationView ov with (nolock) "
|
|
|| " where ov.ResultItemCodingStandard = {{{SINGLE-QUOTE}}}lab{{{SINGLE-QUOTE}}} and ov.ItemName = {{{SINGLE-QUOTE}}}ETOH Level{{{SINGLE-QUOTE}}} "
|
|
|| " and ov.clientguid = " || SQL (clientGuid) || " and ov.chartguid = " || SQL (chartGuid) || " and ov.clientvisitguid = " || SQL (visitGuid) || " "
|
|
|| " order by ov.value "
|
|
};
|
|
|
|
|
|
If Result is not null or Result <> "NONDETECTED"
|
|
|
|
then
|
|
|
|
// Populate the Result value in the Blood Alcohol box
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "PRO Blood alcohol level");
|
|
this_currentObj := NEW ObservationType;
|
|
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
|
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
|
this_currentObj.DataType := "FreeTextValue";
|
|
this_currentObj.ValueObj := New FreeTextValueType;
|
|
this_currentObj.ValueObj.Value := Result;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
// Select the "Alcohol in 30 days question"
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "PRO consumed any alcohol in last 30 days");
|
|
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 = "yes..." then selectedItem.IsSelected := true; endif;
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
endif; // Positive ETOH Level found
|
|
|
|
endif;
|
|
|
|
|
|
|
|
|
|
|
|
// DOCUMENT CLOSING SECTION
|
|
|
|
|
|
IF thisdocumentCommunication.EventType = "DocumentClosing"
|
|
|
|
then
|
|
|
|
|
|
// Check for PAWSS Score
|
|
|
|
theParameter := first of (thisParameters where thisParameters.Name = "PRO PAWSS Total Score 1");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
PAWWSScore := theObservation.ValueObj.Value;
|
|
|
|
|
|
if (PAWWSScore as number) > 3
|
|
|
|
then
|
|
|
|
|
|
// Check for existing CIWA Assessment Order on the account
|
|
|
|
(orderpresent) := read last
|
|
{
|
|
" select o.name "
|
|
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|
|
|| " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || chartGuid || " and o.ClientVisitGUID= " || VisitGuid || " "
|
|
|| " and o.name = {{{SINGLE-QUOTE}}}Contact Attending Physician to Implement AWD Protocol orders{{{SINGLE-QUOTE}}} "
|
|
|| " and o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) "
|
|
};
|
|
|
|
|
|
if orderpresent is null
|
|
|
|
then
|
|
|
|
// Enter CIAW Assessment Order
|
|
|
|
try
|
|
|
|
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n PAWSS Risk score is 4 or greater. Contact the attending physician to implement the Alcohol Withdrawal Protocol Order ", "Informational","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
|
|
|
|
|
|
|
locationGuid := read last {"SELECT CurrentLocationGUID, touchedWhen"
|
|
|| " FROM CV3ClientVisit with (nolock)"
|
|
|| " WHERE GUID = " || Sql(visitGuid)
|
|
|| " AND ClientGUID = " || Sql(clientGuid)
|
|
, primaryTime = touchedWhen};
|
|
|
|
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
|
care_provider_obj:= call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((userGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
|
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((locationGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
|
order_catalog_obj:= call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with ("Contact Attending Physician to Implement AWD Protocol orders");
|
|
endtry;
|
|
|
|
catch Exception ex
|
|
error_occurred := true;
|
|
error_message := "{{+R}}CommonData: {{-R}}\n" || ex.Message || "\n\n";
|
|
|
|
if order_catalog_obj is NOT Null then void := call order_catalog_obj.Dispose; order_catalog_obj := null; endif;
|
|
if location_obj IS NOT Null then void := call location_obj.Dispose; location_obj := null; endif;
|
|
if care_provider_obj IS NOT Null then void := call care_provider_obj.Dispose; care_provider_obj := null; endif;
|
|
if client_visit_obj IS NOT Null then void := call client_visit_obj.Dispose; client_visit_obj := null; endif;
|
|
endcatch;
|
|
|
|
try
|
|
Order_Creation_Reason := "Created per protocol";
|
|
RequestingSource := "Protocol Order";
|
|
SessionType := "Standard";
|
|
SessionReason := "";
|
|
|
|
Order_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
|
with client_visit_obj,
|
|
order_catalog_obj,
|
|
Order_Creation_Reason,
|
|
care_provider_obj,
|
|
RequestingSource,
|
|
SessionType,
|
|
SessionReason,
|
|
location_obj,
|
|
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
|
|
|
|
order_obj.SpecialInstructions := "Contact the attending physician to implement the alcohol withdrawal protocol orders.";
|
|
|
|
void := call Order_Obj.Save;
|
|
|
|
endtry;
|
|
|
|
catch Exception ex
|
|
error_occurred := true;
|
|
error_message := "{{+R}}New Other Order: {{-R}}\n" || ex.Message || "\n\n";
|
|
if Order_Obj IS NOT Null then void := call Order_Obj.Dispose; Order_Obj := null; endif;
|
|
endcatch;
|
|
|
|
if order_catalog_obj IS NOT Null then void := call order_catalog_obj.Dispose; order_catalog_obj := null; endif;
|
|
if location_obj IS NOT Null then void := call location_obj.Dispose; location_obj := null; endif;
|
|
if care_provider_obj IS NOT Null then void := call care_provider_obj.Dispose; care_provider_obj := null; endif;
|
|
if client_visit_obj IS NOT Null then void := call client_visit_obj.Dispose; client_visit_obj := null; endif;
|
|
|
|
|
|
endif; // Order already on file
|
|
|
|
|
|
endif; // PAWWS Score > 4
|
|
|
|
|
|
endif; // Document Closing
|
|
|
|
|
|
endif; // Not an infusion nurse
|
|
|
|
|
|
|
|
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke:
|
|
;;
|
|
logic:
|
|
|
|
|
|
|
|
|
|
|
|
conclude true;
|
|
|
|
|
|
;;
|
|
action:
|
|
return thisdocumentCommunication;
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|