Initial Checking with all 820 MLMs
This commit is contained in:
@@ -0,0 +1,259 @@
|
||||
maintenance:
|
||||
|
||||
title: zzzDOC_FUNC_CREATE_DIETITIAN_CONSULT_FROM_BRADEN_OBS;;
|
||||
mlmname: zzzDOC_FUNC_CREATE_DIETITIAN_CONSULT_FROM_BRADEN_OBS;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: Allscripts;;
|
||||
author: Juliet M. Law ;;
|
||||
specialist: ;;
|
||||
date: 2011-07-18;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Generate a Dietitian Consult Order from a Braden Score result.
|
||||
;;
|
||||
explanation: On the Adult Assessment/Intervention Flowsheet, if the Braden Risk criteria calculate a Braden score
|
||||
less than or equal to 14, then a Dietitian Consult order will automatically be generated, if one does not
|
||||
already exist for the patient.
|
||||
|
||||
Change History
|
||||
--------------
|
||||
2011-07-18 JML Created
|
||||
2014-05-02 JML WO# 161614: MLM re-write; Dietician consults erroneously created for Braden Scores.
|
||||
;;
|
||||
keywords: braden, dietitian consult, flowsheet
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
// RS ADD Message box
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
//Include ObjectsPlus Assemblies
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
//Include Called MLM to setup CDS objects
|
||||
set_cds_vars := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_DEFINITION_MLM{{{SINGLE-QUOTE}}};
|
||||
|
||||
(thisDocumentCommunication) := argument;
|
||||
|
||||
/**************Make Changes To Spelling And Flags In This Section**************/
|
||||
//Set up variables; initialize
|
||||
braden_param := "AS SC braden score CAL";
|
||||
dietitian_consult_name := "Dietitian Consult";
|
||||
|
||||
rcd_val := "";
|
||||
msg := "";
|
||||
braden_val_list := ();
|
||||
|
||||
//Required Objects+ Variables
|
||||
SessionType := "Standard";
|
||||
SessionReason := "";
|
||||
RequestingSource := "";
|
||||
Order_Creation_Reason := "Low Braden score entered";
|
||||
mlm_name := "DOC_FUNC_CREATE_DIETITIAN_CONSULT_FROM_BRADEN_OBS";
|
||||
|
||||
//Constants for document type and event
|
||||
DOCUMENTCLOSING := "DocumentClosing";
|
||||
CHARTOBSERVATION := "ChartObservation";
|
||||
FLOWSHEET := "Flowsheet";
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
//Initialize CDS objects via MLM call
|
||||
(thisDocumentCommunication, client_guid, client_visit_guid, chart_guid,
|
||||
user_guid, document_type, document_name, event_type,
|
||||
configuration_guid, this_currentObs, CancelEventFlag, this_fs_doc,
|
||||
authored_by_guid, isIOFlowsheetFlag, client_document_guid, this_parameters,
|
||||
this_columnList, this_currentColumn, this_chartedObservationsList,
|
||||
this_parameters_displayName, current_parameter, current_parameter_name, current_parameter_guid,
|
||||
current_parameter_datatype, selectedItems, selectedItems_Value, current_value,
|
||||
diagnostic_message, displayMessageFlag) := CALL set_cds_vars WITH (thisDocumentCommunication);
|
||||
|
||||
if ( event_type = DOCUMENTCLOSING ) then
|
||||
bradenParam := first of ( this_parameters WHERE this_parameters.Name = braden_param);
|
||||
|
||||
if ( exists bradenParam ) then
|
||||
if ( bradenParam.ParameterGUID = this_currentObs.ParameterGUID ) then
|
||||
theCurrentColumn := first of ( this_columnList WHERE this_columnList.ClientDocumentGUID = this_currentObs.ClientDocumentGUID);
|
||||
bradenObs := first of ( theCurrentColumn.ChartedObservationsList WHERE theCurrentColumn.ChartedObservationsList.ParameterGUID = bradenParam.ParameterGUID);
|
||||
|
||||
if ( exists bradenObs ) then
|
||||
|
||||
last_braden := bradenObs.ValueObj.Value as number;
|
||||
|
||||
if ( last_braden <= 14 ) then
|
||||
|
||||
//Braden score less than or equal to 14
|
||||
//Check for existence of Dietitian Consult Order
|
||||
(orderName) := read {"SELECT o.Name, o.TouchedWhen"
|
||||
|| " FROM CV3Order as o with (nolock) JOIN"
|
||||
|| " (CV3OrderCatalogMasterItem AS ocmi with (nolock)"
|
||||
|| " JOIN CV3OrderReviewCategory AS orc with (nolock)"
|
||||
|| " ON ocmi.OrderReviewCategoryGUID = orc.GUID)"
|
||||
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
|
||||
|| " WHERE o.ClientGUID = " || Sql(client_guid)
|
||||
|| " AND o.ClientVisitGUID = " || Sql(client_visit_guid)
|
||||
|| " AND o.ChartGUID = " || Sql(chart_guid)
|
||||
|| " AND ("
|
||||
|| " (o.Name = {{{SINGLE-QUOTE}}}" || dietitian_consult_name || "{{{SINGLE-QUOTE}}})"
|
||||
|| " OR ("
|
||||
|| " orc.Code LIKE {{{SINGLE-QUOTE}}}%Risk Assessment Referrals%{{{SINGLE-QUOTE}}}"
|
||||
|| " AND o.Name IN ({{{SINGLE-QUOTE}}}Cachexic Appearance{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}Chewing or Swallowing Difficulty{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}Currently Unable to Feed Self{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}Decubitis Pressure Ulcer Present{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}Mouth Pain- Prevents Eating{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}Nausea, Vomiting Excess over 3 days{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}Poor Appetite, Intake times 2 weeks{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}Recent Oral, Esophageal, or GI Cancer{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}SOB-Prevents Eating- CHF or COPD Only{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}Tube Feedings-Risk{{{SINGLE-QUOTE}}},"
|
||||
|| " {{{SINGLE-QUOTE}}}Weight Loss Unintentional>10 lbs in 3 mo{{{SINGLE-QUOTE}}})"
|
||||
|| " )"
|
||||
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}Dietitian Follow Up%{{{SINGLE-QUOTE}}})"
|
||||
|| " )"
|
||||
|| " AND"
|
||||
|| " ((o.OrderStatusLevelNum > 15"
|
||||
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))"
|
||||
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
|
||||
orderCount := count(orderName) as number;
|
||||
|
||||
if orderCount = 0 then
|
||||
//No Dietitian Consult Orders exist
|
||||
//Get the currently logged on user
|
||||
|
||||
//Get the locationGuid
|
||||
locationGuid := read last {"SELECT CurrentLocationGUID, touchedWhen"
|
||||
|| " FROM CV3ClientVisit with (nolock)"
|
||||
|| " WHERE GUID = " || Sql(client_visit_guid)
|
||||
|| " AND ClientGUID = " || Sql(client_guid)
|
||||
, primaryTime = touchedWhen};
|
||||
try
|
||||
//Retrieve .Net version of client visit object
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((client_visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
|
||||
//Use current user as default care provider
|
||||
care_provider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((user_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
//Get Location Obj
|
||||
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((locationGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
//Get the OrderCatalogMasterItem Obj
|
||||
order_catalog_obj := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
|
||||
with (dietitian_consult_name);
|
||||
|
||||
endtry;
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}CommonData: {{-R}}\n" ||
|
||||
ex.Message || "\n\n";
|
||||
|
||||
//Clean up
|
||||
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
|
||||
//Generate the Dietitian Consult Order
|
||||
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}}};
|
||||
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;
|
||||
|
||||
//Set UDDI field value on order (Indication for Consult)
|
||||
ret_val := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}}
|
||||
with "NUTR_Consult Reasons","Braden Score 14 or Less";
|
||||
|
||||
Order_Obj.SpecialInstructions := "Current Braden Score is " || last_braden || ".";
|
||||
|
||||
//Save order
|
||||
void := call Order_Obj.Save;
|
||||
|
||||
//CleanUp
|
||||
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;
|
||||
|
||||
if error_occurred then
|
||||
thisDocumentCommunication.DisplayMessage := true;
|
||||
thisDocumentCommunication.Message := error_message;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic: conclude true;
|
||||
;;
|
||||
action:
|
||||
return thisDocumentCommunication;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user