227 lines
10 KiB
Plaintext
227 lines
10 KiB
Plaintext
maintenance:
|
|
|
|
title: MRSA Screening Logic;;
|
|
mlmname: DOC_FUNC_MRSA_Screen;;
|
|
arden: version 5.0;;
|
|
version: 2.00;;
|
|
institution: St.Clair Hospital;;
|
|
author: Teresa Spicuzza;;
|
|
specialist: ;;
|
|
date: 2010-12-21;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose:
|
|
;;
|
|
explanation:
|
|
Change history
|
|
|
|
12.21.2010 TS Created
|
|
05.04.2011 TS Added logic to check if patient has ever had screen done. If yes, do not order another if
|
|
updates made to patient profile.
|
|
09.27.2016 TS Eliminate current location of "St. Clair Hospital Anc" from proceeding through logic. Some
|
|
outpatient departments are using the Adult Patient Profile and screens are getting ordered
|
|
if patient has a history of MRSA. HD Ticket # 2372719
|
|
;;
|
|
keywords:
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
//Message box
|
|
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
using "ObjectsPlusXA.SCM.Forms";
|
|
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
|
|
|
|
|
// Receive 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;
|
|
clientvisitGuid := thisDocumentCommunication.ClientVisitGUID;
|
|
chartGuid := thisDocumentCommunication.ChartGUID;
|
|
todays_date := now;
|
|
|
|
// Get the current location
|
|
CurrentLocation := read last
|
|
{"Select CurrentLocation "
|
|
||" From cv3Clientvisit "
|
|
||" Where Guid = " || SQL(clientvisitguid)
|
|
||" and VisitStatus = {{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}}" };
|
|
|
|
|
|
|
|
// Chart Observation Section
|
|
|
|
IF thisdocumentCommunication.EventType is in ("ChartObservation", "DocumentClosing") and CurrentLocation <> "St. Clair Hospital Anc" then
|
|
|
|
//Obtain data items from standard mlm
|
|
MRSA_Rules_MLM := mlm {{{SINGLE-QUOTE}}}SCH_Func_MRSA_Order{{{SINGLE-QUOTE}}};
|
|
(ScreeningUnit, OrderedToday, OrderedWithin3, Positivescreen, SignificantDTM, StatusCode, ResultValue, MRSAHistory, NursingHomeResidency, AntiInfectivewithin7)
|
|
:= call MRSA_Rules_MLM with (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation);
|
|
|
|
//Obtain Value of Is Patient from Nursing Home from structured note
|
|
NursingHome := "";
|
|
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_MRSA nursing home");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
|
|
If true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
|
|
then NursingHome := "yes";
|
|
else NursingHome := "no";
|
|
endif;
|
|
|
|
//Set Order Screening Flag if patient meets criteria
|
|
formattedTextMRSA := " ";
|
|
|
|
If (MRSAHistory = "Yes" or NursingHome = "Yes" or ScreeningUnit ="Yes") and StatusCode is null //OrderedWithin3 = "No"
|
|
then OrderScreen := "Yes";
|
|
formattedTextMRSA := "Patient meets one or more Criteria for MRSA Screening and has not had a Nasal Screen ordered. Order is being placed for Nasal Screen for MRSA.";
|
|
endif;
|
|
If (MRSAHistory = "Yes" or NursingHome = "Yes" or ScreeningUnit ="Yes") and StatusCode is not null //OrderedWithin3 = "No"
|
|
then OrderScreen := "No";
|
|
formattedTextMRSA := "Patient meets one or more Criteria for MRSA Screening, but has a Nasal Screen already ordered or resulted.";
|
|
endif;
|
|
|
|
|
|
//Set which child order to enter based upon if patient has received antibiotics within 7 days
|
|
If AntiInfectivewithin7 = "Yes"
|
|
then Catalog_Item_ModifierVar := "MRSA Screen Antibiotics";
|
|
else Catalog_Item_ModifierVar := "Ordered Per Protocol";
|
|
endif;
|
|
|
|
|
|
//Mark the parameter to order screen based upon Screening Parameters on the structured note
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_MRSA order");
|
|
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" and orderscreen = "yes" then selectedItem.IsSelected := true; endif;
|
|
if selectedItem.Value = "no" and orderscreen = "no" then selectedItem.IsSelected := true; endif;
|
|
listItems := (listItems, selectedItem);
|
|
ENDDO;
|
|
this_currentobj.ValueObj.ListItemsList := listItems;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
// Populate the Info box
|
|
|
|
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_MRSA Order Info");
|
|
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 := formattedTextMRSA;
|
|
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
|
|
|
endif; //If event is ChartObservation or DocumentClosing
|
|
|
|
|
|
// Document Closing Event
|
|
|
|
IF thisdocumentCommunication.EventType = "DocumentClosing" and CurrentLocation <> "St. Clair Hospital Anc" then
|
|
|
|
// Determine if an order is to be placed
|
|
/*
|
|
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_MRSA order");
|
|
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
|
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "no")
|
|
then orderscreen := "no"; endif;
|
|
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
|
|
then orderscreen := "yes"; endif;
|
|
*/
|
|
|
|
// Place order for Nasal Screen for MRSA
|
|
if OrderScreen = "yes" then
|
|
SessionType := "Standard";
|
|
SessionReason := "";
|
|
RequestingSource := "";
|
|
user_IDType := "Edstan Number (physician)";
|
|
order_Creation_Reason := "From Protocol";
|
|
|
|
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((thisdocumentCommunication.ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
|
user_IDCode := "infectioncontrol";
|
|
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}}});
|
|
|
|
|
|
// Create a new Laboratory order from a Pre-Filled item
|
|
try
|
|
Catalog_Item_Name := "Nasal Screen for MRSA (Infection Control)";
|
|
Catalog_Item_Modifier := Catalog_Item_ModifierVar ;
|
|
Catalog_Item_Version := "";
|
|
Laboratory_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
|
|
PreFilled_DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
|
|
|
|
with
|
|
client_visit_obj, // ClientVisit ObjectsPlus object
|
|
Laboratory_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
|
Catalog_Item_Modifier, // string ItemNameModifier
|
|
Catalog_Item_Version, // string ItemNameModifierVersion
|
|
order_Creation_Reason, // string CreateReason
|
|
RequestingCareProvider_obj , // RequestedBy ObjectsPlus object
|
|
RequestingSource, // string RequestedBySource (must be in dictionary)
|
|
SessionType, // string SessionType
|
|
SessionReason, // string SessionReason
|
|
location_obj, // Location ReleaseLocGrpID
|
|
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
|
|
|
|
if ( Laboratory_catalog_item is NOT NULL ) then
|
|
void := call PreFilled_DiagnosticOrder_obj.Save;
|
|
void := call PreFilled_DiagnosticOrder_obj.Dispose;
|
|
void := call Laboratory_catalog_item.Dispose;
|
|
Laboratory_catalog_item:= null;
|
|
endif;
|
|
|
|
endtry;
|
|
|
|
catch Exception ex error_occurred := true; error_message := "{{+R}}New PreFilled Diagnostic order:{{-R}}\n" || ex.Message || "\n\n";
|
|
|
|
if ( Laboratory_catalog_item is NOT NULL ) then void:= call Laboratory_catalog_item.Dispose; Laboratory_catalog_item:= null; endif;
|
|
if ( PreFilled_DiagnosticOrder_obj is NOT NULL ) then void:= call PreFilled_DiagnosticOrder_obj.Dispose; PreFilled_DiagnosticOrder_obj:= null; endif;
|
|
|
|
PreFilled_DiagnosticOrder_dest := null;
|
|
|
|
endcatch;
|
|
|
|
endif; // End of Place order for Nasal Screen for MRSA
|
|
|
|
endif; // End of Document Closing Event
|
|
|
|
|
|
;;
|
|
evoke:
|
|
;;
|
|
logic: conclude true;
|
|
;;
|
|
action: return thisDocumentCommunication;
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|