426 lines
22 KiB
Plaintext
426 lines
22 KiB
Plaintext
maintenance:
|
||
|
||
title: Called MLM to support ORM from Form Open;;
|
||
filename: FORM_S2V_ORM_FormOpen;;
|
||
arden: version 2.5;;
|
||
version: 1.11;; //5.5 FP1 - MLM Version 11
|
||
institution: Allscripts, Speed to Value MLM;;
|
||
author: Allscripts, Phil Thomas;;
|
||
specialist: ;;
|
||
date: 2012-10-23;;
|
||
validation: testing;;
|
||
library:
|
||
purpose:
|
||
|
||
Modification History
|
||
02-01-2012 - Phil Thomas - New MLM to support 5.5 FP1 ORM by hiding or un-hiding the MultumDrugName UDDI based upon discharge session type used.
|
||
|
||
02-09-2012 - Jeff Moore - Modified to exclude non-formulary forms from having the MultumDrugName UDDI controlled by this MLM
|
||
|
||
06-09-2012 - Phil Thomas - Added a check for the required medication form fields and if NULL or required then display the form
|
||
|
||
07-27-2012 - Phil Thomas - Added a check to the required fields update to only evaluate and display the form if the
|
||
triggering call was FormOpen
|
||
|
||
08-10-2012 - Phil Thomas - Added logic to display the home medication instructions as a banner alert, if the inpatient order entry form
|
||
is displayed to the end user. If an inpatient order is being created from a home medication that has multiple entries
|
||
in the OMP, the system will display the banner alert with *Duplicate* at the beginning of the message and display
|
||
the information from the last entry in the OMP.
|
||
|
||
08-13-2012 - Phil Thomas - Added additional funtionality to warn a clinician if the matching home medication to an admission converted inpatient order was
|
||
not reviewed or entered in the current visit.
|
||
|
||
10-23-2012 - Jeff Moore - Fixed a logic issue where the non-reviewed medication message might not have appeared consistently
|
||
|
||
;;
|
||
explanation: This MLM is designed to run from FORM OPEN and will modify the field properties for "MultumDrugName", "RxQuantityAmount_SCM" and "RxDurationAmount_SCM" fields
|
||
based upon if the session type is a discharge or not. In the S2V build this is a sub-called MLM from the "Form_FormOpen_Coord" MLM.
|
||
|
||
Change History
|
||
04.11.2017 TMS CSR 35364: Added logic to set a checkbox on the form if opened from ORM and to value SCH indication fields for medications that can be used
|
||
as chemical restraints to {{{SINGLE-QUOTE}}}home medication regimen{{{SINGLE-QUOTE}}}
|
||
07.23.2019 TMS CSR 37676: Change log_execution_info to false per upgrade analysis.
|
||
|
||
*** Allscripts Disclaimer:
|
||
Client is responsible for all decisions, acts, and omissions of any persons in connection with the delivery of medical care or other services to any patients.
|
||
Before any Licensed Materials are placed into a live production environment, it is Client’s responsibility to review and test all Licensed Materials and associated
|
||
workflows and other content, as implemented, make independent decisions about system settings and configuration based upon Client’s needs, practices, standards and
|
||
environment, and reach its own independent determination that they are appropriate for such live production use. Any such use by Client (or its Authorized Users)
|
||
will constitute Client’s representation that it has complied with the foregoing. Client shall ensure that all Authorized Users are appropriately trained in use of
|
||
the then-deployed release of the Software prior to their use of the Software in a live production environment. Clinical Materials are tools to assist Authorized
|
||
Users in the delivery of medical care, but should not be viewed as prescriptive or authoritative. Clinical Materials are not a substitute for, and Client shall
|
||
ensure that each Authorized User applies in conjunction with the use thereof, independent professional medical judgment. Clinical Materials are not designed for use,
|
||
and Client shall not use them, in any system that provides medical care without the participation of properly trained personnel. Any live production use of Clinical
|
||
Materials by Client (or its Authorized Users) will constitute Client’s acceptance of clinical responsibility for the use of such materials.
|
||
;;
|
||
keywords: Called MLMs, Form fields, Form Open, Orders Reconciliaition, MultumDrugName;
|
||
;;
|
||
knowledge:
|
||
type: data-driven;;
|
||
data:
|
||
|
||
// This MLM is passed three arguments, of types
|
||
// communication_type, form_type and client info object respectively.
|
||
|
||
(this_communication, // Communication object
|
||
this_form, // Form object
|
||
client_info_obj //Arden ClientInfo object
|
||
) := argument;
|
||
|
||
|
||
/*******************Make Changes To Spelling And Flags In This Section*******************/
|
||
|
||
/* Set to true if a decision.log is needed.*/
|
||
log_execution_info := FALSE; //Set to FALSE for Production
|
||
|
||
//Indicate the PRN Reason UDDI Name used on your Medication order forms
|
||
// (tms) PRN_Reason_UDDI := "PRNReasonText"; //PRNReasonText is the system supplied value
|
||
PRN_Reason_UDDI := "PRX_PRNCONDITION"; //PRNReasonText is the system supplied value
|
||
|
||
//Should the Home Medication Instructions appear in the banner of the order entry form if it is forced to display due to a required field missing?
|
||
Enable_Hx_Instructions_in_Banner := TRUE;
|
||
|
||
//Should the clinician be warned whenever a home medication being converted to an admission inpatient medication was not reviewed or entered in the current visit?
|
||
//Note: The Banner rule above will be overridden by this rule if this warning message appears
|
||
// (tms) Enable_Non_Review_Notify := TRUE;
|
||
Enable_Non_Review_Notify := FALSE;
|
||
|
||
/******************Do Not Make Changes Below this Line!**********************************/
|
||
|
||
|
||
Order_GUID := this_communication.ItemID;
|
||
Order_Form := this_communication.FormType;
|
||
Order_Type := this_communication.OrderType;
|
||
Order_Name := this_communication.OrderName;
|
||
Display_Form_Init:= this_communication.DisplayForm;
|
||
OrderCatalogItemGUID := this_Communication.ItemID;
|
||
ClientGUID := this_Communication.ClientGUID;
|
||
ClientVisitGUID := this_Communication.ClientVisitGUID;
|
||
|
||
//capture the Order Session type used found in the primary object
|
||
Primary_Obj := this_communication.PrimaryObj;
|
||
Session_Type := Primary_Obj.InitialSessionTypeCode;
|
||
Internal_Session_Type := Primary_Obj.InternalProcessingType;
|
||
order_source := primary_Obj.SourceCode;
|
||
DC_Session_Type:= primary_Obj.IsForDischarge;
|
||
Display_Form_Init:= this_communication.DisplayForm;
|
||
|
||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||
include standard_libs;
|
||
using "ObjectsPlusXA.SCM.Forms";
|
||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||
|
||
CR := 13 formatted with "%c";
|
||
LF := 10 formatted with "%c";
|
||
CRLF:= CR||LF;
|
||
TAB := 9 formatted with "%c";
|
||
|
||
|
||
//Capture the Calling Event
|
||
Calling_Event := this_communication.CallingEvent;
|
||
|
||
|
||
AdmitDateTime := read last
|
||
{ "Select AdmitDtm From CV3ClientVisit"
|
||
|| " Where GUID = " || SQL(ClientVisitGUID) };
|
||
|
||
/***************************************************************************************/
|
||
|
||
// Initialize error message
|
||
error_message:="";
|
||
Form_Displayed := FALSE;
|
||
RX_DrugName := NULL;
|
||
Dup_Home_Med := FALSE;
|
||
Reviewed_This_Visit := FALSE;
|
||
|
||
// Assigns fields passed in the Form object to the Field object
|
||
field_list:= this_form.fields;
|
||
NoDefaults := first of (field_list
|
||
where field_list.DataItemName = "PRX_NoDefaultValues");
|
||
ChemRestraintInd := last of (field_list
|
||
where field_list.DataItemName = "NUR_Nonchemical Restraint Ind" );
|
||
MedMgtCB := last of (field_list
|
||
where field_list.DataItemName = "NUR_Not Chemical Restraint" );
|
||
|
||
//***Sample Code to add to determine if the form is being opened in ORM during admission reconciliation
|
||
//If this is not a Discharge Session and the form was set to not display then
|
||
// confirm this in the configuration of the Catalog Item Class Type Entry and
|
||
// if the Multum Drug Name UDDI was valued (generally by ORM itself).
|
||
If Not DC_Session_Type and Display_Form_Init = "No" and this_communication.OrderSet = "No" Then
|
||
//Assumes the MulumDrugName field is present
|
||
// MultumDrugName_field := first of (field_list where field_list.DataItemName =
|
||
// "MultumDrugName");
|
||
// If Exist MultumDrugName_field and MultumDrugName_field.Value Is Not NULL then
|
||
// MultumDrugName_field_Value := MultumDrugName_field.Value;
|
||
//Query to see if this item was configured for Do Not Display Form Option
|
||
//(ORM sets the above property based upon this)
|
||
Item_Guid := Read Last
|
||
{" SELECT CV3CatalogClassTypeValue.CatalogMasterGUID FROM
|
||
CV3CatalogClassTypeValue INNER JOIN"
|
||
|| " CV3ClassType ON CV3CatalogClassTypeValue.ClassTypeGUID =
|
||
CV3ClassType.GUID"
|
||
|| " WHERE CV3ClassType.Code = {{{SINGLE-QUOTE}}}SYS-ORM-OpenFormAtConversion{{{SINGLE-QUOTE}}} AND
|
||
CV3CatalogClassTypeValue.CatalogMasterGUID = " || SQL(OrderCatalogItemGUID)
|
||
|| " AND CV3CatalogClassTypeValue.Value = {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} "};
|
||
|
||
//Set a flag that this order form is opening due to an admission orders reconciliation action
|
||
If Item_Guid Is Not NULL then
|
||
Is_From_ORM_Admit := TRUE;
|
||
NoDefaults.value := "True";
|
||
If( exists ChemRestraintInd and ChemRestraintInd.value is null) and ( exists MedMgtCB and MedMgtCb.value = false) then
|
||
|
||
ChemRestraintInd.value := "Home Medication Regimen";
|
||
MedMgtCb.value := true;
|
||
endif;
|
||
|
||
Endif;
|
||
// Endif;
|
||
Endif;
|
||
|
||
//Section to Hide the ORM fields when the Session Type is not a Discharge Session
|
||
//This is the query to determine if the item is configured as a Non-Formulary to be used within ORM
|
||
//This is determine by checking if the item has the use this item for unmapped prescriptions checkbox checked
|
||
(Unmapped_Rx) := read last
|
||
{" select Name"
|
||
||" from CV3OrderCatalogMasterItem "
|
||
||" where CV3OrderCatalogMasterItem.GUID = "|| sql (Order_GUID)
|
||
||" and CV3OrderCatalogMasterItem.IsUnmappedPrescriptionItem = 1 "
|
||
, primarytime = significantdtm};
|
||
|
||
|
||
// Capture the RxDurationAmount_SCM and RxQuantityAmount_SCM fields and MultumDrugName
|
||
Rx_Duration := first of (field_list where field_list.DataItemName = "RxDurationAmount_SCM");
|
||
Rx_Quantity := first of (field_list where field_list.DataItemName = "RxQuantityAmount_SCM");
|
||
Drug_Name := first of (field_list where field_list.DataItemName = "MultumDrugName");
|
||
|
||
|
||
//Capture required Dosing Fields and check if NULL to override ORM from not displaying the form and prevent
|
||
// The user from getting the standard order entry mandatory field pop-up message
|
||
CalculatedDose_field := first of (field_list where field_list.DataItemName = "CalculatedDose");
|
||
If exists CalculatedDose_field then
|
||
CalculatedDose_obj := OBJECT [DosageLow, CalcActualDose,
|
||
CalcOverrideReason, CalcRequestedDose, CalcTotalDailyDose,
|
||
CalcDoseUOM, CalcUOMPer];
|
||
CalculatedDoseValue := CalculatedDose_field.Value;
|
||
//If the Dose is empty and the calling event was Form Open the display the form to avoid the pop-up message
|
||
If CalculatedDoseValue.DosageLow Is NULL and Calling_Event = "FormOpen" then
|
||
this_communication.DisplayForm := "Yes";
|
||
Form_Displayed := TRUE;
|
||
Endif;
|
||
Endif;
|
||
|
||
//DoseageLow Check for NULL from ORM
|
||
DosageLow_field := first of (field_list where field_list.DataItemName = "DosageLow");
|
||
//If the Dose is empty and the calling event was Form Open the display the form to avoid the pop-up message
|
||
If exists DosageLow_field and DosageLow_field.Value Is NULL and Calling_Event = "FormOpen" then
|
||
this_communication.DisplayForm := "Yes";
|
||
Form_Displayed := TRUE;
|
||
Endif;
|
||
|
||
//Frequency Check for NULL from ORM
|
||
Freq_field := first of (field_list where field_list.DataItemName = "FrequencyCode");
|
||
If exists Freq_field and Freq_field.control_mandatory then Freq_field_Value := Freq_field.Value;
|
||
Freq_field_FrequencySummary := Freq_field_value.FrequencySummary;
|
||
//If the Freq is empty and the calling event was Form Open the display the form to avoid the pop-up message
|
||
If Freq_field_FrequencySummary Is NULL and Calling_Event = "FormOpen" then
|
||
this_communication.DisplayForm := "Yes";
|
||
Form_Displayed := TRUE;
|
||
Endif;
|
||
Endif;
|
||
|
||
//PRN Check for value if set to mandatory
|
||
PRN_Reason_field := first of (field_list where field_list.DataItemName = PRN_Reason_UDDI);
|
||
If exists PRN_Reason_field and PRN_Reason_field.Value Is NULL then
|
||
//If the PRN Reason is empty + mandatory and the calling event was Form Open the display the form to avoid the pop-up message
|
||
If PRN_Reason_field.control_mandatory and Calling_Event = "FormOpen" then
|
||
this_communication.DisplayForm := "Yes";
|
||
Form_Displayed := TRUE;
|
||
Endif;
|
||
Endif;
|
||
|
||
//Route Code Check for value if set to mandatory
|
||
Route_field := first of (field_list where field_list.DataItemName = "OrderRouteCode");
|
||
//If the Route field is empty + mandatory and the calling event was Form Open the display the form to avoid the pop-up message
|
||
If exists Route_field and Route_field.Value Is NULL then
|
||
If Route_field.control_mandatory and Calling_Event = "FormOpen" then
|
||
this_communication.DisplayForm := "Yes";
|
||
Form_Displayed := TRUE;
|
||
Endif;
|
||
Endif;
|
||
|
||
|
||
//*****UN-Hide Section for Discharge Sessions******//
|
||
|
||
//Unhide the form fields if the Discharge Session Type is used
|
||
//This code uses the Session Type Name configured (use if only one)
|
||
//If exist Drug_Name AND Session_Type = "Discharge Orders" then //Name must match config
|
||
|
||
//Use this code to use the Internal Session Type (use if more than one)
|
||
If exist Drug_Name AND Internal_Session_Type = "Discharge" and Unmapped_Rx is null then
|
||
|
||
// Un-Hide each field if it exists
|
||
If exists Rx_Duration then Rx_Duration.control_visible := TRUE;
|
||
Rx_Duration.CONTROL_READ_ONLY := FALSE;
|
||
Endif;
|
||
|
||
If exists Rx_Quantity then Rx_Quantity.control_visible := TRUE;
|
||
Rx_Quantity.CONTROL_READ_ONLY := FALSE;
|
||
Endif;
|
||
|
||
If exists Drug_Name then
|
||
Drug_Name.control_visible := TRUE;
|
||
Drug_Name.control_mandatory := TRUE;
|
||
Drug_Name.CONTROL_READ_ONLY := FALSE;
|
||
Endif;
|
||
Endif; //End of new Discharge Session Type Field Control Logic
|
||
|
||
|
||
//*****Hide Section for non-Discharge Sessions******//
|
||
|
||
//Now hide the form fields if the Session Type other than Discharge is used
|
||
|
||
//This code uses the Session Type Name configured (use if only one)
|
||
//If exist Drug_Name AND Session_Type <> "Discharge Orders" then //Name must match config
|
||
|
||
//Use this code to use the Internal Session Type (use if more than one)
|
||
If exist Drug_Name AND Internal_Session_Type <> "Discharge" AND Unmapped_Rx is null then
|
||
|
||
// Hide each field if it exists
|
||
If exists Rx_Duration then Rx_Duration.control_visible := FALSE;
|
||
Rx_Duration.CONTROL_READ_ONLY := TRUE;
|
||
Endif;
|
||
|
||
If exists Rx_Quantity then Rx_Quantity.control_visible := FALSE;
|
||
Rx_Quantity.CONTROL_READ_ONLY := TRUE;
|
||
Endif;
|
||
|
||
If exists Drug_Name then
|
||
Drug_Name.control_visible := FALSE;
|
||
Drug_Name.control_mandatory := FALSE;
|
||
Drug_Name.CONTROL_READ_ONLY := TRUE;
|
||
Endif;
|
||
Endif; //End of new Discharge Session Type Field Control Logic
|
||
|
||
|
||
//New Logic to attempt to pull the Home Medication instructions and display on the Order Entry Form Banner if the form is formed to open like for a mandatory PRN Reason
|
||
//If Not Form_Displayed AND Is_From_ORM_Admit Then
|
||
If Is_From_ORM_Admit Then
|
||
|
||
//Query to figure out what home medication was selected based upon the catalog item mapping configruation
|
||
(RX_DrugName, RX_DoseAmt, RX_Route, RX_Instructions, RX_Comments, RX_Memo, RX_PharmMemo, RX_PRNReason, RX_GenericID, RX_Type, RX_Status, OMR_LastDose, OMR_RXFreq_ID, ORD_OCMI, RX_IsPRN, RX_TouchedWhen) := READ
|
||
{"SELECT cp.DrugName, cp.DoseAmount, cp.Route, cp.Instructions, cp.Comments, cp.Memo, cp.PharmacyMemo, cp.PrnReason, cp.GenericItemID, "
|
||
|| "cp.PrescriptionType, cp.StatusType, SXAAMBOrderMedRecReviewDetail.LastDoseTaken, cp.ScriptFrequencyID, dm.CatalogItemGUID, cp.IsPrn, cp.TouchedWhen "
|
||
|| "FROM SXAAMBOrderMedRecReviewDetail INNER JOIN SXAAMBOrderMedRecReview ON SXAAMBOrderMedRecReviewDetail.MedRecReviewID = SXAAMBOrderMedRecReview.MedRecReviewID "
|
||
|| "INNER JOIN SXAAMBClientPrescription AS cp INNER JOIN SXARxGenericName AS gn ON gn.GenericNameID = cp.GenericNameID "
|
||
|| "INNER JOIN CV3DrugMapping AS dm ON dm.DrugKey = gn.DrugCatalogKey ON SXAAMBOrderMedRecReviewDetail.PrescriptionID = cp.PrescriptionID "
|
||
|| "AND SXAAMBOrderMedRecReview.ClientGUID = cp.ClientGUID AND SXAAMBOrderMedRecReview.ClientGUID = cp.ClientGUID "
|
||
|| "WHERE (cp.ClientGUID = " || SQL(ClientGUID) || ") AND (cp.Instructions IS NOT NULL) AND (dm.CatalogItemGUID = " || SQL(OrderCatalogItemGUID) || ") "
|
||
|| "AND (SXAAMBOrderMedRecReview.VisitGUID = " || SQL(ClientVisitGUID) || ") AND StatusType = 1 "
|
||
//|| "AND (SXAAMBOrderMedRecReview.ReviewDtm >= CONVERT(DATETIME, " || SQL(AdmitDateTime) || ", 102)) "
|
||
//|| "AND (cp.DrugName = " || SQL(MultumDrugName_field_Value) || ") " <-Use only if looking at dnum only
|
||
|| "ORDER BY cp.TouchedWhen"};
|
||
|
||
|
||
|
||
|
||
Total_RX_DrugName := Count of (RX_DrugName);
|
||
/*
|
||
//Flag if more than one matching home medication was found in the reverse query
|
||
If Total_RX_DrugName > 1 then
|
||
Dup_Home_Med_Warning := "*Duplicate Home Med Found!* ";
|
||
Else
|
||
Dup_Home_Med_Warning := "";
|
||
Endif;
|
||
*/
|
||
|
||
//new teresa
|
||
If Total_RX_DrugName > 1 then
|
||
If Total_RX_DrugName < 5 then
|
||
homelist := "";
|
||
For i in (1 seqto (Total_RX_DrugName)) do
|
||
Homelist := Homelist || "[" || (RX_DrugName)[i] || ": " || (RX_Instructions)[i] || "] ";
|
||
Enddo;
|
||
Else Homelist := " This patient has more than 4 orders for the same medication. Please review all entries." ;
|
||
Endif;
|
||
|
||
Else
|
||
Dup_Home_Med_Warning := "";
|
||
Endif;
|
||
|
||
// endnew teresa
|
||
|
||
|
||
//Banner Instructions section
|
||
If Enable_Hx_Instructions_in_Banner Then
|
||
If last of (RX_DrugName) Is Not NULL and Total_RX_DrugName < 2 Then
|
||
//this_communication.DisplayForm := "Yes";
|
||
// this_communication.Message := Dup_Home_Med_Warning || "Instructions from last Home Med: " || first of (RX_DrugName) || " (" || first of (RX_Route) || ") with instructions: " || first of (RX_Instructions);
|
||
this_communication.Message := "Home Order: [" ||first of (RX_DrugName) || ": " ||first of (RX_Instructions) || "] ";
|
||
this_communication.MessageType := "Banner";
|
||
Else
|
||
// If last of (RX_DrugName) Is Not NULL and Total_RX_DrugName > 1 Then
|
||
this_communication.Message := "There are {{{SINGLE-QUOTE}}}"|| Total_RX_DrugName
|
||
|| "{{{SINGLE-QUOTE}}} home orders for this drug. " || Homelist ;
|
||
this_communication.MessageType := "Banner";
|
||
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "There are {{{SINGLE-QUOTE}}}"|| Total_RX_DrugName
|
||
// || "{{{SINGLE-QUOTE}}} home orders for this drug. " || CRLF || Homelist ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||
Endif;
|
||
Endif;
|
||
|
||
If Enable_Non_Review_Notify then
|
||
|
||
//Query to find the last Review Date for the matching Home edication found
|
||
(RX_DrugName_HX, RX_DoseAmt_HX, RX_Route_HX, RX_Instructions_HX, RX_Comments_HX, RX_Memo_HX, RX_PharmMemo_HX, RX_PRNReason_HX, RX_GenericID_HX, RX_Type_HX, RX_Status_HX, OMR_LastDose_HX,
|
||
OMR_RXFreq_ID_HX, ORD_OCMI_HX, Visit_ID_HX, Visit_Type_HX, Visit_CL_HX, VisitGUID_HX, ReviewDTM_HX) := READ LAST
|
||
{"SELECT cp.DrugName, cp.DoseAmount, cp.Route, cp.Instructions, cp.Comments, cp.Memo, cp.PharmacyMemo, cp.PrnReason, cp.GenericItemID, "
|
||
|| "cp.PrescriptionType, cp.StatusType, SXAAMBOrderMedRecReviewDetail.LastDoseTaken, cp.ScriptFrequencyID, dm.CatalogItemGUID, "
|
||
|| "CV3ClientVisit.VisitIDCode, CV3ClientVisit.TypeCode, CV3ClientVisit.CareLevelCode, SXAAMBOrderMedRecReview.VisitGUID, SXAAMBOrderMedRecReview.ReviewDtm "
|
||
|| "FROM SXAAMBOrderMedRecReviewDetail INNER JOIN SXAAMBOrderMedRecReview ON SXAAMBOrderMedRecReviewDetail.MedRecReviewID = SXAAMBOrderMedRecReview.MedRecReviewID "
|
||
|| "INNER JOIN SXAAMBClientPrescription AS cp INNER JOIN SXARxGenericName AS gn ON gn.GenericNameID = cp.GenericNameID "
|
||
|| "INNER JOIN CV3DrugMapping AS dm ON dm.DrugKey = gn.DrugCatalogKey ON SXAAMBOrderMedRecReviewDetail.PrescriptionID = cp.PrescriptionID "
|
||
|| "AND SXAAMBOrderMedRecReview.ClientGUID = cp.ClientGUID AND SXAAMBOrderMedRecReview.ClientGUID = cp.ClientGUID "
|
||
|| "INNER JOIN CV3ClientVisit ON SXAAMBOrderMedRecReview.VisitGUID = CV3ClientVisit.GUID "
|
||
|| "WHERE (cp.ClientGUID = " || SQL(ClientGUID) || ") AND (dm.CatalogItemGUID = " || SQL(OrderCatalogItemGUID) || ") "
|
||
|| "AND StatusType = 1 "
|
||
|| "ORDER BY SXAAMBOrderMedRecReview.TouchedWhenUTC"};
|
||
|
||
If RX_DrugName_HX Is Not NULL then
|
||
|
||
//Compare the Visit GUID of the last reviewed visit for the selected medication and compare to the current Visit Guid
|
||
If VisitGUID_HX = ClientVisitGUID then
|
||
Reviewed_This_Visit := TRUE;
|
||
Else
|
||
Reviewed_This_Visit := FALSE;
|
||
|
||
If OMR_LastDose_HX Is Not NULL then
|
||
|
||
//Notify the user that the home medication being converted was not reviewed or entered on the current visit
|
||
this_communication.DisplayForm := "Yes";
|
||
this_communication.Message := "WARNING: The Home Medication that matches this formulary item was not reviewed/confirmed for this visit."
|
||
|| " This home medication was last reviewed on:" || CRLF || OMR_LastDose_HX || " on Visit ID: " || Visit_ID_HX;
|
||
this_communication.MessageType := "Informational"; //Change to "error" if you wish to stop the inpatient medication entry.
|
||
Else
|
||
//Notify the user that the home medication being converted was not reviewed or entered on the current visit
|
||
this_communication.DisplayForm := "Yes";
|
||
this_communication.Message := "WARNING: The Home Medication that matches this formulary item was not reviewed/confirmed for this visit." ;
|
||
this_communication.MessageType := "Informational"; //Change to "error" if you wish to stop the inpatient medication entry.
|
||
Endif;
|
||
Endif; //Review Visit Check
|
||
Endif; //Home Medication was found
|
||
|
||
Endif; //Enable Non-Review Warning
|
||
|
||
Endif;
|
||
;;
|
||
evoke: // No evoke statement
|
||
;;
|
||
logic:
|
||
|
||
conclude true;
|
||
;;
|
||
action:
|
||
// This MLM returns two parameters, of types communication_type and form_type respectively.
|
||
return this_communication, this_form;
|
||
;;
|
||
end:
|