Initial Checking with all 820 MLMs

This commit is contained in:
2020-02-02 00:54:01 -05:00
parent c59dc6de2e
commit 840d0432f4
828 changed files with 239162 additions and 0 deletions

View File

@@ -0,0 +1,100 @@
maintenance:
title: Form_Access_Manager_HIE_Consent_Update;;
mlmname: Form_Access_Manager_HIE_Consent_Update;;
arden: version 2;;
version: 4.50;;
institution: St Clair;;
author: Bryan Berkeybile, Eclipsys Corp;;
specialist: ;;
date: 2018-01-15;;
validation: testing;;
library:
purpose: Edits for Access Manager/Enterprise Scheduling HIE field that are completed in Acute Care / Comments.
;;
explanation: This MLM is attached to Form {{{SINGLE-QUOTE}}}Registration Patient - Supplemental{{{SINGLE-QUOTE}}} found in "SCM Configuration Tools / Dictionary Maintenance / Called MLM Form Config (AM)".
It will check to see if a patient has entries for the HIE, if not it will query the comments in Acute Care and pull those values to the HIE items
on the Reg Pat-Supplemental tab. If there are no HIE values for a patient, and there are no comments for HIE, the values will remain blank and mandatory to be filled in.
Change history
01.15.2018 BB CSR# 26413 - Created
;;
keywords: Called MLMs, Form fields
;;
knowledge:
type: data-driven;;
data:
(this_communication, this_form, client_info_obj ) := argument;
log_execution_info := FALSE;
error_message:="";
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField :=this_communication.CallingFieldName;
HIE_Auth := last of (field_list where field_list.DataItemName = "SER-HIEAUTH" );
HIE_Date := last of (field_list where field_list.DataItemName = "SER-HIEDATE" );
// FORM INFO
If CallingEvent = "FormOpen"
then
ClientGuid := this_communication.ClientGUID;
(Auth_Results) := read last { " select distinct cd.Text"
|| " from CV3CommentDeclaration cd with (nolock) "
|| " JOIN cv3clientvisit cv with (nolock) on cv.ClientGUID = cd.ClientGUID "
|| " where cv.clientguid = " || sql(ClientGUID)
|| " AND cd.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| " AND cd.typecode = {{{SINGLE-QUOTE}}}HIE Consent Val{{{SINGLE-QUOTE}}} " };
(Date_Results) := read last { " select distinct convert(varchar, convert(datetime, cd.Text), 110)"
|| " from CV3CommentDeclaration cd with (nolock) "
|| " JOIN cv3clientvisit cv with (nolock) on cv.ClientGUID = cd.ClientGUID "
|| " where cv.clientguid = " || sql(ClientGUID)
|| " AND cd.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| " AND cd.typecode = {{{SINGLE-QUOTE}}}HIE Consent Dat{{{SINGLE-QUOTE}}} " };
if HIE_Auth.value is null
Then HIE_Auth.value := Auth_Results;
endif;
if (HIE_Date.value is null)
Then HIE_Date.value := Date_Results;
endif;
endif;
;;
evoke:
;;
logic:
conclude true;
;;
action:
return this_communication, this_form;
;;
end:

View File

@@ -0,0 +1,138 @@
maintenance:
title: FORM_Access_Manager_OP_Service_Area_Update;;
mlmname: FORM_Access_Manager_OP_Service_Area_Update;;
arden: version 2;;
version: 4.50;;
institution: St Clair;;
author: Juliet M. Law;;
specialist: Peggy Leschak;;
date: 2018-09-28;;
validation: testing;;
library:
purpose: Updates outpatient status board Service Area enterprised defined columns
;;
explanation: This MLM is attached to Form {{{SINGLE-QUOTE}}}Registration Visit - SER- OP Service Area{{{SINGLE-QUOTE}}}. It will update enterprise defined columns on outpatient status boards when registration changes
the OP Service Area form on the Visit Registration.
Change history
2018.09.28 JML WO Incident # 3377118 - Created.
;;
keywords: Called MLMs, Form fields
;;
knowledge:
type: data-driven;;
data:
(this_communication, this_form, client_info_obj ) := argument;
log_execution_info := FALSE;
error_message:="";
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//Include generic function to update enterprise defined column
update_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
//Create Enterprise Defined Column Obj
EDCObj := OBJECT [
column_name,
column_value,
client_guid,
chart_guid,
client_visit_guid
];
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField :=this_communication.CallingFieldName;
ClientGUID := this_communication.ClientGUID;
VisitGUID := this_communication.ClientVisitGUID;
ChartGUID := this_communication.ChartGUID;
// Retrieve form fields
OP_Svc_1 := first of ( field_list WHERE field_list.DataItemName = "SER-OP SERVICE 1" );
OP_Svc_Time_1 := first of ( field_list WHERE field_list.DataItemName = "SER-OP SERV TIME 1" );
OP_Svc_2 := first of ( field_list WHERE field_list.DataItemName = "SER-OP SERVICE 2" );
OP_Svc_Time_2 := first of ( field_list WHERE field_list.DataItemName = "SER-OP SERV TIME 2" );
OP_Svc_3 := first of ( field_list WHERE field_list.DataItemName= "SER-OP SERVICE 3" );
OP_Svc_Time_3 := first of ( field_list WHERE field_list.DataItemName = "SER-OP SERV TIME 3" );
OP_Svc_4 := first of ( field_list WHERE field_list.DataItemName = "SER-OP SERVICE 4" );
OP_Svc_Time_4 := first of ( field_list WHERE field_list.DataItemName = "SER-OP SERV TIME 4" );
if ( CallingEvent = "FieldChange" ) then
if ( CallingField = "SER-OP SERVICE 1" ) then
//Call EDC MLM
col_name := "Service 1";
col_value := OP_Svc_1.Value;
endif;
if ( CallingField = "SER-OP SERV TIME 1" ) then
col_name := "Time 1";
col_value := OP_Svc_Time_1.Value;
endif;
if ( CallingField = "SER-OP SERVICE 2" ) then
col_name := "Service 2";
col_value := OP_Svc_2.Value;
endif;
if( CallingField = "SER-OP SERV TIME 2" ) then
col_name := "Time 2";
col_value := OP_Svc_Time_2.Value;
endif;
if ( CallingField = "SER-OP SERVICE 3" ) then
col_name := "Service 3";
col_value := OP_Svc_3.Value;
endif;
if ( CallingField = "SER-OP SERV TIME 3" ) then
col_name := "Time 3";
col_value := OP_Svc_Time_3.Value;
endif;
if ( CallingField = "SER-OP SERVICE 4" ) then
col_name := "Service 4";
col_value := OP_Svc_4.Value;
endif;
if ( CallingField = "SER-OP SERV TIME 4" ) then
col_name := "Time 4";
col_value := OP_Svc_Time_4.Value;
endif;
endif;
;;
evoke:
;;
logic:
SvcLoc := NEW EDCObj WITH [
column_name := col_name,
column_value := col_value,
client_guid := ClientGUID,
chart_guid := ChartGUID,
client_visit_guid := VisitGUID
];
//Call function to update enterprise defined column
return_value := call update_ED_column WITH ( SvcLoc );
conclude true;
;;
action:
return this_communication, this_form;
;;
end:

View File

@@ -0,0 +1,193 @@
maintenance:
title: Form_Access_Manager_Signature_Capture_Update;;
mlmname: Form_Access_Manager_Signature_Capture_Update;;
arden: version 2;;
version: 4.50;;
institution: St Clair;;
author: Don Warnick, Eclipsys Corp;;
specialist: ;;
date: 2017-10-12;;
validation: testing;;
library:
purpose: Edits for Access Manager/Enterprise Scheduling demographic field edits
;;
explanation: This MLM is attached to Form Fields found on form "SER-SignCaptureDocs"
Change history
10.12.2017 DW CSR# 26413 - Created
;;
keywords: Called MLMs, Form fields
;;
knowledge:
type: data-driven;;
data:
(this_communication, this_form, client_info_obj ) := argument;
log_execution_info := FALSE;
error_message:="";
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField :=this_communication.CallingFieldName;
ClientGuid := this_communication.ClientGUID;
ClientVisitGuid := this_communication.ClientVisitGuid;
ChartGuid := this_communication.ChartGUID;
error_destination := destination { Alert } with [ alert_type:= "Warning",short_message:= "ObjectsPlus Error from MLM",priority:= "low",scope:= "chart",Rule_group:= "ObjectsPlus Error from MLM",Rule_number:= 1003,Rule_subgroup := "",Send_with_order:= "",Alert_dialog_settings:= "",Display_alert:= true ];
BloodRefusalField := last of (field_list where field_list.DataItemName = "SER-REQUEST NO BLOOD OR PRODU" );
//Check for Blood Refusal Comment
BloodRefusalComment:= Read Last {"select cd.guid
from CV3ClientVisit cv with (nolock)
join CV3CommentDeclaration cd with (nolock) on cv.GUID = cd.ClientVisitGUID and cv.ClientGUID = cd.ClientGUID
where cv.ClientGUID = " || ClientGuid || " and cv.GUID = " || ClientVisitGuid || " and cd.TypeCode = {{{SINGLE-QUOTE}}}Blood Refusal{{{SINGLE-QUOTE}}} and cd.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}
"};
// Form Open
If CallingEvent = "FormOpen"
then
//Check for Signed Documents
DocumentNameList, DocumentDateList := read
{ "
CREATE TABLE #tmp_aaa (ID int IDENTITY(1, 1), documentname varchar(60), documentdate datetime, deletefield varchar (6))
INSERT INTO #tmp_aaa (documentname,documentdate)
select cd.DocumentName, cd.CreatedWhen
from CV3ClientDocumentCUR cd with (nolock)
where cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || ClientVisitGuid || "
order by cd.DocumentName, cd.CreatedWhen
update t1 set deletefield = {{{SINGLE-QUOTE}}}delete{{{SINGLE-QUOTE}}} from #tmp_aaa t1
inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.documentname = t2.documentname
delete from #tmp_aaa where deletefield = {{{SINGLE-QUOTE}}}delete{{{SINGLE-QUOTE}}}
select documentname, cast (convert(char(10), documentdate,110) as varchar) from #tmp_aaa
"};
if exists DocumentNameList
then
indexList := 1 seqto count (DocumentDateList);
for j in indexList do
ThisDocumentDate := last (first j from DocumentDateList);
ThisDocumentName := last (first j from DocumentNameList);
DocumentField := last of (field_list where field_list.Label = ThisDocumentName );
DocumentField.value := ThisDocumentDate;
enddo;
endif;
// Update the Blood Refusal field with the appropriate value
If exists BloodRefusalComment
then
BloodRefusalField.value := "Y";
else
BloodRefusalField.value := "";
endif;
endif; // Form Open
// Form Close
If CallingEvent = "FormClose"
then
// If a the field is blank and there is a comment, delete the comment
If BloodRefusalField.value is null and exists BloodRefusalComment // Delete the "Blood Refusal" comment
then
try
Discontinue_Comment_obj := call {{{SINGLE-QUOTE}}}PatientComment{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( (BloodRefusalComment as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
empty := call Discontinue_Comment_obj.Discontinue;
void := call Discontinue_Comment_obj.Save;
endtry;
catch exception ex
error_occurred := true;
error_message := error_message || "{{+R}}Discontinue Comment:{{-R}}\n" || ex.Message || "\n\n";
if ex.InnerException is not null net_object then error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n"; endif;
if ( Discontinue_Comment_obj is NOT NULL ) then void:= call Discontinue_Comment_obj.Dispose; Discontinue_Comment_obj:= null; endif;
endcatch;
endif;
// If a the field is Y and there is no comment, create a comment
If BloodRefusalField.value = "Y" and not exists BloodRefusalComment // Add the "Blood Refusal" comment
then
try
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
New_Comment_obj := call {{{SINGLE-QUOTE}}}PatientComment{{{SINGLE-QUOTE}}}.CreatePatientComment with client_visit_obj,"Blood Refusal";
New_Comment_obj.Text := "Y";
void := call New_Comment_obj.Save;
endtry;
catch exception ex
error_occurred:= true;
error_message := "{{+R}}New Comment:{{-R}}\n" || ex.Message || "\n\n";
if ex.InnerException is not null net_object then error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n"; endif;
if ( New_Comment_obj is NOT NULL ) then void:= call New_Comment_obj.Dispose; New_Comment_obj:= null; endif;
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
endcatch;
endif;
endif; // Form Close
;;
evoke:
;;
logic:
conclude true;
;;
action:
return this_communication, this_form;
;;
end:

View File

@@ -0,0 +1,134 @@
maintenance:
title: FORM_ACETYLCYSTEINE_NEW_ORDER;;
mlmname: FORM_ACETYLCYSTEINE_NEW_ORDER;;
arden: version 2.5;;
version: 5.50;;
institution: St Clair Hospital;;
author: Juliet M. Law, Allscripts ;;
specialist: Bryan Berkeybile, Allscripts;;
date: 2013-06-17;;
validation: testing;;
library:
purpose:
;;
explanation: This MLM is called from ...
Change history
2013.06.17 JML CSR 30931: Created
2013.07.19 BDB Updated the Rate Data Item as original was not crossing to WORx. Then updated BaseSolution Dose, as the
calculation did not need to occur on the Form. Then updated Rate value, as the calculation changed
due to the BaseSolution change.
;;
keywords: Called MLMs
;;
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";
HoldOrder_RequestedTime := mlm {{{SINGLE-QUOTE}}}FORM_HOLDORDER_REQUESTEDTIME{{{SINGLE-QUOTE}}};
// 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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
ClientGuid := this_communication.ClientGUID;
ChartGuid := this_communication.ChartGUID;
FormName := this_form.Name;
//Retrieve Fields
Dosage_Low := first of (field_list WHERE field_list.DataItemName = "DosageLow");
Dosage_Low_fld := Dosage_Low.Value;
Rate_fld := first of (field_list WHERE field_list.DataItemName = "PRX_IVRATE"); //[BB changed to test updates to UDDI - Was: "OrderIVRate"]
Order_IV_Rate := Rate_fld.Value;
Instructions_fld := first of (field_list WHERE field_list.DataItemName = "AdminInstructions");
//Add call to FORM_HOLDORDER_REQUESTEDTIME MLM to handle conflict of both MLMs need called on Form Open
(this_communication, this_form) := call HoldOrder_RequestedTime WITH this_communication, this_form, client_info_obj;
if (CallingEvent = "FormOpen") then
if (Instructions_fld.Value = "Run for 1 hour") then
if (Dosage_Low_fld > 0) then
Rate_fld.Value := ROUND( ( Dosage_Low_fld / 200 ) + 200 );
endif;
elseif (Instructions_fld.Value = "Run for 4 hours") then
if (Dosage_Low_fld > 0) then
Rate_fld.Value := ROUND( ( ( Dosage_Low_fld / 200 ) + 500 ) / 4 );
endif;
elseif (Instructions_fld.Value = "Run for 16 hours") then
if (Dosage_Low_fld > 0) then
Rate_fld.Value := ROUND( ( ( Dosage_Low_fld / 200 ) + 1000 ) / 16 );
endif;
endif;
elseif (CallingEvent = "FieldChange") then
if (CallingField = "DosageLow") then
if (Instructions_fld.Value = "Run for 1 hour") then
Rate_fld.Value := ROUND (( Dosage_Low_fld / 200 ) + 200 );
elseif (Instructions_fld.Value = "Run for 4 hours") then
Rate_fld.Value := ROUND( ( ( Dosage_Low_fld / 200 ) + 500 ) / 4 );
elseif (Instructions_fld.Value = "Run for 16 hours") then
Rate_fld.Value := ROUND( ( ( Dosage_Low_fld / 200 ) + 1000 ) / 16 );
endif;
endif;
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:

View File

@@ -0,0 +1,604 @@
maintenance:
title: FORM_ACS_SAME_DAY_ORDER_REPLACEMENT ;;
mlmname: FORM_ACS_SAME_DAY_ORDER_REPLACEMENT;;
arden: version 2.5;;
version: 16.3;;
institution: Allscripts;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: St Clair - Maria Pest;;
date: 2017-12-21;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2015 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose: MLM to replace the current evoking order with a new order on the worksheet.
;;
explanation:
Present actionable alert if any of 3 lab orders already done on current calendar day
;;
keywords: ObjectsPlus/XA, Order
;;
knowledge:
type: data-driven;;
data:
(this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
primary_obj := this_communication.PrimaryObj;
OrdersList := ("Basic Metabolic Panel"
,"Basic Metabolic Panel Fasting"
,"Comprehensive Metabolic Panel"
,"Comprehensive Metabolic Panel Fasting"
,"CBC (Includes Diff)"
,"CBC with Manual Diff");
if this_communication.FormType = "Order"
and this_communication.PrimaryObj.IsPartOfSet
and this_communication.PrimaryObj.name is in OrdersList then
local_session := cds_session.local;
ReplacementOrderInfoObj := object [OrderName,RequestedDate,RequestedTime,FormFields,TouchedWhen];
ReplacementOrderInfo := NEW ReplacementOrderInfoObj with
(this_communication.PrimaryObj.name
,(first of (this_form.Fields where this_form.Fields.DataItemName = "RequestedDate")).Value
,(first of (this_form.Fields where this_form.Fields.DataItemName = "RequestedTime")).Value
,this_form.Fields
,NOW);
local_session.ACS_OrderReplacmentOrderInfo := (local_session.ACS_OrderReplacmentOrderInfo,ReplacementOrderInfo);
endif;
if this_communication.FormType = "Order"
and (not exists(primary_obj.Modifier) or primary_obj.Modifier = "" or primary_obj.Modifier is null) //Ignore repeat orders
and this_communication.OrderSet = "No"
and this_communication.PrimaryObj.name is in OrdersList then
// Specify which .NET assemblies need to be loaded for ObjectsPlus
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
// Using assembly and namespace
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
using namespace "System.Collections.Generic";
CALLED_LAUNCH_LISTBOX_MLM := MLM {{{SINGLE-QUOTE}}}CALLED_LAUNCH_LISTBOX_MULTI_SELECT_ACS{{{SINGLE-QUOTE}}};
/*******************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 if not need to display Order Form dialog.
If it{{{SINGLE-QUOTE}}}s set to true, order form will be displayed and the order will be
saved to order entry worksheet when OK is clicked from the order form. */
display_order_form := false;
/* Set to false if not to cancel the current order */
cancel_current_order := true;
showReplacementMessage := false;
/***************************************************************************************/
// Initialize error message
error_message:="";
error_occurred := false;
info_message := "";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
ClientGuid := this_communication.ClientGUID;
ClientVisitGUID := this_communication.ClientVisitGUID;
ChartGUID := this_communication.ChartGUID;
UserGUID := this_communication.UserGUID;
primary_object := this_communication.primaryObj;
order_name := primary_object.name;
OrderName := order_name;
CallingFieldName := this_communication.CallingFieldName;
field_list := this_form.fields;
// set up date range to check if there is a duplicate Order.
requestedDateFieldValue := (first of (this_form.Fields where this_form.Fields.DataItemName = "RequestedDate")).Value;
requestedTimeFieldValue := (first of (this_form.Fields where this_form.Fields.DataItemName = "RequestedTime")).Value;
if(requestedDateFieldValue = "T")then
ClientVisit_TimeZone := read last {ClientVisit: TimeZone };
theDate := NOW as TIME ClientVisit_TimeZone;
if(theDate is null or theDate = null or not exists theDate)then
theDate := NOW as TIME;
endif;
else
theDate := requestedDateFieldValue;
endif;
begin_date_str := ((extract year theDate) as string) || "-" ||
(extract month theDate) formatted with "%0.2d" || "-" ||
(extract day theDate) formatted with "%0.2d" || " 00:00:00";
end_date_str := ((extract year theDate) as string) || "-" ||
(extract month theDate) formatted with "%0.2d" || "-" ||
(extract day theDate) formatted with "%0.2d" || " 23:59:59";
SQLOrderNamesList := "";
if(OrderName is in ("Basic Metabolic Panel","Basic Metabolic Panel Fasting"))then
SQLOrderNamesList := "{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel Fasting{{{SINGLE-QUOTE}}}";
endif;
if(OrderName is in ("Comprehensive Metabolic Panel","Comprehensive Metabolic Panel Fasting"))then
SQLOrderNamesList := "{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel Fasting{{{SINGLE-QUOTE}}}";
endif;
if(OrderName is in ("CBC (Includes Diff)","CBC with Manual Diff"))then
SQLOrderNamesList := "{{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}";
endif;
if(SQLOrderNamesList <> "")then
query := "select top 1 Name, RequestedDate,RequestedDtm,CV3Order.CreatedWhen,CV3OrderStatus.Description,CV3OrderStatus.LevelNumber,SignificantDtm"
|| " from CV3Order"
|| " left outer join CV3OrderStatus on CV3OrderStatus.Code = CV3Order.OrderStatusCode and CV3OrderStatus.Active = 1"
|| " where ClientGUID = " || ClientGuid
|| " and ChartGUID = " || ChartGUID
|| " and ClientVisitGUID = " || ClientVisitGUID
|| " and CV3Order.Active = 1 and CV3Order.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} and OrderStatusLevelNum <> 69 and OrderStatusCode <> {{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}} and Name in (" || SQLOrderNamesList || ")"
|| " and CV3OrderStatus.[Description] not in ({{{SINGLE-QUOTE}}}Repeat Generation Finished{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Active Master Order{{{SINGLE-QUOTE}}})"
|| " and (RequestedDtm between " || SQL(begin_date_str) || " and " || SQL(end_date_str)
|| " OR (RequestedDtm is null and RequestedDate = {{{SINGLE-QUOTE}}}T{{{SINGLE-QUOTE}}} and CV3Order.CreatedWhen between " || SQL(begin_date_str) || " and " || SQL(end_date_str)
|| ")) ORDER BY RequestedDate,CV3Order.CreatedWhen";
(FoundOrderName, RequestedDate,RequestedDtm,CreatedWhen,OrderStatus,OrderStatusLevelNum,SignificantDtm) := read last {"" || query};
if(OrderStatusLevelNum = 10)then
OrderStatus := "Pending";
endif;
if(OrderStatusLevelNum = 50)then
OrderStatus := "Active";
endif;
if(OrderStatusLevelNum = 60)then
OrderStatus := "Received";
endif;
if(OrderStatusLevelNum = 100)then
OrderStatus := "Completed";
endif;
if((OrderStatusLevelNum as number) is in (80,83,85))then
OrderStatus := "Resulted";
endif;
if(exists(CreatedWhen) and CreatedWhen is not null)then
ExisitingDuplicateOrderCnt := 1;
else
ExisitingDuplicateOrderCnt := 0;
endif;
if(ExisitingDuplicateOrderCnt > 0)then
if(OrderName in ("Basic Metabolic Panel","Basic Metabolic Panel Fasting")) then
SelectionMode := "Multiple";
ReplaceOrdersList := ("Lytes"
,"Sodium Plasma/Serum"
,"Potassium Plasma/Serum"
,"Chloride Plasma/Serum"
,"Carbon Dioxide (CO2)"
,"BUN"
,"Creatinine"
,"Glucose Non-Fasting"
,"Calcium Plasma/Serum");
endif;
if(OrderName in ("Comprehensive Metabolic Panel","Comprehensive Metabolic Panel Fasting")) then
SelectionMode := "Multiple";
ReplaceOrdersList := ("Lytes"
,"Sodium Plasma/Serum"
,"Potassium Plasma/Serum"
,"Chloride Plasma/Serum"
,"Carbon Dioxide (CO2)"
,"AST/SGOT"
,"ALT/SGPT"
,"Albumin Plasma/Serum"
,"Alkaline Phosphatase"
,"Bilirubin Total"
,"BUN"
,"Creatinine"
,"Calcium Plasma/Serum"
,"Glucose Non-Fasting"
,"Protein Plasma/Serum");
endif;
if(OrderName in ("CBC (Includes Diff)","CBC with Manual Diff")) then
ReplaceOrdersList := ("CBC No Diff (Hemogram Only)"
,"Hemoglobin and Hematocrit"
,"Platelet Count"
,"H&H and Platelet Count"
);
endif;
if(SignificantDtm is not null)then
DisplayDate := SignificantDtm;
else
if(RequestedDate = "T")then
DisplayDate := CreatedWhen;
else
DisplayDate := RequestedDtm;
endif;
endif;
//drop the seconds
DisplayDate := DisplayDate as string;
DisplayDate := substring length(DisplayDate)-3 characters from DisplayDate;
myMessage := "{{{SINGLE-QUOTE}}}" || FoundOrderName || "{{{SINGLE-QUOTE}}} already found for " || DisplayDate || " and is " || OrderStatus || ".\n\n";
if(FoundOrderName matches pattern "%CBC%")then
myMessage := myMessage || "-Select Cancel to Cancel THIS order\n-Select Yes to choose alternate tests (CBC No Diff, H&H, Platelet)\n-Select No to proceed with this order\n";
else
myMessage := myMessage || "-Select Cancel to Cancel THIS order\n-Select Yes to choose individual chemistry tests\n-Select No to proceed with this order\n";
endif;
DialogResult := CALL {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with myMessage as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, "Duplicate Daily Lab Alert" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}},"YesNoCancel" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
if((DialogResult as string) = "Yes")then
result := call CALLED_LAUNCH_LISTBOX_MLM with ReplaceOrdersList, SelectionMode, "Select Orders";
ReplaceOrderNameList := result;
//break out {{{SINGLE-QUOTE}}}break out{{{SINGLE-QUOTE}}} items
tmp := ();
for item in ReplaceOrderNameList do
BreakOutItems := ();
if(item = "Lytes")then
BreakOutItems := ("Sodium Plasma/Serum","Potassium Plasma/Serum","Chloride Plasma/Serum","Carbon Dioxide (CO2)");
endif;
if(item = "H&H and Platelet Count")then
BreakOutItems := ("Hemoglobin and Hematocrit","Platelet Count");
endif;
if(count BreakOutItems > 0)then
for BOItem in BreakOutItems do
if(BOItem is not in ReplaceOrderNameList)then
tmp := (tmp,BOItem);
endif;
enddo;
else
tmp := (tmp,item);
endif;
enddo;
ReplaceOrderNameList := tmp;
ReplaceOrderNames := "";
for ReplaceOrderName in ReplaceOrderNameList do
if(ReplaceOrderNames = "")then
ReplaceOrderNames := "{{{SINGLE-QUOTE}}}" || ReplaceOrderName || "{{{SINGLE-QUOTE}}}";
else
ReplaceOrderNames := ReplaceOrderNames || ", {{{SINGLE-QUOTE}}}" || ReplaceOrderName || "{{{SINGLE-QUOTE}}}";
endif;
enddo;
endif;
//get this new order{{{SINGLE-QUOTE}}}s UDDIs
for item in ReplaceOrderNameList do
if(QueryList is null)then
QueryList := (SQL(item));
else
QueryList := (QueryList,SQL(item));
endif;
enddo;
UDDIObj := OBJECT [ItemName,DataItemCode,DataTypeCode];
newOrderUDDISQL := "select
CV3OrderCatalogMasterItem.Name
,CV3OrderEntryField.DataItemCode
,CV3DataItem.DataTypeCode
from
CV3OrderCatalogMasterItem (nolock)
join CV3OrderEntryForm (nolock) on CV3OrderEntryForm.FormGUID = CV3OrderCatalogMasterItem.EntryFormGUID
and CV3OrderEntryForm.IsCurrent = 1
and CV3OrderEntryForm.Active = 1
join CV3OrderEntryField
on CV3OrderEntryField.OrderEntryFormGUID = CV3OrderEntryForm.guid
and CV3OrderEntryField.Active = 1
join CV3DataItem on CV3DataItem.Code = CV3OrderEntryField.DataItemCode
where
CV3OrderCatalogMasterItem.Active = 1
and CV3OrderCatalogMasterItem.Name in (" || QueryList || ")";
newOrderUDDIInfo := read as UDDIObj {"" || newOrderUDDISQL};
endif;
endif;
endif;
/*
if(userguid = "1000001084119001")then
uo := read {UnsubmittedOrders : this};
uor := uo.records__;
break;
endif;
*/
;;
evoke: // No evoke statement
;;
logic:
if(order_name NOT in ("Basic Metabolic Panel"
,"Basic Metabolic Panel Fasting"
,"Comprehensive Metabolic Panel"
,"Comprehensive Metabolic Panel Fasting"
,"CBC (Includes Diff)"
,"CBC with Manual Diff"))then
conclude true;
else
if(ExisitingDuplicateOrderCnt = 0)then
conclude true;
endif;
if((DialogResult as string) = "No")then
//do no intervention
conclude true;
endif;
if((DialogResult as string) = "Cancel" OR (COUNT ReplaceOrderNameList = 0) )then
//want to cancel the order
this_communication.PrimaryObj.CancelOrder := true;
conclude true;
endif;
// The new order can be added only if the current order
// was entered from order entry worksheet
if this_communication.FormType = "Order" //.OrderCanBeCanceled = true
then
try
//-----------------------------------------------------------
// Retrieve current order entry batch.
// The new order can be added only if the parent order
// belongs to the order entry batch
// object owned by the OrderEntryWorksheet.
//-----------------------------------------------------------
worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
orderBatch := worksheetInfo;
if worksheetInfo is NULL OR
"OrderEntryWorksheet" <> (worksheetInfo.OrderBatchOwner as String)
then
// If current order entry batch is not OrderEntryWorksheet,
// do not continue with the order replacement.
// Still conclude true to return communication and form objects.
conclude true;
endif;
this_communication.PrimaryObj.CancelOrder := cancel_current_order;
if(cancel_current_order and NOT this_communication.PrimaryObj.OrderCanBeCanceled)then
void := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Current Order {{{SINGLE-QUOTE}}}" || OrderName || "{{{SINGLE-QUOTE}}} cannot be Canceled. It must be manually removed from the Order Entry Worksheet.";
endif;
if cancel_current_order = true
then
info_message := "The order is canceled by MLM.";
endif;
endtry;
catch Exception ex
error_occurred := true;
error_message := ex.Message;
endcatch;
if error_occurred = false then
//----------------------------------------------------------------------
// Create a new DIAGNOSTIC order from a catalog item
//----------------------------------------------------------------------
try
order_Creation_Reason := "Replacing order: " || EvokingObject.Name;
for ReplaceOrderName in ReplaceOrderNameList do
// get CatalogMasterItem ObjectsPlus object
ReplaceOrder_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
with ReplaceOrderName;
// Create the order
// Session information has been retrieved from the current worksheet if there
// already exists unsubmitted orders.
// The AvailabilityOverride flag is set to AlwaysOverride which will override any
// availabilty policy defined for this order that defines
// this item as not available at this location. The user still need to have the
// correct override right.
Order_obj := call orderBatch.CreateDiagnosticOrder
with
ReplaceOrder_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
order_Creation_Reason, // Create Reason
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}, // AvailabilityOverride
false, // suppresss messages
(Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}, // Created from order primary key
true; // Mandatory on Worksheet
// check if needs to show the order form of the new order
if display_order_form then
order_form_obj:= new NET_OBJECT {{{SINGLE-QUOTE}}}OrderForm{{{SINGLE-QUOTE}}};
order_form_obj.Order := Order_obj;
dialog_return_value := call order_form_obj.ShowDialog;
// when OK button is clicked from the new order{{{SINGLE-QUOTE}}}s form
// the order will be added to the order entry worksheet unsubmitted list by SCM
// no Save command needs to be called in MLM
if (dialog_return_value as String) = "OK" then
// update the informational message to indicate the new order is created
info_message := info_message
|| "\n" || "Order " || ReplaceOrderName || " is created.";
endif;
else
//freqCodeValue_obj := new net_object {{{SINGLE-QUOTE}}}Frequency{{{SINGLE-QUOTE}}} with "before meals";
//Order_obj.RequestedDate := "T";
//Order_obj.RequestedTime := "Routine";
if(RequestedDateFieldValue = "T")then
Order_obj.RequestedDate := RequestedDateFieldValue;
else
order_date_str := ((extract year (RequestedDateFieldValue AS TIME)) as string) || "-" ||
(extract month (RequestedDateFieldValue AS TIME)) formatted with "%0.2d" || "-" ||
(extract day (RequestedDateFieldValue AS TIME)) formatted with "%0.2d";
Order_obj.RequestedDate := order_date_str;
endif;
Order_obj.RequestedTime := RequestedTimeFieldValue.ReqTimeCode;
//Order_obj.Frequency := freqCodeValue_obj;
//Order_obj.StopDate := "T+4";
conditionalOrderFieldValue := (first of (this_form.Fields where this_form.Fields.DataItemName = "ConditionalOrder")).Value;
if(ConditionalOrderFieldValue.IsConditional)then//this_communication.PrimaryObj.IsConditional)then
Reason := ConditionalOrderFieldValue.Reason as string;
Activations := ConditionalOrderFieldValue.Number as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}};
conditional := new net_object {{{SINGLE-QUOTE}}}ConditionalOrder{{{SINGLE-QUOTE}}} with Activations as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, Reason as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
Order_obj.ConditionalOrder := conditional;
endif;
//UDO_list := EVOKINGOBJECT.OrderUserData.RECORDS__ ;
UDO_list := this_form.Fields;
for x in (1 seqto count UDO_list)do
if(UDO_list[x].value is not null)then
//newOrderUDDI := last of (newOrderUDDIInfo WHERE newOrderUDDIInfo.ItemName = ReplaceOrder_catalog_item.Name and newOrderUDDIInfo.DataItemCode = UDO_list[x].UserDataCode);
newOrderUDDI := last of (newOrderUDDIInfo WHERE newOrderUDDIInfo.ItemName = ReplaceOrder_catalog_item.Name and newOrderUDDIInfo.DataItemCode = UDO_list[x].DataItemName);
if(newOrderUDDI is not null)then
if(newOrderUDDI.DataTypeCode in ("Restricted Dictionary", "Free Format Text","Suggested Dictionary"))then
value := UDO_list[x].value as string;
if(value <> "")then
void := CALL Order_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with newOrderUDDI.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, 0 as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
retval := call Order_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with newOrderUDDI.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, value as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
endif;
endif;
if(newOrderUDDI.DataTypeCode = "Checkbox")then
value := UDO_list[x].value as number;
if(value = 1)then
void := CALL Order_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with newOrderUDDI.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, 0 as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
retval := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with newOrderUDDI.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, 1 as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
endif;
endif;
if(newOrderUDDI.DataTypeCode = "Date")then
value := UDO_list[x].value as time;
void := CALL Order_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with newOrderUDDI.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, 0 as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
retval := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Nullable<DateTime>>{{{SINGLE-QUOTE}}} with newOrderUDDI.DataItemCode , value;
endif;
if(newOrderUDDI.DataTypeCode = "Time")then
value := UDO_list[x].value;// as time;
valueS := value as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
sep := ":" AS {{{SINGLE-QUOTE}}}Char{{{SINGLE-QUOTE}}};
netList := new NET_OBJECT {{{SINGLE-QUOTE}}}List<Char>{{{SINGLE-QUOTE}}};
void := CALL netList.Add WITH sep;
array := CALL netList.ToArray;
parts := CALL valueS.Split WITH array;
myHours := parts[1] as number;
myMinutes := parts[2] as number;
valueT := NEW NET_OBJECT {{{SINGLE-QUOTE}}}ObjectsPlusXA.SunriseClinicalManager.Time{{{SINGLE-QUOTE}}} with (myHours as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}), (myMinutes as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}});
void := CALL Order_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with newOrderUDDI.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, 0 as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
retval := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Time>{{{SINGLE-QUOTE}}} with newOrderUDDI.DataItemCode , valueT;
endif;
endif;
endif;
enddo;
/*
//Update the Order{{{SINGLE-QUOTE}}}s Instruction Field
If Instructions_Value Is Not NULL then
If Instructions_Field = "SpecialInstructions" Then
Order_obj.SpecialInstructions := Instructions_Value;
Else
updt_Instructions := call Order_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
Instructions_Field, Instructions_Value;
Endif;
//order_obj.SpecialInstructions
Endif;
*/
//Update if Order is PRN
//Order_obj.IsPRN := EVOKINGOBJECT.IsPRN as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
// Save the order directly to the worksheet instead of using a destination
// Do this only because this Alert is configued as "No Override Allowed" and
// any destinations will never be executed.
void := call Order_obj.Save;
if( Order_obj is NOT NULL ) then
void := call Order_obj.Dispose;
Order_obj:= null;
endif;
if( ReplaceOrder_catalog_item is NOT NULL ) then
void := call ReplaceOrder_catalog_item.Dispose;
ReplaceOrder_catalog_item := null;
endif;
endif;
enddo;
endtry;
catch Exception ex
error_occurred := true;
error_message := ex.Message;
if( Order_obj is NOT NULL ) then
void := call Order_obj.Dispose;
Order_obj:= null;
endif;
if( ReplaceOrder_catalog_item is NOT NULL ) then
void := call ReplaceOrder_catalog_item.Dispose;
ReplaceOrder_catalog_item := null;
endif;
endcatch;
endif;
if error_occurred = true then
this_communication.MessageType := "Error"; // Informational, Error, Banner
this_communication.Message := info_message || "\n" || "Error: " || error_message;
else
// succeeded
if(showReplacementMessage)then
this_communication.MessageType := "Informational"; // Informational, Error, Banner
this_communication.Message := info_message;
endif;
endif;
//----------clean up-------
if( Order_obj is NOT NULL ) then
void := call Order_obj.Dispose;
Order_obj:= null;
endif;
if( ReplaceOrder_catalog_item is NOT NULL ) then
void := call ReplaceOrder_catalog_item.Dispose;
ReplaceOrder_catalog_item := null;
endif;
if ( order_form_obj is NOT NULL ) then
void:= call order_form_obj.Dispose;
order_form_obj := null;
endif;
Endif; // end of replace order
endif;
conclude true;
;;
action:
// This MLM returns two parameters, of types communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,705 @@
maintenance:
title: FORM_ACS_SAME_DAY_ORDER_REPLACEMENT_OS;;
mlmname: FORM_ACS_SAME_DAY_ORDER_REPLACEMENT_OS;;
version: 16.30;;
institution: Allscripts;;
author: Allscripts;;
specialist: Allscripts;;
date: 2010-02-05;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2015 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose:
;;
explanation:
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
(this_communication, this_form, this_ClientInfo) := argument;
// Specify which .NET assemblies need to be loaded for ObjectsPlus
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
local_session := cds_session.local;
ReplacementOrderInfoObj := object [OrderName,RequestedDate,RequestedTime,FormFields,TouchedWhen];
// Using assembly and namespace
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
using namespace "System.Collections.Generic";
CALLED_LAUNCH_LISTBOX_MLM := MLM {{{SINGLE-QUOTE}}}CALLED_LAUNCH_LISTBOX_MULTI_SELECT_ACS{{{SINGLE-QUOTE}}};
ClientGuid := this_communication.ClientGUID;
ChartGUID := this_communication.ChartGUID;
ClientVisitGUID := this_communication.ClientVisitGUID;
UserGUID := this_communication.UserGUID;
primary_object := this_communication.primaryObj;
order_name := primary_object.name;
CallingFieldName := this_communication.CallingFieldName;
field_list := this_form.fields;
OrdersOfInterest:= ("Basic Metabolic Panel"
,"Basic Metabolic Panel Fasting"
,"Comprehensive Metabolic Panel"
,"Comprehensive Metabolic Panel Fasting"
,"CBC (Includes Diff)"
,"CBC with Manual Diff");
if(this_communication.FormType = "OrderSet" and this_communication.CallingEvent = "FormClose")then //if OS form and Form Close
/*If UDDI is a MultiOrderGrid
MulitOrderGrid_fields := first of (field_list where field_list.DataItemName matches pattern "MultiOrderGrid%");
if(exists(MulitOrderGrid_fields))then
for i in 1 seqto Count(MulitOrderGrid_fields) do
MulitOrderGrid_field := MulitOrderGrid_fields[i];
Grid_list := MulitOrderGrid_field.Value;
ProblemListOrder := first of (Grid_list where Grid_list.Name = ProblemListOrderName);
if(exists(ProblemListOrder))then
ProblemListOrder.IsSelected := FALSE;
endif;
enddo;
endif;
*/
//Order Set Configuration Data
OrderSetConfigObj := OBJECT [OrderSetHeading,OrderSetHeadingSingleSpaced,OrderName, RequestedDate, RequestedTime, UserDataCode, UserDataCodeValue ];
OrderSetConfigSQL := "SELECT o.OrderSetHeading, REPLACE(o.OrderSetHeading, {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}) as [OrderSetHeadingSingleSpaced], ocmi.Name, o.RequestedDate, o.RequestedTime, oud.UserDataCode, oud.Value
FROM CV3Order o, CV3OrderXRef x, CV3OrderCatalogMasterItem ocmi, CV3OrderUserData oud
WHERE x.ClientGUID = 0 AND x.ParentGUID = " || this_communication.CatalogOrderSetGUID || " AND ocmi.GUID = o.OrderCatalogMasterItemGUID
AND oud.ClientGUID = o.ClientGUID AND oud.OrderGUID = o.GUID
AND o.GUID = x.OrderGUID AND o.ClientGUID = 0 AND x.Type = 0 AND o.Active = 1";
OrderSetConfigData := read as OrderSetConfigObj {"" || OrderSetConfigSQL};
MulitOrderCheckbox_fieldsList := (field_list where field_list.DataItemName matches pattern "MultiOrderCheckbox%");
for MulitOrderCheckbox_fields in MulitOrderCheckbox_fieldsList do
//if(exists(MulitOrderCheckbox_fields))then //if the MultiOrderCheckbox field exists
sectionHeader := MulitOrderCheckbox_fields.Label;
if(sectionHeader matches pattern "% x % days"
OR sectionHeader matches pattern "% x 2"
OR sectionHeader matches pattern "% x 3")then
ignoreRepeatOrders := true;
else
for i in 1 seqto Count(MulitOrderCheckbox_fields) do //for each MultiOrderCheckbox field
MulitOrderCheckbox_field := MulitOrderCheckbox_fields[i];
MulitOrderCheckbox_field_value := MulitOrderCheckbox_field.Value;
MulitOrderCheckbox_field_valueRecs := MulitOrderCheckbox_field_value.Records__;
for MulitOrderCheckboxFieldItem in MulitOrderCheckbox_field_value do //for each MultiOrderCheckbox field item
if(MulitOrderCheckboxFieldItem.Name is in OrdersOfInterest and MulitOrderCheckboxFieldItem.IsSelected)then //if item is selected
OrderName := MulitOrderCheckboxFieldItem.Name;
//GET ORDER FORM FIELDS
OrderReplacmentOrderInfo := local_session.ACS_OrderReplacmentOrderInfo;
ThisOrderReplacementOrderInfo := last of (OrderReplacmentOrderInfo where OrderReplacmentOrderInfo.OrderName = OrderName);
//OrderReplacmentOrderFormFields := ThisOrderReplacementOrderInfo.FormFields;
//clear the data
BlankReplacementOrderInfo := NEW ReplacementOrderInfoObj with (OrderName,null,null,null,null);
local_session.ACS_OrderReplacmentOrderInfo := (local_session.ACS_OrderReplacmentOrderInfo,BlankReplacementOrderInfo);
// set up date range to check if there is a duplicate Order.
//FIRST TRY TO GET THE REQUESTEDDTM DATA FROM THE ORDER FORM, IF NOT PRESENT, THEN GET THE DATA FROM THE ORDER SET FORM
//OrderReplacmentOrderInfo := local_session.ACS_OrderReplacmentOrderInfo;
//ThisOrderReplacementOrderInfo := last of (OrderReplacmentOrderInfo where OrderReplacmentOrderInfo.OrderName = OrderName);
requestedDateFieldValue := ThisOrderReplacementOrderInfo.RequestedDate;
requestedTimeFieldValue := ThisOrderReplacementOrderInfo.RequestedTime;
RequestedTimeFieldValue_ReqTimeCode := RequestedTimeFieldValue.ReqTimeCode;
//clear the data
BlankReplacementOrderInfo := NEW ReplacementOrderInfoObj with (OrderName,null,null,null);
local_session.ACS_OrderReplacmentOrderInfo := (local_session.ACS_OrderReplacmentOrderInfo,BlankReplacementOrderInfo);
isStat := false;
//handle if the section is a STAT section - for when there is a scheduled section also, we dont want to use that scheduled date UDDI
if(requestedDateFieldValue is null and requestedTimeFieldValue is null)then
currentSection := MulitOrderCheckbox_fields;
if(currentSection.Label matches pattern "STAT %"
OR currentSection.Label matches pattern "% STAT %"
OR currentSection.Label matches pattern "% STAT"
OR currentSection.Label matches pattern "%-STAT %"
OR currentSection.Label matches pattern "%-STAT"
OR currentSection.Label matches pattern "%-STAT-%")then
requestedDateFieldValue := "T";
RequestedTimeFieldValue_ReqTimeCode := "STAT";
isStat := true;
endif;
endif;
if(requestedDateFieldValue is null)then
currentSection := MulitOrderCheckbox_fields;
if(currentSection.Label matches pattern "% Today"
OR currentSection.Label matches pattern "-Today%")then
requestedDateFieldValue := "T";
endif;
endif;
//if no data from the order form, then use the Order Set Form info.
if(requestedDateFieldValue is null and requestedTimeFieldValue is null)then
requestedDateFieldValue := (first of (this_form.Fields where this_form.Fields.DataItemName = "RequestedDate")).Value;
requestedTimeFieldValue := (first of (this_form.Fields where this_form.Fields.DataItemName = "RequestedTime")).Value;
RequestedTimeFieldValue_ReqTimeCode := RequestedTimeFieldValue.ReqTimeCode;
endif;
//get data from Order Set Config
if(requestedDateFieldValue is null and requestedTimeFieldValue is null)then
replacementOrderOrderSetConfigData := last of (OrderSetConfigData WHERE OrderSetConfigData.OrderSetHeading = currentSection.Label AND OrderSetConfigData.OrderName = OrderName);
//seems runtime removes the double spacing
if(NOT EXISTS replacementOrderOrderSetConfigData)then
replacementOrderOrderSetConfigData := last of (OrderSetConfigData WHERE OrderSetConfigData.OrderSetHeadingSingleSpaced = currentSection.Label AND OrderSetConfigData.OrderName = OrderName);
endif;
requestedDateFieldValue := replacementOrderOrderSetConfigData.RequestedDate;
requestedTimeFieldValue := replacementOrderOrderSetConfigData.ReqestedTime;
RequestedTimeFieldValue_ReqTimeCode := replacementOrderOrderSetConfigData.ReqestedTime;
endif;
//END GET REQUESTEDDTM
if(requestedDateFieldValue is null)then
this_communication.MessageType := "Error";
this_communication.Message := "You must enter a Requested Date.";
else
if(requestedDateFieldValue = "T")then
ClientVisit_TimeZone := read last {ClientVisit: TimeZone };
theDate := NOW as TIME ClientVisit_TimeZone;
if(theDate is null or theDate = null or not exists theDate)then
theDate := NOW as TIME;
endif;
elseif(requestedDateFieldValue matches pattern "T+%")then
ClientVisit_TimeZone := read last {ClientVisit: TimeZone };
theDate := NOW as TIME ClientVisit_TimeZone;
if(theDate is null or theDate = null or not exists theDate)then
theDate := NOW as TIME;
endif;
numDays := call (requestedDateFieldValue as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace with "T+" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, "" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
theDate := theDate + (numDays as number) days;
else
theDate := requestedDateFieldValue;
endif;
begin_date_str := ((extract year theDate) as string) || "-" ||
(extract month theDate) formatted with "%0.2d" || "-" ||
(extract day theDate) formatted with "%0.2d" || " 00:00:00";
end_date_str := ((extract year theDate) as string) || "-" ||
(extract month theDate) formatted with "%0.2d" || "-" ||
(extract day theDate) formatted with "%0.2d" || " 23:59:59";
SQLOrderNamesList := "";
if(OrderName is in ("Basic Metabolic Panel","Basic Metabolic Panel Fasting"))then
SQLOrderNamesList := "{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel Fasting{{{SINGLE-QUOTE}}}";
endif;
if(OrderName is in ("Comprehensive Metabolic Panel","Comprehensive Metabolic Panel Fasting"))then
SQLOrderNamesList := "{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel Fasting{{{SINGLE-QUOTE}}}";
endif;
if(OrderName is in ("CBC (Includes Diff)","CBC with Manual Diff"))then
SQLOrderNamesList := "{{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}";
endif;
if(SQLOrderNamesList <> "")then
query := "select top 1 Name, RequestedDate,RequestedDtm,CV3Order.CreatedWhen,CV3OrderStatus.Description,CV3OrderStatus.LevelNumber"
|| " from CV3Order"
|| " left outer join CV3OrderStatus on CV3OrderStatus.Code = CV3Order.OrderStatusCode and CV3OrderStatus.Active = 1"
|| " where ClientGUID = " || ClientGuid
|| " and ChartGUID = " || ChartGUID
|| " and ClientVisitGUID = " || ClientVisitGUID
|| " and CV3Order.Active = 1 and CV3Order.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} and OrderStatusLevelNum <> 69 and OrderStatusCode <> {{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}} and Name in (" || SQLOrderNamesList || ")"
|| " and CV3OrderStatus.[Description] not in ({{{SINGLE-QUOTE}}}Repeat Generation Finished{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Active Master Order{{{SINGLE-QUOTE}}})"
|| " and (RequestedDtm between " || SQL(begin_date_str) || " and " || SQL(end_date_str)
|| " OR (RequestedDtm is null and RequestedDate = {{{SINGLE-QUOTE}}}T{{{SINGLE-QUOTE}}} and CV3Order.CreatedWhen between " || SQL(begin_date_str) || " and " || SQL(end_date_str)
|| ")) ORDER BY RequestedDate,CV3Order.CreatedWhen";
(FoundOrderName, RequestedDate,RequestedDtm,CreatedWhen,OrderStatus,OrderStatusLevelNum) := read last {"" || query};
if(OrderStatusLevelNum = 10)then
OrderStatus := "Pending";
endif;
if(OrderStatusLevelNum = 50)then
OrderStatus := "Active";
endif;
if(OrderStatusLevelNum = 60)then
OrderStatus := "Received";
endif;
if(OrderStatusLevelNum = 100)then
OrderStatus := "Completed";
endif;
if((OrderStatusLevelNum as number) is in (80,83,85))then
OrderStatus := "Resulted";
endif;
if(exists(CreatedWhen) and CreatedWhen is not null)then
ExisitingDuplicateOrderCnt := 1;
else
ExisitingDuplicateOrderCnt := 0;
endif;
if(ExisitingDuplicateOrderCnt > 0)then //if duplicate orders found
if(OrderName in ("Basic Metabolic Panel","Basic Metabolic Panel Fasting")) then
SelectionMode := "Multiple";
ReplaceOrdersList := ("Lytes"
,"Sodium Plasma/Serum"
,"Potassium Plasma/Serum"
,"Chloride Plasma/Serum"
,"Carbon Dioxide (CO2)"
,"BUN"
,"Creatinine"
,"Glucose Non-Fasting"
,"Calcium Plasma/Serum");
endif;
if(OrderName in ("Comprehensive Metabolic Panel","Comprehensive Metabolic Panel Fasting")) then
SelectionMode := "Multiple";
ReplaceOrdersList := ("Lytes"
,"Sodium Plasma/Serum"
,"Potassium Plasma/Serum"
,"Chloride Plasma/Serum"
,"Carbon Dioxide (CO2)"
,"AST/SGOT"
,"ALT/SGPT"
,"Albumin Plasma/Serum"
,"Alkaline Phosphatase"
,"Bilirubin Total"
,"BUN"
,"Creatinine"
,"Calcium Plasma/Serum"
,"Glucose Non-Fasting"
,"Protein Plasma/Serum");
endif;
if(OrderName in ("CBC (Includes Diff)","CBC with Manual Diff")) then
ReplaceOrdersList := ("CBC No Diff (Hemogram Only)"
,"Hemoglobin and Hematocrit"
,"Platelet Count"
,"H&H and Platelet Count"
);
endif;
if(RequestedDate = "T")then
requestedWhen := CreatedWhen;
else
requestedWhen := RequestedDtm;
endif;
//drop the seconds
requestedWhen := requestedWhen as string;
requestedWhen := substring length(requestedWhen)-3 characters from requestedWhen;
myMessage := "{{{SINGLE-QUOTE}}}" || FoundOrderName || "{{{SINGLE-QUOTE}}} already found for " || requestedWhen || " and is " || OrderStatus || ".\n\n";
if(FoundOrderName matches pattern "%CBC%")then
myMessage := myMessage || "-Select Cancel to Cancel THIS order\n-Select Yes to choose alternate tests (CBC No Diff, H&H, Platelet)\n-Select No to proceed with this order\n";
else
myMessage := myMessage || "-Select Cancel to Cancel THIS order\n-Select Yes to choose individual chemistry tests\n-Select No to proceed with this order\n";
endif;
DialogResult := CALL {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with myMessage as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, "Duplicate Daily Lab Alert" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}},"YesNoCancel" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
if((DialogResult as string) = "Cancel")then
MulitOrderCheckboxFieldItem.IsSelected := false;
endif;
ReplaceOrderNameList := ();
if((DialogResult as string) = "Yes")then
//uncheck the original order in the OS
MulitOrderCheckboxFieldItem.IsSelected := false;
result := call CALLED_LAUNCH_LISTBOX_MLM with ReplaceOrdersList, SelectionMode, "Select Orders";
ReplaceOrderNameList := result;
//break out {{{SINGLE-QUOTE}}}break out{{{SINGLE-QUOTE}}} items
tmp := ();
for item in ReplaceOrderNameList do
BreakOutItems := ();
if(item = "Lytes")then
BreakOutItems := ("Sodium Plasma/Serum","Potassium Plasma/Serum","Chloride Plasma/Serum","Carbon Dioxide (CO2)");
endif;
if(item = "H&H and Platelet Count")then
BreakOutItems := ("Hemoglobin and Hematocrit","Platelet Count");
endif;
if(count BreakOutItems > 0)then
for BOItem in BreakOutItems do
if(BOItem is not in ReplaceOrderNameList)then
tmp := (tmp,BOItem);
endif;
enddo;
else
tmp := (tmp,item);
endif;
enddo;
ReplaceOrderNameList := tmp;
ReplaceOrderNames := "";
for ReplaceOrderName in ReplaceOrderNameList do
if(ReplaceOrderNames = "")then
ReplaceOrderNames := "{{{SINGLE-QUOTE}}}" || ReplaceOrderName || "{{{SINGLE-QUOTE}}}";
else
ReplaceOrderNames := ReplaceOrderNames || ", {{{SINGLE-QUOTE}}}" || ReplaceOrderName || "{{{SINGLE-QUOTE}}}";
endif;
enddo;
endif;
//get this new order{{{SINGLE-QUOTE}}}s UDDIs
for item in ReplaceOrderNameList do
if(QueryList is null)then
QueryList := (SQL(item));
else
QueryList := (QueryList,SQL(item));
endif;
enddo;
UDDIObj := OBJECT [ItemName,DataItemCode,DataTypeCode,IsMandatoryOrderEntry,DefaultValue];
newOrderUDDISQL := "select
CV3OrderCatalogMasterItem.Name
,CV3OrderEntryField.DataItemCode
,CV3DataItem.DataTypeCode
,CV3OrderEntryField.IsMandatoryOrderEntry
,CV3OrderEntryField.DefaultValue
from
CV3OrderCatalogMasterItem (nolock)
join CV3OrderEntryForm (nolock) on CV3OrderEntryForm.FormGUID = CV3OrderCatalogMasterItem.EntryFormGUID
and CV3OrderEntryForm.IsCurrent = 1
and CV3OrderEntryForm.Active = 1
join CV3OrderEntryField
on CV3OrderEntryField.OrderEntryFormGUID = CV3OrderEntryForm.guid
and CV3OrderEntryField.Active = 1
join CV3DataItem on CV3DataItem.Code = CV3OrderEntryField.DataItemCode
where
CV3OrderCatalogMasterItem.Active = 1
and CV3OrderCatalogMasterItem.Name in (" || QueryList || ")";
newOrderUDDIInfo := read as UDDIObj {"" || newOrderUDDISQL};
/////////////////////////
if(Count(ReplaceOrderNameList) > 0)then //if there are items to enter as replacments
error_occurred := false;
try
//-----------------------------------------------------------
// Retrieve current order entry batch.
// The new order can be added only if the parent order
// belongs to the order entry batch
// object owned by the OrderEntryWorksheet.
//-----------------------------------------------------------
orderBatch := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
endtry;
catch Exception ex
error_occurred := true;
error_message := ex.Message;
endcatch;
if error_occurred = false then
//----------------------------------------------------------------------
// Create a new DIAGNOSTIC order from a catalog item
//----------------------------------------------------------------------
try
order_Creation_Reason := "Replacing order: " || OrderName;
for ReplaceOrderName in ReplaceOrderNameList do
// get CatalogMasterItem ObjectsPlus object
ReplaceOrder_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
with ReplaceOrderName;
// Create the order
// Session information has been retrieved from the current worksheet if there
// already exists unsubmitted orders.
// The AvailabilityOverride flag is set to AlwaysOverride which will override any
// availabilty policy defined for this order that defines
// this item as not available at this location. The user still need to have the
// correct override right.
Order_obj := call orderBatch.CreateDiagnosticOrder
with
ReplaceOrder_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
order_Creation_Reason, // Create Reason
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}, // AvailabilityOverride
false, // suppresss messages
(0 as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}, // Created from order primary key
true; // Mandatory on Worksheet
// check if needs to show the order form of the new order
if display_order_form then
order_form_obj:= new NET_OBJECT {{{SINGLE-QUOTE}}}OrderForm{{{SINGLE-QUOTE}}};
order_form_obj.Order := Order_obj;
dialog_return_value := call order_form_obj.ShowDialog;
// when OK button is clicked from the new order{{{SINGLE-QUOTE}}}s form
// the order will be added to the order entry worksheet unsubmitted list by SCM
// no Save command needs to be called in MLM
if (dialog_return_value as String) = "OK" then
// update the informational message to indicate the new order is created
info_message := info_message || "\n" || "Order " || ReplaceOrderName || " is created.";
endif;
else
//freqCodeValue_obj := new net_object {{{SINGLE-QUOTE}}}Frequency{{{SINGLE-QUOTE}}} with "before meals";
//Order_obj.RequestedDate := "T";
//Order_obj.RequestedTime := "Routine";
if(RequestedDateFieldValue = "T")then
Order_obj.RequestedDate := RequestedDateFieldValue;
else
order_date_str := ((extract year (RequestedDateFieldValue AS TIME)) as string) || "-" ||
(extract month (RequestedDateFieldValue AS TIME)) formatted with "%0.2d" || "-" ||
(extract day (RequestedDateFieldValue AS TIME)) formatted with "%0.2d";
Order_obj.RequestedDate := order_date_str;
endif;
//Order_obj.RequestedTime := RequestedTimeFieldValue.ReqTimeCode;
/*
//Order_obj.RequestedTime := RequestedTimeFieldValue_ReqTimeCode;
orderprioritycode := "STAT";
time_obj := CALL {{{SINGLE-QUOTE}}}Time{{{SINGLE-QUOTE}}}.parse WITH "23:45";
req_time_obj := NEW NET_OBJECT {{{SINGLE-QUOTE}}}RequestedTime{{{SINGLE-QUOTE}}} WITH RequestedTimeFieldValue_ReqTimeCode, time_obj;
Order_obj.RequestedTime := req_time_obj;//.CodedTime := RequestedTimeFieldValue_ReqTimeCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
*/
//Order_obj.Frequency := freqCodeValue_obj;
//Order_obj.StopDate := "T+4";
/*
conditionalOrderFieldValue := (first of (this_form.Fields where this_form.Fields.DataItemName = "ConditionalOrder")).Value;
if(ConditionalOrderFieldValue.IsConditional)then//this_communication.PrimaryObj.IsConditional)then
Reason := ConditionalOrderFieldValue.Reason as string;
Activations := ConditionalOrderFieldValue.Number as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}};
conditional := new net_object {{{SINGLE-QUOTE}}}ConditionalOrder{{{SINGLE-QUOTE}}} with Activations as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, Reason as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
Order_obj.ConditionalOrder := conditional;
endif;
*/
//UDO_list := EVOKINGOBJECT.OrderUserData.RECORDS__ ;
if(ThisOrderReplacementOrderInfo is not null)then
UDO_list := ThisOrderReplacementOrderInfo.FormFields;
if(UDO_list is null)then
UDO_list := this_form.Fields;
endif;
else
UDO_list := this_form.Fields;
endif;
lst := (newOrderUDDIInfo WHERE newOrderUDDIInfo.ItemName = ReplaceOrder_catalog_item.Name);
for newOrderUDDIInfoObj in lst do
//get data from USer Entered Form Data
obj := first of (UDO_list WHERE UDO_list.DataItemName = newOrderUDDIInfoObj.DataItemCode);
if(obj is not null and obj.Value is not null)then
thisUDDIName := obj.DataItemName;
thisUDDIValue := obj.Value;
else
//Get Order Set configured Data
obj := first of (OrderSetConfigData WHERE OrderSetConfigData.OrderSetHeading = currentSection.Label AND OrderSetConfigData.OrderName = ReplaceOrder_catalog_item.Name AND UserDataCode = newOrderUDDIInfoObj.DataItemCode);
thisUDDIName := obj.DataItemName;
thisUDDIValue := obj.Value;
endif;
if(thisUDDIValue is not null)then
if(thisUDDIName is in ("RequestedDate","LAB_Order Priorities"))then
if(thisUDDIName = "LAB_Order Priorities")then
if(isStat)then
value := "STAT";
else
value := thisUDDIValue as string;
endif;
if(value <> "")then
void := CALL Order_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with newOrderUDDIInfoObj.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, 0 as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
retval := call Order_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with newOrderUDDIInfoObj.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, value as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
endif;
endif;
else
if(newOrderUDDIInfoObj.DataTypeCode is in ("Restricted Dictionary", "Free Format Text","Suggested Dictionary"))then
value := thisUDDIValue as string;
if(value <> "")then
void := CALL Order_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with newOrderUDDIInfoObj.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, 0 as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
retval := call Order_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with newOrderUDDIInfoObj.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, value as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
endif;
endif;
if(newOrderUDDIInfoObj.DataTypeCode = "Checkbox")then
value := thisUDDIValue as number;
if(value = 1)then
void := CALL Order_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with newOrderUDDIInfoObj.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, 0 as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
retval := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with newOrderUDDIInfoObj.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, 1 as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
endif;
endif;
if(newOrderUDDIInfoObj.DataTypeCode = "Date")then
value := thisUDDIValue as time;
void := CALL Order_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with newOrderUDDIInfoObj.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, 0 as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
retval := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Nullable<DateTime>>{{{SINGLE-QUOTE}}} with newOrderUDDIInfoObj.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}} , value;
endif;
if(newOrderUDDIInfoObj.DataTypeCode = "Time")then
value := thisUDDIValue;// as time;
valueS := value as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
sep := ":" AS {{{SINGLE-QUOTE}}}Char{{{SINGLE-QUOTE}}};
netList := new NET_OBJECT {{{SINGLE-QUOTE}}}List<Char>{{{SINGLE-QUOTE}}};
void := CALL netList.Add WITH sep;
array := CALL netList.ToArray;
parts := CALL valueS.Split WITH array;
myHours := parts[1] as number;
myMinutes := parts[2] as number;
valueT := NEW NET_OBJECT {{{SINGLE-QUOTE}}}ObjectsPlusXA.SunriseClinicalManager.Time{{{SINGLE-QUOTE}}} with (myHours as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}), (myMinutes as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}});
void := CALL Order_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with newOrderUDDIInfoObj.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, 0 as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
retval := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Time>{{{SINGLE-QUOTE}}} with newOrderUDDIInfoObj.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}} , valueT;
endif;
endif;
endif;
enddo;
handledOnOrderForm := false;
//handle required UDDIs
for UDDIToCheck in newOrderUDDIInfo do
newOrderOrderSetConfigData := last of (OrderSetConfigData WHERE OrderSetConfigData.OrderSetHeading = currentSection.Label AND OrderSetConfigData.OrderName = ReplaceOrder_catalog_item.Name AND UserDataCode = UDDIToCheck.DataItemCode);
if(UDDIToCheck.DataItemCode is in ("RequestedDate","RequestedTime"))then
ignore := true; //set from the original order{{{SINGLE-QUOTE}}}s data
elseif(UDDIToCheck.DataItemCode = "LAB_Order Priorities")then
UDDIToCheckCurrentValue := call Order_obj.{{{SINGLE-QUOTE}}}GetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with UDDIToCheck.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
if(UDDIToCheckCurrentValue is null or UDDIToCheckCurrentValue = "")then
if(isStat)then
void := CALL Order_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with UDDIToCheck.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, 0 as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
retval := call Order_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with UDDIToCheck.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, "STAT" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
elseif(newOrderOrderSetConfigData.UserDataCodeValue is not null)then
void := CALL Order_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with UDDIToCheck.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, 0 as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
retval := call Order_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with UDDIToCheck.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, newOrderOrderSetConfigData.UserDataCodeValue as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
elseif(UDDIToCheck.DefaultValue is not null)then
void := CALL Order_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with UDDIToCheck.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, 0 as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
retval := call Order_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with UDDIToCheck.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, UDDIToCheck.DefaultValue as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
else
//display the form so the user cna input required value
order_form_obj:= new NET_OBJECT {{{SINGLE-QUOTE}}}OrderForm{{{SINGLE-QUOTE}}};
order_form_obj.Order := Order_obj;
dialog_return_value := call order_form_obj.ShowDialog;
handledOnOrderForm := true;
endif;
endif;
elseif(UDDIToCheck.IsMandatoryOrderEntry)then
UDDIToCheckCurrentValue := call Order_obj.{{{SINGLE-QUOTE}}}GetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with UDDIToCheck.DataItemCode as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
if(UDDIToCheckCurrentValue is null or UDDIToCheckCurrentValue = "")then
//display the form so the user cna input required value
order_form_obj:= new NET_OBJECT {{{SINGLE-QUOTE}}}OrderForm{{{SINGLE-QUOTE}}};
order_form_obj.Order := Order_obj;
dialog_return_value := call order_form_obj.ShowDialog;
handledOnOrderForm := true;
endif;
endif;
enddo;
/*
//Update the Order{{{SINGLE-QUOTE}}}s Instruction Field
If Instructions_Value Is Not NULL then
If Instructions_Field = "SpecialInstructions" Then
Order_obj.SpecialInstructions := Instructions_Value;
Else
updt_Instructions := call Order_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
Instructions_Field, Instructions_Value;
Endif;
//order_obj.SpecialInstructions
Endif;
*/
//Update if Order is PRN
//Order_obj.IsPRN := EVOKINGOBJECT.IsPRN as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}};
// Save the order directly to the worksheet instead of using a destination
// Do this only because this Alert is configued as "No Override Allowed" and
// any destinations will never be executed.
/*;
orderprioritycode := "STAT";
time_obj := CALL {{{SINGLE-QUOTE}}}Time{{{SINGLE-QUOTE}}}.parse WITH "23:45";
req_time_obj := NEW NET_OBJECT {{{SINGLE-QUOTE}}}RequestedTime{{{SINGLE-QUOTE}}} WITH RequestedTimeFieldValue_ReqTimeCode, time_obj;
Order_obj.RequestedTime := req_time_obj;//.
*/
if(not handledOnOrderForm)then
void := call Order_obj.Save;
endif;
if( Order_obj is NOT NULL ) then
void := call Order_obj.Dispose;
Order_obj:= null;
endif;
if( ReplaceOrder_catalog_item is NOT NULL ) then
void := call ReplaceOrder_catalog_item.Dispose;
ReplaceOrder_catalog_item := null;
endif;
endif;
enddo;
endtry;
catch Exception ex
error_occurred := true;
error_message := ex.Message;
this_communication.MessageType := "Error";
this_communication.Message := error_message;
if( Order_obj is NOT NULL ) then
void := call Order_obj.Dispose;
Order_obj:= null;
endif;
if( ReplaceOrder_catalog_item is NOT NULL ) then
void := call ReplaceOrder_catalog_item.Dispose;
ReplaceOrder_catalog_item := null;
endif;
endcatch;
endif;
////////////////////////
endif; //if there are items to enter as replacments
endif;//SQLOrderNamesList check
endif; //if duplicate orders found
endif; //if item is selected
endif; //RequestedDate not null
enddo; //for each MultiOrderCheckbox field item
enddo; //for each MultiOrderCheckbox field
endif; //not repeat order section
enddo; //for each MultiOrderCheckbox
//endif; //if the MultiOrderCheckbox field exists
endif; //if OS form and Form Close
/*
if(userguid = "1000001084119001")then
break;
endif;
*/
;;
priority: 60
;;
evoke:
;;
logic:
conclude true;
;;
action:
return this_communication,this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,112 @@
maintenance:
title: if Checkbox is selected for not in list display Specify Specimen Source and make mandatory;;
filename: FORM_AFBSmear_CB_NotInList;;
arden: version 2;;
version: 4.50;;
institution: Eclipsys, System MLM;;
author: Beth Hilty and Teresa Spicuzza;;
specialist: ;;
date: 2006-03-14;;
validation: testing;;
library:
purpose: This MLM sets the field Specify Specimen Source text to visible and mandatory if Checkbox is selected.
;;
explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and
Communications objects and compares it to Client Information to determine whether to display
certain fields and make them mandatory.
A Banner message is presented to the user to remind them that these fields must be
completed.
If the patient data does not meet the above conditions the fields are not visible on
the form.
The MLM is not run from a trigger event, but rather is called by the application.
It should be configured to run on Form Open.
;;
keywords: Called MLMs, Form fields, PRN, PRN Reason text
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
// This sets the visible control on the field dataitem - PRX_PRN_Reason
NotInList_field := last of (field_list
where field_list.DataItemName = "LAB_Micro_CB_SpecimenNotInList" );
Specimen_First_field := first of (field_list
where field_list.DataItemName = "LAB_RC_SDES_MicroSource_AFBSmearOnly");
Specimen_Second_field := first of (field_list
where field_list.DataItemName = "LAB_RC_SDES_MicroExBF_Sites");
If exists NotInList_field and NotInList_field.value=true
then
Specimen_First_field.control_mandatory := FALSE;
Specimen_First_field.control_visible := FALSE;
Specimen_Second_field.control_mandatory :=TRUE;
Specimen_Second_field.control_visible :=TRUE;
// populate the fields that can be modified on the communication object
// DisplayForm can be "Yes", "No", or "No Change"
// Message is free text
// MessageType can be Informational, Error, or Banner
//this_communication.DisplayForm := "Yes";
//this_communication.Message := "The field {{{SINGLE-QUOTE}}}"
// || Date_label ||"{{{SINGLE-QUOTE}}} must be completed.";
//this_communication.MessageType := "Banner";
else
Specimen_First_field.control_mandatory := TRUE;
Specimen_First_field.control_visible := TRUE;
Specimen_Second_field.control_mandatory :=FALSE;
Specimen_Second_field.control_visible :=FALSE;
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:

View File

@@ -0,0 +1,110 @@
maintenance:
title: FORM_ANTIBIOTIC_ORDERS_PROTECT_DOSE;;
mlmname: FORM_ANTIBIOTIC_ORDERS_PROTECT_DOSE;;
arden: version 2.5;;
version: 15.10;;
institution: St Clair Hospital;;
author: Juliet M. Law, Allscripts;;
specialist: Janet Nordin, Allscripts;;
date: 2016-02-25;;
validation: testing;;
library:
purpose: This MLM triggers on orders contained in the Antibiotics (ASP) Order Sets.
;;
explanation: Makes all dose (and ED frequency) antibiotic ordering fields read-only when called from Antibiotic order sets
Change History
----------------
05.31.2016 JML CSR# 34091 - Created to protect dose field on several antibiotic orders
05.10.2017 JML CSR 35272: Modified to work with new Sepsis Unknown Source Antibiotic ED order set AND
Sepsis Work Up Orders (ED) order set
;;
keywords: Called MLMs, Form fields, antibiotic
;;
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;
/***************************************************************************************/
// Initialize error message
// error_occurred := false;
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGuid;
chart_guid := this_communication.ChartGUID;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormType := this_communication.FormType;
OrderSetName := this_communication.PrimaryObj.OrderSetName;
ASP_OSName := ( "IntraAbdominal Antibiotic ED",
"Pneumonia Antibiotic ED",
"Pneumonia Antibiotic Outpatient ED",
"Genitourinary Antibiotic",
"Genitourinary Antibiotic ED",
"IntraAbdominal Antibiotic",
"Pneumonia Antibiotic",
"Pneumonia Antibiotic Outpatient",
"Skin Antibiotic Inpatient",
"Skin Antibiotic Inpatient ED",
"Skin Antibiotic Outpatient",
"Skin Antibiotic Outpatient ED",
"C Diff Antibiotic ED",
"C Diff Antibiotic",
"Antibiotic Guidelines ED",
"Antibiotic Guidelines",
"Sepsis Unknown Source Antibiotic",
"Sepsis Unknown Source Antibiotic ED",
"Septic Work Up Orders" );
doseFld := first of ( field_list WHERE field_list.DataItemName = "DosageLow" );
uomFld := first of ( field_list WHERE field_list.DataItemName = "Uom" );
routeFld := first of ( field_list WHERE field_list.DataItemName = "OrderRouteCode" );
freqFld := first of ( field_list WHERE field_list.DataItemName = "FrequencyCode" );
stopFld := first of ( field_list WHERE field_list.DataItemName = "StopAfter" );
if ( OrderSetName IN ASP_OSName OR OrderSetName matches pattern "Transition Orders%" ) then
doseFld.control_read_only := true;
uomFld.control_read_only := true;
if ( OrderSetName matches pattern "%ED" ) then
freqFld.control_read_only := true;
endif;
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:

View File

@@ -0,0 +1,747 @@
maintenance:
title: Antibiotic Scheduling;;
mlmname: FORM_Antibiotic_Scheduling;;
arden: version 2;;
version: 5.50;;
institution: St Clair;;
author: Teresa Spicuzza;;
specialist: Don Warnick;;
date: 2014-02-11;;
validation: testing;;
library:
purpose: Automatic Medication Scheduling
;;
explanation: The MLM will select a schedule for an medication based upon the last dose of the prior similar medication
Change history
02.11.2014 DW CSR# 32133 Automatic Medication Scheduling
05.20.2016 JML CSR# 34091 Define exception case when antibiotic scheduling should not run
07.19.2016 BB CSR# 33588 FBC Admission Order set has its own set of rules for Antibiotic scheduling, so this MLM logic
needs to be excluded from CSR#33588 (MLM: FORM_SET_FBC_ADMISSION_ORDERS).
09.22.2017 DW HD# 2763521 Corrected an issue with the top of the hour scheuling programming. Orders scheduled for the last quarter of the hours >=45 were scheduling for the following hour
The June 2016 update broke this code
03.13.2018 TMS CSR 34822 Exclusions added for Zosyn extended infusion.
;;
keywords: Automatic Medication Scheduling
;;
knowledge:
type: data-driven;;
data:
// To introduce new medication categories, update PrimaryTherapeuticCatagoriesSupported & ExcludedTherapeuticCatagories
PrimaryTherapeuticCatagoriesSupported := ("anti-infectives");
ExcludedTherapeuticCatagories := ("anti-infectives | antimalarial agents","anti-infectives | antituberculosis agents",
"anti-infectives | antiviral agents","anti-infectives | macrolide derivatives",
"anti-infectives | miscellaneous antibiotics", "anti-infectives | urinary anti-infectives");
// Define the patient sleeping hours (these hours are avioded for PO administration of some drugs)
bedtime := 00;
waketime := 06;
PORoutes := ("Chew","Chewed","Dissolve in Mouth","Gargle","Oral","PO","Swish","Swish and Spit","Swish and Swallow");
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
(this_communication,this_form,client_info_obj) := argument;
local_session := cds_session.local;
// Restrict who sees the "valdation" alerts
userguid := this_communication.userguid;
useridcode:= read last {" Select idcode from cv3user with (nolock) where guid = " || SQL(userguid)};
FireOnUser:= ("dwarnicktest","ageorgulistest","dbellissimotest");
worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
error_message:="";
field_list := this_form.fields;
comm_primary_obj := this_communication.PrimaryObj;
order_set_name := comm_primary_obj.OrderSetName;
order_name := comm_primary_obj.Name;
continue_processing := true;
ClientGuid := this_communication.ClientGUID;
VisitGuid := this_communication.ClientVisitGUID;
ChartGuid := this_communication.ChartGuid;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
CurrentMinute:= extract minute NOW;
CurrentHour := extract hour NOW;
NextHour := extract hour NOW + 1;
HourAfterNext:= extract hour NOW + 2;
// GATHER INFORMATION ABOUT THIS ORDER
SCIP := last of (field_list where field_list.DataItemName = "PRX_AntibioticNameforMLM");
SCIPValue := SCIP.Value;
Frequency := last of (field_list where field_list.DataItemName = "frequencycode");
FrequencyValue := Frequency.Value;
Route := last of (field_list where field_list.DataItemName = "orderroutecode");
RouteValue := Route.Value;
RequestedTime:= last of (field_list where field_list.DataItemName = "RequestedTime");
RequestedTimeValue := RequestedTime.value;
RequestedDate:= last of (field_list where field_list.DataItemName = "RequestedDate");
Override_Abx_Scheduling := first of ( field_list WHERE field_list.DataItemName = "PRX_Override_Abx_Scheduling" );
if ( exists Override_Abx_Scheduling ) then
if ( ( CallingEvent = "FieldChange" AND CallingField = "PRX_Override_Abx_Scheduling" ) OR CallingEvent = "FormOpen" or (CallingEvent = "FieldChange" AND Override_Abx_Scheduling.Value = true ) ) then
// if ( ( CallingEvent = "FieldChange" AND CallingField = "PRX_Override_Abx_Scheduling" ) OR CallingEvent = "FormOpen" ) then
if ( Override_Abx_Scheduling.Value = false ) then
continue_processing := true;
elseif ( Override_Abx_Scheduling.Value = true ) then
continue_processing := false;
if order_set_name <> "Family Birth Center Admission" Then //[BB] Added to exclude FBC antibiotics from this scheduling 7/19/16
if ( order_name = "Vancomycin:" ) then
//Determine if vancomycin load dose has been given
( o_vancoLoadExists,
o_vancoLoadReqDtm,
o_vancoAdmin) := READ LAST { "SELECT 1, CASE WHEN ot.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} THEN ot.PerformedFromDtm"
|| " ELSE o.RequestedDtm END"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
|| " ON cv.ClientGUID = o.ClientGUID"
|| " AND cv.GUID = o.ClientVisitGUID"
|| " AND cv.ChartGUID = o.ChartGUID"
|| " JOIN CV3OrderTaskOccurrence ot WITH (NOLOCK)"
|| " ON ot.ClientGUID = o.ClientGUID"
|| " AND ot.OrderGUID = o.GUID"
|| " WHERE o.NAME LIKE {{{SINGLE-QUOTE}}}VANCOMYCIN%{{{SINGLE-QUOTE}}}"
|| " AND o.FrequencyCode IN ({{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Now{{{SINGLE-QUOTE}}})"
|| " AND cv.ClientGUID = " || SQL(ClientGuid)
|| " AND cv.GUID = " || SQL(VisitGuid)
|| " AND cv.ChartGUID = " || SQL(ChartGuid)
|| " AND DateDiff(hh, o.Entered, GETDATE()) <= 48"
|| " AND (o.OrderStatusLevelNum > 15"
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))"
|| " order by o.Entered ASC" };
endif;
if ( FrequencyValue.FrequencySummary matches pattern "Q%H" ) and (order_name <> "Piperacillin/Tazobactam:" and order_name <> "Piperacillin/Tazobactam;" ) then
if ( order_name = "Vancomycin:" ) then
if ( not exists o_vancoLoadExists ) then
spanhourfromnow := (now + 30 minute);
else
spanhourfromnow := ( ( o_vancoLoadReqDtm as Time ) + 30 minute );
endif;
else
spanhourfromnow := (now + 30 minute);
endif;
frequencyNum := Substring 2 Characters STARTING AT 2 From ( FrequencyValue.FrequencySummary as string );
plusminus := (frequencyNum as number);
newstarttime := (spanhourfromnow as time) + (plusminus hour) ;
newhr := extract hour newstarttime;
newhr := newhr formatted with "%2.2d";
newyr := extract year newstarttime;
newmn := extract month newstarttime;
newmn := newmn formatted with "%2.2d";
newdd := extract day newstarttime;
newdd := newdd formatted with "%2.2d";
filldate := (newyr || "-" || newmn || "-" || newdd || " 00:00") as time;
filltime := newhr || ":00";
hourtest := filltime;
RequestedDate.Value := filldate;
RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
RequestedTimeValue.ReqTimeValue := filltime;
local_session.SessionVancoTroughScheduledDate := RequestedDate.Value;
local_session.SessionVancoTroughScheduledTime := RequestedTime.Value;
endif;
endif; //[BB] Added to exclude antibiotics from this scheduling 7/19/16
endif;
endif;
endif;
if ( continue_processing = true ) then
If (CallingEvent = "FieldChange" and ( CallingField = "frequencycode" OR CallingField = "PRX_Override_Abx_Scheduling" ) ) or CallingEvent = "FormOpen" then
// Gather information about the drug
(DrugKey, TherapeuticCategory, ExcludedClassType, PrimaryTherapeuticCategory) := read last
{
" select dm.DrugKey, ocmi.TherapeuticCategory , "
|| " ( select top 1 ctv.Value "
|| " from cv3catalogclasstypevalue ctv with (nolock) "
|| " join CV3ClassType ct on ct.guid = ctv.ClassTypeGUID and ct.code = {{{SINGLE-QUOTE}}}PRX_AutoSched_Exclude_for_MLM{{{SINGLE-QUOTE}}} and ct.UserDictionaryCode = {{{SINGLE-QUOTE}}}Medication_Auto_Scheduling{{{SINGLE-QUOTE}}} "
|| " where ctv.Value = {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} and ctv.catalogmasterguid = " || this_communication.ItemID || " ) "
|| " ,case when CHARINDEX ({{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}},ocmi.TherapeuticCategory) > 0 "
|| " then substring (ocmi.TherapeuticCategory, 1, CHARINDEX ({{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}},ocmi.TherapeuticCategory)-2)"
|| " else ocmi.TherapeuticCategory "
|| " end "
|| " from CV3OrderCatalogMasterItem ocmi with (nolock) "
|| " join cv3drugmapping dm with (nolock) on dm.catalogitemguid = ocmi.guid "
|| " where ocmi.guid = " || this_communication.ItemID || " "
};
// Determine if it is Vancomycin
If DrugKey = "D00125" then
Vancomycin := "Yes";
else
Vancomycin := "No";
endif;
// Gather information about the frequency
// Determine Frequency Interval ( "Q3H" = "3" & "hr(s)" )
(FrequencyInterval,FrequencyTimeUOM) := read last
{
" select timefromvalue,TimeUom from CV3Frequency with (nolock) "
|| " where code = {{{SINGLE-QUOTE}}}" || FrequencyValue.FrequencySummary || "{{{SINGLE-QUOTE}}}"
};
// Determine if it is a QxH Frequency
If FrequencyValue.FrequencySummary matches pattern "Q%H" then
FrequencyQxH := "Yes";
else
FrequencyQxH := "No";
endif;
// Determine Schedule Type ("A" = "Fixed" start time...BID,QHS etc... "S" = "Variable" start time....Q4H, Q8H etc...)
ScheduleType := read last
{
" select case when SUBSTRING(value,CHARINDEX({{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}},Value)+1,LEN(1)) = {{{SINGLE-QUOTE}}}A{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Fixed{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}Variable{{{SINGLE-QUOTE}}} end "
|| " from CV3UserDictionaryValue with (nolock) "
|| " WHERE UserDictionaryCode = {{{SINGLE-QUOTE}}}PRX_Dosing Frequency{{{SINGLE-QUOTE}}} AND Active = 1 AND Value like {{{SINGLE-QUOTE}}}" || FrequencyValue.FrequencySummary || "%{{{SINGLE-QUOTE}}} "
};
// Convert the Frequency Code to Doses Per Day
(DosesPerDay) := read last
{
" select count (fsd.ScheduledTime) from CV3CodedFreqTranslation cft with (nolock) "
|| " join CV3FixedScheduleDefinition fsd with (nolock) on fsd.ParentGUID = cft.guid "
|| " where cft.FrequencyCode = {{{SINGLE-QUOTE}}}" || FrequencyValue.FrequencySummary || "{{{SINGLE-QUOTE}}} and "
|| " FrequencyClass = {{{SINGLE-QUOTE}}}<Default>{{{SINGLE-QUOTE}}} and cft.active = 1 "
};
// For the selected Frequency, find the first dose of the day and next scheduled dose today
(NextScheduledDoseTomorrow,NextScheduledDoseToday) := read last
{
" select top 1 "
|| " (select top 1 fsdx.ScheduledTime from CV3FixedScheduleDefinition fsdx with (nolock) where fsdx.ParentGUID = cft.guid "
|| " order by fsdx.ScheduledTime), "
|| " (select top 1 fsdy.ScheduledTime from CV3FixedScheduleDefinition fsdy with (nolock) where fsdy.ParentGUID = cft.guid "
|| " and fsdy.ScheduledTime > REPLACE(CONVERT(VARCHAR(5), GETDATE(), 108), {{{SINGLE-QUOTE}}}:{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) "
|| " order by fsdy.ScheduledTime ) "
|| " from CV3CodedFreqTranslation cft with (nolock) "
|| " join CV3FixedScheduleDefinition fsd with (nolock) on fsd.ParentGUID = cft.guid "
|| " where cft.FrequencyCode = {{{SINGLE-QUOTE}}}" || FrequencyValue.FrequencySummary || "{{{SINGLE-QUOTE}}} and FrequencyClass = {{{SINGLE-QUOTE}}}<Default>{{{SINGLE-QUOTE}}} and cft.active = 1 "
};
// If there are no more scheduled doses for today, use the first scheduled dose tomorrow
If NextScheduledDoseToday is not null then
NextScheduledDoseTime:= NextScheduledDoseToday;
NextScheduledDoseDay := "today";
NextScheduledDoseDate:= (Now) FORMATTED WITH "%.2t";
else
NextScheduledDoseTime:= NextScheduledDoseTomorrow;
NextScheduledDoseDay := "tomorrow";
NextScheduledDoseDate:= (Now + 1 day) FORMATTED WITH "%.2t";
endif;
NextScheduledDoseTime:= NextScheduledDoseTime formatted with "%4.4d"; // Zero Pad to 4 characters (900 becomes 0900)
NextScheduledDoseTime:= (SUBSTRING 2 CHARACTERS STARTING AT 1 FROM NextScheduledDoseTime) || ":" || // hours
(SUBSTRING 2 CHARACTERS STARTING AT 3 FROM NextScheduledDoseTime); // minutes
If TherapeuticCategory in ExcludedTherapeuticCatagories then
ExcludedTherapeuticCategory := "Yes";
else
ExcludedTherapeuticCategory := "No";
endif;
// Proceed if this is a supported Theraputic Category and not individually flagged for Exclusion
// and not a "one-time" order
// and not in a Hold session
// and not a SCIP drug
If ( PrimaryTherapeuticCategory in PrimaryTherapeuticCatagoriesSupported and
( ExcludedClassType = "No" or ExcludedClassType is null ) and
FrequencyInterval is not null and
ScheduleType is not null and
worksheetinfo.sessiontype <> "Hold" and
SCIPValue is null ) then
// GATHER INFORMATION ABOUT MOST RECENTLY ADMINISTERED ORDER (past 2 days) OF THE SAME CATEGORY
(ExistingOrderLastGiven, ExistingOrderFrequency, ExistingOrderHoursSinceGiven,
ExistingOrderName, ExistingOrderTherapeuticCategory, ExistingOrderDrugKey,
ExistingRoute, ExistingNextTaskPending, ExistingNextTaskCanceled) := read last
{
" select oto.performedfromdtm, o.FrequencyCode, datediff (HH, oto.performedfromdtm, getdate()), "
|| " o.name, ocmi.TherapeuticCategory, dm.DrugKey, ot.OrderRoute "
|| " ,(select top 1 oto2.SignificantDtm from cv3ordertaskoccurrence oto2 with (nolock) "
|| " where oto2.clientguid = ot.clientguid and oto2.orderguid = o.guid and oto2.ordertaskguid = ot.guid "
|| " and oto2.SignificantDtm > getdate()-2 and oto2.taskstatuscode = {{{SINGLE-QUOTE}}}Pending{{{SINGLE-QUOTE}}}) "
|| " ,(select top 1 oto2.SignificantDtm from cv3ordertaskoccurrence oto2 with (nolock) "
|| " where oto2.clientguid = ot.clientguid and oto2.orderguid = o.guid and oto2.ordertaskguid = ot.guid "
|| " and oto2.SignificantDtm > getdate()-2 and oto2.taskstatuscode = {{{SINGLE-QUOTE}}}Canceled{{{SINGLE-QUOTE}}}) "
|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
|| " join cv3drugmapping dm with (nolock) on dm.catalogitemguid = ocmi.guid "
|| " join cv3order o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|| " and o.ClientGUID = " || ClientGuid || " "
|| " and o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}" || TherapeuticCategory || "{{{SINGLE-QUOTE}}} "
|| " join cv3ordertask ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid "
|| " join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid "
|| " and oto.ordertaskguid = ot.guid and oto.SignificantDtm > getdate()-2 and oto.taskstatuscode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
|| " order by oto.performedfromdtm "
};
(ExistingOrderInterval) := read last {"select timefromvalue from CV3Frequency with (nolock) where code = {{{SINGLE-QUOTE}}}" || ExistingOrderFrequency || "{{{SINGLE-QUOTE}}}"};
ExistingNextTaskPendingDate:= ExistingNextTaskPending FORMATTED WITH "%.2t";
ExistingNextTaskPendingTime:= extract hour ExistingNextTaskPending || ":" || extract minute ExistingNextTaskPending;
ExistingNextTaskCanceledDate:= ExistingNextTaskCanceled FORMATTED WITH "%.2t";
ExistingNextTaskCanceledTime:= extract hour ExistingNextTaskCanceled || ":" || extract minute ExistingNextTaskCanceled;
// Determine how the order compares to the most recently charted order of the same therapeutic category
CategoryMatch := "No";
DrugMatch := "No";
FrequencyMatch:= "No";
RouteMatch := "No";
if TherapeuticCategory = ExistingOrderTherapeuticCategory then
CategoryMatch := "Yes";
else
CategoryMatch := "No";
endif;
if DrugKey = ExistingOrderDrugKey then
DrugMatch := "Yes";
else
DrugMatch := "No";
endif;
if FrequencyValue.FrequencySummary = ExistingOrderFrequency then
FrequencyMatch := "Yes";
else
FrequencyMatch := "No";
endif;
if RouteValue = ExistingRoute then
RouteMatch := "Yes";
else
RouteMatch := "No";
endif;
// SCENARIOS
If CategoryMatch = "No" then
// Different Category (no drug of the same category in the past 2 days)
Scenario := "6";
If ScheduleType = "Variable" then
// Variable Start Time
TargetHour := NextHour;
TargetDate := NOW;
else
// Fixed Start Time
RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
RequestedTimeValue.ReqTimeValue := NextScheduledDoseTime;
RequestedDate.Value := NextScheduledDoseDate;
endif;
else
// Same Category
If DrugMatch = "Yes" then
// Same Category / Same Drug
If Vancomycin = "No" or (Vancomycin = "Yes" and RouteMatch = "Yes") then
// Same Category / Same Drug / Not Vanco Same Route
If FrequencyMatch = "Yes" then
// Same Category / Same Drug / Not Vanco Same Route / Same Frequency
Scenario := "4";
If ExistingNextTaskPending is not null then
TargetHour := extract hour ExistingNextTaskPending;
TargetDate := ExistingNextTaskPending;
else
TargetHour := extract hour ExistingNextTaskCanceled;
TargetDate := ExistingNextTaskCanceled;
endif;
else
// Same Category / Same Drug / Not Vanco Same Route / Different Frequency
If FrequencyQxH = "Yes" then
// Same Category / Same Drug / Not Vanco Same Route / Different Frequency / QxH
Scenario := "3&5";
TargetHour := extract hour ExistingOrderLastGiven + FrequencyInterval;
TargetDate := ExistingOrderLastGiven;
else
// Same Category / Same Drug / Not Vanco Same Route / Different Frequency / non-QxH
If DosesPerDay <= 2 then
// Same Category / Same Drug / Not Vanco Same Route / Different Frequency / non-QxH / < 2 doses/day
Scenario := "8";
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n\nThis medication was last given on " || (SUBSTRING 10 CHARACTERS STARTING AT 1 FROM (ExistingOrderLastGiven as string)) ||
" at" || (SUBSTRING 6 CHARACTERS STARTING AT 11 FROM (ExistingOrderLastGiven as string)) || "." ||
"\n\n\nThe next scheduled administration time will be " || NextScheduledDoseDay || " at " || NextScheduledDoseTime || "." ||
"\n\n\nYour judgement is required for scheduling. " ||
"\n\n\nPlease select an appropriate start time.","Start Time", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
RequestedTimeValue.ReqTimeValue := NextScheduledDoseTime;
RequestedDate.Value := NextScheduledDoseDate;
else
// Same Category / Same Drug / Not Vanco Same Route / Different Frequency / non-QxH / > 2 doses/day
Scenario := "7";
RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
RequestedTimeValue.ReqTimeValue := NextScheduledDoseTime;
RequestedDate.Value := NextScheduledDoseDate;
endif; // Doses per Day < 2 >
endif; // FrequencyQxH
endif; // Frequency Match
else
// Same Category / Same Drug / Vanco Same Route
Scenario := "10";
If ScheduleType = "Variable" then
// Variable Start Time
TargetHour := NextHour;
TargetDate := NOW;
else
// Fixed Start Time
RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
RequestedTimeValue.ReqTimeValue := NextScheduledDoseTime;
RequestedDate.Value := NextScheduledDoseDate;
endif;
endif; // Vancomycin
else
// Same Category / Different Drug
If ExcludedTherapeuticCategory = "Yes" then
// Same Category / Different Drug / Excluded Category Type
Scenario := "9";
If ScheduleType = "Variable" then
// Variable Start Time
TargetHour := NextHour;
TargetDate := NOW;
else
// Fixed Start Time
RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
RequestedTimeValue.ReqTimeValue := NextScheduledDoseTime;
RequestedDate.Value := NextScheduledDoseDate;
endif;
else
// Same Category / Different Drug / Not an Excluded Category Type
If ExistingOrderInterval is null then
// Same Category / Different Drug / One-Time Dose
if (CallingEvent = "FormOpen" and FrequencyValue.FrequencySummary is not null) or CallingEvent = "FieldChange" then
Scenario := "11";
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n\n This medication cannot be be auto-scheduled " ||
"\n\n " || ExistingOrderName || " was given on " || (SUBSTRING 10 CHARACTERS STARTING AT 1 FROM (ExistingOrderLastGiven as string)) ||
" at" || (SUBSTRING 6 CHARACTERS STARTING AT 11 FROM (ExistingOrderLastGiven as string)) || "." ||
"\n\n Please enter a start time. " ||
"\n\n " || "\n ","Unable to Auto-Schedule", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
RequestedDate.Value := (Now) FORMATTED WITH "%.2t";
RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
RequestedTimeValue.ReqTimeValue:= "";
endif;
else
If ExistingOrderHoursSinceGiven > ExistingOrderInterval then
// Same Category / Different Drug / Not One-Time Dose / Outside the Span
Scenario := "2";
If ScheduleType = "Variable" then
// Variable Start Time
TargetHour := NextHour;
TargetDate := NOW;
else
// Fixed Start Time
RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
RequestedTimeValue.ReqTimeValue := NextScheduledDoseTime;
RequestedDate.Value := NextScheduledDoseDate;
endif;
else
// Same Category / Different Drug / Not One-Time Dose / Within the Span
If FrequencyQxH = "No" then
// Same Category / Different Drug / Not One-Time Dose / Within the Span / QxH
If DosesPerDay <= 2 then
// Same Category / Different Drug / Not One-Time Dose / Within the Span / non-QxH / < 2 doses/day
Scenario := "18";
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n\nThis medication was last given on " || (SUBSTRING 10 CHARACTERS STARTING AT 1 FROM (ExistingOrderLastGiven as string)) ||
" at" || (SUBSTRING 6 CHARACTERS STARTING AT 11 FROM (ExistingOrderLastGiven as string)) || "." ||
"\n\n\nThe next scheduled administration time will be " || NextScheduledDoseDay || " at " || NextScheduledDoseTime || "." ||
"\n\n\nYour judgement is required for scheduling. " ||
"\n\n\nPlease select an appropriate start time.","Start Time", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
RequestedTimeValue.ReqTimeValue := NextScheduledDoseTime;
RequestedDate.Value := NextScheduledDoseDate;
else
// Same Category / Same Drug / Not Vanco Same Route / Different Frequency / non-QxH / > 2 doses/day
Scenario := "17";
RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
RequestedTimeValue.ReqTimeValue := NextScheduledDoseTime;
RequestedDate.Value := NextScheduledDoseDate;
endif;
else
Scenario := "1";
If ExistingNextTaskPending is not null then
ExistingNextTaskTime := ExistingNextTaskPendingTime;
ExistingNextTaskDate := ExistingNextTaskPendingDate;
ExistingNextTaskDTM := ExistingNextTaskPending FORMATTED WITH "%.4t";
else
ExistingNextTaskTime := ExistingNextTaskCanceledTime;
ExistingNextTaskDate := ExistingNextTaskCanceledDate;
ExistingNextTaskDTM := ExistingNextTaskCanceled FORMATTED WITH "%.4t";
endif; // Is there a Pending task (if not use next Canceled task)
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n\n The last dose of {{{SINGLE-QUOTE}}}" || ExistingOrderName || "{{{SINGLE-QUOTE}}}" ||
" was given at " || ExistingOrderLastGiven FORMATTED WITH "%.4t" || "." ||
"\n\n This order will be scheduled to start at " || ExistingNextTaskDTM || "." ||
"\n\n Select YES to continue with this time. " ||
"\n\n Select No to start Now or modify the start time. " || "\n ","Start Time", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
If (dlg_result as string) = "Yes" then
// Same Category / Different Drug / Not One-Time Dose / Within the Span / "Yes", Start next scheduled
// Scenario 1C
Scenario := Scenario || " C";
CalculatedHour:= extract hour ExistingNextTaskPending;
// Determine if the scheduled start time would cause a bedtime dose
BedTimeDoses:= "";
NextDose := CalculatedHour + FrequencyInterval;
indexList := 1 seqto DosesPerDay;
for i in indexList do
If NextDose >= 24 then NextDose := NextDose -24; endif;
If NextDose >= 48 then NextDose := NextDose -48; endif;
If NextDose < waketime and NextDose > bedtime then
If NextDose < 10 then
BedTimeDose := "0" || NextDose || ":00"; // zero pad if necessary & append minutes
else
BedTimeDose := NextDose || ":00"; // just append minutes
endif;
BedTimeDoses := BedTimeDoses || " " || BedTimeDose; // add it to the list
endif;
NextDose := NextDose + FrequencyInterval;
enddo;
// If a PO bed time dose would result from the automated scheduling, ask the clinician to schedule it themselves
If BedTimeDoses <> "" and RouteValue in PORoutes then
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n\n Automatic {{{SINGLE-QUOTE}}}start time{{{SINGLE-QUOTE}}} calculation has determined that this medication can be started on " || ExistingNextTaskDate || " at " || CalculatedHour || ":00." ||
"\n\n\nHowever, this would create an administration schedule for a dose to be given " || RouteValue || " at" || BedTimeDoses || " , which falls during the patient{{{SINGLE-QUOTE}}}s bedtime hours." ||
"\n\n\n Your judgement is required for scheduling. " ||
"\n\n\n Please select an appropriate start time " || "\n ","Calculated Start Time Would Create Bed Time Doses ", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Error" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
RequestedDate.Value := (Now) FORMATTED WITH "%.2t";
RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
RequestedTimeValue.ReqTimeValue:= "";
else
RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
RequestedTimeValue.ReqTimeValue := ExistingNextTaskTime;
RequestedDate.Value := ExistingNextTaskDate;
endif; // BedTimeDoses <> "" and ExistingRoute = "PO"
else
// Same Category / Different Drug / Not One-Time Dose / Within the Span / "No", Start Now
// Scenario 1 A or B
TargetHour := NextHour;
TargetDate := Now;
endif; // Start Now? (YES or NO)
endif; // Within the Span
endif; // QxH
endif; // One-Time Dose
endif; // Excluded Category
endif; // Drug Match
endif; // Category Match
// SCHEDULED TIME ADJUSTMENTS - for variable start time frequencies
If TargetHour is not null and FrequencyTimeUOM = "hr(s)" then
// Adjust for Calculated Dose Hour greater than 24 (next dose falls after midnight today)
If TargetHour < 24 then
// CalculatedHour := TargetHour formatted with "%2.2d"; 09.22.2017 DW HD# 2763521 This formatting introduced on 6/1/2015 created an issue with the top of the hour >=45 scheuling programming.
CalculatedHour := TargetHour;
ElseIf TargetHour >= 24 and TargetHour < 48 then
CalculatedHour := TargetHour - 24;
TargetDate := TargetDate + 1 day;
ElseIf TargetHour >= 48 then
CalculatedHour := TargetHour - 48;
TargetDate := TargetDate + 2 day;
endif;
// Adjust for Calculated Dose Time that is in the past...begin now (existing med has missed recent doses)
TimeNow := (extract year NOW) FORMATTED WITH "%2.2d" || (extract month NOW) FORMATTED WITH "%2.2d" ||
(extract day NOW) FORMATTED WITH "%2.2d" || (extract hour NOW) FORMATTED WITH "%2.2d" ||
(extract minute NOW) FORMATTED WITH "%2.2d";
TimeScheduled:= (extract year TargetDate) FORMATTED WITH "%2.2d" || (extract month TargetDate) FORMATTED WITH "%2.2d" ||
(extract day TargetDate) FORMATTED WITH "%2.2d" || CalculatedHour FORMATTED WITH "%2.2d" || "00";
if TimeScheduled < TimeNow then
CalculatedHour :=NextHour;
TargetDate := NOW;
endif;
// Adjust for Administration time calculated for < 15 minutes...offset the time by an hour
If CurrentMinute >= 45 and CalculatedHour = (EXTRACT HOUR Now) +1 then
CalculatedHour := CalculatedHour + 1; Scenario := Scenario || " B";
else
CalculatedHour := CalculatedHour ; Scenario := Scenario || " A";
endif;
// The Adjustments could have placed the start time to after midnight....if so, adjust date and hour
If CalculatedHour >= 24 then
CalculatedHour := CalculatedHour - 24;
a := "in calc hour";
TargetDate := TargetDate + 1 day;
endif;
// Format the date and time as required by the form fields
CalculatedTime := CalculatedHour || ":00";
CalculatedDate := TargetDate FORMATTED WITH "%.2t";
// Determine if the scheduled start time would cause a bedtime dose
BedTimeDoses:= "";
NextDose := CalculatedHour + FrequencyInterval;
indexList := 1 seqto DosesPerDay;
for i in indexList do
If NextDose >= 24 then NextDose := NextDose -24; endif;
If NextDose >= 48 then NextDose := NextDose -48; endif;
If NextDose < waketime and NextDose > bedtime then
If NextDose < 10 then
BedTimeDose := "0" || NextDose || ":00"; // zero pad if necessary & append minutes
else
BedTimeDose := NextDose || ":00"; // just append minutes
endif;
BedTimeDoses := BedTimeDoses || " " || BedTimeDose; // add it to the list
endif;
NextDose := NextDose + FrequencyInterval;
enddo;
// If a PO bed time dose would result from the automated scheduling, ask the clinician to schedule it themselves
If BedTimeDoses <> "" and RouteValue in PORoutes then
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n\n Automatic {{{SINGLE-QUOTE}}}start time{{{SINGLE-QUOTE}}} calculation has determined that this medication can be started on " || CalculatedDate || " at " || CalculatedHour || ":00." ||
"\n\n\nHowever, this would create an administration schedule for a dose to be given " || RouteValue || " at" || BedTimeDoses || " , which falls during the patient{{{SINGLE-QUOTE}}}s bedtime hours." ||
"\n\n\n Your judgement is required for scheduling. " ||
"\n\n\n Please select an appropriate start time " || "\n ","Calculated Start Time Would Create Bed Time Doses ", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Error" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
RequestedDate.Value := (Now) FORMATTED WITH "%.2t";
RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
RequestedTimeValue.ReqTimeValue:= "";
else
RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
RequestedTimeValue.ReqTimeValue := CalculatedTime;
RequestedDate.Value := CalculatedDate;
endif; // BedTimeDoses <> "" and ExistingRoute = "PO"
endif; // Target Time (variable hourly shedules)
If useridcode in FireOnUser then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
" Select {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} for detailed MLM information", " Scenario " || Scenario,"YESNO" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
if (dialogResult as string) = "Yes" then
break;
endif;
endif;
else
// Scenario#X - no automtated scheduling (initialize date and time fields...today & no time)
// Re-initialize the time value if the MLM was evoked by a frequency change on a med of the included ther. category
If CallingEvent = "FieldChange" and CallingField = "frequencycode" and
PrimaryTherapeuticCategory in PrimaryTherapeuticCatagoriesSupported and
(ExcludedClassType = "No" or ExcludedClassType is null) then
RequestedTimeValue.ReqTimeCode := "";
RequestedTimeValue.ReqTimeValue:= "";
if (RequestedDate.Value > Now) then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Did you intend to schedule this medication for one time on " || RequestedDate.Value FORMATTED WITH "%.2t" || " ?" ||
" \n\n If this is not the intended administration date, please adjust the scheduled date.", " Potential Schedule Conflict ","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
endif;
/* Scenario#X */
if useridcode in FireOnUser then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
" Select {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} for detailed MLM information","Scenario X ","YESNO" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
if (dialogResult as string) = "Yes" then
break;
endif;
endif;
endif; // Is this a medication to be processed? (i.e.supported Theraputic Category, flagged for Exclusion etc...)
endif; // If CallingEvent <> "FormOpen"
if ( order_set_name IN ( "Pneumonia Antibiotic", "Skin Antibiotic Inpatient", "Vancomycin Orders") AND order_name = "Vancomycin:" ) then
local_session.SessionVancoTroughScheduledDate := RequestedDate.Value;
local_session.SessionVancoTroughScheduledTime := RequestedTime.Value;
endif;
endif;
;;
evoke:
;;
logic:
conclude true;
;;
action:
return this_communication, this_form;
;;
end:

View File

@@ -0,0 +1,78 @@
maintenance:
title: St.Clair: Promod selection on tube feeds;;
mlmname: FORM_BB_Rhogam;;
arden: version 2;;
version: 4.50;;
institution: St Clair;;
author: Don Warnick, Eclipsys Corp;;
specialist: ;;
date: 2006-08-25;;
validation: testing;;
library:
purpose: Value the Quantitative Result with "sent to reference lab" or blank dependinging upon the Screen Result selection
;;
explanation: This MLM is called from the Lab BBank Rhogam form.
It values the BB Rhogam_FT_FM Quant Result with "sent to reference lab" if BB Rhogam_FT_FM Screen is "positive"
It values the BB Rhogam_FT_FM Quant Result with "" if BB Rhogam_FT_FM Screen is "negative"
;;
keywords: Called MLMs, Form fields, Fetal Maternal Screen Result, Fetal Maternal Quantitative Result
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
// Value the Diet_DSS_Supplement field based upon the status of the Protein Powder Check Box
Screen_result := last of (field_list where field_list.DataItemName = "BB Rhogam_FT_FM Screen" );
Quant_result := last of (field_list where field_list.DataItemName = "BB Rhogam_FT_FM Quant Result" );
Quant_result .control_read_only := True;
If Screen_result.value = "positive"
then
Quant_result .value := "Sent to reference lab";
else
Quant_result .value := "";
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:

View File

@@ -0,0 +1,124 @@
maintenance:
title: BB product mandatory Surg proc or Trans ind;;
filename: FORM_BB_Surg_or_Trans_Ind;;
arden: version 2;;
version: 4.50;;
institution: Eclipsys, System MLM;;
author: Teresa Spicuzza and Beth Hilty;;
specialist: ;;
date: 2006-02-23;;
validation: testing;;
library:
purpose: This MLM sets the field Surgical Procedure as mandatory if Product for surgery is selected. It also sets the field Transfusion indication as mandatory if the Product for transfusion is selected.
;;
explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and
Communications objects and compares it to Client Information to determine whether to display
certain fields and make them mandatory.
A Banner message is presented to the user to remind them that these fields must be
completed.
If the patient data does not meet the above conditions the fields are not visible on
the form.
The MLM is not run from a trigger event, but rather is called by the application.
It should be configured to run on Form Open.
change history
05.29.2008 DW Change hidden fields to protected fields (control_visible := false --- control_read_only :=true)
06.18.2008 DW Remove code to require an indication when Transfusion is selected from Surgery or Transfusion list
;;
keywords: Called MLMs, Form fields
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
Surgery := ("Product for Surgery", "Surgery");
Transfusion := ("Product for Transfusion", "Transfusion");
Blank := "";
// This sets the visible control on the field dataitem - BB Blood Prod Surgical Proc
Prod_for_Surg_Trans_field := first of (field_list
where field_list.DataItemName = "BB Blood Prod Surg-Transfusion");
Surg_Proc_field := first of (field_list
where field_list.DataItemName = "LAB_VO_DI_BBProd Surgical Proc");
Trans_Ind_field := first of (field_list
where field_list.DataItemName = "LAB_VO_DI_BBProd TransInd FFP_Cryo");
If exists Prod_for_Surg_Trans_field then
Indication := Prod_for_Surg_Trans_field.value;
endif;
// If Indication in Surgery then
If Indication = "Product for Surgery" then
Surg_Proc_field.control_read_only := FALSE;
Surg_Proc_field.control_mandatory := TRUE;
// Removed per ED CPOE project 06.18.08 DW
// Trans_Ind_field.value := "";
// Trans_Ind_field.control_read_only := TRUE;
// Trans_Ind_field.control_mandatory := FALSE;
else
If Indication in Transfusion then
// Removed per ED CPOE project 06.18.08 DW
// Trans_Ind_field.control_read_only := FALSE;
// Trans_Ind_field.control_mandatory := TRUE;
Surg_Proc_field.value := Blank;
Surg_Proc_field.control_read_only := TRUE;
Surg_Proc_field.control_mandatory := FALSE;
endif;
endif;
if Indication = NULL then
Surg_Proc_field.control_mandatory := FALSE;
Trans_Ind_field.control_mandatory := FALSE;
endif;
;;
evoke: // No evoke statement
;;
logic:
conclude true;
;;
action:
// This MLM returns one parameters, of type form_type.
return this_communication, this_form;
;;
end:

View File

@@ -0,0 +1,113 @@
maintenance:
title: BB product mandatory Surg proc or Trans ind;;
filename: FORM_BB_Surg_or_Trans_Ind_PLT;;
arden: version 2;;
version: 4.50;;
institution: Eclipsys, System MLM;;
author: Teresa Spicuzza and Beth Hilty;;
specialist: ;;
date: 2006-02-27;;
validation: testing;;
library:
purpose: This MLM sets the field Surgical Procedure as mandatory if Product for surgery is selected. It also sets the field Transfusion indication as mandatory if the Product for transfusion is selected.
;;
explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and
Communications objects and compares it to Client Information to determine whether to display
certain fields and make them mandatory.
A Banner message is presented to the user to remind them that these fields must be
completed.
If the patient data does not meet the above conditions the fields are not visible on
the form.
The MLM is not run from a trigger event, but rather is called by the application.
It should be configured to run on Form Open.
;;
keywords: Called MLMs, Form fields
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
Surgery := ("Product for Surgery", "Surgery");
Transfusion := ("Product for Transfusion", "Transfusion");
Blank := "";
// This sets the visible control on the field dataitem - BB Blood Prod Surgical Proc
Prod_for_Surg_Trans_field := first of (field_list
where field_list.DataItemName = "BB Blood Prod Surg-Transfusion");
Surg_Proc_field := first of (field_list
where field_list.DataItemName = "LAB_VO_DI_BBProd Surgical Proc");
Trans_Ind_field := first of (field_list
where field_list.DataItemName = "LAB_VO_DI_BBProd Trans Ind Plt");
If exists Prod_for_Surg_Trans_field then
Indication := Prod_for_Surg_Trans_field.value;
endif;
// If Indication in Surgery then
If Indication = "Product for Surgery" then
Surg_Proc_field.control_visible := TRUE;
Surg_Proc_field.control_mandatory := TRUE;
Trans_Ind_field.value := "";
Trans_Ind_field.control_visible := FALSE;
Trans_Ind_field.control_mandatory := FALSE;
else
If Indication in Transfusion then
Trans_Ind_field.control_visible := TRUE;
Trans_Ind_field.control_mandatory := TRUE;
Surg_Proc_field.value := Blank;
Surg_Proc_field.control_visible := FALSE;
Surg_Proc_field.control_mandatory := FALSE;
endif;
endif;
if Indication = NULL then
Surg_Proc_field.control_mandatory := FALSE;
Trans_Ind_field.control_mandatory := FALSE;
endif;
;;
evoke: // No evoke statement
;;
logic:
conclude true;
;;
action:
// This MLM returns one parameters, of type form_type.
return this_communication, this_form;
;;
end:

View File

@@ -0,0 +1,113 @@
maintenance:
title: BB product mandatory Surg proc or Trans ind;;
filename: FORM_BB_Surg_or_Trans_Ind_RCP;;
arden: version 2;;
version: 4.50;;
institution: Eclipsys, System MLM;;
author: Teresa Spicuzza and Beth Hilty;;
specialist: ;;
date: 2006-02-24;;
validation: testing;;
library:
purpose: This MLM sets the field Surgical Procedure as mandatory if Product for surgery is selected. It also sets the field Transfusion indication as mandatory if the Product for transfusion is selected.
;;
explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and
Communications objects and compares it to Client Information to determine whether to display
certain fields and make them mandatory.
A Banner message is presented to the user to remind them that these fields must be
completed.
If the patient data does not meet the above conditions the fields are not visible on
the form.
The MLM is not run from a trigger event, but rather is called by the application.
It should be configured to run on Form Open.
;;
keywords: Called MLMs, Form fields
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
Surgery := ("Product for Surgery", "Surgery");
Transfusion := ("Product for Transfusion", "Transfusion");
Blank := "";
// This sets the visible control on the field dataitem - BB Blood Prod Surgical Proc
Prod_for_Surg_Trans_field := first of (field_list
where field_list.DataItemName = "BB Blood Prod Surg-Transfusion");
Surg_Proc_field := first of (field_list
where field_list.DataItemName = "LAB_VO_DI_BBProd Surgical Proc");
Trans_Ind_field := first of (field_list
where field_list.DataItemName = "LAB_VO_DI_BBProd Trans Ind RC");
If exists Prod_for_Surg_Trans_field then
Indication := Prod_for_Surg_Trans_field.value;
endif;
// If Indication in Surgery then
If Indication = "Product for Surgery" then
Surg_Proc_field.control_visible := TRUE;
Surg_Proc_field.control_mandatory := TRUE;
Trans_Ind_field.value := "";
Trans_Ind_field.control_visible := FALSE;
Trans_Ind_field.control_mandatory := FALSE;
else
If Indication in Transfusion then
Trans_Ind_field.control_visible := TRUE;
Trans_Ind_field.control_mandatory := TRUE;
Surg_Proc_field.value := Blank;
Surg_Proc_field.control_visible := FALSE;
Surg_Proc_field.control_mandatory := FALSE;
endif;
endif;
if Indication = NULL then
Surg_Proc_field.control_mandatory := FALSE;
Trans_Ind_field.control_mandatory := FALSE;
endif;
;;
evoke: // No evoke statement
;;
logic:
conclude true;
;;
action:
// This MLM returns one parameters, of type form_type.
return this_communication, this_form;
;;
end:

View File

@@ -0,0 +1,296 @@
maintenance:
title: Type and Screen MLM;;
MLMname: FORM_BB_Type_and_Screen;;
arden: version 2;;
version: 4.50;;
institution: Eclipsys, System MLM;;
author: Jonelle Tygielski;;
specialist: ;;
date: 2008-06-18;;
validation: testing;;
library:
purpose: This MLM will make the Surgery Date Mandatory only if the patient is from the ED.
;;
explanation: The MLM
change history
06.18.2008 DW Initial Build
11.01.2010 TMS Added logic for hold session - if priority is scheduled time make field not mandatory
allowing the order to be placed in hold without time entered. This forces the time to
be entered upon release.
02.10.2015 STH CSR #: 32776 - Update type and screen to have additional decidsion support to check for speciemen{{{SINGLE-QUOTE}}}s in lab.
This is an effort to preven multiple unnecessary needle punctures to patients. This MLM was also previously updated
for CSR#: 32765 to display user friendly lab priorities when ordering.
03-20-2015 STH CSR #: 32165 - Update type and screen MLM to support the new order form Maria created. The new form and this updated MLM will
check if there is a current type and screen on file, verify expiration date if a current type and screen exists,
check the scheduled date of current type and screen against expiration date and purpose (surgery/transfusion) and verify
if they need a type and screen ordered. Also this MLM will work on the out patient order form also, and will support
the additional fields added for outpatient type and screen ordering. If the selected purpose and schedule date is outside
the acceptable timeframe for the selected surgery or transfusion date (or greater than 14 days in the future for transfusions)
the user will be alerted with an error and only acceptable date values will be accepted for entering this order.
07-22-2015 STH HD Ticket #: 1811116 - Updated CABG check to also work on form close to NOT require a surgery date when the indication is surgery.
10-19-2015 STH HD Ticket #: 1909815 - Had to add logic to account for daylight savings time. Since the requested date does not have time associated with it
the time was defaulted to midnight (00:00:00.000), but going across daylight savings time the system was automatically
subtracting 1 hour causing the 14 days to actually on be 13 days.
03-10-2016 STH HD Ticket #: 2077411 - Issue with daylight savings time calculating the 14 days incorrectly. When the MLM subtracts the hour it actually subtracts 2 hours.
Removing logic to subtract an hour when going through spring time adjustment and this will correct the issue.
Original CSR 32165 will need a failed change control filed against it.
11-1-2017 STH HD Ticket #:2924688 - Daylight savings time got us again. Found that the system at exectuion of comparing 2 date/times the system would
automatically adjust for daylight savings time; however this year (16.3 CU10 PR12) the date/time change did not present
in the break (should current date/time not adjust date/time when crossing over time change). I changed the logic to use SQL
instead of the MLM code. I change the variable from being a date/time to having SQL return true of false based
on the date/time selected for surgery or transfusion.
01-31-2018 STH HD Ticket #: ????? - When correcting the daylight savings time I changed the days added from 4 down to 3 for surgery & transfustion date compare.
I also changed one of the date compares for surgery on outpatient checking to > instead of >=. Fixed the logic.
10.01.2019 STH - CA Service Desk#: 3905806 - Issue with type and screen result data having a new format of date,time (previously just date). Adjusted MLM to addres this.
;;
keywords: type and screen, expiration, lab
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
Visit_Guid := this_communication.ClientVisitGuid;
Chart_Guid := this_communication.ChartGuid;
Client_Guid := this_communication.ClientGuid;
comm_obj := this_communication.primaryobj;
call_field := this_communication.CallingFieldName;
IndicationValue := first of (field_list where field_list.DataItemName = "LAB_VO_DI_BB Indication");
TransfusionDate := first of (field_list where field_list.DataItemName = "LAB_VO_BB Transfuse Date");
SurgeryDate := first of (field_list where field_list.DataItemName = "LAB_VO_BB Surgery Date");
CABG := first of (field_list where field_list.DataItemName = "BB Type and Screen CABG Date Unknown");
Pregnant90days := first of (field_list where field_list.DataItemName = "BB Type and Screen Pregnancy Question");
Transfusion90days := first of (field_list where field_list.DataItemName = "BB Type and Screen Transfusion Question");
edpatient := read last {"select typecode from cv3clientvisit where "
|| " ClientGUID = " || SQL(client_guid)
|| " and ChartGUID = " || SQL(chart_guid)
|| " and GUID= " || SQL(visit_guid)
|| " and typecode = {{{SINGLE-QUOTE}}}emergency{{{SINGLE-QUOTE}}}"
|| " and active = 1 "
};
If exist edpatient then
TransfusionDate.control_mandatory := False;
TransfusionDate.control_read_only := False;
SurgeryDate.control_mandatory := False;
SurgeryDate.control_read_only := False;
IndicationValue.control_mandatory := False;
IndicationValue.control_read_only := false;
Elseif IndicationValue.value = "Surgery" then
SurgeryDate.control_mandatory := True;
SurgeryDate.control_read_only := False;
TransfusionDate.Value := null;
TransfusionDate.control_mandatory := False;
TransfusionDate.control_read_only := True;
elseif IndicationValue.value = "Transfusion" then
SurgeryDate.Value := null;
SurgeryDate.control_mandatory := False;
SurgeryDate.control_read_only := True;
if this_form.Name = "LAB BB TYHD_OP" then
TransfusionDate.control_mandatory := True;
TransfusionDate.control_read_only := False;
else
TransfusionDate.control_mandatory := False;
TransfusionDate.control_read_only := False;
endif;
else
SurgeryDate.Value := null;
TransfusionDate.Value := null;
SurgeryDate.control_mandatory := False;
SurgeryDate.control_read_only := True;
TransfusionDate.control_mandatory := False;
TransfusionDate.control_read_only := True;
endif;
requested_date := last of (field_list where field_list.DataItemName = "RequestedDate" );
requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" );
requested_time_value := requested_time.value;
session_type := comm_obj.internalprocessingtype;
If (CallingEvent = "FormOpen") then
//****BEGIN***** STH 2.10.2015 CSR 32765 - show user friendly lab priorities
DisplayNewScheduled := first of (field_list.Value
where field_list.DataItemName = "LAB_CB_Alternate Priorities");
if (DisplayNewScheduled) THEN
Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
(this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
endif;
//****END***** STH 2.10.2015 CSR 32765 - show user friendly lab priorities
sql_speciemen_expiration := read last { " select "
|| " o.SignificantDtm "
|| " , case when tol.text like {{{SINGLE-QUOTE}}}%,%{{{SINGLE-QUOTE}}} "
|| " then dateadd(hh,7,cast(substring(tol.text,0,charindex({{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}},tol.text,0)) as datetime)) "
|| " else dateadd(hh,7,cast(tol.Text as datetime)) end as {{{SINGLE-QUOTE}}}specimen_expiration_date{{{SINGLE-QUOTE}}} "
|| " ,tol.TouchedWhen as {{{SINGLE-QUOTE}}}speciemen_touchedwhen{{{SINGLE-QUOTE}}} "
|| " into #tmp_specimen_Expiration_TS "
|| " from CV3ClientVisit cv with (nolock) "
|| " inner join CV3BasicObservation bo with (nolock) "
|| " on cv.ClientGUID = bo.ClientGUID "
|| " and cv.ChartGUID = bo.ChartGUID "
|| " and cv.guid = bo.ClientVisitGUID "
|| " and bo.ItemName = {{{SINGLE-QUOTE}}}Specimen Expiration{{{SINGLE-QUOTE}}} "
|| " inner join CV3TextualObservationLine tol with (nolock) "
|| " on bo.ClientGUID = tol.ClientGUID "
|| " and bo.GUID = tol.ObservationGUID "
|| " inner join CV3Order o with (nolock) "
|| " on bo.orderguid = o.guid "
|| " where o.SignificantDtm >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), -14) "
|| " and ((cv.ClientGUID = " || sql(Client_Guid)
|| " and cv.ChartGUID = " || sql(Chart_Guid)
|| " and cv.guid = " || sql(Visit_Guid) || ")"
|| " or (cv.ClientGUID = " || sql(Client_Guid)
|| " and cv.TypeCode in ({{{SINGLE-QUOTE}}}Clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pre Admit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pre Clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SDC{{{SINGLE-QUOTE}}}))) "
|| " and tol.Text is not null "
|| " and tol.Active = 1 "
|| " select top 1 specimen_expiration_date from #tmp_specimen_Expiration_TS with (nolock) "
|| " where specimen_expiration_date > getdate() "
|| " order by speciemen_touchedwhen desc "};
current_speciemen_expiration := sql_speciemen_expiration[1];
if sql_speciemen_expiration is not null and sql_speciemen_expiration <> "" then
current_speciemen_expiration := sql_speciemen_expiration[1];
this_communication.DisplayForm := "yes";
this_communication.Message := "There is a current Type and Screen that expires on " || current_speciemen_expiration[1] || ".";
this_communication.MessageType := "Informational";
//StopOrderBoxValue.control_mandatory := TRUE;
//NewOrderBox.value := FALSE;
endif;
endif;
If (CallingEvent = "FormOpen") or (called_by = "FieldChange") and (session_type = "Hold") then
If exists (requested_time) and (requested_time_value.ReqTimeCode = "Scheduled Time") then
requested_time.Control_mandatory := false;
else requested_time.Control_mandatory := true;
endif;
endif;
If ( CallingEvent = "FormClose") then
//STH - ADDED TO CORRECT ISSUE WITH DAYLIGHT SAVINGS TIME ADJUSTMENT AUTOMATICALLY BEING ACCOUNTED FOR IN THE APPLICATION.
reqdtm_plus_14days := (requested_date.value + 14 days);
reqdtm_plus_3days := (requested_date.value + 4 days);
//2017-11-1 STH - ADDED SQL LOGIC TO DO THE DATE ADD BECAUSE THE MLM EXECUTION WAS ADJUSTING FOR DAYLIGHT SAVINGS TIME
//HOWEVER WHEN REVIEWING THE BREAK THE FIELD DID NOT REPRESENT THE TIME CHANGE. IN 2016 I COULD SEE THE ADDITION/SUBTRACTION
//OF THE HOUR; HOWEVER IN 16.3 CU10 PR12 IT SEEMED THE SYSTEM ADJUSTED FOR THE TIME CHANGE CHANGE WHEN COMPARING DATES/TIME
//BUT THE MLM EDITOR DIDNT REPRESENT THE CHANGE. THIS SHOULD HOPEFULLY FIX ALL FUTURE PROBLEMS WITH THIS MLM AND DAYLIGHT SAVINGS TIME.
(surgdateGT14days, surgdateGT3days, transfusedateGT3days) := read last { "select case when isnull("
|| sql(SurgeryDate.Value) || ",{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) > dateadd(dd,+14,isnull(" || sql(requested_date.value)
|| ",{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})) then {{{SINGLE-QUOTE}}}true{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}false{{{SINGLE-QUOTE}}} end,
case when isnull("
|| sql(SurgeryDate.Value) || ",{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) >= dateadd(dd,+4,isnull(" || sql(requested_date.value)
|| ",{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})) then {{{SINGLE-QUOTE}}}true{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}false{{{SINGLE-QUOTE}}} end
,case when isnull("
|| sql(TransfusionDate.Value) || ",{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) >= dateadd(dd,+4,isnull(" || sql(requested_date.value)
|| ",{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})) then {{{SINGLE-QUOTE}}}true{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}false{{{SINGLE-QUOTE}}} end " };
/*
if ((checkhours1 as number) = 23)then
reqdtm_plus_14days := reqdtm_plus_14days + 1 hour;
//elseif ((checkhours1 as number) = 1) then
// reqdtm_plus_14days := reqdtm_plus_14days - 1 hour;
endif;
if ((checkhours2 as number) = 23) then
reqdtm_plus_3days := reqdtm_plus_3days + 1 hour;/
//elseif ((checkhours2 as number) = 1) then
// reqdtm_plus_14days := reqdtm_plus_14days - 1 hour;
endif;
*/
if this_form.Name = "LAB BB TYHD_OP" then
if ((surgdateGT3days = "true")//(SurgeryDate.Value >= reqdtm_plus_3days)
and ((Transfusion90days.Value = "Yes") or (Pregnant90days.Value = "Yes"))) then
this_communication.DisplayForm := "yes";
this_communication.Message := "Patient must be tested within 3 days of Surgery.";
this_communication.MessageType := "Error";
SurgeryDate.Value := null;
endif;
if ((Transfusion90days.Value = "No") and (Pregnant90days.Value = "No")
and (surgdateGT14days = "true")) then//SurgeryDate.Value > reqdtm_plus_14days)) then
this_communication.DisplayForm := "yes";
//this_communication.Message := "Surgery date (" || surg_dttm || ") is greater than 14 days past the scheduled date (" || sched_dttm || ").";
this_communication.Message := "Surgery date greater than 14 days in future";
this_communication.MessageType := "Error";
SurgeryDate.Value := null;
endif;
endif;
if (transfusedateGT3days = "true") then
this_communication.DisplayForm := "yes";
this_communication.Message := "Patient must be tested within 3 days of Transfusion";
this_communication.MessageType := "Error";
TransfusionDate.Value := null;
endif;
endif;
if call_field = "BB Type and Screen CABG Date Unknown" or call_field = "LAB_VO_DI_BB Indication" or ( CallingEvent = "FormClose") then
if (CABG.Value) THEN
SurgeryDate.Value := null;
SurgeryDate.control_mandatory := False;
SurgeryDate.control_read_only := True;
endif;
endif;
;;
evoke: // No evoke statement
;;
logic:
conclude true;
;;
action:
// This MLM returns one parameters, of type form_type.
return this_communication, this_form;
;;
end:

View File

@@ -0,0 +1,86 @@
maintenance:
title: Test;;
mlmname: FORM_BedReq;;
arden: version 2;;
version: 4.50;;
institution: St Clair Isolation Set MLM;;
author: Robert spence, Eclipsys Corp;;
specialist: ;;
date: 2007-01-04;;
validation: testing;;
library:
purpose: Test
;;
explanation: Test
Changes 01/03/2007 RS Added logic to add Case number to the form for SIS routing on close event
;;
keywords: Called MLMs, Form fields, TEst
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
ClientGuid:=this_communication.ClientGUID;
ClientChartGUID:=this_communication.ChartGUID;
Fld_AdmitDx := last of (field_list where field_list.DataItemName = "NUR_AdmittingDx" );
If CallingEvent="FormClose"
then
//Retrieve Patients Admitting Dx Number
AdmitDx:= read last
{"SELECT text "
|| " from CV3HealthIssueDeclaration with (nolock) "
|| " WHERE ClientGUID = " || SQL(ClientGuid)
|| " And ChartGUID = " || SQL(ClientChartGUID)
|| " And typecode = " || SQL("Admitting Dx")
|| " and Active = 1"};
Fld_AdmitDx.Value := AdmitDx;
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:

View File

@@ -0,0 +1,234 @@
maintenance:
title: Form_Berinert_Calc;;
mlmname: Form_Berinert_Calc;;
arden: version 2;;
version: 5.50;;
institution: St. Clair Hospital;;
author: Teresa Spicuzza ;;
specialist: Teresa Spicuzza ;;
date: 2012-05-21;;
validation: testing;;
library:
purpose: Caculate Berinert dose based on weight. Present dose rounded as:
500 - 600 units round to 500 units
601 - 999 units round to the nearest 50 units
1000 - 1100 units round to 1000 units
1101 - 1499 units - round to the nearest 50 units
1500 - 1600 units round to 1500 units
1601 - 1999 units round to the nearest 50 units
2000 - 2100 units round to 2000 units
2101 - 2499 units - round to nearest 50 units
2500 - 2600 units round to 2500 units
2601 - 3000 units - round to nearest 50 units
For patients < 25 kg, pop up a note that states:
"Dosing in children < 12y/o is not established." and allow for a type in a dose;
For patients > 150 kg, pop up a note that states:
"Clinical trials did not include obese patients > 150 kg. No specific dosing recommendations are available."
and allow for a type in a dose.
;;
explanation:
Dosing Weight in Kilograms * 20 = Dose
If Dosing Weight in Kilograms is null alert user to
Please enter a Weight before proceeding
Change history
03.18.2015 TMS New MLM to calculate and round Berinert C1 Esterase Inhibitor (Human) doses. CSR 24477
;;
keywords:
Berinert, weight; C1 Esterase Inhibitor (Human)
;;
knowledge:
type: data-driven;;
data:
/********************Make Changes To Spelling And Flags In This Section*********************/
/*************************************************************************************************/
// 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;
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
CRLF:= CR||LF;
adminInfo := first of
(field_list where field_list.DataItemName = "AdminInstructions");
OrderInfo := first of
(field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
comb_ht_wt_field := first of
(field_list where field_list.DataItemName = "CombinedMeasurements");
dose := first of
(field_list where field_list.DataItemName = "DosageLow");
dose_val := dose.value;
if exists comb_ht_wt_field then
comb_ht_wt_val := comb_ht_wt_field.value;
wt := comb_ht_wt_val.weight;
ht := comb_ht_wt_val.height;
wt_type := comb_ht_wt_val.weighttype;
bsa := comb_ht_wt_val.bsa;
bmi := comb_ht_wt_val.bmi;
endif;
If CallingEvent = "FormOpen" or (CallingEvent = "FieldChange" and callingfield = "CombinedMeasurements") then
if not exists wt or wt = 0 then
this_communication.Message :=
"Please Enter a Weight "
|| "before proceeding."
;
this_communication.MessageType := "Error";
else
wt_val := wt as number;
endif;
If (wt_val >= 25 and wt_val <= 150) then
//Dose
dose_calc := (wt as number) * 20;
If dose_calc >= 500 and dose_calc < 601 then
halffactor := 250; roundfactor := 500;
rndmessage := " (rounded to 500 mg) - ";
elseif
dose_calc >= 601 and dose_calc < 1000 then
halffactor := 25; roundfactor := 50;
rndmessage := " (rounded to nearest 50 mg) - ";
elseif
dose_calc >= 1000 and dose_calc < 1101 then
halffactor := 500; roundfactor := 1000;
rndmessage := " (rounded to 1000 mg) - ";
elseif
dose_calc >= 1101 and dose_calc < 1500 then
halffactor := 25; roundfactor := 50;
rndmessage := " (rounded to nearest 50 mg) - ";
elseif
dose_calc >= 1500 and dose_calc < 1601 then
halffactor := 750; roundfactor := 1500;
rndmessage := " (rounded to 1500 mg) - ";
elseif
dose_calc >= 1601 and dose_calc < 2000 then
halffactor := 25; roundfactor := 50;
rndmessage := " (rounded to nearest 50 mg) - ";
elseif
dose_calc >= 2000 and dose_calc < 2101 then
halffactor := 1000; roundfactor := 2000;
rndmessage := " (rounded to 2000 mg) - ";
elseif
dose_calc >= 2101 and dose_calc < 2500 then
halffactor := 25; roundfactor := 50;
rndmessage := " (rounded to nearest 50 mg) - ";
elseif
dose_calc >= 2500 and dose_calc < 2601 then
halffactor := 1250; roundfactor := 2500;
rndmessage := " (rounded to 2500 mg) - ";
elseif
dose_calc >= 2601 and dose_calc < 3000 then
halffactor := 25; roundfactor := 50;
rndmessage := " (rounded to nearest 50 mg) - ";
elseif
dose_calc >= 3000 then
halffactor := 1500; roundfactor := 3000;
rndmessage := " (rounded to 3000 mg) - ";
endif;
rnd_dose := int((dose_calc + halffactor)/roundfactor) * roundfactor;
if exists dose then
Dose.Value := rnd_dose ;
mltodraw := rnd_dose/50;
rawrate := ((rnd_dose /50) / 4);
rateofadmin := int((rawrate + 0.5)/1) * 1;
msg1 := "Dose calculated at 20 units/kg" ;
msg1b := "Final concentration after reconstitution is 50 units/ml. " ;
// msg1 := "Dose calculated at 20units/kg - Final concentration after reconstitution is 50units/ml. " ;
msg2 := "Administer " ;
msg2b := " units (";
msg3 := " ml) by slow IV injection at 4 ml/min. (" ;
msg4 := " minutes)";
dose.control_read_only := true;
admininfo.value := msg1 || rndmessage || msg1b || LF || LF || msg2 || rnd_dose || msg2b || mltodraw || msg3 || rateofadmin || msg4;
endif;
elseif
(wt as number) < 25 and (wt as number) > 0 then
this_communication.Message :=
"Dosing in children < 12y/o is not established. "
|| "Enter a dose if you wish to continue."
;
this_communication.MessageType := "Informational";
admininfo.value := " ";
Dose.Value := "";
dose.control_read_only := false;
elseif
(wt as number) > 150 then
this_communication.Message :=
"Clinical trials did not include obese patients > 150 kg. No specific dosing recommendations are available. "
|| "Enter a dose if you wish to continue."
;
this_communication.MessageType := "Informational";
admininfo.value := " ";
Dose.Value := "";
dose.control_read_only := false;
endif; // not exists wt
endif;
If CallingEvent = "FieldChange" and Callingfield = "DosageLow" then
wt_val := wt as number;
If (wt_val < 25 or wt_val > 150) and dose_val > 0 then
mltodraw := dose.value/50;
rawrate := ((dose.value /50) / 4);
rateofadmin := int((rawrate + 0.5)/1) * 1;
// msg1 := "Dose calculated at 20 units/kg" ;
msg1b := "Final concentration after reconstitution is 50 units/ml. " ;
msg2 := "Administer " ;
msg2b := " units (";
msg3 := " ml) by slow IV injection at 4 ml/min. (" ;
msg4 := " minutes)";
// dose.control_read_only := true;
admininfo.value := msg1b || LF || LF || msg2 || dose.value || msg2b || mltodraw || msg3 || rateofadmin || msg4;
endif;
endif;
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns two parameters, of types
//communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,101 @@
maintenance:
title: Blood Availibility Order;;
mlmname: FORM_BLOOD_AVAILIBILITY_ORDER;;
arden: version 2;;
version: 5.50;;
institution: St Clair;;
author: Maria Pest;;
specialist: Don Warnick;;
date: 2015-11-09;;
validation: testing;;
library:
purpose: Automatic Medication Scheduling
;;
explanation: The MLM will search past lab blood orders by order number and return the order name to a field
Change history
11.09.2015 DW CSR# 32531 Created
11.24.2015 DW HD# 1952521 Corrected the issue with not searching across all visits. (was joining on cv3chart which limited it to the same visit)
04.21.2016 STH CSR#: 32165 Updated for new names to be included in MLM logic. {go-live 4/27/2016}
;;
keywords: Blood Availibility Order
;;
knowledge:
type: data-driven;;
data:
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
(this_communication,this_form,client_info_obj) := argument;
error_message:="";
field_list := this_form.fields;
ClientGuid := this_communication.ClientGUID;
VisitGuid := this_communication.ClientVisitGUID;
ChartGuid := this_communication.ChartGuid;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
OrderNumber := last of (field_list where field_list.DataItemName = "BB Blood Prod Avail Order ID");
OrderNumberValue:= OrderNumber.Value;
OrderName := last of (field_list where field_list.DataItemName = "BB Blood Prod Avail FT");
If CallingEvent = "FieldChange"
then
(PastOrderName) := read last
{
" select "
|| " case when ocmi.name = {{{SINGLE-QUOTE}}}Red Cell Products{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Red Blood Cells{{{SINGLE-QUOTE}}} "
|| " when ocmi.name in ({{{SINGLE-QUOTE}}}Transfuse Platelets{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Platelet Products{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}Platelets{{{SINGLE-QUOTE}}} "
|| " when ocmi.name in ({{{SINGLE-QUOTE}}}Transfuse FFP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Fresh Frozen Plasma{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}Thawed Fresh Frozen Plasma{{{SINGLE-QUOTE}}}"
|| " when ocmi.name in ({{{SINGLE-QUOTE}}}Transfuse Cryoprecipitate{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Cryoprecipitate{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}Cyoprecipiate{{{SINGLE-QUOTE}}} end "
|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid "
|| " where o.ClientGUID = " || ClientGuid || " "
|| " and o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) "
|| " and o.createdwhen > getdate() -90 "
|| " and o.typecode = {{{SINGLE-QUOTE}}}diagnostic{{{SINGLE-QUOTE}}} and o.idcode = {{{SINGLE-QUOTE}}}" || OrderNumberValue || "{{{SINGLE-QUOTE}}}"
|| " and ocmi.name in ({{{SINGLE-QUOTE}}}Red Cell Products{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Transfuse Platelets{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Transfuse FFP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Transfuse Cryoprecipitate{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Cryoprecipitate{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Fresh Frozen Plasma{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Platelet Products{{{SINGLE-QUOTE}}}) "
|| " and o.entered > getdate()-21 "
};
if exist PastOrderName
then
OrderName.Value := PastOrderName;
else
OrderName.Value := " ";
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n\nThis order number does not match a Blood Order.","Order Not Found", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
endif;
endif; // If CallingEvent <> "FieldChange"
;;
evoke:
;;
logic:
conclude true;
;;
action:
return this_communication, this_form;
;;
end:

View File

@@ -0,0 +1,78 @@
maintenance:
title: St.Clair: Promod selection on tube feeds;;
mlmname: FORM_Blood_Consent_Form;;
arden: version 2;;
version: 4.50;;
institution: St Clair;;
author: Shawn Head, Allscripts;;
specialist: Maria Pest, Allscripts;;
date: 2016-08-11;;
validation: testing;;
library:
purpose: Used to control the reprinting of the blood consent form
;;
explanation:
08-11-2016 STH CSR#: 34139 - Created to control modifying/re-printing the order information. {Go-Live 10/4/2016}
;;
keywords: Called MLMs, Form fields, Fetal Maternal Screen Result, Fetal Maternal Quantitative Result
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
// Value the Diet_DSS_Supplement field based upon the status of the Protein Powder Check Box
Reprint_Form := last of (field_list where field_list.DataItemName = "BB Informed Consent" );
Reprint_Count := last of (field_list where field_list.DataItemName = "BB Consent Reprint" );
abc123 := Reprint_Form.value;
xyz123 := Repint_Count.Value;
if(Reprint_Form.Value) then
if(Reprint_Count.Value is null) then
Reprint_Count.Value := 1;
else
Reprint_Count.Value := (Reprint_Count.Value as number) + 1;
endif;
Reprint_Form.Value := false;
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:

View File

@@ -0,0 +1,110 @@
maintenance:
title: Blood Culture Line Location Mandatory;;
filename: FORM_Blood_Cul_Line_Loc_Man;;
arden: version 2;;
version: 4.50;;
institution: Eclipsys, System MLM;;
author: Teresa Spicuzza and Beth Hilty;;
specialist: ;;
date: 2006-03-22;;
validation: testing;;
library:
purpose: This MLM sets the field Line Location as mandatory and visible if Line is selected.
;;
explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and
Communications objects and compares it to Client Information to determine whether to display
certain fields and make them mandatory.
A Banner message is presented to the user to remind them that these fields must be
completed.
If the patient data does not meet the above conditions the fields are not visible on
the form.
The MLM is not run from a trigger event, but rather is called by the application.
It should be configured to run on Form Open.
;;
keywords: Called MLMs, Form fields
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
Surgery := ("Product for Surgery", "Surgery");
Transfusion := ("Product for Transfusion", "Transfusion");
Blank := "";
// This sets the visible control and Mandatory control on the field dataitem - LAB_SREQ_VO_FT_LineDrawDescrip
Select_LineDraw_field := first of (field_list
where field_list.DataItemName = "LAB_SREQ_VO_DI_Line_PeripDraw");
Line_Location_field := first of (field_list
where field_list.DataItemName = "LAB_SREQ_VO_FT_LineDrawDescrip");
//Trans_Ind_field := first of (field_list
//where field_list.DataItemName = "LAB_VO_DI_BBProd TransInd FFP_Cryo");
If exists Select_LineDraw_field then
Indication := Select_LineDraw_field.value;
endif;
// If Indication in Surgery then
If Indication = "Line Draw" then
Line_Location_field.control_visible := TRUE;
Line_Location_field.control_mandatory := TRUE;
else
If Indication = "Peripheral Draw" then
Line_Location_field.control_visible := FALSE;
Line_Location_field.control_mandatory := FALSE;
endif;
endif;
if Indication = NULL then
Line_Location_field.control_mandatory := FALSE;
Line_Location_field.control_mandatory := FALSE;
endif;
;;
evoke: // No evoke statement
;;
logic:
conclude true;
;;
action:
// This MLM returns one parameters, of type form_type.
return this_communication, this_form;
;;
end:

View File

@@ -0,0 +1,100 @@
maintenance:
title: Form_Blood_Product_Infusion_Rate;;
mlmname: Form_Blood_Product_Infusion_Rate;;
arden: version 2.5;;
version: 16.30;;
institution: St Clair Hospital;;
author: Teresa Spicuzza, Allscripts ;;
specialist: Maria Pest, Allscripts ;;
date: 2019-03-07;;
validation: testing;;
library:
purpose: Calculate the rate of infusion when blood transfusion ordered to be give at 1mL/kg/hr.
;;
explanation:
Change history
04.14.2019 TMS CSR 37956 Created MLM to calculate infusion rate when blood/platelet/FFP transfusion ordered to be give at 1mL/kg/hr, and
to populate first 15 minute transfusion rate when appropriate.
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
(this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
field_list:= this_form.Fields;
Client_GUID := this_communication.ClientGUID;
ClientVisit_GUID := this_communication.ClientVisitGUID;
Chart_GUID := this_communication.ChartGUID;
form_name := this_form.Name;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
// HtWtBSA := First of ( field_list where field_list.DataItemName = "CombinedMeasurements" And field_list.Control_MultiFieldOccNum = 1 ) ;
RBC_Rate := First of ( field_list where field_list.DataItemName = "BB Blood Infusion Rate RBC" );
CalcRate := First of ( field_list where field_list.DataItemName = "BB Blood Infusion Calculated Rate") ;
FFP_PLT_Rate := First of ( field_list where field_list.DataItemName = "BB Blood Infus Rate FFP PLT" );
Transfuse_Init_Rate := First of ( field_list where field_list.DataItemName ="BB Blood Infus Rate 1st 15 min" );
// check weight Value for Patient
Wt_Grams := Read first {"Select text from CV3PhysicalNoteDeclaration With (Nolock) Where Typecode= {{{SINGLE-QUOTE}}}WEIGHT{{{SINGLE-QUOTE}}} "
|| " And ClientVisitGUID = " ||SQL(ClientVisit_GUID) || " " };
Wt := (Wt_Grams as Number) / 1000;
If Wt is Null or Wt = 0 Then
RawRate := null;
else
RawRate := int(((wt As Number) + 0.5/1) * 1 );
endif;
If (RBC_Rate.value matches pattern "1 mL/KG/hour%" or FFP_PLT_Rate.value matches pattern "1 mL/KG/hour%") then
If RawRate is not null then
CalcRate.value := RawRate || " mL/hour";
Transfuse_Init_Rate.value := "120 mL/hour";
else
CalcRate.value := "";
Transfuse_Init_Rate.value := "120 mL/hour";
endif;
elseif (RBC_Rate.value matches pattern "emergent%" or FFP_PLT_Rate.value matches pattern "emergent%") then
CalcRate.value := "";
Transfuse_Init_Rate.value := "";
else
CalcRate.value := "";
Transfuse_Init_Rate.value := "120 mL/hour";
endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,227 @@
maintenance:
title: Update of Significant Events for Blood Products Special Needs;;
mlmname: FORM_BLOOD_PRODUCT_UPDATE_SIG_EVENTS;;
arden: version 2.5;;
version: 5.50;;
institution: Eclipsys, Test MLM;;
author: Eclipsys Corporation;;
specialist: ;;
date: 2010-03-09;;
validation: testing;;
library:
purpose: Creates and saves the Significant Event object using ObjectsPlus when blood bank orders are for Leukoreduced; Hemoglobin S. Negative; Irradiated; or CMV Negative Products Indicated. If patient has an existing significant event with any of these indications the appropriate box will be pre selected on the order form.
;;
explanation: This MLM is triggered from Blood Product Transfusion Orders
History
12-6-2011 TMS Created for CSR 26619
4/25/2016 STH CSR#: 32165 - Updated to be used on both order set forms and order forms now. The order set forms will have mapped fields to the hidden dataitems so the green checkmark does not appear next to the lists.
Maria created the form configuration. {go-live 4/27/2016}
5/6/2016 STH CSR#: 32165 - CA service desk #: 2157308 - Updated MLM to handle the special needs "Autologous" and "Direct Donation". The original MLM deployed did not handle these items at all.
;;
keywords: ObjectsPlus, Blood Products, Special Needs, Significant Event
;;
knowledge:
type: data-driven;;
data:
// Specify which .NET assemblies need to be loaded for ObjectsPlus
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
log_execution_info := false;
error_occurred := false;
error_message := "";
//--------------------------------------------------------------------
(this_communication, // Communication object
this_form, // Form object
client_info_obj // Arden ClientInfo object
) := argument;
//called_by := this_communication.CallingEvent;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
ClientGuid := this_communication.ClientGUID;
ClientVisitGuid := this_communication.ClientVisitGUID;
ChartGuid := this_communication.ChartGuid;
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
if(this_form.Name in ("LAB BB Transfuse RBC","Lab BB RBCs","Lab BB Platelets","LAB BB Transfuse PLT")) then
LeukReduction := last of (field_list where field_list.DataItemName = "LAB_LO_CB_BBLeuk Reduction");
HemoSNegative := last of (field_list where field_list.DataItemName = "LAB_LO_CB_BBHemoglobin S Negative");
IrradiatedInd := last of (field_list where field_list.DataItemName = "LAB_LO_CB_BBIrradiated");
Autologous := last of (field_list where field_list.DataItemName = "LAB_LO_CB_BBAutologous");
DirectDonation := last of (field_list where field_list.DataItemName = "LAB_LO_CB_BBDirect Donation");
//BBCMV_NegProInd := last of (field_list where field_list.DataItemName = "LAB_LO_CB_BBCMV Negative");
endif;
if(this_form.Name in ("LAB BB Transfuse RBC","Lab BB RBCs")) then
OS_Special_needs := last of (field_list where field_list.DataItemName = "BB SpecNeeds RBC MLM to Mapped");
elseif(this_form.Name in ("Lab BB Platelets","LAB BB Transfuse PLT")) then
OS_Special_needs := last of (field_list where field_list.DataItemName = "BB SpecNeeds Plt MLM to Mapped");
endif;
/*
elseif(this_form.Name in ("LAB BB Transfuse PLT")) then
LeukReduction := last of (field_list where field_list.DataItemName = "BB Blood Prod Leuk Reduction");
HemoSNegative := last of (field_list where field_list.DataItemName = "BB Blood Prod Hemoglobin S Negative");
IrradiatedInd := last of (field_list where field_list.DataItemName = "BB Blood Prod Irradiated");
OS_Special_needs := last of (field_list where field_list.DataItemName = "BB SpecNeeds Plt MLM to Mapped");
//CMV_NegProInd := last of (field_list where field_list.DataItemName = "BB Blood Prod CMV Neg");
endif;
*/
LabGenericMandatory := mlm {{{SINGLE-QUOTE}}}FORM_LAB_GENERIC_MANDITORY{{{SINGLE-QUOTE}}};
(ProductIndList) := read
{
" select description "
|| "from cv3ClientEventDeclaration with (nolock) "
|| "where clientguid = " || ClientGuid || " and status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| "and typecode = {{{SINGLE-QUOTE}}}Blood Transfusion{{{SINGLE-QUOTE}}} "
};
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n List: " || ProductIndList ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
If CallingEvent = "FormOpen" then
(this_form, this_communication) := Call LabGenericMandatory with this_form, this_communication;
endif;
If ((CallingEvent = "FormOpen")
and (this_form.Name in ("LAB BB Transfuse RBC","Lab BB RBCs","Lab BB Platelets","LAB BB Transfuse PLT"))) then
tmp_OS_Special_Needs := "";
//tmp_OS_Special_Needs_RBCs := "";
If "Leukoreduced Products Indicated" in ProductIndList then
If exists LeukReduction then
LeukReduction.Value := true;
endif;
if (this_communication.FormType = "OrderSet") then
//Leukocyte Reduction Filter; Irradiated; Hemoglobin S Negative; Autologous; Direct Donation
tmp_OS_Special_Needs := tmp_OS_Special_Needs || "; Leukocyte Reduction Filter";
endif;
endif;
If (("Hemoglobin S Negative Products Indicated" in ProductIndList) and (this_form.Name in ("LAB BB Transfuse RBC","Lab BB RBCs"))) then
If exists HemoSNegative then
HemoSNegative.Value := true;
endif;
if (this_communication.FormType = "OrderSet") then
tmp_OS_Special_Needs := tmp_OS_Special_Needs || "; Hemoglobin S Negative";
endif;
endif;
If "Irradiated Products Indicated" in ProductIndList then
If exists IrradiatedInd then
IrradiatedInd.Value := true;
endif;
if (this_communication.FormType = "OrderSet") then
tmp_OS_Special_Needs := tmp_OS_Special_Needs || "; Irradiated";
endif;
endif;
If "Autologous" in ProductIndList then
if (this_communication.FormType = "OrderSet") then
//Leukocyte Reduction Filter; Irradiated; Hemoglobin S Negative; Autologous; Direct Donation
tmp_OS_Special_Needs := tmp_OS_Special_Needs || "; Autologous";
endif;
endif;
If "Direct Donation" in ProductIndList then
if (this_communication.FormType = "OrderSet") then
//Leukocyte Reduction Filter; Irradiated; Hemoglobin S Negative; Autologous; Direct Donation
tmp_OS_Special_Needs := tmp_OS_Special_Needs || "; Direct Donation";
endif;
endif;
if (length of tmp_OS_Special_Needs) > 2 then
tmp_OS_Special_Needs := SUBSTRING ((length of tmp_OS_Special_Needs) - 1) CHARACTERS STARTING AT 2 FROM tmp_OS_Special_Needs;
endif;
OS_Special_Needs.Value := trim(tmp_OS_Special_Needs);
endif;
if ((this_communication.CallingEvent = "FieldChange") and ((this_communication.FormType = "OrderSet")))then
//Leukocyte Reduction Filter; Irradiated; Hemoglobin S Negative; Autologous; Direct Donation
if (((find "Leukocyte Reduction Filter" in string OS_Special_Needs.Value) > 0))then
LeukReduction.Value := true;
else
LeukReduction.Value := false;
endif;
if (((find "Irradiated" in string OS_Special_Needs.Value) > 0)) then
IrradiatedInd.Value := true;
else
IrradiatedInd.Value := false;
endif;
if (((find "Hemoglobin S Negative" in string OS_Special_Needs.Value) > 0)) then
HemoSNegative.Value := true;
else
HemoSNegative.Value := false;
endif;
if (((find "Autologous" in string OS_Special_Needs.Value) > 0)) then
Autologous.Value := true;
else
Autologous.Value := false;
endif;
if (((find "Direct Donation" in string OS_Special_Needs.Value) > 0)) then
DirectDonation.Value := true;
else
DirectDonation.Value := false;
endif;
endif;
If CallingEvent = "FormClose" then
If "Leukoreduced Products Indicated" in ProductIndList then
ShowMessage1 := "No";
If exists LeukReduction and LeukReduction.Value = false then
ShowMessage1 := "Yes";
endif;
If exists BBLeukReduction and BBLeukReduction.Value = false then
ShowMessage1 := "Yes";
endif;
endif;
If "Hemoglobin S Negative Products Indicated" in ProductIndList then
ShowMessage2 := "No";
If exists HemoSNegative and HemoSNegative.Value = false then
ShowMessage2 := "Yes";
endif;
endif;
If "Irradiated Products Indicated" in ProductIndList then
ShowMessage3 := "No";
If exists IrradiatedInd and IrradiatedInd.Value = false then
ShowMessage3 := "Yes";
endif;
endif;
If (ShowMessage1 = "Yes" or ShowMessage2 = "Yes" or ShowMessage3 = "Yes" or ShowMessage4 = "Yes") then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n You have removed special needs for this order. "
|| "\n\n For emergent use only. To permanently remove special need from profile, update Significant Events." ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
endif;
;;
evoke: // No evoke statement
;;
logic:
conclude true; // always, to return modified objects
;;
action:
/*-----------------------------------------------------------*/
/* return communication_type and form_type objects to system */
/*-----------------------------------------------------------*/
return this_comm, this_form;
;;
end:

View File

@@ -0,0 +1,148 @@
maintenance:
title: Patient Type Change;;
mlmname: FORM_CaseManagement;;
arden: version 2;;
version: 4.50;;
institution: St Clair Charger MLM;;
author: Robert Spence, Eclipsys Corp;;
specialist: ;;
date: 2008-08-08;;
validation: testing;;
library:
purpose: This MLM restricts the user only select one checkbox on the Patient Type Change order
;;
explanation: See above
;;
keywords: Called MLMs, Form fields, Case Management, Restrict form
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormType := this_communication.FormType;
Obs_field := last of (field_list
where field_list.DataItemName = "NUR_ADTObsvStatusCBx" );
SSop_field := last of (field_list
where field_list.DataItemName = "NUR_ADTSsopStatusCBx" );
Inp_field := last of (field_list
where field_list.DataItemName = "NUR_ADTInptStatusCBx");
Surgery_field := last of (field_list
where field_list.DataItemName = "NUR_ADTsdcstatusCBx");
Denied_field := last of (field_list
where field_list.DataItemName = "NUR_ADTAdmDeniedCBx");
If callingField = "NUR_ADTObsvStatusCBx" then
If Obs_field.Value = True then
SSop_field.control_read_only := True;
Inp_field.control_read_only := True;
Surgery_field.control_read_only := True;
Denied_field.control_read_only := True;
else
SSop_field.control_read_only := False;
Inp_field.control_read_only := False;
Surgery_field.control_read_only := False;
Denied_field.control_read_only := False;
endif;
elseif callingField = "NUR_ADTSsopStatusCBx" then
If SSop_field.Value = True then
Obs_field.control_read_only := True;
Inp_field.control_read_only := True;
Surgery_field.control_read_only := True;
Denied_field.control_read_only := True;
else
Obs_field.control_read_only := False;
Inp_field.control_read_only := False;
Surgery_field.control_read_only := False;
Denied_field.control_read_only := False;
endif;
elseif callingField = "NUR_ADTInptStatusCBx" then
If Inp_field .Value = True then
Obs_field.control_read_only := True;
SSop_field.control_read_only := True;
Surgery_field.control_read_only := True;
Denied_field.control_read_only := True;
else
Obs_field.control_read_only := False;
SSop_field.control_read_only := False;
Surgery_field.control_read_only := False;
Denied_field.control_read_only := False;
endif;
elseif callingField = "NUR_ADTsdcstatusCBx" then
If Surgery_field.Value = True then
Obs_field.control_read_only := True;
Inp_field.control_read_only := True;
SSop_field.control_read_only := True;
Denied_field.control_read_only := True;
else
Obs_field.control_read_only := False;
Inp_field.control_read_only := False;
SSop_field.control_read_only := False;
Denied_field.control_read_only := False;
endif;
elseif callingField = "NUR_ADTAdmDeniedCBx" then
If Denied_field .Value = True then
Obs_field.control_read_only := True;
Inp_field.control_read_only := True;
Surgery_field.control_read_only := True;
SSop_field.control_read_only := True;
else
Obs_field.control_read_only := False;
Inp_field.control_read_only := False;
Surgery_field.control_read_only := False;
SSop_field.control_read_only := False;
endif;
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:

View File

@@ -0,0 +1,99 @@
maintenance:
title: FORM_CCM_ELECTROLYTE_MEDICATION;;
mlmname: FORM_CCM_ELECTROLYTE_MEDICATION;;
arden: version 2.5;;
version: 6.10;;
institution: St. Clair Hospital ;;
author: Shivprasad Jadhav;;
specialist: Shivprasad Jadhav, Allscripts;;
date: 2015-03-05;;
validation: testing;;
library:
purpose: 25-03-2015 CSR-33064 : MLM Created
Scenario 1 : if user select any order from Central line i.e "Pottasium Chloride or Calcium Gluconate" then
the other same order from Pheripheral line e.g [Pottasium Chloride or Calcium Gluconate] order should greyed out.
Scenario 2 : if user select any order from Pheripheral line i.e "Pottasium Chloride or Calcium Gluconate" then the other same order
from Central line e.g [Pottasium Chloride or Calcium Gluconate] order should greyed out.;;
explanation:
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
( this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
field_list:= this_form.Fields;
Pharmacy := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 50 );
Pharmacy_Value := Pharmacy.Value ;
// *********** Objects for first flow *************
Potassium1 := Pharmacy_Value[4];
Potassium2 := Pharmacy_Value[5];
Calcium1 := Pharmacy_Value[6];
Calcium2 := Pharmacy_Value[7];
If Potassium1.IsSelected = True Then
Potassium2.IsReadonly := True;
//Calcium2.IsReadonly := True;
Endif;
If Potassium2.IsSelected = True Then
Potassium1.IsReadonly := True;
//Calcium2.IsReadonly := True;
Endif;
If ( Potassium1.IsSelected = False And Potassium2.IsReadonly = True ) or (Potassium2.IsSelected = False And Potassium1.IsReadonly = True ) Then
Potassium1.IsReadonly := False;
Potassium2.IsReadonly := False;
Potassium1.IsSelected := False ;
Potassium2.IsSelected := False ;
Endif;
If Calcium1.IsSelected = True Then
Calcium2.IsReadonly := True;
//Calcium2.IsReadonly := True;
Endif;
If Calcium2.IsSelected = True Then
Calcium1.IsReadonly := True;
//Calcium2.IsReadonly := True;
Endif;
If ( Calcium1.IsSelected = False And Calcium2.IsReadonly = True ) or (Calcium2.IsSelected = False And Calcium1.IsReadonly = True ) Then
Calcium1.IsReadonly := False;
Calcium2.IsReadonly := False;
Calcium1.IsSelected := False ;
Calcium2.IsSelected := False ;
Endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,378 @@
maintenance:
title: ;;
mlmname: FORM_CHEMO_DESENSITIZATION_PROTOCOL;;
arden: version 2.5;;
version: 1.00;;
institution: St.Clair Hospital ;;
author: Sandy Zhang ;;
specialist: Debbie Bellissimo ;;
date: 2017-08-17;;
validation: testing;;
library:
purpose:
;;
explanation:
;;
keywords:
;;
citations:
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list := this_form.Fields;
primary_order_set_type := this_communication.PrimaryObj[1];
order_set_name := primary_order_set_type.OrderSetName;
// carboplatin orderset guid = 9000068526703910
// oxaliplatin orderset guid = 9000068526803910
if (order_set_name = "Oxaliplatin Desensitization Protocol") then
// sets {{{SINGLE-QUOTE}}}Target Dose (mg){{{SINGLE-QUOTE}}}
if (this_communication.CallingFieldName = "DosageLow|3") then
target_dose := first of (field_list where field_list.DataItemName = "DosageLow"
and field_List.Control_MultiFieldOccNum = 3);
dose_bag_1 := first of (field_list where field_list.DataItemName = "DosageLow"
and field_List.Control_MultiFieldOccNum = 1);
dose_bag_2 := first of (field_list where field_list.DataItemName = "DosageLow"
and field_List.Control_MultiFieldOccNum = 2);
dose_bag_3 := first of (field_list where field_list.DataItemName = "DosageLow"
and field_List.Control_MultiFieldOccNum = 4);
dose_bag_4 := first of (field_list where field_list.DataItemName = "DosageLow"
and field_List.Control_MultiFieldOccNum = 5);
dose_bag_5 := first of (field_list where field_list.DataItemName = "DosageLow"
and field_List.Control_MultiFieldOccNum = 6);
calc_bag_1 := target_dose.Value * 0.0001;
calc_bag_2 := target_dose.Value * 0.001;
calc_bag_3 := target_dose.Value * 0.01;
calc_bag_4 := target_dose.Value * 0.1;
// calc_bag_5 := target_dose.Value * 0.9;
calc_bag_5 := round (target_dose.Value - calc_bag_4 - calc_bag_3 - calc_bag_2 - calc_bag_1);
dose_bag_1.Value := calc_bag_1;
dose_bag_2.Value := calc_bag_2;
dose_bag_3.Value := calc_bag_3;
dose_bag_4.Value := calc_bag_4;
dose_bag_5.Value := calc_bag_5;
endif; // if (this_communication.CallingFieldName = "DosageLow|3")
// sets {{{SINGLE-QUOTE}}}Requested Time{{{SINGLE-QUOTE}}}
if (this_communication.CallingFieldName = "RequestedTime|1") then
// grab hidden time fields
time_field_bag_1 := first of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 1);
time_field_bag_2 := first of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 2);
time_field_bag_3 := first of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 3);
time_field_bag_4 := first of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 4);
time_field_bag_5 := first of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 5);
time_field_supportive_med := first of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 6);
// grab hidden date fields
date_bag_1 := first of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 1);
date_bag_2 := first of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 2);
date_bag_3 := first of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 3);
date_bag_4 := first of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 4);
date_bag_5 := first of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 5);
//
time_value_bag_1 := time_field_bag_1.Value[1];
time_value_bag_2 := time_field_bag_2.Value[1];
time_value_bag_3 := time_field_bag_3.Value[1];
time_value_bag_4 := time_field_bag_4.Value[1];
time_value_bag_5 := time_field_bag_5.Value[1];
time_value_supportive_med := time_field_supportive_med.Value[1];
raw_time_bag_1 := time_value_bag_1.ReqTimeValue as time;
get_hour_bag_2 := (extract hour (raw_time_bag_1) + 1) as number;
get_hour_bag_3 := (extract hour (raw_time_bag_1) + 2) as number;
get_hour_bag_4 := (extract hour (raw_time_bag_1) + 3) as number;
get_hour_bag_5 := (extract hour (raw_time_bag_1) + 4) as number;
bag_1_date := raw_time_bag_1;
// bag_1_date := date_bag_1.Value[1];
bag_2_date := date_bag_2.Value[1];
bag_3_date := date_bag_3.Value[1];
bag_4_date := date_bag_4.Value[1];
bag_5_date := date_bag_5.Value[1];
/************************************************bag 2*****************************************************/
if (get_hour_bag_2 >= 24) then
time_value_bag_2.ReqTimeValue := (((extract hour raw_time_bag_1) - 23) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d");
date_bag_2.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date + 1) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date));
else
time_value_bag_2.ReqTimeValue := (((extract hour raw_time_bag_1) + 1) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d");
date_bag_2.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date));
endif;
/************************************************bag 3*****************************************************/
if (get_hour_bag_3 >= 24) then
time_value_bag_3.ReqTimeValue := (((extract hour raw_time_bag_1) - 22) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d");
date_bag_3.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date + 1) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date));
else
time_value_bag_3.ReqTimeValue := (((extract hour raw_time_bag_1) + 2) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d");
date_bag_3.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date));
endif;
/************************************************bag 4*****************************************************/
if (get_hour_bag_4 >= 24) then
time_value_bag_4.ReqTimeValue := (((extract hour raw_time_bag_1) - 21) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d");
date_bag_4.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date + 1) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date));
else
time_value_bag_4.ReqTimeValue := (((extract hour raw_time_bag_1) + 3) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d");
date_bag_4.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date));
endif;
/************************************************bag 5*****************************************************/
if (get_hour_bag_5 >= 24) then
//corrected_hour_bag_5 := raw_time_bag_1 - 24;
time_value_bag_5.ReqTimeValue := (((extract hour raw_time_bag_1) - 20) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d");
date_bag_5.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date + 1) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date));
else
time_value_bag_5.ReqTimeValue := (((extract hour raw_time_bag_1) + 4) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d");
date_bag_5.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date));
endif;
/************************************************supportive meds*****************************************************/
if ((extract hour raw_time_bag_1 - 1) < 0) then
time_value_supportive_med.ReqTimeValue := "00:00";
else
time_value_supportive_med.ReqTimeValue := (((extract hour raw_time_bag_1) - 1) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d");
endif;
endif; // if (this_communication.CallingFieldName = "RequestedTime|1") // sets requested time
endif; // if (this_communication.CallingFieldName = "RequestedTime|1")
if (order_set_name = "Carboplatin Desensitization Protocol") then
// sets {{{SINGLE-QUOTE}}}Target Dose (mg){{{SINGLE-QUOTE}}}
if (this_communication.CallingFieldName = "DosageLow|3") then
target_dose := first of (field_list where field_list.DataItemName = "DosageLow"
and field_List.Control_MultiFieldOccNum = 3);
dose_bag_1 := first of (field_list where field_list.DataItemName = "DosageLow"
and field_List.Control_MultiFieldOccNum = 1);
dose_bag_2 := first of (field_list where field_list.DataItemName = "DosageLow"
and field_List.Control_MultiFieldOccNum = 2);
dose_bag_3 := first of (field_list where field_list.DataItemName = "DosageLow"
and field_List.Control_MultiFieldOccNum = 4);
dose_bag_4 := first of (field_list where field_list.DataItemName = "DosageLow"
and field_List.Control_MultiFieldOccNum = 5);
dose_bag_5 := first of (field_list where field_list.DataItemName = "DosageLow"
and field_List.Control_MultiFieldOccNum = 6);
calc_bag_1 := target_dose.Value * 0.001;
calc_bag_2 := target_dose.Value * 0.01;
calc_bag_3 := target_dose.Value * 0.1;
calc_bag_4 := round (target_dose.Value - calc_bag_1 - calc_bag_2 - calc_bag_3);
dose_bag_1.Value := calc_bag_1;
dose_bag_2.Value := calc_bag_2;
dose_bag_3.Value := calc_bag_3;
dose_bag_4.Value := calc_bag_4;
endif; // if (this_communication.CallingFieldName = "DosageLow|3")
// sets {{{SINGLE-QUOTE}}}Requested Time{{{SINGLE-QUOTE}}} for carboplatin order set
if (this_communication.CallingFieldName = "RequestedTime|1") then
// grab hidden time fields
time_field_bag_1 := first of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 1);
time_field_bag_2 := first of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 2);
time_field_bag_3 := first of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 3);
time_field_bag_4 := first of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 4);
time_field_bag_5 := first of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 5);
time_field_supportive_med := first of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 6);
// grab hidden date fields
date_bag_1 := first of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 1);
date_bag_2 := first of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 2);
date_bag_3 := first of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 3);
date_bag_4 := first of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 4);
//
time_value_bag_1 := time_field_bag_1.Value[1];
time_value_bag_2 := time_field_bag_2.Value[1];
time_value_bag_3 := time_field_bag_3.Value[1];
time_value_bag_4 := time_field_bag_4.Value[1];
time_value_bag_5 := time_field_bag_5.Value[1];
time_value_supportive_med := time_field_supportive_med.Value[1];
raw_time_bag_1 := time_value_bag_1.ReqTimeValue as time;
get_hour_bag_2 := (extract hour (raw_time_bag_1) + 1) as number;
get_hour_bag_3 := (extract hour (raw_time_bag_1) + 3) as number;
get_hour_bag_4 := (extract hour (raw_time_bag_1) + 4) as number;
get_minutes_bag_2 := (extract minute (raw_time_bag_1) + 30) as number;
get_minutes_bag_3 := (extract minute (raw_time_bag_1)) as number;
get_minutes_bag_4 := (extract minute (raw_time_bag_1) + 30) as number;
bag_1_date := raw_time_bag_1;
// bag_1_date := date_bag_1.Value[1];
bag_2_date := date_bag_2.Value[1];
bag_3_date := date_bag_3.Value[1];
bag_4_date := date_bag_4.Value[1];
/************************************************bag 2*****************************************************/
// this calculates the remainder of the minutes if it exceeds 60 minutes
if (get_minutes_bag_2 > 60) then
minute_remain_bag_2 := get_minutes_bag_2 - 60;
hour_remain_bag_2 := get_hour_bag_2 + 1;
else
minute_remain_bag_2 := get_minutes_bag_2;
hour_remain_bag_2 := get_hour_bag_2;
endif;
if (hour_remain_bag_2 >= 24) then
time_value_bag_2.ReqTimeValue := ((hour_remain_bag_2 - 24) FORMATTED WITH "%2.2d") || ":" || (minute_remain_bag_2 FORMATTED WITH "%2.2d");
date_bag_2.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date + 1) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date));
else
time_value_bag_2.ReqTimeValue := (hour_remain_bag_2 FORMATTED WITH "%2.2d") || ":" || (minute_remain_bag_2 FORMATTED WITH "%2.2d");
date_bag_2.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date));
endif;
/************************************************bag 3*****************************************************/
// this calculates the remainder of the minutes if it exceeds 60 minutes
if (get_minutes_bag_3 > 60) then
minute_remain_bag_3 := get_minutes_bag_3 - 60;
hour_remain_bag_3 := get_hour_bag_3 + 1;
else
minute_remain_bag_3 := get_minutes_bag_3;
hour_remain_bag_3 := get_hour_bag_3;
endif;
if (hour_remain_bag_3 >= 24) then
time_value_bag_3.ReqTimeValue := ((hour_remain_bag_3 - 24) FORMATTED WITH "%2.2d") || ":" || (minute_remain_bag_3 FORMATTED WITH "%2.2d");
date_bag_3.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date + 1) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date));
else
time_value_bag_3.ReqTimeValue := (hour_remain_bag_3 FORMATTED WITH "%2.2d") || ":" || (minute_remain_bag_3 FORMATTED WITH "%2.2d");
date_bag_3.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date));
endif;
/************************************************bag 4*****************************************************/
// this calculates the remainder of the minutes if it exceeds 60 minutes
if (get_minutes_bag_4 >= 60) then
minute_remain_bag_4 := get_minutes_bag_4 - 60;
hour_remain_bag_4 := get_hour_bag_4 + 1;
else
minute_remain_bag_4 := get_minutes_bag_4;
hour_remain_bag_4 := get_hour_bag_4;
endif;
if (hour_remain_bag_4 >= 24) then
time_value_bag_4.ReqTimeValue := ((hour_remain_bag_4 - 24) FORMATTED WITH "%2.2d") || ":" || (minute_remain_bag_4 FORMATTED WITH "%2.2d");
date_bag_4.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date + 1) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date));
else
time_value_bag_4.ReqTimeValue := (hour_remain_bag_4 FORMATTED WITH "%2.2d") || ":" || (minute_remain_bag_4 FORMATTED WITH "%2.2d");
date_bag_4.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date));
endif;
/************************************************bag 5*****************************************************/
// inactive because bag 5 does not exist for carboplatin
time_value_bag_5.ReqTimeValue := ((extract hour raw_time_bag_1) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d");
/************************************************supportive meds*****************************************************/
if ((extract hour raw_time_bag_1 - 1) < 0) then
time_value_supportive_med.ReqTimeValue := "00:00";
else
time_value_supportive_med.ReqTimeValue := (((extract hour raw_time_bag_1) - 1) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d");
endif;
endif; // if (this_communication.CallingFieldName = "RequestedTime|1") // sets requested time
endif; // if (order_set_name = {{{SINGLE-QUOTE}}}Carboplatin Desensitization Protocol{{{SINGLE-QUOTE}}})
;;
priority: 50
;;
evoke: // No evoke statement
;;
logic: conclude true;
;;
action: return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,156 @@
maintenance:
title: Charging: If we select override billing location show more items;;
mlmname: FORM_CHG_PerfLocation;;
arden: version 2;;
version: 4.50;;
institution: St Clair Charger MLM;;
author: Robert Spence, Eclipsys Corp;;
specialist: ;;
date: 2006-03-31;;
validation: testing;;
library:
purpose: This MLM sets the field PRN Reason text to visible and mandatory if IsPRN true.
;;
explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and
Communications objects and compares it to Client Information to determine whether to display
certain fields and make them mandatory.
A Banner message is presented to the user to remind them that these fields must be
completed.
If the patient data does not meet the above conditions the fields are not visible on
the form.
The MLM is not run from a trigger event, but rather is called by the application.
It should be configured to run on Form Open.
;;
keywords: Called MLMs, Form fields, PRN, PRN Reason text
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormType := this_communication.FormType;
// This sets the visible control on the field dataitem - CHG_OVERRIDE_WITH
OverRideLoc_field := last of (field_list
where field_list.DataItemName = "CHG_OR_LOC" );
PerfLoc_field := last of (field_list
where field_list.DataItemName = "CHG_PerfLoc" );
Notes_field := last of (field_list
where field_list.DataItemName = "CHG_Comment");
ORWith_field := last of (field_list
where field_list.DataItemName = "CHG_OR_WITH");
SetID_field := last of (field_list
where field_list.DataItemName = "CHG_RS_SETID");
// this_communication.DisplayForm := "Yes";
// this_communication.Message := "MLM Field :" || CallingField || "\n" ||
// "MLM Event :" || CallingEvent || "\n" ||
// "Form type :" || FormType;
// this_communication.MessageType := "Informational";
If CallingEvent="FormOpen"
then
If FormType ="OrderSet"
then
ClientGuid:=this_communication.ClientGUID;
ClientVisitGUID:=this_communication.ClientVisitGUID;
//Retrieve Patient{{{SINGLE-QUOTE}}}s Current Location
CurrLocation:= read last
{"SELECT currentlocation "
|| " FROM cv3clientvisit "
|| " WHERE ClientGUID = " || SQL(ClientGuid)
|| " And GUID = " || SQL(ClientVisitGUID)};
ORWith_field.Value :=CurrLocation;
Notes_field.value :="Billing Location: " || ORWith_field.Value;
elseif FormType = "Order"
then
If SetID_field.Value = False
then
ClientGuid:=this_communication.ClientGUID;
ClientVisitGUID:=this_communication.ClientVisitGUID;
CurrLocation:= read last
{"SELECT currentlocation "
|| " FROM cv3clientvisit "
|| " WHERE ClientGUID = " || SQL(ClientGuid)
|| " And GUID = " || SQL(ClientVisitGUID)};
ORWith_field.Value :=CurrLocation;
Notes_field.value :="Billing Location: " || ORWith_field.Value;
endif;
endif;
elseif CallingEvent = "FieldChange"
then
If OverRideLoc_field.value=true
then
If (PerfLoc_field.value = "") or (PerfLoc_field.value is null)
then
PerfLoc_field.control_Visible:=TRUE;
else
Notes_field.value :="Billing Location: " || PerfLoc_field.value;
endif;
else
PerfLoc_field.control_Visible:=False;
PerfLoc_field.value:="";
If ORWith_field.value is not null
then
Notes_field.value :="Billing Location: " || ORWith_field.Value;
endif;
endif;
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:

View File

@@ -0,0 +1,301 @@
maintenance:
title: FORM_Clostridium_Difficile_Toxin_Order ;;
mlmname: FORM_Clostridium_Difficile_Toxin_Order ;;
arden: version 2.5;;
version: 6.10;;
institution: St. Clair Hospital;;
author: Shivprasad Jadhav;;
specialist: Shivprasad jadhav, Allscripts Corporation;;
date: 2015-10-23;;
validation: testing;;
library:
purpose: Preselect the "Clostridium Difficile Toxin by PCR" Order IF:
1st Senario:- Order is not placed at all.
2nd Senario:- MLM will look back for past 4days lab result across the visit for "Clostridium Difficile Toxin by PCR" order
with the order status as "Specimen Recieved by performing Department" if order is not placed then it has to be preselect.
3rd Senario:-MLM will lool back for past 4days lab result across the visit for "Clostridium Difficile Toxin by PCR" with the order
status "1 or more final results received" if this order staus is not present then lab order has to be preselect.
;;
explanation:
Change History
-----------------
23.10.2015 JML CSR# 33678: Created
06.29.2016 DJW CSR# 34852 Updated for new message
#1 12/08/2017 SHAMI CSR#36182
#2 12/15/2017 SHAMI
07/10/2019 JML CSR# 38386: Modified logic to auto-check lab test based on ED vs. Inpatient location.
;;
keywords: Called MLMs
;;
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;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
log_execution_info := FALSE;
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGUID;
USER_guid := this_communication.USERGUID;
pObj := this_communication.PrimaryObj;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
item_event := this_communication.itemevent;
form_type := this_communication.formtype;
//Get patient{{{SINGLE-QUOTE}}}s current location
curr_loc := read last { "SELECT CurrentLocation FROM CV3ClientVisit cv WITH (NOLOCK) WHERE cv.GUID = " || visit_guid };
if ( curr_loc = "ER Major" ) then
lab_test_name := "Clostridium Difficile Toxin Gene Testing by PCR";
index_val := 2;
C_Diff_O := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckBox" AND field_list.Control_MultiFieldOccNum = 4);
else
lab_test_name := "Clostridium Difficile Screening";
index_val := 4;
C_Diff_O := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckBox" AND field_list.Control_MultiFieldOccNum = 2);
endif;
//Retrieve relevant form fields
C_Diff := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckBox" AND field_list.Control_MultiFieldOccNum = index_val);
C_Speci := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 3);
C_Comment := last of ( field_list WHERE field_list.DataItemName = "NUR_ Comment 1 line" );
NurseInstructionsGrid := first of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 1);
read_only_instr := false;
C_Iso := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckBox" AND field_list.Control_MultiFieldOccNum = 3 );
C_NotifyID := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 2 );
C_Diff_Val := C_Diff.Value;
C_Speci_Val:= C_Speci.Value ;
C_Iso_Val := C_Iso.Value;
C_NotifyID_Val := C_NotifyID.Value;
C_NotifyID_Order := C_NotifyID_Val[1];
C_Diff_O_Val := C_Diff_O.Value;
Special_Instr := C_Speci_Val[1];
if ( CallingEvent = "FormOpen" ) then
//Check to see if patient is on Clostridium Difficile Toxin Gene Testing by PCR
//Ordered OR resulted
C_Diff_Order := read {"SELECT o.Name"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
|| " ON cv.GUID = o.ClientVisitGUID"
|| " AND cv.ClientGUID = o.ClientGUID"
|| " AND cv.ChartGUID = o.ChartGUID"
|| " WHERE cv.ClientGUID = " || Sql(client_guid)
|| " And cv.Guid =" || Sql(visit_guid)
|| " AND o.NAME IN ( {{{SINGLE-QUOTE}}}Clostridium Difficile Toxin Gene Testing by PCR{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Clostridium Difficile Screening{{{SINGLE-QUOTE}}} ) "
|| " AND DATEDIFF(HH, o.SignificantDtm, GetDate()) <= 96 " //96
|| " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PCOL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}COLL{{{SINGLE-QUOTE}}})"};
//Ordered ONLY
C_Diff_Ord_Pending := read {"SELECT o.Name"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
|| " ON cv.GUID = o.ClientVisitGUID"
|| " AND cv.ClientGUID = o.ClientGUID"
|| " AND cv.ChartGUID = o.ChartGUID"
|| " WHERE cv.ClientGUID = " || Sql(client_guid)
|| " And cv.Guid =" || Sql(visit_guid)
|| " AND o.NAME IN ( {{{SINGLE-QUOTE}}}Clostridium Difficile Toxin Gene Testing by PCR{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Clostridium Difficile Screening{{{SINGLE-QUOTE}}} ) "
|| " AND DATEDIFF(HH, o.SignificantDtm, GetDate()) <= 96 "
|| " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PCOL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}COLL{{{SINGLE-QUOTE}}})"};
//If lab test Ordered, display Comment line informing user C Diff order has already been placed
If exist C_Diff_Ord_Pending Then
C_Comment.Control_Visible := True ;
Else
C_Comment.Control_Visible := False ;
EndIf;
//If C Diff order doesn{{{SINGLE-QUOTE}}}t exist, auto check C Diff lab
if ( Not exists C_Diff_Order ) then
for lab in 1 seqto ( count C_Diff_Val ) do
if ( C_Diff_Val[lab].Name = lab_test_name ) then
C_Diff_Val[lab].IsSelected := true ;
C_Diff_Val[lab].IsReadonly := False ;
C_Diff_O_Val.IsSelected := false;
C_Diff_O_Val.IsReadOnly := true;
Special_Instr.IsSelected := True ;
C_Comment.Control_Visible := False ;
C_Iso_Val.IsSelected := true;
C_NotifyID_Order.IsSelected := true;
endif;
enddo;
else
C_Diff_Val.IsSelected := ( false);
C_Diff_Val.IsReadonly := (true );
C_Diff_O_Val.IsSelected := false;
C_Diff_O_Val.IsReadonly := true;
read_only_instr := true;
C_Iso_Val.IsSelected := false;
C_Iso_Val.IsReadOnly := true;
C_NotifyID_Order.IsSelected := false;
C_NotifyID_Order.IsReadonly := true;
Special_Instr.IsSelected := false;
Special_Instr.IsReadonly := true;
endif;
index_list := 1 seqto (count NurseInstructionsGrid.Value);
for I in index_list do
NurseInstructionsGrid.Value[I].IsReadonly := read_only_instr;
enddo;
//#1 : Start
IF(this_form.name="NUR_Cdiff StandOrder") Then
Result := read last { " SELECT TOP 1 O.Name "
||" FROM Cv3Order (NOLOCK) O "
||" INNER JOIN CV3OrderTaskOccurrence ot on ot.ClientGUID=O.ClientGUID and ot.OrderGUID=O.GUID and ot.TaskStatusCode={{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
||" WHERE ot.PerformedFromDtm >= DATEADD(HOUR, -48, GETDATE())"
||" AND O.Status= {{{SINGLE-QUOTE}}}ACTIVE{{{SINGLE-QUOTE}}} AND O.ActivateStatus={{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} "
||" AND Name IN ({{{SINGLE-QUOTE}}}Bisacodyl 5mg EC Tab{{{SINGLE-QUOTE}}} , "
||" {{{SINGLE-QUOTE}}}Bisacodyl 10mg Rectal Supp{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Chondrus/Mineral Oil{{{SINGLE-QUOTE}}} , "
||" {{{SINGLE-QUOTE}}}Docusate Calcium 240mg Cap{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Docusate Sodium 50mg Cap{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Docusate Sodium 100mg Cap{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Docusate Sodium Syrup{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Docusate Sodium Syrup/Mineral Oil{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Glycerin Adult Supp{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Glycerin Pediatric Supp{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Lo-So Prep - Magnesium Citrate Powder{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Magnesium Citrate 300ml Soln{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Magnesium Hydroxide Susp{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Mineral Oil{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Mineral Oil Enema{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Polycarbophil 500mg Tab{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Senna Tab{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Senna Syrup{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Senna/Docusate Sodium Tab{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Sodium Phosphate Enema{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Sodium Phosphate Pediatric Enema{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Polyethylene Glycol - Electrolytes Prep{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Polyethylene Glycol - Electrolytes Prep{{{SINGLE-QUOTE}}}, "
||" {{{SINGLE-QUOTE}}}Polyethylene Glycol 17gm Powder{{{SINGLE-QUOTE}}}) "
||" AND O.ClientGUID = " || SQL(client_guid)
||" AND O.ChartGUID = " || SQL(Chart_guid)
||" AND O.ClientVisitGUID = " || SQL(Visit_guid)
};
IF(EXISTS Result ) THEN
Flag := True;
//#2 Start
C_Infprev := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 2);
C_Notify := C_Infprev.Value[1];
C_Spe := C_Speci.Value[1];
C_Notify.IsSelected := False ;
C_Notify.IsReadonly := True ;
C_Spe.IsSelected := False ;
C_Spe.IsReadonly := True ;
//#2 END
Indicator_1 := NurseInstructionsGrid.Value[1] ;
Indicator_2 := NurseInstructionsGrid.Value[2];
Indicator_3 := NurseInstructionsGrid.Value[3];
C_Diff_Val[lab].IsSelected := False ;
C_Diff_Val[lab].IsReadonly := True ;
C_Diff_O_Val.IsSelected := false;
C_Diff_O_Val.IsReadOnly := true;
Indicator_1.IsReadonly := True ;
Indicator_2.IsReadonly := True ;
Indicator_3.IsReadonly := true;
C_Iso_Val.IsSelected := false;
C_Iso_Val.IsReadOnly := true;
if Flag = True then
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n This patient has received laxatives in the last 48 hours. C.diff testing is not recommended in this setting. "|| " "
,"C Diff Ordering Information ", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
else
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n If patient has had laxitives, lactulose, bowel prep or new tube feed, sending C.diff specimen is not recommended. "|| " "
,"C Diff Ordering Information ", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
Endif;// Flag
else
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n If patient has had laxitives, lactulose, bowel prep or new tube feed, sending C.diff specimen is not recommended. "|| " "
,"C Diff Ordering Information ", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
ENDIF;//Result exist
ENDIF;//form exist
ENDIF;// Calling EVNET
//#1 : END
;;
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:

View File

@@ -0,0 +1,145 @@
maintenance:
title: FORM_COLECTOMYCOLON_RESCTION_POST_OP;;
mlmname: FORM_COLECTOMYCOLON_RESCTION_POST_OP;;
arden: version 2.5;;
version: 6.10;;
institution: St. Clair Hospital ;;
author: Shivprasad Jadhav;;
specialist: Shivprasad Jadhav, Allscripts;;
date: 2015-02-23;;
validation: testing;;
library:
purpose: Scenario 1 : Only one can be selected from the highlighted 5 Order item/order set. As all are given for same reason[mild to moderate pain].
Scenario 2 : Only one can be selected from the highlighted two order item as both are given for same reason[nausea/vomiting];;
explanation:
11-03-2015 - CSR:33066 : Created
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
( this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
field_list:= this_form.Fields;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
Medication_Morphine := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 62 );
Medication_HydroMorphine := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 63 );
Medication_Pharmacy := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 49 );
Morphine_Value := Medication_Morphine.Value ;
HydroMorphine_Value := Medication_HydroMorphine.Value;
Pharmacy_Value := Medication_Pharmacy.Value;
// *********** Objects for first flow *************
Morphine1 := first of (Morphine_Value where Morphine_Value.Name = "Morphine Inj");
//Morphine2 := first of (Morphine_Value where Morphine_Value.Name = "PCA - Morphine Order Set"); //PCA - Morphine Order Set
Morphine2 := Morphine_Value[2];
HydroMorphine1 := first of (HydroMorphine_Value where HydroMorphine_Value.Name = "Hydromorphone Inj"); // D5W 1000ml
//HydroMorphine2 := first of (HydroMorphine_Value where HydroMorphine_Value.Name = "PCA - Hydromorphone Order Set");
HydroMorphine2 := HydroMorphine_Value[2];
//OxyCodon := first of (Pharmacy_Value where Pharmacy_Value.Name = "OxyCODONE 5mg/Acetaminophen 325mg Tab");
//Second Scope in MLM
Ondansetron := first of (Pharmacy_Value where Pharmacy_Value.Name = "Ondansetron Inj");
Promethazine := first of (Pharmacy_Value where Pharmacy_Value.Name = "Promethazine Inj");
If Morphine1.IsSelected = True Then
Morphine2.IsReadonly := True;
HydroMorphine1.IsReadonly := True ;
HydroMorphine2.IsReadonly := True;
//OxyCodon.IsReadonly := True ;
Endif;
If Morphine2.IsSelected = True Then
Morphine1.IsReadonly := True;
HydroMorphine1.IsReadonly := True ;
HydroMorphine2.IsReadonly := True;
//OxyCodon.IsReadonly := True ;
Endif;
If HydroMorphine1.IsSelected = True Then
Morphine1.IsReadonly := True;
Morphine2.IsReadonly := True;
HydroMorphine2.IsReadonly := True;
//OxyCodon.IsReadonly := True ;
Endif;
If HydroMorphine2.IsSelected = True Then
Morphine1.IsReadonly := True;
Morphine2.IsReadonly := True;
HydroMorphine1.IsReadonly := True ;
//OxyCodon.IsReadonly := True ;
Endif;
/*If OxyCodon.IsSelected = True Then
Morphine1.IsReadonly := True;
Morphine2.IsReadonly := True;
HydroMorphine1.IsReadonly := True ;
HydroMorphine2.IsReadonly := True;
Endif;*/
If HydroMorphine2.IsSelected = False And HydroMorphine1.IsSelected = False And Morphine2.IsSelected = False And Morphine1.IsSelected = False Then
Morphine1.IsReadonly := False;
Morphine2.IsReadonly := False;
HydroMorphine1.IsReadonly := False ;
HydroMorphine2.IsReadonly := False;
//OxyCodon.IsReadonly := False ;
EndIf;
// Second flow ******************************************************************************
If Ondansetron.IsSelected = True Then
Promethazine.IsReadonly := True;
Endif;
If Promethazine.IsSelected = True Then
Ondansetron.IsReadonly := True;
Endif;
If Promethazine.IsSelected = False And Ondansetron.IsSelected = False Then
Promethazine.IsReadonly := False;
Ondansetron.IsReadonly := False;
EndIf;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,59 @@
maintenance:
title: FORM_CT_NEEDLE_BIOPSY_RENAL_REQUISITION_FORM_HYPERLINK;;
mlmname: FORM_CT_NEEDLE_BIOPSY_RENAL_REQUISITION_FORM_HYPERLINK;;
arden: version 2;;
version: 4.50;;
institution: St Clair Charger MLM;;
author: Don Warnick, Eclipsys Corp;;
specialist: Rob Stewart;;
date: 2017-04-20;;
validation: testing;;
library:
purpose: This MLM will exectue a link to a form
;;
explanation: This MLM launch a hyperlink to the Biopsy Requistion form stored on Clarinet
Change history
04.20.2017 DW CSR# 35462 - Created - CT Needle Biopsy, Renal - launch link to Clairnet document
;;
keywords: Called MLMs, Form fields, Set
;;
knowledge:
type: data-driven;;
data:
(this_communication,this_form,client_info_obj) := argument;
log_execution_info := False;
error_message:="";
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormType := this_communication.FormType;
PertinentClnicalInfo := first of (field_list where field_list.DataItemName = "CT Renal Indications" and field_List.Control_MultiFieldOccNum = 1);
if PertinentClnicalInfo.value = "Random Renal Biopsy"
then
link_value := "http://clairnet/Forms/Forms%20Directory/UPMC%20Renal%20Biopsy%20Requisition%20Form.pdf";
shell_to_win := INTERFACE {long shell32:ShellExecuteA(long, char*, char*, char*, char*, char*)};
x := call shell_to_win with 0, "open",link_value,NULL, NULL, "SW_SHOWNORMAL";
endif;
;;
evoke:
;;
logic:
conclude true;
;;
action:
return this_communication, this_form;
;;
end:

View File

@@ -0,0 +1,132 @@
maintenance:
title: FORM_C_Section_Admission_OS;;
mlmname: FORM_C_Section_Admission_OS;;
arden: version 2.5;;
version: 6.10;;
institution: St. Clair Hospital ;;
author: Shivprasad Jadhav;;
specialist: Shivprasad Jadhav, Allscripts;;
date: 2015-02-07;;
validation: testing;;
library:
purpose: Ø User should be able to select only one from cefazolin or clindamycin ;;
explanation:
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
(this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
field_list:= this_form.Fields;
field_list := this_form.fields;
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGUID;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
CallingItem := CallingField.Records_;
Medication := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 49 );
Medication_Val := Medication.Value;
CBC_48_Hours := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckBox"
and field_list.Control_MultiFieldOccNum = 5 );
CBC_48_Hours_Val := CBC_48_Hours.Value;
Type_Screen := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckBox"
and field_list.Control_MultiFieldOccNum = 6 );
Type_Screen_Val := Type_Screen.Value;
Val1 := Type_Screen.Value[1];
MLM_Medical_Imaging := MLM {{{SINGLE-QUOTE}}}FORM_MEDICAL_IMAGING_INDICATIONS_FOR_OS{{{SINGLE-QUOTE}}} ;
(this_communication, this_form) := CALL MLM_Medical_Imaging with this_communication ;
// *********** Objects for first flow *************
item1 := Medication_Val[1];
item2 := Medication_Val[2];
Val1 := Type_Screen.Value[1];
//********* objects for Second Flow **********
// first flow ***************************************************************************************************
If item1.IsSelected = True Then
item2.IsReadonly := True;
EndIf;
If item2.IsSelected = True Then
item1.IsReadonly := True;
EndIf;
If (item1.IsSelected = False And item2.IsSelected = False ) Then
item1.IsReadonly := False;
item2.IsReadonly := False;
EndIf;
//Check to see if patient had these labs drawn in last 96 hours
( lab_name_CBC ) := read {"SELECT o.Name"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
//|| " ON cv.GUID = o.ClientVisitGUID"
|| " On cv.ClientGUID = o.ClientGUID"
|| " AND cv.ChartGUID = o.ChartGUID"
|| " WHERE cv.ClientGUID = " || Sql(client_guid)
|| " AND o.NAME IN ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}} )"
|| " AND DATEDIFF(MINUTE, o.ARRIVALDTM, GetDate()) <= 2880 "
|| " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}})"};
if ( exists lab_name_CBC ) then
CBC_48_Hours.Value[1].IsSelected := False;
else
CBC_48_Hours.Value[1].IsSelected := True ;
endif;
//Check to see if patient had these labs drawn in last 96 hours
lab_name_TypeScreen := read {"SELECT Distinct o.Name"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
//|| " ON cv.GUID = o.ClientVisitGUID"
|| " On cv.ClientGUID = o.ClientGUID"
|| " AND cv.ChartGUID = o.ChartGUID"
|| " WHERE cv.ClientGUID = " || Sql(client_guid)
|| " AND o.NAME IN ({{{SINGLE-QUOTE}}}Type and Screen{{{SINGLE-QUOTE}}} )"
|| " AND DATEDIFF(MINUTE, o.ARRIVALDTM, GetDate()) <= 4320 "
|| " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}})"};
if ( exists lab_name_TypeScreen ) then
Val1.IsSelected := False;
else
Val1.IsSelected := True ;
endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,109 @@
maintenance:
title: Form_Demerol_Item_code;;
mlmname: Form_Demerol_Item_code;;
arden: version 2;;
version: 4.50;;
institution: St. Clair Hospital;;
author: Teresa Spicuzza ;;
specialist: Eclipsys Corporation;;
date: 2006-01-20;;
validation: testing;;
library:
purpose: Populate Worx order code based on demerol dose.
;;
explanation: This checks the ordered dose
of morphine and populates the worx product code with
corresponding value.
Value is based on high dose if present
Else low dose (mandatory on form) is used
;;
keywords:
Demerol, dose, worx code;
;;
knowledge:
type: data-driven;;
data:
/********************Make Changes To Spelling And Flags In This Section*********************/
/****************************************************************************************/
// 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;
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
//Dose
lodose := first of
(field_list where field_list.DataItemName = "dosagelow");
hidose := first of
(field_list where field_list.DataItemName = "dosagehigh");
//WORx Code
worx_prod_code := first of
(field_list where field_list.DataItemName = "PRX_DRUGIDCODE");
if exists lodose then
lodose_value := lodose.value;
endif;
if exists hidose then
hidose_value := hidose.value;
endif;
if hidose_value > 0 then
dose_value := hidose_value;
else
dose_value := lodose_value;
endif;
If dose_value <= 50 then
worx_prod_code.value := "04472";
elseif
dose_value <=75 and dose_value >50 then
worx_prod_code.value := "04473";
elseif
dose_value >75 then
worx_prod_code.value := "04474";
else
worx_prod_code.value := "04474";
endif; //
/* // FOR DEBUGGING PURPOSES: display a message to the user
this_communication.Message :=
"wt = "|| wt
|| "\nbolus_conc.value = " || bolus_conc.value
|| "\nbolus_dose = " || bolus_dose
|| "\ndose_route.value = " || dose_route.value
|| "\nrnd_bolus_dose = " || rnd_bolus_dose
;
this_communication.MessageType := "Informational";
*/
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns two parameters, of types
//communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end:', N'0ca0fddb-15d5-4f06-8279-851b59923223', 2, N'Form_Demerol_Item_code', N'2', N'4.50', CAST(N'2006-01-20T00:00:00.000' AS DateTime), NULL)

View File

@@ -0,0 +1,315 @@
maintenance:
title: Charging: If we select override billing location show more items;;
mlmname: FORM_DietAllOptions;;
arden: version 2;;
version: 4.50;;
institution: St Clair Charger MLM;;
author: Robert Spence, Eclipsys Corp;;
specialist: ;;
date: 2006-05-08;;
validation: testing;;
library:
purpose: This MLM sets the field PRN Reason text to visible and mandatory if IsPRN true.
;;
explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and
Communications objects and compares it to Client Information to determine whether to display
certain fields and make them mandatory.
A Banner message is presented to the user to remind them that these fields must be
completed.
If the patient data does not meet the above conditions the fields are not visible on
the form.
The MLM is not run from a trigger event, but rather is called by the application.
It should be configured to run on Form Open.
Change history
12.16.2015 DW CSR# 33655 Previnar - Created
07/20/2011 Modified data values as indicated below for Project #26464 Jack Miller and Maria Pest
04/05/2012 JL Added logic to include a note in the Order Summary Line when the user selects any of the "Consistent Carbohydrate" diet options; removed code that supports diet options
that are no longer available.
06/06/2012 Modified verbiage for the "Consistent Carbohydrate" diet options that displays in the Order Summary Line.
11/06/2015 CSR:32228- Seclusion Tray MLM - Added [Finger food] By Shivprasad Jadhav
04.26.2016 DW CSR# 34212 - Dietitian May Modify button selection
;;
keywords: Called MLMs, Form fields, PRN, PRN Reason text
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
//Custom variables
//Summary Line Verbiage
orderSummaryLine := "Add 1 carb serving (15g of carbohydrate) if 9pm BGM less than 100 mg/dl";
// This sets the visible control on the field dataitem - CHG_OVERRIDE_WITH
//Special Diets
Special_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_Special" );
//Sodium Options
Sodium_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD__Sodium" );
//Protein Options
Protein_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_Protein" );
//Carbohydrate & Calorie Controlled Diets
ADACalorie_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_ADA or Calorie" );
//Potassium Options
Potassium_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_Potassium" );
//Fluid Restrictions
FluidRestrictions_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_Fluid Restrictions" );
//Common Diets
Common_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_COMMON" );
Consistency_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_CONSISTENCY" );
//Liquid/Liquid Consistency Options
Liquid_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_LIQUID" );
//GI Options
GI_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_GI" );
//Other Diets
Other_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_Other" );
//Finger Food
Finger_Field := last of (field_list
where field_list.DataItemName = "DIET_DSD_Finger Foods" ); // Added By Shivprasad for CSR:32228- Seclusion Tray MLM on [6 Sept 2015]
//Thickened Liquids
//Hidden Field - Summary Line Verbiage
SummaryLine_Field := last of (field_list
where field_list.DataItemName = "DIET_Summary Line Verbiage");
Dietitian_May_Modify_SummaryLine:= last of (field_list where field_list.DataItemName = "DIET_May Not Modify" );
Dietitian_May_Modify_Selection := last of (field_list where field_list.DataItemName = "DIET_May Modify" );
// FIELD CHANGE
if (CallingEvent = "FieldChange") then
If CallingField="DIET_DSD_Special" then
//set everything to active where applicable
Sodium_Field.Control_READ_ONLY:= FALSE;
Potassium_Field.Control_READ_ONLY:= FALSE;
Protein_Field.Control_READ_ONLY:= FALSE;
If ((Liquid_Field.Value <> "Clear Liquid Controlled Carbohydrate") and
(Liquid_Field.Value <> "Full Liquid Controlled Carbohydrate")) or
(Liquid_Field.Value Is Null) then
ADACalorie_Field.Control_READ_ONLY:= FALSE;
endif;
Common_Field.Control_READ_ONLY:= FALSE;
Consistency_Field.Control_READ_ONLY:=FALSE;
Liquid_Field.Control_READ_ONLY:= FALSE;
GI_Field.Control_READ_ONLY:=FALSE;
Other_Field.Control_READ_ONLY:=FALSE;
FluidRestrictions_Field.Control_READ_ONLY:= FALSE;
//now for logic:
If Special_Field.Value ="Heart Healthy No Added Salt" then
Sodium_Field.Value:="";
Sodium_Field.Control_READ_ONLY:= TRUE;
endif;
If Special_Field.Value ="Heart Healthy 2 gram Sodium" then
Sodium_Field.Value:="";
Sodium_Field.Control_READ_ONLY:= TRUE;
endif;
/* Diet name changes, CSR 26464, 07/20/2011
Changed "Renal Dialysis NA3gmP90K70Fld1200"
to "Renal Dialysis: 3g Na, 90g Protein, 70meq K, 1200cc Fluid Restriction" */
If Special_Field.Value ="Renal Dialysis: 3g Na, 90g Protein, 70meq K, 1200cc Fluid Restriction" then
Sodium_Field.Value:="";
Sodium_Field.Control_READ_ONLY:= TRUE;
Potassium_Field.Value:="";
Potassium_Field.Control_READ_ONLY:= TRUE;
Protein_Field.Value:="";
Protein_Field.Control_READ_ONLY:= TRUE;
FluidRestrictions_Field.Value:="";
FluidRestrictions_Field.Control_READ_ONLY:= TRUE;
endif;
/* Diet name changes, CSR 26464, 07/20/2011
Changed "Renal Non Dialysis NA2gm P60 K60"
to "Renal Non Dialysis: 2g Na, 60g Protein, 60meq K" */
If Special_Field.Value ="Renal Non Dialysis: 2g Na, 60g Protein, 60meq K" then
Sodium_Field.Value:="";
Sodium_Field.Control_READ_ONLY:= TRUE;
Potassium_Field.Value:="";
Potassium_Field.Control_READ_ONLY:= TRUE;
Protein_Field.Value:="";
Protein_Field.Control_READ_ONLY:= TRUE;
endif;
endif;
If CallingField="DIET_DSD_LIQUID" then
// Do positive logic first
If (Liquid_Field.Value = "Clear Liquid Controlled Carbohydrate")
or (Liquid_Field.Value = "Full Liquid Controlled Carbohydrate") then
ADACalorie_Field.Value:="";
ADACalorie_Field.Control_READ_ONLY:= TRUE;
Else
ADACalorie_Field.Control_READ_ONLY := FALSE;
endif;
endif;
If CallingField ="DIET_DSD_GI" then
// Now for negative logic, also remember to trap for that null value
if ((Special_Field.Value <> "Renal Dialysis NA3gmP90K70Fld1200") OR (Special_Field.Value IS NULL)) then
FluidRestrictions_Field.Control_Read_Only:= False;
endif;
endif;
if CallingField = "DIET_DSD_COMMON" then
//CSR 30591, JML: Disable the Sodium options if Heart Healthy is selected under the common diets
if (Common_Field.Value = "Heart Healthy No Added Salt") then
Sodium_Field.Value:="";
Sodium_Field.Control_READ_ONLY:= TRUE;
else
Sodium_Field.Control_Read_Only := false;
endif;
//CSR 30591, JML: Add comment to hidden field if the carbohydrate option is selected;
// allows comment to appear on the Order Summary Line
if (Common_Field.Value = "No Concentrated Sweets, 2 carb 9pm snack") then
SummaryLine_Field.Value := orderSummaryLine;
else
SummaryLine_Field.Value := "";
endif;
endif;
if CallingField = "DIET_DSD_ADA or Calorie" then
//CSR 30591, JML: Add comment to hidden field on form if any of the Carbohydrate
// & Calorie Control Diets option is selected; allows the comment to appear
// on the Order Summary Line
if (ADACalorie_Field.Value IS NOT NULL) then
SummaryLine_Field.Value := orderSummaryLine;
else
SummaryLine_Field.Value := "";
endif;
endif;
// If the "Dietitian May Modfiy" button is de-selected, select the special instructions box "Not to be modified by dietitian"
If CallingField="DIET_May Modify" then
If Dietitian_May_Modify_Selection.Value = true
then
Dietitian_May_Modify_SummaryLine.Value := false;
endif;
If Dietitian_May_Modify_Selection.Value = false
then
Dietitian_May_Modify_SummaryLine.Value := true;
endif;
endif;
endif; // Field Change
// FORM CLOSE
If CallingEvent="FormClose" then
tally:=0;
If exist (Special_Field.value) then tally:=tally+1; endif;
If exist (Sodium_Field.value) then tally:=tally+1; endif;
If exist (Protein_Field.value) then tally:=tally+1; endif;
If exist (ADACalorie_Field.value) then tally:=tally+1; endif;
If exist (Potassium_Field.value) then tally:=tally+1; endif;
If exist (FluidRestrictions_Field.value) then tally:=tally+1; endif;
If exist (Common_Field.value) then tally:=tally+1; endif;
If exist (Consistency_Field.value) then tally:=tally+1; endif;
If exist (Liquid_Field.value) then tally:=tally+1; endif;
If exist (GI_Field.value) then tally:=tally+1; endif;
If exist (Other_Field.value) then tally:=tally+1; endif;
If exist (Finger_Field.value) then tally:=tally+1; endif; // Added By Shivprasad for CSR:32228- Seclusion Tray MLM on [17 Nov 2015]
If (tally <1) then
StopMessage:="You must enter at leaset one diet for this order";
endif;
If (tally >6) then
StopMessage:="You may only enter 6 total Diets to a Diet Order";
endif;
If (tally<1) or (tally>6) then
this_communication.DisplayForm := "Yes";
this_communication.Message := "You have entered " || tally || " diets " || "\n" || "\n" || StopMessage;
this_communication.MessageType := "Error";
endif;
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:

View File

@@ -0,0 +1,150 @@
maintenance:
title: St.Clair: Non Routine Diet Trays;;
mlmname: FORM_Diet_Overdue_NonRoutine_Tray;;
arden: version 2;;
version: 4.50;;
institution: St Clair;;
author: Don Warnick, Eclipsys Corp;;
specialist: ;;
date: 2007-03-22;;
validation: testing;;
library:
purpose: Determine if it is too late to send a routine meal tray and force the entry of a non routine tray is needed.
;;
explanation: This MLM is called from the Form_DietAllOptions form.
Change history
07.11.2008 RS Changed Today time from string to Arden time format
;;
keywords: Called MLMs, Form fields, Non Routine Diet Tray
;;
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;
visit_guid := this_communication.ClientVisitGUID;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := FALSE;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
requesteddate:= last of (field_list where field_list.DataItemName = "RequestedDate" );
requestedtime:= last of (field_list where field_list.DataItemName = "RequestedTime" );
nonroutinetray:= last of (field_list where field_list.DataItemName = "DIET_Non Routine Trays" );
// determine if the requested time is scheduled or coded.
if exists requestedtime.value.reqtimevalue
then time_type := "scheduled";
time_value := requestedtime.value.reqtimevalue;
else time_type := "coded";
time_value := requestedtime.value.reqtimecode;
endif;
// if coded get the timelimit of the coded time..if scheduled get the inputted time w/o the :
if time_type = "coded" then
(timelimit) := read last
{" select endtime "
||" from cv3codedtime "
||" where name = " || sql(time_value)
||" and active = 1 " };
elseif time_type = "scheduled" then
(timelimit) := read last
{" select stuff(" || sql (time_value) || ", patindex({{{SINGLE-QUOTE}}}%:%{{{SINGLE-QUOTE}}},"
|| sql (time_value) || " ),1,null) "};
endif;
// extract components of current time and create fields which can be compared with requested time
hr := extract hour now; if hr < 10 then hr := "0" || hr; endif;
mi := extract minute now; if mi < 10 then mi := "0" || mi; endif;
currtime := hr || mi;
yr := extract year now;
mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
// today:= mn || "-" || dd || "-" || yr || " 00:00:00";
// 07-11-2008 RS Changed today string to equal Arden Time String
today:= yr || "-" || mn || "-" || dd || "T00:00:00";
// determine if meal is overdue based upon requested time and current date and time
if requesteddate.value > (today as time) then overdue:= False;
elseif requesteddate.value < (today as time) then overdue:= True;
elseif requesteddate.value = (today as time) and (currtime as number) > (timelimit as number)
then overdue:= True; else overdue:= False;
endif;
if overdue = True then nonroutinetray.Control_mandatory:= True; else nonroutinetray.Control_mandatory:= False; endif;
// Use visit_guids to fire alerts so we can test on MACS TEST PATIENT ONLY IN PROD
// JUST CHANGE THE GUID FOR THE NEW ACCOUNT AND UNCOMMENT BATCH OF CODE
/*
If (visit_guid ="9000221334600270") or (visit_guid = "9000001559200270") then
this_communication.Message :=
"\nschedule type = " || time_type
|| "\nschedulte time value= " || time_value
|| "\n "
|| "\ncurrent date / time = " || now
|| "\n "
|| "\ncurrent date = " || (today as time)
|| "\nrequested date = " || requesteddate.value
|| "\n "
|| "\ncurrent time = " || currtime
|| "\ntime limit = " || timelimit
|| "\n "
|| "\noverdue = " || overdue
|| "\n\nyear =" || yr
|| "\nMonth = " || mn
|| "\nDay = " || dd
|| "\n\nMessage From Robert Spence, HIS 7461";
this_communication.MessageType := "Informational";
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:

View File

@@ -0,0 +1,435 @@
maintenance:
title: Retrieve Previous Preferences;;
mlmname: Form_Diet_Pref_Retreive;;
arden: version 2;;
version: 4.50;;
institution: St Clair Diet Pref MLM;;
author: Robert Spence, Eclipsys Corp;;
specialist: ;;
date: 2006-05-26;;
validation: testing;;
library:
purpose: This MLM sets the fields (3) For Preferences from the latest order
;;
explanation: This MLM takes the data sent to CDS from Diet on open
Use in On Open ONLY!
Change History
--------------------------------------
26.05.2006 JLM Created MLM By Robert Spence
17.11.2015 GOS Populating 3 Diet Preferences and Other UDDI{{{SINGLE-QUOTE}}}s for Child Diet Order [Diet - Add to Current Diet].
;;
keywords: Called MLMs, Form fields, Diet, Preferences, On Open Only
;;
knowledge:
type: data-driven;;
data:
// This MLM is passed three arguments, of types
// communication_type, form_type and client info object respectively.
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
// 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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
ClientGuid :=this_communication.clientguid;
ClientVisitGuid := this_communication.ClientVisitGuid;
ClientChartGuid := this_communication.ChartGuid;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
// Start: Added By Shivprasad
comm_obj := this_communication.primaryobj;
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGUID;
//End : By Shivprasad
If CallingEvent ="FormOpen" Then
// Get the Last Order
OrderGuid := read last
{ " Select top 1 guid "
|| " from cv3order "
|| " where clientguid = " || SQL(ClientGuid)
|| " and clientvisitguid = " || SQL(ClientVisitGuid)
|| " and chartguid = " || SQL(ClientChartGuid)
|| " and ((Name = " || SQL("Diet") || ") "
|| " or (Name = " || SQL("Supplements") || ")"
|| " or (Name = " || SQL("Diet_Special Request") || "))"
|| " order by createdwhen desc" };
// Get each Preference
If exists(OrderGuid) then
PrefData1 := read last
{ " Select Value"
|| " from CV3OrderUserData "
|| " where clientguid = " || SQL(ClientGuid)
|| " and OrderGUID = " || SQL(OrderGuid)
|| " and UserDataCode = " || SQL("DIET_DSP_Preference or Restriction") };
PrefData2 := read last
{ " Select Value"
|| " from CV3OrderUserData "
|| " where ClientGuid= " || SQL(ClientGuid)
|| " and OrderGUID = " || SQL(OrderGuid)
|| " and UserDataCode = " || SQL("DIET_DSP_Additional Pref or Restriction")};
PrefData3 := read last
{ " Select Value"
|| " from CV3OrderUserData "
|| " where ClientGuid= " || SQL(ClientGuid)
|| " and OrderGUID = " || SQL(OrderGuid)
|| " and UserDataCode = " || SQL("DIET_DSP_More Prefs and Restrictions")};
endif;
// If We are a supplement, there is no need for this...
FormName := this_form.name;
If FormName <> "DIET_Supplement"
then
OrderGuid := read last
{ " Select top 1 guid "
|| " from cv3order "
|| " where clientguid = " || SQL(ClientGuid)
|| " and clientvisitguid = " || SQL(ClientVisitGuid)
|| " and chartguid = " || SQL(ClientChartGuid)
|| " and ((Name = " || SQL("Diet") || ") "
|| " or (Name = " || SQL("Diet_Special Request") || "))"
|| " order by createdwhen desc" };
If exists(OrderGuid)
then
PrefDataTemp := read last
{" Select Value "
|| " from CV3OrderUserData "
|| " where ClientGuid= " || SQL(ClientGuid)
|| " and OrderGUID = " || SQL(OrderGuid)
|| " and UserDataCode = " || SQL("DIET_MT_LO_Seclusion Tray")};
Pref4_Field := last of (field_list
where field_list.DataItemName = "DIET_MT_LO_Seclusion Tray" );
If PrefDataTemp = "1"
then
Pref4_Field.Value := True;
Else
Pref4_Field.Value := False;
endif;
endif;
endif;
// This sets the visible control on the field dataitem - CHG_OVERRIDE_WITH
Pref1_Field := last of (field_list
where field_list.DataItemName = "DIET_DSP_Preference or Restriction" );
Pref2_Field := last of (field_list
where field_list.DataItemName = "DIET_DSP_Additional Pref or Restriction" );
Pref3_Field := last of (field_list
where field_list.DataItemName = "DIET_DSP_More Prefs and Restrictions" );
AtStart_Field := last of (field_list
where field_list.DataItemName = "DIET_PREF_ATSTART" );
// this_communication.DisplayForm := "Yes";
// this_communication.Message := "PrefData4 Is = " || PrefData4 || "\n" ||
// "PrefDataTemp is = " || PrefDataTemp || "\n" ||
// "Client GUID is = " || ClientGUID || "\n" ||
// "Order GUID is = " || OrderGUID || "\n" ||
// "Form Name is = " || FormName || "\n" ||
// "Pre4_Field is = " || Pref4_Field;
//
// this_communication.MessageType := "Error";
If Exists(PrefData1)
Then
Pref1_Field.Value := PrefData1;
AtStart_Field.Value := True;
Endif;
If Exists(PrefData2)
Then
Pref2_Field.Value := PrefData2;
AtStart_Field.Value :=True;
Endif;
If Exists(PrefData3)
Then
Pref3_Field.Value := PrefData3;
AtStart_Field.Value :=True;
Endif;
Endif; // End of form Open Event
//=====================================Code Added By Shivprasad for Seclusion Tray MLM ===================================
/* Purpose of Code
2015-03-14 CSR-32228 : Created MLM
1st Senario- When user open the "Diet order" ,then what ever order was present in the [Preference or Restriction (1),
Preference or Restriction (2),Preference or Restriction (3)]e.g "No Caffeine" should get prepopulate.
2nd Senario- When the user open the "Diet Order" and all prepopulated information from the "Preference or Restriction "section ,
user should be able to change the information .
----------------------------------------------------------------------------------------------------------------------------------------------------
1st Senario- When user select "Seclusion Tray " from Diet order then the "No Metal/China should be anavailable (Grayed-Out ) to user for selection.
2nd Senario- When user select "No Metal/China" from the Diet order then the "Seclusion Tray" should be Greyed-Out to user for selection .
----------------------------------------------------------------------------------------------------------------------------------------------------
1st Senario- When user select "Seclusion Tray " from Diet order then "Finger Foods" from Other Diets should get auto selected.
2nd Senario - When user uncheck the "Seclusion Tray" then "Finger Food " should also get uncheck.
3rd Senario-When user select "Finger Foods" from Other Diets order,then "Seclusion Tray" should not get autoselect. "Finger Foods" can be select single.
4th Senario- If "Finger Foods" has selected previously (Single selected) and "Seclusion Tray" is not selected ,and
if user select "No Metal/China" then "Finger Foods" should not get uncheck. */
F_FingerDiet := last of ( field_list WHERE field_list.DataItemName ="DIET_DSD_Finger Foods" and field_list.Control_MultiFieldOccNum = 1);
F_Diet1 := last of ( field_list WHERE field_list.DataItemName = "DIET_DSP_Preference or Restriction" and field_list.Control_MultiFieldOccNum = 1);
F_Diet2 := last of ( field_list WHERE field_list.DataItemName = "DIET_DSP_Additional Pref or Restriction" and field_list.Control_MultiFieldOccNum = 1);
F_Diet3 := last of ( field_list WHERE field_list.DataItemName = "DIET_DSP_More Prefs and Restrictions" and field_list.Control_MultiFieldOccNum = 1);
F_Seclusion := last of ( field_list WHERE field_list.DataItemName = "DIET_MT_LO_Seclusion Tray" and field_list.Control_MultiFieldOccNum = 1);
F_MetalChina := last of ( field_list WHERE field_list.DataItemName = "DIET_MT_LO_No Metal/China" and field_list.Control_MultiFieldOccNum = 1);
F_Seclusion_Val := F_Seclusion.Value ;
F_MetalChina_Value := F_MetalChina.Value ;
// To look for Any Active order
DietOrderGuid := Read first{" Select Top 1 o1.guid from cv3ClientVisit cv with (nolock) Join Cv3Order o1 With (Nolock) "
|| " on cv.guid=o1.ClientVisitGUID And cv.ClientGUID=o1.ClientGUID And cv.ChartGUID=o1.ChartGUID And o1.name = {{{SINGLE-QUOTE}}}Diet{{{SINGLE-QUOTE}}} "
|| " And o1.OrderStatusLevelNum = 50 And o1.InitialSessionTypeCode <> {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} And cv.guid = "|| visit_guid || " Order By O1.CreatedWhen Desc "} ;
If exist DietOrderGuid Then ActiveOrderAlert := False ; Endif;
// If {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} order is not Present then we are looking any other order to Pull the Data
If Not Exist DietOrderGuid Then
ActiveOrderAlert := True ;
DietOrderGuid := Read first{" Select Top 1 o1.guid from cv3ClientVisit cv with (nolock) Join Cv3Order o1 With (Nolock) "
|| " on cv.guid=o1.ClientVisitGUID And cv.ClientGUID=o1.ClientGUID And cv.ChartGUID=o1.ChartGUID And o1.name = {{{SINGLE-QUOTE}}}Diet{{{SINGLE-QUOTE}}} "
|| " And o1.InitialSessionTypeCode <> {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} And cv.guid = "|| visit_guid || " Order By O1.CreatedWhen Desc "} ;
Endif;
Ord_data := OBJECT[Obs_name, Value];
Ord_vals := READ AS Ord_data {" Select ud.UserDataCode , ud.Value "
|| " from cv3ClientVisit cv (nolock) Join cv3Order o (nolock)"
|| " On cv.guid =o.ClientVisitGUID And cv.ClientGUID=o.ClientGUID And cv.VisitStatus = {{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}} "
|| " Join cv3OrderUserData ud On ud.OrderGUID=o.GUID And ud.ClientGUID=cv.ClientGUID "
|| " And ud.UserDataCode in ({{{SINGLE-QUOTE}}}DIET_DSP_Preference or Restriction{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}DIET_DSP_Additional Pref or Restriction{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}DIET_DSP_More Prefs and Restrictions{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DIET_MT_LO_No Metal/China{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DIET_MT_LO_Seclusion Tray{{{SINGLE-QUOTE}}}) "
|| " And o.guid = " || DietOrderGuid || " "} ;
Ord_data1 := OBJECT[Obs_name, Value];
Ord_vals1 := READ AS Ord_data1 {" Select ud.UserDataCode , ud.Value "
|| " from cv3ClientVisit cv (nolock) Join cv3Order o (nolock)"
|| " On cv.guid =o.ClientVisitGUID And cv.ClientGUID=o.ClientGUID And cv.VisitStatus = {{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}} "
|| " Join cv3OrderUserData ud On ud.OrderGUID=o.GUID And ud.ClientGUID=cv.ClientGUID "
|| " And ud.UserDataCode in ({{{SINGLE-QUOTE}}}DIET_DSD_Common{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}DIET_DSD_Special{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}DIET_DSD_ADA or Calorie{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}DIET_DSD_Consistency{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}DIET_DSD_Liquid{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}DIET_DSD_GI{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}DIET_DSD_Other{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}DIET_DSD__Sodium{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DIET_MT_LO_No Metal/China{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DIET_MT_LO_Seclusion Tray{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}DIET_DSD_Potassium{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}DIET_DSD_Finger Foods{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DIET_DSD_Thickened{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}DIET_DSD_Protein{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DIET_DSD_Fluid Restrictions{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DIET_Summary Line Verbiage{{{SINGLE-QUOTE}}}) "
|| " And o.guid = " || DietOrderGuid || " "} ; //And o.OrderStatusCode = {{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}}
Sp_Inst := Read first {"select SpecialInstructions from CV3OrderAddnlInfo oa With (Nolock) Join CV3Order o With (Nolock) On oa.guid=o.guid
And oa.ClientGUID = o.ClientGUID And o.Guid = " || DietOrderGuid || " "} ;
If CallingEvent ="FormOpen" Then
//Generic_MLM := MLM {{{SINGLE-QUOTE}}}FORM_DIET_PREF_RETREIVE{{{SINGLE-QUOTE}}};
//this_communication,this_form := Call Generic_MLM With this_communication,this_form, client_info_obj ;
If Not exist Ord_vals Then // To Clear the Diet1, Diet2, Diet3 if No active parent {{{SINGLE-QUOTE}}}Diet{{{SINGLE-QUOTE}}} Order present on Patient
F_Diet1.Value := Null ;
F_Diet2.Value := Null ;
F_Diet3.Value := Null ;
Endif;
// Visually Impaired
Diet1 := first of(Ord_vals.Value where Ord_vals.Obs_name = "DIET_DSP_Preference or Restriction" And Ord_vals.Value Is Not Null );
Diet2 := first of (Ord_vals.Value where Ord_vals.Obs_name = "DIET_DSP_Additional Pref or Restriction" And Ord_vals.Value Is Not Null );
Diet3 := first of(Ord_vals.Value where Ord_vals.Obs_name = "DIET_DSP_More Prefs and Restrictions" And Ord_vals.Value Is Not Null );
MetalChina := first of(Ord_vals.Value where Ord_vals.Obs_name = "DIET_MT_LO_No Metal/China" And Ord_vals.Value Is Not Null );
Seclusion := first of(Ord_vals.Value where Ord_vals.Obs_name = "DIET_MT_LO_Seclusion Tray" And Ord_vals.Value Is Not Null );
If Diet1 Is Not Null Then
F_Diet1.Value := Diet1 ; Endif;
If Diet2 Is Not Null Then
F_Diet2.Value := Diet2 ; Endif;
If Diet1 Is Not Null Then
F_Diet3.Value := Diet3 ; Endif;
If F_Seclusion.Value = true Then
F_FingerDiet.Value := "Finger Foods" ;
Elseif F_Seclusion.Value = false And F_MetalChina.Control_Read_Only = True And F_MetalChina.Value = False Then
if F_FingerDiet.Value = "Finger Foods" Then
F_FingerDiet.Value := Null ;
Endif;
Endif;
If MetalChina = "1" Then
F_MetalChina.Value := True ;
F_Seclusion.Value := False ;
F_FingerDiet.Value := "" ;
//F_Seclusion.Control_Read_Only := True ;
Elseif Seclusion = "1" Then
F_Seclusion.Value := true ;
F_FingerDiet.Value := "Finger Foods" ;
F_MetalChina.Value := False;
Endif;
If comm_obj.Modifier= "(Add to current diet)" Then
// To show the Message to User when he open Child Diet Order i.e.[Diet-Add to current diet]
If ActiveOrderAlert = True Then // To Pass the Message if No active parent {{{SINGLE-QUOTE}}}Diet{{{SINGLE-QUOTE}}} Order present on Patient
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient does NOT have an active diet order ", "Important Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
Ord_vals1.Value := "";
Endif;
// To Show the Previous Active diet orders Data on new child-Diet Order
F_Common := last of ( field_list WHERE field_list.DataItemName = "DIET_DSD_Common" and field_list.Control_MultiFieldOccNum = 1);
F_Special := last of ( field_list WHERE field_list.DataItemName = "DIET_DSD_Special" and field_list.Control_MultiFieldOccNum = 1);
F_Cal := last of ( field_list WHERE field_list.DataItemName = "DIET_DSD_ADA or Calorie" and field_list.Control_MultiFieldOccNum = 1);
F_Consi := last of ( field_list WHERE field_list.DataItemName = "DIET_DSD_Consistency" and field_list.Control_MultiFieldOccNum = 1);
F_Liquid := last of ( field_list WHERE field_list.DataItemName = "DIET_DSD_Liquid" and field_list.Control_MultiFieldOccNum = 1);
F_ThickLiquid := last of ( field_list WHERE field_list.DataItemName = "DIET_DSD_Thickened" and field_list.Control_MultiFieldOccNum = 1);
F_GI := last of ( field_list WHERE field_list.DataItemName = "DIET_DSD_GI" and field_list.Control_MultiFieldOccNum = 1);
F_Other := last of ( field_list WHERE field_list.DataItemName = "DIET_DSD_Other" and field_list.Control_MultiFieldOccNum = 1);
F_Finger := last of ( field_list WHERE field_list.DataItemName = "DIET_DSD_Finger Foods" and field_list.Control_MultiFieldOccNum = 1);
F_Sodium := last of ( field_list WHERE field_list.DataItemName = "DIET_DSD__Sodium" and field_list.Control_MultiFieldOccNum = 1);
F_Pota := last of ( field_list WHERE field_list.DataItemName = "DIET_DSD_Potassium" and field_list.Control_MultiFieldOccNum = 1);
F_Protein := last of ( field_list WHERE field_list.DataItemName = "DIET_DSD_Protein" and field_list.Control_MultiFieldOccNum = 1);
F_Fluid := last of ( field_list WHERE field_list.DataItemName = "DIET_DSD_Fluid Restrictions" and field_list.Control_MultiFieldOccNum = 1);
F_Summary := last of ( field_list WHERE field_list.DataItemName = "DIET_Summary Line Verbiage" and field_list.Control_MultiFieldOccNum = 1);
F_SpecialInst := last of ( field_list WHERE field_list.DataItemName = "SpecialInstructions" and field_list.Control_MultiFieldOccNum = 1);
Common := first of(Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_DSD_Common" And Ord_vals1.Value Is Not Null );
Special := first of (Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_DSD_Special" And Ord_vals1.Value Is Not Null );
Cal := first of(Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_DSD_ADA or Calorie" And Ord_vals1.Value Is Not Null );
Consi := first of(Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_DSD_Consistency" And Ord_vals1.Value Is Not Null );
Liquid := first of (Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_DSD_Liquid" And Ord_vals1.Value Is Not Null );
ThickLiquid := first of (Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_DSD_Thickened" And Ord_vals1.Value Is Not Null );
GI := first of(Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_DSD_GI" And Ord_vals1.Value Is Not Null );
Other := first of(Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_DSD_Other" And Ord_vals1.Value Is Not Null );
Finger := first of(Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_DSD_Finger Foods" And Ord_vals1.Value Is Not Null );
Sodium := first of (Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_DSD__Sodium" And Ord_vals1.Value Is Not Null );
Pota := first of(Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_DSD_Potassium" And Ord_vals1.Value Is Not Null );
Protein := first of(Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_DSD_Protein" And Ord_vals1.Value Is Not Null );
MetalChina := first of(Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_MT_LO_No Metal/China" And Ord_vals1.Value Is Not Null );
Seclusion := first of(Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_MT_LO_Seclusion Tray" And Ord_vals1.Value Is Not Null );
Fluid := first of(Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_DSD_Fluid Restrictions" And Ord_vals1.Value Is Not Null );
Summary := first of(Ord_vals1.Value where Ord_vals1.Obs_name = "DIET_Summary Line Verbiage" And Ord_vals1.Value Is Not Null );
If Common is Not Null Then F_Common.Value := Common ; Else F_Common.Value :="" ; Endif;
If Special is Not Null Then F_Special.Value := Special ; Else F_Special.Value :="" ; Endif;
If Cal is Not Null Then F_Cal.Value := Cal ; Else F_Cal.Value :="" ; Endif;
If Consi is Not Null Then F_Consi.Value := Consi ; Else F_Consi.Value :="" ; Endif;
If Liquid is Not Null Then F_Liquid.Value := Liquid ; Else F_Liquid.Value :="" ; Endif;
If ThickLiquid is Not Null Then F_ThickLiquid.Value := ThickLiquid ; Else F_ThickLiquid.Value :="" ; Endif;
If GI is Not Null Then F_GI.Value := GI ; Else F_GI.Value :="" ; Endif;
If Other is Not Null Then F_Other.Value := Other ; Else F_Other.Value :="" ; Endif;
If Finger is Not Null Then F_Finger.Value := Finger ; Elseif F_FingerDiet.Value = "Finger Foods" Then Void:=Void ; Else F_Finger.Value :="" ; Endif; // for Finger Section
If Sodium is Not Null Then F_Sodium.Value := Sodium ; Else F_Sodium.Value :="" ; Endif;
If Pota is Not Null Then F_Pota.Value := Pota ; Else F_Pota.Value :="" ; Endif;
If Protein is Not Null Then F_Protein.Value := Protein ; Else F_Protein.Value :="" ; Endif;
If Fluid is Not Null Then F_Fluid.Value := Fluid ; Else F_Fluid.Value :="" ; Endif;
If Summary is Not Null Then F_Summary.Value := Summary ; Else F_Summary.Value :="" ; Endif;
If Sp_Inst is Not Null Then F_SpecialInst.Value := Sp_Inst ; Else F_SpecialInst.Value :="" ; Endif;
If MetalChina = "1" Then
F_MetalChina.Value := True ;
F_Seclusion.Value := False ;
Elseif Seclusion = "1" Then
F_Seclusion.Value := true ;
F_MetalChina.Value := False ;
Endif;
if F_Seclusion.Value = True Then F_FingerDiet.Value := "Finger Foods" ; Else F_FingerDiet.Value :=""; Endif;
Endif;
Endif;
//---------------------------- Change in field Change Event -----------------------------------------------
If CallingEvent ="FieldChange" Then
If this_communication.CallingFieldLabel = "Seclusion Tray" Then
If F_Seclusion.Value = true Then
F_MetalChina.Value := False;
F_FingerDiet.Value := "Finger Foods" ;
ElseIF F_Seclusion.Value = False Then
//F_MetalChina.Value := True;
F_FingerDiet.Value:= Null ;
EndIf ;
Elseif this_communication.CallingFieldLabel = "No Metal/China" Then
if F_MetalChina.Value = true Then
F_Seclusion.Value := False;
F_FingerDiet.Value:= Null ;
Elseif F_MetalChina.Value = False And F_Seclusion.Value = True Then
F_Seclusion.Value := True;
F_FingerDiet.Value := "Finger Foods" ;
Endif;
Endif ;
// Code for [Seclusion Tray Check Box ] and [Finger food] Value Selection
If F_Seclusion.Value = true Then
F_FingerDiet.Value := "Finger Foods" ;
Elseif F_Seclusion.Value = false
//And F_MetalChina.Control_Read_Only = False
And F_MetalChina.Value = False Then
If F_FingerDiet.Value = "Finger Foods" Then
F_FingerDiet.Value:= Null ;
Endif;
Endif;
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:

View File

@@ -0,0 +1,162 @@
maintenance:
title: Change Supplement Form Per Frequency Changes;;
mlmname: FORM_Diet_Supplement_Freq;;
arden: version 2;;
version: 4.50;;
institution: St Clair Diet MLM;;
author: Robert Spence, Eclipsys Corp;;
specialist: ;;
date: 2006-03-31;;
validation: testing;;
library:
purpose: This MLM sets the field PRN Reason text to visible and mandatory if IsPRN true.
;;
explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and
Communications objects and compares it to Client Information to determine whether to display
certain fields and make them mandatory.
A Banner message is presented to the user to remind them that these fields must be
completed.
If the patient data does not meet the above conditions the fields are not visible on
the form.
The MLM is not run from a trigger event, but rather is called by the application.
It should be configured to run on Form Open.
;;
keywords: Called MLMs, Form fields, PRN, PRN Reason text
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent :=this_communication.CallingEvent;
// This sets the visible control on the field dataitem - FrequencyCode
UDFreq_field := first of (field_list
where field_list.DataItemName = "DIET_Supplement Frequency" );
Freq_field := first of (field_list
where field_list.DataItemName = "FrequencyCode" );
Freq_value := freq_field.value;
Freq_summary := freq_value.frequencysummary;
//In_Frequency_field := first of (field_list
//where field_list.DataItemName = "FrequencyCode" );
Breakfast_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_1_Breakfast" );
MidMorning_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_2_Mid Morning" );
Lunch_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_3_Lunch" );
MidAfternoon_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_4_Mid Afternoon" );
Dinner_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_5_Dinner" );
BeforeBed_field := last of (field_list
where field_list.DataItemName = "DIET_SSP_LO_6_Before Bed" );
/*If exists(In_Frequency_field)
then
Freq:=In_Frequency_field.value.frequencysummary;
endif;
this_communication.DisplayForm := "Yes";
this_communication.Message := "Freq defined as: "|| Freq_summary
|| "\n" || "Calling field is : " || CallingField;
this_communication.MessageType := "Error";*/
If CallingEvent="FieldChange"
then
If ((CallingField="FrequencyCode") or (CallingField="DIET_Supplement Frequency"))
then
If Freq_summary = "Daily" OR UDFreq_field.value = "Daily"
then
Breakfast_field.Value :=FALSE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=TRUE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=FALSE;
BeforeBed_field.Value :=FALSE;
elseif (Freq_summary = "BID" OR UDFreq_field.value = "BID")
then
Breakfast_field.Value :=FALSE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=TRUE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=TRUE;
BeforeBed_field.Value :=FALSE;
elseif (Freq_summary = "TID" OR UDFreq_field.value = "TID")
then
Breakfast_field.Value :=TRUE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=TRUE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=TRUE;
BeforeBed_field.Value :=FALSE;
elseif (Freq_summary = "QID" OR UDFreq_field.value = "QID")
then
Breakfast_field.Value :=TRUE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=TRUE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=TRUE;
BeforeBed_field.Value :=TRUE;
else
Breakfast_field.Value :=FALSE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=FALSE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=FALSE;
BeforeBed_field.Value :=FALSE;
endif;
ENDIF;
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:

View File

@@ -0,0 +1,229 @@
maintenance:
title: Change Supplement Form Per Required Fields And Frequency Checks;;
mlmname: FORM_Diet_Supplement_Req;;
arden: version 2;;
version: 4.50;;
institution: St Clair Diet MLM;;
author: Robert Spence, Eclipsys Corp;;
specialist: ;;
date: 2006-03-31;;
validation: testing;;
library:
purpose: This MLM checks the frequency valuse and 2 other required supplements
;;
explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and
Communications objects and compares it to Client Information to determine whether to display
certain fields and make them mandatory.
A Banner message is presented to the user to remind them that these fields must be
completed.
If the patient data does not meet the above conditions the fields are not visible on
the form.
The MLM is not run from a trigger event, but rather is called by the application.
Change History:
03/13/2007 RS Changed to disable buttons on field change of 3 supplement choices
03/21/2012 TS/MJP Orders Rec Project 26841: DataItemName used for frequency value
and summary changed to Frequencycode to correct frequency translation
on Post Hospital Care Orders. Logic for UDDI Frequency Field included
in logic to allow MLM to work with either field during turnover period
of 4 hours for MLM to be recached. This field can be removed from the
MLM and the call for the MLM on field change can be removed from this
field on the form for any subsequent changes to this MLM.
;;
keywords: Called MLMs, Form fields, Frequency, Supplements
;;
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";
// 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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent :=this_communication.CallingEvent;
// This sets the visible control on the field dataitem - FrequencyCode
Supplement_field := first of (field_list
where field_list.DataItemName = "DIET_DSS_Supplement" );
Specific_field := first of (field_list
where field_list.DataItemName = "DIET_DSS_Supplement Flavors" );
PerPatient_field := first of (field_list
where field_list.DataItemName = "DIET_Supplements per Patient" );
Note_field := first of (field_list
where field_list.DataItemName = "DIET_Supplement Flavor Note" );
//Initial value
NoteValue:="Supplement flavors will be varied. If you prefer specific flavors, they must be selected specifically.";
UDFreq_field := first of (field_list
where field_list.DataItemName = "DIET_Supplement Frequency" );
Freq_field := first of (field_list
where field_list.DataItemName = "FrequencyCode" );
Freq_value := freq_field.value;
Freq_summary := freq_value.frequencysummary;
Breakfast_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_1_Breakfast" );
MidMorning_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_2_Mid Morning" );
Lunch_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_3_Lunch" );
MidAfternoon_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_4_Mid Afternoon" );
Dinner_field := first of (field_list
where field_list.DataItemName = "DIET_SSP_LO_5_Dinner" );
BeforeBed_field := last of (field_list
where field_list.DataItemName = "DIET_SSP_LO_6_Before Bed" );
If CallingEvent="FieldChange"
then
If ((CallingField="FrequencyCode") or (CallingField="DIET_Supplement Frequency"))
then
If Freq_summary = "Daily" OR UDFreq_field.value = "Daily"
then
Breakfast_field.Value :=FALSE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=TRUE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=FALSE;
BeforeBed_field.Value :=FALSE;
elseif (Freq_summary = "BID" OR UDFreq_field.value = "BID")
then
Breakfast_field.Value :=FALSE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=TRUE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=TRUE;
BeforeBed_field.Value :=FALSE;
elseif (Freq_summary = "TID" OR UDFreq_field.value = "TID")
then
Breakfast_field.Value :=TRUE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=TRUE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=TRUE;
BeforeBed_field.Value :=FALSE;
elseif (Freq_summary = "QID" OR UDFreq_field.value = "QID")
then
Breakfast_field.Value :=TRUE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=TRUE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=TRUE;
BeforeBed_field.Value :=TRUE;
else
Breakfast_field.Value :=FALSE;
MidMorning_field.Value :=FALSE;
Lunch_field.Value :=FALSE;
MidAfternoon_field.Value :=FALSE;
Dinner_field.Value :=FALSE;
BeforeBed_field.Value :=FALSE;
endif;
elseif (CallingField =("DIET_DSS_Supplement"))
then
If (Supplement_field.Value Is Not Null)
Then
Specific_field.value :="";
Specific_field.control_read_only :=True;
PerPatient_field.value :=False;
PerPatient_field.control_read_only :=True;
Note_Field.Value :="By selecting a Supplement, you are not able to select a Specific Flavor or Patient{{{SINGLE-QUOTE}}}s Choice";
else
Specific_field.control_read_only :=False;
PerPatient_field.control_read_only :=False;
Note_Field.Value :=NoteValue;
endif;
elseif (CallingField =("DIET_DSS_Supplement Flavors"))
then
If (Specific_field.value Is Not Null)
Then
Supplement_field.value :="";
Supplement_field.control_read_only :=True;
PerPatient_field.value :=False;
PerPatient_field.control_read_only :=True;
Note_Field.Value :="By selecting a Specific Flavor, you are not able to select Supplement or Patient{{{SINGLE-QUOTE}}}s Choice";
else
Supplement_field.control_read_only :=False;
PerPatient_field.control_read_only :=False;
Note_Field.Value :=NoteValue;
endif;
elseif (CallingField = "DIET_Supplements per Patient")
then
If PerPatient_Field.Value = TRUE
Then
Supplement_field.value :="";
Supplement_field.control_read_only :=True;
Specific_field.value :="";
Specific_field.control_read_only :=True;
Note_Field.Value :="By selecting Patient{{{SINGLE-QUOTE}}}s Choice, you are not able to select a Supplement or a Specific Flavor";
else
Supplement_field.control_read_only :=False;
Specific_field.control_read_only :=False;
Note_Field.Value :=NoteValue;
endif;
endif;
elseif (CallingEvent ="FormClose")
then
if (PerPatient_Field.Value = False) and (Supplement_field.Value Is Null) and (Specific_field.value Is Null)
then
this_communication.DisplayForm := "Yes";
this_communication.Message := "You must select at least one Supplement";
this_communication.MessageType := "Error";
// Supplement_field.value :=Supplement_field.value;
endif;
endif;
// this_communication.DisplayForm := "Yes";
// this_communication.Message := "The Frequency is: " || In_Frequency_field || "\n" || "Freq defined as: "|| Freq
// || "\n" || "Calling event is: " || CallingEvent
// || "\n" || "Calling field is : " || CallingField;
// this_communication.MessageType := "Informational";
;;
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:

View File

@@ -0,0 +1,216 @@
maintenance:
title: St.Clair: Promod selection on tube feeds;;
mlmname: FORM_Diet_TubeFeed_Promod;;
arden: version 2;;
version: 4.50;;
institution: St Clair;;
author: Don Warnick, Eclipsys Corp;;
specialist: ;;
date: 2006-08-23;;
validation: testing;;
library:
purpose: Value the DIET_DSS_Supplement with Promod if the Promod Check Box is selected.
;;
explanation: This MLM is called from two forms, the DIET_TubeFeed.
It values the DIET_DSS_Supplement with Protein Powder if the Add Protien Powder Check Box is checked.
It values the DIET_DSS_Supplement with blanks if the Add Protien Powder Check Box is unchecked.
Change history
09.08.2009 JM Changes made to make the Prosource Frequency mandatory if Add Prosource Liquid Protein is selected.
09.08.2009 JM Also, added requirement that two fields be mandatory if Selectable Add Banana Flakes is checked.
09.09.2011 MJP Changed supplement field value from Prosource Liquid Protein to LiquaCel Liquid Protein Vary.
09.02.2014 DW CSR# 32365 - Additional fields become mandatory when continuous schedule is selected
04.26.2016 DW CSR# 34212 - Dietitian May Modify button selection
;;
keywords: Called MLMs, Form fields, Protein Powder
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField :=this_communication.CallingFieldName;
// Value the Diet_DSS_Supplement field based upon the status of the Protein Powder Check Box
Supplement_Field := last of (field_list where field_list.DataItemName = "DIET_DSS_Protein" );
AddPromod_Field := last of (field_list where field_list.DataItemName = "DIET_Add Promod" );
scoops := last of (field_list where field_list.DataItemName = "DIET_TUBE_VL_scoops_# Scoops" );
ProFreq := last of (field_list where field_list.DataItemName = "DIET_Add Protein Frequency"); //23047
Banana_Field := last of (field_list where field_list.DataItemName = "DIET_DSS_Banana"); //23047
BFlakes_Field := last of (field_list where field_list.DataItemName = "DIET_Banana Flakes"); //23047
Flakes := (field_list where field_list.DataItemName = "DIET_#Packets_Banana Flakes"); //23047
BFFreq := (field_list where field_list.DataItemName = "DIET_Add Banana Frequency"); //23047
schedule := last of (field_list where field_list.DataItemName = "DIET_Tube Feed Schedule" );
amount := last of (field_list where field_list.DataItemName = "DIET_TUBE_VL_cc_AMOUNT" );
frequency:= last of (field_list where field_list.DataItemName = "DIET_TUBE_VO_Frequency" );
flowstart := last of (field_list where field_list.DataItemName = "DIET_TUBE_VL_mL/hr Start Rate" );
flowgoal := last of (field_list where field_list.DataItemName = "DIET_TUBE_VL_mL/hr Goal Rate" );
feedadv := last of (field_list where field_list.DataItemName = "DIET_Tube Feed Advance" );
feedadvfreq:= last of (field_list where field_list.DataItemName = "DIET_Tube Feed Adv Freq" );
Dietitian_May_Modify_SummaryLine:= last of (field_list where field_list.DataItemName = "DIET_May Not Modify" );
Dietitian_May_Modify_Selection := last of (field_list where field_list.DataItemName = "DIET_May Modify" );
// FIELD CHANGE
if (CallingEvent = "FieldChange") then
// If the "Dietitian May Modfiy" button is de-selected, select the special instructions box "Not to be modified by dietitian"
If CallingField="DIET_May Modify" then
If Dietitian_May_Modify_Selection.Value = true
then
Dietitian_May_Modify_SummaryLine.Value := false;
endif;
If Dietitian_May_Modify_Selection.Value = false
then
Dietitian_May_Modify_SummaryLine.Value := true;
endif;
endif;
endif; // Field Change
// FORM CLOSE
If CallingEvent = "FormCLose"
then
If schedule.value = "Continuous" and flowstart.value is null and flowgoal.value is null
then
this_communication.Message := " Flow Rate Required "; this_communication.MessageType := "Informational";
endif;
else
If AddPromod_Field.value = true
then
Supplement_Field.value := "LiquaCel Liquid Protein Vary";
scoops.control_mandatory:= true;
scoops.control_read_only:=false;
ProFreq.control_mandatory:= true;
ProFreq.control_read_only:=false;
else
Supplement_Field.value := "";
scoops.control_mandatory:= false;
scoops.control_read_only:=true;
ProFreq.control_mandatory:= false;
ProFreq.control_read_only:=true;
scoops.value := "";
ProFreq.value := "";
endif;
If BFlakes_Field.value = true
then
Banana_Field.value := "Banana Flakes";
Flakes.control_mandatory:= true;
Flakes.control_read_only:=false;
BFFreq.control_mandatory:= true;
BFFreq.control_read_only:=false;
else
Banana_Field.value := "";
Flakes.control_mandatory:= false;
Flakes.control_read_only:=true;
BFFreq.control_mandatory:= false;
BFFreq.control_read_only:=true;
Flakes.value := "";
BFFreq.value := "";
endif;
If schedule.value = "Continuous"
then
// flowstart.control_mandatory:=true;
flowstart.control_read_only:=false;
// flowgoal.control_mandatory:=true;
flowgoal.control_read_only:=false;
// feedadv.control_mandatory:=true;
feedadv.control_read_only:=false;
// feedadvfreq.control_mandatory:=true;
feedadvfreq.control_read_only:=false;
amount.control_mandatory:=false;
amount.control_read_only:=true;
amount.value := "";
frequency.control_mandatory:=false;
frequency.control_read_only:=true;
frequency.value := "";
elseif schedule.value="Intermittent"
then
amount.control_mandatory:=true;
amount.control_read_only:=false;
frequency.control_mandatory:=true;
frequency.control_read_only:=false;
flowstart.control_mandatory:=false;
flowstart.control_read_only:=true;
flowstart.value := "";
flowgoal.control_mandatory:=false;
flowgoal.control_read_only:=true;
flowgoal.value := "";
feedadv.control_mandatory:=false;
feedadv.control_read_only:=true;
feedadv.value := "";
feedadvfreq.control_mandatory:=false;
feedadvfreq.control_read_only:=true;
feedadvfreq.value := "";
endif;
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:

View File

@@ -0,0 +1,77 @@
maintenance:
title: Form Diluent based on selected Dose;;
mlmname: FORM_DILUENT_FROM_DOSE;;
arden: version 2;;
version: 5.00;;
institution: St.Clair;;
author: Ankit Mistry;;
specialist: Ankit Mistry;;
date: 2017-08-16;;
validation: testing;;
library:
purpose: Used to set Dilunt Data based on Entered Dose
If Then
DosageLow >= 1 and DosageLow < 501 BaseSolution.Name = 0.9% NaCl 100ml . BaseSolution.Dose = 100 BaseSolution.UOM = mL
DosageLow >= 501 and DosageLow < 1700 BaseSolution.Name = 0.9% NaCl 250ml . BaseSolution.Dose = 250 BaseSolution.UOM = mL
DosageLow >= 1700 BaseSolution.Name = 0.9% NaCl 500ml . BaseSolution.Dose = 500 BaseSolution.UOM = mL
;;
explanation: This MLM was developed to Auto Populate Dilunt Data based on Entered Dose.
Change history
08-07-2017 AMistry - New MLM Created.
;;
keywords:
;;
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;
field_list:= this_form.fields;
zz := field_list.Records__;
zzz := this_communication.PrimaryObj.Records__;
Dosage_Obj := FIRST OF ( field_list WHERE field_list.DataItemName = "DosageLow" );
DosageValue := Dosage_Obj.Value AS NUMBER;
BaseSolution_Obj := FIRST OF ( field_list WHERE field_list.DataItemName = "BaseSolution" );
BaseSolutionValue := BaseSolution_Obj.Value;
If DosageValue >= 1 AND DosageValue < 501 then
BaseSolutionValue.Name := "0.9% NaCl 100ml .";
BaseSolutionValue.Dose := "100";
BaseSolutionValue.uom := "mL";
ElseIf DosageValue >= 501 AND DosageValue < 1700 then
BaseSolutionValue.Name := "0.9% NaCl 250ml .";
BaseSolutionValue.Dose := "250";
BaseSolutionValue.uom := "mL";
ElseIf DosageValue >= 1700 then
//BaseSolutionValue.Name := "0.9% NaCl 500ml .";
BaseSolutionValue.Name := "0.9% NaCl 500ml";
BaseSolutionValue.Dose := "500";
BaseSolutionValue.uom := "mL";
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:

View File

@@ -0,0 +1,327 @@
maintenance:
title: St.Clair Direct info to AdminInstructions;;
mlmname: FORM_Direct_Info_to_AdminInstructions;;
arden: version 2;;
version: 4.50;;
institution: St Clair Hospital;;
author: Claudia Benson, Claudia.Benson@stclair.org, (412) 942-1307;;
specialist: Eclipsys Corporation;;
date: 2006-10-11;;
validation: testing;;
library:
purpose: To add selected meds to the Comments field
;;
explanation: This generic MLM can be called from several order forms:
- RESP SA IPPB
- RESP Contin Bronch
- RESP Med-Artif Airwy
- RESP Spont Aerosol
- (others?)
If a particular form is used, specified in the configuration list below, then other
field labels and values, also in the list, will be made appended to the Administration
Instructions.
Change History
03.27.2007 DW Added to Atrovent 0.25 list of meds that are added to Admin Instructions field
05.22.2008 DW Added RESP_Arformoterol 15mcg to list of meds that are added to Admin Instructions field
05.28.2008 DW Added Arfomoterol, Racepinephrine, and Pulmocort 1 mg to the Administration Instructions
08.27.2008 RS Added logic to summarize data to the field MLM_Manual Rep Forms for Resp Page instructions
02.21.2013 TMS Added logic to clear stop after field for one time and STAT frequencies. CSR 26557
01.14.2015 TMS Added new form map for "RESP Spont Aerosol" CSR 32176
09.26.2016 JML CSR 33723: Changed all wording references from {{{SINGLE-QUOTE}}}Xopenex{{{SINGLE-QUOTE}}} to {{{SINGLE-QUOTE}}}Levalbuterol{{{SINGLE-QUOTE}}}
04.07.2017 JML CSR 34699: Added new Levalbuterol data items to Continuous Bronchodilator OS
Rules:
Trigger on formopen or fieldchange.
Use list of
forms,
delimiter to be used between appended values,
fields to append to the Admin Instructions.
This MLM calls 2 other MLMs:
UTIL_STRING_PARSE: A utility for parsing the config list of forms and fields.
FORM_GENERIC_Display: A form-called MLM for displaying other, dependent fields.
;;
keywords: Called MLMs, Form fields, Respiratory Meds
;;
knowledge:
type: data-driven;;
data:
/***********************Make Changes To Spelling And Flags In This Section***********************/
//NOTE: THE RELATIVE ORDER OF ITEMS MUST BE MAINTAINED WITHIN LISTS!!!
//MUST HAVE THE FOLLOWING ORDER FOR EACH ELEMENT ITEM:
//"FORM_NAME|DELIMITER|FIELDS_TO_APPEND_TO_ADMIN_INSTRUCTIONS"
form_map_list :=
("RESP SA IPPB|:|RESP_Albuterol 2.5mg/3ml NSS,RESP_Arformoterol 15mcg,RESP_Albuterol 1.25mg/3ml NSS,"||
"RESP_Albuterol Dose,RESP_Alupent 0.2mg/2.5ml NSS,RESP_Alupent 0.3mg/2.5ml NSS,"||
"RESP_Atrovent 0.25 mg/3 ml NSS,RESP_Atrovent 0.5mg/3ml NSS,RESP_Atrovent Dose,RESP_Lidocaine Volume,"||
"RESP_Mucomyst volume,RESP_Mucomyst %,RESP_NSS 2.5cc,RESP_NSS 3cc,RESP NSS amount,RESP_Pentamidine 600mg,"||
"RESP_Pentamidine Dose,RESP_Pulmicort 0.5mg,RESP_Pulmicort 1mg,"||
"RESP_Racepinephrine 0.5ml (Vaponephrine),RESP_Xopenex,RESP_Xopenex 0.63mg/3ml NSS,"||
//(20070110) Change requested by Claudia Benson: remove "IsPRN,RESP_PRN" from admin instruc.
// "RESP_Xopenex 1.25mg/3ml NSS,IsPRN,RESP_PRN Reasons,UseWakingHourOnly"
"RESP_Xopenex 1.25mg/3ml NSS,UseWakingHourOnly"
//End of change (20070110)
,"RESP Contin Bronch|:|RESP_Albuterol 10mg/hr,RESP_Albuterol Dose- mg/hr,RESP_Albuterol 15mg/hr,"||
"RESP_Atrovent mg/hr,RESP_Atrovent 1 mg/hr,RESP_Xopenex 5 mg/hr,RESP_Xopenex 7.5mg/hr"
,"RESP Spont Aerosol|:|RESP_Albuterol 2.5mg/3ml NSS,RESP_Arformoterol 15mcg,RESP_Albuterol 1.25mg/3ml NSS,"||
"RESP_Albuterol Dose,RESP_Alupent 0.2mg/2.5ml NSS,RESP_Alupent 0.3mg/2.5ml NSS,"||
"RESP_Atrovent 0.25 mg/3 ml NSS,RESP_Atrovent 0.5mg/3ml NSS,RESP_Atrovent Dose,RESP_Lidocaine Volume,"||
"RESP_Mucomyst volume,RESP_Mucomyst %,RESP_NSS 2.5cc,RESP_NSS 3cc,RESP NSS amount,RESP_Pentamidine 600mg,"||
"RESP_Pentamidine Dose,RESP_Pulmicort 0.5mg,RESP_Pulmicort 1mg,"||
"RESP_Racepinephrine 0.5ml (Vaponephrine),RESP_Xopenex,RESP_Xopenex 0.63mg/3ml NSS,"||
"RESP_Xopenex 1.25mg/3ml NSS,UseWakingHourOnly"
,"RESP Med-Artif Airwy|:|RESP_Mucomyst volume,RESP NSS amount,Resp Instruction_Lines5"
,"YOUR_FORM_NAME_HERE|YOUR_DELIM|APPEND_FIELD_1,APPEND_FIELD_2,APPEND_FIELD_3,...etc."
);
// data item name for Admin Instructions
admin_instr_din := "AdminInstructions";
OneTimeFreq := ("STAT", "ONCE");
/************************************************************************************************/
// 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;
//Initialize MLM pointers:
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
gen_dsply := mlm {{{SINGLE-QUOTE}}}FORM_GENERIC_Display{{{SINGLE-QUOTE}}};
// Display any realated fields first:
(this_communication, this_form) := call gen_dsply
with this_communication, this_form, client_info_obj;
// Initialize messages
error_message:="";
admin_instr_msg := "";
page_text_msg := "";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingForm := this_form.name;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
FrequencyCode := first of (field_list WHERE field_list.DataItemName="FrequencyCode") ;
FrequencyCode_value := FrequencyCode.value;
StopAfter := first of (field_list WHERE field_list.DataItemName="StopAfter" AND field_list.Label= "Stop After");
StopAfter_Value := StopAfter.Value;
if called_by_editor then
CallingForm := "RESP Med-Artif Airwy";
endif;
// remove Stop After value for one time frequencies
if ((CallingField = "StopAfter" or CallingEvent = "FormClose"))and FrequencyCode_value.FrequencySummary in OneTimeFreq then
StopAfter_Value.NUMBER := NULL;
StopAfter_Value.Option := "";
endif;
for i in 1 seqto count form_map_list do
// parse the form mapper:
form_element_list := call str_parse with form_map_list[i], "|";
test_form_name := form_element_list[1]; //Lookup form name from map list
// Test for proper form
if CallingForm = test_form_name then
//Find admin instruc field:
admin_instr := last of (field_list where field_list.DataItemName = admin_instr_din);
page_text := last of (field_list where field_list.DataItemName = "MLM_Manual Resp Forms");
if exists admin_instr then
admin_instr.value := admin_instr_msg;
page_text.value := page_text_msg;
page_del := "" ;
dlm := form_element_list[2]; //lookup delimeter
//Lookup appending fields, from map list
test_append_field_list := call str_parse with form_element_list[3], ",";
for k in 1 seqto count test_append_field_list do
// Test for proper field
test_append_field := test_append_field_list[k];
append_field := first of
(field_list where field_list.DataItemName = test_append_field);
if exists append_field and (append_field.value is not null
and append_field.value <> FALSE) then
// Add selected meds to the Special Instructions field
admin_instr.value := admin_instr.value || append_field.label;
If append_field.label matches pattern "Albuterol%"
then
If page_text.value matches pattern "Albuterol%"
then
DoNaught := True;
else
page_text.value := page_text.value || "Albuterol;";
endif;
elseif append_field.label matches pattern "%Atrovent%"
then
If page_text.value matches pattern "%Atrovent%"
then
DoNaught := True;
else
page_text.value := page_text.value || "Atrovent;";
endif;
elseif append_field.label matches pattern "%Alupent%"
then
If page_text.value matches pattern "%Alupent%"
then
DoNaught := True;
else
page_text.value := page_text.value || "Alupent;";
endif;
elseif append_field.label matches pattern "%Arformoterol%"
then
If page_text.value matches pattern "%Arformoterol%"
then
DoNaught := True;
else
page_text.value := page_text.value || "Arformoterol;";
endif;
elseif append_field.label matches pattern "%Alupent%"
then
If page_text.value matches pattern "%Alupent%"
then
DoNaught := True;
else
page_text.value := page_text.value || "Alupent;";
endif;
elseif append_field.label matches pattern "%Racepinephrine%"
then
If page_text.value matches pattern "%Racepinephrine%"
then
DoNaught := True;
else
page_text.value := page_text.value || "Racepinephrine;";
endif;
elseif append_field.label matches pattern "%Pulmicort%"
then
If page_text.value matches pattern "%Pulmicort%"
then
DoNaught := True;
else
page_text.value := page_text.value || "Pulmicort;";
endif;
elseif append_field.label matches pattern "%Pentamidine%"
then
If page_text.value matches pattern "%Pentamidine%"
then
DoNaught := True;
else
page_text.value := page_text.value || "Pentamidine;";
endif;
elseif append_field.label matches pattern "Levalbuterol%"
then
If page_text.value matches pattern "%Levalbuterol%"
then
DoNaught := True;
else
page_text.value := page_text.value || "Levalbuterol;";
endif;
elseif append_field.label matches pattern "%Lidocaine%"
then
If page_text.value matches pattern "%Lidocaine%"
then
DoNaught := True;
else
page_text.value := page_text.value || "Lidocaine;";
endif;
elseif append_field.label matches pattern "%Mucomyst%"
then
If page_text.value matches pattern "%Mucomyst%"
then
DoNaught := True;
else
page_text.value := page_text.value || "Mucomyst;";
endif;
elseif append_field.label matches pattern "%NSS%"
then
If page_text.value matches pattern "%NSS%"
then
DoNaught := True;
else
page_text.value := page_text.value || "NSS;";
endif;
endif;
if append_field.datatype <> "checkbox" then
if append_field.dataitemname = "RESP_PRN Reasons" then
admin_instr.value := admin_instr.value || " - " || append_field.value;
else
admin_instr.value := admin_instr.value || " " || append_field.value;
endif;
endif; // append_field.datatype <> "checkbox"
admin_instr.value := admin_instr.value || " " || dlm || " " ;
/*
// FOR DEBUGGING PURPOSES: display a message to the user
this_communication.Message :=
"callingform = "|| callingform
|| "\nCallingEvent = " || CallingEvent
|| "\ntest_form_name = " || test_form_name
|| "\ntest_field = " || test_field
|| "\ntest_append_field = " || test_append_field
|| "\nappend_field = " || append_field.dataitemname
|| "\nadmin_instr_din = " || admin_instr_din
|| "\nadmin_instr.value = " || admin_instr.value;
this_communication.MessageType := "Informational";
*/
endif; // exists append_field and ...
enddo; // for k in 1 seq to count test_manditory_field_list
endif; // exists admin_instr
endif; // CallingForm = test_form_name
enddo; // for i in 1 seqto count form_map_list
;;
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:

View File

@@ -0,0 +1,70 @@
maintenance:
title: Form_Discharge_Ins_Autoselect;;
mlmname: Form_Discharge_Ins_Autoselect;;
arden: version 2.5;;
version: 6.10;;
institution: SCH ;;
author: Deepty Singh;;
specialist: Shivprasad Jadhav ;;
date: 2014-12-23;;
validation: testing;;
library:
purpose: To AutoSelect all items of "DISC_Call doctor if" dataitem, if "all of the above" is selected and vice - versa
;;
explanation:
;;
keywords:
;;
citations:
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CT_Call_doc := last of ( field_list WHERE field_list.DataItemName = "DISC_Call doctor if");
CT_Call_doc_Value := CT_Call_doc.Value;
IF CT_Call_doc_Value matches pattern "%all of the above%" then
CT_Call_doc_Value := "any problems";
CT_Call_doc_Value := "all of the above";
CT_Call_doc.Value := "any problems; any questions about your wound; fever of 101.5 degrees; wound opens, swells, becomes red, or increased drainage; you develop a fever; you have fever, chills, diarrhea, increased pain or unrelieved pain; you observe any increase in redness around the wound site; nausea, vomiting, bleeding, increased abdominal pain, fever over 101.5, wound opens, swells, or increased drainage; All of the above";
//CT_Call_doc.Value := "All of the above; nausea, vomiting, bleeding, increased abdominal pain, fever over 101.5, wound opens, swells, or increased drainage; you observe any increase in redness around the wound site; you have fever, chills, diarrhea, increased pain or unrelieved pain; you develop a fever; wound opens, swells, becomes red, or increased drainage; fever of 101.5 degrees; any questions about your wound; any problems";
ENDIF;
IF CT_Call_doc.Value = "any problems; any questions about your wound; fever of 101.5 degrees; wound opens, swells, becomes red, or increased drainage; you develop a fever; you have fever, chills, diarrhea, increased pain or unrelieved pain; you observe any increase in redness around the wound site; nausea, vomiting, bleeding, increased abdominal pain, fever over 101.5, wound opens, swells, or increased drainage" THEN
CT_Call_doc.Value := null;
ENDIF;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action:
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,92 @@
maintenance:
title: Form_Discharge_Ins_Close;;
mlmname: Form_Discharge_Ins_Close;;
arden: version 2.5;;
version: 6.10;;
institution: SCH ;;
author: Deepty Singh;;
specialist: Shivprasad Jadhav ;;
date: 2014-12-23;;
validation: testing;;
library:
purpose: To unselect "all of the above" from "DISC_Call doctor if" if all options are selected. We don{{{SINGLE-QUOTE}}}t need to show it on the Order Summary
;;
explanation:
;;
keywords:
;;
citations:
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CT_Call_doc := last of ( field_list WHERE field_list.DataItemName = "DISC_Call doctor if");
CT_Call_doc_Value := CT_Call_doc.Value;
IF CT_Call_doc_Value matches pattern "All of the above%" then
CT_Call_doc_Val := read last {"declare @all int, @above int, @len int " ||
" select @all = charindex ({{{SINGLE-QUOTE}}}ALL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}"||CT_Call_doc_Value|| "{{{SINGLE-QUOTE}}}) " ||
" select @above = charindex ({{{SINGLE-QUOTE}}}above{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}"||CT_Call_doc_Value|| "{{{SINGLE-QUOTE}}}) " ||
" select @len = len({{{SINGLE-QUOTE}}}"||CT_Call_doc_Value|| "{{{SINGLE-QUOTE}}}) " ||
" select right({{{SINGLE-QUOTE}}}"||CT_Call_doc_Value|| "{{{SINGLE-QUOTE}}},(@len-(@above+5)) )"};
CT_Call_doc.value := CT_Call_doc_Val;
ELSEIF CT_Call_doc_Value matches pattern "%All of the above" then
CT_Call_doc_Val := read last {"declare @all int, @above int, @len int " ||
" select @all = charindex ({{{SINGLE-QUOTE}}}ALL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}"||CT_Call_doc_Value|| "{{{SINGLE-QUOTE}}}) " ||
" select @above = charindex ({{{SINGLE-QUOTE}}}above{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}"||CT_Call_doc_Value|| "{{{SINGLE-QUOTE}}}) " ||
" select @len = len({{{SINGLE-QUOTE}}}"||CT_Call_doc_Value|| "{{{SINGLE-QUOTE}}}) " ||
" select left ({{{SINGLE-QUOTE}}}"||CT_Call_doc_Value|| "{{{SINGLE-QUOTE}}},(@all-3) ) "};
CT_Call_doc.value := CT_Call_doc_Val;
ELSEIF CT_Call_doc_Value matches pattern "%All of the above%" then
CT_Call_doc_Val := read last {"declare @all int, @above int, @len int " ||
" select @all = charindex ({{{SINGLE-QUOTE}}}ALL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}"||CT_Call_doc_Value|| "{{{SINGLE-QUOTE}}}) " ||
" select @above = charindex ({{{SINGLE-QUOTE}}}above{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}"||CT_Call_doc_Value|| "{{{SINGLE-QUOTE}}}) " ||
" select @len = len({{{SINGLE-QUOTE}}}"||CT_Call_doc_Value|| "{{{SINGLE-QUOTE}}}) " ||
" select left ({{{SINGLE-QUOTE}}}"||CT_Call_doc_Value|| "{{{SINGLE-QUOTE}}},(@all-3) ) "||
" + right({{{SINGLE-QUOTE}}}"||CT_Call_doc_Value|| "{{{SINGLE-QUOTE}}},(@len-(@above+5)) )"};
CT_Call_doc.value := CT_Call_doc_Val;
ENDIF;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action:
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,195 @@
maintenance:
title: FORM_DISCHARGE_ORDER_RESTRICT_ACTIVITY;;
mlmname: FORM_DISCHARGE_ORDER_RESTRICT_ACTIVITY;;
arden: version 2.5;;
version: 5.50;;
institution: St Clair Charger MLM;;
author: Juliet Johns, Allscripts, Inc;;
specialist: Amanda Kirsopp, Allscripts, Inc;;
date: 2013-04-04;;
validation: testing;;
library:
purpose: This MLM restricts the selection of mutually exclusive activities in the Activity on Discharge order.
;;
explanation: This MLM will not allow contradicting activities to be selected within the Activity on Discharge order.
For example, if the user selects "Drive with caution" under the Activity section, this MLM will
disable the "No driving" checkbox under the Activity Restricted section.
;;
keywords: Called MLMs, Form fields, Discharge Orders, Activity on Discharge
;;
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;
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//String Parsing Lib
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := FALSE;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormType := this_communication.FormType;
//Define activities List
discharge_activity_list := ("Drive with caution",
"May shower",
"May return to work",
"May resume sexual activity",
"Short walks are encouraged",
"May use steps");
discharge_restrict_list := ("No driving",
"May not shower",
"May not return to work",
"May not resume sexual activity",
"Limit walking",
"May not use steps");
//Retrieve relevant fields
Disch_Activity := last of (field_list WHERE field_list.DataItemName = "SCH_DI Activity Approved");
Disch_Restricted := last of (field_list WHERE field_list.DataItemName = "DISC_Activity Restricted");
Disch_Diet := last of (field_list WHERE field_list.DataItemName = "DISC_DIET");
if (CallingEvent = "FieldChange") then
if (CallingField = "SCH_DI Activity Approved" OR CallingField = "DISC_Activity Restricted") then
//Activities selected by user
activity_list := CALL str_parse WITH Disch_Activity.Value, ";";
//Restrictions selected by user
restrict_list := CALL str_parse WITH Disch_Restricted.Value, ";";
aa := "";
//Loop through restricted activities selected by the user
for i in 1 seqto (count restrict_list) do
//Check to see if a potential conflicting restriction was selected by the user
// based on the predefined list (above)
if (Trim(restrict_list[i]) NOT IN discharge_restrict_list) then
//Potential conflict was not selected
//Begin building Restricted Activity List
if (aa = "") then
aa := restrict_list[i];
else
aa := aa || ";" || restrict_list[i];
endif;
else
//Potential conflicting restriction was selected by user
//Retrieve index in discharge_restrict_list where potential conflict occurs
bool := true;
k := 1;
while bool = true do
if (discharge_restrict_list[k] = Trim(restrict_list[i])) then
bool := false;
contra_restrict_index := k;
else
k := k + 1;
endif;
enddo;
//Check for a match in the predefined conflicting activity list (above)
// and the activity list selected by user
// Needed to add a check for one item in activity list selected or multiple due to the need
// to trim extra spaces before and after conflicting activity to make a match
if (count activity_list = 1) then
if (Trim(discharge_activity_list[contra_restrict_index]) IN activity_list) then
displayMsg := true;
else
displayMsg := false;
endif;
else
if (Trim(discharge_activity_list[contra_restrict_index]) IN Trim(activity_list)) then
displayMsg := true;
else
displayMsg := false;
endif;
endif;
if (displayMsg) then
msg := "You selected contradicting activities, " || discharge_activity_list[contra_restrict_index]
|| ", and " || discharge_restrict_list[contra_restrict_index]
|| ". The restricted activity has been unselected."
|| " If you want the restriction, please unselect the activity.";
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg, "Info", "Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
else
//Conflict does not exist
//Build into restrictions value
if (aa = "") then
aa := restrict_list[i];
else
aa := aa || ";" || restrict_list[i];
endif;
endif;
endif;
enddo;
if (aa IS NULL OR aa = "") then
Disch_Restricted.Value := "";
else
Disch_Restricted.Value := aa;
endif;
elseif (CallingField = "DISC_DIET") then
diet_list := CALL str_parse WITH Disch_Diet.Value, ";";
bb := "";
for i in 1 seqto (count diet_list) do
if (count diet_list > 1) then
if (Trim(diet_list[i]) = "NPO") then
msg := "You selected contradicting diets with an NPO."
|| " The NPO diet has been unselected."
|| " If you want the NPO diet, please unselect all other diets.";
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg, "Info", "Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
else
if (bb = "") then
bb := diet_list[i];
else
bb := bb || ";" || diet_list[i];
endif;
endif;
else
bb := diet_list[i];
endif;
enddo;
Disch_Diet.Value := bb;
endif;
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:

View File

@@ -0,0 +1,143 @@
maintenance:
title: FORM_DISCHARGE_REPEAT_LAB_ORDERS;;
mlmname: FORM_DISCHARGE_REPEAT_LAB_ORDERS;;
arden: version 2.5;;
version: 5.50;;
institution: St Clair Charger MLM;;
author: Juliet Johns, Allscripts, Inc;;
specialist: Dean Miklavic, Allscripts, Inc;;
date: 2013-08-19;;
validation: testing;;
library:
purpose:
;;
explanation:
;;
keywords: Called MLMs, Form fields, Discharge Orders, Repeat Lab
;;
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;
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//String Parsing Lib
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
//Local session object
local_session := cds_session.local;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := FALSE;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormType := this_communication.FormType;
//Retrieve fields
Lab_Date_fld := last of (field_list WHERE field_list.DataItemName = "DISC_FU Labwork Date");
Lab_Test_List := last of (field_list WHERE field_list.DataItemName = "DISC_Lab Tests");
Labwork_Schd := last of (field_list WHERE field_list.DataItemName = "DISC_Lab Schedule");
Lab_Followup := last of (field_list WHERE field_list.DataItemName = "Obj_Plus_MD FollowUp2");
Repeat_Lab_Submit := last of (field_list WHERE field_list.DataItemName = "CPOE Repeat Lab Submit Button");
Addl_Instructions := last of (field_list WHERE field_list.DataItemName = "NUR_NurInstructionFreeText");
linebreakme:= read last
{" SELECT "
|| " {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} +char(13) + char(10) "
};
tabme := read last
{" SELECT "
|| " char(9) "
};
spaceme := " ";
If ((CallingEvent = "ButtonClick") AND (CallingField = "CPOE Repeat Lab Submit Button") OR (CallingEvent = "FormClose")) then
labs_ordered := call str_parse with Lab_Test_List.Value, ";";
if ( ( count labs_ordered ) > 0 ) then
if ( count ( labs_ordered ) = 1 ) then
labs_ordered := last of (labs_ordered);
endif;
if (Lab_Date_fld.Value is null) then
labwork_date := "";
else
labwork_date := "Next date of labwork: " || ( SUBSTRING 10 CHARACTERS FROM (Lab_Date_fld.Value AS String) );
endif;
if (Lab_Followup.Value is null) then
followup_with := "";
else
followup_with := "Follow up with " || Lab_Followup.Value;
endif;
if (Labwork_Schd.Value is null) then
lab_schd := "";
else
lab_schd := "Labwork schedule: " || Labwork_Schd.Value;
endif;
repeat_labs_list := spaceme || labwork_date || linebreakme
|| spaceme || labs_ordered || linebreakme
|| spaceme || lab_schd || linebreakme
|| spaceme || followup_with || linebreakme;
if (Addl_Instructions.Value is null) then
Addl_Instructions.Value := linebreakme || repeat_labs_list;
else
Addl_Instructions.Value := Addl_Instructions.Value || linebreakme || linebreakme || repeat_labs_list;
endif;
//Clear List
Lab_Date_fld.Value := null;
Labwork_Schd.Value := "";
Lab_Followup.Value := "";
Lab_Test_List.Value := "";
endif;
if (CallingEvent = "FormClose") then
local_session.SessionDischargeLabOrders := Addl_Instructions.Value;
endif;
elseif (CallingEvent = "FormOpen") then
if (local_session.SessionDischargeLabOrders <> "") then
local_session.SessionDischargeLabOrders := "";
endif;
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:

View File

@@ -0,0 +1,140 @@
maintenance:
title: FORM_DISCHARGE_REPEAT_MI_ORDERS;;
mlmname: FORM_DISCHARGE_REPEAT_MI_ORDERS;;
arden: version 2.5;;
version: 5.50;;
institution: St Clair Charger MLM;;
author: Juliet Johns, Allscripts, Inc;;
specialist: Dean Miklavic, Allscripts, Inc;;
date: 2013-08-19;;
validation: testing;;
library:
purpose:
;;
explanation:
;;
keywords: Called MLMs, Form fields, Discharge Orders, Repeat Lab
;;
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;
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//String Parsing Lib
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
//Local session object
local_session := cds_session.local;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := FALSE;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormType := this_communication.FormType;
//Retrieve fields
MI_Date_fld := last of (field_list WHERE field_list.DataItemName = "DISC_FU MI Date");
MI_Test_List := last of (field_list WHERE field_list.DataItemName = "DISC_Medical Image Tests");
MI_Followup := last of (field_list WHERE field_list.DataItemName = "DISC_Medical Image Folllow up");
Repeat_Lab_Submit := last of (field_list WHERE field_list.DataItemName = "CPOE Repeat Lab Submit Button");
Repeat_Instructions := last of (field_list WHERE field_list.DataItemName = "NUR_NurInstructionFreeText");
linebreakme:= read last
{" SELECT "
|| " {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} +char(13) + char(10) "
};
tabme := read last
{" SELECT "
|| " char(9) "
};
spaceme := " ";
If (((CallingEvent = "ButtonClick") AND (CallingField = "CPOE Repeat Lab Submit Button")) OR (CallingEvent = "FormClose")) then
labs_ordered := call str_parse with MI_Test_List.Value, ";";
if ( ( count labs_ordered ) > 0 ) then
if ( count ( labs_ordered ) = 1 ) then
labs_ordered := last of (labs_ordered);
endif;
if (MI_Date_fld.Value is null) then
labwork_date := "";
else
labwork_date := "Do test on: " || ( SUBSTRING 10 CHARACTERS FROM ( MI_Date_fld.Value AS STRING) );
endif;
if (MI_Followup.Value is null) then
followup_with := "";
else
followup_with := "Follow up in " || MI_Followup.Value;
endif;
//repeat_mi_list := spaceme || labs_ordered || labwork_date
// || linebreakme || spaceme || followup_with;
repeat_mi_list := spaceme || "Test(s): " || labs_ordered || linebreakme
|| spaceme || labwork_date || linebreakme
|| spaceme || followup_with;
if (Repeat_Instructions.Value is null) then
Repeat_Instructions.Value := "Medical Imaging & Other Tests - " || linebreakme || spaceme
|| "Date: " || ( SUBSTRING 10 CHARACTERS FROM ( now as string ) )
|| linebreakme || repeat_mi_list;
else
Repeat_Instructions.Value := Repeat_Instructions.Value || linebreakme || linebreakme || repeat_mi_list;
endif;
//Clear List
MI_Date_fld.Value := null;
MI_Followup.Value := "";
MI_Test_List.Value := "";
endif;
if (CallingEvent = "FormClose") then
local_session.SessionDischargeMIOrders := Repeat_Instructions.Value;
endif;
elseif (CallingEvent = "FormOpen") then
if (local_session.SessionDischargeMIOrders <> "") then
local_session.SessionDischargeMIOrders := "";
endif;
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:

View File

@@ -0,0 +1,96 @@
maintenance:
title: Form_Drotrecogin_calc;;
mlmname: Form_Drotrecogin_calc;;
arden: version 2;;
version: 4.50;;
institution: St. Clair Hospital;;
author: Teresa M. Spicuzza ;;
specialist: Eclipsys Corporation;;
date: 2006-11-28;;
validation: testing;;
library:
purpose: Caculate Drotrecogin rate based on weight. Present dose rounded to two
decimal points.
;;
explanation:
Dosing Weight in Kilograms * 0.24 =
Infusion rate (round to nearest 1000th)
If Dosing Weight in Kilograms is null alert user to
Enter a Calculation Weight on the Vital Sign Flowsheet before proceeding
;;
keywords:
Xigris, Infusion, Drotrecogin, weight;
;;
knowledge:
type: data-driven;;
data:
/********************Make Changes To Spelling And Flags In This Section*********************/
/*************************************************************************************************/
// 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;
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
comb_ht_wt_field := first of
(field_list where field_list.DataItemName = "CombinedMeasurements");
if exists comb_ht_wt_field then
comb_ht_wt_val := comb_ht_wt_field.value;
wt := comb_ht_wt_val.weight;
ht := comb_ht_wt_val.height;
wt_type := comb_ht_wt_val.weighttype;
bsa := comb_ht_wt_val.bsa;
bmi := comb_ht_wt_val.bmi;
endif;
if not exists wt then
comb_ht_wt_field.control_read_only := true;
this_communication.Message :=
"Please Enter a Calculation Weight on the Vital Sign Flowsheet "
|| "before proceeding."
;
this_communication.MessageType := "Error";
else
//Rate
rate := first of
(field_list where field_list.DataItemName = "OrderIVRate");
dose_rate := (wt as number) * 0.24;
if exists rate then
RateValue := Rate.Value;
RateValue.Amount := dose_rate formatted with "%.2f";
RateValue.RateUOM := "ml";
OrderIVRateValue.KVODisplayed := false;
OrderIVRateValue.IsKVO := false;
endif;
endif; // not exists wt
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns two parameters, of types
//communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,102 @@
maintenance:
title: FORM_ED_CT_ORDERS_TO_STAT;;
mlmname: FORM_ED_CT_ORDERS_TO_STAT;;
arden: version 2.5;;
version: 6.10;;
institution: St Clair Hospital;;
author: Juliet M. Law, Allscripts;;
specialist: Bryan Berkeybile, Allscripts;;
date: 2014-10-08;;
validation: testing;;
library:
purpose: This MLM triggers on all CT orders.
;;
explanation: Defaults all CT orders placed in the ED to STAT, when ordered by ED physician and not in a HOLD session.
Change History
----------------
10.08.2014 JML CSR# 32188 - Created
10.29.2014 JML Moved to Production
;;
keywords: Called MLMs, Form fields, ED, CT
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGuid;
chart_guid := this_communication.ChartGUID;
requesting_cp_guid := this_communication.CareProviderGUID;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormType := this_communication.FormType;
CT_Requested_Time := last of ( field_list WHERE field_list.DataItemName = "RequestedTime");
CT_ReqTime_Value := CT_Requested_Time.Value;
//Retrieve patients location
er_patient := read {"SELECT 1"
|| " FROM CV3Client c WITH (NOLOCK) JOIN CV3ClientVisit cv WITH (NOLOCK)"
|| " ON c.GUID = cv.ClientGUID"
|| " WHERE c.GUID = " || Sql(client_guid)
|| " AND cv.GUID = " || Sql(visit_guid)
|| " AND cv.ChartGUID = " || Sql(chart_guid)
|| " AND cv.CurrentLocation = {{{SINGLE-QUOTE}}}ER Major{{{SINGLE-QUOTE}}}"};
//Retrieve occupation of user entering order
user_role_type := this_communication.PrimaryObj.EnterRole;
//Retrieve order session
order_session_type := this_communication.PrimaryObj.InitialSessionTypeCode;
//If patient location = ED; occupation = ED Physician; order session <> {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}}, default CT to STAT
if ( exists er_patient ) then
if ( user_role_type = "ED Physician" ) then
if ( order_session_type <> "Hold" ) then
//Set frequence code to STAT
CT_ReqTime_Value.ReqTimeCode := "STAT";
endif;
endif;
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:

View File

@@ -0,0 +1,105 @@
maintenance:
title: FORM_ED_GO_PACK;;
mlmname: FORM_ED_GO_PACK;;
arden: version 2.5;;
version: 6.10;;
institution: St. Clair Hospital ;;
author: Shivprasad Jadhav;;
specialist: Shivprasad Jadhav, Allscripts;;
date: 2015-10-23;;
validation: testing;;
library:
purpose:
If user clicks on the HIV PEP Regimen checkbox, then include order details for Truvada and Isentress medications.
If check box is not selected then do not include order details for Truvada and Isentress medications.;;
explanation:
Change History
============================================
20-04-2015 CSR-33616 : Created
24-01-2019 CSR 37702: Added logic to support new HIV PEP Go Pack order for ED.
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
( this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
field_list:= this_form.Fields;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
F_HIV_PEP := last of ( field_list WHERE field_list.DataItemName = "ED_HIV PEP Regimen" );
F_Truvada := last of ( field_list WHERE field_list.DataItemName = "ED_Truvada" );
F_Isentress := last of ( field_list WHERE field_list.DataItemName = "ED_Isentress 400mg" );
F_HIV_PEP_2 := last of ( field_list WHERE field_list.DataItemName = "ED_HIV PEP Regimen (2)" );
F_Truvada_2 := last of ( field_list WHERE field_list.DataItemName = "ED_Truvada (2)" );
F_Isentress_2 := last of ( field_list WHERE field_list.DataItemName = "ED_Isentress 400mg (2)" );
Truvada_txt := "Truvada (Emtricitabine 200 mg/Tenofovir 300 mg Tab) (7 Tablets) Take 1 tablet by mouth daily for 7 days.";
Esentress_txt := "Isentress 400mg (Raltegravir 400mg Tab) (14 Tablets) Take 1 tablet by mouth two times a day for 7 days." ;
//=========================================================================================================
if ( CallingEvent = "FormOpen" ) then
If F_HIV_PEP.Value = True Then
F_Truvada.Value := Truvada_txt ;
F_Isentress.Value := Esentress_txt ;
Elseif F_HIV_PEP.Value = False Then
F_Truvada.Value := "" ;
F_Isentress.Value := "" ;
Endif;
if ( F_HIV_PEP_2.Value = true ) then
F_Truvada_2.Value := Truvada_txt ;
F_Isentress_2.Value := Esentress_txt ;
Elseif ( F_HIV_PEP_2.Value = false ) then
F_Truvada_2.Value := "" ;
F_Isentress_2.Value := "" ;
endif;
Elseif ( CallingEvent = "FieldChange" ) then
If F_HIV_PEP.Value = True Then
F_Truvada.Value := Truvada_txt ;
F_Isentress.Value := Esentress_txt ;
Elseif F_HIV_PEP.Value = False Then
F_Truvada.Value := "" ;
F_Isentress.Value := "" ;
Endif;
if ( F_HIV_PEP_2.Value = true ) then
F_Truvada_2.Value := Truvada_txt ;
F_Isentress_2.Value := Esentress_txt ;
Elseif ( F_HIV_PEP_2.Value = false ) then
F_Truvada_2.Value := "" ;
F_Isentress_2.Value := "" ;
endif;
Endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,84 @@
maintenance:
title: ED Respitory Page;;
mlmname: FORM_ED_Resp_Page;;
arden: version 2;;
version: 4.50;;
institution: St Clair Charger MLM;;
author: Robert Spence, Eclipsys Corp;;
specialist: ;;
date: 2008-03-07;;
validation: testing;;
library:
purpose: This MLM Fires On ED Resp Order being opened
;;
explanation: Simply retrieves the location from the status board.
;;
keywords: Called MLMs, Form fields, ED, Status Board
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
Visit_Guid := this_communication.ClientVisitGuid;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormType := this_communication.FormType;
// This sets the visible control on the field dataitem - CHG_OVERRIDE_WITH
EDLoc :=last of (field_list
where field_list.DataItemName = "ED Location" );
Temp := read last {"Select el.EDDisplayName "
|| " from sxaedlocation as el "
|| " join sxaedboard as eb "
|| " on eb.EdLocationguid = el.locationguid "
|| " and eb.clientvisitguid = " || SQL(Visit_Guid)
|| " and eb.active =1 "};
EDLoc.Value := Temp;
// this_communication.DisplayForm := "Yes";
// this_communication.Message := "ED Returned = " || Temp
// || "Visit_Guid = " || Visit_Guid;
// this_communication.MessageType := "Informational";
;;
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:

View File

@@ -0,0 +1,159 @@
maintenance:
title: FormClose MLM Coordinator for order Forms;;
filename: Form_FormClose_Coord;;
arden: version 2.5;;
version: 16.3;;
institution: Allscripts ;;
author: Allscripts ;;
specialist: Allscripts;;
date: 2013-03-27;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2016 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
*
* P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is "Commercial Computer Software".
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*
**/
/* P r o p r i e t a r y N o t i c e */
/*** 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 Clients 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 Clients 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 Clients 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 Clients acceptance of clinical responsibility for the use of such materials.*/
library:
purpose:
Coordinate calls to multiple MLMs on FormClose for orders.
;;
explanation:
This MLM receives the three unmodified objects as arguements from the system,
and then declares and calls multiple MLMs to implement actions required
on FormClose. The three argument objects are passed to each called MLM in
turn. Modified communication and form objects are returned by each called
MLM to this FormClose Coordinator MLM.
NOTES:
1. When sent to the next called MLM, the objects contain the changes made
by the previous MLM, so the sequence of calls may be important. Each
called MLM may need to be tested for the existence of processed or changed
fields to avoid failing on a nested call
2. The called MLMs must exist in the database and must be in the Editor{{{SINGLE-QUOTE}}}s
memory (at a minimum "Loaded" and the Syntax checked) before this MLM is
processed. If they are not the Editor will display an error stating
that "The module <module anme> could not be located."
3. This MLM is initially configured to call modified "form-called" MLMs
which have the prefix "FORM_" in the filenames. The prefix is not required
for called MLMs; any valid MLM name may be used.
;;
keywords: Called MLM; FormClose Event; Order;
;;
Knowledge:
type: data-driven;;
data:
/*-------------------------------------------*/
/* form-related objects received by this MLM */
/*-------------------------------------------*/
(comm_obj, // communication type object
form_obj, // form type object
client_info_obj // client info object
) := argument;
/*-----------------------------------------------*/
/* constants and values to be used in processing */
/*-----------------------------------------------*/
field_list := form_obj.fields;
form_name := form_obj.Name;
client_name := client_info_obj.DisplayName;
/*** = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ***/
/*** Declare MLMs that will be called from this one ***/
/*** Add others as neede, sequence may be important ***/
/*** = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ***/
FORM_ID_REPEATORDERS := MLM {{{SINGLE-QUOTE}}}FORM_ID_RepeatOrders{{{SINGLE-QUOTE}}};
FORM_ACS_SAME_DAY_ORDER_REPLACEMENT := MLM {{{SINGLE-QUOTE}}}FORM_ACS_SAME_DAY_ORDER_REPLACEMENT{{{SINGLE-QUOTE}}};
FORM_ACS_SAME_DAY_ORDER_REPLACEMENT_OS := MLM {{{SINGLE-QUOTE}}}FORM_ACS_SAME_DAY_ORDER_REPLACEMENT_OS{{{SINGLE-QUOTE}}};
FORM_SET_RX_MEDICATION_ORDER_MGT := MLM {{{SINGLE-QUOTE}}}FORM_SET_RX_MEDICATION_ORDER_MGT{{{SINGLE-QUOTE}}};
FORM_SET_CPOE_PED_COMMONDX_CHAIN := MLM {{{SINGLE-QUOTE}}}FORM_SET_CPOE_PED_COMMONDX_CHAIN{{{SINGLE-QUOTE}}};
FORM_SET_REPEAT_LAB_ORDERS := MLM {{{SINGLE-QUOTE}}}FORM_SET_REPEAT_LAB_ORDERS{{{SINGLE-QUOTE}}};
/***--- ADD OTHER CALLED MLM DEFINITIONS HERE ---***/
// func_new_called_mlm := MLM {{{SINGLE-QUOTE}}}Any_Valid_MLM_Name"; // note "FORM_" prefix is not needed
/*** = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ***/
/*** get new communication and form values with called MLMs ***/
/*** each subsequent MLM will get forms w. updated values ***/
/*** = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ***/
if(form_name is in ("LAB Chemistry IVDM", "LAB Hematology"))then
if(NOT comm_obj.PrimaryObj.CancelOrder)then
(comm_obj, form_obj, client_info_obj) := CALL FORM_ACS_SAME_DAY_ORDER_REPLACEMENT with comm_obj, form_obj, client_info_obj;
endif;
if(NOT comm_obj.PrimaryObj.CancelOrder)then
(comm_obj, form_obj, client_info_obj) := CALL FORM_ID_REPEATORDERS with comm_obj, form_obj, client_info_obj;
endif;
endif;
if(form_name is in ("CPOE Behav Health OS","CPOE Gastro OS","CPOE Nephrology OS","CPOE Neuro OS","CPOE Pulmonary OS.","CPOE Urology OS","CPOE_HMD_CommOrder"))then
(comm_obj, form_obj, client_info_obj) := CALL FORM_ACS_SAME_DAY_ORDER_REPLACEMENT_OS with comm_obj, form_obj, client_info_obj;
(comm_obj, form_obj, client_info_obj) := CALL FORM_SET_RX_MEDICATION_ORDER_MGT with comm_obj, form_obj, client_info_obj;
endif;
if(form_name is in (,"CPOE_GEN_CommDx"))then
(comm_obj, form_obj, client_info_obj) := CALL FORM_ACS_SAME_DAY_ORDER_REPLACEMENT_OS with comm_obj, form_obj, client_info_obj;
(comm_obj, form_obj, client_info_obj) := CALL FORM_SET_CPOE_PED_COMMONDX_CHAIN with comm_obj, form_obj, client_info_obj;
endif;
if(form_name is in (,"Lab STAT Order Set"))then //removed "ED Diag Order" - for OS Laboratory Orders Scheduled
(comm_obj, form_obj, client_info_obj) := CALL FORM_ACS_SAME_DAY_ORDER_REPLACEMENT_OS with comm_obj, form_obj, client_info_obj;
endif;
if(form_name is in ("Lab Common Order Set","Lab Com w Repeat OS"))then
(comm_obj, form_obj, client_info_obj) := CALL FORM_ACS_SAME_DAY_ORDER_REPLACEMENT_OS with comm_obj, form_obj, client_info_obj;
(comm_obj, form_obj, client_info_obj) := CALL FORM_SET_REPEAT_LAB_ORDERS with comm_obj, form_obj, client_info_obj;
endif;
/***--- ADD ANOTHER CALLED MLM DEFINITION HERE ---***/
/*
if(NOT comm_obj.PrimaryObj.CancelOrder)then
(comm_obj, form_obj) := CALL func_<see_above_definition> with comm_obj, form_obj, client_info_obj;
endif;
*/
;;
evoke:
// no evokin event for called MLM
;;
logic:
conclude true; // always, to return object values
;;
action:
//return communication and form objects
return comm_obj, form_obj;
;;
end:

View File

@@ -0,0 +1,397 @@
maintenance:
title: FORM_FUNC_ANTICOAGULANT_CHECK;;
mlmname: FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK;;
arden: version 2.5;;
version: 5.50;;
institution: St. Clair Hospital;;
author: Juliet M. Law, Allscripts, Inc. Ext. 7461;;
specialist: ;;
date: 2012-03-28;;
validation: testing;;
library:
purpose:
Called from any Form or Order Set MLM.
Used to check for existing or unsubmitted anticoagulant orders that conflict with current anticoagulant selection.
;;
explanation: This MLM was written to be called from Forms and Order Sets that require a check for an anticoagulant conflict.
Change History:
2012.03.28 JML Created
2012.05.09 JML Changed Lovenox duplicate med alert to soft stop
2012.05.16 JML Changed Heparin duplicate med alert to soft stop
2013.05.02 JML CSR #31334: Leapfrog changes; added alert support for
Fondaparinux (Arixtra), Argatroban, and Apixaban (Eliquis)
2014.01.22 JML CSR #31334: Adding conflict checks for Warfarin and Xarelto
to support ortho post op order sets.
2018.09.07 JML CSR 37062: Adding conflict check for Post Op Shoulder OS.
2018.11.16 JML CSR 37344/37345/37346: Added new DVT Anticoagulant Orders- Ortho Procedures order set; called from some
ortho post op order sets.
;;
keywords: anticoagulant, conflict, called mlm, func
;;
knowledge:
type: data-driven;;
data:
//Establish Communication, Form, ClientInfo objects
(this_communication,
this_form,
client_info_obj,
selectedMed) := argument;
//Include standard .Net libraries
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//Create local session object
local_session := cds_session.local;
//Define form values passed in through the Form and Communication Object
field_list := this_form.fields;
CallingField := this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
//Patient GUIDs
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGUID;
//Event values
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
//General variables to control logic flow
stop := false;
severity := "";
//Define anticoagulant medications that require conflict check
(anticoagulant_meds) := READ {"SELECT ocmi.Name"
|| " FROM CV3OrderCatalogMasterItem ocmi WITH (NOLOCK)"
|| " WHERE ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}coagulation modifiers | anticoagulants{{{SINGLE-QUOTE}}}"
|| " and ocmi.Name not like {{{SINGLE-QUOTE}}}zz%{{{SINGLE-QUOTE}}}"
|| " ORDER BY ocmi.Name"};
heparin_inj_meds := (anticoagulant_meds WHERE anticoagulant_meds IN ("Heparin Inj",
"Heparin Inj -",
"Heparin Inj-",
"Heparin Inj.") );
heparin_iv_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Heparin%25,000%"
OR anticoagulant_meds MATCHES PATTERN "Heparin Infusion%");
lovenox_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Enoxaparin%");
pradaxa_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Dabigatran%");
xarelto_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Rivaroxaban%");
warfarin_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Warfarin%");
arixtra_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Fondaparinux%");
argatroban_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Argatroban%");
apixaban_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Apixaban%");
//Check local session variable for unsubmitted orders
if (((count local_session.SessionUnsubmittedAnticoagulantOrders) as number) > 0) then
(existing_orders) := local_session.SessionUnsubmittedAnticoagulantOrders;
order_count := count (existing_orders) as number;
else
//Check for existing orders
(existing_orders) := read {"SELECT o.Name, o.TouchedWhen "
|| " FROM CV3Order o with (nolock) JOIN CV3OrderCatalogMasterItem ocmi with (nolock) "
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID "
|| " WHERE o.ClientGUID = " || Sql(client_guid)
|| " AND o.ClientVisitGUID = " || Sql(visit_guid)
|| " AND o.ChartGUID = " || Sql(chart_guid)
|| " AND (o.Name LIKE {{{SINGLE-QUOTE}}}Enoxaparin%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}Heparin%25,000%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}Heparin Inj%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}Dabigatran%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}Rivaroxaban%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}Warfarin%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}Fondaparinux%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}Argatroban%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}Apixaban%{{{SINGLE-QUOTE}}})"
|| " AND"
|| " ((o.OrderStatusLevelNum > 15"
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
, primaryTime = touchedWhen};
order_count := count (existing_orders) as number;
endif;
if (order_count > 0) then
//Patient has an existing (submitted or unsubmitted) anticoagulant medication order
//Iterate through each existing order and determine if there is a conflict
//Based on which new anticoagulant medication is selected on order set
for existingItem IN existing_orders do
if (selectedMed = "Heparin Inj" OR selectedMed matches pattern "%Heparin%" ) then
if ((existingItem IN lovenox_meds)
OR (existingItem IN pradaxa_meds)
OR (existingItem IN xarelto_meds)
OR (existingItem IN heparin_iv_meds)
OR (existingItem IN arixtra_meds)
OR (existingItem IN argatroban_meds)
OR (existingItem IN apixaban_meds)) then
//hard stop, no override
stop := true;
severity := "high";
stop_message := "Avoid concurrent use of " || selectedMed
|| " and " || existingItem
|| " due to increased bleeding risk.\n\nContact physician to adjust orders."
|| "\n\nYou MUST discontinue " || existingItem || " before " || selectedMed
|| " can be ordered.";
elseif (existingItem IN heparin_inj_meds) then
stop := true;
severity := "low";
stop_message := "Duplicate Medication Alert!\n\nThis patient already has an order for Heparin SQ."
|| " You MUST discontinue the previous Heparin SQ order before placing a new "
|| "Heparin SQ order, UNLESS the therapies will not be overlapping."
|| "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}."
|| "\n\nOtherwise, click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}.";
endif;
elseif (selectedMed matches pattern "Enoxaparin Inj%") then
if ((existingItem IN heparin_iv_meds)
OR (existingItem IN argatroban_meds)) then
//soft stop, priority low, must acknowledge
stop := true;
severity := "low";
stop_message := selectedMed || " and " || existingItem
|| " should not be used together due to increased bleeding risk except when transitioning from "
|| existingItem || " to " || selectedMed || "."
|| "\n\nIf your Patient is transitioning from " || existingItem || " to " || selectedMed
|| ", click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}"
|| "\n\nIf your Patient is NOT transitioning from " || existingItem || " to " || selectedMed
|| ", click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}";
elseif ((existingItem IN heparin_inj_meds)
OR (existingItem IN pradaxa_meds)
OR (existingItem IN xarelto_meds)
OR (existingItem IN arixtra_meds)
OR (existingItem IN apixaban_meds)) then
//hard stop, no override
stop := true;
severity := "high";
stop_message := "Avoid concurrent use of " || selectedMed || " and "
|| existingItem || " due to increased bleeding risk.\n\nContact physician to adjust orders."
|| "\n\nYou MUST discontinue " || existingItem || " before " || selectedMed
|| " can be ordered.";
elseif ((existingItem IN lovenox_meds)) then
stop := true;
severity := "low";
stop_message := "Duplicate Medication Alert!\n\nThis patient already has an order for Enoxaparin."
|| " You MUST discontinue the previous Enoxaparin order before placing a new "
|| "Enoxaparin order, UNLESS the therapies will not be overlapping."
|| "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}."
|| "\n\nOtherwise, click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}.";
endif;
elseif (selectedMed = "Fondaparinux Inj") then
if ((existingItem IN lovenox_meds)
OR (existingItem IN heparin_inj_meds)
OR (existingItem IN heparin_iv_meds)
OR (existingItem IN pradaxa_meds)
OR (existingItem IN xarelto_meds)
OR (existingItem IN apixaban_meds)) then
stop := true;
severity := "high";
stop_message := "Avoid concurrent use of " || selectedMed || " and "
|| existingItem || " due to increased bleeding risk.\n\nContact physician to adjust orders."
|| "\n\nYou MUST discontinue " || existingItem || " before " || selectedMed
|| " can be ordered.";
if (existingItem IN pradaxa_meds) then
stop_message := stop_message || "\n\n"
|| "If CrCl is greater than or equal to 30 ml/min, begin Arixtra"
|| " 12 hours after last Pradaxa dose."
|| "\n \n If CrCl is less than 30 ml/min, begin Arixtra"
|| " 24 hours after last Pradaxa dose.";
elseif (existingItem IN xarelto_meds) then
stop_message := stop_message || "\n\n"
|| "When switching from Xarelto to Arixtra"
|| ", discontinue Xarelto and give Arixtra"
|| " when the next Xarelto dose would have been due.";
endif;
elseif (existingItem IN argatroban_meds) then
stop := true;
severity := "low";
stop_message := selectedMed || " and " || existingItem
|| " should not be used together due to increased bleeding risk except when transitioning from "
|| existingItem || " to " || selectedMed || "."
|| "\n\nIf your Patient is transitioning from " || existingItem || " to " || selectedMed
|| ", click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}"
|| "\n\nIf your Patient is NOT transitioning from " || existingItem || " to " || selectedMed
|| ", click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}";
elseif (existingItem IN arixtra_meds) then
stop := true;
severity := "low";
stop_message := "Duplicate Medication Alert!\n\nThis patient already has an order for Fondaparinux."
|| " You MUST discontinue the previous Fondaparinux order before placing a new "
|| "Fondaparinux order, UNLESS the therapies will not be overlapping."
|| "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}."
|| "\n\nOtherwise, click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}.";
endif;
elseif ( selectedMed matches pattern "Warfarin%" ) then
if ( ( existingItem IN xarelto_meds )
OR ( existingItem IN apixaban_meds ) ) then
stop := true;
severity := "low";
stop_message := selectedMed || " and " || existingItem || " should not be used together"
|| " due to increased bleeding risk.\n\nContact physician to adjust orders."
|| "\n\nWhen converting from " || existingItem || " to " || selectedMed
|| ", discontinue " || existingItem
|| " because " || existingItem || " affects the INR."
|| "\n\nUse Heparin or Lovenox with " || selectedMed
|| " as bridge therapy while waiting for the INR to rise if therapeutic levels are needed immediately."
|| "\n\nClick {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to contine ordering " || selectedMed
|| ", otherwise click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}.";
endif;
elseif ( selectedMed matches pattern "Rivaroxaban%" ) then
if ( ( existingItem IN heparin_inj_meds )
OR ( existingItem IN lovenox_meds )
OR ( existingItem IN pradaxa_meds )
OR ( existingItem IN warfarin_meds )
OR ( existingItem IN arixtra_meds )
OR ( existingItem IN apixaban_meds ) ) then
stop := true;
severity := "high";
stop_message := "Avoid concurrent use of " || selectedMed || " and "
|| existingItem || " due to increased bleeding risk.\n\nContact physician to adjust orders.";
if ( existingItem IN warfarin_meds ) then
stop_message := stop_message || "\n\nWhen converting from " || existingItem
|| " to " || selectedMed
|| ", discontinue " || existingItem || " and start " || selectedMed
|| " when INR is less than 3.0";
elseif ( existingItem IN arixtra_meds ) then
stop_message := stop_message || "\n\nWhen converting from " || existingItem || " to " || selectedMed
|| ", discontinue " || existingItem || " and start " || selectedMed
|| " 0-2 hours before the next " || existingItem || " dose would have been due.";
elseif ( existingItem IN apixaban_meds ) then
stop_message := stop_message || "\n\nWhen converting from " || existingItem
|| " to " || selectedMed
|| ", discontinue " || existingItem
|| " and start " || selectedMed
|| " when the next " || existingItem
|| " dose would have been due.";
elseif ( existingItem IN lovenox_meds ) then
stop_message := stop_message || "\n\nWhen converting from " || existingItem
|| " to " || selectedMed
|| ", discontinue " || existingItem
|| " and start " || selectedMed
|| " 0-2 hours before the next " || existingItem
|| " dose would have been due.";
endif;
elseif ( ( existingItem IN heparin_iv_meds )
OR ( existingItem IN argatroban_meds ) ) then
stop := true;
severity := "low";
stop_message := selectedMed || " and " || existingItem
|| " should not be used together due to increased bleeding risk"
|| " except when transitioning from " || existingItem || " to "
|| selectedMed || "."
|| "\n\nStart " || selectedMed || " when " || existingItem
|| " infusion is stopped."
|| "\n\nIf your Patient is transitioning from " || existingItem || " to " || selectedMed
|| ", click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}"
|| "\n\nIf your Patient is NOT transitioning from " || existingItem || " to " || selectedMed
|| ", click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}";
elseif ( existingItem IN xarelto_meds ) then
stop := true;
severity := "low";
stop_message := "Duplicate Medication Alert!\n\nThis patient already has an order for Xarelto."
|| " You MUST discontinue the previous Xarelto order before placing a new "
|| "Xarelto order, UNLESS the therapies will not be overlapping."
|| "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}."
|| "\n\nOtherwise, click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}.";
endif;
elseif ( selectedMed matches pattern "Apixaban%" ) then
if ( ( existingItem IN lovenox_meds )
OR ( existingItem IN arixtra_meds )
OR ( existingItem IN heparin_inj_meds )
OR ( existingItem IN warfarin_meds )
OR ( existingItem IN pradaxa_meds )
OR ( existingItem IN xarelto_meds ) ) then
stop := true;
severity := "high";
if ( existingItem IN warfarin_meds ) then
stop_message := "When converting from " || existingItem
|| " to " || selectedMed
|| ", discontinue " || existingItem
|| " and start " || selectedMed
|| " when INR less then 2.0.";
else
stop_message := "When converting from " || existingItem
|| " to " || selectedMed
|| ", discontinue " || existingItem
|| " and start " || selectedMed
|| " when the next " || existingItem
|| " dose would have been due.";
endif;
elseif ( ( existingItem IN heparin_iv_meds )
OR ( existingItem IN argatroban_meds ) ) then
stop := true;
severity := "low";
stop_message := selectedMed || " and " || existingItem
|| " should not be used together due to increased bleeding risk"
|| " except when transitioning from " || existingItem || " to "
|| selectedMed || "."
|| "\n\nStart " || selectedMed || " when " || existingItem
|| " infusion is stopped."
|| "\n\nIf your Patient is transitioning from " || existingItem || " to " || selectedMed
|| ", click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}"
|| "\n\nIf your Patient is NOT transitioning from " || existingItem || " to " || selectedMed
|| ", click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}";
elseif ( existingItem IN apixaban_meds ) then
stop := true;
severity := "low";
stop_message := "Duplicate Medication Alert! This patient already has an order for Apixaban."
|| " You MUST discontinue the previous Apixaban "
|| "order before placing a new Apixaban order, UNLESS the therapies will not be overlapping."
|| "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}."
|| "\n\nOtherwise, click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}.";
endif;
endif;
enddo;
endif;
;;
priority: 50
;;
evoke:
;;
logic:
conclude true;
;;
action:
//Return to calling function whether a stop
// (i.e. conflict) is true, the message to display,
// and the severity (i.e. hard or soft stop)
return stop, stop_message, severity;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,164 @@
maintenance:
title: FORM_FUNC_CALC_ADJUSTED_BODY_WEIGHT;;
mlmname: FORM_FUNC_CALC_ADJUSTED_BODY_WEIGHT;;
arden: version 2.5;;
version: 15.1;;
institution: St Clair Hospital;;
author: Juliet Law, Allscripts ;;
specialist: ;;
date: 2016-05-09;;
validation: testing;;
library:
purpose: Functional MLM to calculate adjusted body weight for drug dosing
;;
explanation: This MLM will be a functional call from Order set MLMs to calculate adjusted body weight (ABW) for drug dosing.
ABW = ( ( Total Body Weight - Ideal Body Weight) * 0.4 ) + Ideal Body Weight
Ideal Body Weight = ( 2.3 * inches over 5 feet ) + 45.5kg (Female)
( 2.3 * inches over 5 feet ) + 50.0kg (Male)
Change history
05.09.2016 JML Created.
;;
keywords: Called MLMs, display, fields
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
Visit_Guid := this_communication.ClientVisitGuid;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
/* What is the HEIGHT limit for using the Ideal weight calculation? */
/* The calculation will be done if the height is GREATER THAN OR EQUAL TO this number listed below */
ideal_WT_height_limit:= 150; /* cm */
comb_ht_wt_field := first of
(field_list where field_list.DataItemName = "CombinedMeasurements"
and field_List.Control_MultiFieldOccNum = 1);
if ( exists comb_ht_wt_field ) then
comb_ht_wt_val := comb_ht_wt_field.value;
wt := comb_ht_wt_val.weight;
ht := comb_ht_wt_val.height;
wt_type := comb_ht_wt_val.weighttype;
bsa := comb_ht_wt_val.bsa;
bmi := comb_ht_wt_val.bmi;
endif;
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGuid;
If ( not ( exist wt ) OR wt = 0 ) then
errormessage := errormessage || "Weight is required to calculate Adjusted Body Weight \n\n";
fatalerror := true;
endif;
if ( not ( exist ht ) OR ht = 0) then
errormessage := errormessage || "Height is required to calculate Adjusted Body Weight\n\n";
fatalerror := true;
endif;
if ( exist client_info_obj ) then
(birthdate, birth_year, patientgender ):= read last
{ClientInfo: birthdate, BirthYearNum, GenderTypeIntlCode REFERENCING client_info_obj};
endif;
if ( ( exist birthdate ) and ( birth_year > 0 ) and ( birthdate is time ) ) then
patientage:= (NOW - birthdate) / (1 year);
patientage:= (int (patientage));
endif;
if ( patientage < 18 ) then
fatalerror := true;
endif;
if ( fatalerror = true ) then
if patientage < 18 then
this_communication.Message := "This Calculation Is Not Approved For Patients < 18 Years Old";
this_communication.MessageType := "Error";
endif;
else
actualwt:= wt;
// now ideal
if ( patientgender = "F" ) then
WeightKg:= ((((ht /2.54)-60)* 2.3)+45.5);
else
WeightKg:= ((((ht /2.54)-60)* 2.3)+50);
endif; //if patientgender = "F"
// idealwt := WeightKg;
idealwt := (int ((WeightKg+ 0.005) * 100))/100;
extraideal := "";
if ( ht < ideal_WT_height_limit ) then
extraideal := "(Patient < 60 inches)";
if ( patientgender = "F" ) then
idealwt := 45.5;
else
idealwt := 50;
endif;
endif;
// now adjusted
adjustedwt := ((actualwt - idealwt)* 0.4) + idealwt;
// now round all
actualwt := (int ((actualwt + 0.005) * 100))/100;
idealwt := (int ((idealwt + 0.005) * 100))/100;
adjustedwt := (int ((adjustedwt + 0.005) * 100))/100;
if ( actualwt < idealwt ) then
weightused:= actualwt;
else
weightused:= adjustedwt;
endif;
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, weightused, actualwt, idealwt;
;;
end:

View File

@@ -0,0 +1,93 @@
maintenance:
title: FORM_Func_Disable_OS_Checkboxes;;
mlmname: FORM_Func_Disable_OS_Checkboxes;;
arden: version 2.5;;
version: 15.1;;
institution: St Clair Hospital;;
author: Juliet Law, Allscripts ;;
specialist: ;;
date: 2016-05-05;;
validation: testing;;
library:
purpose: Functional MLM to disable / enable grouping of checkbox fields on an order set
;;
explanation: This MLM will be a functional call from Order set MLMs when needing to disable / enable a grouping
of checkbox fields.
Change history
05.05.2016 JML Created
;;
keywords: Called MLMs, checkbox, fields
;;
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
callingField, //checkbox field that initiated the disable / enable of other checkboxes
readOnlyVal, //Disable v. enable
exceptionLst //Checkboxes to leave alone
) := argument;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
ClientGuid := this_communication.ClientGUID;
ChartGuid := this_communication.ChartGUID;
ClientVisitGuid := this_communication.ClientVisitGUID;
field_list := this_form.fields;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to True if a decision.log is needed.*/
log_execution_info := False;
//------------------------------------------------------------
// Define the ObjectsPlus destinations
//------------------------------------------------------------
for i in 1 seqto ( count field_list ) do
if ( field_list.DataItemName[i] matches pattern "PRX_Checkbox%" ) then
concatCurrField := field_list.DataItemName[i] || "|" || field_list.Control_MultiFieldOccNum[i];
if ( concatCurrField <> callingField ) then
if ( NOT ( concatCurrField IN exceptionLst ) ) then
affectedFld := first of ( field_list WHERE field_list.DataItemName = field_list.DataItemName[i]
AND field_list.Control_MultiFieldOccNum = field_list.Control_MultiFieldOccNum[i] );
affectedFld.Control_Read_Only := readOnlyVal;
endif;
endif;
endif;
enddo;
;;
evoke: // No evoke statement
;;
logic:
conclude True;
;;
action:
// This MLM returns two parameters, of types communication_type and form_type respectively.
return true;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,149 @@
maintenance:
title: FORM_FUNC_DISPLAY_ANTIBIOTIC_GUIDELINES;;
mlmname: FORM_FUNC_DISPLAY_ANTIBIOTIC_GUIDELINES;;
arden: version 2.5;;
version: 15.1;;
institution: St Clair Hospital;;
author: Juliet Law, Allscripts ;;
specialist: ;;
date: 2016-05-05;;
validation: testing;;
library:
purpose: Functional MLM to display antibiotic guideline information on order sets
;;
explanation: This MLM will be a functional call from Order set MLMs when needing to display antibiotic / allergy guideline information
Change history
05.05.2016 JML Created.
06.09.2017 JML CSR 35272: Added guidelines for Sepsis Unknown Source Antibiotic order sets
02.13.2018 JML CSR 25885: Replaced gentamicin with amikacin on GU antibiotics order sets
;;
keywords: Called MLMs, display, fields
;;
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;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
ClientGuid := this_communication.ClientGUID;
ChartGuid := this_communication.ChartGUID;
ClientVisitGuid := this_communication.ClientVisitGUID;
PrimaryObjdetail:=this_communication.PrimaryObj;
OrderSetName := PrimaryObjdetail.OrderSetName;
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to True if a decision.log is needed.*/
log_execution_info := False;
SP := " ";
SP2 := SP||SP;
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
CRLF:= CR||LF;
TAB := 9 formatted with "%c";
//Retrieve fields
Allergy_Info := first of ( field_list WHERE field_list.DataItemName = "NUR_GenAdditionalTxt" AND field_list.Control_MultiFieldOccNum = 1 );
Antibiotic_Info := first of ( field_list WHERE field_list.DataItemName = "NUR_GenAdditionalTxt" AND field_list.Control_MultiFieldOccNum = 2 );
allergy_msg := "Note: Simple rash, nausea or vomiting does not exclude the use of Cephalosporins.";
allergy_msg := allergy_msg || CRLF || "Avoid cephalosporin only if PCN reaction was immediate hypersensitivity (i.e. hives, anaphylaxis, pharyngeal edema, neutropenia, fever).";
Allergy_Info.Value := allergy_msg;
wt_based_msg := CRLF || "";
if ( OrderSetName = "Pneumonia Antibiotic" ) then
wt_based_msg := "Ceftriaxone 1 gm (< 80 kg)" || TAB || "Vancomycin Loading Dose 25 mg/kg ABW x1";
wt_based_msg := wt_based_msg || CRLF || "Ceftriaxone 2 gm (>= 80 kg)" || TAB || SP2 || "then Vancomycin 20 mg/kg ABW IV q12hr (CrCl > 60 ml/min) OR q24hr (CrCl 30-60 ml/min)";
wt_based_msg := wt_based_msg || CRLF || TAB || TAB || TAB || SP2 || " OR X 1 (CrCl < 30 ml/min)";
wt_based_msg := wt_based_msg || CRLF || "Tobramycin 5 mg/kg ABW X 1";
wt_based_msg := wt_based_msg || CRLF || "ABW (Adjusted Body Weight) = (Total Body Weight - Ideal Body Weight) x 0.4 + Ideal Body Weight;";
endif;
if ( OrderSetName = "Pneumonia Antibiotic ED" ) then
wt_based_msg := "Ceftriaxone 1 gm (< 80 kg)" || TAB || "Vancomycin Loading Dose 25 mg/kg ABW x1" || TAB || "Tobramycin 5 mg/kg ABW X 1";
wt_based_msg := wt_based_msg || CRLF || "Ceftriaxone 2 gm (>= 80 kg)";
wt_based_msg := wt_based_msg || CRLF || CRLF || "ABW (Adjusted Body Weight) = (Total Body Weight - Ideal Body Weight) x 0.4 + Ideal Body Weight";
endif;
if ( OrderSetName = "Sepsis Unknown Source Antibiotic ED" ) then
wt_based_msg := "Vancomycin Loading Dose 25 mg/kg ABW x1";
wt_based_msg := wt_based_msg || CRLF || CRLF || "ABW (Adjusted Body Weight) = (Total Body Weight - Ideal Body Weight) x 0.4 + Ideal Body Weight";
endif;
if ( OrderSetName = "Sepsis Unknown Source Antibiotic" ) then
wt_based_msg := "Vancomycin Loading Dose 25 mg/kg ABW x1";
wt_based_msg := wt_based_msg || CRLF || SP2 || SP2 || "then Vancomycin 20 mg/kg ABW IV q12hr (CrCl > 60 ml/min) OR q24hr (CrCl 30-60 ml/min)";
wt_based_msg := wt_based_msg || CRLF || TAB || SP2 || " OR X 1 (CrCl < 30 ml/min)";
wt_based_msg := wt_based_msg || CRLF || CRLF || "ABW (Adjusted Body Weight) = (Total Body Weight - Ideal Body Weight) x 0.4 + Ideal Body Weight;";
endif;
if ( OrderSetName IN ("Genitourinary Antibiotic", "Genitourinary Antibiotic ED") ) then
wt_based_msg := "Ceftriaxone 1 gm (< 80 kg)" || TAB || "Amikacin 7.5 mg/kg ABW X 1";
wt_based_msg := wt_based_msg || CRLF || "Ceftriaxone 2 gm (>= 80 kg)";
wt_based_msg := wt_based_msg || CRLF || CRLF || "ABW (Adjusted Body Weight) = (Total Body Weight - Ideal Body Weight) x 0.4 + Ideal Body Weight";
endif;
if ( OrderSetName IN ("IntraAbdominal Antibiotic", "IntraAbdominal Antibiotic ED") ) then
wt_based_msg := "Cefazolin 1 gm (< 80 kg)";
wt_based_msg := wt_based_msg || CRLF || "Cefazolin 2 gm (>= 80 kg)";
endif;
if ( OrderSetName = "Skin Antibiotic Inpatient" ) then
wt_based_msg := "Cefazolin 1 gm (< 80 kg)" || TAB || "Vancomycin Loading Dose 25 mg/kg ABW X 1";
wt_based_msg := wt_based_msg || CRLF || "Cefazolin 2 gm (>= 80 kg)" || TAB || SP2 || "then Vancomycin 20 mg/kg ABW IV q12hr (CrCl > 60 ml/min) OR q24hr (CrCl 30-60 ml/min)";
wt_based_msg := wt_based_msg || CRLF || TAB || TAB || TAB || SP2 || " OR X 1 (CrCl < 30 ml/min)";
wt_based_msg := wt_based_msg || CRLF || "Clindamycin 600 mg IV q6hr (< 80 kg)";
wt_based_msg := wt_based_msg || CRLF || "Clindamycin 900 mg IV q8hr (>= 80 kg)";
endif;
if ( OrderSetName = "Skin Antibiotic Inpatient ED" ) then
wt_based_msg := "Cefazolin 1 gm (< 80 kg)" || TAB || "Vancomycin Loading Dose 25 mg/kg ABW X 1" || TAB || "Clindamycin 600 mg IV STAT (< 80 kg)";
wt_based_msg := wt_based_msg || CRLF || "Cefazolin 2 gm (>= 80 kg)" || TAB || TAB || TAB || TAB || TAB || TAB || "Clindamycin 900 mg IV STAT (>= 80 kg)";
wt_based_msg := wt_based_msg || CRLF || CRLF || "ABW (Adjusted Body Weight) = (Total Body Weight - Ideal Body Weight) x 0.4 + Ideal Body Weight";
endif;
if ( OrderSetName IN ("Skin Antibiotic Outpatient", "Skin Antibiotic Outpatient ED") ) then
wt_based_msg := "Cephalexin 500 mg PO (<= 110 kg)";
wt_based_msg := wt_based_msg || CRLF || "Cephalexin 1000 mg PO (> 110 kg)";
endif;
Antibiotic_Info.Value := wt_based_msg;
;;
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;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,80 @@
maintenance:
title: FORM_FUNC_DISPLAY_FORM_FIELD;;
mlmname: FORM_FUNC_DISPLAY_FORM_FIELD;;
arden: version 2.5;;
version: 15.1;;
institution: St Clair Hospital;;
author: Juliet Law, Allscripts ;;
specialist: ;;
date: 2016-05-05;;
validation: testing;;
library:
purpose: Functional MLM to control display value of form fields on an order set
;;
explanation: This MLM will be a functional call from Order set MLMs when needing to control the display property
of fields.
Change history
05.05.2016 JML Created.
;;
keywords: Called MLMs, display, fields
;;
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
fieldName,
displayOption
) := argument;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
ClientGuid := this_communication.ClientGUID;
ChartGuid := this_communication.ChartGUID;
ClientVisitGuid := this_communication.ClientVisitGUID;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to True if a decision.log is needed.*/
log_execution_info := False;
//------------------------------------------------------------
// Define the ObjectsPlus destinations
//------------------------------------------------------------
for i IN 1 seqto ( count fieldName ) do
fieldName[i].Control_Visible := displayOption;
rtnValue := fieldName[i].Control_Visible;
enddo;
;;
evoke: // No evoke statement
;;
logic:
conclude True;
;;
action:
// This MLM returns two parameters, of types communication_type and form_type respectively.
return rtnValue;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,118 @@
maintenance:
title: Called MLM that determines if an escort order is to be placed ;;
mlmname: Form_Func_Escort_Order;;
arden: version 4.5;;
version: 2.00;;
institution: St. Clair Hospital;;
author: ;;
specialist: ;;
date: 2010-12-01;;
validation: testing;;
library:
purpose:
Called from any Form MLM. It interrogates all select data items on the form and determines if
any require an accompanying escort order (based upon a class type of the order)
;;
explanation: This MLM was written to be called from ED Order Set MLMs, but can be called from others as well.
Change history
12.01.2010 DW Created
03.04.20111 DW Corrected location issue by changing the SQL to order by touchedwhen
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(this_form,this_communication) := ARGUMENT;
field_list := this_form.fields;
CallingFormGUID :=this_communication.FormGUID;
ClientVisitGuid := this_communication.ClientVisitGuid;
RelevantItemsCount:= 0;
(Origin) := read last {"select "
|| " columnnewvalue from sxaedlocationaudit a with (nolock) where columnname = {{{SINGLE-QUOTE}}}location{{{SINGLE-QUOTE}}} "
|| " and clientvisitguid = " || SQL(ClientVisitGuid) || " order by touchedwhen"};
(DataItemName,OCCNumsOnForm) := read {"select "
|| " fld.dataitemcode,fld.multifieldoccnum "
|| " from cv3orderentryform frm with (nolock) "
|| " join cv3orderentryfield fld with (nolock) on fld.orderentryformguid = frm.guid "
|| " where frm.formguid = " || SQL(CallingFormGUID) || " and frm.iscurrent = 1 "};
// Find the selected orders in the order set
for i in 1 seqto count OCCNumsOnForm do
ThisOccNum := OCCNumsOnForm [i];
ThisDataItemName := DataItemName [i];
OrderSetItem := last of (field_list where field_list.DataItemName = ThisDataItemName and field_List.Control_MultiFieldOccNum = ThisOccNum);
OrderSetItemVal := OrderSetItem.Value;
OrderSetItemSel := (OrderSetItemVal where OrderSetItemVal.isselected = true);
OrderSetItemSelGUID:= OrderSetItemSel.OrderCatalogMasterItemGUID;
// Determine if any of the selected order requires an escort order
for i in 1 seqto count OrderSetItemSelGUID do
ThisItemGUID := OrderSetItemSelGUID [i];
EscortClassDestination := read last {"select ctv.value "
|| " from cv3ordercatalogmasteritem mi with(nolock) "
|| " join cv3catalogclasstypevalue ctv with(nolock) on ctv.catalogmasterguid = mi.guid and ctv.value not in ({{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})"
|| " join cv3classtype ct with(nolock) on ct.guid = ctv.classtypeguid and ct.code = {{{SINGLE-QUOTE}}}ed_escort request{{{SINGLE-QUOTE}}} "
|| " where mi.guid = " || SQL(ThisItemGUID) || " "};
if exists EscortClassDestination then RelevantItemsCount := RelevantItemsCount + 1; EscortFinalDestination:= EscortClassDestination; endif;
enddo;
enddo;
if RelevantItemsCount = 0 then EscortQuestion := "No"; else EscortQuestion := "Yes"; endif;
// Define the fields to be updated
EscortOrder := last of (field_list where field_list.DataItemName = "Multiordercheckbox" and field_list.Label = "Request Escort");
EscortOrderVal := EscortOrder.Value;
EscortOrderBox := first of (EscortOrderVal where EscortOrderVal.Name = "Request Escort");
DestinationField:= last of (field_list where field_list.DataItemName = "Obj_Plus_EscortDestination" and field_List.Control_MultiFieldOccNum = 1 );
OriginField := last of (field_list where field_list.DataItemName = "NUR_Origin" and field_List.Control_MultiFieldOccNum = 1 );
if EscortQuestion = "Yes" then EscortOrderBox.ISSelected :=True;
DestinationField.value := EscortFinalDestination;
OriginField.value := Origin;
else EscortOrderBox.ISSelected :=False; DestinationField.value := " "; OriginField.value := " ";
endif;
;;
evoke: /* Call MLM */
;;
logic:
conclude true;
;;
action:
return EscortQuestion;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,172 @@
maintenance:
title: FORM_GASTRIC_BYPASS_POST_OP;;
mlmname: FORM_GASTRIC_BYPASS_POST_OP;;
arden: version 2.5;;
version: 6.10;;
institution: St. Clair Hospital ;;
author: Shivprasad Jadhav;;
specialist: Shivprasad Jadhav, Allscripts;;
date: 2015-03-12;;
validation: testing;;
library:
purpose: 12-03-2015 CSR-33077 : Created MLM
Scenario 1 : When one medication is selected from available 3 for uncler prophylaxis then other 2 should not be able to get selected From medication Grid.
Scenario 2 : When one medication is selected from available 4 for antiemetics then other 3 should not be able to get selected from Mdeication Grid pharmacy -anthiemetics section;;
explanation:
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
( this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
field_list:= this_form.Fields;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
CallingItem := CallingField.Records_;
Medication := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 49 );
Medication_Value := Medication.Value ;
CPAP := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 70 );
CPAP_Value := CPAP.Value ;
Respiratory := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 71 );
Respiratory_Value := Respiratory.Value ;
// *********** Objects for first flow *************
Famotidine := first of (Medication_Value where Medication_Value.Name = "Famotidine Inj");
Pantoprazole := first of (Medication_Value where Medication_Value.Name = "Pantoprazole Inj");
Pantoprazole_40mg := first of (Medication_Value where Medication_Value.Name = "Pantoprazole 40mg DR Tab");
/*********************************************************************************************/
Metoclopramide := first of (Medication_Value where Medication_Value.Name = "Metoclopramide Inj");
Ondansetron := first of (Medication_Value where Medication_Value.Name = "Ondansetron Inj");
Promethazine := first of (Medication_Value where Medication_Value.Name = "Promethazine Inj");
Prochlorperazine := first of (Medication_Value where Medication_Value.Name = "Prochlorperazine Inj");
/*********************************************************************************************/
CPAP_Row := first of (CPAP_Value where CPAP_Value.Name = "CPAP");
Respiratory_Row:= first of (Respiratory_Value where Respiratory_Value.Name = "Nurse Instruction:");
If Metoclopramide.IsSelected = True Then
Ondansetron.IsReadonly := True;
Promethazine.IsReadonly := True ;
Prochlorperazine.IsReadonly := True;
Endif;
If Ondansetron.IsSelected = True Then
Metoclopramide.IsReadonly := True;
Promethazine.IsReadonly := True ;
Prochlorperazine.IsReadonly := True;
Endif;
If Promethazine.IsSelected = True Then
Metoclopramide.IsReadonly := True;
Ondansetron.IsReadonly := True;
Prochlorperazine.IsReadonly := True;
Endif;
If Prochlorperazine.IsSelected = True Then
Metoclopramide.IsReadonly := True;
Ondansetron.IsReadonly := True;
Promethazine.IsReadonly := True ;
Endif;
If Prochlorperazine.IsSelected = False And Metoclopramide.IsSelected = False And Ondansetron.IsSelected = False And Promethazine.IsSelected = False Then
Metoclopramide.IsReadonly := False;
Ondansetron.IsReadonly := False;
Promethazine.IsReadonly := False ;
Prochlorperazine.IsReadonly := False;
EndIf;
// Second flow ******************************************************************************
If Famotidine.IsSelected = True Then
Pantoprazole.IsReadonly := True;
Pantoprazole_40mg.IsReadonly := True ;
Endif;
If Pantoprazole.IsSelected = True Then
Famotidine.IsReadonly := True;
Pantoprazole_40mg.IsReadonly := True ;
Endif;
If Pantoprazole_40mg.IsSelected = True Then
Famotidine.IsReadonly := True;
Pantoprazole.IsReadonly := True ;
Endif;
If Famotidine.IsSelected = False And Pantoprazole.IsSelected = False And Pantoprazole_40mg.IsSelected = False Then
Famotidine.IsReadonly := False;
Pantoprazole.IsReadonly := False;
Pantoprazole_40mg.IsReadonly := False ;
EndIf;
// Third flow ******************************************************************************
if (CPAP_Row.IsSelected = FALSE And Respiratory_Row.IsReadonly= TRUE ) Then
A:=111;
Endif;
if ( CallingEvent = "FieldChange" ) then
if ( CallingField = "MultiOrderGrid|70") or ( CallingField = "MultiOrderGrid|71") then
if ( true IN CPAP_Row.IsSelected Or true IN Respiratory_Row.IsSelected ) then
CPAP_Row.IsSelected := true;
Respiratory_Row.IsSelected := true ;
Respiratory_Row.IsReadonly := TRUE ;
endif;
endif;
endif;
if A= 111 Then
CPAP_Row.IsSelected := FALSE;
Respiratory_Row.IsSelected := FALSE;
CPAP_Row.IsReadonly := FALSE ;
Respiratory_Row.IsReadonly := FALSE ;
Endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,278 @@
maintenance:
title: Ordering Conditional Display field;;
mlmname: FORM_GENERIC_Display;;
arden: version 2;;
version: 4.50;;
institution: St Clair Hospital;;
author: Claudia Benson, Claudia.Benson@stclair.org, (412) 942-1307;;
specialist: Eclipsys Corporation;;
date: 2006-10-11;;
validation: testing;;
library:
purpose: Based on a value provided in one field, make another field DISPLAY.
;;
explanation: This generic MLM can be called from several order forms:
- Resp PFT
- (others?)
If a particular value is placed in a certain field of a certain form, specified by
the configuration list below, then another field, also in the list, will be made to
display.
Trigger on formopen or fieldchange.
Rules:
Use lists of
forms,
fields to test on the form,
values to test for,
field to make visible (if the value in the other field is present)
Value (T or F) of the read-only status of the visible field.
change history
05.22.2008 RS Get ED Status Board location
05.28.2008 DW Forced Xopenex error box if dose missing
01.20.2015 TMS Added new form map for "RESP Spont Aerosol" CSR 32176
04.26.2016 TMS Add call on form Open to Medication Order Management MLM CSR 33465
07.26.2017 AnkitM CSR 33723: Changed word references from {{{SINGLE-QUOTE}}}Xopenex{{{SINGLE-QUOTE}}} to {{{SINGLE-QUOTE}}}Levalbuterol{{{SINGLE-QUOTE}}}
;;
keywords: Called MLMs, Form fields, generic, field test, visible
;;
knowledge:
type: data-driven;;
data:
/***********************Make Changes To Spelling And Flags In This Section************************/
//NOTE: THE RELATIVE ORDER OF ITEMS MUST BE MAINTAINED WITHIN LISTS!!!
//MUST HAVE THE FOLLOWING ORDER FOR EACH ELEMENT ITEM:
//"FORM_NAME|FIELD_NAME_TO_TEST|VALUEs_TO_TEST_FOR|FIELD_TO_MAKE_VISIBLE|T_or_F(READ_ONLY)"
form_map_list :=
("Resp PFT|Resp PFT Reason For Test|Pre-Operative|Resp PFT_Surgery Date|F"
,"Resp PFT|Resp PFT Reason For Test|Pre-Operative|Resp PFT_Surgery Time|F"
,"RESP SA IPPB|IsPRN|TRUE|RESP_PRN Reasons|F"
,"RESP SA IPPB|RESP_Xopenex|Use Therapeutic Substitute|RESP_Xopenex Substitutes Label|T"
,"RESP SA IPPB|RESP_Xopenex|Use Therapeutic Substitute|RESP_Xopenex Substitute Label 2|T"
,"RESP SA IPPB|RESP_Xopenex|Per Physician Order: Do NOT Substitute|RESP_Xopenex 0.63mg/3ml NSS|F"
,"RESP SA IPPB|RESP_Xopenex|Per Physician Order: Do NOT Substitute|RESP_Xopenex 1.25mg/3ml NSS|F"
,"RESP Spont Aerosol|IsPRN|TRUE|RESP_PRN Reasons|F"
,"RESP Spont Aerosol|RESP_Xopenex|Use Therapeutic Substitute|RESP_Xopenex Substitutes Label|T"
,"RESP Spont Aerosol|RESP_Xopenex|Use Therapeutic Substitute|RESP_Xopenex Substitute Label 2|T"
,"RESP Spont Aerosol|RESP_Xopenex|Per Physician Order: Do NOT Substitute|RESP_Xopenex 0.63mg/3ml NSS|F"
,"RESP Spont Aerosol|RESP_Xopenex|Per Physician Order: Do NOT Substitute|RESP_Xopenex 1.25mg/3ml NSS|F"
,"YOUR_FORM_NAME_HERE|YOUR_TEST_FIELD_HERE|VALID_VAL1,VALID_VAL2|DISPLAY_FIELD_HERE|F_or_T"
);
/**************************************************************************************JAB********/
// 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;
//Initialize MLM pointers:
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
chk_overdue_time := MLM {{{SINGLE-QUOTE}}}overdue_req_time{{{SINGLE-QUOTE}}};
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingForm := this_form.name;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
Visit_Guid := this_communication.ClientVisitGuid;
// 05/22/08 RS Added per ED CPOE Beeper additions
If (CallingForm = "RESP SA IPPB" or CallingForm = "RESP Spont Aerosol") then
If (CallingEvent = "FormOpen") then
EDLoc :=last of (field_list
where field_list.DataItemName = "ED Location" );
Temp := read last {"Select el.EDDisplayName "
|| " from sxaedlocation as el "
|| " join sxaedboard as eb "
|| " on eb.EdLocationguid = el.locationguid "
|| " and eb.clientvisitguid = " || SQL(Visit_Guid)
|| " and eb.active =1 "};
EDLoc.Value := Temp;
elseif (CallingEvent = "FormClose") then
Levalbuterolquestion := last of (field_list where field_list.DataItemName = "RESP_Xopenex" );
Levalbuterol063 := last of (field_list where field_list.DataItemName = "RESP_Xopenex 0.63mg/3ml NSS" );
Levalbuterol125 := last of (field_list where field_list.DataItemName = "RESP_Xopenex 1.25mg/3ml NSS" );
If Levalbuterolquestion.value = "Per Physician Order: Do NOT Substitute" and (Levalbuterol063.value = False and Levalbuterol125.value = False) then
this_communication.Message :=
"callingform = "|| callingform
|| "\nCallingEvent = " || CallingEvent;
this_communication.Message := "You must select a Levalbuterol dose";
this_communication.MessageType := "Error";
endif;
endif;
endif;
if called_by_editor then
CallingForm := "LAB Ser Nsg Col_Ser1";
CallingEvent := "FieldChange";
CallingField := "LAB_M_VO_OBR15_SpecType_Ser1";
endif;
for i in 1 seqto count form_map_list do
// initialize vars:
visible_field := null;
trigger_field := null;
// parse the form mapper:
form_element_list := call str_parse with form_map_list[i], "|";
test_form_name := form_element_list[1]; //Lookup form name from map list
// Test for proper form
if CallingForm = test_form_name then
test_visible_field := form_element_list[4]; //Lookup visible field from map list
test_vis_field_r_o := form_element_list[5]; //Lookup read-only status from map list
visible_field := first of
(field_list where field_list.DataItemName = test_visible_field);
// Set open form defaults
if exists visible_field then
test_field := form_element_list[2]; //Lookup test field from map list
trigger_field := first of
(field_list where field_list.DataItemName = test_field);
//check for {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} fields
if visible_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then
Right_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Right" );
Superficial_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Superficial" );
Left_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Left" );
Deep_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Deep" );
endif;
// Test for proper field
if exists trigger_field then
//Lookup list of valid values for the test field
test_val_list := call str_parse with form_element_list[3], ",";
//Check for time field
if trigger_field.dataitemname = "RequestedTime"
and "overdue" is in test_val_list then
if exists trigger_field.value.reqtimevalue then
time_type := "scheduled";
time_val := trigger_field.value.reqtimevalue;
else
time_type := "coded";
time_val := trigger_field.value.reqtimecode;
endif;
// check for overdue time
time_is_overdue := call chk_overdue_time
with time_val, time_type;
endif;
if (trigger_field.value as string) is in test_val_list or time_is_overdue then
// Make the field visible (but NOT Manditory!)
visible_field.control_visible := True;
if test_vis_field_r_o = "F" then
visible_field.control_read_only := False;
else
visible_field.control_read_only := True;
endif;
// make {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} settings writable
if visible_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then
Right_box.control_visible := True;
Superficial_box.control_visible := True;
Left_box.control_visible := True;
Deep_box.control_visible := True;
if test_vis_field_r_o = "F" then
Right_box.control_read_only := False;
Superficial_box.control_read_only := False;
Left_box.control_read_only := False;
Deep_box.control_read_only := False;
else
Superficial_box.control_read_only := True;
Left_box.control_read_only := True;
Deep_box.control_read_only := True;
endif;
endif;
// FOR DEBUGGING PURPOSES: display a message to the user
/* this_communication.Message :=
"callingform = "|| callingform
|| "\nCallingEvent = " || CallingEvent
|| "\ntest_form_name = " || test_form_name
|| "\ntest_field = " || test_field
|| "\ntest_visible_field = " || test_visible_field
|| "\ntrigger_field = " || trigger_field.dataitemname
|| "\nvisible_field = " || visible_field.dataitemname
|| "\ntest_val_list = " || test_val_list;
this_communication.MessageType := "Informational";
*/
else
visible_field.control_visible := False;
if test_vis_field_r_o = "F" then
// visible_field.control_read_only := True;
visible_field.value := null;
endif;
if visible_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then
// set all {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} boxes to read-only
Right_box.control_visible := False;
Superficial_box.control_visible := False;
Left_box.control_visible := False;
Deep_box.control_visible := False;
Right_box.value := null;
Superficial_box.value := null;
Left_box.value := null;
Deep_box.value := null;
endif; // visible_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript"
endif; // (trigger_field.value as string) is in test_val_list
endif; // exists trigger_field
endif; // exists visible_field
endif; // CallingForm = test_form_name
enddo; // for i in 1 seqto count form_map_list
Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_Rx_Medication_Retrieval{{{SINGLE-QUOTE}}};
(this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
;;
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:

View File

@@ -0,0 +1,226 @@
maintenance:
title: Ordering either one or another Manditory field;;
mlmname: FORM_GENERIC_EITHER_OR_MANDITORY;;
arden: version 2;;
version: 4.50;;
institution: St Clair Hospital;;
author: Claudia Benson, Claudia.Benson@stclair.org, (412) 942-1307;;
specialist: Eclipsys Corporation;;
date: 2006-10-11;;
validation: testing;;
library:
purpose: To make a list of fields all manditory until one is filled out.
;;
explanation: This generic MLM can be called from several Micro order forms:
- Resp CPAP
- Resp BiPAP
- (others?)
It will make ALL of the specified fields as manditory, unless one is filled in
with a value. Then, it will make all of the other, formerly manditory, fields
into non-manditory fields.
Trigger on formopen or fieldchange.
Rules:
Use lists of
forms,
list of fields to make manditory.
change history
09.11.2007 TMS added 3 new fields to order from to change from mandatory to non-mandatory. (LAB_RC_BGCMT_LV_RespNasalMaskLPM, LAB_RC_BGCMT_LO_RespPartRebreather, LAB_RC_BGCMT_LO_RespNonRebreather)
02.11.2007 DW added a new form, LAB ChemBloodGas_Tmp.
01.28.2009 DW added logic to end the MLM if the MLM_Form_Update_Flag is on the form and is unchecked (will check the field to indicate open for modification)
02.25.2009 DW revised the 01.28.2009 logic to bypass the edits if the form is accessd by a physician
02.26.2015 STH CSR# 32765 - updated to call the user lab priority options MLM to display the user friendly lab priorities when appropriate.
05.29.2015 MJP CSR# 33459: added new field to form to change from mandatory to non (LAB_RC_BGCMT_LV_HiFloNCLPM)
;;
keywords: Called MLMs, Form fields, generic, manditory
;;
knowledge:
type: data-driven;;
data:
/***********************Make Changes To Spelling And Flags In This Section************************/
//NOTE: THE RELATIVE ORDER OF ITEMS MUST BE MAINTAINED WITHIN LISTS!!!
//MUST HAVE THE FOLLOWING ORDER FOR EACH ELEMENT ITEM:
//"FORM_NAME|FIELDS_TO_MAKE_MANDITORY"
form_map_list :=
("Resp CPAP|Resp BIPAP/CPAP O2%,Resp CPAP LPM"
,"Resp BIPAP|Resp BIPAP/CPAP O2%,Resp CPAP LPM"
,"LAB Chem Blood Gas|LAB_RC_BGCMT_LV_RespNCLPM" ||
",LAB_RC_BGCMT_LV_RespFaceMaskLPM,LAB_RC_BGCMT_LV_RespVenturiMaskFIO2" ||
",LAB_RC_BGCMT_LV_HiFloNCLPM" ||
",LAB_RC_BGCMT_LV_RESP Oximizer LPM,LAB_RC_BGCMT_RespAerosolMode,LAB_RC_BGCMT_BIPAP_CPAP" ||
",LAB_RC_BGCMT_LV_RespVentMode,LAB_RC_BGCMT_LO_RespRoomAir,LAB_RC_BGCMT_LO_Resp100 02" ||
",LAB_RC_BGCMT_LV_RespNasalMaskLPM,LAB_RC_BGCMT_LO_RespPartRebreather,LAB_RC_BGCMT_LO_RespNonRebreather"
,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_LV_RespNCLPM" ||
",LAB_RC_BGCMT_LV_RespFaceMaskLPM,LAB_RC_BGCMT_LV_RespVenturiMaskFIO2" ||
",LAB_RC_BGCMT_LV_HiFloNCLPM" ||
",LAB_RC_BGCMT_LV_RESP Oximizer LPM,LAB_RC_BGCMT_RespAerosolMode,LAB_RC_BGCMT_BIPAP_CPAP" ||
",LAB_RC_BGCMT_LV_RespVentMode,LAB_RC_BGCMT_LO_RespRoomAir,LAB_RC_BGCMT_LO_Resp100 02" ||
",LAB_RC_BGCMT_LV_RespNasalMaskLPM,LAB_RC_BGCMT_LO_RespPartRebreather,LAB_RC_BGCMT_LO_RespNonRebreather"
,"YOUR_FORM_NAME_HERE|MANDITORY_FIELD_1,MANDITORY_FIELD_2,MANDITORY_FIELD_3,...etc."
);
/**************************************************************************************JAB********/
// 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;
//Initialize MLM pointers:
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
gen_ungray := mlm {{{SINGLE-QUOTE}}}FORM_GENERIC_un_gray{{{SINGLE-QUOTE}}};
// Display any field related to others:
(this_communication, this_form) := call gen_ungray
with this_communication, this_form, client_info_obj;
// Initialize lists
test_manditory_field_list := ();
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
//*****BEGIN ***** STH 2.10.2015 - Added for CSR 32765 to display user friendly lab priorities
Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
DisplayNewScheduled := first of (field_list.Value
where field_list.DataItemName = "LAB_CB_Alternate Priorities");
//*****END ***** STH 2.10.2015 - Added for CSR 32765 to display user friendly lab priorities
CallingForm := this_form.name;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
if called_by_editor then
CallingForm := "Resp CPAP";
endif;
// 2.25.2009 DW bypass logic
//
// Bypass this MLM{{{SINGLE-QUOTE}}}s logi when a form is opened by a physician
orderroletype:= this_communication.primaryobj.enterrole;
orderrole := orderroletype matches pattern "%Physician%";
userguid:= this_communication.UserGUID;
user_orderrole := read last { "Select orderroletype from CV3User where guid = " || SQL(userguid) };
user_orderrolephysicain := user_orderrole matches pattern "%Physician%";
If user_orderrolephysicain = true
then; // Go to the end of the MLM
else // Continue with the MLM logic
for i in 1 seqto count form_map_list do
// Initialize value counter
value_in_mand_field_counter := 0;
// initialize vars:
manditory_field := null;
trigger_field := null;
// parse the form mapper:
form_element_list := call str_parse with form_map_list[i], "|";
test_form_name := form_element_list[1]; //Lookup form name from map list
// Test for proper form
if CallingForm = test_form_name then
//Lookup manditory fields, from map list
test_manditory_field_list := call str_parse with form_element_list[2], ",";
for j in 1 seqto count test_manditory_field_list do
// Test for proper field
test_manditory_field := test_manditory_field_list[j];
manditory_field := first of
(field_list where field_list.DataItemName = test_manditory_field);
if exists manditory_field then
if (manditory_field.datatype <> "checkbox"
and manditory_field.value is not null)
or (manditory_field.datatype = "checkbox"
and manditory_field.value = true) then
value_in_mand_field_counter := value_in_mand_field_counter + 1;
endif;
endif;
enddo; // for j in 1 seq to count test_manditory_field_list
for k in 1 seqto count test_manditory_field_list do
test_manditory_field := test_manditory_field_list[k];
manditory_field := first of
(field_list where field_list.DataItemName = test_manditory_field);
if exists manditory_field then
if value_in_mand_field_counter <= 0 then // Set open form defaults
// Mandate the field and, if necessary, make it visible
manditory_field.control_visible := true;
manditory_field.control_mandatory := True;
manditory_field.control_read_only := False;
else
manditory_field.control_mandatory := False;
manditory_field.control_read_only := False;
endif; // value_in_mand_field_counter <= 0
endif; // exists manditory_field
enddo; // for k in 1 seq to count test_manditory_field_list
endif; // CallingForm = test_form_name
enddo; // for i in 1 seqto count form_map_list
endif; // If exist FormUpdateCheckbox and FormUpdateCheckbox.value = False
//****BEGIN***** STH 2.10.2015 Added for CSR 32765 only display user friendly lab priorities if the opbservation is added to the form AND selected/checked
if (DisplayNewScheduled) then
//Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
(this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
endif;
//****END***** STH 2.10.2015 Added for CSR 32765 only display user friendly lab priorities if the opbservation is added to the form AND selected/checked
;;
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:

View File

@@ -0,0 +1,340 @@
maintenance:
title: Ordering: Carry forward Medical Imaging Indications on an Order Set;;
mlmname: FORM_Generic_Medical_Imaging_Indications_for_OS;;
arden: version 2;;
version: 4.50;;
institution: St Clair Medical Imaging Indications;;
author: Don Warnick Eclipsys Corp;;
specialist: ;;
date: 2010-07-26;;
validation: testing;;
library:
purpose: Populate the Medical Imaging indications of all tests on an Order Set.
;;
explanation: This MLM was written ED Order Sets, but can be used on others as well.
Change history
07.26.2010 DW Created
;;
keywords: Called MLMs, Medical Imaging, Indications
;;
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*******************/
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField :=this_communication.CallingFieldName;
ClientVisitGuid := this_communication.ClientVisitGuid;
//--------------------------------------------------------------------------
local_session := cds_session.local;
//--------------------------------------------------------------------------
//Initialize MLM pointers:
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
indications1 := last of (field_list where field_list.DataItemName = "ED_MI_ClinInd1" and field_List.Control_MultiFieldOccNum = 1 );
indications2 := last of (field_list where field_list.DataItemName = "ED_MI_ClinInd2" and field_List.Control_MultiFieldOccNum = 1 );
indications1val := indications1.value;
indications2val := indications2.value;
ivyesno1 := last of (field_list where field_list.DataItemName = "MI Yes No" and field_List.Control_MultiFieldOccNum = 1 );
ivyesno2 := last of (field_list where field_list.DataItemName = "MI Yes No2" and field_List.Control_MultiFieldOccNum = 1 );
ivyesno3 := last of (field_list where field_list.DataItemName = "MI Yes No3" and field_List.Control_MultiFieldOccNum = 1 );
// Determine pregnancy possibility
PregnancyHistory:= last of (field_list where field_list.DataItemName = "MI_LV_MI Yes No Pregnacy" and field_List.Control_MultiFieldOccNum = 1 );
lower_age_limit := 9;
upper_age_limit := 56;
if exist client_info_obj then (birthdate, birth_year, patient_gender ):= read last{ClientInfo: birthdate, BirthYearNum, GenderTypeIntlCode REFERENCING client_info_obj}; endif;
if exist birthdate and birth_year > 0 and birthdate is time then patient_age:= (NOW - birthdate) / (1 year); endif;
if (patient_age <= lower_age_limit or patient_age >= upper_age_limit and patient_gender = "F") or (patient_gender = "M") then NotAMom := "true"; endif;
// Carry-forward code using the session object
if CallingEvent = "FormOpen" then
If local_session.has_received_order_worksheet_message <> FALSE then
PregnancyHistory.value := local_session.SessionPregnancyValue;
indications1.value := local_session.SessionIndications1;
indications2.value := local_session.SessionIndications2;
// this_communication.Message := " open " || local_session.SessionPregnancyValue ; this_communication.MessageType := "Informational";
endif;
elseif CallingEvent = "FormClose" then
if PregnancyHistory.value is null then PregnancyHistory.value := local_session.SessionPregnancyValue; endif; // carry forward from form to os
//PregnancyHistory.value := local_session.SessionPregnancyValue;
local_session.SessionIndications1:= indications1.value;
local_session.SessionIndications2:= indications2.value;
local_session.SessionPregnancyValue := PregnancyHistory.value;
if local_session.has_received_order_worksheet_message = FALSE then local_session.has_received_order_worksheet_message := TRUE; else; endif;
// this_communication.Message := " close " ; this_communication.MessageType := "Informational";
endif; // calling event = formopen
//////////////////////// Section for making Indication 1 field mandatory if MI exam is selected ///////////
// Grid Section
MIConcatInd_GR := ();
MIIndList := last of (field_list where field_list.DataItemName = "MLM_MI_Indication_Mand_Grid_List");
MIIndList_val := MIIndList.value;
calc_map_list_Ind := call str_parse with MIIndList_val,"^";
for i in 1 seqto count calc_map_list_Ind do
calc_element_Ind := call str_parse with calc_map_list_Ind [i], "^";
MI_Ind_OccNum := (calc_element_Ind[1]) as number;
MI_Ind_Fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = MI_Ind_OccNum);
MI_Ind_Fld_val := MI_Ind_Fld.Value;
MI_Ind_Fld_val_Sel := MI_Ind_Fld_val.isselected;
MIConcatInd_GR := MIConcatInd_GR, MI_Ind_Fld_val_Sel ;
enddo;
// Checkbox Section Note: Re-uses the same field names as above except for one, MIConcatInd_
MIConcatInd_CB := ();
MIIndList := last of (field_list where field_list.DataItemName = "MLM_MI_Indication_Mand_Checkbox_List");
MIIndList_val := MIIndList.value;
calc_map_list_Ind := call str_parse with MIIndList_val,"^";
for i in 1 seqto count calc_map_list_Ind do
calc_element_Ind := call str_parse with calc_map_list_Ind [i], "^";
MI_Ind_OccNum := (calc_element_Ind[1]) as number;
MI_Ind_Fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = MI_Ind_OccNum);
MI_Ind_Fld_val := MI_Ind_Fld.Value;
MI_Ind_Fld_val_Sel := MI_Ind_Fld_val.isselected;
MIConcatInd_CB := MIConcatInd_CB, MI_Ind_Fld_val_Sel ;
enddo;
MIFound := (true in MIConcatInd_GR) or (true in MIConcatInd_CB) ;
If MIFound = true
then
if NotAMom = "true" then
PregnancyHistory.control_read_only := True;
PregnancyHistory.control_mandatory := False;
else
PregnancyHistory.control_read_only := False;
PregnancyHistory.control_mandatory := True;
endif;
else
PregnancyHistory.control_mandatory := False;
endif;
//////////////////////// Section for making Indication 1 field mandatory (but Pregnancy unnecssary if Ultrasound exam is selected ///////////
// Grid Section
USConcatInd_GR := ();
USIndList := last of (field_list where field_list.DataItemName = "MLM_MI_Indication_Mand_US_Grid_List");
USIndList_val := USIndList.value;
UScalc_map_list := call str_parse with USIndList_val,"^";
for i in 1 seqto count UScalc_map_list do
UScalc_element := call str_parse with UScalc_map_list [i], "^";
USInd_OccNum := (UScalc_element[1]) as number;
USInd_Fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = USInd_OccNum);
USInd_Fld_val := USInd_Fld.Value;
USInd_Fld_val_Sel := USInd_Fld_val.isselected;
USConcatInd_GR := USConcatInd_GR, USInd_Fld_val_Sel ;
enddo;
// Checkbox Section Note: Re-uses the same field names as above except for one, USConcatInd_
USConcatInd_CB := ();
USIndList := last of (field_list where field_list.DataItemName = "MLM_MI_Indication_Mand_US_Checkbox_List");
USIndList_val := USIndList.value;
UScalc_map_list := call str_parse with USIndList_val,"^";
for i in 1 seqto count UScalc_map_list do
UScalc_element := call str_parse with UScalc_map_list [i], "^";
USInd_OccNum := (UScalc_element[1]) as number;
USInd_Fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = USInd_OccNum);
USInd_Fld_val := USInd_Fld.Value;
USInd_Fld_val_Sel := USInd_Fld_val.isselected;
USConcatInd_CB := USConcatInd_CB, USInd_Fld_val_Sel ;
enddo;
USFound := (true in USConcatInd_GR) or (true in USConcatInd_CB) ;
If (USFound = true or MIFound = true)
then indications1.control_mandatory := True;
else
indications1.control_mandatory := False;
endif;
//////////////////// Section for making 3 fields mandatory if an MI with IV Contrast is ordered ///////
IVConcat := ();
IVOrderGrid := last of (field_list where field_list.DataItemName = "MLM_MI_Indication_Mand_IV_Checkbox_List");
IVOrderGridval := IVOrderGrid.value;
calc_map_list3 := call str_parse with IVOrderGridval,"|";
for i in 1 seqto count calc_map_list3 do
calc_element_list3 := call str_parse with calc_map_list3 [i], "|";
IVOccNum := (calc_element_list3[1]) as number;
IVGroup := last of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = IVOccNum);
IVGroupVal := IVGroup.Value;
IVGroupValIsSel := IVGroupVal.isselected;
IVConcat := IVConcat, IVGroupValIsSel ;
enddo;
IVFound := (true in IVConcat) ;
If IVFound = true then
ivyesno1.control_mandatory := True;
ivyesno2.control_mandatory := True;
ivyesno3.control_mandatory := True; else
ivyesno1.control_mandatory := False;
ivyesno2.control_mandatory := False;
ivyesno3.control_mandatory := False;
endif;
//////////////////////// Section for populating Indication fields for all tests in the Order Set //////////
indfieldlist1 := last of (field_list where field_list.DataItemName = "MLM_MI_Indication_List");
indfieldlistval1 := indfieldlist1.value || "," ;
calc_map_list := call str_parse with indfieldlistval1,","; // "A1|A2,B1|B2" (string) becomes "A1|A2" , "B1|B2" (list) // calc_map_list[1] = "A1|A2"
// Create a SQL Where Clause value of the list of Indications fileds ("prefix+A1","prefix+A2","prefix+B1","prefix+B2" etc..)
SQLWhere := "";
for i in 1 seqto count calc_map_list do
calc_element_SQL1 := call str_parse with calc_map_list[i], "^";
SQlWhere := SQLWhere || "{{{SINGLE-QUOTE}}}" || calc_element_SQL1[1] || "{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}" || calc_element_SQL1[2] || "{{{SINGLE-QUOTE}}}" ;
if (i <> count calc_map_list) then SQLWhere := SQLWhere || ","; endif;
enddo;
// Create a list of possible dictionary values via SQL search of indications dictionaries found on this form (prefix+A1+value, etc...)
AllMIInd := ();
AllMIInd := read {"select di.code + v.value from cv3dataitem di "
|| " join cv3userdictionary ud on ud.description = di.dictionaryname "
|| " join cv3userdictionaryvalue v on v.userdictionarycode = ud.code "
|| " where di.code in ( " || SQLWhere || ")" };
// Define the indications fields on the Order Set to be populated
for i in 1 seqto count calc_map_list do
calc_element_list := call str_parse with calc_map_list[i], "^";
field1 := calc_element_list[1] ;
field2 := calc_element_list[2] ;
indpop1 := last of (field_list where field_list.DataItemName = field1 and field_List.Control_MultiFieldOccNum = 1 );
indpop2 := last of (field_list where field_list.DataItemName = field2 and field_List.Control_MultiFieldOccNum = 1 );
// Concatenate the indication field to be populated with the indication value inputted by user then see if this pair matches the list of possibilities
IndFldPlusUserInd1 := field1 || indications1val ;
IndFldPlusUserInd2 := field2 || indications2val ;
if IndFldPlusUserInd1 in AllMIInd then foundone := true ; else foundone := false; endif;
if IndFldPlusUserInd2 in AllMIInd then foundtwo := true ; else foundtwo := false; endif;
// Both Indications 1 and 2 are found
if foundone = true and foundtwo = true then
indpop1.value := indications1val;
indpop2.value := indications2val;
// Indication 1 found and Indication 2 not found
elseif foundone = true and foundtwo = false then
indpop1.value := indications1val;
indpop2.value := " ";
// Indication 1 not found and Indication 2 found
elseif foundone = false and foundtwo = true then
indpop1.value := indications2val;
indpop2.value := " ";
// Both indications 1 and 2 not found (default)
else indpop1.value := " ";
indpop2.value := " ";
endif; // indications 1 and 2 found or not
enddo; // for i in 1 seqto count calc_map_list do
;;
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:

View File

@@ -0,0 +1,244 @@
maintenance:
title: Make read only fields available;;
mlmname: FORM_GENERIC_un_gray;;
arden: version 2;;
version: 4.50;;
institution: St Clair Hospital;;
author: Mary Sieger, Mary.Sieger@stclair.org, 412-942-1194;;
specialist: Eclipsys Corporation;;
date: 2006-10-26;;
validation: testing;;
library:
purpose: Based on a value provided in one field, make another field AVAILABLE.
;;
explanation: This generic MLM can be called from several order forms:
- LAB Chem Blood Gas
- (others?)
If a particular value is placed in a certain field of a certain form, specified by
the configuration list below, then another field, also in the list, will be made to
be available (i.e. un-grayed).
Trigger on formopen or fieldchange.
Rules:
Use lists of
forms,
fields to test on the form,
values to test for,
field to make available (if the value in the other field is present)
change history
2.11.2007 DJW added a new form, LAB ChemBloodGas_Tmp.
5.29.2015 MJP CSR#33459 added new fields for High Flow
;;
keywords: Called MLMs, Form fields, generic, field test, read-only
;;
knowledge:
type: data-driven;;
data:
/***********************Make Changes To Spelling And Flags In This Section************************/
//NOTE: THE RELATIVE ORDER OF ITEMS MUST BE MAINTAINED WITHIN LISTS!!!
//MUST HAVE THE FOLLOWING ORDER FOR EACH ELEMENT ITEM:
//"FORM_NAME|FIELD_NAME_TO_TEST|VALUEs_TO_TEST_FOR|FIELD_TO_MAKE_NOT_READ_ONLY"
form_map_list :=
("LAB Chem Blood Gas|LAB_RC_BGCMT_RespAerosolMode|(any_value)|LAB_RC_BGCMT_LV_RespAerosolConc"
,"LAB Chem Blood Gas|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_RespMode_BIPAP_CPAP"
,"LAB Chem Blood Gas|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespIPAPcmH2O"
,"LAB Chem Blood Gas|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespEPAPcmH2O"
,"LAB Chem Blood Gas|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespBIPAPCPAPO2"
,"LAB Chem Blood Gas|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespBIPAPCPAPLPM"
,"LAB Chem Blood Gas|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_VT"
,"LAB Chem Blood Gas|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_O2ConcFIO2"
,"LAB Chem Blood Gas|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_PEEP"
,"LAB Chem Blood Gas|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_PressureSupport"
,"LAB Chem Blood Gas|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_Rate"
,"LAB Chem Blood Gas|LAB_RC_BGCMT_LV_HiFloNCLPM|(any_value)|LAB_RC_BGCMT_LV_HiFloNC%"
,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_RespAerosolMode|(any_value)|LAB_RC_BGCMT_LV_RespAerosolConc"
,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_RespMode_BIPAP_CPAP"
,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespIPAPcmH2O"
,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespEPAPcmH2O"
,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespBIPAPCPAPO2"
,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_BIPAP_CPAP|(any_value)|LAB_RC_BGCMT_LV_RespBIPAPCPAPLPM"
,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_VT"
,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_O2ConcFIO2"
,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_PEEP"
,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_PressureSupport"
,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_LV_RespVentMode|(any_value)|LAB_RC_BGCMT_LV_RespVent_Rate"
,"LAB ChemBloodGas_Tmp|LAB_RC_BGCMT_LV_HiFloNCLPM|(any_value)|LAB_RC_BGCMT_LV_HiFloNC%"
,"YOUR_FORM_NAME_HERE|YOUR_TEST_FIELD_HERE|VALID_VAL1,VALID_VAL2|UN_GRAY_FIELD_HERE"
);
/**************************************************************************************JAB********/
// 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;
//Initialize MLM pointers:
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
chk_overdue_time := MLM {{{SINGLE-QUOTE}}}overdue_req_time{{{SINGLE-QUOTE}}};
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingForm := this_form.name;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
if called_by_editor then
CallingForm := "LAB Chem Blood Gas";
CallingEvent := "FieldChange";
CallingField := "LAB_RC_BGCMT_RespAerosolMode";
endif;
for i in 1 seqto count form_map_list do
// initialize vars:
visible_field := null;
trigger_field := null;
// parse the form mapper:
form_element_list := call str_parse with form_map_list[i], "|";
test_form_name := form_element_list[1]; //Lookup form name from map list
// Test for proper form
if CallingForm = test_form_name then
test_visible_field := form_element_list[4]; //Lookup visible field from map list
visible_field := first of
(field_list where field_list.DataItemName = test_visible_field);
// Set open form defaults
if exists visible_field then
test_field := form_element_list[2]; //Lookup test field from map list
trigger_field := first of
(field_list where field_list.DataItemName = test_field);
//check for {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} fields
if visible_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then
Right_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Right" );
Superficial_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Superficial" );
Left_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Left" );
Deep_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Deep" );
endif;
// Test for proper field
if exists trigger_field then
//Lookup list of valid values for the test field
test_val_list := call str_parse with form_element_list[3], ",";
//Check for time field
if trigger_field.dataitemname = "RequestedTime"
and "overdue" is in test_val_list then
if exists trigger_field.value.reqtimevalue then
time_type := "scheduled";
time_val := trigger_field.value.reqtimevalue;
else
time_type := "coded";
time_val := trigger_field.value.reqtimecode;
endif;
// check for overdue time
time_is_overdue := call chk_overdue_time
with time_val, time_type;
endif;
if ((trigger_field.value as string) is in test_val_list)
or ("(any_value)" is in test_val_list and trigger_field.value is not null)
or time_is_overdue then
// Make the field UN-GRAYED (but NOT Mandatory!)
visible_field.control_read_only := false;
// make {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} settings writable
if visible_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then
Right_box.control_read_only := False;
Superficial_box.control_read_only := False;
Left_box.control_read_only := False;
Deep_box.control_read_only := False;
else
Right_box.control_read_only := true;
Superficial_box.control_read_only := True;
Left_box.control_read_only := True;
Deep_box.control_read_only := True;
// Right_box.value := null;
// Superficial_box.value := null;
// Left_box.value := null;
// Deep_box.value := null;
endif;
else
visible_field.control_read_only := true;
visible_field.value := "";
if visible_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then
Right_box.control_read_only := true;
Superficial_box.control_read_only := True;
Left_box.control_read_only := True;
Deep_box.control_read_only := True;
Right_box.value := "";
Superficial_box.value := "";
Left_box.value := "";
Deep_box.value := "";
endif;
endif; // (trigger_field.value as string) is in test_val_list
/*
// FOR DEBUGGING PURPOSES: display a message to the user
this_communication.Message :=
"callingform = "|| callingform
|| "\nCallingEvent = " || CallingEvent
|| "\ntest_form_name = " || test_form_name
|| "\ntest_field = " || test_field
|| "\ntest_visible_field = " || test_visible_field
|| "\ntrigger_field = " || trigger_field.dataitemname
|| "\nvisible_field = " || visible_field.dataitemname
|| "\ntrigger_field.value = " || trigger_field.value
|| "\ntest_val_list = " || test_val_list
|| "\nvisible_field = " || visible_field
|| "\ntime_is_overdue = " ||time_is_overdue;
this_communication.MessageType := "Informational";
*/
endif; // exists trigger_field
endif; // exists visible_field
endif; // CallingForm = test_form_name
enddo; // for i in 1 seqto count form_map_list
;;
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:

View File

@@ -0,0 +1,107 @@
maintenance:
title: FORM_G_CODE_CHARGES;;
mlmname: FORM_G_CODE_CHARGES;;
arden: version 2.5;;
version: 5.50;;
institution: St Clair Charger MLM;;
author: Juliet Johns, Allscripts, Inc;;
specialist: Maria Pest, Allscripts, Inc;;
date: 2013-04-05;;
validation: testing;;
library:
purpose: This MLM requires checkboxes selected.
;;
explanation: This MLM will enforces one and only one checkbox selected.
;;
keywords: Called MLMs, Form fields, G Code, Charges
Change History
2013.04.05 JML Original Code Creation
;;
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;
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := FALSE;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormType := this_communication.FormType;
Percentage_List := ("CH",
"CI",
"CJ",
"CK",
"CL",
"CM",
"CN");
if (CallingEvent = "FieldChange") then
fldCount := 0;
for i in 1 seqto (count Percentage_List) do
Percent_fld_name := "CHG_GMOD(" || Percentage_List[i] || ")";
Percent_fld := first of (field_list WHERE field_list.DataItemName = Percent_fld_name);
if (Percent_fld.Value = true AND fldCount = 0) then
fldCount := fldCount + 1;
elseif (Percent_fld.Value = true AND fldCount = 1) then
Percent_fld.Value := false;
endif;
enddo;
elseif (CallingEvent = "FormClose") then
fldCount := 0;
for i in 1 seqto (count Percentage_List) do
Percent_fld_name := "CHG_GMOD(" || Percentage_List[i] || ")";
Percent_fld := first of (field_list WHERE field_list.DataItemName = Percent_fld_name);
if (Percent_fld.Value = true AND fldCount = 0) then
fldCount := fldCount + 1;
endif;
enddo;
if (fldCount = 0) then
this_communication.DisplayForm := "Yes";
this_communication.Message := "You must select at least one percentage checkbox.";
this_communication.MessageType := "Error";
endif;
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:

View File

@@ -0,0 +1,355 @@
maintenance:
maintenance:
title: Haloperidol IV Order on Monitored Bed Check;;
mlmname: Form_Haloperidol_IV_Orders;;
arden: version 2;;
version: 5.50;;
institution: St. Clair Hospital;;
author: Teresa M. Spicuzza ;;
specialist: Eclipsys Corporation;;
date: 2012-05-23;;
validation: testing;;
library:
purpose: Prohibit ordering of Haldol by IV Push or IVPB on a non-nmonitored unit unless being ordered for end of life care.
.
;;
explanation: This MLM will hard stop user from entering an order for Haldol by IV push or IVPB if patient is not on a monitored unit and not ordered for end of life care..
Change history
05.23.2012 TS Created CSR 30783 To Production on 9/25/2012
03.13.2015 TS Modified for new delirium protocol to enable ordering of IV
Haldol if dose is less than 2mg. CSR 33144
03.18.2015 TS Modified alert messages to note "doses greater than 2 mg" CSR 33144
04.24.2015 TS Modified to inlcude monitoring admin message for IV administration of Haldol CSR 33144
05.07.2015 TS Modified to write monitoring admin message for IV administration of Haldol to a new
data item to eliminate removing user typed instructions. Ticket 1730634
11.27.2018 TS CSR 37432 Modified for Post Anesthesia Orders - if haldol IV greater than 2mg
is ordered alert user that the patient will need a monitored bed for 24 hours
and create an order for Cardiac Monitor to be added to worksheet.
;;
keywords:
Haldol, Haloperidol, IV Push;
;;
knowledge:
type: data-driven;;
data:
// This MLM is passed three arguments, of types
// communication_type, form_type and client info object respectively.
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
(this_communication, // Communication object
this_form, // Form object
client_info_obj // Arden ClientInfo object
) := argument;
CallingEvent := this_communication.CallingEvent;
CallingField :=this_communication.CallingFieldName;
ClientGuid := this_communication.ClientGUID;
ClientVisitGuid := this_communication.ClientVisitGUID;
ChartGuid := this_communication.ChartGuid;
Primary_object := this_communication.PrimaryObj;
OrderSetName := Primary_Object.OrderSetName;
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
// Define fields for MLM use
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
CRLF:= CR||LF;
HaldolOrder := last of (field_list where field_list.DataItemName = "PRX_Generic_CB");
HaldolOrder_value := HaldolOrder.value;
OrderRoute := last of (field_list where field_list.DataItemName = "OrderRouteCode");
OrderRoute_value := OrderRoute.value;
Dose := last of (field_list where field_list.DataItemName = "DosageLow");
Dose_value := Dose.value;
Indication := last of (field_list where field_list.DataItemName = "NUR_Nonchemical Restraint Ind");
Indication_value := Indication.value;
AdminInst := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
CardMonInst := last of (field_list where field_list.DataItemName = "PRX_CardiacMonitorInst");
ReasonMessage := "";
CardMonMsg := "Follow Cardiac Monitoring Requirements for IV Haloperidol";
MonitoringMsg := "Cardiac Monitoring requirements for IV Haloperidol" || CRLF ||
"1. If Baseline QTc < 450 msec and the cumulative dose is < or = 2mg/24 hours then cardiac monitoring is NOT required." || CRLF ||
"2. If Baseline QTc < 450 msec and the cumulative dose exceeds 2 mg/24 hours then cardiac monitoring IS required." || CRLF ||
"3. If Baseline QTc is 450-499 msec then cardiac monitoring IS required." || CRLF ||
"4. If Baseline QTc is > = 500 msec then IV haloperidol should NOT be used." ;
NoMsg := "";
CreateMonitorOrder := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_GENERAL_ORDER_ON_WORKSHEET{{{SINGLE-QUOTE}}};
If OrderSetName matches pattern "Anesthesia Post Op Orders%" then
// Get Current worksheet info ***** START *****
// Get the currently logged on user
Active_ClientVisitGUID := this_communication.ClientVisitGUID;
Active_OrderGUID:= PrimaryObjdetail.GUID;
Active_SignificiantDtm:= Now;
location_guid := read last {"select CurrentLocationGUID from CV3ClientVisit where GUID=" || SQL(Active_ClientVisitGUID)};
//TRY
try
//-----------------------------------------------------------
// Retrieve current order entry batch.
// The companion order can be added only if the parent order
// belongs to the order entry batch
// object owned by the OrderEntryWorksheet.
//-----------------------------------------------------------
worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
if worksheetInfo is NULL
OR "OrderEntryWorksheet" <> (worksheetInfo.OrderBatchOwner as String) then
z:=0;
endif;
//------------------------------------------------------------
// Get the .NET version of the Client Visit object.
// Needed to create new ObjectsPlus object
//------------------------------------------------------------
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((Active_ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
//-----------------------------------------------------------
// Check the order entry worksheet. If there are no entries
// already on the worksheet set the initial values for
// the worksheet.
//-----------------------------------------------------------
if worksheetInfo.UnsubmittedOrdersCount = 0 then
// If there are no orders on the worksheet set
// defaults that will be used to create the orders
WSSessionType := "Standard";
WSSessionReason := "Orders created by MLM";
WSRequestedBySource := "";
// Set the session type and reason on the worksheet
void := call worksheetInfo.SetSessionType with (WSSessionType, WSSessionReason);
// Set the requesting source string
worksheetInfo.RequestedBySource := WSRequestedBySource;
//Get the current user as the default care provider
WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById
with ( user_IDType, user_IDCode );
//Set the requesting provider
worksheetInfo.RequestedBy := WSRequestedBy_obj;
// Get the location that will be used for the orders.
WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
//Set the expected release location group
worksheetInfo.ExpectedReleaseLocationGroup := WSlocation_obj;
//Dispose RequestedBy CareProvider
if( WSRequestedBy_obj is NOT NULL ) then
void := call WSRequestedBy_obj.Dispose;
WSRequestedBy_obj:= null;
endif;
//Dispose ExpectedReleaseLocationGroup
if( WSlocation_obj is NOT NULL ) then
void := call WSlocation_obj.Dispose;
WSlocation_obj:= null;
endif;
else
//If there are orders on the worksheet retrieve the default values
// on the worksheet.
// These values are not required for this sample MLM however they
// contain useful information that can be used in the logic of an
// MLM.
WSSessionType := worksheetInfo.SessionType;
WSSessionReason := worksheetInfo.SessionReason;
WSRequestedBySource := worksheetInfo.RequestedBySource;
WSRequestedBy_obj := worksheetInfo.RequestedBy;
WSlocation_obj := worksheetInfo.ExpectedReleaseLocationGroup;
endif;
endtry;
catch Exception ex
error_occurred := true;
error_message := "{{+R}}Common Data:{{-R}}\n" ||
ex.Message || "\n\n";
if( worksheetInfo is NOT NULL ) then
void := call worksheetInfo.Dispose;
worksheetInfo:= null;
endif;
if( client_visit_obj is NOT NULL ) then
void := call client_visit_obj.Dispose;
client_visit_obj:= null;
endif;
if( WSRequestedBy_obj is NOT NULL ) then
void := call WSRequestedBy_obj.Dispose;
WSRequestedBy_obj:= null;
endif;
if( WSlocation_obj is NOT NULL ) then
void := call WSlocation_obj.Dispose;
WSlocation_obj:= null;
endif;
// If unable to initialize starting data, do not continue
// with the creation of any orders.
// Still conclude true as the error message needs to
// be displayed as an error.
//conclude true;
endcatch;
Order_Creation_Reason := "Monitored Bed Required" ;
order_type := "Other";
Order_Catalog_Item := "Monitor: Cardiac";
endif;
If CallingEvent= "FieldChange" and CallingField = "DosageLow" and
HaldolOrder_value = True and (OrderRoute_value = "IV Push" or OrderRoute_value = "IVPB") and
OrderSetName matches pattern "Anesthesia Post Op Orders%" then
If dose_value > 2 then
dialogResult1 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Haloperidol doses > 2 mg require continuous ECG monitoring" ||
"\n beyond the PACU, thus your patient will need to go to a " ||
"\n monitored bed for 24 hours." ||
" \n\n Do you wish to proceed with the haloperidol dose > 2 mg? ? ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
if((dialogResult1 as string) = "Yes") then
AdditionalInfo := "Haloperidol doses > 2 mg require continuous ECG monitoring " ||
"beyond the PACU. Patient will need to go to a " ||
"monitored bed for 24 hours." ;
Obj_Error_occurred, Obj_error_message := Call CreateMonitorOrder with
order_type,
client_visit_obj, // ClientVisit ObjectsPlus object
Order_catalog_item, // CatalogMasterItem ObjectsPlus object
order_Creation_Reason, // string CreateReason
worksheetInfo,
AdditionalInfo,
WSRequestedBy_obj, // RequestingProvider ObjectsPlus object
WSRequestedBySource, // string requestingSource(must be in dict)
WSSessionType, // string SessionType
WSSessionReason, // string SessionReason
WSLocation_obj;
else
dose.value := "";
endif;
endif;
endif;
If HaldolOrder_value = True and (OrderRoute_value = "IV Push" or OrderRoute_value = "IVPB") and
OrderSetName not in ("Anesthesia Post Op Orders", "Anesthesia Post Op Orders - Supplemental") then
If Indication_value <> "End of Life Agitation" then
AdminInst.value := CardMonMsg;
CardMonInst.value := MonitoringMsg;
else
AdminInst.value :=NoMsg;
CardMonInst.value := NoMsg;
endif;
else;
AdminInst.value :=NoMsg;
CardMonInst.value := NoMsg;
endif;
If HaldolOrder_value = True and (OrderRoute_value = "IV Push" or OrderRoute_value = "IVPB") and dose_value > 2 then
/*
Monitored Bed Accomodation Codes:
03 CCU
06 SP/Monitored
02 ICU
14 CVSU
04 IMC
*/
MonitoredBed := ("03 CCU","06 SP/Monitored","02 ICU","14 CVSU", "04 IMC");
// Get patient current accomodation
CurrentAccom := read last
{"Select ac.Code "
||" From CV3ClientVisitLocation cvl"
||" Join SXAAMAccommodation ac on ac.AccommodationID = cvl.AccommodationID "
||" Where ClientGuid = " || SQL(ClientGuid)
||" and ClientVisitGuid = " || SQL(ClientVisitGuid)
||" and cvl.Status = {{{SINGLE-QUOTE}}}CUR{{{SINGLE-QUOTE}}}" };
// Get patient current location
CurrentLocation := read last
{"Select CurrentLocation "
||" From cv3Clientvisit "
||" Where ClientGuid = " || SQL(ClientGuid)
||" and Guid = " || SQL(ClientVisitGuid)
||" and VisitStatus = {{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}}" };
If CurrentAccom in MonitoredBed or Indication_value = "End of Life Agitation" or CurrentLocation matches pattern "ER%" or dose_value <= 2 or OrderSetName matches pattern "Anesthesia Post Op Orders%" then
continueorder := "true";
else
reasonmessage := "Continuous ECG monitoring is required for Haloperidol greater than 2mg administered by IV Push, except for {{{SINGLE-QUOTE}}}End of Life{{{SINGLE-QUOTE}}} Care. You cannot proceed with this order.";
alloworder := "no";
continueorder := "false";
endif;
If continueorder = "true" and OrderRoute_value = "IV Push" then
If dose_value <= 20 then
If CurrentLocation matches pattern "ER-%" then
alloworder := "warn";
reasonmessage := "Continuous ECG monitoring is required for Haloperidol greater than 2mg administered by IV Push";
else
alloworder := "yes";
endif;
else alloworder := "no";
reasonmessage := "Doses of 20mg or greater should be diluted in 50 ml of D5W and given as an infusion. You cannot proceed with this order.";
endif;
endif;
endif;
If alloworder = "no" then
this_communication.DisplayForm := "yes";
this_communication.Message := ReasonMessage;
this_communication.MessageType := "Error";
endif;
If alloworder = "warn" then
this_communication.DisplayForm := "yes";
this_communication.Message := ReasonMessage;
this_communication.MessageType := "Informational";
endif;
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns two parameters, of types
//communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,102 @@
maintenance:
title: Health Issues entered from Order Form ;;
mlmname: Form_Health_Issue_Entered_From_Order_Form;;
arden: version 2.5;;
version: 5.50;;
institution: St. Clair Hospital;;
author: ;;
specialist: ;;
date: 2011-05-14;;
validation: testing;;
library:
purpose:
Called from any Form MLM.
When a health issue box is checked, the MLM the corresponding dropdown box is enabled.
When a health issue box is unchecked, the MLM clears the data from the corresponding dropdown box and enables
the other checkboxes
;;
explanation: This MLM was written to be called forms and Order Set from which Health Issues are entered.
Change history
05.13.2011 DW Created
07.12.2011 DW Adjusted for pre-filled fields on OS
01.23.2013 SH Added logic to end of MLM to update the "Selected Time" to the current time when closing the form [csr#: 31231]
10.01.2015 JML CSR # 23359: Copied to Production
03.11.2016 DW CSR# 34077 Transitional Care order set
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(this_communication, // Communication object
this_form
) := argument;
//OBJ+ libraries
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Assigns fields passed in the Form object to the Field object
formclose_admittime_update := mlm{{{SINGLE-QUOTE}}}FORM_FUNC_CPOE_OS_MAPCURTIME{{{SINGLE-QUOTE}}};
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
orderroletype:= this_communication.primaryobj.enterrole;
orderrole:= orderroletype matches pattern "%Physician%";
MD_Box := last of (field_list where field_list.DataItemName = "MLM_Physician_Mandatory_HI");
HI_AdmitDiag := last of ( field_list where field_list.DataItemName = "OBJ_PLUS_ADM_Health Issue");
HI_AdmitDiag_Dictionary_List := last of ( field_list where field_list.DataItemName = "HI List 3");
// *** Open / Close Section ***
If CallingEvent= "FormOpen" and orderrole = true then
MD_Box.control_mandatory := true;
endif;
If CallingEvent= "FormClose" and orderrole = true then
MD_Box.control_mandatory := true;
if ( HI_AdmitDiag.Value is not null OR HI_AdmitDiag.Value <> "" OR HI_AdmitDiag_Dictionary_List.Value is not null ) then
MD_Box.control_mandatory := false;
endif;
else
MD_Box.control_mandatory := false;
endif;
curtime := read last {"SELECT left(CONVERT(VARCHAR(8),GETDATE(),108),5)"};
if CallingEvent = "FormClose" and orderrole = true then
RequestedTime := first of (field_list.Value WHERE field_list.DataItemName="RequestedTime");
RequestedTime.ReqTimeCode := "Start Time";
RequestedTime.ReqTimeValue := curtime;
endif;
;;
evoke: /* Call MLM */
;;
logic:
conclude true;
;;
action:
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,514 @@
maintenance:
title: Cardiac Protocol Heparin Dosing ;;
mlmname: FORM_Heparin_Cardiac_Protocol;;
arden: version 2;;
version: 4.50;;
institution: St. Clair Hospital ;;
author: Teresa Spicuzza;;
specialist: Robert Spence, St. Clair Hospital ;;
date: 2008-06-25;;
validation: testing;;
library:
purpose: Calculates Heparin Dose based on Patient Weight.
;;
explanation: On any event, this MLM gathers information from the
fields on the Weight-based heparing order entry form and sets a
fatal error flag is needed.
Processing continues only if there are no errors on the form.
On the FormOpen event, the MLM will transfer the value of hte rate field
to the current rate field.
On the FieldChange event the fields "Current Rate Action" and "Adjustment in
units/kg/hr" are considered.
Form to which to attach: PRX_IvDrpHepWtBased
Calling Event: FormOpen
Calling Event: FieldChange
Calling Field: PRX_HepWbRateAdjust
Calling Field: PRX_HepChgValue
History
07/18/2008 RS Added logic to cap the variable used for calculating the Rate ml/hr
11/21/2012 TMS Added PRX_HepWbCurrentRate as call field to logic to start calculation of adjustment and new rate - Ticket 154292
07.23.2019 TMS CSR 37676 - Change log_execution_info to false per upgrade analysis.
;;
keywords: Heparin, dosage,;
;;
knowledge:
type: data-driven;;
data:
/*-----------------------------------------------------------------------*/
/* This MLM receives three objects from the system, of types shown below */
/*-----------------------------------------------------------------------*/
(this_comm, // Communication type object
this_form, // Form type object
client_obj // Arden ClientInfo type object
) := argument;
/************* Make Changes To Spelling And Flags In This Section *************/
/*------------------------------------*/
/* Set to true if a CDS log is needed.*/
/*------------------------------------*/
log_execution_info := false;
/*-------------------------*/
/* set flags and variables */
/*-------------------------*/
fatal_error := false;
hep_soln_conc := 50; // "standard" concentration in units/ml
Measurements_di := "CombinedMeasurements";
APTT_val_sec_di := "PRX_HepWtBase_APTTvalue";
curr_rate_u_h_di := "PRX_HepWbCurrentRate";
curr_rate_adj_di := "PRX_HepWbRateAdjust";
adj_val_u_h_di := "PRX_HepChgUnitsPerHr";
calc_rate_di := "PRX_Generic_CB";
iv_rate_u_h_di := "PRX_DRIPINIT";
iv_rate_ml_comp := "OrderIVRate";
route_di := "OrderRouteCode";
// iv_rate_ml_h_di := "PRX_DRIPINIT";
// iv_rate_uom_di := "PRX_DRIPINITUOM";
/******************************************************************************/
/*--------------------------*/
/* set up testing variables */
/*--------------------------*/
if called_by_editor then
visit_obj := read last {ClientVisit: THIS};
// client_obj := read last {ClientInfo: THIS};
endif;
/*-------------------------------------------*/
/* get information from Communication object */
/*-------------------------------------------*/
called_by := this_comm.CallingEvent;
call_field := this_comm.CallingFieldName;
if called_by_editor then
client_guid := visit_obj.clientguid;
visit_guid := visit_obj.GUID;
chart_guid := visit_obj.chartguid;
orderId := "1000002689073001";
called_by := "FormOpen";
else
client_guid := this_comm.ClientGUID;
visit_guid := this_comm.ClientVisitGUID;
chart_guid := this_comm.ChartGuid;
orderid := this_comm.ItemID;
endif;
/*------------------------------------------------------------*/
/* Assign pointers to the Field list and to individual fields */
/*------------------------------------------------------------*/
field_list := this_form.fields;
comb_ht_wt_fld := first of (field_list
where field_list.DataItemName = Measurements_di);
APTT_val_sec_fld := first of (field_list
where field_list.DataItemName = APTT_val_sec_di);
curr_rate_u_h_fld := first of (field_list
where field_list.DataItemName = curr_rate_u_h_di);
curr_rate_adj_fld := first of (field_list
where field_list.DataItemName = curr_rate_adj_di);
adj_val_u_h_fld := first of (field_list
where field_list.DataItemName = adj_val_u_h_di);
calc_rate_fld := first of (field_list
where field_list.DataItemName = calc_rate_di);
iv_rate_u_h_fld := first of (field_list
where field_list.DataItemName = iv_rate_u_h_di);
iv_rate_ml_h_fld :=first of (field_list
where field_list.DataItemName = iv_rate_ml_comp );
EdLocFld := first of (field_list
where field_list.DataItemName = "ED Location");
FromOrderSet := first of (field_list
where field_list.DataItemName = "MLM_From Order Set");
/*--------------------------------------*/
/* RS: 06/12 get location */
/*--------------------------------------*/
If (called_by = "FormOpen") or (call_field = "MLM_From Order Set") then
//Retrieve Patient{{{SINGLE-QUOTE}}}s Current Location
LocName:= read last
{"SELECT currentlocation "
|| " FROM cv3clientvisit "
|| " WHERE ClientGUID = " || SQL(client_guid )
|| " And GUID = " || SQL(visit_guid)};
EdLocFld.Value := LocName;
ApttVal := read last
{"Select top 1 bo.value "
|| " From cv3order as o with (nolock) "
|| " join cv3basicobservation as bo with (nolock) "
|| " on o.clientguid = bo.clientguid "
|| " and o.chartguid = bo.chartguid "
|| " and o.guid = bo.orderguid "
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|| " and bo.Active = 1 "
|| " And bo.IsHistory = 0 "
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|| " and ocmi.active = 1 "
|| " and ocmi.name = {{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}} "
|| " where o.clientguid = " || SQL(client_guid)
|| " and o.chartguid = " || SQL(chart_guid)
|| " and o.performeddtm >= (DATEADD(hour, -28, getdate())) "
|| " order by o.performeddtm desc "
};
CompVal := ApttVal As Number;
APTT_val_sec_fld.VALUE := CompVal;
If (FromOrderSet.Value = True) then
orderlist := read
{" Select guid from cv3ordercatalogmasteritem "
|| " where (name = {{{SINGLE-QUOTE}}}Heparin 25,000 Units+ D5W 500ml{{{SINGLE-QUOTE}}}) or "
|| " (name = {{{SINGLE-QUOTE}}}Heparin 25,000 Units+ 0.9% NaCl 500ml{{{SINGLE-QUOTE}}}) "
|| " and active = 1 "
};
orderid1:=First(orderlist);
orderid2:=Last(orderlist);
OldRate := read last
{" Select top 1 oud.value "
|| " from cv3order as o with (nolock) "
|| " join cv3orderuserdata as oud with (nolock) "
|| " on oud.orderguid= o.guid "
|| " and oud.userdatacode = {{{SINGLE-QUOTE}}}PRX_DRIPINIT{{{SINGLE-QUOTE}}} "
|| " where o.clientguid = " || SQL(client_guid)
|| " and o.chartguid = " || SQL (chart_guid)
|| " and (o.ordercatalogmasteritemguid = " || SQL(orderid1)
|| " or o.ordercatalogmasteritemguid = " || SQL(orderid2) || ") "
|| " and o.requesteddtm <= getdate() "
|| " order by o.requesteddtm desc, o.createdwhen desc"
};
else
OldRate := read last
{" Select top 1 oud.value "
|| " from cv3order as o with (nolock) "
|| " join cv3orderuserdata as oud with (nolock) "
|| " on oud.orderguid= o.guid "
|| " and oud.userdatacode = {{{SINGLE-QUOTE}}}PRX_DRIPINIT{{{SINGLE-QUOTE}}} "
|| " where o.clientguid = " || SQL(client_guid)
|| " and o.chartguid = " || SQL (chart_guid)
|| " and o.ordercatalogmasteritemguid = " || SQL(orderid)
|| " and o.requesteddtm <= getdate() "
|| " order by o.requesteddtm desc, o.createdwhen desc"
};
endif;
/* test := (curr_rate_adj_fld.value is null) or (curr_rate_adj_fld.Value <> "Initial") ;
this_comm.Message := "Old Rate Set to " || OldRate
|| "\n\n Rate Adjust set to \n" || curr_rate_adj_fld.Value
|| "If statement would return " ||test;
this_comm.MessageType := "Error";
*/
If (curr_rate_adj_fld.value is null) or (curr_rate_adj_fld.Value <> "Initial") then
curr_rate_u_h_fld.value := OldRate;
iv_rate_ml_h_fld.control_read_only := True;
iv_rate_u_h_fld.control_read_only := True;
else
curr_rate_u_h_fld.value := NULL;
endif;
// now for the suggested calculations
/* test := curr_rate_adj_fld.Value <> "Initial" ;
this_comm.Message := "Called by " || called_by
|| "\nCalling field " || call_field
|| "\nexists APTT_val_sec_Fld " || exists APTT_val_sec_Fld
|| "\nexists curr_rate_u_h_fld " || exists curr_rate_u_h_fld
|| "\ncurr_rate_adj_fld.Value is" || curr_rate_adj_fld.value ;
this_comm.MessageType := "Error";
curr_rate_adj_fld.value := "Increase";
*/
If (exists APTT_val_sec_Fld)
and (exists curr_rate_u_h_fld) then
If (curr_rate_adj_fld.Value <> "Initial" or curr_rate_adj_fld.Value is null) then
If CompVal < 66 then
curr_rate_adj_fld.value := "Increase";
adj_val_u_h_fld.value := 200;
elseif (CompVal >= 66) and (CompVal <= 76) then
curr_rate_adj_fld.value := "Increase";
adj_val_u_h_fld.value := 100;
elseif (CompVal >= 77) and (CompVal <= 115) then
curr_rate_adj_fld.value := "No Change";
adj_val_u_h_fld.value := null;
elseif (CompVal >= 116) and (CompVal <= 134) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 100;
elseif (CompVal >= 135) and (CompVal <= 154) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 200;
elseif (CompVal > 154) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 200;
fatal_error := true;
this_comm.Message := "Please Note that recent APTT above 154 Seconds \n\n"
||"Please STOP HEPARIN INFUSION for 1 hour... \n\n"
||"Then resume at new rate as calculated on this order";
this_comm.MessageType := "Error";
endif;
endif;
else
curr_rate_adj_fld.value := null;
adj_val_u_h_fld.value := null;
endif;
endif;
If EdLocFld.Value matches pattern "ER%" then
IsED := True;
else
IsED := False;
endif;
/*------------------------*/
/* get values from fields */
/*------------------------*/
if exists comb_ht_wt_fld then
// comb_ht_wt_fld.control_read_only := true;
comb_ht_wt_val := comb_ht_wt_fld.Value;
wt := comb_ht_wt_val.weight;
ht := comb_ht_wt_val.height;
wt_type := comb_ht_wt_val.weighttype;
bsa := comb_ht_wt_val.bsa;
bmi := comb_ht_wt_val.bmi;
endif;
if exist APTT_val_sec_fld then
APTT_val_sec_fld.Control_Mandatory := false;
endif;
if exist curr_rate_u_h_fld then
if curr_rate_u_h_fld.Value is null then
curr_rate_u_h := 0;
else
curr_rate_u_h := curr_rate_u_h_fld.Value;
endif;
endif;
if exist curr_rate_adj_fld then
adj_action := curr_rate_adj_fld.Value;
endif;
if exist adj_val_u_h_fld then
adj_amt_u_h := adj_val_u_h_fld.Value as number;
endif;
if exist iv_rate_u_h_fld then
iv_rate_u_h := iv_rate_u_h_fld.Value;
// iv_rate_amt := iv_rate_u_h.AMOUNT as number;
// iv_rate_uom := iv_rate_u_h.UOM;
endif;
if exist iv_rate_ml_h_fld then
iv_rate_ml_h := iv_rate_ml_h_fld.Value;
endif;
/*----------------------------------*/
/* process form fields and settings */
/* only if no errors are found */
/*----------------------------------*/
if not fatal_error then
// if (called_by = "FormOpen") or (call_field = "MLM_From Order Set" ) then
// curr_rate_u_h_fld.Control_Read_Only := false;
// curr_rate_u_h_fld.Value := iv_rate_u_h.Amount;
// curr_rate_u_h_fld.Control_Read_Only := true;
/// APTT_val_sec_fld.Control_Mandatory := false;
// APTT_val_sec_fld.Value := null;
If (call_field = "PRX_DRIPINIT") then
marker:=true;
checkrate := iv_rate_u_h_fld.Value ;
if ((floor (checkrate /50)) <> (ceiling(checkrate /50)) or (checkrate is null) or (checkrate =0)) then
this_comm.Message := "Your IV Rate Must Be Divisible by 50" || "\n\n" ||
"You Entered: " || checkrate;
this_comm.MessageType := "Error";
iv_rate_u_h_fld.value:=null;
iv_rate_ml_h.Amount := null;
else
iv_rate_ml_h.Amount := checkrate /50;
endif;
// TMS added PRX_HepWbCurrentRate to logic to prevent looping when current rate is changed
// elseif (call_field ="PRX_HepWtBase_APTTvalue") and (curr_rate_adj_fld.value is null or curr_rate_adj_fld.Value <> "Initial") then
elseif ((call_field ="PRX_HepWtBase_APTTvalue") or (call_field = "PRX_HepWbCurrentRate")) and (curr_rate_adj_fld.value is null or curr_rate_adj_fld.Value <> "Initial") then
iv_rate_u_h_fld.Value:= null;
iv_rate_ml_h.Amount := null;
If (curr_rate_adj_fld.value is null or curr_rate_adj_fld.Value <> "Initial") then
APTT_val_sec_fld.Control_Mandatory := true;
curr_rate_adj_fld.value := null;
adj_val_u_k_h_fld.value := null;
endif;
CompVal := APTT_val_sec_fld.VALUE As Number;
If CompVal is not null then
If (exists APTT_val_sec_Fld) and (exists curr_rate_u_h_fld) then
If CompVal < 66 then
curr_rate_adj_fld.value := "Increase";
adj_val_u_h_fld.value := 200;
elseif (CompVal >= 66) and (CompVal <= 76) then
curr_rate_adj_fld.value := "Increase";
adj_val_u_h_fld.value := 100;
elseif (CompVal >= 77) and (CompVal <= 115) then
curr_rate_adj_fld.value := "No Change";
adj_val_u_h_fld.value := null;
elseif (CompVal >= 116) and (CompVal <= 134) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 100;
elseif (CompVal >= 135) and (CompVal <= 154) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 200;
elseif (CompVal > 154) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 200;
endif;
endif;
else
curr_rate_adj_fld.value := null;
adj_val_u_k_h_fld.value := null;
endif;
elseif (call_field = calc_rate_di) or (called_by = "FormOpen") or (FromOrderSet.Value = True) then
calc_rate_fld.Value := False;
CompVal := APTT_val_sec_fld.VALUE As Number;
if (CompVal > 154) then
fatal_error := true;
this_comm.Message := "Please Note that recent APTT above 154 Seconds \n\n"
||"Please STOP HEPARIN INFUSION for 1 hour... \n\n"
||"Then resume at new rate as calculated on this order";
this_comm.MessageType := "Error";
endif;
if adj_action = "Initial" then
/* clear adjustment field and make read only */
adj_val_u_h_fld.Value := null;
adj_val_u_h_fld.Control_Mandatory := false;
adj_val_u_h_fld.Control_Read_Only := true;
/* calculate initial rate units/hr */
calc_rate_u_h := (wt * 12) + curr_rate_u_h;
round_rate_u_h := int((calc_rate_u_h + 25)/50) * 50;
If round_rate_u_h >= 1000 then
iv_rate_u_h_fld.Value := 1000;
round_rate_u_h := 1000;
else
iv_rate_u_h_fld.Value := round_rate_u_h;
endif;
// iv_rate_u_h.Amount := round_rate_u_h;
// iv_rate_u_h.UOM := "units/hr";
/* calculate rate ml/hr */
calc_rate_ml_h := round_rate_u_h / hep_soln_conc;
iv_rate_ml_h.Amount := calc_rate_ml_h as number;
elseif adj_action = "No Change" then
/* clear adjustment field and make read only */
adj_val_u_h_fld.Value := null;
adj_val_u_h_fld.Control_Mandatory := false;
adj_val_u_h_fld.Control_Read_Only := true;
/* make APTT field mandatory */
APTT_val_sec_fld.Control_Mandatory := true;
/* calculate "new" rate units/hr */
calc_rate_u_h := (wt * 0) + curr_rate_u_h;
round_rate_u_h := int((calc_rate_u_h + 25)/50) * 50;
iv_rate_u_h_fld.Value := round_rate_u_h;
// iv_rate_u_h.Amount := round_rate_u_h;
// iv_rate_u_h.UOM := "units/hr";
/* calculate rate ml/hr */
calc_rate_ml_h := round_rate_u_h / hep_soln_conc;
iv_rate_ml_h.Amount := calc_rate_ml_h as number;
elseif (adj_action = "Increase") or (adj_action = "Decrease") then
if adj_action = "Decrease" then
adj_amt_u_h := -adj_amt_u_h ;
endif;
iv_rate_u_h_fld.Value := curr_rate_u_h + adj_amt_u_h ;
// iv_rate_u_h.Amount := round_rate_u_h;
// iv_rate_u_h.UOM := "units/hr";
/* calculate rate ml/hr */
calc_rate_ml_h := iv_rate_u_h_fld.Value / hep_soln_conc;
iv_rate_ml_h.Amount := calc_rate_ml_h as number;
endif;
endif; // called_by = ...
endif; // not fatal error
;;
evoke: // No evoke statement
;;
logic:
conclude true; // always, to return modified objects
;;
action:
/*-----------------------------------------------------------*/
/* return communication_type and form_type objects to system */
/*-----------------------------------------------------------*/
return this_comm, this_form;
;;
end:

View File

@@ -0,0 +1,456 @@
maintenance:
title: Cardiac Protocol Heparin Dosing ;;
mlmname: FORM_Heparin_Cardiac_Protocol_POV;;
arden: version 2;;
version: 4.50;;
institution: St. Clair Hospital ;;
author: Teresa Spicuzza;;
specialist: Robert Spence, St. Clair Hospital ;;
date: 2008-06-25;;
validation: testing;;
library:
purpose: Calculates Heparin Dose based on Patient Weight.
;;
explanation: On any event, this MLM gathers information from the
fields on the Weight-based heparing order entry form and sets a
fatal error flag is needed.
Processing continues only if there are no errors on the form.
On the FormOpen event, the MLM will transfer the value of hte rate field
to the current rate field.
On the FieldChange event the fields "Current Rate Action" and "Adjustment in
units/kg/hr" are considered.
Form to which to attach: PRX_IvDrpHepWtBased
Calling Event: FormOpen
Calling Event: FieldChange
Calling Field: PRX_HepWbRateAdjust
Calling Field: PRX_HepChgValue
History
07/18/2008 RS Added logic to cap the variable used for calculating the Rate ml/hr
11/21/2012 TMS Added PRX_HepWbCurrentRate as call field to logic to start calculation of adjustment and new rate - Ticket 154292
07.23.2019 TMS CSR 37676 - Change log_execution_info to false per upgrade analysis.
;;
keywords: Heparin, dosage,;
;;
knowledge:
type: data-driven;;
data:
/*-----------------------------------------------------------------------*/
/* This MLM receives three objects from the system, of types shown below */
/*-----------------------------------------------------------------------*/
(this_comm, // Communication type object
this_form, // Form type object
client_obj // Arden ClientInfo type object
) := argument;
/************* Make Changes To Spelling And Flags In This Section *************/
/*------------------------------------*/
/* Set to true if a CDS log is needed.*/
/*------------------------------------*/
log_execution_info := false;
/*-------------------------*/
/* set flags and variables */
/*-------------------------*/
fatal_error := false;
hep_soln_conc := 50; // "standard" concentration in units/ml
Measurements_di := "CombinedMeasurements";
APTT_val_sec_di := "PRX_HepWtBase_APTTvalue";
curr_rate_u_h_di := "PRX_HepWbCurrentRate";
curr_rate_adj_di := "PRX_HepWbRateAdjust";
adj_val_u_h_di := "PRX_HepChgUnitsPerHr";
calc_rate_di := "PRX_Generic_CB";
iv_rate_u_h_di := "PRX_DRIPINIT";
iv_rate_ml_comp := "OrderIVRate";
route_di := "OrderRouteCode";
// iv_rate_ml_h_di := "PRX_DRIPINIT";
// iv_rate_uom_di := "PRX_DRIPINITUOM";
/******************************************************************************/
/*--------------------------*/
/* set up testing variables */
/*--------------------------*/
if called_by_editor then
visit_obj := read last {ClientVisit: THIS};
// client_obj := read last {ClientInfo: THIS};
endif;
/*-------------------------------------------*/
/* get information from Communication object */
/*-------------------------------------------*/
called_by := this_comm.CallingEvent;
call_field := this_comm.CallingFieldName;
if called_by_editor then
client_guid := visit_obj.clientguid;
visit_guid := visit_obj.GUID;
chart_guid := visit_obj.chartguid;
orderId := "1000002689073001";
called_by := "FormOpen";
else
client_guid := this_comm.ClientGUID;
visit_guid := this_comm.ClientVisitGUID;
chart_guid := this_comm.ChartGuid;
orderid := this_comm.ItemID;
endif;
/*------------------------------------------------------------*/
/* Assign pointers to the Field list and to individual fields */
/*------------------------------------------------------------*/
field_list := this_form.fields;
comb_ht_wt_fld := first of (field_list
where field_list.DataItemName = Measurements_di);
APTT_val_sec_fld := first of (field_list
where field_list.DataItemName = APTT_val_sec_di);
curr_rate_u_h_fld := first of (field_list
where field_list.DataItemName = curr_rate_u_h_di);
curr_rate_adj_fld := first of (field_list
where field_list.DataItemName = curr_rate_adj_di);
adj_val_u_h_fld := first of (field_list
where field_list.DataItemName = adj_val_u_h_di);
calc_rate_fld := first of (field_list
where field_list.DataItemName = calc_rate_di);
iv_rate_u_h_fld := first of (field_list
where field_list.DataItemName = iv_rate_u_h_di);
iv_rate_ml_h_fld :=first of (field_list
where field_list.DataItemName = iv_rate_ml_comp );
EdLocFld := first of (field_list
where field_list.DataItemName = "ED Location");
FromOrderSet := first of (field_list
where field_list.DataItemName = "MLM_From Order Set");
/*--------------------------------------*/
/* RS: 06/12 get location */
/*--------------------------------------*/
If (called_by = "FormOpen") or (call_field = "MLM_From Order Set") then
//Retrieve Patient{{{SINGLE-QUOTE}}}s Current Location
LocName:= read last
{"SELECT currentlocation "
|| " FROM cv3clientvisit "
|| " WHERE ClientGUID = " || SQL(client_guid )
|| " And GUID = " || SQL(visit_guid)};
EdLocFld.Value := LocName;
ApttVal := read last
{"Select top 1 bo.value "
|| " From cv3order as o with (nolock) "
|| " join cv3basicobservation as bo with (nolock) "
|| " on o.clientguid = bo.clientguid "
|| " and o.chartguid = bo.chartguid "
|| " and o.guid = bo.orderguid "
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|| " and bo.Active = 1 "
|| " And bo.IsHistory = 0 "
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|| " and ocmi.active = 1 "
|| " and ocmi.name = {{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}} "
|| " where o.clientguid = " || SQL(client_guid)
|| " and o.chartguid = " || SQL(chart_guid)
|| " and o.performeddtm >= (DATEADD(hour, -28, getdate())) "
|| " order by o.performeddtm desc "
};
CompVal := ApttVal As Number;
APTT_val_sec_fld.VALUE := CompVal;
If (FromOrderSet.Value = True) then
orderlist := read
{" Select guid from cv3ordercatalogmasteritem "
|| " where (name = {{{SINGLE-QUOTE}}}Heparin 25,000 Units +D5W 500ml{{{SINGLE-QUOTE}}}) or "
|| " (name = {{{SINGLE-QUOTE}}}Heparin 25,000 Units +0.9% NaCl 500ml{{{SINGLE-QUOTE}}}) "
|| " and active = 1 "
};
orderid1:=First(orderlist);
orderid2:=Last(orderlist);
OldRate := read last
{" Select top 1 oud.value "
|| " from cv3order as o with (nolock) "
|| " join cv3orderuserdata as oud with (nolock) "
|| " on oud.orderguid= o.guid "
|| " and oud.userdatacode = {{{SINGLE-QUOTE}}}PRX_DRIPINIT{{{SINGLE-QUOTE}}} "
|| " where o.clientguid = " || SQL(client_guid)
|| " and o.chartguid = " || SQL (chart_guid)
|| " and (o.ordercatalogmasteritemguid = " || SQL(orderid1)
|| " or o.ordercatalogmasteritemguid = " || SQL(orderid2) || ") "
|| " and o.requesteddtm <= getdate() "
|| " order by o.requesteddtm desc, o.createdwhen desc"
};
else
OldRate := read last
{" Select top 1 oud.value "
|| " from cv3order as o with (nolock) "
|| " join cv3orderuserdata as oud with (nolock) "
|| " on oud.orderguid= o.guid "
|| " and oud.userdatacode = {{{SINGLE-QUOTE}}}PRX_DRIPINIT{{{SINGLE-QUOTE}}} "
|| " where o.clientguid = " || SQL(client_guid)
|| " and o.chartguid = " || SQL (chart_guid)
|| " and o.ordercatalogmasteritemguid = " || SQL(orderid)
|| " and o.requesteddtm <= getdate() "
|| " order by o.requesteddtm desc, o.createdwhen desc"
};
endif;
/* test := (curr_rate_adj_fld.value is null) or (curr_rate_adj_fld.Value <> "Initial") ;
this_comm.Message := "Old Rate Set to " || OldRate
|| "\n\n Rate Adjust set to \n" || curr_rate_adj_fld.Value
|| "If statement would return " ||test;
this_comm.MessageType := "Error";
*/
If (curr_rate_adj_fld.value is null) or (curr_rate_adj_fld.Value <> "Initial") then
curr_rate_u_h_fld.value := OldRate;
iv_rate_ml_h_fld.control_read_only := True;
iv_rate_u_h_fld.control_read_only := True;
else
curr_rate_u_h_fld.value := NULL;
endif;
// now for the suggested calculations
/* test := curr_rate_adj_fld.Value <> "Initial" ;
this_comm.Message := "Called by " || called_by
|| "\nCalling field " || call_field
|| "\nexists APTT_val_sec_Fld " || exists APTT_val_sec_Fld
|| "\nexists curr_rate_u_h_fld " || exists curr_rate_u_h_fld
|| "\ncurr_rate_adj_fld.Value is" || curr_rate_adj_fld.value ;
this_comm.MessageType := "Error";
curr_rate_adj_fld.value := "Increase";
*/
If (exists APTT_val_sec_Fld)
and (exists curr_rate_u_h_fld) then
If (curr_rate_adj_fld.Value <> "Initial" or curr_rate_adj_fld.Value is null) then
If CompVal < 66 then
curr_rate_adj_fld.value := "Increase";
adj_val_u_h_fld.value := 200;
elseif (CompVal >= 66) and (CompVal <= 76) then
curr_rate_adj_fld.value := "Increase";
adj_val_u_h_fld.value := 100;
elseif (CompVal >= 77) and (CompVal <= 115) then
curr_rate_adj_fld.value := "No Change";
adj_val_u_h_fld.value := null;
elseif (CompVal >= 116) and (CompVal <= 134) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 100;
elseif (CompVal > 134) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 200;
fatal_error := true;
this_comm.Message := "Please Note that recent APTT above 134 Seconds \n\n"
||"Please STOP HEPARIN INFUSION for 1 hour... \n\n"
||"Then resume at new rate as calculated on this order";
this_comm.MessageType := "Error";
endif;
endif;
else
curr_rate_adj_fld.value := null;
adj_val_u_h_fld.value := null;
endif;
endif;
If EdLocFld.Value matches pattern "ER%" then
IsED := True;
else
IsED := False;
endif;
if exist APTT_val_sec_fld then
APTT_val_sec_fld.Control_Mandatory := false;
endif;
if exist curr_rate_u_h_fld then
if curr_rate_u_h_fld.Value is null then
curr_rate_u_h := 0;
else
curr_rate_u_h := curr_rate_u_h_fld.Value;
endif;
endif;
if exist curr_rate_adj_fld then
adj_action := curr_rate_adj_fld.Value;
endif;
if exist adj_val_u_h_fld then
adj_amt_u_h := adj_val_u_h_fld.Value as number;
endif;
if exist iv_rate_u_h_fld then
iv_rate_u_h := iv_rate_u_h_fld.Value;
// iv_rate_amt := iv_rate_u_h.AMOUNT as number;
// iv_rate_uom := iv_rate_u_h.UOM;
else
fatal_error:=true;
endif;
if exist iv_rate_ml_h_fld then
iv_rate_ml_h := iv_rate_ml_h_fld.Value;
endif;
/*----------------------------------*/
/* process form fields and settings */
/* only if no errors are found */
/*----------------------------------*/
if not fatal_error then
// if (called_by = "FormOpen") or (call_field = "MLM_From Order Set" ) then
// curr_rate_u_h_fld.Control_Read_Only := false;
// curr_rate_u_h_fld.Value := iv_rate_u_h.Amount;
// curr_rate_u_h_fld.Control_Read_Only := true;
/// APTT_val_sec_fld.Control_Mandatory := false;
// APTT_val_sec_fld.Value := null;
If (call_field = "PRX_DRIPINIT") then
marker:=true;
checkrate := iv_rate_u_h_fld.Value ;
if ((floor (checkrate /50)) <> (ceiling(checkrate /50)) or (checkrate is null) or (checkrate =0)) then
this_comm.Message := "Your IV Rate Must Be Divisible by 50" || "\n\n" ||
"You Entered: " || checkrate;
this_comm.MessageType := "Error";
iv_rate_u_h_fld.value:=null;
iv_rate_ml_h.Amount := null;
else
iv_rate_ml_h.Amount := checkrate /50;
endif;
// this will only apply on initials
// TMS added PRX_HepWbCurrentRate to logic to prevent looping when current rate is changed
// elseif (call_field ="PRX_HepWtBase_APTTvalue") and (curr_rate_adj_fld.value is null or curr_rate_adj_fld.Value <> "Initial") then
elseif ((call_field ="PRX_HepWtBase_APTTvalue") or (call_field = "PRX_HepWbCurrentRate")) and (curr_rate_adj_fld.value is null or curr_rate_adj_fld.Value <> "Initial") then
iv_rate_u_h_fld.Value:= null;
iv_rate_ml_h.Amount := null;
If (curr_rate_adj_fld.value is null or curr_rate_adj_fld.Value <> "Initial") then
APTT_val_sec_fld.Control_Mandatory := true;
curr_rate_adj_fld.value := null;
adj_val_u_k_h_fld.value := null;
endif;
CompVal := APTT_val_sec_fld.VALUE As Number;
If CompVal is not null then
If (exists APTT_val_sec_Fld) and (exists curr_rate_u_h_fld) then
If CompVal < 66 then
curr_rate_adj_fld.value := "Increase";
adj_val_u_h_fld.value := 200;
elseif (CompVal >= 66) and (CompVal <= 76) then
curr_rate_adj_fld.value := "Increase";
adj_val_u_h_fld.value := 100;
elseif (CompVal >= 77) and (CompVal <= 115) then
curr_rate_adj_fld.value := "No Change";
adj_val_u_h_fld.value := null;
elseif (CompVal >= 116) and (CompVal <= 134) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 100;
elseif (CompVal > 134) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 200;
endif;
endif;
else
curr_rate_adj_fld.value := null;
adj_val_u_k_h_fld.value := null;
endif;
elseif (call_field = calc_rate_di) or (called_by = "FormOpen") or (FromOrderSet.Value = True) then
calc_rate_fld.Value := False;
CompVal := APTT_val_sec_fld.VALUE As Number;
if (CompVal > 134) then
fatal_error := true;
this_comm.Message := "Please Note that recent APTT above 134 Seconds \n\n"
||"Please STOP HEPARIN INFUSION for 1 hour... \n\n"
||"Then resume at new rate as calculated on this order";
this_comm.MessageType := "Error";
endif;
if adj_action = "Initial" then
/* clear adjustment field and make read only */
adj_val_u_h_fld.Value := null;
adj_val_u_h_fld.Control_Mandatory := false;
adj_val_u_h_fld.Control_Read_Only := true;
iv_rate_ml_h.Amount := iv_rate_u_h_fld.Value /50 ;
elseif adj_action = "No Change" then
/* clear adjustment field and make read only */
adj_val_u_h_fld.Value := null;
adj_val_u_h_fld.Control_Mandatory := false;
adj_val_u_h_fld.Control_Read_Only := true;
/* make APTT field mandatory */
APTT_val_sec_fld.Control_Mandatory := true;
iv_rate_u_h_fld.Value := curr_rate_u_h;
iv_rate_ml_h.Amount := curr_rate_u_h / 50;
elseif (adj_action = "Increase") or (adj_action = "Decrease") then
if adj_action = "Decrease" then
adj_amt_u_h := -adj_amt_u_h ;
endif;
iv_rate_u_h_fld.Value := curr_rate_u_h + adj_amt_u_h ;
iv_rate_ml_h.Amount := iv_rate_u_h_fld.Value / 50;
endif;
endif; // called_by = ...
endif; // not fatal error
;;
evoke: // No evoke statement
;;
logic:
conclude true; // always, to return modified objects
;;
action:
/*-----------------------------------------------------------*/
/* return communication_type and form_type objects to system */
/*-----------------------------------------------------------*/
return this_comm, this_form;
;;
end:

View File

@@ -0,0 +1,181 @@
maintenance:
title: Form_Heparin_Dose_calc;;
mlmname: Form_Heparin_Dose_calc;;
arden: version 2;;
version: 4.50;;
institution: St. Clair Hospital;;
author: Teresa M. Spicuzza (Teresa.Spicuzza@stclair.org), 412.942.1721 ;;
specialist: Eclipsys Corporation;;
date: 2006-10-27;;
validation: testing;;
library:
purpose: Caculate Heparin bolus dose based on weight.
;;
explanation: (Per T. Spicuzza, 10-26-06):
Dosing Weight in Kilograms * Bolus Concentration =
Bolus Dose (round to nearest 100)
Dose equals value of (rounded) Bolus Dose
If (rounded) Bolus Dose is 5000 or less Then
Product Concentration equals 1000
WORx Product Code equals 06466
Concentration Text equals (1000units/ml)
ElseIf (rounded) Bolus Dose is 5001 or greater
Product Concentration equals 1000
WORx Product Code equals 06466
Concentration Text equals (1000units/ml)
Endif
If Dosing Weight in Kilograms is null alert user to
Enter a Calculation Weight on the Vital Sign Flowsheet before proceeding
;;
keywords:
Heparin, bolus, weight;
;;
knowledge:
type: data-driven;;
data:
/********************Make Changes To Spelling And Flags In This Section*********************/
/********************************************************************************JAB********/
// 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;
called_by := this_communication.CallingEvent;
call_field := this_communication.CallingFieldName;
//RS Set some needed fields
if called_by_editor then
client_guid := "9000001369400200";
visit_guid := visit_obj.GUID;
chart_guid := "9000001918900170";
orderId := "1000002689073001";
called_by := "FormOpen";
else
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGuid;
orderid := this_comm.ItemID;
endif;
//Initialize MLM pointers:
round_dose := mlm {{{SINGLE-QUOTE}}}SYS_ROUND_DOSAGE{{{SINGLE-QUOTE}}};
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
comb_ht_wt_field := first of
(field_list where field_list.DataItemName = "CombinedMeasurements");
if exists comb_ht_wt_field then
comb_ht_wt_val := comb_ht_wt_field.value;
wt := comb_ht_wt_val.weight;
ht := comb_ht_wt_val.height;
wt_type := comb_ht_wt_val.weighttype;
bsa := comb_ht_wt_val.bsa;
bmi := comb_ht_wt_val.bmi;
endif;
if not exists wt then
DoNada:=True;
else
//Units per Kg wt
bolus_conc := first of (field_list where field_list.DataItemName
= "PRX_WtBasedHeparinBolusUnitsPerKg");
//Route
dose_route := first of
(field_list where field_list.DataItemName = "OrderRouteCode");
//Dose
dose := first of
(field_list where field_list.DataItemName = "dosagelow");
//Strength
prod_conc_str := first of
(field_list where field_list.DataItemName = "PRX_CONCSTRENGTH");
//WORx Code
worx_prod_code := first of
(field_list where field_list.DataItemName = "PRX_DRUGIDCODE");
//Concentration Text
prod_conc_txt := first of
(field_list where field_list.DataItemName = "PRX_Concentration");
if exists bolus_conc then
bolus_dose := (wt as number) * (bolus_conc.value as number);
endif;
//round the dose
// per trackit 100664 problem with system rounding to 50 not 100
// RS Overridin system call and using our own integer rounding calculation
// Original code
// (error_msg, rnd_bolus_dose) := call round_dose
// with bolus_dose, dose_route.value;
// new code introduced 11/11/2008
rnd_bolus_dose := int((bolus_dose + 50)/100) * 100;
//use the rounded dose for the actual dose
if exists dose then
dose.value := rnd_bolus_dose;
endif;
If rnd_bolus_dose <= 5000 then
prod_conc_str.value := "1000";
worx_prod_code.value := "06466";
prod_conc_txt.value := "(1000units/ml)";
else
prod_conc_str.value := "1000";
worx_prod_code.value := "06466";
prod_conc_txt.value := "(1000units/ml)";
endif; // rnd_bolus_dose <= 5000
endif; // not exists wt
/* // FOR DEBUGGING PURPOSES: display a message to the user
this_communication.Message :=
"wt = "|| wt
|| "\nbolus_conc.value = " || bolus_conc.value
|| "\nbolus_dose = " || bolus_dose
|| "\ndose_route.value = " || dose_route.value
|| "\nrnd_bolus_dose = " || rnd_bolus_dose
;
this_communication.MessageType := "Informational";
*/
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns two parameters, of types
//communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,231 @@
maintenance:
title: Form_Heparin_Dose_calc_Cap;;
mlmname: Form_Heparin_Dose_calc_Cap;;
arden: version 2;;
version: 4.50;;
institution: St. Clair Hospital;;
author: Teresa M. Spicuzza (Teresa.Spicuzza@stclair.org), 412.942.1721 ;;
specialist: Eclipsys Corporation;;
date: 2006-10-27;;
validation: testing;;
library:
purpose: Calculate Heparin bolus dose based on weight.
;;
explanation: (Per T. Spicuzza, 10-26-06):
Dosing Weight in Kilograms * Bolus Concentration =
Bolus Dose (round to nearest 100)
Dose equals value of (rounded) Bolus Dose
If (rounded) Bolus Dose is 5000 or less Then
Product Concentration equals 1000
WORx Product Code equals 06466
Concentration Text equals (1000units/ml)
ElseIf (rounded) Bolus Dose is 5001 or greater
Product Concentration equals 1000
WORx Product Code equals 06466
Concentration Text equals (1,000units/ml)
Endif
If Dosing Weight in Kilograms is null alert user to
Enter a Calculation Weight on the Vital Sign Flowsheet before proceeding
Change history
02.26.2010 TS Changed Worx code on >5000 units and <5000 units to a new product (same product).
07.06.2011 TS changed dose cap from 4000 units to 5000 units.
;;
keywords:
Heparin, bolus, weight;
;;
knowledge:
type: data-driven;;
data:
/********************Make Changes To Spelling And Flags In This Section*********************/
/********************************************************************************JAB********/
// 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;
called_by := this_communication.CallingEvent;
call_field := this_communication.CallingFieldName;
//RS Set some needed fields
if called_by_editor then
client_guid := "9000001369400200";
visit_guid := visit_obj.GUID;
chart_guid := "9000001918900170";
orderId := "1000002689073001";
called_by := "FormOpen";
else
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGuid;
orderid := this_comm.ItemID;
endif;
//Initialize MLM pointers:
round_dose := mlm {{{SINGLE-QUOTE}}}SYS_ROUND_DOSAGE{{{SINGLE-QUOTE}}};
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
/*--------------------------------------*/
/* RS: 06/12 get location */
/*--------------------------------------*/
FromOrderSet := first of
(field_list where field_list.DataItemName = "MLM_From Order Set");
EdLocFld := first of (field_list
where field_list.DataItemName = "ED Location");
IF (EDLocFld.Value = "") or (EDLocFld.Value is Null) then
//Retrieve Patient{{{SINGLE-QUOTE}}}s Current Location
LocName:= read last
{"SELECT currentlocation "
|| " FROM cv3clientvisit "
|| " WHERE ClientGUID = " || SQL(client_guid )
|| " And GUID = " || SQL(visit_guid)};
EdLocFld.Value := LocName;
endif;
/*---------------------------------------------------*/
If EdLocFld.Value matches pattern "ER%" then
IsED := True;
else
IsED := False;
endif;
comb_ht_wt_field := first of
(field_list where field_list.DataItemName = "CombinedMeasurements");
test_ht_wt_val := comb_ht_wt_field.value;
wt2 := test_ht_wt_val.weight;
testex := exists comb_ht_wt_field ;
if exists comb_ht_wt_field then
comb_ht_wt_val := comb_ht_wt_field.value;
wt := comb_ht_wt_val.weight;
ht := comb_ht_wt_val.height;
wt_type := comb_ht_wt_val.weighttype;
bsa := comb_ht_wt_val.bsa;
bmi := comb_ht_wt_val.bmi;
endif;
if not exists wt then
tester:=true;
else
//Units per Kg wt
bolus_conc := first of (field_list where field_list.DataItemName
= "PRX_WtBasedHeparinBolusUnitsPerKg");
//Route
dose_route := first of
(field_list where field_list.DataItemName = "OrderRouteCode");
//Dose
dose := first of
(field_list where field_list.DataItemName = "dosagelow");
//Strength
prod_conc_str := first of
(field_list where field_list.DataItemName = "PRX_CONCSTRENGTH");
//WORx Code
worx_prod_code := first of
(field_list where field_list.DataItemName = "PRX_DRUGIDCODE");
//Concentration Text
prod_conc_txt := first of
(field_list where field_list.DataItemName = "PRX_Concentration");
if exists bolus_conc then
bolus_dose := (wt as number) * (bolus_conc.value as number);
endif;
//round the dose
// per trackit 100664 problem with system rounding to 50 not 100
// RS Overridin system call and using our own integer rounding calculation
// Original code
// (error_msg, rnd_bolus_dose) := call round_dose
// with bolus_dose, dose_route.value;
// new code introduced 11/11/2008
rnd_bolus_dose := int((bolus_dose + 50)/100) * 100;
// Cap the rounded bolus dose. If greater than 5000, set to 5000
if rnd_bolus_dose > 5000 then
rnd_bolus_dose := 5000;
endif;
//use the rounded dose for the actual dose
if exists dose then
dose.value := rnd_bolus_dose;
endif;
If rnd_bolus_dose <= 5000 then
prod_conc_str.value := "1000";
worx_prod_code.value := "06466";
prod_conc_txt.value := "(1000units/ml)";
else
prod_conc_str.value := "1000";
worx_prod_code.value := "06466";
prod_conc_txt.value := "(1000units/ml)";
endif; // rnd_bolus_dose <= 5000
endif; // not exists wt
/*this_communication.Message :=
" Calling field is " || call_field || "\n" ||
" Order set field = " || FromOrderSet.value || "\n" ||
" W2 = " || wt2 || "\n" ||
" test_ht_wt_val = " || test_ht_wt_val || "\n" ||
" Exist ht_wt? = "|| testex
;
this_communication.MessageType := "Informational";
*/
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns two parameters, of types
//communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,515 @@
maintenance:
title: Low Intensity Heparin Protocol Dosing ;;
mlmname: FORM_Heparin_Low_Intensity_Protocol;;
arden: version 2.5;;
version: 15.1;;
institution: St. Clair Hospital ;;
author: Teresa Spicuzza;;
specialist: Teresa Spicuzza, St. Clair Hospital ;;
date: 2015-08-21;;
validation: testing;;
library:
purpose: Calculates Low Intensity Heparin Dose based on Patient Weight.
;;
explanation: On any event, this MLM gathers information from the
fields on the Weight-based heparing order entry form and sets a
fatal error flag is needed.
Processing continues only if there are no errors on the form.
On the FormOpen event, the MLM will transfer the value of hte rate field
to the current rate field.
On the FieldChange event the fields "Current Rate Action" and "Adjustment in
units/kg/hr" are considered.
Form to which to attach: PRX_IvDrpHepLowInten
Calling Event: FormOpen
Calling Event: FieldChange
Calling Field: PRX_HepWbRateAdjust
Calling Field: PRX_HepChgValue
History
10.21.2015 TMS Copy of Cardiac heparin protocol with changes
needed to support Low Intensity Procotol CSR 33670
07.23.2019 TMS CSR 37676 - Change log_execution_info to false per upgrade analysis.
;;
keywords: Heparin, dosage,;
;;
knowledge:
type: data-driven;;
data:
/*-----------------------------------------------------------------------*/
/* This MLM receives three objects from the system, of types shown below */
/*-----------------------------------------------------------------------*/
(this_comm, // Communication type object
this_form, // Form type object
client_obj // Arden ClientInfo type object
) := argument;
/************* Make Changes To Spelling And Flags In This Section *************/
/*------------------------------------*/
/* Set to true if a CDS log is needed.*/
/*------------------------------------*/
log_execution_info := false;
/*-------------------------*/
/* set flags and variables */
/*-------------------------*/
fatal_error := false;
hep_soln_conc := 50; // "standard" concentration in units/ml
Measurements_di := "CombinedMeasurements";
APTT_val_sec_di := "PRX_HepWtBase_APTTvalue";
curr_rate_u_h_di := "PRX_HepWbCurrentRate";
curr_rate_adj_di := "PRX_HepWbRateAdjust";
adj_val_u_h_di := "PRX_HepChgUnitsPerHr";
calc_rate_di := "PRX_Generic_CB";
iv_rate_u_h_di := "PRX_DRIPINIT";
iv_rate_ml_comp := "OrderIVRate";
route_di := "OrderRouteCode";
/******************************************************************************/
/*--------------------------*/
/* set up testing variables */
/*--------------------------*/
if called_by_editor then
visit_obj := read last {ClientVisit: THIS};
// client_obj := read last {ClientInfo: THIS};
endif;
/*-------------------------------------------*/
/* get information from Communication object */
/*-------------------------------------------*/
called_by := this_comm.CallingEvent;
call_field := this_comm.CallingFieldName;
if called_by_editor then
client_guid := visit_obj.clientguid;
visit_guid := visit_obj.GUID;
chart_guid := visit_obj.chartguid;
orderId := "1000002689073001";
called_by := "FormOpen";
else
client_guid := this_comm.ClientGUID;
visit_guid := this_comm.ClientVisitGUID;
chart_guid := this_comm.ChartGuid;
orderid := this_comm.ItemID;
endif;
/*------------------------------------------------------------*/
/* Assign pointers to the Field list and to individual fields */
/*------------------------------------------------------------*/
field_list := this_form.fields;
comb_ht_wt_fld := first of (field_list
where field_list.DataItemName = Measurements_di);
APTT_val_sec_fld := first of (field_list
where field_list.DataItemName = APTT_val_sec_di);
curr_rate_u_h_fld := first of (field_list
where field_list.DataItemName = curr_rate_u_h_di);
curr_rate_adj_fld := first of (field_list
where field_list.DataItemName = curr_rate_adj_di);
adj_val_u_h_fld := first of (field_list
where field_list.DataItemName = adj_val_u_h_di);
calc_rate_fld := first of (field_list
where field_list.DataItemName = calc_rate_di);
iv_rate_u_h_fld := first of (field_list
where field_list.DataItemName = iv_rate_u_h_di);
iv_rate_ml_h_fld :=first of (field_list
where field_list.DataItemName = iv_rate_ml_comp );
EdLocFld := first of (field_list
where field_list.DataItemName = "ED Location");
FromOrderSet := first of (field_list
where field_list.DataItemName = "MLM_From Order Set");
/*--------------------------------------*/
/* RS: 06/12 get location */
/*--------------------------------------*/
If (called_by = "FormOpen") or (call_field = "MLM_From Order Set") then
//Retrieve Patient{{{SINGLE-QUOTE}}}s Current Location
LocName:= read last
{"SELECT currentlocation "
|| " FROM cv3clientvisit "
|| " WHERE ClientGUID = " || SQL(client_guid )
|| " And GUID = " || SQL(visit_guid)};
EdLocFld.Value := LocName;
ApttVal := read last
{"Select top 1 bo.value "
|| " From cv3order as o with (nolock) "
|| " join cv3basicobservation as bo with (nolock) "
|| " on o.clientguid = bo.clientguid "
|| " and o.chartguid = bo.chartguid "
|| " and o.guid = bo.orderguid "
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|| " and bo.Active = 1 "
|| " And bo.IsHistory = 0 "
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|| " and ocmi.active = 1 "
|| " and ocmi.name = {{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}} "
|| " where o.clientguid = " || SQL(client_guid)
|| " and o.chartguid = " || SQL(chart_guid)
|| " and o.performeddtm >= (DATEADD(hour, -28, getdate())) "
|| " order by o.performeddtm desc "
};
CompVal := ApttVal As Number;
APTT_val_sec_fld.VALUE := CompVal;
If (FromOrderSet.Value = True) then
orderlist := read
{" Select guid from cv3ordercatalogmasteritem "
|| " where (name = {{{SINGLE-QUOTE}}}Heparin 25,000 Units + D5W 500ml{{{SINGLE-QUOTE}}}) or "
|| " (name = {{{SINGLE-QUOTE}}}Heparin 25,000 Units + 0.9% NaCl 500ml{{{SINGLE-QUOTE}}}) "
|| " and active = 1 "
};
orderid1:=First(orderlist);
orderid2:=Last(orderlist);
OldRate := read last
{" Select top 1 oud.value "
|| " from cv3order as o with (nolock) "
|| " join cv3orderuserdata as oud with (nolock) "
|| " on oud.orderguid= o.guid "
|| " and oud.userdatacode = {{{SINGLE-QUOTE}}}PRX_DRIPINIT{{{SINGLE-QUOTE}}} "
|| " where o.clientguid = " || SQL(client_guid)
|| " and o.chartguid = " || SQL (chart_guid)
|| " and (o.ordercatalogmasteritemguid = " || SQL(orderid1)
|| " or o.ordercatalogmasteritemguid = " || SQL(orderid2) || ") "
|| " and o.requesteddtm <= getdate() "
|| " order by o.requesteddtm desc, o.createdwhen desc"
};
else
OldRate := read last
{" Select top 1 oud.value "
|| " from cv3order as o with (nolock) "
|| " join cv3orderuserdata as oud with (nolock) "
|| " on oud.orderguid= o.guid "
|| " and oud.userdatacode = {{{SINGLE-QUOTE}}}PRX_DRIPINIT{{{SINGLE-QUOTE}}} "
|| " where o.clientguid = " || SQL(client_guid)
|| " and o.chartguid = " || SQL (chart_guid)
|| " and o.ordercatalogmasteritemguid = " || SQL(orderid)
|| " and o.requesteddtm <= getdate() "
|| " order by o.requesteddtm desc, o.createdwhen desc"
};
endif;
/* test := (curr_rate_adj_fld.value is null) or (curr_rate_adj_fld.Value <> "Initial") ;
this_comm.Message := "Old Rate Set to " || OldRate
|| "\n\n Rate Adjust set to \n" || curr_rate_adj_fld.Value
|| "If statement would return " ||test;
this_comm.MessageType := "Error";
*/
If (curr_rate_adj_fld.value is null) or (curr_rate_adj_fld.Value <> "Initial") then
curr_rate_u_h_fld.value := OldRate;
iv_rate_ml_h_fld.control_read_only := True;
iv_rate_u_h_fld.control_read_only := True;
else
curr_rate_u_h_fld.value := NULL;
endif;
// now for the suggested calculations
/* test := curr_rate_adj_fld.Value <> "Initial" ;
this_comm.Message := "Called by " || called_by
|| "\nCalling field " || call_field
|| "\nexists APTT_val_sec_Fld " || exists APTT_val_sec_Fld
|| "\nexists curr_rate_u_h_fld " || exists curr_rate_u_h_fld
|| "\ncurr_rate_adj_fld.Value is" || curr_rate_adj_fld.value ;
this_comm.MessageType := "Error";
curr_rate_adj_fld.value := "Increase";
*/
If (exists APTT_val_sec_Fld)
and (exists curr_rate_u_h_fld) then
If (curr_rate_adj_fld.Value <> "Initial" or curr_rate_adj_fld.Value is null) then
If CompVal < 57 then
curr_rate_adj_fld.value := "Increase";
adj_val_u_h_fld.value := 200;
elseif (CompVal >= 57) and (CompVal <= 67) then
curr_rate_adj_fld.value := "Increase";
adj_val_u_h_fld.value := 100;
elseif (CompVal >= 68) and (CompVal <= 96) then
curr_rate_adj_fld.value := "No Change";
adj_val_u_h_fld.value := null;
elseif (CompVal >= 97) and (CompVal <= 115) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 100;
elseif (CompVal >= 116) and (CompVal <= 134) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 200;
elseif (CompVal > 134) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 200;
fatal_error := true;
this_comm.Message := "Please Note that recent APTT above 134 Seconds \n\n"
||"Please STOP HEPARIN INFUSION for 1 hour... \n\n"
||"Then resume at new rate as calculated on this order";
this_comm.MessageType := "Error";
endif;
endif;
else
curr_rate_adj_fld.value := null;
adj_val_u_h_fld.value := null;
endif;
endif;
If EdLocFld.Value matches pattern "ER%" then
IsED := True;
else
IsED := False;
endif;
/*------------------------*/
/* get values from fields */
/*------------------------*/
if exists comb_ht_wt_fld then
// comb_ht_wt_fld.control_read_only := true;
comb_ht_wt_val := comb_ht_wt_fld.Value;
wt := comb_ht_wt_val.weight;
ht := comb_ht_wt_val.height;
wt_type := comb_ht_wt_val.weighttype;
bsa := comb_ht_wt_val.bsa;
bmi := comb_ht_wt_val.bmi;
endif;
if exist APTT_val_sec_fld then
APTT_val_sec_fld.Control_Mandatory := false;
endif;
if exist curr_rate_u_h_fld then
if curr_rate_u_h_fld.Value is null then
curr_rate_u_h := 0;
else
curr_rate_u_h := curr_rate_u_h_fld.Value;
endif;
endif;
if exist curr_rate_adj_fld then
adj_action := curr_rate_adj_fld.Value;
endif;
if exist adj_val_u_h_fld then
adj_amt_u_h := adj_val_u_h_fld.Value as number;
endif;
if exist iv_rate_u_h_fld then
iv_rate_u_h := iv_rate_u_h_fld.Value;
// iv_rate_amt := iv_rate_u_h.AMOUNT as number;
// iv_rate_uom := iv_rate_u_h.UOM;
endif;
if exist iv_rate_ml_h_fld then
iv_rate_ml_h := iv_rate_ml_h_fld.Value;
endif;
/*----------------------------------*/
/* process form fields and settings */
/* only if no errors are found */
/*----------------------------------*/
if not fatal_error then
// if (called_by = "FormOpen") or (call_field = "MLM_From Order Set" ) then
// curr_rate_u_h_fld.Control_Read_Only := false;
// curr_rate_u_h_fld.Value := iv_rate_u_h.Amount;
// curr_rate_u_h_fld.Control_Read_Only := true;
/// APTT_val_sec_fld.Control_Mandatory := false;
// APTT_val_sec_fld.Value := null;
If (call_field = "PRX_DRIPINIT") then
marker:=true;
checkrate := iv_rate_u_h_fld.Value ;
if ((floor (checkrate /50)) <> (ceiling(checkrate /50)) or (checkrate is null) or (checkrate =0)) then
this_comm.Message := "Your IV Rate Must Be Divisible by 50" || "\n\n" ||
"You Entered: " || checkrate;
this_comm.MessageType := "Error";
iv_rate_u_h_fld.value:=null;
iv_rate_ml_h.Amount := null;
else
iv_rate_ml_h.Amount := checkrate /50;
endif;
// TMS added PRX_HepWbCurrentRate to logic to prevent looping when current rate is changed
// elseif (call_field ="PRX_HepWtBase_APTTvalue") and (curr_rate_adj_fld.value is null or curr_rate_adj_fld.Value <> "Initial") then
elseif ((call_field ="PRX_HepWtBase_APTTvalue") or (call_field = "PRX_HepWbCurrentRate")) and (curr_rate_adj_fld.value is null or curr_rate_adj_fld.Value <> "Initial") then
iv_rate_u_h_fld.Value:= null;
iv_rate_ml_h.Amount := null;
If (curr_rate_adj_fld.value is null or curr_rate_adj_fld.Value <> "Initial") then
APTT_val_sec_fld.Control_Mandatory := true;
curr_rate_adj_fld.value := null;
adj_val_u_k_h_fld.value := null;
endif;
CompVal := APTT_val_sec_fld.VALUE As Number;
If CompVal is not null then
If (exists APTT_val_sec_Fld) and (exists curr_rate_u_h_fld) then
If CompVal < 57 then
curr_rate_adj_fld.value := "Increase";
adj_val_u_h_fld.value := 200;
elseif (CompVal >= 57) and (CompVal <= 67) then
curr_rate_adj_fld.value := "Increase";
adj_val_u_h_fld.value := 100;
elseif (CompVal >= 68) and (CompVal <= 96) then
curr_rate_adj_fld.value := "No Change";
adj_val_u_h_fld.value := null;
elseif (CompVal >= 97) and (CompVal <= 115) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 100;
elseif (CompVal >= 116) and (CompVal <= 134) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 200;
elseif (CompVal > 134) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_h_fld.value := 200;
endif;
endif;
else
curr_rate_adj_fld.value := null;
adj_val_u_k_h_fld.value := null;
endif;
elseif (call_field = calc_rate_di) or (called_by = "FormOpen") or (FromOrderSet.Value = True) then
calc_rate_fld.Value := False;
CompVal := APTT_val_sec_fld.VALUE As Number;
if (CompVal > 134) then
fatal_error := true;
this_comm.Message := "Please Note that recent APTT above 134 Seconds \n\n"
||"Please STOP HEPARIN INFUSION for 1 hour... \n\n"
||"Then resume at new rate as calculated on this order";
this_comm.MessageType := "Error";
endif;
if adj_action = "Initial" then
/* alert if no calculation weight exists for calculation*/
// If wt is Null or wt = 0 then
// fatal_error := true;
// this_comm.Message := "Please enter a calculation weight to continue";
// this_comm.MessageType := "Error";
// endif;
/* clear adjustment field and make read only */
adj_val_u_h_fld.Value := null;
adj_val_u_h_fld.Control_Mandatory := false;
adj_val_u_h_fld.Control_Read_Only := true;
/* calculate initial rate units/hr */
calc_rate_u_h := (wt * 12) + curr_rate_u_h;
round_rate_u_h := int((calc_rate_u_h + 25)/50) * 50;
If round_rate_u_h >= 1000 then
iv_rate_u_h_fld.Value := 1000;
round_rate_u_h := 1000;
else
iv_rate_u_h_fld.Value := round_rate_u_h;
endif;
// iv_rate_u_h.Amount := round_rate_u_h;
// iv_rate_u_h.UOM := "units/hr";
/* calculate rate ml/hr */
calc_rate_ml_h := round_rate_u_h / hep_soln_conc;
iv_rate_ml_h.Amount := calc_rate_ml_h as number;
elseif adj_action = "No Change" then
/* clear adjustment field and make read only */
adj_val_u_h_fld.Value := null;
adj_val_u_h_fld.Control_Mandatory := false;
adj_val_u_h_fld.Control_Read_Only := true;
/* make APTT field mandatory */
APTT_val_sec_fld.Control_Mandatory := true;
/* calculate "new" rate units/hr */
calc_rate_u_h := (wt * 0) + curr_rate_u_h;
round_rate_u_h := int((calc_rate_u_h + 25)/50) * 50;
iv_rate_u_h_fld.Value := round_rate_u_h;
// iv_rate_u_h.Amount := round_rate_u_h;
// iv_rate_u_h.UOM := "units/hr";
/* calculate rate ml/hr */
calc_rate_ml_h := round_rate_u_h / hep_soln_conc;
iv_rate_ml_h.Amount := calc_rate_ml_h as number;
elseif (adj_action = "Increase") or (adj_action = "Decrease") then
if adj_action = "Decrease" then
adj_amt_u_h := -adj_amt_u_h ;
endif;
iv_rate_u_h_fld.Value := curr_rate_u_h + adj_amt_u_h ;
// iv_rate_u_h.Amount := round_rate_u_h;
// iv_rate_u_h.UOM := "units/hr";
/* calculate rate ml/hr */
calc_rate_ml_h := iv_rate_u_h_fld.Value / hep_soln_conc;
iv_rate_ml_h.Amount := calc_rate_ml_h as number;
endif;
endif; // called_by = ...
endif; // not fatal error
;;
evoke: // No evoke statement
;;
logic:
conclude true; // always, to return modified objects
;;
action:
/*-----------------------------------------------------------*/
/* return communication_type and form_type objects to system */
/*-----------------------------------------------------------*/
return this_comm, this_form;
;;
end:

View File

@@ -0,0 +1,502 @@
maintenance:
title: Weight Based Heparin Dosing ;;
mlmname: FORM_Heparin_WtBased_Dose_Calc;;
arden: version 2;;
version: 4.50;;
institution: St. Clair Hospital ;;
author: Teresa Spicuzza;;
specialist: Josue Lopez, Eclipsys Corporation;;
date: 2007-02-07;;
validation: testing;;
library:
purpose: Calculates Heparin Dose based on Patient Weight.
;;
explanation: On any event, this MLM gathers information from the
fields on the Weight-based heparing order entry form and sets a
fatal error flag is needed.
Processing continues only if there are no errors on the form.
On the FormOpen event, the MLM will transfer the value of hte rate field
to the current rate field.
On the FieldChange event the fields "Current Rate Action" and "Adjustment in
units/kg/hr" are considered.
Form to which to attach: PRX_IvDrpHepWtBased
Calling Event: FormOpen
Calling Event: FieldChange
Calling Field: PRX_HepWbRateAdjust
Calling Field: PRX_HepChgValue
Change history
12.05.2011 TMS Added PRX_HepWbCurrentRate as call field to logic to start calculation of adjustment and new rate - Ticket 142743
07.23.2019 TMS CSR 37676 - Change log_execution_info to false per upgrade analysis.
;;
keywords: Heparin, dosage,;
;;
knowledge:
type: data-driven;;
data:
/*-----------------------------------------------------------------------*/
/* This MLM receives three objects from the system, of types shown below */
/*-----------------------------------------------------------------------*/
(this_comm, // Communication type object
this_form, // Form type object
client_obj // Arden ClientInfo type object
) := argument;
/************* Make Changes To Spelling And Flags In This Section *************/
/*------------------------------------*/
/* Set to true if a CDS log is needed.*/
/*------------------------------------*/
log_execution_info := false;
// References the LOCAL SESSION object
local_session := cds_session.local;
/*-------------------------*/
/* set flags and variables */
/*-------------------------*/
fatal_error := false;
hep_soln_conc := 50; // "standard" concentration in units/ml
Measurements_di := "CombinedMeasurements";
APTT_val_sec_di := "PRX_HepWtBase_APTTvalue";
curr_rate_u_h_di := "PRX_HepWbCurrentRate";
curr_rate_adj_di := "PRX_HepWbRateAdjust";
adj_val_u_k_h_di := "PRX_HepChgValue";
calc_rate_di := "PRX_Generic_CB";
iv_rate_u_h_di := "PRX_DRIPINIT";
iv_rate_ml_comp := "OrderIVRate";
route_di := "OrderRouteCode";
// iv_rate_ml_h_di := "PRX_DRIPINIT";
// iv_rate_uom_di := "PRX_DRIPINITUOM";
/******************************************************************************/
/*--------------------------*/
/* set up testing variables */
/*--------------------------*/
if called_by_editor then
visit_obj := read last {ClientVisit: THIS};
// client_obj := read last {ClientInfo: THIS};
endif;
/*-------------------------------------------*/
/* get information from Communication object */
/*-------------------------------------------*/
called_by := this_comm.CallingEvent;
call_field := this_comm.CallingFieldName;
/* this_comm.Message := "Call Field " || call_field;
this_comm.MessageType := "Informational";
*/
if called_by_editor then
client_guid := visit_obj.clientguid;
visit_guid := visit_obj.GUID;
chart_guid := visit_obj.chartguid;
orderId := "1000002689073001";
called_by := "FormOpen";
else
client_guid := this_comm.ClientGUID;
visit_guid := this_comm.ClientVisitGUID;
chart_guid := this_comm.ChartGuid;
orderid := this_comm.ItemID;
endif;
/*------------------------------------------------------------*/
/* Assign pointers to the Field list and to individual fields */
/*------------------------------------------------------------*/
field_list := this_form.fields;
comb_ht_wt_fld := first of (field_list
where field_list.DataItemName = Measurements_di);
APTT_val_sec_fld := first of (field_list
where field_list.DataItemName = APTT_val_sec_di);
curr_rate_u_h_fld := first of (field_list
where field_list.DataItemName = curr_rate_u_h_di);
curr_rate_adj_fld := first of (field_list
where field_list.DataItemName = curr_rate_adj_di);
adj_val_u_k_h_fld := first of (field_list
where field_list.DataItemName = adj_val_u_k_h_di);
calc_rate_fld := first of (field_list
where field_list.DataItemName = calc_rate_di);
iv_rate_u_h_fld := first of (field_list
where field_list.DataItemName = iv_rate_u_h_di);
iv_rate_ml_h_fld :=first of (field_list
where field_list.DataItemName = iv_rate_ml_comp );
EdLocFld := first of (field_list
where field_list.DataItemName = "ED Location");
FromOrderSet := first of (field_list
where field_list.DataItemName = "MLM_From Order Set");
/*--------------------------------------*/
/* RS: 06/12 get location */
/*--------------------------------------*/
If (called_by = "FormOpen") or (call_field = "MLM_From Order Set")
then
if (curr_rate_adj_fld.value is null) or (curr_rate_adj_fld.Value <> "Initial")
then
curr_rate_adj_fld.value := null;
adj_val_u_k_h_fld.value := null;
iv_rate_u_h_fld.Value:= null;
iv_rate_ml_h.Amount := null;
endif;
//Retrieve Patient{{{SINGLE-QUOTE}}}s Current Location
LocName:= read last
{"SELECT currentlocation "
|| " FROM cv3clientvisit "
|| " WHERE ClientGUID = " || SQL(client_guid )
|| " And GUID = " || SQL(visit_guid)};
EdLocFld.Value := LocName;
ApttVal := read last
{"Select top 1 bo.value "
|| " From cv3order as o with (nolock) "
|| " join cv3basicobservation as bo with (nolock) "
|| " on o.clientguid = bo.clientguid "
|| " and o.chartguid = bo.chartguid "
|| " and o.guid = bo.orderguid "
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|| " and bo.Active = 1 "
|| " And bo.IsHistory = 0 "
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|| " and ocmi.active = 1 "
|| " and ocmi.name = {{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}} "
|| " where o.clientguid = " || SQL(client_guid)
|| " and o.chartguid = " || SQL(chart_guid)
|| " and o.performeddtm >= (DATEADD(hour, -28, getdate())) "
|| " order by o.performeddtm desc "
};
CompVal := ApttVal As Number;
APTT_val_sec_fld.VALUE := CompVal;
If (FromOrderSet.Value = True) then
orderlist := read
{" Select guid from cv3ordercatalogmasteritem "
|| " where (name = {{{SINGLE-QUOTE}}}Heparin 25,000 Units + D5W 500ml{{{SINGLE-QUOTE}}}) or "
|| " (name = {{{SINGLE-QUOTE}}}Heparin 25,000 Units + 0.9% NaCl 500ml{{{SINGLE-QUOTE}}}) "
|| " and active = 1 "
};
orderid1:=First(orderlist);
orderid2:=Last(orderlist);
OldRate := read last
{" Select top 1 oud.value "
|| " from cv3order as o with (nolock) "
|| " join cv3orderuserdata as oud with (nolock) "
|| " on oud.orderguid= o.guid "
|| " and oud.userdatacode = {{{SINGLE-QUOTE}}}PRX_DRIPINIT{{{SINGLE-QUOTE}}} "
|| " where o.clientguid = " || SQL(client_guid)
|| " and o.chartguid = " || SQL (chart_guid)
|| " and (o.ordercatalogmasteritemguid = " || SQL(orderid1)
|| " or o.ordercatalogmasteritemguid = " || SQL(orderid2) || ") "
|| " and o.requesteddtm <= getdate() "
|| " order by o.requesteddtm desc, o.createdwhen desc"
};
else
OldRate := read last
{" Select top 1 oud.value "
|| " from cv3order as o with (nolock) "
|| " join cv3orderuserdata as oud with (nolock) "
|| " on oud.orderguid= o.guid "
|| " and oud.userdatacode = {{{SINGLE-QUOTE}}}PRX_DRIPINIT{{{SINGLE-QUOTE}}} "
|| " where o.clientguid = " || SQL(client_guid)
|| " and o.chartguid = " || SQL (chart_guid)
|| " and o.ordercatalogmasteritemguid = " || SQL(orderid)
|| " and o.requesteddtm <= getdate() "
|| " order by o.requesteddtm desc, o.createdwhen desc"
};
endif;
/* test := (curr_rate_adj_fld.value is null) or (curr_rate_adj_fld.Value <> "Initial") ;
curr_rate_adj_fld.value := "Decrease";
adj_val_u_k_h_fld.value := 3;
this_comm.Message := "Old Rate Set to " || OldRate
|| "\n\n Rate Adjust set to \n" || curr_rate_adj_fld.Value
|| "If statement would return " ||test;
this_comm.MessageType := "Error";
*/
If (curr_rate_adj_fld.value is null) or (curr_rate_adj_fld.Value <> "Initial") then
curr_rate_u_h_fld.value := OldRate;
APTT_val_sec_fld.Control_Mandatory := true;
iv_rate_ml_h_fld.control_read_only := True;
iv_rate_u_h_fld.control_read_only := True;
else
curr_rate_u_h_fld.value := NULL;
endif;
// now for the suggested calculations
If (exists APTT_val_sec_Fld)
and (exists curr_rate_u_h_fld) then
If (curr_rate_adj_fld.Value <> "Initial" or curr_rate_adj_fld.Value is null) then
If CompVal < 66 then
curr_rate_adj_fld.value := "Increase";
adj_val_u_k_h_fld.value := 4;
elseif (CompVal >= 66) and (CompVal <= 76) then
curr_rate_adj_fld.value := "Increase";
adj_val_u_k_h_fld.value := 2;
elseif (CompVal >= 77) and (CompVal <= 115) then
curr_rate_adj_fld.value := "No Change";
adj_val_u_k_h_fld.value := null;
adj_val_u_k_h_fld.Control_Read_Only := true;
elseif (CompVal >= 116) and (CompVal <= 134) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_k_h_fld.value := 2;
elseif (CompVal > 134) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_k_h_fld.value := 3;
fatal_error := true;
this_comm.Message := "Please Note that recent APTT above 114 Seconds \n\n"
||"Please STOP HEPARIN INFUSION for 1 hour... \n\n"
||"Then resume at new rate as calculated on this order";
this_comm.MessageType := "Error";
endif;
endif;
else
curr_rate_adj_fld.value := null;
adj_val_u_k_h_fld.value := null;
endif;
endif;
If EdLocFld.Value matches pattern "ER%" then
IsED := True;
else
IsED := False;
endif;
/*------------------------*/
/* get values from fields */
/*------------------------*/
if exists comb_ht_wt_fld then
// comb_ht_wt_fld.control_read_only := true;
comb_ht_wt_val := comb_ht_wt_fld.Value;
wt := comb_ht_wt_val.weight;
ht := comb_ht_wt_val.height;
wt_type := comb_ht_wt_val.weighttype;
bsa := comb_ht_wt_val.bsa;
bmi := comb_ht_wt_val.bmi;
endif;
if exist curr_rate_u_h_fld then
if curr_rate_u_h_fld.Value is null then
curr_rate_u_h := 0;
else
curr_rate_u_h := curr_rate_u_h_fld.Value;
endif;
endif;
if exist curr_rate_adj_fld then
adj_action := curr_rate_adj_fld.Value;
endif;
if exist adj_val_u_k_h_fld then
adj_amt_u_k_h := adj_val_u_k_h_fld.Value as number;
endif;
if exist iv_rate_u_h_fld then
iv_rate_u_h := iv_rate_u_h_fld.Value;
// iv_rate_amt := iv_rate_u_h.AMOUNT as number;
// iv_rate_uom := iv_rate_u_h.UOM;
endif;
if exist iv_rate_ml_h_fld then
iv_rate_ml_h := iv_rate_ml_h_fld.Value;
endif;
/*----------------------------------*/
/* process form fields and settings */
/* only if no errors are found */
/*----------------------------------*/
if not fatal_error then
// if (called_by = "FormOpen") or (call_field = "MLM_From Order Set" ) then
// curr_rate_u_h_fld.Control_Read_Only := false;
// curr_rate_u_h_fld.Value := iv_rate_u_h.Amount;
// curr_rate_u_h_fld.Control_Read_Only := true;
/// APTT_val_sec_fld.Control_Mandatory := false;
// APTT_val_sec_fld.Value := null;
If (call_field = "PRX_DRIPINIT") then
marker:=true;
checkrate := iv_rate_u_h_fld.Value ;
if ((floor (checkrate /50)) <> (ceiling(checkrate /50)) or (checkrate is null) or (checkrate =0)) then
this_comm.Message := "Your IV Rate Must Be Divisible by 50" || "\n\n" ||
"You Entered: " || checkrate;
this_comm.MessageType := "Error";
iv_rate_u_h_fld.value:=null;
iv_rate_ml_h.Amount := null;
else
iv_rate_ml_h.Amount := checkrate /50;
endif;
elseif (called_by = "FormClose") then
local_session.Sess_APTTValue:= (APTT_val_sec_fld.VALUE as number);
// TMS added PRX_HepWbCurrentRate to logic to prevent looping when current rate is changed
// elseif (call_field ="PRX_HepWtBase_APTTvalue") and (curr_rate_adj_fld.value is null or curr_rate_adj_fld.Value <> "Initial") then
elseif ((call_field ="PRX_HepWtBase_APTTvalue") or (call_field = "PRX_HepWbCurrentRate")) and (curr_rate_adj_fld.value is null or curr_rate_adj_fld.Value <> "Initial") then
iv_rate_u_h_fld.Value:= null;
iv_rate_ml_h.Amount := null;
If (curr_rate_adj_fld.value is null or curr_rate_adj_fld.Value <> "Initial") then
APTT_val_sec_fld.Control_Mandatory := true;
curr_rate_adj_fld.value := null;
adj_val_u_k_h_fld.value := null;
endif;
CompVal := APTT_val_sec_fld.VALUE As Number;
If CompVal is not null then
If (exists APTT_val_sec_Fld) and (exists curr_rate_u_h_fld) then
If CompVal < 66 then
curr_rate_adj_fld.value := "Increase";
adj_val_u_k_h_fld.value := 4;
elseif (CompVal >= 66) and (CompVal <= 76) then
curr_rate_adj_fld.value := "Increase";
adj_val_u_k_h_fld.value := 2;
elseif (CompVal >= 77) and (CompVal <= 115) then
curr_rate_adj_fld.value := "No Change";
adj_val_u_k_h_fld.value := null;
adj_val_u_k_h_fld.Control_Read_Only := true;
elseif (CompVal >= 116) and (CompVal <= 134) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_k_h_fld.value := 2;
elseif (CompVal > 134) then
curr_rate_adj_fld.value := "Decrease";
adj_val_u_k_h_fld.value := 3;
endif;
endif;
endif;
elseif (call_field = calc_rate_di) or (called_by = "FormOpen") or (FromOrderSet.Value = True) then
If (exists APTT_val_sec_Fld) and (exists curr_rate_u_h_fld) then
calc_rate_fld.Value := False;
CompVal := APTT_val_sec_fld.VALUE As Number;
if (CompVal > 134) then
fatal_error := true;
this_comm.Message := "Please Note that recent APTT above 134 Seconds \n\n"
||"Please STOP HEPARIN INFUSION for 1 hour... \n\n"
||"Then resume at new rate as calculated on this order";
this_comm.MessageType := "Error";
endif;
if adj_action = "Initial" then
/* clear adjustment field and make read only */
adj_val_u_k_h_fld.Value := null;
adj_val_u_k_h_fld.Control_Mandatory := false;
adj_val_u_k_h_fld.Control_Read_Only := true;
/* calculate initial rate units/hr */
calc_rate_u_h := (wt * 18) + curr_rate_u_h;
round_rate_u_h := int((calc_rate_u_h + 25)/50) * 50;
iv_rate_u_h_fld.Value := round_rate_u_h;
// iv_rate_u_h.Amount := round_rate_u_h;
// iv_rate_u_h.UOM := "units/hr";
/* calculate rate ml/hr */
calc_rate_ml_h := round_rate_u_h / hep_soln_conc;
iv_rate_ml_h.Amount := calc_rate_ml_h as number;
elseif adj_action = "No Change" then
/* clear adjustment field and make read only */
adj_val_u_k_h_fld.Value := null;
adj_val_u_k_h_fld.Control_Mandatory := false;
adj_val_u_k_h_fld.Control_Read_Only := true;
// APTT_val_sec_fld.Control_Mandatory := true;
/* calculate "new" rate units/hr */
calc_rate_u_h := (wt * 0) + curr_rate_u_h;
round_rate_u_h := int((calc_rate_u_h + 25)/50) * 50;
iv_rate_u_h_fld.Value := round_rate_u_h;
// iv_rate_u_h.Amount := round_rate_u_h;
// iv_rate_u_h.UOM := "units/hr";
/* calculate rate ml/hr */
calc_rate_ml_h := round_rate_u_h / hep_soln_conc;
iv_rate_ml_h.Amount := calc_rate_ml_h as number;
elseif (adj_action = "Increase") or (adj_action = "Decrease") then
adj_rate_u_h := adj_amt_u_k_h * wt;
if adj_action = "Decrease" then
adj_rate_u_h := -adj_rate_u_h;
endif;
calc_rate_u_h := curr_rate_u_h + adj_rate_u_h;
round_rate_u_h := int((calc_rate_u_h + 25)/50) * 50;
iv_rate_u_h_fld.Value := round_rate_u_h;
// iv_rate_u_h.Amount := round_rate_u_h;
// iv_rate_u_h.UOM := "units/hr";
/* calculate rate ml/hr */
calc_rate_ml_h := round_rate_u_h / hep_soln_conc;
iv_rate_ml_h.Amount := calc_rate_ml_h as number;
endif;
endif; // if exists
endif; // called_by = ...
endif; // not fatal error
;;
evoke: // No evoke statement
;;
logic:
conclude true; // always, to return modified objects
;;
action:
/*-----------------------------------------------------------*/
/* return communication_type and form_type objects to system */
/*-----------------------------------------------------------*/
return this_comm, this_form;
;;
end:

View File

@@ -0,0 +1,97 @@
maintenance:
title: St.Clair: Home Health Services PHCO info;;
mlmname: FORM_HH_PHCO;;
arden: version 2;;
version: 5.50;;
institution: St Clair;;
author: Debbie Eiler/Kathy B.;;
specialist: Shawn Head;;
date: 2012-03-14;;
validation: testing;;
library:
purpose: Determines what informational info to display on the "Home Health Service" order for patients.
;;
explanation: This MLM is called from the HHS Home Care Ord form.
It set the value of HH-Instructions to either.....
1. "Your Physician has ordered Home Health Services. If you have not spoken with someone before you leave we will be contacting you within 24 hours."
OR
2. "Call the Home Health Agency if they have not contacted you with 24 hours."
(NOTE: 1. is used when there is no "Home Care Provider" selected on the entered order.)
(NOTE: 2. is used when there is an active provider selected. )
CHANGE HISTORY
3-14-2012 STH - Created this MLM net-new
;;
keywords: Called MLMs, Form fields, HH, Home Health, PHCO HH, PHCO Home Health
;;
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 the 2 messages below to what to display to the patient on the order details/summary line.
PHCO_msg_with_hcp := "Call the Home Health Agency if they have not contacted you within 24 hours.";
PHCO_msg_without_hcp := "Your Physician has ordered Home Health Services. If you have not spoken with someone before you leave we will be contacting you within 24 hours.";
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
// Value the Home Care Provider current selected
hcp_value := last of (field_list where field_list.DataItemName = "Obj_Plus_Home Care list" );
phco_msg := last of (field_list where field_list.DataItemName = "HH-Instructions");
//this_communication.DisplayForm := "Yes";
//this_communication.Message := "You have entered " || hcp_value || " diets " || "\n" || "\n" || StopMessage;
//this_communication.MessageType := "Error";
//Checks to see if the hcp_value (Health Care Provider) on the order form is blank. If blank show PHCO_msg_without_hcp else show PHCO_msg_with_hcp
If hcp_value.value is null or hcp_value.value = ""
then
phco_msg.value := PHCO_msg_without_hcp;
else
phco_msg.value := PHCO_msg_with_hcp;
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:

View File

@@ -0,0 +1,385 @@
maintenance:
title: Form_HoldOrder_RequestedTime;;
mlmname: Form_HoldOrder_RequestedTime;;
arden: version 2;;
version: 4.50;;
institution: St. Clair Hospital;;
author: Teresa Spicuzza ;;
specialist: Eclipsys Corporation;;
date: 2010-10-27;;
validation: testing;;
library:
purpose: Change med orders to scheduled start time.
;;
explanation: ( )
Change history
01.30.2012 TMS Added routines for Now and Then Dosing to only make Start Now Checkbox visible to
IT and CCM physicians during pilot period. Also verifies on form open if Start Now
checkbox will be available. Not available in hold session, if order preconfigured
as PRN, if order is preconfigured with a one time or User Schedule frequency. If
order is preconfigured with start now checked and a duration other than times, alert
user to only use Times with Start Now.
03.05.2013 TMS Added call to FORM_MED_Irreg_Sched to populate Rx Comments and Rx Instructions for meal
frequencies when pre-configured on a child order. CSR 31322
04.08.2013 TMS Added call to FORM_SCIP_Abx_Dosing MLM on form open CSR 31359
08.12.2013 TMS Added logic for PRN reason to be mandatory upon form open for Behav. Health patients. CSR 31639
08.14.2013 TMS Added logic to make PRN field visible if hidden on form for Behav. Health patients. CSR 31639
08.15.2013 TMS Changed prn reason to not mandatory until dept ensures reason indicated by physician. CSR 31639
10.08.2013 TMS Changed the users who can use the "now and then" functionality on form open from particular
users as part of the pilot to all physician and physician extenders. CSR 26926
11.07.2013 TMS Commented out the users who can use the "now and then" functionality to allow nurses,
secretaries and pharmacists access. CSR 26926
02.21.2014 TMS Added functionality for STAT and Then orders, modified to allow use of PRN with Stat/Now and then orders.
Updated to use Total doses UDDI to populate the stop after field with appropriate value. CSR 31883
06.16.2014 TMS Add call to FORM_S2V_ORM_FORMOPEN to form open mlm calls for Admission Order Rec project. CSR 31688
06.17.2014 DW CSR# 32133 Added call to Automatic Medication Scheduling mlm
08.25.2014 TMS Added logic to form open for ORM orders on chemical restraint forms. If medical management indication
is prefilled on an order template, remove read only control from frequency and indication to allow
changing the preselected indication and allow entry of a frequency when chosen from the order browse.
Trackit Ticket # 167748
02.25.2016 JML CSR 32396: Modified to call FORM_PERICARDITIS_PAIN_ORDER mlm to protect all medication relevant ordering fields.
04.27.2016 TMS Added coding for Order Management CSR 33465
05.31.2016 JML CSR 34091: Modified to call FORM_ANTIBIOTIC_ORDERS_PROTECT_DOSE for several antibiotic orders.
04.11.2017 TMS Modified to add FORM_Rx_Pediatric_Acetaminophen and Form_Rituxin as a called MLM from this MLM instead of having
the reverse to keep this as the "master" MLM that calls others for form open, being done in preparation for using
hidden default dosing. Added call to FORM_RX_Default_Medication_Values CSR 35364.
05.10.2017 JML CSR 35272: Modified to work with new Sepsis Unknown Source Antibiotic ED order set AND
Sepsis Work Up Orders (ED) order set
09.14.2017 TMS CSR 35956: Added temporary alert message for hydromorphone shortage.
09.21.2017 TMS CSR 35956: Removed temporary alert message for hydromorphone shortage.
03.13.2018 TMS CSR 34822: Add Logic to call PRX_Sched_Logic to protect Zosyn extended infusion start date/time and frequency.
04.19.2018 TMS CSR 35320: Remove setting medications to {{{SINGLE-QUOTE}}}Scheduled/Start Time{{{SINGLE-QUOTE}}} when order is placed from the anesthesia post op order sets for
medications being ordered for PACU or OPSU.
05.16.2018 TMS CSR 33940: Add "With Dialysis Treatment" to Frequency retrievals that contain As Ordered.
01.29.2019 TMS CSR 37266: Remove setting medications to {{{SINGLE-QUOTE}}}Scheduled/Start Time{{{SINGLE-QUOTE}}} when order is placed from two new anesthesia post op order sets
(Standard and Supplemental) for medications being ordered for PACU or OPSU.
09.26.2019 TMS CSR 38305: Added logic to set start time to Routine if location is Infusion Center.
;;
keywords:
Hold, requested Time, Start time;
;;
knowledge:
type: data-driven;;
data:
/********************Make Changes To Spelling And Flags In This Section*********************/
/* send_alert := "DoNotSend";
*/
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
/*
//--------------------------------------------------------------------------
local_session := cds_session.local;
//--------------------------------------------------------------------------
*/
// 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;
comm_obj := this_communication.primaryobj;
CalledBy := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
IrregFreqOrders := MLM {{{SINGLE-QUOTE}}}FORM_MED_Irreg_Sched{{{SINGLE-QUOTE}}};
SCIPAbxOrder := MLM {{{SINGLE-QUOTE}}}FORM_SCIP_Abx_Dosing{{{SINGLE-QUOTE}}};
AutoMedScheduling := MLM {{{SINGLE-QUOTE}}}FORM_Antibiotic_Scheduling{{{SINGLE-QUOTE}}};
AdmitORM := MLM {{{SINGLE-QUOTE}}}FORM_S2V_ORM_FormOpen{{{SINGLE-QUOTE}}};
AcetaminophenOrder := MLM {{{SINGLE-QUOTE}}}FORM_Rx_Pediatric_Acetaminophen{{{SINGLE-QUOTE}}};
OrderManagement := MLM {{{SINGLE-QUOTE}}}FORM_Rx_Medication_Retrieval{{{SINGLE-QUOTE}}};
RituxinCalc := MLM {{{SINGLE-QUOTE}}}FORM_Rituxin{{{SINGLE-QUOTE}}};
DefaultMedValues := MLM {{{SINGLE-QUOTE}}}FORM_RX_Default_Medication_Values{{{SINGLE-QUOTE}}};
ZosynOrder := MLM {{{SINGLE-QUOTE}}}FORM_PRX_SCHED_LOGIC{{{SINGLE-QUOTE}}};
//CSR 32396 JML Change Begin
PericarditisOrder := MLM {{{SINGLE-QUOTE}}}FORM_PERICARDITIS_PAIN_ORDER{{{SINGLE-QUOTE}}};
Antibiotic_Stewardship_Orders := MLM {{{SINGLE-QUOTE}}}FORM_ANTIBIOTIC_ORDERS_PROTECT_DOSE{{{SINGLE-QUOTE}}};
AnesthesiaOS :=( "Anesthesia Post Op Orders",
"Anesthesia Post Op Orders - Standard",
"Anesthesia Post Op Orders - Supplemental",
"Pediatric Medication PACU Post Op OS");
//List of specific OS names to modify MLM logic handling
PericarditisOSName := "Pericarditis Pain Order Set";
ASP_OSName := ( "IntraAbdominal Antibiotic ED",
"Pneumonia Antibiotic ED",
"Pneumonia Antibiotic Outpatient ED",
"Genitourinary Antibiotic",
"Genitourinary Antibiotic ED",
"IntraAbdominal Antibiotic",
"Pneumonia Antibiotic",
"Pneumonia Antibiotic Outpatient",
"Skin Antibiotic Inpatient",
"Skin Antibiotic Inpatient ED",
"Skin Antibiotic Outpatient",
"Skin Antibiotic Outpatient ED",
"C Diff Antibiotic ED",
"C Diff Antibiotic",
"Sepsis Unknown Source Antibiotic",
"Sepsis Unknown Source Antibiotic ED",
"Antibiotic Guidelines ED",
"Antibiotic Guidelines",
"Septic Work Up Orders" );
//CSR 32396 JML Change End
ASP_with_ExtZosyn := ("Skin Antibiotic Inpatient",
"Pneumonia Antibiotic",
"Sepsis Unknown Source Antibiotic",
"IntraAbdominal Antibiotic");
// Set some needed fields
if called_by_editor then
client_guid := "9000001369400200";
visit_guid := visit_obj.GUID;
chart_guid := "9000001918900170";
orderId := "1000002689073001";
called_by := "FormOpen";
else
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGuid;
orderid := this_communication.ItemID;
endif;
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
stat_then := last of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then" );
TotalDosing := first of ( field_list WHERE field_list.DataItemName = "PRX_Dosing Total Doses");
disable_now := last of (field_list where field_list.DataItemName = "PRX_DosingNowDisabled" );
requested_date := last of (field_list where field_list.DataItemName = "RequestedDate" );
requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" );
requested_time_value := requested_time.value;
order_freq := first of (field_list where field_list.DataItemName = "FrequencyCode");
order_freq_value := order_freq.value;
order_freq_summary := order_freq_value.FrequencySummary;
newfrequency := order_freq.FrequencySummary;
session_type := comm_obj.internalprocessingtype;
Order_name:= comm_obj.name;
Order_set_name := comm_obj.OrderSetName;
nofrequency := "";
IsPRN_field := last of (field_list where field_list.DataItemName = "IsPRN" );
Reason_field := last of (field_list where field_list.DataItemName = "PRX_PRNCONDITION" );
StopAfter := first of (field_list.Value WHERE field_list.DataItemName="StopAfter" );
RX_Comments_field := last of (field_list where field_list.DataItemName = "Rx Comments");
RX_Instructions_field := last of (field_list where field_list.DataItemName = "Rx Instructions");
SCIP_Antibiotic := last of (field_list where field_list.DataItemName = "PRX_AntibioticNameforMLM");
SCIP_Antibiotic_value := SCIP_Antibiotic.value;
BehavHealth := ("PSYE", "PSYW");
med_cb := last of (field_list where field_list.DataItemName = "NUR_Not Chemical Restraint" );
med_cb_value := med_cb.value;
med_cond := last of (field_list where field_list.DataItemName = "NUR_Nonchemical Restraint Ind");
OneTimeFreq := ("As Ordered", "As-Directed", "Between Blood", "Given in Delivery Room",
"Given in Infusion Center", "Given in NSY","<QxM>", "Load", "Now", "Once", "Stat",
"One Time", "Today", "Per-Protocol", "POST OP", "Post-Procedure", "Post-Transfusion",
"PRE OP", "Pre-Procedure", "Pre-Transfusion", "<User Schedule>", "<Variable Interval>",
"With Dialysis Treatment");
continue_checking_order := TRUE;
// fire_on_User := ("MD","DO","DDS","DPM","PA","PA-C","CRNP","IT");
/* Get the current user{{{SINGLE-QUOTE}}}s occupation*/
/* userguid := this_communication.UserGUID;
UserCode := read last
{"Select occupationcode "
||" From cv3user with (nolock) "
||" Where Guid = " || SQL(userguid) };
continue_checking_order := UserCode in fire_on_User;
*/
CurrentLocationGuid := read last
{"Select CurrentLocationGuid "
||" From cv3Clientvisit "
||" Where ClientGuid = " || SQL(Client_Guid)
||" and Guid = " || SQL(Visit_Guid)
||" and VisitStatus in ({{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRE{{{SINGLE-QUOTE}}})" };
CurrentLocation := read last
{"Select Name from cv3location "
||" Where Guid = " || SQL(CurrentLocationGuid) };
If exists Reason_field and CurrentLocation in BehavHealth then
Reason_field.control_mandatory := FALSE;
Reason_field.control_visible := TRUE;
endif;
If session_type = "Hold" then
If exists order_freq and order_freq_summary = "STAT" then
order_freq_value.FrequencySummary := NULL ;
endif;
start_now.control_read_only := true;
start_now.value := false;
stat_then.control_read_only := true;
stat_then.value := false;
TotalDosing.control_read_only := true;
TotalDosing.value := "";
requested_time_value.ReqTimeCode := "Scheduled/Start Time";
endif;
//CSR 32396 JML Change
If ( CalledBy = "FormOpen" AND Order_set_name = PericarditisOSName ) then
( this_communication, this_form ) := call PericarditisOrder
with ( this_communication, this_form, client_info_obj );
elseif ( ( CalledBy = "FormOpen" OR CalledBy = "FieldChange" ) AND ( Order_Set_Name IN ASP_OSName OR Order_Set_Name matches pattern "Transition Orders%" ) ) then
( this_communication, this_form ) := call Antibiotic_Stewardship_Orders
with ( this_communication, this_form, client_info_obj );
If Order_Set_Name IN ASP_with_ExtZosyn then
( this_communication, this_form ) := call ZosynOrder
with ( this_communication, this_form, client_info_obj );
endif;
( this_communication, this_form ) := call AutoMedScheduling with ( this_communication, this_form, client_info_obj );
elseIf ( CalledBy = "FormOpen" AND Order_set_name = "Piperacillin/Tazobactam Orders" ) then
( this_communication, this_form ) := call ZosynOrder
with ( this_communication, this_form, client_info_obj );
Else
(this_communication, this_form) := call AutoMedScheduling
with (this_communication, this_form, client_info_obj);
(this_communication, this_form) := call AdmitORM
with (this_communication, this_form, client_info_obj);
(this_communication, this_form) := call OrderManagement
with (this_communication, this_form, client_info_obj);
(this_communication, this_form) := call DefaultMedValues
with (this_communication, this_form, client_info_obj);
If Order_name matches pattern "%Acetaminophen%" then
(this_communication, this_form) := call AcetaminophenOrder
with (this_communication, this_form, client_info_obj);
endif;
// TMS removed on 9.21.2017 due to shipment arriving and supply not critically low
// If Order_name matches pattern "%HYDROmorphone Inj%" or Order_name matches pattern "%HYDROmorphone Inj%" then
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Hydromorphone injection supply is critically low. \n\n Please consider ordering morphine injection. ","Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
// endif;
If Order_name = "Rituximab:" then
(this_communication, this_form) := call RituxinCalc
with (this_communication, this_form, client_info_obj);
endif;
If exists order_freq and order_freq_summary = "Now" then
start_now.control_read_only := true;
stat_then.control_read_only := true;
TotalDosing.control_read_only := true;
stopafter.number := null;
stopafter.option := "";
else
if exist Rx_comments_field then
(this_communication, this_form) := call IrregFreqOrders
with (this_communication, this_form, client_info_obj);
endif;
endif;
// If order is on a chemical restraint med form and indication for
// medication management is prepopulated, remove read only control
// from frequency and indication 08.25/2014 - TMS
If (exists med_cb and med_cb.Value = true) then
order_freq.control_read_only := false;
med_cond.control_read_only := false;
endif;
If exists order_freq and order_freq_summary in OneTimeFreq then
start_now.control_read_only := true;
stat_then.control_read_only := true;
TotalDosing.control_read_only := true;
endif;
If exists SCIP_Antibiotic and SCIP_Antibiotic.value is not NULL then
(this_communication, this_form) := call SCIPAbxOrder
with (this_communication, this_form, client_info_obj);
endif;
/* If exists IsPRN_field and IsPRN_field.value = true then
If exists start_now then
start_now.value := false;
start_now.control_read_only := true;
stat_then.value := false;
stat_then.control_read_only := true;
TotalDosing.value := "";
TotalDosing.control_read_only := true;
endif;
endif;
*/
If session_type = "Hold" then
If exists order_freq and order_freq_summary = "STAT" then
order_freq_value.FrequencySummary := NULL ;
endif;
start_now.control_read_only := true;
start_now.value := false;
stat_then.control_read_only := true;
stat_then.value := false;
TotalDosing.control_read_only := true;
TotalDosing.value := "";
If (Order_Set_Name in AnesthesiaOS or CurrentLocation matches pattern "Infus%") then
requested_time_value.ReqTimeCode := "Routine";
else
requested_time_value.ReqTimeCode := "Scheduled/Start Time";
endif; endif;
if continue_checking_order = false then
Start_Now.control_visible := FALSE;
Stat_Then.control_visible := FALSE;
TotalDosing.control_visible := FALSE;
endif;
if(Start_Now.Value = true) or (Stat_Then.Value = true) Then
StopAfter.control_read_only := true;
TotalDosing.control_read_only := false;
else
StopAfter.control_read_only := false;
TotalDosing.control_read_only := true;
/*
if(StopAfter.option = "Days" OR StopAfter.option = "Hours" OR StopAfter.option = "Minutes") then
this_communication.DisplayForm := "Yes";
this_communication.Message := "You can not select "|| StopAfter.option ||" in Stop After Window with Start Now Dosing Option. Please select {{{SINGLE-QUOTE}}}Times{{{SINGLE-QUOTE}}} option ";
this_communication.MessageType := "Error";
stopafter.option := "";
endif;
*/
endif;
endif;
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns two parameters, of types
//communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,116 @@
maintenance:
title: Home Medications Form;;
mlmname: FORM_HOME_MEDS;;
arden: version 2;;
version: 4.50;;
institution: St Clair;;
author: Eclipsys Corp;;
specialist: Mary Jo Goodwin ;;
date: 2006-12-29;;
validation: testing;;
library:
purpose: Display appropriate fields depending on which type of med is displayed
;;
explanation: This MLM is called from the three Medication Type fields.
Only one of these three fields can be populated so when one has
a value the other two will grey out.
;;
keywords: Called MLMs, Form fields, Chemical Restraint
;;
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*******************/
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
med_field := last of (field_list where field_list.DataItemName = "NUR_HM_MedicationDict" );
herbal_field := last of (field_list where field_list.DataItemName = "NUR_HM_Herbal Vita Splmts" );
unknown_field := last of (field_list where field_list.DataItemName = "NUR_HM_Med Name Unknown");
If CallingField = "NUR_HM_MedicationDict" then
If exists med_field.Value then
// if chemical restraint then hide the regular frequency field ,
herbal_field.control_read_only := TRUE;
herbal_field.control_mandatory := FALSE;
herbal_field.value := NULL;
unknown_field.control_read_only := TRUE;
unknown_field.control_mandatory := FALSE;
unknown_field.value := NULL;
else
herbal_field.control_read_only := FALSE;
herbal_field.control_mandatory := TRUE;
unknown_field.control_read_only := FALSE;
unknown_field.control_mandatory := TRUE;
endif;
Elseif CallingField = "NUR_HM_Herbal Vita Splmts" then
If exists herbal_field.value then
// if medical condition then make the regualr frequency field visible,
med_field.control_read_only := TRUE;
med_field.control_mandatory := FALSE;
med_field.value := NULL;
unknown_field.control_read_only := TRUE;
unknown_field.control_mandatory := FALSE;
unknown_field.value := NULL;
else
med_field.control_read_only := FALSE;
med_field.control_mandatory := TRUE;
unknown_field.control_read_only := FALSE;
unknown_field.control_mandatory := TRUE;
endif;
Elseif CallingField = "NUR_HM_Med Name Unknown" then
If exists unknown_field.value then
med_field.control_read_only := TRUE;
med_field.control_mandatory := FALSE;
med_field.value := NULL;
herbal_field.control_read_only := TRUE;
herbal_field.control_mandatory := FALSE;
herbal_field.value := NULL;
else
med_field.control_read_only := FALSE;
med_field.control_mandatory := TRUE;
herbal_field.control_read_only := FALSE;
herbal_field.control_mandatory := TRUE;
endif;
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:

View File

@@ -0,0 +1,82 @@
maintenance:
title: FORM_HYPERLINKS;;
mlmname: FORM_HYPERLINKS;;
arden: version 2;;
version: 4.50;;
institution: St Clair Hospital;;
author: Robert Spence;;
specialist: ;;
date: 2008-07-09;;
validation: testing;;
library:
purpose: --TESTING--
;;
explanation:
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
/****************Make Changes To Spelling And Flags In This Section********************/
// Set to true if a decision.log is needed.
log_execution_info:= FALSE;
/**************************************************************************************/
// This MLM is passed three arguments
// communication_type, form_type and client info object respectively.
(this_communication, this_form, client_info_obj) := argument;
//Get the calling event and form data
calling_event := this_communication.callingevent;
calling_form := this_form.name;
calling_field_name := this_communication.callingfieldname;
field_list := this_form.fields;
if calling_field_name matches pattern "%|%" then
//Determine the MultiFieldOccNum and DataItemName using a call to another MLM to parse the string
parse_mlm :=MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
parsed_string := CALL parse_mlm with (calling_field_name,"|");
calling_field := first of parsed_string;
multi_field_num := last of parsed_string as number;
// Assigns fields passed in the Form object to the Field object
mlm_field := first of (field_list where field_list.DataItemName = calling_field AND field_list.control_multifieldoccnum = multi_field_num);
else
mlm_field := first of (field_list where field_list.DataItemName = calling_field_name);
endif;
//Retrieve the hyperlink substring from the field value
substring_mlm := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_BETWEEN{{{SINGLE-QUOTE}}};
link_value:=CALL substring_mlm with (mlm_field.value,"(",")");
if exists mlm_field then
/****************************************FFI*********************************************/
shell_to_win := INTERFACE
{long shell32:ShellExecuteA(long, char*, char*, char*, char*, char*)};
x := call shell_to_win with 0, "open",
link_value,NULL, NULL, "SW_SHOWNORMAL";
/**************************************END OF FFI****************************************/
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:

View File

@@ -0,0 +1,251 @@
maintenance:
title: FORM_HYPOGLYCEMIA_PROTOCOL_ADULTS;;
mlmname: FORM_HYPOGLYCEMIA_PROTOCOL_ADULTS;;
arden: version 2.5;;
version: 6.10;;
institution: St. Clair Hospital ;;
author: Shivprasad Jadhav;;
specialist: Shivprasad Jadhav, Allscripts;;
date: 2015-02-23;;
validation: testing;;
library:
purpose: Change History
============================================
20-04-2015 CSR-33068 : Created
Scenario 1 : When user selects/deselects Nursing instruction of patients with gastric bypass then IV of D5W and nursing to physician notification of "
after administration of IV of D5W at 80ml/hours , call physician for furthur orders." gets automatically selected/deselected.
Scenario 2 : User should also be able to select /deselect manually IV of D5W and when done so nursing to physician notification of "
after administration of IV of D5W at 80ml/hours , call physician for furthur orders." should be pre selected/deselected
as that is needed for blood sugar <=39mg/dl.
Scenario 3 : When scernario 2 is done , i.e. IV d5w is selected/deselected ,then nursing instruction of patient with gastric bypass should not get pre selected/ deselected.;;
explanation:
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
( this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
field_list:= this_form.Fields;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
Nursing_Instruction := last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline"
and field_list.Control_MultiFieldOccNum = 5 );
Nurs_Instr_WotGBypass := last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline"
and field_list.Control_MultiFieldOccNum = 2 );
Nursing_Instruction4 := last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline"
and field_list.Control_MultiFieldOccNum = 4 );
Nursing_Instruction6 := last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline"
and field_list.Control_MultiFieldOccNum = 6 );
IV_Fluid := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 50 );
Nursing_Phy_Notification := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 55 );
Medication := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 56 );
Nursing_Instruction_CHK :=Nursing_Instruction.Value;
IV_Fluid_Value := IV_Fluid.Value ;
Nursing_Phy_Notification_Val := Nursing_Phy_Notification.Value;
Medication_Val := Medication.Value;
Nursing_Instr2_CHK := Nurs_Instr_WotGBypass.Value ;
// *********** Objects for first flow *************
CHKBOX_Nursing := first of (Nursing_Instruction_CHK where Nursing_Instruction_CHK.Name = "Nursing Instructions");
GR_D5W_1000 := first of (IV_Fluid_Value where IV_Fluid_Value.Name = "D5W 1000ml"); // D5W 1000ml
GR_Nursing_To_Phy := Nursing_Phy_Notification_Val[2]; // "Nursing To Physician Notification"
GR_Dextrose_50 := Medication_Val[3]; // "Dextrose 50 %"
//=========================================================================================================
if ( CallingEvent = "FieldChange" ) then
if ( CallingField = "MultiOrderInline|5" or CallingField = "MultiOrderInline|2" ) then
Inline1 :=1;
Inline2 :=1;
if ( CallingEvent = "FieldChange" ) then
if ( CallingField = "MultiOrderInline|5") then
if ( true IN CHKBOX_Nursing.IsSelected ) then
GR_D5W_1000.IsSelected := true;
GR_Nursing_To_Phy.IsSelected := true ;
GR_D5W_1000.IsReadonly := true;
GR_Nursing_To_Phy.IsReadonly := true ;
Inline1 := 100 ;
endif;
endif;
endif;
if ( CallingEvent = "FieldChange" ) then
if ( CallingField = "MultiOrderInline|5") then
if ( False IN CHKBOX_Nursing.IsSelected ) then
//If CHKBOX_Nursing.IsSelected = False And GR_D5W_1000.IsReadonly = true And GR_Nursing_To_Phy.IsReadonly = true And CHKBOX_Nursing.IsSelected = False Then
/* GR_D5W_1000.IsSelected := False;
GR_Nursing_To_Phy.IsSelected := False ;
GR_D5W_1000.IsReadonly := False;
GR_Nursing_To_Phy.IsReadonly := False ; */
Inline1 := 111 ;
//Endif;
endif;
endif;
endif;
// Third flow ******************************************************************************
//CHKBOX_Nursing := Nursing_Instruction_CHK.Records__; //first of (Nursing_Instruction_CHK Where Nursing_Instruction_CHK.value ="");
CHKBOX_Nursing1 := first of (Nursing_Instr2_CHK where Nursing_Instr2_CHK.Name = "Nursing Instructions");
if ( CallingEvent = "FieldChange" ) then
if ( CallingField = "MultiOrderInline|2") then
if ( true IN CHKBOX_Nursing1.IsSelected ) then
GR_D5W_1000.IsSelected := true;
GR_Dextrose_50.IsSelected := true ;
GR_Nursing_To_Phy.IsSelected := true ;
GR_D5W_1000.IsReadonly := true;
GR_Dextrose_50.IsReadonly := true ;
GR_Nursing_To_Phy.IsReadonly := true ;
Inline2 := 100 ;
endif;
endif;
endif;
if ( CallingEvent = "FieldChange" ) then
if ( CallingField = "MultiOrderInline|2") then
if ( False IN CHKBOX_Nursing1.IsSelected ) then
//If CHKBOX_Nursing1.IsSelected = False And GR_D5W_1000.IsReadonly = true And GR_Nursing_To_Phy.IsReadonly = true And GR_Dextrose_50.IsReadonly = False And CHKBOX_Nursing.IsSelected = False Then
/* GR_D5W_1000.IsSelected := False;
GR_Dextrose_50.IsSelected := False ;
GR_Nursing_To_Phy.IsSelected := False ;
GR_D5W_1000.IsReadonly := False;
GR_Dextrose_50.IsReadonly := False ;
GR_Nursing_To_Phy.IsReadonly := False ; */
Inline2 := 111 ;
//endif;
endif;
endif;
endif;
If ( Inline1 =111 And Inline2 =111 ) or ( CHKBOX_Nursing.IsSelected = False And Inline2 =111 ) Then
GR_D5W_1000.IsSelected := False;
GR_Dextrose_50.IsSelected := False ;
GR_Nursing_To_Phy.IsSelected := False ;
GR_D5W_1000.IsReadonly := False;
GR_Dextrose_50.IsReadonly := False ;
GR_Nursing_To_Phy.IsReadonly := False ;
Inline1 :=1 ;
Inline2 :=1 ;
ElseIf ( CHKBOX_Nursing.IsSelected = True And Inline2 = 111 ) Then
GR_Dextrose_50.IsSelected := False ;
GR_Dextrose_50.IsReadonly := False;
Inline2 := 1;
ElseIf ( CHKBOX_Nursing.IsSelected = False And CHKBOX_Nursing1.IsSelected = False )or ( Inline1 =111 And CHKBOX_Nursing1.IsSelected = False ) Then
GR_D5W_1000.IsSelected := False;
GR_Nursing_To_Phy.IsSelected := False ;
GR_D5W_1000.IsReadonly := False;
GR_Nursing_To_Phy.IsReadonly := False ;
Inline1 := 1 ;
//ElseIf
Endif;
Endif;
Endif;
// Second flow ******************************************************************************
If GR_D5W_1000.IsSelected = true Then
GR_Nursing_To_Phy.IsSelected := true ;
GR_Nursing_To_Phy.IsReadonly := true ;
Endif;
If GR_D5W_1000.IsSelected = False And GR_Nursing_To_Phy.IsReadonly = true Then
GR_Nursing_To_Phy.IsSelected := False ;
GR_Nursing_To_Phy.IsReadonly := False ;
Endif;
// fourth Flow ************************************************************************
GR2_Dextrose_50 := Medication_Val[2]; // "Dextrose 50 %"
Nursing_Instruction4_CHK :=Nursing_Instruction4.Value;
B := Nursing_Instruction4_CHK[2];
CHKBOX_Nursing4 := Last of (Nursing_Instruction4_CHK where Nursing_Instruction4_CHK.Name = "Nursing Instructions");
if ( CallingEvent = "FieldChange" ) then
if ( CallingField = "MultiOrderInline|4") then
if ( true IN CHKBOX_Nursing4.IsSelected ) then
GR2_Dextrose_50.IsSelected := True ;
GR2_Dextrose_50.IsReadonly := True ;
endif;
endif;
endif;
if ( CallingEvent = "FieldChange" ) then
if ( CallingField = "MultiOrderInline|4") then
if ( False IN CHKBOX_Nursing4.IsSelected ) then
GR2_Dextrose_50.IsSelected := False ;
GR2_Dextrose_50.IsReadonly:= False ;
endif;
endif;
endif;
// Fifth Flow **************************************************************************************
GR1_Dextrose_50 := Medication_Val[1]; // "Dextrose 50 %"
Nursing_Instruction6_CHK :=Nursing_Instruction6.Value;
C := Nursing_Instruction6_CHK[2];
CHKBOX_Nursing6 := Last of (Nursing_Instruction6_CHK where Nursing_Instruction6_CHK.Name = "Nursing Instructions");
if ( CallingEvent = "FieldChange" ) then
if ( CallingField = "MultiOrderInline|6") then
if ( true IN CHKBOX_Nursing6.IsSelected ) then
GR1_Dextrose_50.IsSelected := True ;
GR1_Dextrose_50.IsReadonly := True ;
endif;
endif;
endif;
if ( CallingEvent = "FieldChange" ) then
if ( CallingField = "MultiOrderInline|6") then
if ( False IN CHKBOX_Nursing6.IsSelected ) then
GR1_Dextrose_50.IsSelected := False ;
GR1_Dextrose_50.IsReadonly:= False ;
endif;
endif;
endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,138 @@
maintenance:
title: Repeat Orders -- Add Order GUID to form;;
filename: FORM_ID_RepeatOrders;;
arden: version 2;;
version: 4.50;;
institution: Eclipsys;;
author: Sharon Kelly;;
specialist: Robert Spence;;
date: 2007-05-01;;
validation: testing;;
library:
purpose: This MLM is being used as a way to suppress the transmission of orders from SCM to
the St. Claire ancillary Deficiency System if an order is a repeating order and not
the first of the set of repeating orders. St. Claire wants only the first of a set
of repeating orders to be sent to the deficiency system. This MLM fires on FormClose
when a user is entering or modifying an order. It distinguishes between whether the order
which is the context of the MLM is the master of a repeat order or a non-repeat order by
checking the control_read_only property of the RequestedTime field on the order form.
That control is set by the system to be TRUE if the order is a repeat order; otherwise it will
be FALSE on FormClose. This MLM will check the value of the control_read_only of RequestedTime.
If it is TRUE, this MLM will populate the hidden field on the form with the OrderGUID of the current
order (which is the master repeat order). That value will be propagated to all
the children -- the repeat instances generated from the master.
An interface process will read the hidden field transmitted in the HL7 message --
if the field is present and populated, the interface will use the master order GUID stored in
the message to determine whether or not this is the initial repeat or a subsequent one.
;;
explanation: This MLM is called on FormClose of any order using the form to which this MLM is attached.
The intention is to "mark" repeating orders. When the initial order of a repeating group of orders is entered.
It populates a hidden TEST_RepeatOrderID field with the OrderGUID of the Primary Object (the order
being entered).
No message is sent displayed to the user.
The order form must be configured with the TEST_RepeatOrderID field and this MLM must be triggered
by FormClose.
change history
05.03 RS Changed fields on GUID per interface Attached MLM to LAB Chemistry form{{{SINGLE-QUOTE}}}s on close
01.28.2008 DW Added logic to end the MLM if the MLM_Form_Update_Flag is on the form and is unchecked (will check the field to indicate open for modification)
02.25.2009 DW Revised the 01.28.2009 logic to bypass the edits if the form is accessd by a physician
12.03.2015 JML Removed "test" code that was never moved to PRD that was causing the order to not create.
04.04.2016 STH CSR#: 32165 - Update MLM to call GMS developed MLM that was created to update a field as not required if the conditional order check box is selected. {GO Live targeted for 4/27/2016}
;;
keywords: Called MLMs, Form fields, PRN
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
call_conditional_mlm_logic := mlm {{{SINGLE-QUOTE}}}Form_Lab_ConditionalOrder_PriorityTime{{{SINGLE-QUOTE}}};
// Assigns fields passed in the Form object to the Field object and the name of the form
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormType := this_communication.FormType;
form_name := this_form.Name;
/*-------------------------------------------*/
/* Retrieve info from other argument objects */
/*-------------------------------------------*/
//Capture the Ordering Method (Item Event), the OrderGUID, and the OrderCatalogMasterItemGUID
Order_Method := this_communication.ItemEvent; // Could be UserEnter, UserModify, UserEditUnsubmitted, SystemEnter, or SystemModify.
Order_GUID := this_communication.PrimaryObj.GUID;
Order_GUID_string := Order_GUID AS String;
RepeatOrderID_field := first of (field_list where field_list.DataItemName = "REPEAT_ORDER_GUID");
// RepeatOrderMarker_field := first of (field_list where field_list.DataItemName = "REPEAT_ORDER_MARKER");
RequestedTime_field := first of (field_list where field_list.DataItemName = "RequestedTime");
Time_Val:= RequestedTime_Field.Value;
Time_Code := Time_Val.ReqTimeCode;
// If this is a Repeat order (which it is if the RequestedTime field has been set to ReadOnly), populate
// the hidden field with the OrderGUID of this order (which is the master order). If it is not a repeat order (either configured
// as Not Repeatable or user did n{{{SINGLE-QUOTE}}}t select a repeat option on a repeatable order), do nothing (leave hidden field NULL)
// Order_Method: "UserEntry", "UserModify" , "UserEditUnsubmitted", "SystemEnter", "SystemModify"
// Change per 08/14/2007 problems If repeat order is already valued, do nothing.
If (Time_Code Is Null) Then
if RequestedTime_field.control_read_only = true then
RepeatOrderID_field.Value := Order_GUID_string;
endif;
endif;
/**** FOR DEBUGGING PURPOSES -- Commented out for Production ****************
this_communication.DisplayForm := "Yes";
// FOR DEBUGGING PURPOSES: display a message to the user
this_communication.Message :=
"Form Name = "|| form_name
|| "\nCallingEvent = " || Order_method
|| "\nOrder GUID = " || Order_GUID_string
|| "\nTime UOM= " || Time_Code;
this_communication.MessageType := "Informational";
******************************************************************************************/
(this_communication, this_form) := call call_conditional_mlm_logic with (this_communication, this_form,client_info_obj);
;;
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:

View File

@@ -0,0 +1,106 @@
maintenance:
title: Repeat Orders -- Add Order GUID to form;;
filename: FORM_ID_RepeatOrders_Rx;;
arden: version 2.5;;
version: 15.10;;
institution: Eclipsys;;
author: Teresa Spicuzza;;
specialist: Teresa Spicuzza;;
date: 2015-10-13;;
validation: testing;;
library:
purpose: This MLM is being used as a way to suppress the transmission of orders from SCM to
the St. Clair ancillary Deficiency System if an order is a repeating order and not
the first of the set of repeating orders. St. Clair wants only the first of a set
of repeating orders to be sent to the deficiency system. This MLM fires on FormClose
when a user is entering an order. That control is set by the system to be TRUE if the order is a repeat order; otherwise it will
be FALSE on FormClose. This MLM will check the value of the control_read_only of RequestedTime.
If it is TRUE, this MLM will populate the hidden field on the form with the OrderGUID of the current
order (which is the master repeat order). That value will be propagated to all
the children -- the repeat instances generated from the master.
An interface process will read the hidden field transmitted in the HL7 message --
if the field is present and populated, the interface will use the master order GUID stored in
the message to determine whether or not this is the initial repeat or a subsequent one.
;;
explanation: This MLM is called by FORM _NOW_AND_THEN on FormClose of any order listed in the logic using the the dosing
option functionality for medicatio orders. The intention is to "mark" repeating orders. When the initial order
of a repeating group of orders is entered. It populates a hidden REPEAT_ORDER_GUID_MED field with the OrderGUID
of the Primary Object (the order being entered).
No message is sent displayed to the user.
The order form must be configured with the REPEAT_ORDER_GUID_MED field and this MLM must be triggered
by FormClose.
change history
10.13.2015 TMS Copied and modified for pharmacy orders that use a dosing option group from Form_ID_Repeat_Orders.
Moved to prod 11.11.2015 Ticket # 1855646
;;
keywords: Called MLMs, Form fields, PRN
;;
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;
/***************************************************************************************/
comm_obj := this_communication.primaryobj;
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object and the name of the form
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormType := this_communication.FormType;
form_name := this_form.Name;
/*-------------------------------------------*/
/* Retrieve info from other argument objects */
/*-------------------------------------------*/
//Capture the Ordering Method (Item Event), the OrderGUID, and the OrderCatalogMasterItemGUID
// Order_Method := this_communication.ItemEvent; // Could be UserEnter, UserModify, UserEditUnsubmitted, SystemEnter, or SystemModify.
Order_GUID := this_communication.PrimaryObj.GUID;
Order_GUID_string := Order_GUID AS String;
RepeatOrderID_field := first of (field_list where field_list.DataItemName = "REPEAT_ORDER_GUID_MED");
If comm_obj.Name = "MethylPREDNISolone 4mg Dose Pak Tab" and RepeatOrderID_field.value is null Then
RepeatOrderID_field.Value := Order_GUID_string;
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:

View File

@@ -0,0 +1,281 @@
maintenance:
title: FORM_INDWELLING_VENOUS_AND_ARTERIAL_CATH;;
mlmname: FORM_INDWELLING_VENOUS_AND_ARTERIAL_CATH;;
arden: version 2.5;;
version: 6.10;;
institution: St. Clair Hospital ;;
author: Shivprasad Jadhav;;
specialist: Shivprasad Jadhav, Allscripts;;
date: 2015-03-11;;
validation: testing;;
library:
purpose: 2015-03-14 CSR-33187 : Created MLM
Scenario 1 : When user select any order of Pneumococcal Vaccine Inj. e.g. [Pneumococcal Vaccine inj-0.5 ml,for IM Frequency-ONCE],
then other same order available for same reason i.e [Pneumococcal Vaccine inj-0.5 ml,for SQ, Frequency-ONCE) should be grayed out or Visa verse.
Scenario 2 :When user select any order of Pneumococcal Vaccine Inj. e.g. [Pneumococcal Vaccine inj-0.5 ml,for SQ, Frequency-ONCE],
then other same order available for same reason i.e [Pneumococcal Vaccine inj-0.5 ml,for IM, Frequency-ONCE) should be grayed out or Visa verse
;;
explanation:
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
( this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
field_list:= this_form.Fields;
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGUID;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
Generic_MLM := MLM {{{SINGLE-QUOTE}}}FORM_GENERIC_MEDICAL_IMAGING_INDICATIONS_FOR_OS{{{SINGLE-QUOTE}}};
this_communication,this_form := Call Generic_MLM With this_communication,this_form, client_info_obj ;
Pharmacy_Infusion := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 50);
Medical_Imaging := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 58 );
Nursing_Instr := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 48 );
Non_Phy_Consult := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 31);
Pharmacy_Infusion_Value := Pharmacy_Infusion.Value ;
Medical_Imaging_Value := Medical_Imaging.Value ;
Nursing_Instr_Value := Nursing_Instr.Value ;
Non_Phy_Consult_Value := Non_Phy_Consult.Value ;
// *********** Objects for first flow *************
NACL_250ML := Pharmacy_Infusion_Value[3];
Chest_Portable := first of (Medical_Imaging_Value where Medical_Imaging_Value.Name = "Chest Portable");
Nursing4 := Nursing_Instr_Value[4];
/*If (NACL_250ML.IsSelected = True And Chest_Portable.IsSelected = False And Nursing4.IsSelected = False) or
(NACL_250ML.IsSelected = False And Chest_Portable.IsSelected = True And Nursing4.IsSelected = False) or
(NACL_250ML.IsSelected = False And Chest_Portable.IsSelected = False And Nursing4.IsSelected = True) Then
NACL_250ML.IsSelected := True ;
Chest_Portable.IsSelected := True;
Nursing4.IsSelected := True;
Chest_Portable.IsReadonly := True;
Nursing4.IsReadonly := True;
Endif;*/
If (NACL_250ML.IsSelected = True And Nursing4.IsSelected = False) or
(NACL_250ML.IsSelected = True And Nursing4.IsSelected = True) Then
NACL_250ML.IsSelected := True ;
// Chest_Portable.IsSelected := True;
Nursing4.IsSelected := True;
//Chest_Portable.IsReadonly := True;
Nursing4.IsReadonly := True;
Endif;
If ( Chest_Portable.IsSelected = True And Nursing4.IsSelected = True) or
(Chest_Portable.IsSelected = True And Nursing4.IsSelected = False)
Then
//NACL_250ML.IsSelected := True ;
Chest_Portable.IsSelected := True;
Nursing4.IsSelected := True;
//Chest_Portable.IsReadonly := True;
Nursing4.IsReadonly := True;
Endif;
If
(NACL_250ML.IsSelected = False And Nursing4.IsReadonly = True And Nursing4.IsSelected = True) Then
NACL_250ML.IsSelected := False ;
// Chest_Portable.IsSelected := False;
If Chest_Portable.IsSelected = False Then
Nursing4.IsSelected := False;
//Chest_Portable.IsReadonly := False;
Nursing4.IsReadonly := False;
Endif;
Endif;
If
( Chest_Portable.IsSelected = False And Nursing4.IsReadonly = True And Nursing4.IsSelected = True) Then
//NACL_250ML.IsSelected := False ;
Chest_Portable.IsSelected := False;
If NACL_250ML.IsSelected = False Then
Nursing4.IsSelected := False;
// Chest_Portable.IsReadonly := False;
Nursing4.IsReadonly := False;
Endif;
Endif;
// Second flow ******************************************************************************
Nursing1 := Nursing_Instr_Value[1];
Nursing2 := Nursing_Instr_Value[2];
Nursing3 := Nursing_Instr_Value[3];
If (Nursing1.IsSelected = True And Nursing2.IsSelected = False And Nursing3.IsSelected = False) or
(Nursing1.IsSelected = False And Nursing2.IsSelected = True And Nursing3.IsSelected = False) or
(Nursing1.IsSelected = False And Nursing2.IsSelected = False And Nursing3.IsSelected = True) Then
Nursing1.IsSelected := True ;
Nursing2.IsSelected := True ;
Nursing3.IsSelected := True ;
Nursing2.IsReadonly := True;
Nursing3.IsReadonly := True;
Endif;
If Nursing1.IsSelected = False And Nursing2.IsReadonly = True And Nursing3.IsReadonly = True Then
Nursing1.IsSelected := False ;
Nursing2.IsSelected := False ;
Nursing3.IsSelected := False ;
Nursing2.IsReadonly := False;
Nursing3.IsReadonly := False;
Endif;
// Third flow ******************************************************************************
Nursing6 := Nursing_Instr_Value[6];
Nursing7 := Nursing_Instr_Value[7];
Nursing8 := Nursing_Instr_Value[8];
If (Nursing6.IsSelected = True And Nursing7.IsSelected = False ) or
(Nursing6.IsSelected = False And Nursing7.IsSelected = True And Nursing7.IsReadonly = False )
Then
Nursing6.IsSelected := True ;
Nursing7.IsSelected := True ;
Nursing8.IsSelected := True ;
Nursing7.IsReadonly := True;
//Nursing14.IsReadonly := True;
Endif;
If ( Nursing6.IsSelected = False And Nursing7.IsReadonly = True ) or
(Nursing6.IsSelected = False And Nursing7.IsReadonly = True And Nursing7.IsSelected = True) Then
Nursing6.IsSelected := False ;
Nursing7.IsSelected := False ;
Nursing8.IsSelected := False ;
Nursing7.IsReadonly := False;
Nursing8.IsReadonly := False;
Endif;
// Fourth Flow *****************************************************************************
Nursing11 := Nursing_Instr_Value[11];
Nursing12 := Nursing_Instr_Value[12];
Nursing13 := Nursing_Instr_Value[13];
If (Nursing11.IsSelected = True And Nursing12.IsSelected = False ) or
(Nursing11.IsSelected = False And Nursing12.IsSelected = True And Nursing12.IsReadonly = False )
Then
Nursing11.IsSelected := True ;
Nursing12.IsSelected := True ;
Nursing13.IsSelected := True ;
Nursing12.IsReadonly := True;
//Nursing14.IsReadonly := True;
Endif;
If (Nursing11.IsSelected = False And Nursing12.IsReadonly = True ) or
(Nursing11.IsSelected = False And Nursing12.IsReadonly = True And Nursing12.IsSelected = True ) Then
Nursing11.IsSelected := False ;
Nursing12.IsSelected := False ;
Nursing13.IsSelected := False ;
Nursing12.IsReadonly := False;
Nursing13.IsReadonly := False;
Endif;
/* If LastRow = 100 Then
Nursing12.IsSelected := True ;
//Nursing12.IsReadonly := True ;
//ElseIf LastRow =99 then
// Nursing12.IsSelected := False ;
// Nursing12.IsReadonly := False ;
Endif; */
//Sixth Workflow *****************************************************************************
Nursing14 := Nursing_Instr_Value[14];
Nursing15 := Nursing_Instr_Value[15];
If (Nursing14.IsSelected = True And Nursing15.IsSelected = False ) or
(Nursing14.IsSelected = False And Nursing15.IsSelected = True And Nursing15.IsReadonly = False )
Then
Nursing14.IsSelected := True ;
Nursing15.IsSelected := True ;
Nursing15.IsReadonly := True;
Endif;
If Nursing14.IsSelected = False And Nursing15.IsReadonly = True Then
Nursing14.IsSelected := False ;
Nursing15.IsSelected := False ;
Nursing15.IsReadonly := False;
Endif;
//Seventh Workflow *****************************************************************************
Nursing16 := Nursing_Instr_Value[16];
Nursing17 := Nursing_Instr_Value[17];
If (Nursing16.IsSelected = True And Nursing17.IsSelected = False ) or
(Nursing16.IsSelected = False And Nursing17.IsSelected = True And Nursing17.IsReadonly = False )
Then
Nursing16.IsSelected := True ;
Nursing17.IsSelected := True ;
Nursing17.IsReadonly := True;
Endif;
If Nursing16.IsSelected = False And Nursing17.IsReadonly = True Then
Nursing16.IsSelected := False ;
Nursing17.IsSelected := False ;
Nursing17.IsReadonly := False;
Endif;
//Eightth Workflow *****************************************************************************
Nursing9 := Nursing_Instr_Value[9];
Nursing99 := Nursing_Instr_Value[10];
If (Nursing9.IsSelected = True And Nursing99.IsSelected = False ) or
(Nursing9.IsSelected = False And Nursing99.IsSelected = True And Nursing99.IsReadonly = False )
Then
Nursing9.IsSelected := True ;
Nursing99.IsSelected := True ;
Nursing99.IsReadonly := True;
Endif;
If Nursing9.IsSelected = False And Nursing99.IsReadonly = True Then
Nursing9.IsSelected := False ;
Nursing99.IsSelected := False ;
Nursing99.IsReadonly := False;
Endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,157 @@
maintenance:
title: Infliximab Infusion Reaction ;;
filename: FORM_Infliximab_Reaction;;
arden: version 2.5;;
version: 16.3;;
institution: St. Clair;;
author: Teresa Spicuzza;;
specialist: ;;
date: 2018-12-12;;
validation: testing;;
library:
purpose: This MLM sets the Reaction Symptoms to mandatory when Yes to reaction is checked.
;;
explanation: This MLM sets the Reaction Symptoms to mandatory when Yes to reaction is checked.
.
History:
01.22.2018 TMS CSR 37640 MLM to make the reaction symptoms mandatory when patient noted to have reaction to Infliximab.
MLM will retrieve last documented order and present info to user.
;;
keywords: Called MLMs,
;;
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*******************/
log_execution_info := FALSE;
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
/***************************************************************************************/
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
comm_obj := this_communication.primaryobj;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
YesBox := last of (field_list where field_list.DataItemName = "Checkbox" );
YesBox_value := YesBox.value;
NoBox := last of (field_list where field_list.DataItemName = "Checkbox 1" );
NoBox_value := NoBox.value;
ReactionSymptoms := first of ( field_list WHERE field_list.DataItemName = "GenericTextBox");
ClientGuid := this_communication.ClientGUID;
OrderCatGuid := this_communication.ItemID;
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
CRLF:= CR||LF;
TAB := 9 formatted with "%c";
Reaction, DateCharted, DataCode := read last {"
select top 1 oud.value, oud.CreatedWhen, oud.UserDataCode from cv3order o
join CV3OrderUserData oud on oud.OrderGUID = o.guid
where o.ordercatalogmasteritemguid = " || OrderCatGuid || "
and o.ClientGUID = " || ClientGuid || "
and (oud.UserDataCode = {{{SINGLE-QUOTE}}}GenericTextBox{{{SINGLE-QUOTE}}} or oud.UserDataCode = {{{SINGLE-QUOTE}}}Checkbox 1{{{SINGLE-QUOTE}}})
order by oud.CreatedWhen desc" };
If (DataCode = "Checkbox 1" or DataCode is Null) then
ReactionHx := "False";
Else
ReactionHx := "True";
Endif;
If CallingEvent = "FieldChange" then
If CallingField = "Checkbox" and YesBox_value = true then
ReactionSymptoms.control_mandatory := true;
NoBox.value := false;
If ReactionHx = "True" then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "This patient has a previous reaction documented on " || DateCharted
||" \n Reaction/Symptoms: " || Reaction
||" \n\n Choose YES if you would like this reaction added to the current order"
||" \n\n Choose NO to continue with your own dialog" ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
if((dialogResult as string) = "Yes") then
ReactionSymptoms.value := Reaction;
endif;
endif;
Elseif CallingField = "Checkbox" and YesBox_value = false then
ReactionSymptoms.control_mandatory := false;
ReactionSymptoms.value := null;
Elseif CallingField = "Checkbox 1" and NoBox_value = true and ReactionHx = "False" then
ReactionSymptoms.control_mandatory := false;
YesBox.value := false;
ReactionSymptoms.value := null;
Elseif CallingField = "Checkbox 1" and NoBox_value = true and ReactionHx = "True" then
dialogResult2 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "This patient has a previous reaction documented on " || DateCharted
||" \n Reaction/Symptoms: " || Reaction
||" \n\n Choose YES if you would like this reaction added to the current order and Previous Reaction changed to YES"
||" \n\n Choose NO to continue documenting as NO previous reaction." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
if((dialogResult2 as string) = "Yes") then
ReactionSymptoms.control_mandatory := true;
YesBox.value := true;
NoBox.value := false;
ReactionSymptoms.value := Reaction;
elseif ((dialogResult2 as string) = "No") then
ReactionSymptoms.control_mandatory := false;
YesBox.value := false;
ReactionSymptoms.value := null;
endif;
endif;
endif;
If CallingEvent = "FormClose" then
If YesBox.Value = false and NoBox.Value = false then
hardstop := "yes";
ReasonMessage := "Please answer YES or NO to {{{SINGLE-QUOTE}}}Previous Reaction to Infliximab?{{{SINGLE-QUOTE}}} to continue.";
else hardstop := "no";
endif;
If hardstop = "yes" then //Present user with message box and stop order set from being submitted.
this_communication.DisplayForm := "yes";
this_communication.Message := ReasonMessage;
this_communication.MessageType := "Error";
endif;
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:

View File

@@ -0,0 +1,304 @@
maintenance:
title: Form_Insulin_Sliding_Scale_calc;;
mlmname: Form_Insulin_Sliding_Scale_calc;;
arden: version 2;;
version: 4.50;;
institution: St. Clair Hospital;;
author: Teresa M. Spicuzza ;;
specialist: Josue Lopez, Eclipsys Corporation;;
date: 2007-02-02;;
validation: testing;;
library:
purpose: Populate Variable dose fields based upon Sliding scale dosing option
and baseline dose of insulin.
;;
explanation:
1. On any activation, this MLM will gather data from the fields:
a. Baseline Dose
b. Variable Dose
c. Dosing Option
2. On the FieldChange event of the Dose Options field, this MLM will
a. clear any previous values from the Variable Dose object,
b. if the Dose Option value is "Manual Entry",
i. set Dose Options Read Only atribute to "true"
ii. set the Baseline Dose Mandatory attribute to "false"
c. if the Dose Option value is "Low", "Moderate" or "High",
i. set Dose Options Read Only atribute to "false"
ii. set the Baseline Dose Mandatory attribute to "true"
3. On the ButtonClick event, this MLM will
a. set error messages for
i. missing Dosing Option
ii. Dosing Option = "Manual Entry" and Variable Doses are missing
iii.Other Dosing Option and Baseline Dosage value is missing
b. if errors are found,
i. blank out Variable Dose list
ii. display error message
c. if no errors are found, then for
i. Dosing Option = "Manual Entry"
1) if missing Baseline Dosage, convert it to 0
2) add Baseline Dosage to (entered) Variable Doses
3) display informational message about Variable Dose amount.
ii. Other Dosing Options
1) select Low, Moderate or High Variable Dose increments according
to Dosing Option chosen
2) create a Variable Dose object for each Blood Sugar range, and
3) Set Variable Dose amount = Baseline amount + increment for
each object.
MLM assigned to:
OEF: PRX_IjSS
Calling Event: ButtonClick
Calling Field: CallMLM Button
Calling Event: FieldChange
Calling Field: PRX_InsulinSlideDosing
;;
keywords:
Insulin, sliding scale;
;;
knowledge:
type: data-driven;;
data:
/******************* Make Changes To Spelling And Flags In This Section ***************/
log_execution_info := false;
low_incr := (1, 2, 3, 4, 5);
mod_incr := (1, 3, 5, 7, 9);
high_incr := (2, 4, 7, 10, 13);
dose_ranges := ("Low", "Moderate", "High");
/**************************************************************************************/
// This MLM receives three arguments from system
(this_communication, // Communication object
this_form, // Form object
client_info_obj // Arden ClientInfo object
) := argument;
// get calling event values from communication object
calling_event := this_communication.CallingEvent;
calling_field := this_communication.CallingFieldName;
// Assign pointer to the Field object, get field values
field_list := this_form.fields;
// get Baseline dose
baseline_field := first of
(field_list where field_list.DataItemName = "PRX_InsulinBaseline" );
if exists baseline_field then
baseline_value := baseline_field.value as number;
endif;
// get variable dose list
VariableDose_field := first of
(field_list where field_list.DataItemName = "VariableDose" );
if exists VariableDose_field then
dose_list := VariableDose_field.Value;
endif;
// This sets the value of the increments depending upon the dosing option selected.
Option_field := first of
(field_list where field_list.DataItemName = "PRX_InsulinSlideDosing" );
if exists Option_field then
opt_chosen := Option_field.Value;
endif;
// process fields according to calling events
if calling_event = "FieldChange" and calling_field = "PRX_InsulinSlideDosing" then
// blank out variable dose list, make read only
VariableDose_field.Control_Read_Only := false;
if exist dose_list then
for ea_dose in dose_list do
ea_dose.condition := null;
ea_dose.from := null;
ea_dose.to := null;
ea_dose.DoseInstructions := null;
ea_dose.uom := null;
ea_dose.ItemID := null;
enddo;
endif; // exist dose_list
VariableDose_field.Control_Read_Only := true;
// set field characteristics when option is chosen
if opt_chosen = "Manual Entry" then
VariableDose_field.Control_Read_Only := false;
baseline_field.Control_Mandatory := false;
elseif opt_chosen is in dose_ranges then
VariableDose_field.Control_Read_Only := true;
baseline_field.Control_Mandatory := true;
endif; // opt_chosen = ...
elseif calling_event = "ButtonClick" then
// check for errors
err_msg := "";
fatal_error := false;
if (opt_chosen is null) or (opt_chosen = "") then
fatal_error := true;
err_msg := "Please Select a Dosing Option before proceeding.";
else
if opt_chosen = "Manual Entry" then
if not exist dose_list then
fatal_error := true;
err_msg := "Dosages must be entered manually.";
endif;
elseif opt_chosen is in dose_ranges then
if (baseline_value is null) or (baseline_value = "") then
fatal_error := true;
err_msg := "Please Enter a Baseline Dose before proceeding.";
endif; // baseline_value is null
endif; // opt_chosen = ...
endif; // not exist opt_chosen
// proceed only if no errors
if fatal_error then
if exist dose_list then
for ea_dose in dose_list do
ea_dose.condition := null;
ea_dose.from := null;
ea_dose.to := null;
ea_dose.DoseInstructions := null;
ea_dose.uom := null;
ea_dose.ItemID := null;
enddo;
endif; // exist dose_list
this_communication.Message := err_msg;
this_communication.MessageType := "Error";
else // hooray, no errors!
if opt_chosen = "Manual Entry" then
if (baseline_value is null) or (baseline_value = "") then
baseline_value := 0;
endif;
for ea_dose in dose_list do
entered_dose := ea_dose.DoseInstructions as number;
final_dose := entered_dose + baseline_value;
ea_dose.DoseInstructions := final_dose;
enddo;
this_communication.Message := "Baseline amount of "
|| baseline_value || " "
|| "added to Variable Doses";
this_communication.MessageType := "Informational";
else // other options chosen
// select dosage range
if opt_chosen = "Low" then
dose_opt := low_incr;
elseif opt_chosen = "Moderate" then
dose_opt := mod_incr;
elseif opt_chosen = "High" then
dose_opt := high_incr;
endif;
inc1 := dose_opt[1];
inc2 := dose_opt[2];
inc3 := dose_opt[3];
inc4 := dose_opt[4];
inc5 := dose_opt[5];
// set the value in the Variable dose field based upon the baseline
// and dosing options selected on form
VariableDose_field.Control_Read_Only := false;
// clear exisisting Variable Dose list
if exist dose_list then
for ea_dose in dose_list do
ea_dose.condition := null;
ea_dose.from := null;
ea_dose.to := null;
ea_dose.DoseInstructions := null;
ea_dose.uom := null;
ea_dose.ItemID := null;
enddo;
endif; // exist dose_list
// create new Variable Dose list
variable_dose_type := OBJECT [Condition, From, To, DoseInstructions, UOM, ItemID];
var_dose := NEW variable_dose_type;
var_dose.condition := "Blood Sugar";
var_dose.from := "70";
var_dose.to := "149";
var_dose.DoseInstructions := (baseline_value as number);
var_dose.uom := "units";
var_dose.ItemID := NULL;
VariableDose_field.Value := VariableDose_field.Value, var_dose;
var_dose := NEW variable_dose_type;
var_dose.condition := "Blood Sugar";
var_dose.from := "150";
var_dose.to := "199";
var_dose.DoseInstructions := (baseline_value as number) + (inc1 as number);
var_dose.uom := "units";
var_dose.ItemID := NULL;
VariableDose_field.Value := VariableDose_field.Value, var_dose;
var_dose := NEW variable_dose_type;
var_dose.condition := "Blood Sugar";
var_dose.from := "200";
var_dose.to := "249";
var_dose.DoseInstructions := (baseline_value as number) + (inc2 as number);
var_dose.uom := "units";
var_dose.ItemID := NULL;
VariableDose_field.Value := VariableDose_field.Value, var_dose;
var_dose := NEW variable_dose_type;
var_dose.condition := "Blood Sugar";
var_dose.from := "250";
var_dose.to := "299";
var_dose.DoseInstructions := (baseline_value as number) + (inc3 as number);
var_dose.uom := "units";
var_dose.ItemID := NULL;
VariableDose_field.Value := VariableDose_field.Value, var_dose;
var_dose := NEW variable_dose_type;
var_dose.condition := "Blood Sugar";
var_dose.from := "300";
var_dose.to := "349";
var_dose.DoseInstructions := (baseline_value as number) + (inc4 as number);
var_dose.uom := "units";
var_dose.ItemID := NULL;
VariableDose_field.Value := VariableDose_field.Value, var_dose;
var_dose := NEW variable_dose_type;
var_dose.condition := "Blood Sugar";
var_dose.from := "350";
var_dose.to := "399";
var_dose.DoseInstructions := (baseline_value as number) + (inc5 as number);
var_dose.uom := "units";
var_dose.ItemID := NULL;
VariableDose_field.Value := VariableDose_field.Value, var_dose;
VariableDose_field.Control_Read_Only := true;
endif; // opt_chosen = ...
endif; // fatal_error
endif; // calling_event = ...
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns communication_type and form_type parameters.
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,95 @@
maintenance:
title: Retrieve Isolations;;
mlmname: Form_Isolations_Retreive;;
arden: version 2;;
version: 4.50;;
institution: St Clair Isolations MLM;;
author: Robert Spence, Eclipsys Corp;;
specialist: ;;
date: 2006-05-26;;
validation: testing;;
library:
purpose: This MLM sets the Field for Isolations per visit.
;;
explanation: This MLM takes the data sent to CDS from Medical Imaging on open
Use in On Open ONLY!
;;
keywords: Called MLMs, Form fields, Isolation, Medical Imaging, On Open Only
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
ClientGuid :=this_communication.clientguid;
ClientVisitGuid := this_communication.ClientVisitGuid;
ClientChartGuid := this_communication.ChartGuid;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
Iso_field :=last of (field_list
where field_list.DataItemName = "MI Isolation" );
// Get the Isolation Column
IsolationCol := read last
{ " Select top 1 Columnname"
|| " from cv3EnterpriseColumnData "
|| " where dataitemcode = " || SQL({{{SINGLE-QUOTE}}}Isolation{{{SINGLE-QUOTE}}})};
If exists(IsolationCol)
then
// now get the visit{{{SINGLE-QUOTE}}}s isolation status
Isolation := read last
{ " Select " || IsolationCol
|| " from CV3EnterpriseVisitData "
|| " where visitguid = " || SQL(ClientVisitGuid)};
If (Isolation Is Null)
then
Iso_field.Value :="";
else
Iso_field.Value := Isolation;
endif;
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:

View File

@@ -0,0 +1,171 @@
maintenance:
title: Ordering: Prevent the selection of conflicting Isolation Types and require at least one type be selected;;
mlmname: FORM_Isolation_Field_Edits;;
arden: version 2;;
version: 4.50;;
institution: St Clair Isolation Set MLM;;
author: Don Warnick, Eclipsys Corp;;
specialist: ;;
date: 2006-08-24;;
validation: testing;;
library:
purpose: Prevent the simultaneous slection of two conflicting Isolation Types and require that at least one Isolation Type be entered
;;
explanation: This MLM is called from the Isolation form (ISO Isolation).
If Isolation Type, "Protective" is selected, then the "Intensive Protective" selection becomes unavailable and vice versa.
If any Isolation Type is selcted, then the "No Isolation" selection becomes unavailable and vice versa.
Also require that at least one Isolation Type be selected
Changes: 07/12/2011 JM Added logic to accomodate the new label for Enhanced Droplet. Also allows only either
Droplet or Enhanced Droplet to be chosen, not both. Project#25736
;;
keywords: Called MLMs, Form fields, Isolation
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
// 1. Hide the ISO Intensive Protective check box if the ISO Protective check box has been selected and vice versa
// 2. Hide the No Isolation check box if any Isolation type has been selected and vice versa
// 3. Require that an Isolation Type be selected before closing the form
airborne := last of (field_list where field_list.DataItemName = "Iso_Airborne" );
contact := last of (field_list where field_list.DataItemName = "Iso_Contact" );
droplet := last of (field_list where field_list.DataItemName = "Iso_Droplet" );
enhanceddroplet := last of (field_list where field_list.DataItemName = "Iso_Enhanced Droplet" ); // Added 07/12/2011
protective := last of (field_list where field_list.DataItemName = "Iso_Protective" );
intensive_protective := last of (field_list where field_list.DataItemName = "Iso_Intensive Protective" );
no_isolation := last of (field_list where field_list.DataItemName = "Iso_No Isolation" );
If CallingEvent="FormClose"
then
If (airborne.value = False) and
(contact.value = False) and
(droplet.value = False) and
(enhanceddroplet.value = False) and // Added 07/12/2011
(protective.value = False) and
(intensive_protective.value = False) and
(no_isolation.value = False)
then
this_communication.DisplayForm := "Yes";
this_communication.Message := "No Isolation Type was selected" || "\n" || "\n" || "Please check at least one of the boxes";
this_communication.MessageType := "Error";
endif;
elseif CallingEvent = "FieldChange"
then
If CallingField <> "Iso_No Isolation"
then
If airborne.Value = True or
contact.Value = True or
droplet.Value = True or
enhanceddroplet.value = True or // Added 07/12/2011
protective.value = True or
intensive_protective.value = True
then
no_isolation.control_read_only := True;
else
no_isolation.control_read_only := False;
endif;
/* Changes below for #25736 07/12/2011 ******************** */
If CallingField = "Iso_Enhanced Droplet"
then
If enhanceddroplet.value = True
then
droplet.control_read_only := True;
else
droplet.control_read_only := False;
endif;
elseif CallingField = "Iso_Droplet"
then
If droplet.value = True
then
enhanceddroplet.Control_read_only := True;
else
enhanceddroplet.Control_read_only := False;
endif;
endif;
/* Changes above for #25736 07/12/2011 ******************* */
If CallingField = "Iso_Protective"
then
If protective.value = True
then
intensive_protective.control_read_only := True;
else
intensive_protective.control_read_only := False;
endif;
elseif CallingField = "Iso_Intensive Protective"
then
If intensive_protective.value = True
then
protective.control_read_only := True;
else
protective.control_read_only := False;
endif;
endif;
elseif CallingField = "Iso_No Isolation"
then
If no_isolation.Value = True
then
airborne.control_read_only := True;
contact.control_read_only := True;
droplet.control_read_only := True;
enhanceddroplet.control_read_only := True; // added 07/12/2011
protective.control_read_only := True;
intensive_protective .control_read_only := True;
else
airborne.control_read_only := False;
contact.control_read_only := False;
droplet.control_read_only := False;
enhanceddroplet.control_read_only := False; // added 07/12/2011
protective .control_read_only := False;
intensive_protective .control_read_only := False;
endif;
endif;
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:

View File

@@ -0,0 +1,161 @@
maintenance:
title: Isolation Set MLM;;
mlmname: FORM_ISOLATION_SET;;
arden: version 2;;
version: 4.50;;
institution: St Clair Charger MLM;;
author: Robert Spence, Eclipsys Corp;;
specialist: ;;
date: 2006-07-14;;
validation: testing;;
library:
purpose: This MLM is to auto fill supply sets
;;
explanation: This MLM xxxxxxxx
;;
keywords: Called MLMs, Form fields, Set, Isolation
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormType := this_communication.FormType;
Isolation_Header :=Last of (field_list
where field_list.DataItemName = "MultiOrderCheckBox" and field_list.CONTROL_MULTIFIELDOCCNUM=6);
Airborne_Header :=Last of (field_list
where field_list.DataItemName = "MultiOrderCheckBox" and field_list.CONTROL_MULTIFIELDOCCNUM=1);
Contact_Header :=Last of (field_list
where field_list.DataItemName = "MultiOrderCheckBox" and field_list.CONTROL_MULTIFIELDOCCNUM=2);
Droplet_Header :=Last of (field_list
where field_list.DataItemName = "MultiOrderCheckBox" and field_list.CONTROL_MULTIFIELDOCCNUM=3);
Protective_Header :=Last of (field_list
where field_list.DataItemName = "MultiOrderCheckBox" and field_list.CONTROL_MULTIFIELDOCCNUM=5);
IP_Protective_Header :=Last of (field_list
where field_list.DataItemName = "MultiOrderCheckBox" and field_list.CONTROL_MULTIFIELDOCCNUM=4);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
IsoFieldsList:=Isolation_Header.Value;
IsoSelVals := IsoFieldsList.IsSelected;
IsoSelName := IsoFieldsList.Name;
Airborne:=Last (First 1 from IsoSelVals);
Contact := Last(First 2 from IsoSelVals);
Droplet := Last(First 3 from IsoSelVals);
Protective := Last(First 4 From IsoSelVals);
IP_Protective:=Last(First 5 From IsoSelVals);
If Airborne =True
then
AirFieldsList := Airborne_Header.Value;
AirSelVals := AirFieldsList.IsSelected;
AirFieldsList.IsSelected := (1,1,1,1,1,1,1,1,1);
else
AirFieldsList := Airborne_Header.Value;
AirSelVals := AirFieldsList.IsSelected;
AirFieldsList.IsSelected := (0,0,0,0,0,0,0,0,0);
endif;
If Contact =True
then
ConFieldsList := Contact_Header.Value;
ConSelVals := ConFieldsList.IsSelected;
ConFieldsList.IsSelected := (1,1,1,1,1,1,1,1,1,1,1);
else
ConFieldsList := Contact_Header.Value;
ConSelVals := ConFieldsList.IsSelected;
ConFieldsList.IsSelected := (0,0,0,0,0,0,0,0,0,0,0);
endif;
If Droplet =True
then
DropFieldsList := Droplet_Header.Value;
DropSelVals := DropFieldsList.IsSelected;
DropFieldsList.IsSelected := (1,1,1,1,1,1);
else
DropFieldsList := Droplet_Header.Value;
DropSelVals := DropFieldsList.IsSelected;
DropFieldsList.IsSelected := (0,0,0,0,0,0);
endif;
If Protective =True
then
ProFieldsList := Protective_Header.Value;
ProSelVals := ProFieldsList.IsSelected;
ProFieldsList.IsSelected := (1,1,1,1,1,1,1,1);
else
ProFieldsList := Protective_Header.Value;
ProSelVals := ProFieldsList.IsSelected;
ProFieldsList.IsSelected := (0,0,0,0,0,0,0,0);
endif;
If IP_Protective=True
then
IP_ProFieldsList := IP_Protective_Header.Value;
IP_ProSelVals := IP_ProFieldsList.IsSelected;
IP_ProFieldsList.IsSelected := (1,1,1,1,1,1,1,1,1);
else
IP_ProFieldsList := IP_Protective_Header.Value;
IP_ProSelVals := IP_ProFieldsList.IsSelected;
IP_ProFieldsList.IsSelected := (0,0,0,0,0,0,0,0,0);
endif;
// this_communication.DisplayForm := "Yes";
// this_communication.Message := "MLM Field :" || CallingField || "\n" ||
// "MLM Event :" || CallingEvent || "\n" ||
// "Form type :" || FormType || "\n" ||
// "Fields List : "|| IsoFieldsList || "\n" ||
// "Values: "|| IsoSelVals || "\n" ||
// "Names: " || IsoSelName|| "\n" ||
// "Airborne: " || Airborne || "\n" ||
// "Protective: " || Protective || "\n" ||
// "Test3: " || Test3 || "\n" ||
// "Cnum: " || CNum;
// this_communication.MessageType := "Informational";
;;
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:

View File

@@ -0,0 +1,468 @@
maintenance:
title: Form_Kcentra_Order;;
mlmname: Form_Kcentra_Order;;
arden: version 2.5;;
version: 6.10;;
institution: SCH ;;
author: Shivprasad Jadhav;;
specialist: Shivprasad Jadhav, Allscripts;;
date: 2015-07-15;;
validation: testing;;
library:
purpose: While opening of the Order items If the weight is not charted on the patient then pre -populate the message that weight needs to entered like below.
Dose shall be calculated as per the INR result and weight and should be populated in the dosage field.
Dosage cap should also be calculated as per the below data and If the user is putting the dose greater than the dose cap then
it should display a popup and place the value as the highest capping which is allowed. ** Pop up removed 5/2/18 info added to order and
listed on order set info box.
2 to 3.9 25 units/kg 2500 "Dose not to exceed 2500 units.
4 to 5.9 35 units/kg 3500 "Dose not to exceed 3,500 units
6 n more 50 units/kg 5000 "Dose not to exceed 5,000 units
;;
explanation:
Change History
-----------------
07.07.2015 SJ CSR# 32480 : Created
11.09.2015 TMS Updated MLM to include all specIfications needed for KCentra Dosing.
Moved to production 11/9/2015 CSR 32480
05.02.2018 TMS CSR 36420 Updated MLM to include buttons for allowing physician to choose between
Warfarin reversal using INR values or NOAC reversal using 50 units/kg. Updated
info with dose capping values and calculation info for NOACs. Pop up removed notifing user
of dose capping, since this is added to order calculation info.
06.26.2018 TMS CSR 36420 Updated to not present duplicate "no weight" notices on order item
when called from an order set within an order set.
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
( this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
field_list:= this_form.Fields;
Client_GUID := this_communication.ClientGUID;
ClientVisit_GUID := this_communication.ClientVisitGUID;
Chart_GUID := this_communication.ChartGUID;
form_name := this_form.Name;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
Primary_object := this_communication.PrimaryObj;
ParentOrderSet := this_communication.ParentOrderSetGUID;
OrderSetName := Primary_Object.OrderSetName;
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
CRLF:= CR||LF;
HtWt := First of ( field_list where field_list.DataItemName = "CombinedMeasurements" ) ;
Parameters := First of ( field_list where field_list.DataItemName = "PRX_Parameters" ) ;
Dosage := First of ( field_list where field_list.DataItemName = "DosageLow" ) ;
INR_Calc_Value := First of ( field_list where field_list.DataItemName = "PRX_INR_Value") ;
INR_Override := First of ( field_list where field_list.DataItemName = "PRX_Generic_CB") ;
AdminInst := First of ( field_list where field_list.DataItemName = "AdminInstructions") ;
UnitsPerKg := First of ( field_list where field_list.DataItemName = "PRX_Units_Per_Kg") ;
WarfarinReversal := Last of ( field_list where field_list.DataItemName = "PRX_WarfarinReversal") ;
NOACReversal := last of ( field_list where field_list.DataItemName = "PRX_NOACReversal") ;
UnitsPerKg_val := UnitsPerKg.value;
Val_Wt := HtWt.Value.WEIGHT;
Dosage_value :=Dosage.Value ;
Max_Rate_in_Units := 210;
Max_Rate_in_MLs := 8.4;
// check weight Value for Patient and Give warning message
Wt := Val_Wt ;
If (Wt is 0 and callingevent = "FormOpen" and this_communication.ParentOrderSetGUID is null) or (Wt is 0 and callingevent = "FormClose" and (Dosage is null or Dosage = 0)) then
Void := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Please enter a weight for this patient" ,"Sunrise Clinical Manager", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
Endif;
// Round weight to the nearest whole number for calculation
CalcWt := int (val_wt as number);
DecWgt := (val_wt as number) - (CalcWt as number);
DecWgt := (DecWgt as number) + 0.5;
If DecWgt > 1 then CalcWt := CalcWt + 1; Endif;
// Obtain the INR Result Value and Apply condition for Dose with Dose Capping Value
(INR_Result ) := Read First {" select bo.Value "
|| " from CV3Order o join CV3BasicObservation bo on bo.clientguid = o.clientguid "
|| " and bo.chartguid = o.chartguid "
|| " and bo.clientvisitguid = o.clientvisitguid "
|| " and o.GUID = bo.OrderGUID "
|| " left outer join CV3TextualObservationLine tol on bo.clientguid = tol.clientguid "
|| " and bo.GUID = tol.ObservationGUID "
|| " where o.clientvisitguid = " || SQL(ClientVisit_GUID)
|| " And o.clientguid = " ||SQL(Client_GUID)
|| " and o.ChartGUID = " ||SQL(Chart_GUID)
|| " and IsHistory = 0 "
|| " AND ( o.name ={{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}} ) "
|| " And bo.ResultItemCode ={{{SINGLE-QUOTE}}}INR{{{SINGLE-QUOTE}}} Order By bo.entered Desc "};
// remove > or < sign from result If present for calculation
If INR_Result matches pattern ">%" or INR_Result matches pattern "<%" then
INR_Result:= (substring (length of inr_result) characters starting at 2 from INR_Result) ;
Endif;
// Alert User If no INR Result Value on patient record.
// If INR_Result is null and Dosage.Value is null and CallingEvent = "FormOpen" Then
If INR_Result is null and Dosage.Value is null and INR_Override.Value = false and WarfarinReversal.Value = True Then
Void := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient has no current INR result on record. " ||CRLF || CRLF
|| "Please manually enter an INR value or enter a valid dose If you wish to administer Kcentra." ,"Sunrise Clinical Manager", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
Dosage.Control_Read_only := false;
INR_Override.Value := "true";
INR_Calc_Value.Control_Read_only := false;
Endif;
// Determine whether to use manually entered INR value or retrieved value for dose calculation
If INR_Override.Value = false then
INR_Val := INR_Result As Number;
INR_Calc_Value.Value := INR_Val;
INR_Calc_Value.Control_Read_Only := true;
else
INR_Val := INR_Calc_Value.Value as Number;
Endif;
If ( CallingEvent = "FormOpen" ) or (CallingEvent = "FieldChange") then
If (CallingField = "PRX_WarfarinReversal" and WarfarinReversal.Value= True) then
NoacReversal.value := false;
Dosage.value := null;
UnitsPerKg.value := null;
elseif (CallingField = "PRX_NoacReversal" and NOACReversal.Value = True) then
WarfarinReversal.Value := false;
Dosage.value := null;
UnitsPerKg.value := null;
elseif (CallingField = "PRX_NoacReversal" and NOACReversal.Value = False) then
WarfarinReversal.Value := true;
Dosage.value := null;
UnitsPerKg.value := null;
elseif (CallingField = "PRX_WarfarinReversal" and WarfarinReversal.Value= False) then
NoacReversal.value := true;
Dosage.value := null;
UnitsPerKg.value := null;
endif;
If WarfarinReversal.value = True then
If (CallingField = "PRX_Generic_CB" and INR_Override.value = true) then
INR_Calc_Value.Control_Read_Only := false;
INR_Calc_Value.Value := null;
INR_Val := INR_Calc_Value.value as Number;
Dosage.Control_Read_only := false;
Dosage.value := Null;
Unitsperkg.value := null;
Unitsperkg.Control_Read_Only := false;
Endif;
If (CallingField = "PRX_Generic_CB" or CallingField = "PRX_INR_Value") and INR_Override.value = true and INR_Calc_Value is not null then
INR_Calc_Value.Control_Read_Only := false;
INR_Val := INR_Calc_Value.value as Number;
Dosage.Control_Read_only := false;
If INR_Val < 2 or INR_Val is null then
Unitsperkg.value := Null;
Unitsperkg.Control_Read_Only := false;
Dosage.value := Null;
else
Unitsperkg.Control_Read_Only := true;
Endif;
Endif;
If CallingField = "PRX_Generic_CB" and INR_Override.value = false and INR_Calc_Value.value is not null then
INR_Calc_Value.Control_Read_Only := true;
INR_Val := INR_Result as Number;
Dosage_value := "" ;
Dosage.Control_Read_only := true;
Unitsperkg.Control_Read_Only := true;
Endif;
// Allow user to type in dose when override is selected an no INR value available
If INR_Val is Null and INR_Override.value = true and Dosage.value is not null Then
INR_Calc_Value.Control_Read_Only := false;
MaxDoseCap := 5000 ;
Parameters.Value := "Dose not to exceed 5,000 units. " || CRLF
|| "Infuse Prothrombin Complex Concentrate at 0.12 mL/kg/min (~ 3 units/kg/min)" || CRLF
|| "Maximum infusion rate is 8.4 mL/min (~210 units/min) "|| CRLF
|| "Dose will be rounded to the next nearest whole vial size. " ;
If wt > 0 then
Rate_in_Units := 3 * (CalcWt as number);
Rate_in_ml := 0.12 * (CalcWt as number);
If Rate_In_units > Max_Rate_in_Units then
Rate_In_Units := Max_Rate_in_Units;
Endif;
If Rate_in_ml > Max_Rate_in_MLs then
Rate_In_ml := Max_Rate_in_MLs;
Endif;
AdminInst.value := "Infusion Rates for this dose: " || Rate_in_ml || "mL/min (~" || Rate_in_Units || " units/min) " || CRLF ;
Endif;
If Dosage_value > MaxDoseCap and callingevent = "fieldchange" Then
Dosage.value := MaxDoseCap ;
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Maximum Dose Allowed " || MaxDoseCap || " units. ","Max Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
Endif;
Endif; //INR_Val is Null and INR_Override.value = true and Dosage.value is not null
// Determine dose based upon INR value and weight. Check calculated dose against max dose limit and cap dose If necessary.
If INR_Val is Not Null And Wt > 0 Then
If (INR_Val < 0.9 ) Then
Dosage_value := "" ;
Endif;
If (INR_Val >= 2.0 ) Then
// INR 2.0 to 3.9
If INR_Val >= 2.0 and INR_Val < 4.0 Then
CalcDose := Int( 25 * (CalcWt As Number )) ;
UnitsPerKg.value := 25;
MaxDoseCap := 2500 ;
// INR 4.0 to 5.9
ElseIf INR_Val >= 4.0 and INR_Val < 6.0 Then
CalcDose := Int ( 35 * (CalcWt As Number )) ;
UnitsPerKg.value := 35;
MaxDoseCap := 3500 ;
// INR 6.0 or greater
ElseIf INR_Val >= 6.0 Then
CalcDose := Int(( 50 * (CalcWt As Number )) ) ;
UnitsPerKg.value := 50;
MaxDoseCap := 5000 ;
Endif;
Dosage.value := CalcDose;
Rate_in_Units := 3 * (CalcWt as number);
Rate_in_ml := 0.12 * (CalcWt as number);
If Rate_In_units > Max_Rate_in_Units then
Rate_In_Units := Max_Rate_in_Units;
Endif;
If Rate_in_ml > Max_Rate_in_MLs then
Rate_In_ml := Max_Rate_in_MLs;
Endif;
If Dosage.value > MaxDoseCap Then
Dosage.value := MaxDoseCap ;
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Maximum Dose Allowed " || MaxDoseCap || " for this INR Range ","Max Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
dosemessage := " **Maximum Dose Allowed";
Else
Dosage.value := CalcDose ;
dosemessage := "";
Endif;
Parameters.Value := "Dose not to exceed " || MaxDoseCap || " units. "|| CRLF
|| "Infuse Prothrombin Complex Concentrate at 0.12 mL/kg/min (~ 3 units/kg/min) "|| CRLF
|| "Maximum infusion rate is 8.4 mL/min (~210 units/min) "|| CRLF
|| "Dose will be rounded to the next nearest whole vial size. " ;
AdminInst.value := "Infusion Rates for this dose: " || Rate_in_ml || "mL/min (~" || Rate_in_Units || " units/min) "|| CRLF
|| "Weight rounded to " || Calcwt || " kg X " ||unitsPerKg.value || " units/kg = " || Dosage.value || dosemessage;
Endif; // inr > 2
Endif; //INR_Val is Not Null And Wt > 0 Then
// Calculate dose for INR 0.9 to 2.0 - used for Apixaban, Edoxaban, Rivaroxaban.
If INR_Val is Not Null and INR_val >= 0.9 and INR_Val < 2.0 And Wt > 0 Then
If (unitsperkg.value is null and dosage.value is null) then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " The INR Result for this patient is less than 2." || CRLF || " Do you still wish to place order? ", "Low INR Value Alert", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
dialogResult := dialogResult As string;
If dialogResult = "Yes" Then
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "For Apixaban, Edoxaban, Rivaroxaban. NOT indicated for Dabigatran." , "INR < 2 Alert", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
Dosage.Control_Mandatory := True ;
Dosage.Control_Read_Only := false;
UnitsPerKg.control_mandatory := "true";
UnitsPerKg.Control_Read_Only := false;
Parameters.Value := "For Apixaban, Edoxaban, Rivaroxaban. NOT indicated for Dabigatran." || CRLF
|| "Infuse Prothrombin Complex Concentrate at 0.12 mL/kg/min (~ 3 units/kg/min) "|| CRLF
|| "Maximum infusion rate is 8.4 mL/min (~210 units/min) "|| CRLF
|| "Dose will be rounded to the next nearest whole vial size. " ;
AdminInst.value := " ";
Else
Dosage.Value := Null ;
Dosage.Control_Mandatory := True ;
UnitsPerKg.value := null;
UnitsPerKg.control_mandatory := "false";
Parameters.Value := " ";
AdminInst.value := "";
Endif;
Endif; // if units per kg and dosage is null show messages
If INR_Val >= 0.9 and INR_Val < 2.0 Then
If callingfield = "PRX_Units_Per_Kg" then
If (UnitsPerKg_val as number) > 50 or (UnitsPerKg_val as number) < 25 then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Please enter a value between 25 Units/kg and 50 Units/kg" ,"Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
UnitsPerKg.value := null;
Dosage.value := null;
AdminInst.value := "";
Endif;
If ((UnitsPerKg_val as number) > 0 and (UnitsPerKg_val as number) <= 50) and UnitsPerKg_val is not null then
CalcDose := Int((UnitsPerKg.value As Number) * (CalcWt As Number )) ;
Dosage.value := CalcDose;
Rate_in_Units := 3 * (CalcWt as number);
Rate_in_ml := 0.12 * (CalcWt as number);
If Rate_In_units > Max_Rate_in_Units then
Rate_In_Units := Max_Rate_in_Units;
Endif;
If Rate_in_ml > Max_Rate_in_MLs then
Rate_In_ml := Max_Rate_in_MLs;
Endif;
If UnitsPerKg_val >0 and UnitsPerKg_val <=25 then MaxDoseCap := 2500;
elseIf UnitsPerKg_val >25 and UnitsPerKg_val <=35 then MaxDoseCap := 3500;
elseIf UnitsPerKg_val >35 and UnitsPerKg_val <=50 then MaxDoseCap := 5000;
Endif;
If Dosage.value > MaxDoseCap Then
Dosage.value := MaxDoseCap ;
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Maximum Dose Allowed " || MaxDoseCap || " for this INR Range ","Max Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
DoseMessage := " **Maximum Dose Allowed";
Else
Dosage.value := CalcDose ;
DoseMessage := "";
Endif;
Parameters.Value := "For Apixaban, Edoxaban, Rivaroxaban. NOT indicated for Dabigatran." || CRLF || "Dose not to exceed " || MaxDoseCap || " units. "|| CRLF
|| "Infuse Prothrombin Complex Concentrate at 0.12 mL/kg/min (~ 3 units/kg/min) "|| CRLF
|| "Maximum infusion rate is 8.4 mL/min (~210 units/min) "|| CRLF
|| "Dose will be rounded to the next nearest whole vial size. " ;
AdminInst.value := "Infusion Rates for this dose: " || Rate_in_ml || "mL/min (~" || Rate_in_Units || " units/min) "|| CRLF
|| "Weight rounded to " || Calcwt || " kg X " ||unitsPerKg_val || " units/kg = " || Dosage.value || DoseMessage;
Endif; //((UnitsPerKg_val as number) > 0 and (UnitsPerKg_val as number) <= 50) and UnitsPerKg_val is not null
elseIf callingfield = "DosageLow" and dosage.value > 0 then
CalcDose := dosage.value;
Rate_in_Units := 3 * (CalcWt as number);
Rate_in_ml := 0.12 * (CalcWt as number);
MaxDoseCap := 5000 ;
UnitsPerKg.control_mandatory := false;
UnitsPerKg.VALUE := "";
If Rate_In_units > Max_Rate_in_Units then
Rate_In_Units := Max_Rate_in_Units;
Endif;
If Rate_in_ml > Max_Rate_in_MLs then
Rate_In_ml := Max_Rate_in_MLs;
Endif;
If Dosage.value > MaxDoseCap Then
Dosage.value := MaxDoseCap ;
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Maximum Dose Allowed " || MaxDoseCap || " for this INR Range ","Max Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
DoseMessage := " **Maximum Dose Allowed";
Else
Dosage.value := CalcDose ;
DoseMessage := "";
Endif;
Parameters.Value := "For Apixaban, Edoxaban, Rivaroxaban. NOT indicated for Dabigatran." || CRLF || "Dose not to exceed " || MaxDoseCap || " units. "|| CRLF
|| "Infuse Prothrombin Complex Concentrate at 0.12 mL/kg/min (~ 3 units/kg/min) "|| CRLF
|| "Maximum infusion rate is 8.4 mL/min (~210 units/min) "|| CRLF
|| "Dose will be rounded to the next nearest whole vial size. " ;
AdminInst.value := "Infusion Rates for this dose: " || Rate_in_ml || "mL/min (~" || Rate_in_Units || " units/min) "|| CRLF ;
Endif; // calling field is dosagelow or UnitsPerKg_val
Endif; // INR_Val >= 0.9 and INR_Val < 2.0
Endif; //INR_Val is Not Null and INR_val >= 0.9 and INR_Val < 2.0 And Wt > 0
elseif NoacReversal.value = true then
UnitsPerKg.value := 50;
MaxDoseCap := 5000;
If wt > 0 then
CalcDose := Int((UnitsPerKg.value As Number) * (CalcWt As Number )) ;
Dosage.value := CalcDose;
Rate_in_Units := 3 * (CalcWt as number);
Rate_in_ml := 0.12 * (CalcWt as number);
endif;
If Rate_In_units > Max_Rate_in_Units then
Rate_In_Units := Max_Rate_in_Units;
Endif;
If Rate_in_ml > Max_Rate_in_MLs then
Rate_In_ml := Max_Rate_in_MLs;
Endif;
If Dosage.value > MaxDoseCap Then
Dosage.value := MaxDoseCap ;
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Maximum Dose Allowed " || MaxDoseCap || " for NOAC Reversal ","Max Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
DoseMessage := " **Maximum Dose Allowed";
Else
Dosage.value := CalcDose ;
DoseMessage := "";
Endif;
Parameters.Value := "For Apixaban, Edoxaban, Rivaroxaban. NOT indicated for Dabigatran." || CRLF || "Dose not to exceed " || MaxDoseCap || " units. "|| CRLF
|| "Infuse Prothrombin Complex Concentrate at 0.12 mL/kg/min (~ 3 units/kg/min) "|| CRLF
|| "Maximum infusion rate is 8.4 mL/min (~210 units/min) "|| CRLF
|| "Dose will be rounded to the next nearest whole vial size. " ;
AdminInst.value := "Infusion Rates for this dose: " || Rate_in_ml || "mL/min (~" || Rate_in_Units || " units/min) "|| CRLF
|| "Weight rounded to " || Calcwt || " kg X " ||unitsPerKg_val || " units/kg = " || Dosage.value || DoseMessage;
Endif; //((UnitsPerKg_val as number) > 0 and (UnitsPerKg_val as number) <= 50) and UnitsPerKg_val is not null
Endif; // (CallingEvent = "FormOpen" ) or (CallingEvent = "FieldChange")
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,113 @@
maintenance:
title: FORM_KNEE_ASPIRATION_OS_Check;;
mlmname: FORM_KNEE_ASPIRATION_OS_Check;;
arden: version 2.5;;
version: 6.10;;
institution: St. Clair Hospital ;;
author: Shivprasad Jadhav;;
specialist: Shivprasad Jadhav, Allscripts;;
date: 2015-01-29;;
validation: testing;;
library:
purpose: Ø User should be able to select only one out of 3 Knee aspiartion Orders ;;
explanation:
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
(this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
field_list:= this_form.Fields;
field_list := this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
CallingItem := CallingField.Records_;
/********************************** Added By Shivprasad *****************************************************/
Set_Generic_MLM:= MLM {{{SINGLE-QUOTE}}}FORM_Set_Generic_Item_Control{{{SINGLE-QUOTE}}};
this_communication,this_form := call Set_Generic_MLM with this_communication,this_form,client_info_obj ;
/***************************************************************************************/
Knee_Left := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 2 );
Knee_Left_Val := Knee_Left.Value;
Knee_Right := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 1 );
Knee_Right_Val := Knee_Right.Value;
Knee_Bilateral := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 5 );
Knee_Bilateral_Val := Knee_Bilateral.Value;
// *********** Objects for first flow *************
item1 := Knee_Left_Val[1];
item2 := Knee_Right_Val[1];
item3 := Knee_Bilateral_Val[1];
//********* objects for Second Flow **********
Knee_Left:= first of (Knee_Left_Val where Knee_Left_Val.Name = "Knee Aspiration");//
Knee_right:= first of (Knee_Right_Val where Knee_Right_Val.Name = "Knee Aspiration");//
Knee_BiLateral := first of (Knee_Bilateral_Val where Knee_Bilateral_Val.Name = "Knee Aspiration");//
// first flow ***************************************************************************************************
If Knee_Left.IsSelected = True Then
Knee_right.IsReadonly := True;
Knee_BiLateral.IsReadonly := True;
EndIf;
If Knee_right.IsSelected = True Then
Knee_Left.IsReadonly := True;
Knee_BiLateral.IsReadonly := True;
EndIf;
If Knee_BiLateral.IsSelected = True Then
Knee_Left.IsReadonly := True;
Knee_right.IsReadonly := True;
EndIf;
If (Knee_Left.IsSelected = False And Knee_right.IsSelected = False And Knee_BiLateral.IsSelected = False ) Then
Knee_Left.IsReadonly := False;
Knee_right.IsReadonly := False;
Knee_BiLateral.IsReadonly := False;
EndIf;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,142 @@
maintenance:
title: Ordering: Auto-populate heparin status on aptt order with appropriate selection;;
mlmname: FORM_Lab_APTT_Heparin_Status;;
arden: version 2;;
version: 4.50;;
institution: St Clair Hospital;;
author: Dean Miklavic Eclipsys Corp;;
specialist: Don Warnick Eclipsys Corp ;;
date: 2009-07-13;;
validation: testing;;
library:
purpose: Display a message outlining a Lab Protocol when specific drugs are entered
;;
explanation: This MLM is called from forms where APTT is ordered. It uses two session objects (one for SQ orders and one for IV orders)
passed from SCH_Unsubmitted_Heparin_Order to populate the Heparin Status field.
Change history
07.13.2009 DW Initial build
04.03.2012 TMS Modified to only send label field with continuous heparin. CSR 24257
;;
keywords: Called MLMs, Form open, heparin
;;
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;
// Specify which .NET assemblies need to be loaded for ObjectsPlus
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
/*******************Make Changes To Spelling And Flags In This Section*******************/
// heparin_order := "%Heparin%";
heparin_order_iv := "%Heparin 25,000%";
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
Visit_Guid := this_communication.ClientVisitGuid;
Chart_Guid := this_communication.ChartGuid;
Client_Guid := this_communication.ClientGuid;
//order_name := this_communication.primaryobj.name;
local_session := cds_session.local;
omitcheckstatus := last of (field_list where field_list.DataItemName = "MLM Generic Checkbox" );
heparinlabinfo := last of (field_list where field_list.DataItemName = "LAB_VO_DI_Coag_Heparin Status" );
heparinstatus := last of (field_list where field_list.DataItemName = "Lab_ContHep_Question" );
LabHoldOrderReqDtm := mlm {{{SINGLE-QUOTE}}}FORM_LAB_HOLDORDER_REQUESTEDTIME{{{SINGLE-QUOTE}}};
LabRepeatOrders := mlm {{{SINGLE-QUOTE}}}FORM_ID_REPEATORDERS{{{SINGLE-QUOTE}}};
omitcheckstatus_value := omitcheckstatus.value;
retain_heparin_Status := heparinstatus.value;
heparinstatus_value := heparinstatus.value;
// Search patient record for existing Heparin IV order
heparin_order_iv_found := read last {"select name from cv3order where name like " || SQL(heparin_order_iv)
|| " and ClientGUID = " || SQL(client_guid)
|| " and ChartGUID = " || SQL(chart_guid)
|| " and ClientVisitGUID= " || SQL(visit_guid)
|| " and OrderStatusLevelNum > 15 "
|| " and OrderStatusLevelNum not in (69, 70) "
};
if heparin_order_IV_found is not null then heparin_iv_found := true; else heparin_iv_found := false; endif;
// Search unsubmitted orders for Heparin IV order (use count function to determine if the session object is populated)
unsubmitted_heparin_iv:= local_session.SessionUnsubmittedHeparinIV;
unsubmitted_heparin_iv_count:= count(unsubmitted_heparin_iv) As Number;
if unsubmitted_heparin_iv_count = 0 then unsubmitted_heparin_iv_found := false; else unsubmitted_heparin_iv_found := true; endif;
if ((unsubmitted_heparin_iv_found = true) or (heparin_iv_found = true )) then found_orders:= "true"; else found_orders := "false"; endif;
// If order preconfigured with heparin status retain configured value regardless of existing or unsubmitted orders
If CallingEvent = "FormOpen" then
if omitcheckstatus_value = true then heparinstatus.value := retain_heparin_Status ; endif;
endif;
// If order preconfigured with heparin status retain configured value regardless of existing or unsubmitted orders
If CallingEvent = "FormClose" or callingEvent = "FormOpen" then
if found_orders = "true" and omitcheckstatus_value = false then heparinstatus.value := "Yes"; heparinlabinfo.value := "Continuous Heparin";
endif;
if found_orders = "false" and omitcheckstatus_value = false then heparinstatus.value := "No"; heparinlabinfo.value := "";
endif;
endif;
If CallingEvent = "FormClose" or CallingField = "Lab_ContHep_Question" then
if heparinstatus_value = "Yes" then heparinlabinfo.value := "Continuous Heparin";
else heparinlabinfo.value := "";
endif;
endif;
// Call for other MLM{{{SINGLE-QUOTE}}}s on Form Open and Close
If CallingEvent = "FormOpen" then
(this_communication,this_form) := Call LabHoldOrderReqDtm with this_communication, this_form, client_info_obj;
endif;
If CallingEvent = "FormClose" then
(this_communication,this_form) := Call LabRepeatOrders with this_communication, this_form, client_info_obj;
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:

View File

@@ -0,0 +1,108 @@
maintenance:
title: Lab Synovial Joint Fluid Mandatory;;
mlmname: FORM_LAB_CHEM_SYNOVIAL_MAND;;
arden: version 2;;
version: 4.50;;
institution: St Clair Lab Synovial MLM;;
author: Robert Spence, Eclipsys Corp;;
specialist: ;;
date: 2006-09-11;;
validation: testing;;
library:
purpose: This MLM sets the field Synovial to Mandatory if another field is selected
;;
explanation: This MLM enables teh Synovial to be mandatory
;;
keywords: Called MLMs, Form fields, Lab, Synovial, Chemistry
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormName := this_form.Name;
If FormName = "LAB Chemistry Fluid1"
then
ActOnField:=last of (field_list
where field_list.DataItemName = "LAB_M_VO_OBR15_SpecType_Chem_1" );
elseif FormName = "LAB Chemistry Fluid2"
then
ActOnField := last of (field_list
where field_list.DataItemName = "LAB_M_VO_OBR15_SpecType_Chem_2" );
elseif FormName = "LAB Chemistry Fluid3"
then
ActOnField := last of (field_list
where field_list.DataItemName = "LAB_M_VO_OBR15_SpecType_Chem_3" );
elseif FormName = "LAB Hem Nsg Col_Hem1"
then
ActOnField := last of (field_list
where field_list.DataItemName = "LAB_M_VO_OBR15_SpecType_Hem_1" );
elseif FormName = "LAB_MG_SpecChem1"
then
ActOnField := last of (field_list
where field_list.DataItemName = "LAB_M_VO_OBR15_SpecType_Chem_1" );
endif;
SynovialField :=last of (field_list
where field_list.DataItemName = "Lab_VO_SiteforSynovialFluid" );
If ActOnField.Value ="Synovial Joint Fluid (SYN)"
then
SynovialField.Control_Mandatory:=True;
else
SynovialField.Control_Mandatory:=False;
endif;
// this_communication.DisplayForm := "Yes";
// this_communication.Message := "MLM Field :" || CallingField || "\n" ||
// "MLM Event :" || CallingEvent || "\n" ||
// "Form type :" || FormType || "\n" ||
// "FormName: " || FormName || "\n" ||
// "ActOn:"|| ActOnField.Value;
// this_communication.MessageType := "Informational";
;;
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:

View File

@@ -0,0 +1,88 @@
maintenance:
title: Form_Lab_ConditionalOrder_PriorityTime ;;
mlmname: Form_Lab_ConditionalOrder_PriorityTime ;;
arden: version 2;;
version: 4.50;;
institution: St. Clair Hospital;;
author: Shivprasad Jadhav ;;
specialist: Allscripts Corporation ;;
date: 2015-09-09;;
validation: testing;;
library:
purpose: possible to create an MLM that can be used generically on lab forms attached to the Conditional field so that any time a Condition is populated,
the order is permitted to be entered without a priority (removes the mandatory).
The priority would then be mandatory upon activation. This would be similar to what your team did with the Gentamicin Peak orders.
;;
explanation: ( )
CHANGE HISTORY
09/09/2015 - CSR# 32480 - Created MLM {GO-Live targeted for 4/26/2016};;
keywords:
Hold, requested Time, Start time;
;;
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;
comm_obj := this_communication.primaryobj;
called_by := this_communication.CallingEvent;
call_field := this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGuid;
orderid := this_communication.ItemID;
field_list:= this_form.fields;
session_type := comm_obj.internalprocessingtype;
Prm_Conditional := First of (field_list where field_list.DataItemName = "ConditionalOrder" );
Prm_PriorityTime_New := First of (field_list where field_list.DataItemName = "LAB_Order Priorities" );
Prm_PriorityTime := First of (field_list where field_list.DataItemName = "RequestedTime" );
if ((Prm_Conditional.Value.IsConditional = True)) Then
Prm_PriorityTime.Control_Mandatory := False;
Prm_PriorityTime_New.Control_Mandatory := False;
endif;
/*
Else
//****BEGIN***** STH 2.10.2015 CSR 32765 - show user friendly lab priorities
DisplayNewScheduled := first of (field_list.Value
where field_list.DataItemName = "LAB_CB_Alternate Priorities");
if (DisplayNewScheduled) THEN
//Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
//(this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
Prm_PriorityTime_New.Control_Mandatory := True; //Prm_PriorityTime.Control_Mandatory
Prm_PriorityTime.Control_Mandatory := false;
else
//****END***** STH 2.10.2015 CSR 32765 - show user friendly lab priorities
Prm_PriorityTime_New.Control_Mandatory := false; //Prm_PriorityTime.Control_Mandatory
Prm_PriorityTime.Control_Mandatory := true;
endif;
EndIf;
*/
//--------------------------------------------------------------------------------------------------------------
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns two parameters, of types
//communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,307 @@
maintenance:
title: Ordering Conditional Manditory field;;
mlmname: FORM_LAB_GENERIC_MANDITORY;;
arden: version 2;;
version: 4.50;;
institution: St Clair Isolation Set MLM;;
author: Mary Sieger, Mary.Sieger@stclair.org, 412-942-1194;;
specialist: Eclipsys Corporation;;
date: 2006-10-09;;
validation: testing;;
library:
purpose: Based on a value provided in one field, make another field manditory.
;;
explanation: This generic MLM can be called from several Micro order forms:
- LAB Ser Nsg Col_Ser1
- LAB_Micro_BodyFldCul
- LAB_Micro_ExudateCul
- LAB BBank Type & Scr
- LAB_Micro_Blood Cul
- LAB BBank Prod RBC
- LAB BBank Prod PLT
- LAB BBank Prod FFP
- (others?)
Rules:
Use lists of
forms,
fields to test on the form,
values to test for,
fields to make manditory (if the value is present).
change history
06.18.2008 DW Remove code to require an indication when Transfusion is selected from Surgery or Transfusion list
2/26/2015 STH CSR# 32765 - updated to call the user lab priority options MLM to display the user firendly lab priorities when approriate.
11.29.2017 DW CSR# 36079 - change "line draw" to "other" on the Blood Culture order form
;;
keywords: Called MLMs, Form fields, generic, field test, manditory
;;
knowledge:
type: data-driven;;
data:
/***********************Make Changes To Spelling And Flags In This Section************************/
//NOTE: THE RELATIVE ORDER OF ITEMS MUST BE MAINTAINED WITHING LISTS!!!
//MUST HAVE THE FOLLOWING ORDER FOR EACH ELEMENT ITEM:
//"FORM_NAME|FIELD_NAME_TO_TEST|VALUEs_TO_TEST_FOR|FIELD_TO_MAKE_MANDITORY"
form_map_list :=
("LAB Ser Nsg Col_Ser1|LAB_M_VO_OBR15_SpecType_Ser1|Skin (SKN),Tissue (TIS)|LAB_VO_FT_Ser_SkinInfo"
,"LAB_Micro_BodyFldCul|LAB_RC_SDES_MicroBodyFld|Body Fluid (FLD)|LAB_SREQ_VO_FT_MicroTypeIn"
,"Lab_Micro_BodyFldCul|Lab_RC_SDES_MicroBodyFld|Synovial Joint Fluid (SYN)|Lab_SREQ_VO_DI_SiteSynovialJointFluid"
,"LAB_Micro_ExudateCul|LAB_RC_SDES_MicroExCul|Exudate (EX)|LAB_SREQ_VO_FT_MicroTypeIn"
,"LAB BBank Type & Scr|LAB_Yes or No|YES|BB_Date_ Proc Surgical Procedure"
// DW 11.29.2017 36079 Changed "line draw" to "other"
//,"LAB_Micro_Blood Cul|LAB_SREQ_VO_DI_Line_PeripDraw|Line Draw|LAB_SREQ_VO_FT_LineDrawDescrip"
,"LAB_Micro_Blood Cul|LAB_SREQ_VO_DI_Line_PeripDraw|Other|LAB_SREQ_VO_FT_LineDrawDescrip"
,"LAB BBank Prod RBC|BB Blood Prod Surg-Transfusion|Product for Surgery|LAB_VO_DI_BBProd Surgical Proc"
// Removed per ED CPOE project 06.18.08 DW
// ,"LAB BBank Prod RBC|BB Blood Prod Surg-Transfusion|Product for Transfusion|LAB_VO_DI_BBProd Trans Ind RC"
,"LAB BBank Prod PLT|BB Blood Prod Surg-Transfusion|Product for Surgery|LAB_VO_DI_BBProd Surgical Proc"
// Removed per ED CPOE project 06.18.08 DW
//,"LAB BBank Prod PLT|BB Blood Prod Surg-Transfusion|Product for Transfusion|LAB_VO_DI_BBProd Trans Ind Plt"
,"LAB BBank Prod FFP|BB Blood Prod Surg-Transfusion|Product for Surgery|LAB_VO_DI_BBProd Surgical Proc"
// Removed per ED CPOE project 06.18.08 DW
// ,"LAB BBank Prod FFP|BB Blood Prod Surg-Transfusion|Product for Transfusion|LAB_VO_DI_BBProd TransInd FFP_Cryo"
,"Lab_Micro_FungusSmea|Lab_RC_SDES_MicroSource_FungusSmear|Synovial Joint Fluid (SYN)|Lab_SREQ_VO_DI_SiteSynovialJointFluid"
,"Resp Vent Adult Vol|Resp Vent Flow By|TRUE|Resp Vent Base Flow"
,"Resp Vent Adult Vol|Resp Vent Flow By|TRUE|Resp Vent Flow Sensitivity"
,"DIET_Diet_All Option|RequestedTime|OVERDUE|DIET_Non Routine Trays"
,"LAB_Micro_GramStainO|LAB_Micro_CB_SpecimenNotInList|TRUE|LAB_RC_SDES_MicroExBF_Sites"
,"LAB_Micro_GramStainO|LAB_Micro_CB_SpecimenNotInList|FALSE|LAB_RC_SDES_MicroSource_GramStainOnly"
,"LAB_Micro_GramStainO|LAB_RC_SDES_MicroExBF_Sites|Body Fluid (FLD),Exudate (EX)|LAB_SREQ_VO_FT_MicroTypeIn"
,"LAB_Micro_GramStainO|LAB_RC_SDES_MicroSource_GramStainOnly|Tissue (TIS)|LAB_SREQ_VO_DI_MicroDescript"
,"LAB_Micro_GramStainO|LAB_RC_SDES_MicroSource_GramStainOnly|Synovial Joint Fluid (SYN)|LAB_SREQ_VO_DI_SiteSynovialJointFluid"
,"Lab_Micro_AFBSmearOn|LAB_Micro_CB_SpecimenNotInList|TRUE|LAB_RC_SDES_MicroExBF_Sites"
,"Lab_Micro_AFBSmearOn|LAB_Micro_CB_SpecimenNotInList|FALSE|Lab_RC_SDES_MicroSource_AFBSmearOnly"
,"Lab_Micro_AFBSmearOn|LAB_RC_SDES_MicroExBF_Sites|Body Fluid (FLD),Exudate (EX)|LAB_SREQ_VO_FT_MicroTypeIn"
,"Lab_Micro_AFBSmearOn|Lab_RC_SDES_MicroSource_AFBSmearOnly|Tissue (TIS)|LAB_SREQ_VO_DI_MicroDescript"
,"Lab_Micro_AFBSmearOn|Lab_RC_SDES_MicroSource_AFBSmearOnly|Synovial Joint Fluid (SYN)|LAB_SREQ_VO_DI_SiteSynovialJointFluid"
,"Lab_Micro_FungusCul|LAB_Micro_CB_SpecimenNotInList|TRUE|LAB_RC_SDES_MicroExBF_Sites"
,"Lab_Micro_FungusCul|LAB_Micro_CB_SpecimenNotInList|FALSE|LAB_RC_SDES_MicroSource_FungusSmear"
,"Lab_Micro_FungusCul|LAB_RC_SDES_MicroExBF_Sites|Body Fluid (FLD),Exudate (EX)|LAB_SREQ_VO_FT_MicroTypeIn"
,"Lab_Micro_FungusCul|LAB_RC_SDES_MicroSource_FungusSmear|Tissue (TIS)|LAB_SREQ_VO_DI_MicroDescript"
,"Lab_Micro_FungusCul|Lab_RC_SDES_MicroSource_FungusSmear|Synovial Joint Fluid (SYN)|Lab_SREQ_VO_DI_SiteSynovialJointFluid"
,"LAB_Micro_TBCulture|LAB_Micro_CB_SpecimenNotInList|TRUE|LAB_RC_SDES_MicroExBF_Sites"
,"LAB_Micro_TBCulture|LAB_Micro_CB_SpecimenNotInList|FALSE|Lab_RC_SDES_MicroSources_TBCul"
,"LAB_Micro_TBCulture|LAB_RC_SDES_MicroExBF_Sites|Body Fluid (FLD),Exudate (EX)|LAB_SREQ_VO_FT_MicroTypeIn"
//NOTE: for TB Cultures, Additional Information (LAB_SREQ_VO_DI_MicroDescript) is NEVER Manditory! per Mary
//,"LAB_Micro_TBCulture|Lab_RC_SDES_MicroSources_TBCul|Tissue (TIS)|LAB_SREQ_VO_DI_MicroDescript"
,"LAB_Micro_TBCulture|Lab_RC_SDES_MicroSources_TBCul|Synovial Joint Fluid (SYN)|Lab_SREQ_VO_DI_SiteSynovialJointFluid"
,"LAB_Micro_Legionella|LAB_Micro_CB_SpecimenNotInList|TRUE|LAB_RC_SDES_MicroExBF_Sites"
,"LAB_Micro_Legionella|LAB_Micro_CB_SpecimenNotInList|FALSE|LAB_RC_SDES_MicroSource_LegionellaCul"
,"LAB_Micro_Legionella|LAB_RC_SDES_MicroExBF_Sites|Body Fluid (FLD),Exudate (EX)|LAB_SREQ_VO_FT_MicroTypeIn"
//,"LAB_Micro_Legionella|LAB_RC_SDES_MicroExBF_Sites|Exudate (EX)|LAB_SREQ_VO_FT_MicroTypeIn"
,"LAB_Micro_Legionella|LAB_RC_SDES_MicroSource_LegionellaCul|Tissue (TIS)|LAB_SREQ_VO_DI_MicroDescript"
//NOTE: for Legionella Cultures, no Synovial Box, per Mary
//,"LAB_Micro_Legionella|LAB_RC_SDES_MicroSource_LegionellaCul|Synovial Joint Fluid (SYN)|LAB_SREQ_VO_DI_SiteSynovialJointFluid"
,"YOUR_FORM_NAME_HERE|YOUR_TEST_FIELD_HERE|VALID_VAL1,VALID_VAL2|MANDITORY_FIELD_HERE"
);
/**************************************************************************************JAB********/
// 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;
//Initialize MLM pointers:
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
chk_overdue_time := MLM {{{SINGLE-QUOTE}}}overdue_req_time{{{SINGLE-QUOTE}}};
gen_dsply := mlm {{{SINGLE-QUOTE}}}FORM_GENERIC_Display{{{SINGLE-QUOTE}}};
// Display any realated fields first:
(this_communication, this_form) := call gen_dsply
with this_communication, this_form, client_info_obj;
// Initialize error message
error_message:="";
// Initialize lists
test_form_name_list := ();
test_field_list := ();
test_manditory_field_list := ();
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
//*****BEGIN ***** STH 2.10.2015 - Added for CSR 32765 to display user friendly lab priorities
Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
DisplayNewScheduled := first of (field_list.Value
where field_list.DataItemName = "LAB_CB_Alternate Priorities");
//*****END ***** STH 2.10.2015 - Added for CSR 32765 to display user friendly lab priorities
CallingForm := this_form.name;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
if called_by_editor then
CallingForm := "LAB Ser Nsg Col_Ser1";
CallingEvent := "FieldChange";
CallingField := "LAB_M_VO_OBR15_SpecType_Ser1";
endif;
for i in 1 seqto count form_map_list do
// initialize vars:
manditory_field := null;
trigger_field := null;
// parse the form mapper:
form_element_list := call str_parse with form_map_list[i], "|";
test_form_name := form_element_list[1]; //Lookup form name from map list
// Test for proper form
if CallingForm = test_form_name then
test_manditory_field := form_element_list[4]; //Lookup manditory field from map list
manditory_field := first of
(field_list where field_list.DataItemName = test_manditory_field);
// Set open form defaults
if exists manditory_field then
test_field := form_element_list[2]; //Lookup test field from map list
trigger_field := first of
(field_list where field_list.DataItemName = test_field);
//check for {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} fields
if manditory_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then
Right_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Right" );
Superficial_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Superficial" );
Left_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Left" );
Deep_box := last of (field_list
where field_list.DataItemName = "LAB_SREQ_LO_CB_Micro_Deep" );
endif;
// Test for proper field
if exists trigger_field then
//Lookup list of valid values for the test field
test_val_list := call str_parse with form_element_list[3], ",";
//Check for time field
if trigger_field.dataitemname = "RequestedTime" and "overdue" is in test_val_list then
if exists trigger_field.value.reqtimevalue then
time_type := "scheduled";
time_val := trigger_field.value.reqtimevalue;
else
time_type := "coded";
time_val := trigger_field.value.reqtimecode;
endif;
// check for overdue time
time_is_overdue := call chk_overdue_time
with time_val, time_type;
endif;
if (trigger_field.value as string) is in test_val_list or time_is_overdue then
// Mandate the field and, if necessary, make it visible
manditory_field.control_visible := true;
manditory_field.control_mandatory := True;
manditory_field.control_read_only := False;
// make {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} settings writable
if manditory_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then
Right_box.control_visible := True;
Right_box.control_read_only := False;
Superficial_box.control_visible := True;
Superficial_box.control_read_only := False;
Left_box.control_visible := True;
Left_box.control_read_only := False;
Deep_box.control_visible := True;
Deep_box.control_read_only := False;
endif;
// i := count form_map_list;
else
// manditory_field.control_visible := false;
manditory_field.control_mandatory := False;
if trigger_field.dataitemname <> "RequestedTime" then
manditory_field.control_read_only := True;
endif;
manditory_field.value:="";
if manditory_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript" then
// set all {{{SINGLE-QUOTE}}}additional info{{{SINGLE-QUOTE}}} boxes to read-only
Right_box.control_mandatory := False;
Right_box.control_read_only := True;
Right_box.value:="";
Superficial_box.control_mandatory := False;
Superficial_box.control_read_only := True;
Superficial_box.value:="";
Left_box.control_mandatory := False;
Left_box.control_read_only := True;
Left_box.value:="";
Deep_box.control_mandatory := False;
Deep_box.control_read_only := True;
Deep_box.value:="";
endif; // manditory_field.dataitemname = "LAB_SREQ_VO_DI_MicroDescript"
endif; // (trigger_field.value as string) is in test_val_list
/* // FOR DEBUGGING PURPOSES: display a message to the user
this_communication.Message :=
"callingform = "|| callingform
|| "\nCallingEvent = " || CallingEvent
|| "\ntest_form_name = " || test_form_name
|| "\ntest_field = " || test_field
|| "\ntest_manditory_field = " || test_manditory_field
|| "\ntrigger_field.value.reqtimecode = " || trigger_field.value.reqtimecode
|| "\ntrigger_field.value.reqtimevalue = " || trigger_field.value.reqtimevalue
|| "\nmanditory_field = " || manditory_field.dataitemname
|| "\ntest_val_list = " || test_val_list
|| "\ncfg_end = " || cfg_end
|| "\ncurr_time = " || curr_time || x;
this_communication.MessageType := "Informational";
*/
endif; // exists trigger_field
endif; // exists manditory_field
endif; // CallingForm = test_form_name
enddo; // for i in 1 seqto count form_map_list
//****BEGIN***** STH 2.10.2015 Added for CSR 32765 only display user friendly lab priorities if the opbservation is added to the form AND selected/checked
if (DisplayNewScheduled) then
//Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
(this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
endif;
//****END***** STH 2.10.2015 Added for CSR 32765 only display user friendly lab priorities if the opbservation is added to the form AND selected/checked
;;
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:

View File

@@ -0,0 +1,152 @@
maintenance:
title: Form_Lab_HoldOrder_RequestedTime;;
mlmname: Form_Lab_HoldOrder_RequestedTime;;
arden: version 2;;
version: 4.50;;
institution: St. Clair Hospital;;
author: Teresa Spicuzza ;;
specialist: Eclipsys Corporation;;
date: 2010-10-27;;
validation: testing;;
library:
purpose: Allows lab orders requested with a scheduled time to be entered in a hold session without
the specific time entered. This will force the time to be entered upon release.
;;
explanation: ( )
CHANGE HISTORY
2/26/2015 - STH CSR# 32765 - updated to call the user lab priority options MLM to display the user firendly lab priorities when approriate.
12/03/2015 JML Removed "test" code that was never moved to PRD that was causing the order to not create.
05/17/2016 JML CSR 34155: Modified to handle autoscheduling of the Vancomycin Trough orders ONLY if called from
Antibiotic Order Sets (i.e. Antibiotics Pneumonia)
05.10.2017 JML CSR 35272: Modified to work with new Sepsis Unknown Source Antibiotic ED order set AND
Sepsis Work Up Orders (ED) order set
;;
keywords:
Hold, requested Time, Start time;
;;
knowledge:
type: data-driven;;
data:
/********************Make Changes To Spelling And Flags In This Section*********************/
/* send_alert := "DoNotSend";
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
//--------------------------------------------------------------------------
local_session := cds_session.local;
//--------------------------------------------------------------------------
*/
// 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;
comm_obj := this_communication.primaryobj;
called_by := this_communication.CallingEvent;
call_field := this_communication.CallingFieldName;
order_set_name := comm_obj.OrderSetName;
// Set some needed fields
if called_by_editor then
client_guid := "9000001369400200";
visit_guid := visit_obj.GUID;
chart_guid := "9000001918900170";
orderId := "1000002689073001";
called_by := "FormOpen";
else
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGuid;
orderid := this_communication.ItemID;
endif;
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
requested_date := last of (field_list where field_list.DataItemName = "RequestedDate" );
requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" );
requested_time_value := requested_time.value;
session_type := comm_obj.internalprocessingtype;
//user_friendly_lab_time := last of (field_list where field_list.DataItemName = "LAB_Phleb Draw Sched Time" );
//user_friendly_lab_priority := last of (field_list where field_list.DataItemName = "LAB_Order Priorities" );
DisplayNewScheduled := first of (field_list.Value
where field_list.DataItemName = "LAB_CB_Alternate Priorities");
If (called_by = "FormOpen") or (called_by = "FieldChange") and (session_type = "Hold") then
If exists (requested_time) and (requested_time_value.ReqTimeCode = "Scheduled Time") then
requested_time.Control_mandatory := false;
else
requested_time.Control_mandatory := true;
endif;
endif;
if (DisplayNewScheduled) then
Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
(this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
endif;
/** CSR : 32240 : Vancomycin Order change in Mandatory and Non-mandatory field ******************************/
If this_form.Name ="LAB Chemistry Peak" Then
if comm_obj.Name in ( "Vancomycin Peak Plasma/Serum" ,"Tobramycin Peak Plasma/Serum","Gentamicin Peak Plasma/Serum" )
And comm_obj.Modifier = "-RN to Schedule" Then
Prm_Conditional := First of (field_list where field_list.DataItemName = "ConditionalOrder" );
Prm_PriorityTime_New := First of (field_list where field_list.DataItemName = "LAB_Order Priorities" );
Prm_PriorityTime := First of (field_list where field_list.DataItemName = "RequestedTime" );
If Prm_Conditional.Value.IsConditional = True Then
Prm_PriorityTime.Control_Mandatory := False;
Prm_PriorityTime_New.Control_Mandatory := False;
Else
Prm_PriorityTime.Control_Mandatory := True; //Prm_PriorityTime.Control_Mandatory
Prm_PriorityTime_New.Control_Mandatory := True;
EndIf;
Endif;
EndIf;
//--------------------------------------------------------------------------------------------------------------
//******* CSR 34155: Autoscheduling Vancomycin Trough *****************
if ( this_form.Name = "LAB Chemistry TDM" ) then
ASP_OSName := ( "Pneumonia Antibiotic",
"Skin Antibiotic Inpatient",
"Antibiotic Guidelines",
//"Vancomycin Orders",
"Sepsis Unknown Source Antibiotic",
"Sepsis Unknown Source Antibiotic ED" );
if ( order_set_name IN ASP_OSName OR order_set_name matches pattern "Transition Orders%" ) then
autosched_trough_mlm := MLM {{{SINGLE-QUOTE}}}FORM_VANCOMYCIN_AUTOSCHEDULING_TROUGH_ORDERS{{{SINGLE-QUOTE}}};
( this_communication, this_form ) := call autosched_trough_mlm WITH this_communication, this_form, client_info_obj;
endif;
endif;
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns two parameters, of types
//communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,95 @@
maintenance:
title: FORM_LAB_PRIORITY_OPTIONS;;
mlmname: FORM_LAB_PRIORITY_OPTIONS;;
arden: version 2;;
version: 4.50;;
institution: St Clair Isolation Set MLM;;
author: Eclipsys Corp;;
specialist: Shawn Head;;
date: 2014-11-24;;
validation: testing;;
library:
purpose: MLM will display either the custom priorities or system priorites and assign the proper schedule to the lab orders.
;;
explanation: This MLM can be called from any fields on a form that need to trigger the custom priority fields added to the lab forms.
This MLM will display a custom UDDI that has "user fiendly" descriptions. The called MLM SCH_LAB_PRIORITY_OPTIONS_CALLED
is the MLM that actually does all the logic. If there are other MLM{{{SINGLE-QUOTE}}}s already attached to form fields on the MLM then their is a section
commented out below that can be copied/pasted into other MLM{{{SINGLE-QUOTE}}}s to call the MLM properly. There are configuration pieces that Maria Pest
put in place for all this to work properly with the MLM. See the CSR request details for more information. This logic will work on both
Order forms and Order Set Forms.
Change History
2014.11.24 - STH CSR#: 32765 - Created MLM
2015.03.09 - STH CSR#: 32765 - Issues addressed based on users feed back (showing the time field disabled instead of hidding it,adding section for
order set calling, and making sure all fields are working from both order entry and being called from Order Sets).
;;
keywords: Called MLMs, Form fields, schedule
;;
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*******************/
/* These variables must containt he same wording as the options in the drop down list */
/***************************************************************************************/
// Initialize error message
error_message:="";
call_field := this_communication.CallingFieldName;
field_list:= this_form.fields;
DisplayNewScheduled := first of (field_list.Value
where field_list.DataItemName = "LAB_CB_Alternate Priorities");
if (DisplayNewScheduled) then
Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
(this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
endif;
//testmlm := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
// (this_communication,this_form) := call testmlm with (this_communication,this_form,client_info_obj);
//--------THIS SECTION CAN BE COPIED TO OTHER MLM{{{SINGLE-QUOTE}}}S IF YOU NEED TO CALL THE CUSTOM LAB PRIORITIES MLM
/*
//-----------BEGIN COPY SECTION-------------------
DisplayNewScheduled := first of (field_list.Value
where field_list.DataItemName = "LAB_CB_Alternate Priorities");
if (DisplayNewScheduled) then
Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
(this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
endif;
//-----------END COPY SECTION-------------------
//--------THIS SECTION CAN BE COPIED TO OTHER MLM{{{SINGLE-QUOTE}}}S IF YOU NEED TO CALL THE CUSTOM LAB PRIORITIES MLM*/
;;
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:

View File

@@ -0,0 +1,107 @@
maintenance:
title: Lab Synovial Joint Fluid Mandatory;;
mlmname: FORM_LAB_SYNOVIAL_MAND;;
arden: version 2;;
version: 4.50;;
institution: St Clair Lab Synovial MLM;;
author: Robert Spence, Eclipsys Corp;;
specialist: ;;
date: 2006-09-11;;
validation: testing;;
library:
purpose: This MLM sets the field Synovial to Mandatory if another field is selected
;;
explanation: This MLM enables teh Synovial to be mandatory
;;
keywords: Called MLMs, Form fields, Lab, Synovial
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingField :=this_communication.CallingFieldName;
CallingEvent := this_communication.CallingEvent;
FormName := this_form.Name;
If FormName = "Lab_Micro_AFBSmearOn"
then
ActOnField:=last of (field_list
where field_list.DataItemName = "Lab_RC_SDES_MicroSource_AFBSmearOnly" );
elseif FormName = "Lab_Micro_BodyFldCul"
then
ActOnField := last of (field_list
where field_list.DataItemName = "Lab_RC_SDES_MicroBodyFld" );
elseif FormName = "Lab_Micro_FungusCul"
then
ActOnField := last of (field_list
where field_list.DataItemName = "Lab_RC_SDES_MicroSource_FungusSmear" );
elseif FormName ="Lab_Micro_FungusSmea"
then
ActOnField := last of (field_list
where field_list.DataItemName = "Lab_RC_SDES_MicroSource_FungusSmear" );
elseif FormName ="LAB_Micro_TBCulture"
then
ActOnField := last of (field_list
where field_list.DataItemName = "Lab_RC_SDES_MicroSources_TBCul" );
endif;
SynovialField :=last of (field_list
where field_list.DataItemName = "Lab_SREQ_VO_DI_SiteSynovialJointFluid" );
If ActOnField.Value ="Synovial Joint Fluid (SYN)"
then
SynovialField.Control_Mandatory:=True;
else
SynovialField.Control_Mandatory:=False;
endif;
// this_communication.DisplayForm := "Yes";
// this_communication.Message := "MLM Field :" || CallingField || "\n" ||
// "MLM Event :" || CallingEvent || "\n" ||
// "Form type :" || FormType || "\n" ||
// "FormName: " || FormName;
// this_communication.MessageType := "Informational";
;;
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:

View File

@@ -0,0 +1,118 @@
maintenance:
title: BB product mandatory Surg proc or Trans ind;;
filename: FORM_LAB_TDM;;
arden: version 2;;
version: 4.50;;
institution: Eclipsys, System MLM;;
author: Teresa Spicuzza and Beth Hilty;;
specialist: ;;
date: 2006-03-01;;
validation: testing;;
library:
purpose: This MLM removes the mandatory from the Last Dose and Time fields when the Unknown Last Dose checkbox is selected.
;;
explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and
Communications objects and compares it to Client Information to determine whether to display
certain fields and make them mandatory.
A Banner message is presented to the user to remind them that these fields must be
completed.
If the patient data does not meet the above conditions the fields are not visible on
the form.
The MLM is not run from a trigger event, but rather is called by the application.
It should be configured to run on Form Open.
;;
keywords: Called MLMs, Form fields
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
// This removes the mandatory control on the field dataitem - LAB_Chem_Date_TDM and LAB_Chem_Time_TDM
Last_Dose_Date_field := first of (field_list
where field_list.DataItemName = "LAB_Chem_Date_TDM");
Last_Dose_Time_field := first of (field_list
where field_list.DataItemName = "LAB_Chem_Time_TDM");
Unknown_Dose_field := last of (field_list
where field_list.DataItemName = "LAB_Chem_CB_TDM");
If exists Unknown_Dose_field and Unknown_Dose_field.value=TRUE
then
Last_Dose_Date_label := Last_Dose_Date_field.label;
Last_Dose_Date_field.control_mandatory := FALSE;
Last_Dose_Time_field.control_mandatory := FALSE;
endif;
// If Indication in Surgery then
// If Indication = "Product for Surgery" then
// Surg_Proc_field.control_visible := TRUE;
// Surg_Proc_field.control_mandatory := TRUE;
// Trans_Ind_field.value := "";
// Trans_Ind_field.control_visible := FALSE;
// Trans_Ind_field.control_mandatory := FALSE;
// else
//
// If Indication in Transfusion then
// Trans_Ind_field.control_visible := TRUE;
// Trans_Ind_field.control_mandatory := TRUE;
// Surg_Proc_field.value := Blank;
// Surg_Proc_field.control_visible := FALSE;
// Surg_Proc_field.control_mandatory := FALSE;
// endif;
// endif;
// if Indication = NULL then
// Surg_Proc_field.control_mandatory := FALSE;
// Trans_Ind_field.control_mandatory := FALSE;
// endif;
;;
evoke: // No evoke statement
;;
logic:
conclude true;
;;
action:
// This MLM returns one parameters, of type form_type.
return this_communication, this_form;
;;
end:

View File

@@ -0,0 +1,99 @@
maintenance:
title: Ordering: Pregnancy field visable only for females and blood warmer temp mandatory only if warmer field is yes;;
mlmname: FORM_Lab_WarmBlood;;
arden: version 2;;
version: 4.50;;
institution: St Clair Isolation Set MLM;;
author: Don Warnick & Mary Sieger, Eclipsys Corp;;
specialist: ;;
date: 2006-07-25;;
validation: testing;;
library:
purpose: HIde the pregnancy field if the patient is not a female and hide the blood warmer temp if blood warmer field is not yes
;;
explanation: This MLM is called from the LAB BB_Transfuse Rx form.
Upon form open the patient gender is interrogated and if they are female, the pregnancy box is visable.
If the Blood Warmer field is filled with a yes, the Blood Warmer Temp field is mandatory. If no, then it is not.
;;
keywords: Called MLMs, Form fields, Blood Warmer, Pregnancy
;;
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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
// 1. Display the BB Trans Rx_Dict_Pregnancy field only if the patient is female
// 2. Make the BB Trans Rx_Num Temp field mandatory of Blood Warmer field is set to Yes
Pregnancy_History := last of (field_list where field_list.DataItemName = "BB Trans Rx_Dict_Pregnancy" );
Blood_Warmed := last of (field_list where field_list.DataItemName = "BB Trans Rx_Dict_Blood Warmed" );
Blood_Temperature := last of (field_list where field_list.DataItemName = "BB Trans Rx_Num_Temp of Blood Warmer" );
If CallingEvent="FormOpen"
then
if exist client_info_obj
then
(patient_gender ):= read last
{ClientInfo: GenderTypeIntlCode REFERENCING client_info_obj};
endif;
if exist patient_gender
and patient_gender = "M" then
Pregnancy_History.control_visible := False;
Pregnancy_History.control_mandatory := False;
endif;
elseif CallingEvent = "FieldChange"
then
If Blood_Warmed.Value = "No"
then
Blood_Temperature.control_mandatory := False;
elseIf Blood_Warmed.Value = "Yes"
then
Blood_Temperature.control_mandatory := True;
endif;
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:

View File

@@ -0,0 +1,420 @@
maintenance:
title: Form_Lovenox_CalcDose_Simple;;
mlmname: Form_Lovenox_CalcDose_Simple;;
arden: version 2;;
version: 4.50;;
institution: St. Clair Hospital;;
author: Teresa M. Spicuzza (Teresa.Spicuzza@stclair.org), 412.942.1721 ;;
specialist: Eclipsys Corporation;;
date: 2008-09-09;;
validation: testing;;
library:
purpose: Calculate Lovenox dose based on weight - this MLM only calculates the dose
and supplies the correct item code - it does not check for creatinine clearance
and recommend dosing based upon CrCl value.
;;
explanation: Dosing Weight in Kilograms * Dosing = Dose
Change history
04.14.2011 TMS Initial Build from copy of Lovenox calculation MLM (Dev only) with creatinine clearance logic removed
01.16.2012 TMS Correct product code for 160mg dose from 07501 to 03468 - Ticket 146195
10.18.2012 TMS Added hold order logic for start time and start now. CSR 26926
05.08.2017 TMS Update dose cap from 150mg to 190mg for 1mg/kg dosing. CSR 33671
;;
keywords:
lovenox, dose, weight;
;;
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;
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
comm_obj := this_communication.primaryobj;
called_by := this_communication.CallingEvent;
call_field := this_communication.CallingFieldName;
If called_by_editor then
client_guid := "9000001369400200";
visit_guid := visit_obj.GUID;
chart_guid := "9000001918900170";
orderId := "1000002689073001";
called_by := "FormOpen";
else
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGuid;
orderid := this_comm.ItemID;
endif;
//Initialize MLM pointers:
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
// Get patient weight
comb_ht_wt_field := first of (field_list where field_list.DataItemName = "CombinedMeasurements");
If exists comb_ht_wt_field then comb_ht_wt_val := comb_ht_wt_field.value;
wt := comb_ht_wt_val.weight;
weightvalue := (wt as number);
endif;
// Define other fields
dosing10 := first of (field_list where field_list.DataItemName = "PRX_Lovenox1mgDosing");
dosing15 := first of (field_list where field_list.DataItemName = "PRX_Lovenox1.5mgDosing");
dose := first of (field_list where field_list.DataItemName = "DosageLow");
con := first of (field_list where field_list.DataItemName = "PRX_CONCENTRATION");
str := first of (field_list where field_list.DataItemName = "PRX_CONCSTRENGTH");
struom := first of (field_list where field_list.DataItemName = "PRX_CONCSTRENGTHUOM");
strvol := first of (field_list where field_list.DataItemName = "PRX_CONCSTRVOLUME");
strvoluom := first of (field_list where field_list.DataItemName = "PRX_CONCSTRVOLUMEUOM");
worxcode := first of (field_list where field_list.DataItemName = "PRX_DRUGIDCODE");
override := first of (field_list where field_list.DataItemName = "PRX_DosageOverride");
frequencyx := first of (field_list where field_list.DataItemName = "FrequencyCode");
frequency := frequencyx.Value;
q24nowstat := ("Q24H","NOW","STAT","ONCE","TODAY","Given in Infusion Center");
mayprocess:= "YES";
start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" );
requested_time_value := requested_time.value;
order_freq_summary := frequency.FrequencySummary;
session_type := comm_obj.internalprocessingtype;
// Define messages
messageA := "Please round dose to the nearest 5mg";
messageB := "Please round dose to the nearest 10mg";
messageC := "Please verify dose.";
messageG := "Lovenox 1.5 mg/kg is only dosed Q24H";
messageW := "Calculated dosing requires weight to be entered.";
messageD := "Lovenox 1.5 mg/kg is not recommended for patients >136kg. Dosing regimen should be 1mg/kg.";
messageN := "Lovenox is not recommended in patients <30kg. Contact physician.";
//
If session_type = "Hold" then
If exists frequencyx and order_freq_summary = "STAT" then
frequency.FrequencySummary := NULL ;
endif;
start_now.control_read_only := true;
requested_time_value.ReqTimeCode := "Scheduled/Start Time";
endif;
If call_field = "PRX_DosageOverride" and override.value = True then
dosing10.value := False; dosing15.value := False; dose.control_read_only := false; dosing := "M";
dosing10.Control_Read_Only := True; dosing15.Control_Read_Only := True; mayprocess := "YES";
dose.value := "";
con.value := "";
str.value := "";
struom.value := "";
strvol.value := "";
strvoluom.value:= "";
worxcode.value := "";
endif;
If call_field = "PRX_DosageOverride" and override.value = False then
dosing10.value := False; dosing15.value := False; dose.control_read_only := true; dosing := "";
dosing10.Control_Read_Only := false; dosing15.Control_Read_Only := false; mayprocess := "NO"; dose.value := "";
endif;
// Toggle between 1.0 and 1.5 dosing
If call_field = "PRX_Lovenox1mgDosing" and dosing10.value = True then
dosing15.value := False; override.value := False; dosing := "1"; dose.control_read_only := True; mayprocess := "YES";
endif;
If call_field = "PRX_Lovenox1mgDosing" and dosing10.value = False then
dosing15.value := True; override.value := False; dosing:= "1.5"; dose.control_read_only := True; mayprocess := "YES";
If frequency.FrequencySummary is not null then
If frequency.FrequencySummary not in q24nowstat then
messagetext := messageG;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
frequency.FrequencySummary := null;
endif;
endif;
endif;
If call_field = "PRX_Lovenox1.5mgDosing" and dosing15.value = True then
dosing10.value := False; override.value := False; dosing:= "1.5"; dose.control_read_only := True; mayprocess := "YES";
If frequency.FrequencySummary is not null then
If frequency.FrequencySummary not in q24nowstat then
messagetext := messageG;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
frequency.FrequencySummary := null;
endif;
endif;
endif;
If call_field = "PRX_Lovenox1.5mgDosing" and dosing15.value = False then
dosing10.value := True; override.value := False; dosing:= "1"; mayprocess := "YES";
endif;
If ((call_field <> "PRX_Lovenox1mgDosing" and call_field <> "PRX_Lovenox1.5mgDosing") or call_field is null) and dosing10.value = True then dosing := "1"; endif;
If ((call_field <> "PRX_Lovenox1.5mgDosing" and call_field <> "PRX_Lovenox1.5mgDosing") or call_field is null) and dosing15.value = True then dosing := "1.5"; endif;
If ((call_field <> "PRX_Lovenox1mgDosing" and call_field <> "PRX_Lovenox1.5mgDosing") or call_field is null) and override.value = True then dosing := "M"; endif;
If ((call_field = "DosageLow") and (override.value = True)) then dosing := "M"; endif;
If called_by in ("FormClose", "FieldChange") then
If frequency.FrequencySummary is not null then
If frequency.FrequencySummary not in q24nowstat and dosing = "1.5" then
messagetext := messageG;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
frequency.FrequencySummary := null;
endif;
endif;
/*
If (dosing = "1" or dosing = "1.5") and weightValue is null then
messagetext := messageW;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
endif;
*/
//////////////////////////////////////////// Process Fields Section ////////////////////////////////////////////
/* Manual Dose Logic */
If mayprocess = "YES" and dosing = "M" then; manual_dose := dose.value;
worxcode.value := Null;
manual_map_list :=(
// dsg ds con s su v vu id
"M|||30|(30mg/0.3ml)|30|MG|0.3|ML|06817",
"M|||40|(40mg/0.4ml)|40|MG|0.4|ML|05997",
"M|||45|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"M|||50|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"M|||55|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"M|||60|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"M|||65|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"M|||70|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"M|||75|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"M|||80|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"M|||85|(100mg/ml)|100|MG|1|ML|06999",
"M|||90|(100mg/ml)|100|MG|1|ML|06999",
"M|||95|(100mg/ml)|100|MG|1|ML|06999",
"M|||100|(100mg/ml)|100|MG|1|ML|06999",
"M|||110|(120mg/ml)|120|MG|1|ML|07500",
"M|||120|(120mg/ml)|120|MG|1|ML|07500",
"M|||130|(150mg/ml)|150|MG|1|ML|07501",
"M|||140|(150mg/ml)|150|MG|1|ML|07501",
"M|||150|(150mg/ml)|150|MG|1|ML|07501",
"M|||160|(2 x 80mg)| | | | |03468",
"M|||170|(100 + 70mg)| | | | |03469",
"M|||180|(100 + 80mg)| | | | |03470",
"M|||190|(100 + 90mg)| | | | |03471",
"M|||200|(2 x 100mg)| | | | |03472"
);
for j in 1 seqto count manual_map_list do
manual_element_list := call str_parse with manual_map_list[j], "|";
field1 := manual_element_list[1];
field2 := manual_element_list[2];
field3 := manual_element_list[3];
field4 := manual_element_list[4];
field5 := manual_element_list[5];
field6 := manual_element_list[6];
field7 := manual_element_list[7];
field8 := manual_element_list[8];
field9 := manual_element_list[9];
field10:= manual_element_list[10];
If manual_dose = (field4 as number) then
con.value := field5;
str.value := field6;
struom.value := field7;
strvol.value := field8;
strvoluom.value:= field9;
worxcode.value := field10;
endif;
enddo; /* for j in 1 seqto count manual_map_list do */
If manual_dose < 101 and worxcode.value is null then
messagetext := messageA;
dose.value := "";
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
endif;
If manual_dose > 100 and manual_dose < 200 and worxcode.value is null then
messagetext := messageB;
dose.value := "";
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
endif;
If manual_dose > 200 or manual_dose < 30 and worxcode.value is null then
dose.value := "";
messagetext := messageC;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
endif;
endif; /* may process = YES and dosing = "M" */
/* Calculated dosing logic */
If mayprocess = "YES" and dosing <> "M" then
// If (dosing = "1" or dosing = "1.5") and weightvalue < 1 then
// messagetext := messageW;
// this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
// endif;
If (dosing = "1" or dosing = "1.5") and (weightvalue > 0 and weightvalue < 30) then
messagetext := messageN;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
endif;
If dosing = "1.5" and weightvalue > 136.4 then
messagetext := messageD;
dose.value := "";
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
endif;
calc_map_list :=(
// dsg wl wu ds con s su v vu id
"1|0.5|29.4||(30mg/0.3ml)|30|MG|0.3|ML|06817",
"1|29.5|34.4|30|(30mg/0.3ml)|30|MG|0.3|ML|06817",
"1|34.5|35.4|40|(40mg/0.4ml)|40|MG|0.4|ML|05997",
"1|35.5|43.4|40|(40mg/0.4ml)|40|MG|0.4|ML|05997",
"1|43.5|46.4|45|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1|46.5|53.4|50|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1|53.5|56.4|55|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1|56.5|63.4|60|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1|63.5|66.4|65|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1|66.5|73.4|70|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1|73.5|76.4|75|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1|76.5|83.4|80|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1|83.5|86.4|85|(100mg/ml)|100|MG|1|ML|06999",
"1|86.5|93.4|90|(100mg/ml)|100|MG|1|ML|06999",
"1|93.5|96.4|95|(100mg/ml)|100|MG|1|ML|06999",
"1|96.5|105.4|100|(100mg/ml)|100|MG|1|ML|06999",
"1|105.5|115.4|110|(120mg/ml)|120|MG|1|ML|07500",
"1|115.5|125.4|120|(120mg/ml)|120|MG|1|ML|07500",
"1|125.5|135.4|130|(150mg/ml)|150|MG|1|ML|07501",
"1|135.5|145.4|140|(150mg/ml)|150|MG|1|ML|07501",
"1|145.5|155.4|150|(150mg/ml)|150|MG|1|ML|07501",
"1|155.5|165.4|160|(2 x 80mg)| | | | |03468",
"1|165.5|175.4|170|(100 + 70mg)| | | | |03469",
"1|175.5|185.4|180|(100 + 80mg)| | | | |03470",
"1|185.5|195.4|190|(100 + 90mg)| | | | |03471",
"1.5|0.5|29.4||(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1.5|29.5|31.4|45|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1.5|31.5|35.4|50|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1.5|35.5|37.4|55|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1.5|37.5|42.4|60|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1.5|42.5|44.4|65|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1.5|44.5|48.4|70|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1.5|48.5|51.4|75|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1.5|51.5|55.4|80|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1.5|55.5|57.4|85|(100mg/ml)|100|MG|1|ML|06999",
"1.5|57.5|61.4|90|(100mg/ml)|100|MG|1|ML|06999",
"1.5|61.5|64.4|95|(100mg/ml)|100|MG|1|ML|06999",
"1.5|64.5|70.4|100|(100mg/ml)|100|MG|1|ML|06999",
"1.5|70.5|76.4|110|(120mg/ml)|120|MG|1|ML|07500",
"1.5|76.5|83.4|120|(120mg/ml)|120|MG|1|ML|07500",
"1.5|83.5|90.4|130|(150mg/ml)|150|MG|1|ML|07501",
"1.5|90.5|96.4|140|(150mg/ml)|150|MG|1|ML|07501",
"1.5|96.5|103.4|150|(150mg/ml)|150|MG|1|ML|07501",
"1.5|103.5|110.4|160|(80 + 80mg)| | | | |03468",
"1.5|110.5|116.4|170|(100 + 70mg)| | | | |03469",
"1.5|116.5|123.4|180|(100 + 80mg)| | | | |03470",
"1.5|123.5|130.4|190|(100 + 90mg)| | | | |03471",
"1.5|130.5|136.4|200|(100 + 100mg)| | | | |03472"
);
for i in 1 seqto count calc_map_list do
calc_element_list := call str_parse with calc_map_list[i], "|";
field1 := calc_element_list[1];
field2 := calc_element_list[2];
field3 := calc_element_list[3];
field4 := calc_element_list[4];
field5 := calc_element_list[5];
field6 := calc_element_list[6];
field7 := calc_element_list[7];
field8 := calc_element_list[8];
field9 := calc_element_list[9];
field10:= calc_element_list[10];
//
field2conv := (field2 as number);
field3conv := (field3 as number);
field4conv := (field4 as number);
If (dosing = field1) and (weightvalue >= field2conv) and (weightvalue <= field3conv) then
dose.value := field4;
con.value := field5;
str.value := field6;
struom.value := field7;
strvol.value := field8;
strvoluom.value:= field9;
worxcode.value := field10;
endif;
enddo; /* for i in 1 seqto count calc_map_list do */
If (dosing = "1") and (weightvalue >195.4) then
dose.value := 190;
con.value := "(100 + 90mg)";
str.value := "";
struom.value := "";
strvol.value := "";
strvoluom.value:= "";
worxcode.value := "03472";
endif;
endif; /* may process = YES */
endif; /* If formclose or fieldchange)*/
If called_by = "FormClose" then
If (dosing = "1" or dosing = "1.5") and weightValue is null then
messagetext := messageW;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
endif;
endif;
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns two parameters, of types
//communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,608 @@
maintenance:
title: Form_Lovenox_Dose_calc;;
mlmname: Form_Lovenox_Dose_calc;;
arden: version 2;;
version: 4.50;;
institution: St. Clair Hospital;;
author: Teresa M. Spicuzza (Teresa.Spicuzza@stclair.org), 412.942.1721 ;;
specialist: Eclipsys Corporation;;
date: 2008-09-09;;
validation: testing;;
library:
purpose: Calculate Lovenox dose based on weight with dosing recommendations for decreased kidney function.
;;
explanation: Dosing Weight in Kilograms * Dosing = Dose
Change history
09.09.2008 DW Initial build
02.26.2012 TMS Revised to disallow override when CrCl < 27 ml/min. Additional Messages for clarity.
10.18.2012 TMS Added hold order logic for start time and start now. CSR 26926
06.01.2016 TMS Added EstCrClval to argument being returned from CrCl MLM call as needed for
other calculated med orders (Vanco). CSR 34154, 34156
05.08.2017 TMS Update dose cap from 150mg to 190mg for 1mg/kg dosing. CSR 33671
;;
keywords:
lovenox, dose, weight;
;;
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;
comm_obj := this_communication.primaryobj;
called_by := this_communication.CallingEvent;
call_field := this_communication.CallingFieldName;
if called_by_editor then
client_guid := "9000001369400200";
visit_guid := visit_obj.GUID;
chart_guid := "9000001918900170";
orderId := "1000002689073001";
called_by := "FormOpen";
else
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGuid;
orderid := this_comm.ItemID;
endif;
//Initialize MLM pointers:
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
If (call_field = "PRX_Generic_CB") or (CallingEvent = "FormOpen") then
creatinine_calculator := mlm {{{SINGLE-QUOTE}}}FORM_MLM_CREATININE_CLEARANCE{{{SINGLE-QUOTE}}};
(this_communication, this_form, EstCrClval) := call creatinine_calculator with this_communication, this_form, client_info_obj;
endif;
// Get patient weight
comb_ht_wt_field := first of (field_list where field_list.DataItemName = "CombinedMeasurements");
if exists comb_ht_wt_field then comb_ht_wt_val := comb_ht_wt_field.value;
wt := comb_ht_wt_val.weight;
weightvalue := (wt as number);
endif;
creatinine := first of (field_list where field_list.DataItemName = "PRX_CrCl_Estimated");
creatininevalue := creatinine.value;
// Define other fields
dosing10 := first of (field_list where field_list.DataItemName = "PRX_Lovenox1mgDosing");
dosing15 := first of (field_list where field_list.DataItemName = "PRX_Lovenox1.5mgDosing");
dose := first of (field_list where field_list.DataItemName = "DosageLow");
con := first of (field_list where field_list.DataItemName = "PRX_CONCENTRATION");
str := first of (field_list where field_list.DataItemName = "PRX_CONCSTRENGTH");
struom := first of (field_list where field_list.DataItemName = "PRX_CONCSTRENGTHUOM");
strvol := first of (field_list where field_list.DataItemName = "PRX_CONCSTRVOLUME");
strvoluom := first of (field_list where field_list.DataItemName = "PRX_CONCSTRVOLUMEUOM");
worxcode := first of (field_list where field_list.DataItemName = "PRX_DRUGIDCODE");
override := first of (field_list where field_list.DataItemName = "PRX_DosageOverride");
override_value := override.value;
frequencyx := first of (field_list where field_list.DataItemName = "FrequencyCode");
frequency := frequencyx.Value;
q24nowstat := ("Q24H","NOW","STAT","ONCE");
nowstat := ("NOW","STAT","ONCE");
mayprocess:= "YES";
start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" );
requested_time_value := requested_time.value;
order_freq_summary := frequency.FrequencySummary;
session_type := comm_obj.internalprocessingtype;
// Define messages
messageA := "Max Lovenox dose in patients with CrCl less than 30ml/min is 1mg/kg SQ Q24H. \n";
messageB := "Recommended Lovenox dose for CrCl 30ml/min or above is 1mg/kg SQ Q12H. \n";
messageC := "Max Lovenox dose for morbidly obese patients with a CrCl 30ml/min or above is 190mg SQ Q12H. Unfractionated heparin may be a consideration in morbidly obese patients. \n";
messageD := "Max Lovenox dose for morbidly obese patients with a CrCl less than 30ml/min is 190mg SQ Q24H. Unfractionated heparin may be a consideration in renally impaired/dialysis patients and/or morbidly obese patients. \n";
messageE := "Lovenox not appropriate for patients weighing less than 30kg. \n";
messageF := "Lovenox 1.5 mg/kg is not appropriate for patients greater than 136kg. \n\n Max Lovenox dose for morbidly obese patients with a CrCl greater than 30ml/min is 1mg/kg (max 150mg) SQ Q12H. Unfractionated heparin may be a consideration in morbidly obese patients. \n";
messageG := "Lovenox 1.5 mg/kg is only dosed Q24H. \n";
messageH := "Lovenox 1.5 mg/kg is not appropriate for patients greater than 136kg. \n\n Max Lovenox dose for morbidly obese patients with a CrCl less than 30ml/min is 1mg/kg (max 150mg) SQ Q24H. Unfractionated heparin may be a consideration in renally impaired/dialysis patients and/or morbidly obese patients. \n";
messageR := "Max Lovenox 1.5mg/kg one time dose for obese patients is 200mg. Unfractionated heparin may be a consideration in morbidly obese patients. \n";
messageQ := "Max Lovenox 1mg/kg one time dose for morbidly obese patients is 190mg. Unfractionated heparin may be a consideration in morbidly obese patients. \n";
messageY := "\n You may override the recommended dose by selecting the Override box. \n";
// Hold order processing
If session_type = "Hold" then
If exists frequencyx and order_freq_summary = "STAT" then
frequency.FrequencySummary := NULL ;
endif;
start_now.control_read_only := true;
requested_time_value.ReqTimeCode := "Scheduled/Start Time";
endif;
// Set value of message Z (patient creatinine between 27 & 33)
If creatininevalue >= 27 and creatininevalue <= 33
then messageZ := "\n Patients CrCl is estimated to " || creatininevalue || ". Please use clinical judgement in determining dosing regimen. \n";
else messageZ := " ";
endif;
// Set value of message X (patient creatinine between < 27 no override allowed)
If creatininevalue < 27
then messageX := " ";
else messageX := "\n You may override the recommended frequency by selecting the Override box. \n";
endif;
// Toggle between 1.0 and 1.5 dosing
If call_field = "PRX_Lovenox1mgDosing" and dosing10.value = True then dosing15.value := False; dosing := "1"; endif;
If call_field = "PRX_Lovenox1mgDosing" and dosing10.value = False then dosing15.value := True; dosing:= "1.5"; endif;
If call_field = "PRX_Lovenox1.5mgDosing" and dosing15.value = True then dosing10.value := False; dosing:= "1.5"; endif;
If call_field = "PRX_Lovenox1.5mgDosing" and dosing15.value = False then dosing10.value := True; dosing:= "1"; endif;
If ((call_field <> "PRX_Lovenox1mgDosing" and call_field <> "PRX_Lovenox1.5mgDosing") or call_field is null) and dosing10.value = True then dosing := "1"; endif;
If ((call_field <> "PRX_Lovenox1.5mgDosing" and call_field <> "PRX_Lovenox1.5mgDosing") or call_field is null) and dosing15.value = True then dosing := "1.5"; endif;
// If frequency is blank
If frequency.FrequencySummary is not null then
// Patient is too small
If weightvalue < 30 then
mayprocess := "NO";
messagetext := messageE;
this_communication.Message := messagetext || messageZ ; this_communication.MessageType := "Informational";
override.control_read_only := True;
override.value := False;
//////////////////////////////////////////// 1.5 dosing section ////////////////////////////////////////////
elseif (dosing = "1.5") then
// Patient is too big.....CrCl is high... frequency is Q24H
if (weightvalue > 136.4 and creatininevalue >= 30 and frequency.FrequencySummary = "Q24H") then
mayprocess := "NO";
messagetext := messageF;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
override.control_read_only := True;
override.value := False;
// Patient is too big.....CrCl is high... one time frequency
elseif (weightvalue > 136.4 and creatininevalue >= 30 and frequency.FrequencySummary in NowStat) then
mayprocess := "YES";
weightvalue := 133;
messagetext := messageR;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
override.control_read_only := True;
override.value := False;
// Patient is too big.....CrCl is low
elseif (weightvalue > 136.4 and creatininevalue < 30) then
mayprocess := "NO";
messagetext := messageH;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
override.control_read_only := True;
override.value := False;
// Patient is too big.....CrCl is high.....frequency = Q12H
elseif (weightvalue > 136.4 and creatininevalue > 30 and frequency.FrequencySummary = "Q12H") then
mayprocess := "NO";
messagetext := messageF;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
override.control_read_only := True;
override.value := False;
// Patient is just right.....CrCl is low.....frequency = Q12H
elseif (weightvalue <= 136.4 and creatininevalue <= 30 and frequency.FrequencySummary = "Q12H") then
mayprocess := "NO";
messagetext := messageG;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
override.control_read_only := True;
override.value := False;
// Patient is just right.....CrCl is <=30 and >=27.....frequency = Q24hr/NOW/STAT/ONCE......no override
elseif (weightvalue <= 136.4 and creatininevalue <= 30 and creatininevalue >= 27 and frequency.FrequencySummary in q24nowstat and override.value = False) then
mayprocess := "NO";
messagetext := messageA;
this_communication.Message := messagetext || messageZ || messageY ; this_communication.MessageType := "Informational";
override.control_read_only := False;
// Patient is just right.....CrCl is <=30 and >=27.....frequency = Q24hr/NOW/STAT/ONCE.....recommended dose was ovverridden
elseif (weightvalue <= 136.4 and creatininevalue <= 30 and creatininevalue >= 27 and frequency.FrequencySummary in q24nowstat and override.value = True) then
mayprocess := "YES";
override.control_read_only := False;
// Patient is just right.....CrCl is < 27.....frequency = Q24hr/NOW/STAT/ONCE......no override allowed
elseif (weightvalue <= 136.4 and creatininevalue < 27 and frequency.FrequencySummary in q24nowstat and override.value = False) then
mayprocess := "NO";
messagetext := messageA;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
override.control_read_only := True;
override.value := False;
// Patient is just right.....CrCl is high.....frequency =Q12H
elseif ( weightvalue <= 136.4 and creatininevalue >= 30 and frequency.FrequencySummary not in q24nowstat) then
mayprocess := "NO";
dose.value := NULL;
messagetext := messageG;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
override.control_read_only := True;
override.value := False;
// Patient is just right.....CrCl is high.....frequency = NOW/STAT/ONCE
elseif ( weightvalue <= 136.4 and creatininevalue >= 30 and frequency.FrequencySummary in nowstat ) then
mayprocess := "YES";
override.control_read_only := True;
override.value := False;
// Patient is just right.....CrCl is high.....frequency = Q24hr
elseif ( weightvalue <= 136.4 and creatininevalue >= 30 and frequency.FrequencySummary = "Q24H" ) then
mayprocess := "YES";
If messageZ <> " " then this_communication.Message := messageZ ; this_communication.MessageType := "Informational"; endif;
override.control_read_only := True;
override.value := False;
endif; /* end of 1.5 section */
else /* proceed to 1.0 section (dosing <> 1.5) */
//////////////////////////////////////////// 1.0 dosing section ////////////////////////////////////////////////////////////////////////////////////////
// Patient is obese.....CrCl is okay.....frequency = Q24hr......no override
if (weightvalue > 195 and creatininevalue >= 30 and frequency.FrequencySummary = "Q24H" and override.value = False) then
mayprocess := "NO";
messagetext := messageC;
this_communication.Message := messagetext || messageZ || messageX; this_communication.MessageType := "Informational";
override.control_read_only := False;
// Patient is obese.....CrCl is okay.....frequency = Q24hr.....recommended dose was overridden
elseif (weightvalue > 195 and creatininevalue >= 30 and frequency.FrequencySummary = "Q24H" and override.value = True) then
mayprocess := "YES";
weightvalue := 190;
override.control_read_only := False;
// Patient is obese.....CrCl is okay.....frequency = Q12hr
elseif (weightvalue > 195 and creatininevalue >= 30 and frequency.FrequencySummary = "Q12H") then
mayprocess := "YES";
weightvalue := 190;
messagetext := messageC;
this_communication.Message := messagetext || messageZ ; this_communication.MessageType := "Informational";
override.control_read_only := True;
override.value := False;
// Patient is obese.....CrCl is okay.....frequency = NOW/STAT/ONCE
elseif (weightvalue > 195 and creatininevalue >= 30 and frequency.FrequencySummary in q24nowstat) then
mayprocess := "YES";
weightvalue := 190;
messagetext := messageQ;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
override.control_read_only := True;
override.value := False;
// Patient is obese.....CrCl is too low (< 30 and >= 27).....frequency = Q12H......no override
elseif (weightvalue > 195 and creatininevalue < 30 and creatininevalue >= 27 and frequency.FrequencySummary not in q24nowstat and override.value = False) then
mayprocess := "NO";
messagetext := messageD;
this_communication.Message := messagetext || messageZ || messageX ; this_communication.MessageType := "Informational";
override.control_read_only := False;
override.value := False;
// Patient is obese.....CrCl is too low (<27).....frequency = Q12H......no override allowed
elseif (weightvalue > 195 and creatininevalue < 27 and frequency.FrequencySummary not in q24nowstat ) then
mayprocess := "NO";
messagetext := messageD;
this_communication.Message := messagetext || messageZ ; this_communication.MessageType := "Informational";
override.control_read_only := True;
override.value := False;
// Patient is obese.....CrCl is too low (< 30 and >= 27).....frequency = Q12H .....recommended dose was ovverridden
elseif (weightvalue > 195 and creatininevalue < 30 and creatininevalue >= 27 and frequency.FrequencySummary not in q24nowstat and override.value = True)
then
mayprocess := "YES";
weightvalue := 190;
// messagetext := messageC;
// this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
override.control_read_only := False;
// Patient is obese.....CrCl is too low.....frequency = Q24
elseif (weightvalue > 195 and creatininevalue < 30 and frequency.FrequencySummary = "Q24H" ) then
mayprocess := "YES";
weightvalue := 190;
messagetext := messageD;
this_communication.Message := messagetext || messageZ ; this_communication.MessageType := "Informational";
override.control_read_only := True;
override.value := False;
// Patient is obese.....CrCl is too low.....frequency = NOW/STAT/ONCE
elseif (weightvalue > 195 and creatininevalue < 30 and frequency.FrequencySummary in nowstat) then
mayprocess := "YES";
weightvalue := 190;
messagetext := messageQ;
this_communication.Message := messagetext ; this_communication.MessageType := "Informational";
override.control_read_only := True;
override.value := False;
// Patient is just right.....CrCl is okay.....frequency = Q24hr......no override
elseif ( weightvalue <= 195 and creatininevalue >= 30 and frequency.FrequencySummary = "Q24H" and override.value = False) then
mayprocess := "NO";
messagetext := messageB;
this_communication.Message := messagetext || messageZ || messageX ; this_communication.MessageType := "Informational";
override.control_read_only := False;
// Patient is just right.....CrCl is okay.....frequency = Q24hr.....recommended dose was ovverridden
elseif ( weightvalue <= 195 and creatininevalue >= 30 and frequency.FrequencySummary = "Q24H" and override.value = True) then
mayprocess := "YES";
override.control_read_only := False;
// Patient is just right.....CrCl is okay.....frequency = Q12hr
elseif (weightvalue <= 195 and creatininevalue >= 30 and frequency.FrequencySummary = "Q12H") then
mayprocess := "YES";
If messageZ <> " " then this_communication.Message :=messageZ ; this_communication.MessageType := "Informational"; endif;
override.control_read_only := True;
override.value := False;
// Patient is just right.....CrCl is okay.....frequency = NOW/STAT/ONCE
elseif (weightvalue <= 195 and creatininevalue >= 30 and frequency.FrequencySummary in nowstat) then
mayprocess := "YES";
override.control_read_only := True;
override.value := False;
// Patient is just right.....CrCl is too low.....frequency = Q24
elseif ( weightvalue <= 195 and creatininevalue < 30 and frequency.FrequencySummary = "Q24H") then
mayprocess := "YES";
If messageZ <> " " then this_communication.Message := messageZ ; this_communication.MessageType := "Informational"; endif;
override.control_read_only := True;
override.value := False;
// Patient is just right.....CrCl is too low.....frequency = NOW/STAT/ONCE
elseif ( weightvalue <= 195 and creatininevalue < 30 and frequency.FrequencySummary in nowstat ) then
mayprocess := "YES";
override.control_read_only := True;
override.value := False;
// Patient is just right.....CrCl is too low.....frequency = Q12H......no override
elseif (weightvalue <= 195 and creatininevalue < 30 and creatininevalue >= 27 and frequency.FrequencySummary not in q24nowstat and override.value = False) then
mayprocess := "NO";
messagetext := messageA;
this_communication.Message := messagetext || messageZ || messageX ; this_communication.MessageType := "Informational";
override.control_read_only := False;
// Patient is just right.....CrCl is too low (<27).....frequency = Q12H......no override allowed
elseif (weightvalue<= 195 and creatininevalue < 27 and frequency.FrequencySummary not in q24nowstat ) then
mayprocess := "NO";
messagetext := messageA;
this_communication.Message := messagetext || messageZ ; this_communication.MessageType := "Informational";
override.control_read_only := True;
override.value := False;
// Patient is just right.....CrCl is too low.....frequency = Q12H.....recommended dose was ovverridden
elseif (weightvalue <= 195 and creatininevalue < 30 and creatininevalue >= 27 and frequency.FrequencySummary not in q24nowstat and override.value = True) then
mayprocess := "YES";
override.control_read_only := False;
endif; /* end of 1.0 section */
endif; /* end of proceessing for patient{{{SINGLE-QUOTE}}}s not too small */
//////////////////////////////////////////// Process Fields Section ////////////////////////////////////////////
If mayprocess = "YES" then
calc_map_list :=(
// dsg wl wu ds con s su v vu id
"1|30|34.4|30|(30mg/0.3ml)|30|MG|0.3|ML|06817",
"1|34.5|35.4|40|(40mg/0.4ml)|40|MG|0.4|ML|05997",
"1|35.5|43.4|40|(40mg/0.4ml)|40|MG|0.4|ML|05997",
"1|43.5|46.4|45|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1|46.5|53.4|50|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1|53.5|56.4|55|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1|56.5|63.4|60|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1|63.5|66.4|65|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1|66.5|73.4|70|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1|73.5|76.4|75|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1|76.5|83.4|80|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1|83.5|86.4|85|(100mg/ml)|100|MG|1|ML|06999",
"1|86.5|93.4|90|(100mg/ml)|100|MG|1|ML|06999",
"1|93.5|96.4|95|(100mg/ml)|100|MG|1|ML|06999",
"1|96.5|105.4|100|(100mg/ml)|100|MG|1|ML|06999",
"1|105.5|115.4|110|(120mg/ml)|120|MG|1|ML|07500",
"1|115.5|125.4|120|(120mg/ml)|120|MG|1|ML|07500",
"1|125.5|135.4|130|(150mg/ml)|150|MG|1|ML|07501",
"1|135.5|145.4|140|(150mg/ml)|150|MG|1|ML|07501",
"1|145.5|155.4|150|(150mg/ml)|150|MG|1|ML|07501",
"1|155.5|165.4|160|(2 x 80mg)| | | | |03468",
"1|165.5|175.4|170|(100 + 70mg)| | | | |03469",
"1|175.5|185.4|180|(100 + 80mg)| | | | |03470",
"1|185.5|195.4|190|(100 + 90mg)| | | | |03471",
"1.5|29.5|31.4|45|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1.5|31.5|35.4|50|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1.5|35.5|37.4|55|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1.5|37.5|42.4|60|(60mg/0.6ml)|60|MG|0.6|ML|06997",
"1.5|42.5|44.4|65|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1.5|44.5|48.4|70|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1.5|48.5|51.4|75|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1.5|51.5|55.4|80|(80mg/0.8ml)|80|MG|0.8|ML|06998",
"1.5|55.5|57.4|85|(100mg/ml)|100|MG|1|ML|06999",
"1.5|57.5|61.4|90|(100mg/ml)|100|MG|1|ML|06999",
"1.5|61.5|64.4|95|(100mg/ml)|100|MG|1|ML|06999",
"1.5|64.5|70.4|100|(100mg/ml)|100|MG|1|ML|06999",
"1.5|70.5|76.4|110|(120mg/ml)|120|MG|1|ML|07500",
"1.5|76.5|83.4|120|(120mg/ml)|120|MG|1|ML|07500",
"1.5|83.5|90.4|130|(150mg/ml)|150|MG|1|ML|07501",
"1.5|90.5|96.4|140|(150mg/ml)|150|MG|1|ML|07501",
"1.5|96.5|103.4|150|(150mg/ml)|150|MG|1|ML|07501",
"1.5|103.5|110.4|160|(2 x 80mg)| | | | |03468",
"1.5|110.5|116.4|170|(100 + 70mg)| | | | |03469",
"1.5|116.5|123.4|180|(100 + 80mg)| | | | |03470",
"1.5|123.5|130.4|190|(100 + 90mg)| | | | |03471",
"1.5|130.5|136.4|200|(2 X 100mg)| | | | |03472"
);
for i in 1 seqto count calc_map_list do
calc_element_list := call str_parse with calc_map_list[i], "|";
field1 := calc_element_list[1];
field2 := calc_element_list[2];
field3 := calc_element_list[3];
field4 := calc_element_list[4];
field5 := calc_element_list[5];
field6 := calc_element_list[6];
field7 := calc_element_list[7];
field8 := calc_element_list[8];
field9 := calc_element_list[9];
field10:= calc_element_list[10];
field2conv := (field2 as number);
field3conv := (field3 as number);
if (dosing = field1) and (weightvalue >= field2conv) and (weightvalue <= field3conv) then
dose.value := field4;
con.value := field5;
str.value := field6;
struom.value := field7;
strvol.value := field8;
strvoluom.value:= field9;
worxcode.value := field10;
endif;
enddo; /* for i in 1 seqto count calc_map_list do */
else
dose.value := "";
con.value := "";
str.value := "";
struom.value := "";
strvol.value := "";
strvoluom.value:= "";
worxcode.value := "";
endif; /* may process = YES */
else; /* frequency has been entered */
endif; /* frequency has been entered */
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns two parameters, of types
//communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,606 @@
maintenance:
title: Ordering: Pregnancy field visable only for females between 9 and 55;;
mlmname: FORM_Medical_Imaging;;
arden: version 2;;
version: 4.50;;
institution: St Clair Pregnanacy and Isolation MLM;;
author: Don Warnick, Robert Spence Eclipsys Corp;;
specialist: ;;
date: 2007-07-31;;
validation: testing;;
library:
purpose: Hide the pregnancy field if the patient is not a female of child bearing age
Auto popultate the isolation field
Loosen the restrictions for Medical Imaging orders when the order is entered by a doctor
;;
explanation: This MLM is called from many Medical Imaging forms.
Upon form open the patient gender and age is interrogated and if the patient is a female between 9 and 55, the pregnancy box is visable.
Auto fill the isolation field per the patient{{{SINGLE-QUOTE}}}s current isolation status
If requesting doctor is non-staff physician, the type-in physician field becomes mandatory
If a doctor (orderroletype = %physician%) enters the order, this MLM will cause some fields to be optional.
Change history
05.29.2008 DW Change hidden fields to protected fields (control_visible := false --- control_read_only :=true)
06.03.2008 DW Removed the calling event = form open statement so the mlm logic can be invoked from a grid
07.07.2008 DW Removed the reverse childbearing female logic of 5/29 (pregnancy question was shown incorrectly as mandatory on ultrasound tests)
01.13.2009 DW Added session object code to recall the answer to the pregnancy and lms questions and populate them on other forms during the session
03.17.2009 DW Added code to fire an alert only if a Contrast is needed, the patient is allergic to Iodine and the order is a CT or MRI
06.20.2012 TMS CSR# 22904 - Added coding to retrieve idodine allergy and reaction, diabetic health issues and metformin given or history of metformin in
the past 48 hours to auto populate fields on diagnostic studies with contrast questions.
06.26.2012 TMS CSR# 22904 - Removed query for medication history per requestor.
02.25.2014 DW CSR# 32185 - CPOE Auto-populate pregnancy field on MI order forms
05.05.2014 DW CSR# 32185 - CPOE Auto-populate pregnancy field on MI order forms (disable the cpoe logic related to contrast)
10.29.2014 JML CSR# 32188 - Added call to FORM_ED_CT_ORDERS_TO_STAT to ensure all CT orders made in ED are set to STAT
09.23.2015 DW CSR# 23359 - ICD10
07.19.2018 TMS CSR# 36350 - Added FieldChange and MLM_From Order Set field in addition to FormOpen Logic to execute MLM from CT Order Sets.
;;
keywords: Called MLMs, Form fields, Pregnancy, Isolation
;;
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;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
//JML - CSR 32188 Change
ed_ct_stat_orders := mlm {{{SINGLE-QUOTE}}}FORM_ED_CT_ORDERS_TO_STAT{{{SINGLE-QUOTE}}};
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Change the age limits with these variables */
lower_age_limit := 9;
upper_age_limit := 56;
non_staff_requester := "Non Staff, Physician";
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField :=this_communication.CallingFieldName;
ClientVisitGuid := this_communication.ClientVisitGuid;
ClientGuid := this_communication.ClientGuid;
ChartGuid := this_communication.ChartGuid;
requesting_user_guid := this_communication.CareProviderGUID;
orderroletype:= this_communication.primaryobj.enterrole;
user_guid:= this_communication.userguid;
ordername:= this_communication.primaryobj.name;
//--------------------------------------------------------------------------
local_session := cds_session.local;
//--------------------------------------------------------------------------
if ( ordername matches pattern "%CT%" ) then
( this_communication, this_form_client_info_obj ) := call ed_ct_stat_orders with this_communication, this_form, client_info_obj;
endif;
//Mark by RS
// Display the MI_LV_MI Yes No Pregnancy field only if the patient is female
// Also display last menstraul period if patient is female.
Pregnancy_History := last of (field_list where field_list.DataItemName = "MI_LV_MI Yes No Pregnacy" );
LMP_Field := last of (field_list where field_list.DataItemName = "MI_LV_MI LMP" );
Order_md_field := last of (field_list where field_list.DataItemName = "MI_MR_VO_OBR16P2_MI Typein Order MD");
Iso_field :=last of (field_list where field_list.DataItemName = "MI Isolation" );
ctabdpelviscontrast := last of (field_list where field_list.DataItemName = "MI_VO_MI CT Abd Pelvis Contrast" );
ctothercontrast := last of (field_list where field_list.DataItemName = "MI_VO_MI CT Other Contrast" );
DiabeticPatient := last of (field_list where field_list.DataItemName = "MI Yes No" );
bpmeds := last of (field_list where field_list.DataItemName = "MI Yes No2" );
IodineAllergyCB := last of (field_list where field_list.DataItemName = "MI Yes No3" );
orderrole := orderroletype matches pattern "%Physician%";
OnMetformin := last of (field_list where field_list.DataItemName = "MI Metformin Med");
// IodineAllergyCB := last of (field_list where field_list.DataItemName = "MI Yes No3");
// DiabeticPatient := last of (field_list where field_list.DataItemName = "MI Yes No");
IodineReaction := last of (field_list where field_list.DataItemName = "MI Iodine Reaction");
DiabeticPatient_value := DiabeticPatient.value;
ReactionList := ("Unknown", "Anaphylaxis", "Rash", "Hives", "Itch", "Swelling", "Shortness of Breath");
OSMLM := last of (field_list where field_list.DataItemName = "MLM_From Order Set");
iodinealerthistory := last of (field_list where field_list.DataItemName = "MI_Iodine_Allergy_Alert_CPOE" );
useridcode := read last {" Select idcode from cv3user where guid = " || SQL(user_guid)};
fire_on_User := ("rspence","jmwright","tspicuzza", "tspicuzzatest","deiler","lhancher","gfino",
"dmiklavic", "dwarnick","dmiklavichis","chughes","mvennero","wbell","cdeluca",
"gconnolly","otraynor","jlaw");
// 06.03.2008 DW Removed the calling event = form open statement so the mlm logic can be invoked from a grid
// If CallingEvent="FormOpen"
// then
// Lab Priority Code Section.************************************************************************************
DisplayNewScheduled := first of (field_list.Value
where field_list.DataItemName = "LAB_CB_Alternate Priorities");
if (DisplayNewScheduled) then
Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
(this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
endif;
/****************************************************************************************************************/
// DW 01.13.2009 code to carry forward the pregnancy and lmp values into other ordersets within a session
If (CallingEvent = "FormOpen" or (CallingEvent = "Fieldchange" and CallingField = "MLM_From Order Set"))
and local_session.has_received_order_worksheet_message <> FALSE then
Pregnancy_History.value := local_session.SessionPregnancyValue;
LMP_Field.value := local_session.SessionLMPValue;
endif;
requesting_user_name := read last { "Select displayname from CV3User where guid = " || SQL(requesting_user_guid) };
if requesting_user_name = non_staff_requester then
Order_md_field.control_visible := true;
Order_md_field.control_mandatory := true;
else
Order_md_field.control_visible := false;
Order_md_field.control_mandatory := false;
endif;
if exist client_info_obj
then
(birthdate, birth_year, patient_gender ):= read last
{ClientInfo: birthdate, BirthYearNum, GenderTypeIntlCode REFERENCING client_info_obj};
endif;
if exist birthdate and birth_year > 0 and birthdate is time
then
patient_age:= (NOW - birthdate) / (1 year);
if (patient_age <= lower_age_limit or patient_age >= upper_age_limit and patient_gender = "F") or (patient_gender = "M")
then
PatientAbleToBePreganant := False;
Pregnancy_History.control_read_only := True;
Pregnancy_History.control_mandatory := False;
LMP_Field.control_read_only := True;
LMP_Field.control_mandatory := False;
else
PatientAbleToBePreganant := True;
endif;
endif;
If CallingEvent= "FormOpen" or (CallingEvent = "Fieldchange" and CallingField = "MLM_From Order Set") then // Added TMS 5.15.2012
// Auto-Fill Pregnancy Section (CSR# 32185)
if PatientAbleToBePreganant = True
then
// Populate the Pregnancy field if the session object hasn{{{SINGLE-QUOTE}}}t already done so (the session object wins)
if Pregnancy_History.value is not null
then
PregData := " A response of {{{SINGLE-QUOTE}}}" || Pregnancy_History.value || "{{{SINGLE-QUOTE}}} was carried forward from another order for this patient.";
else
// Retrieve Pregnancy Test Results
(Result) := read last
{ " select ov.value "
|| " from CV3BasicObservationView ov with (nolock) "
|| " where ov.ResultItemCodingStandard = {{{SINGLE-QUOTE}}}lab{{{SINGLE-QUOTE}}} and ov.ItemName = {{{SINGLE-QUOTE}}}hCG Pregnancy{{{SINGLE-QUOTE}}} "
|| " and ov.clientguid = " || SQL (ClientGuid) || " and ov.chartguid = " || SQL (chartguid) || " and ov.clientvisitguid = " || SQL (clientvisitguid) || " "
|| " order by ov.value "
};
// Retrieve Pregnancy Charting on Patient Profile
(ProileCharting) := read last
{ " select fsl.value "
|| " from CV3ClientDocument cd (nolock) "
|| " join CV3ClientDocDetail cdd (nolock) on (cdd.ClientDocumentGUID = cd.GUID and cdd.ClientGUID = " || SQL (ClientGuid) || " and cdd.active = 1) "
|| " join CV3ObservationDocument od (nolock) ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3ObsCatalogMasterItem ocmi (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " and ocmi.userdictionarycode = {{{SINGLE-QUOTE}}}SCH_PRO fem repro pg yn{{{SINGLE-QUOTE}}} "
|| " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || SQL (ClientGuid) || " ) and fsl.active = 1 "
|| " where cd.clientguid = " || SQL (ClientGuid) || " and cd.chartguid = " || SQL (chartguid) || " "
|| " and cd.documentname like {{{SINGLE-QUOTE}}}%patient profile%{{{SINGLE-QUOTE}}} and cd.iscanceled = 0 "
|| " order by fsl.createdwhen "
};
// Retrieve Pregnancy Charting Point of Care Pregnancy Test charted on the ED VS Flowsheet)
(POCCharting) := read last
{ " select fsl.value "
|| " from CV3ClientDocument cd (nolock) "
|| " join CV3ClientDocDetail cdd (nolock) on (cdd.ClientDocumentGUID = cd.GUID and cdd.ClientGUID = " || SQL (ClientGuid) || " and cdd.active = 1) "
|| " join CV3ObservationDocument od (nolock) ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3ObsCatalogMasterItem ocmi (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " and ocmi.userdictionarycode = {{{SINGLE-QUOTE}}}sch_edvitalsign_bedsideHCG{{{SINGLE-QUOTE}}} "
|| " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || SQL (ClientGuid) || " ) and fsl.active = 1 "
|| " where cd.clientguid = " || SQL (ClientGuid) || " and cd.chartguid = " || SQL (chartguid) || " "
|| " and cd.DocumentName = {{{SINGLE-QUOTE}}}1. Vital Signs - ED{{{SINGLE-QUOTE}}} and cd.iscanceled = 0 "
|| " order by fsl.createdwhen "
};
// If at least one data element indicates not pregnant, file "no" in the "is pregant" question.
// For safety, override this with a "yes", if at least one element indicates pregnant.
// If no data is filed regarding pregnancy, search the past 9 months of visits.
if Result = "Neg" or ProileCharting = "No" or ProileCharting = "Not Applicable" or POCCharting is "Neg" then Pregnant := "No";
NoPregvisit := "Pregnancy Information was found in this visit. \n";
WhoDecicded := " was based on SCM information ";
endif;
if Result = "POS" or ProileCharting = "Yes" or POCCharting = "POSITIVE" then Pregnant := "Yes";
NoPregvisit := "Pregnancy Information was found in this visit. \n";
WhoDecicded:= " was based on SCM information ";
endif;
if Result is null and ProileCharting is null and POCCharting is null
then
Pregnant := "Unknown";
NoPregvisit := "No Pregnancy Information was found in this visit. \n";
// Retrieve 9 months of Pregnancy Test Results (all visits)
(Result_9months, Result_9monthsDate) := read last
{ " select ov.value, convert(char(11), ov.createdwhen,1) "
|| " from CV3BasicObservationView ov with (nolock) "
|| " where ov.ResultItemCodingStandard = {{{SINGLE-QUOTE}}}lab{{{SINGLE-QUOTE}}} and ov.ItemName = {{{SINGLE-QUOTE}}}hCG Pregnancy{{{SINGLE-QUOTE}}} "
|| " and ov.clientguid = " || SQL (ClientGuid) || " and ov.createdWhen > getdate () -270 "
|| " order by ov.createdwhen "
};
// Retrieve 9 months of Pregnancy Charting on Patient Profile
(ProileCharting_9months,ProileCharting_9monthsDate) := read last
{ " select fsl.value, convert(char(11), fsl.createdwhen,1) "
|| " from CV3ClientDocument cd (nolock) "
|| " join CV3ClientDocDetail cdd (nolock) on (cdd.ClientDocumentGUID = cd.GUID and cdd.ClientGUID = " || SQL (ClientGuid) || " and cdd.active = 1) "
|| " join CV3ObservationDocument od (nolock) ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3ObsCatalogMasterItem ocmi (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " and ocmi.userdictionarycode = {{{SINGLE-QUOTE}}}SCH_PRO fem repro pg yn{{{SINGLE-QUOTE}}} "
|| " join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || SQL (ClientGuid) || " )"
|| " and fsl.active = 1 and fsl.createdWhen > getdate () -270 "
|| " where cd.clientguid = " || SQL (ClientGuid) || " "
|| " and cd.documentname like {{{SINGLE-QUOTE}}}%patient profile%{{{SINGLE-QUOTE}}} and cd.iscanceled = 0 "
|| " order by fsl.createdwhen "
};
// Retrieve 9 months of Pregnancy Charting Point of Care Pregnancy Test charted on the ED VS Flowsheet)
(POCCharting_9months,POCCharting_9monthsDate) := read last
{ " select fsl.value, convert(char(11), fsl.createdwhen,1) "
|| " from CV3ClientDocument cd (nolock) "
|| " join CV3ClientDocDetail cdd (nolock) on (cdd.ClientDocumentGUID = cd.GUID and cdd.ClientGUID = " || SQL (ClientGuid) || " and cdd.active = 1) "
|| " join CV3ObservationDocument od (nolock) ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3ObsCatalogMasterItem ocmi (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " and ocmi.userdictionarycode = {{{SINGLE-QUOTE}}}sch_edvitalsign_bedsideHCG{{{SINGLE-QUOTE}}} "
|| " join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || SQL (ClientGuid) || " )"
|| " and fsl.active = 1 and fsl.createdWhen > getdate () -270 "
|| " where cd.clientguid = " || SQL (ClientGuid) || " "
|| " and cd.DocumentName = {{{SINGLE-QUOTE}}}1. Vital Signs - ED{{{SINGLE-QUOTE}}} and cd.iscanceled = 0 "
|| " order by fsl.createdwhen "
};
// If something is found in a past visit, display it in a dialog box. The will select current status.
if Result_9months = "POS" or ProileCharting_9months = "YES" or POCCharting_9months = "POSITIVE" then
Evidence := " ";
If Result_9months is not null then
Evidence := Evidence || " \n Positive HCG Pregnancy test results were filed on " || Result_9monthsDate ;
endif;
If ProileCharting_9months is not null then
Evidence := Evidence || " \n\n Pregnancy was documented in the Patient Profile on " || ProileCharting_9monthsDate;
endif;
If POCCharting_9months is not null then
Evidence := Evidence || " \n\n Positive ED Bedside HCG results were filed on " || POCCharting_9monthsDate;
endif;
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n Information was found in SCM indicating that the patient may have been pregnant in the past 9 months. "||
"\n\n\n Information Found " ||
" \n _________________________________ " ||
"\n" || Evidence ||
" \n\n\n\n Please verify the patient{{{SINGLE-QUOTE}}}s pregnacy status " ||
" \n _________________________________ " ||
"\n\n Select {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} if she is currently pregnant " ||
"\n\n Select {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} if she is not currently pregnant " ||
"\n\n Select {{{SINGLE-QUOTE}}}Cancel{{{SINGLE-QUOTE}}} if her status is unknown " || "\n "
,"Pregnancy Information Found on a Past Visit ", "YesNoCancel" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
If (dlg_result as string) = "Yes" then Pregnant := "Yes"; endif;
If (dlg_result as string) = "No" then Pregnant := "No"; endif;
If (dlg_result as string) = "Cancel" then Pregnant := "Unknown"; endif;
WhoDecicded:= " was decided by the user";
else;
Pregnant := "Unknown";
WhoDecicded:= " was decided because no SCM information was found indicating pregnancy";
endif; // Has something has been found in the past 9 months?
endif; // Has something been found in the current visit?
Pregnancy_History.value := Pregnant;
// Gather the decision data (Used for MLM testing)
PregData := " " || NOW || " \n\n";
if NoPregvisit is not null then PregData := PregData || NoPregvisit; endif;
PregData := PregData
|| " \n hCG Result this visit : {{{SINGLE-QUOTE}}}" || Result || "{{{SINGLE-QUOTE}}}. "
|| " \n Profile charting this visit : {{{SINGLE-QUOTE}}}" || ProileCharting || "{{{SINGLE-QUOTE}}}. "
|| " \n ED hCG POC charting this visit : {{{SINGLE-QUOTE}}}" || POCCharting || "{{{SINGLE-QUOTE}}}. \n"
|| " \n Past hCG Result was found : {{{SINGLE-QUOTE}}}" || Result_9months || "{{{SINGLE-QUOTE}}} on " || Result_9monthsDate || ". "
|| " \n Past Profile charting was found : {{{SINGLE-QUOTE}}}" || ProileCharting_9months || "{{{SINGLE-QUOTE}}} on " || ProileCharting_9monthsDate || ". "
|| " \n Past ED hCG POC charting was found : {{{SINGLE-QUOTE}}}" || POCCharting_9months || "{{{SINGLE-QUOTE}}} on " || POCCharting_9monthsDate || ". ";
PregData := PregData || " \n\n A pregnancy response of {{{SINGLE-QUOTE}}}" || Pregnant || "{{{SINGLE-QUOTE}}}" || WhoDecicded || ".";
endif; // Something was found in the session object
// Display the decision data in a message box (Used for MLM testing)
// dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n" || PregData,"The Evidence", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
endif; // PatientAbleToBePreganant
// Obtain health issues pertaining to diabetes
/* Replaced with ICD10 project
(diabeteshealthissue) := read
{ "select distinct hid.shortname, chi.code, chi.typecode, hid.typecode "
|| "from cv3healthissuedeclaration hid with (nolock) "
|| "join cv3codedhealthissue chi on chi.Guid = hid.codedhealthissueguid "
|| "where hid.clientguid = " || ClientGuid || " and hid.active = 1 and hid.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| "and chi.typecode in ({{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt-Stated Hx{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt Stated HX{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}AMB Med History{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}) "
|| "and (hid.text like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} or hid.shortname like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} )"|| " and chi.code not in ({{{SINGLE-QUOTE}}}250.50{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}253.2{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}253.5{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}352.3{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}354{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}362.29{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}588.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.01{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.03{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.04{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}648.80{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.81{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.82{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.83{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.84{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.90{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}775.00{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}775.10{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V12.2{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V18.0{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V19.8{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V49.89{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}V77.1{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V84.89{{{SINGLE-QUOTE}}})"
|| " and (hid.description not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}} or hid.shortname not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}}) "
};
*/
ProblemList := "({{{SINGLE-QUOTE}}}250.50{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}253.2{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}253.5{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}352.3{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}354{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}362.29{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}588.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.01{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.03{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.04{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.80{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.81{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.82{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.83{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.84{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.90{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}775.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}775.10{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V12.2{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V18.0{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V19.8{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V49.89{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V77.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V84.89{{{SINGLE-QUOTE}}})";
(diabeteshealthissue) := read
{ "select distinct hid.shortname, chi.code, chi.typecode, hid.typecode "
|| "from cv3healthissuedeclaration hid with (nolock) "
|| "join cv3codedhealthissue chi on chi.Guid = hid.codedhealthissueguid "
|| "where hid.clientguid = " || ClientGuid || " and hid.active = 1 and hid.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| "and chi.typecode in ({{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt-Stated Hx{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt Stated HX{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}AMB Med History{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}) "
|| "and (hid.text like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} or hid.shortname like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} )"
|| "and "
|| "( "
|| "(hid.ICD9Code is null and chi.code not in " || ProblemList || " ) "
|| "or "
|| "(hid.ICD9Code is not null and hid.ICD9Code not in " || ProblemList || " ) "
|| ") "
|| " and (hid.description not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}} or hid.shortname not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}}) "
};
diabeteshealthissue_found := count(diabeteshealthissue) As Number;
// Obtain Coded Allergen Guids
(AllergenGuids) := read
{ " select guid from cv3allergen where Code like {{{SINGLE-QUOTE}}}%Iodine%{{{SINGLE-QUOTE}}} or Code like {{{SINGLE-QUOTE}}}%iodide%{{{SINGLE-QUOTE}}} or Code like {{{SINGLE-QUOTE}}}%iodinated%{{{SINGLE-QUOTE}}}"};
// Retrieve coded allergies to Iodine
(IodineAllergy, Reaction) := read last
{ " Select Status, SvrtyLevelDisplay from CV3AllergyDeclaration "
|| " where ((clientguid = " || SQL(clientguid) || ") and "
|| " (AllergenGUID in ( " ||SQL(allergenguids) || ") and Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}})) "
};
If IodineAllergy is not Null then IodineBox := "True"; else IodineBox := "False"; endif;
If IodineBox = "True"
then IodineAllergyCB.value := "Yes";
else IodineAllergyCB.value := "Unknown";
endif;
If Reaction is not Null then IodineReaction.value := Reaction; endif;
// If Reaction in ReactionList then IodineReaction.value := Reaction; endif;
// Retrieve Metformin Orders (as identified by class type) charted as given.
(Medgiven, Medname) := read last
{ " select oto.performedfromdtm, o.name "
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " join CV3CatalogClassTypevalue ctv on ctv.CatalogMasterGUID = ocmi.GUID "
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|| " join CV3ClassType ct on ct.GUID = ctv.ClassTypeGUID "
|| " join cv3ordertask as ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid "
|| " join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid "
|| " and oto.ordertaskguid = ot.guid "
|| " where o.ClientGUID = " || SQL (ClientGuid)
|| " and oto.taskstatuscode ={{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
|| " and ct.Code = {{{SINGLE-QUOTE}}}PRX_MetforminMed{{{SINGLE-QUOTE}}} "
|| " order by oto.PerformedFromDtm "
};
// If last given task within 48 hours then value emar flag to yes
if (Medgiven as time) is within the past 48 hours then GetEmar := "Yes"; else GetEmar := "No"; endif;
/* Retrieve admit date and time. If patient admitted less than 48 hours check medication history for metformin meds
(AdmitDate) := read last
{ " select admitdtm from CV3ClientVisit "
|| " where guid = " || SQL(clientvisitguid)
|| " and clientguid = " || SQL(clientguid)
};
If (AdmitDate as time) is within the past 48 hours then GetHx := "Yes"; else GetHx := "No"; endif;
If GetHx = "Yes" then
(MetforminHx) := read last
{ " select cp.drugname from SXAAMBClientPrescription cp "
|| " join CV3Client c on c.guid = " || SQL(clientguid)
|| " where cp.genericnameid in (2598, 2888, 2251, 2705, 2474, 1481, 2152, 2254)"
|| " and cp.statustype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
|| " and cp.clientguid = " || SQL(clientguid)
};
endif;
*/
// Value Metformin drug name and diabetic meds flag. If both history and current metformin found use current.
If GetEmar = "No" then
DiabeticMeds := "False";
endif;
If GetEmar = "Yes" then
DiabeticMeds := "True";
OnMetformin.value := Medname;
endif;
// Set value of diabetic patient question if patient has health issue or diabetic meds are found.
If (DiabeticMeds = "True" or diabeteshealthissue_found >0)
then DiabeticPatient.value := "Yes";
else DiabeticPatient.value := "Unknown";
endif;
Endif; // If CallingEvent="FormOpen
// End Added TMS 5.15.2012
//Mark by RS
IsolationCol := read last
{ " Select top 1 Columnname"
|| " from cv3EnterpriseColumnData "
|| " where dataitemcode = " || SQL({{{SINGLE-QUOTE}}}Isolation{{{SINGLE-QUOTE}}})};
If exists(IsolationCol)
then
// now get the visit{{{SINGLE-QUOTE}}}s isolation status
Isolation := read last
{ " Select " || IsolationCol
|| " from CV3EnterpriseVisitData "
|| " where visitguid = " || SQL(ClientVisitGuid)};
If (Isolation Is Null)
then
Iso_field.Value :="";
else
Iso_field.Value := Isolation;
endif;
endif;
// endif;
// DW CSR# 32185 05.05.2014 disable this logic also....post activation change
/*
if orderrole = true
then
if (ctabdpelviscontrast.value in ("NO IV Contrast","PO Contrast Only")) or
(ctothercontrast.value in ("NO IV Contrast","PO Contrast Only"))
then DiabeticPatient.control_mandatory:= false;
DiabeticPatient.control_read_only:= true;
bpmeds.control_mandatory:= false;
bpmeds.control_read_only:= true;
IodineAllergyCB.control_mandatory:= false;
IodineAllergyCB.control_read_only:= true;
else DiabeticPatient.control_mandatory:= true;
DiabeticPatient.control_read_only:= false;
bpmeds.control_mandatory:= true;
bpmeds.control_read_only:= false;
IodineAllergyCB.control_mandatory:= true;
IodineAllergyCB.control_read_only:= false;
endif;
endif;
*/
// DW 01.13.2009 code to carry forward the pregnancy and lmp values into other ordersets within a session
If CallingEvent="FormClose"
then
local_session.SessionPregnancyValue := Pregnancy_History.value;
local_session.SessionLMPValue := LMP_Field.value;
if local_session.has_received_order_worksheet_message = FALSE then
local_session.has_received_order_worksheet_message := TRUE; else; endif;
endif;
// section for displaying a warning box when patient is allergic to iodine - radiopaque and contrast is selected
If CallingField in ("MI_VO_MI CT Other Contrast" , "MI_VO_MI CT Abd Pelvis Contrast" ) and useridcode in fire_on_user then
(allergen,severity,confidence) := read last
{ " Select a.code, ad.svrtyleveldisplay, ad.conflevelcode "
|| " from cv3allergydeclaration ad with (nolock) "
|| " join cv3allergen a with (nolock) on a.guid = ad.allergenguid "
|| " where a.code like {{{SINGLE-QUOTE}}}iodine - radiopaque{{{SINGLE-QUOTE}}} and ad.status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} and ad.clientguid = " || SQL(ClientGuid)};
if exist confidence then p_confidence:= confidence; else p_confidence:= ""; endif;
if exist severity then p_severity:= severity; else p_severity:= ""; endif;
if exists allergen and (ctothercontrast.value = "IV Contrast" or ctabdpelviscontrast.value in ("IV/PO Contrast" , "No IV Contrast / PO Contrast Only" , "No PO Contrast / IV Contrast Only"))
then
this_communication.Message := "\n\n ALLERGY ALERT "
|| "\n\n\nPatient is alergic to " || allergen || " which is contained in the " || ordername || " order."
|| "\n\n\nOrder/Additive Name : " || ordername
|| "\n\nReaction : " || p_severity
|| "\n\nConfidence Level : " || p_confidence || "\n\n "
; this_communication.MessageType := "Informational";
iodinealerthistory.value := "An allergy to " || allergen || " with a " || p_severity || " reaction was detected and reported at the time of order entry (confidence level : " || p_confidence || " )" ;
else
iodinealerthistory.value := " ";
endif; // if contrast solution is requested
endif; // if form close
;;
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:

View File

@@ -0,0 +1,465 @@
maintenance:
title: Ordering: Carry forward Medical Imaging Indications on an Order Set;;
mlmname: FORM_Medical_Imaging_Indications_for_OS;;
arden: version 2;;
version: 4.50;;
institution: St Clair Medical Imaging Indications;;
author: Don Warnick Eclipsys Corp;;
specialist: ;;
date: 2009-03-19;;
validation: testing;;
library:
purpose: Populate the Medical Imaging indications of all tests on an Order Set.
;;
explanation: This MLM was written ED Order Sets, but can be used on others as well.
Change history
03.19.2009 DW Created
06.04.2009 DW Altered to require pregnancy question be anwered only if a non-Ultrasound MI order is selected
11.24.2010 DW Altered to enter escort order if MI item with the escort class has been selected
06.20.2012 TMS Added logic under form open to retrieve diabetic health issues and iodine allergies to autopopulate
questions on order set form when found. CSR 22904
06.26.2012 TMS Removed query to home meds CSR 22904
08.28.2015 DW CSR# 23359 - ICD10
04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
07.07.2016 DW HD# 2106742 Override prenancy question to a "no" if this is a male
11.13.2017 TMS CSR 35723 Add call to Diabetic Management Check MLM (Form_Set_Diabetic_mgt_Check) when user in Transitional Order Sets.
11.21.2018 DW HD# 2407141 - The pregnancy (Yes/No) value entered on an ED OS, is not carried forward to the ED Common Diagnostic (and Radiology) Orders OS.
;;
keywords: Called MLMs, Medical Imaging, Indications
;;
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;
local_session := cds_session.local;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
comm_obj := this_communication.primaryobj;
CallingEvent := this_communication.CallingEvent;
CallingField :=this_communication.CallingFieldName;
ClientVisitGuid := this_communication.ClientVisitGuid;
ClientGuid := this_communication.ClientGuid;
// Lab Priority Code Section.************************************************************************************
If comm_obj.OrderSetName Not In( "Observation Common Orders", "Admission Orders - Chest Pain")Then //this_form.Name ="CPOE_OBS_CommOrder" And
DisplayNewScheduled := first of (field_list.Value
where field_list.DataItemName = "LAB_CB_Alternate Priorities");
if (DisplayNewScheduled) then
Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
(this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
endif;
endif;
/****************************************************************************************************************/
//Initialize MLM pointers:
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
indications1 := last of (field_list where field_list.DataItemName = "ED_MI_ClinInd1" and field_List.Control_MultiFieldOccNum = 1 );
indications2 := last of (field_list where field_list.DataItemName = "ED_MI_ClinInd2" and field_List.Control_MultiFieldOccNum = 1 );
indications1val := indications1.value;
indications2val := indications2.value;
ivyesno1 := last of (field_list where field_list.DataItemName = "MI Yes No" and field_List.Control_MultiFieldOccNum = 1 );
ivyesno2 := last of (field_list where field_list.DataItemName = "MI Yes No2" and field_List.Control_MultiFieldOccNum = 1 );
ivyesno3 := last of (field_list where field_list.DataItemName = "MI Yes No3" and field_List.Control_MultiFieldOccNum = 1 );
ivyesno1_value := ivyesno1.value;
// Determine pregnancy possibility
PregnancyHistory:= last of (field_list where field_list.DataItemName = "MI_LV_MI Yes No Pregnacy" and field_List.Control_MultiFieldOccNum = 1 );
lower_age_limit := 9;
upper_age_limit := 56;
if exist client_info_obj then (birthdate, birth_year, patient_gender ):= read last{ClientInfo: birthdate, BirthYearNum, GenderTypeIntlCode REFERENCING client_info_obj}; endif;
if exist birthdate and birth_year > 0 and birthdate is time then patient_age:= (NOW - birthdate) / (1 year); endif;
if (patient_age <= lower_age_limit or patient_age >= upper_age_limit and patient_gender = "F") or (patient_gender = "M") then NotAMom := "true"; endif;
// Carry-forward code using the session object
if CallingEvent = "FormOpen" then
If local_session.has_received_order_worksheet_message <> FALSE then
PregnancyHistory.value := local_session.SessionPregnancyValue;
indications1.value := local_session.SessionIndications1;
indications2.value := local_session.SessionIndications2;
//this_communication.Message := " open " || local_session.SessionPregnancyValue ; this_communication.MessageType := "Informational";
endif;
// Override to No if this is a male
If patient_gender = "M" then
PregnancyHistory.value := " ";
PregnancyHistory.control_read_only := true;
endif;
//////////////// add tms
// Obtain Coded Allergen Guids
(AllergenGuids) := read
{ " select guid from cv3allergen where Code like {{{SINGLE-QUOTE}}}%Iodine%{{{SINGLE-QUOTE}}} or Code like {{{SINGLE-QUOTE}}}%iodide%{{{SINGLE-QUOTE}}} or Code like {{{SINGLE-QUOTE}}}%iodinated%{{{SINGLE-QUOTE}}}"};
// Retrieve coded allergies to Iodine
(IodineAllergy, Reaction) := read last
{ " Select Status, SvrtyLevelDisplay from CV3AllergyDeclaration "
|| " where ((clientguid = " || SQL(clientguid) || ") and "
|| " (AllergenGUID in ( " ||SQL(allergenguids) || ") and Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}})) "
};
If IodineAllergy is not Null then IodineBox := "True"; else IodineBox := "False"; endif;
If IodineBox = "True" then Ivyesno3.value := "Yes"; endif;
// Obtain health issues pertaining to diabetes
/* Replaced with ICD10 project
(diabeteshealthissue) := read
{"select distinct hid.shortname, chi.code, chi.typecode, hid.typecode "
||"from cv3healthissuedeclaration hid with (nolock) "
||"join cv3codedhealthissue chi on chi.Guid = hid.codedhealthissueguid "
|| "where hid.clientguid = " || ClientGuid || " and hid.active = 1 and hid.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| "and chi.typecode in ({{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt-Stated Hx{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt Stated HX{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}AMB Med History{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}) "
|| "and (hid.text like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} or hid.shortname like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} )"|| " and chi.code not in ({{{SINGLE-QUOTE}}}250.50{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}253.2{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}253.5{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}352.3{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}354{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}362.29{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}588.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.01{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.03{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.04{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}648.80{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.81{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.82{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.83{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.84{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.90{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}775.00{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}775.10{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V12.2{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V18.0{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V19.8{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V49.89{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}V77.1{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V84.89{{{SINGLE-QUOTE}}})"
|| " and (hid.description not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}} or hid.shortname not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}}) "
};
*/
ProblemList := "({{{SINGLE-QUOTE}}}250.50{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}253.2{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}253.5{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}352.3{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}354{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}362.29{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}588.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.01{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.03{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.04{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.80{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.81{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.82{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.83{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.84{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.90{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}775.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}775.10{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V12.2{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V18.0{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V19.8{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V49.89{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V77.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V84.89{{{SINGLE-QUOTE}}})";
(diabeteshealthissue) := read
{ "select distinct hid.shortname, chi.code, chi.typecode, hid.typecode "
|| "from cv3healthissuedeclaration hid with (nolock) "
|| "join cv3codedhealthissue chi on chi.Guid = hid.codedhealthissueguid "
|| "where hid.clientguid = " || ClientGuid || " and hid.active = 1 and hid.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| "and chi.typecode in ({{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt-Stated Hx{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt Stated HX{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}AMB Med History{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}) "
|| "and (hid.text like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} or hid.shortname like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} )"
|| "and "
|| "( "
|| "(hid.ICD9Code is null and chi.code not in " || ProblemList || " ) "
|| "or "
|| "(hid.ICD9Code is not null and hid.ICD9Code not in " || ProblemList || " ) "
|| ") "
|| "and (hid.description not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}} or hid.shortname not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}}) "
};
/*
// Retrieve Metformin Orders (as identified by class type) charted as given.
(Medgiven, Medname) := read last
{ " select oto.performedfromdtm, o.name "
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " join CV3CatalogClassTypevalue ctv on ctv.CatalogMasterGUID = ocmi.GUID "
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|| " join CV3ClassType ct on ct.GUID = ctv.ClassTypeGUID "
|| " join cv3ordertask as ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid "
|| " join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid "
|| " and oto.ordertaskguid = ot.guid "
|| " where o.ClientGUID = " || SQL (ClientGuid)
|| " and oto.taskstatuscode ={{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
|| " and ct.Code = {{{SINGLE-QUOTE}}}PRX_MetforminMed{{{SINGLE-QUOTE}}} "
|| " order by oto.PerformedFromDtm "
};
// If last given task within 48 hours then value emar flag to yes
if (Medgiven as time) is within the past 48 hours then GetEmar := "Yes"; else GetEmar := "No"; endif;
// Retrieve admit date and time. If patient admitted less than 48 hours check medication history for metformin meds
(AdmitDate) := read last
{ " select admitdtm from CV3ClientVisit "
|| " where guid = " || SQL(clientvisitguid)
|| " and clientguid = " || SQL(clientguid)
};
If (AdmitDate as time) is within the past 48 hours then GetHx := "Yes"; else GetHx := "No"; endif;
If GetHx = "Yes" then
(MetforminHx) := read last
{ " select cp.drugname from SXAAMBClientPrescription cp "
|| " join CV3Client c on c.guid = " || SQL(clientguid)
|| " where cp.genericnameid in (2598, 2888, 2251, 2705, 2474, 1481, 2152, 2254)"
|| " and cp.statustype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
|| " and cp.clientguid = " || SQL(clientguid)
};
endif;
// Value Metformin drug name and diabetic meds flag. If both history and current metformin found use current.
If GetEmar = "No" then
DiabeticMeds := "False";
endif;
If GetEmar = "Yes" then
DiabeticMeds := "True";
endif;
*/
diabeteshealthissue_found := count(diabeteshealthissue) As Number;
// Set value of diabetic patient question if patient has health issue
If diabeteshealthissue_found >0 then ivyesno1.value := "Yes"; endif;
elseif CallingEvent = "FormClose" then
Escort_MLM := mlm {{{SINGLE-QUOTE}}}Form_Func_Escort_Order{{{SINGLE-QUOTE}}};
EscortQuestion := call Escort_MLM with this_form,this_communication;
If comm_obj.OrderSetName matches pattern "Transition Orders -%" then
Diabetic_Order_Check := mlm {{{SINGLE-QUOTE}}}FORM_SET_Diabetic_Mgt_Check{{{SINGLE-QUOTE}}};
(this_communication, this_form) := call Diabetic_Order_Check with this_communication, this_form, client_info_obj;
// Diabetic_Insulin_Cov:= mlm {{{SINGLE-QUOTE}}}FORM_SET_Diabetic_Insulin_Coverage{{{SINGLE-QUOTE}}};
// (this_communication, this_form) := call Diabetic_Insulin_Cov with this_communication, this_form, client_info_obj;
endif;
Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
(this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
if PregnancyHistory.value is null then PregnancyHistory.value := local_session.SessionPregnancyValue; endif; // carry forward from form to os
//PregnancyHistory.value := local_session.SessionPregnancyValue;
local_session.SessionIndications1:= indications1.value;
local_session.SessionIndications2:= indications2.value;
local_session.SessionPregnancyValue := PregnancyHistory.value;
if local_session.has_received_order_worksheet_message = FALSE then local_session.has_received_order_worksheet_message := TRUE; else; endif;
// this_communication.Message := " close " ; this_communication.MessageType := "Informational";
endif; // calling event = formopen
//////////////////////// Section for making Indication 1 field mandatory if MI exam is selected ///////////
MIConcat := ();
MIOrderGrid := last of (field_list where field_list.DataItemName = "ED_MI_ClinInd1" and field_List.Control_MultiFieldOccNum = 2 );
MIOrderGridval := MIOrderGrid.value;
calc_map_list2 := call str_parse with MIOrderGridval,"|";
for i in 1 seqto count calc_map_list2 do
calc_element_list2 := call str_parse with calc_map_list2 [i], "|";
OccNum := (calc_element_list2[1]) as number;
MIGroup := last of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = OccNum);
MIGroupVal := MIGroup.Value;
MIGroupValIsSel := MIGroupVal.isselected;
MIConcat := MIConcat, MIGroupValIsSel ;
enddo;
MIFound := (true in MIConcat) ;
If MIFound = true
then
// indications1.control_mandatory := True;
if NotAMom = "true" then
PregnancyHistory.control_read_only := True;
PregnancyHistory.control_mandatory := False;
else
PregnancyHistory.control_read_only := False;
PregnancyHistory.control_mandatory := True;
endif;
else
// indications1.control_mandatory := False;
PregnancyHistory.control_mandatory := False;
endif;
//////////////////////// Section for making Indication 1 field mandatory (but Pregnancy unnecssary if Ultrasound exam is selected ///////////
USConcat := ();
USOrderGrid := last of (field_list where field_list.DataItemName = "MLM_US Pregnancy Question" and field_List.Control_MultiFieldOccNum = 1 );
USOrderGridval := USOrderGrid.value;
calc_map_list4 := call str_parse with USOrderGridval,"|";
for i in 1 seqto count calc_map_list4 do
calc_element_list4 := call str_parse with calc_map_list4 [i], "|";
USOccNum := (calc_element_list4[1]) as number;
USGroup := last of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = USOccNum);
USGroupVal := USGroup.Value;
USGroupValIsSel := USGroupVal.isselected;
USConcat := USConcat, USGroupValIsSel ;USOccNum := (calc_element_list4[1]) as number;
enddo;
USFound := (true in USConcat) ;
If (USFound = true or MIFound = true)
then indications1.control_mandatory := True;
else
indications1.control_mandatory := False;
endif;
//////////////////// Section for making 3 fields mandatory if an MI with IV Contrast is ordered ///////
IVConcat := ();
IVOrderGrid := last of (field_list where field_list.DataItemName = "ED_MI_ClinInd2" and field_List.Control_MultiFieldOccNum = 2 );
IVOrderGridval := IVOrderGrid.value;
calc_map_list3 := call str_parse with IVOrderGridval,"|";
for i in 1 seqto count calc_map_list3 do
calc_element_list3 := call str_parse with calc_map_list3 [i], "|";
IVOccNum := (calc_element_list3[1]) as number;
IVGroup := last of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = IVOccNum);
IVGroupVal := IVGroup.Value;
IVGroupValIsSel := IVGroupVal.isselected;
IVConcat := IVConcat, IVGroupValIsSel ;
enddo;
IVFound := (true in IVConcat) ;
If IVFound = true then
ivyesno1.control_mandatory := True;
ivyesno2.control_mandatory := True;
ivyesno3.control_mandatory := True; else
ivyesno1.control_mandatory := False;
ivyesno2.control_mandatory := False;
ivyesno3.control_mandatory := False;
endif;
//////////////////////// Section for populating Indication fields for all tests in the Order Set //////////
prefix:= "MI_MR_VO_OBR31P2_";
// Concatenate the list of Indications fields found in the 3 Freetext fields into a list
indfieldlist1 := last of (field_list where field_list.DataItemName = "ED_MI_ClinIndFreetext1" and field_List.Control_MultiFieldOccNum = 1 );
indfieldlistval1 := indfieldlist1.value;
indfieldlist2 := last of (field_list where field_list.DataItemName = "ED_MI_ClinIndFreetext2" and field_List.Control_MultiFieldOccNum = 1 );
indfieldlistval2 := indfieldlist2.value;
indfieldlist3 := last of (field_list where field_list.DataItemName = "ED_MI_ClinIndFreetext3Active" and field_List.Control_MultiFieldOccNum = 1 );
indfieldlistval3 := indfieldlist3.value;
indfieldlist4 := last of (field_list where field_list.DataItemName = "ED_MI_ClinIndFreetext4" and field_List.Control_MultiFieldOccNum = 1 );
indfieldlistval4 := indfieldlist4.value;
indfieldlistval := indfieldlistval1 || "," || indfieldlistval2 || "," || indfieldlistval3 || "," || indfieldlistval4 ;
calc_map_list := call str_parse with indfieldlistval,","; // "A1|A2,B1|B2" (string) becomes "A1|A2" , "B1|B2" (list) // calc_map_list[1] = "A1|A2"
// Create a SQL Where Clause value of the list of Indications fileds ("prefix+A1","prefix+A2","prefix+B1","prefix+B2" etc..)
SQLWhere := "";
for i in 1 seqto count calc_map_list do
calc_element_SQL := call str_parse with calc_map_list[i], "|";
SQlWhere := SQLWhere || "{{{SINGLE-QUOTE}}}" || prefix || calc_element_SQL[1] || "{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}" || prefix || calc_element_SQL[2] || "{{{SINGLE-QUOTE}}}" ;
if (i <> count calc_map_list) then SQLWhere := SQLWhere || ","; endif;
enddo;
// Create a list of possible dictionary values via SQL search of indications dictionaries found on this form (prefix+A1+value, etc...)
AllMIInd := ();
AllMIInd := read {"select di.code + v.value from cv3dataitem di "
|| " join cv3userdictionary ud on ud.description = di.dictionaryname "
|| " join cv3userdictionaryvalue v on v.userdictionarycode = ud.code "
|| " where di.code in ( " || SQLWhere || ")" };
// Define the indications fields on the Order Set to be populated
for i in 1 seqto count calc_map_list do
calc_element_list := call str_parse with calc_map_list[i], "|";
field1 := prefix || calc_element_list[1] ;
field2 := prefix || calc_element_list[2] ;
indpop1 := last of (field_list where field_list.DataItemName = field1 and field_List.Control_MultiFieldOccNum = 1 );
indpop2 := last of (field_list where field_list.DataItemName = field2 and field_List.Control_MultiFieldOccNum = 1 );
// Concatenate the indication field to be populated with the indication value inputted by user then see if this pair matches the list of possibilities
IndFldPlusUserInd1 := field1 || indications1val ;
IndFldPlusUserInd2 := field2 || indications2val ;
if IndFldPlusUserInd1 in AllMIInd then foundone := true ; else foundone := false; endif;
if IndFldPlusUserInd2 in AllMIInd then foundtwo := true ; else foundtwo := false; endif;
// Both Indications 1 and 2 are found
if foundone = true and foundtwo = true then
indpop1.value := indications1val;
indpop2.value := indications2val;
// Indication 1 found and Indication 2 not found
elseif foundone = true and foundtwo = false then
indpop1.value := indications1val;
indpop2.value := " ";
// Indication 1 not found and Indication 2 found
elseif foundone = false and foundtwo = true then
indpop1.value := indications2val;
indpop2.value := " ";
// Both indications 1 and 2 not found (default)
else indpop1.value := " ";
indpop2.value := " ";
endif; // indications 1 and 2 found or not
enddo; // for i in 1 seqto count calc_map_list do
;;
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:

View File

@@ -0,0 +1,147 @@
maintenance:
title: Generic Medication Weight Calculation;;
mlmname: Form_Medication_calc;;
arden: version 2;;
version: 16.3;;
institution: St. Clair Hospital;;
author: Teresa M. Spicuzza ;;
specialist: Eclipsys Corporation;;
date: 2018-01-04;;
validation: testing;;
library:
purpose: Calculate Medications based upon the order name and multiplier entered by user.
;;
explanation:
Change history
04.09.2018 TMS CSR 35320 - Created for PACU Pedatric Medication Dose Calculation
;;
keywords:
Medication, Calculation;
;;
knowledge:
type: data-driven;;
data:
/********************Make Changes To Spelling And Flags In This Section*********************/
/*************************************************************************************************/
// 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;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
comm_obj := this_communication.primaryobj;
OrderName := comm_obj.Name;
OrderSetName := comm_obj.OrderSetName;
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Get patient weight
comb_ht_wt_field := first of (field_list where field_list.DataItemName = "CombinedMeasurements");
If exists comb_ht_wt_field then
comb_ht_wt_val := comb_ht_wt_field.value;
wt := comb_ht_wt_val.weight;
weightvalue := (wt as number);
endif;
OrderedDose := first of (field_list where field_list.DataItemName = "DosageLow");
OrderedUnits := first of (field_list where field_list.DataItemName = "UOM");
Instructions := first of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
DosePerKg := first of (field_list where field_list.DataItemName = "PRX_DosePerKg");
If exists OrderedDose then OrderedDoseValue := OrderedDose.Value; endif;
If exists OrderedUnits then OrderedUnitsValue := OrderedUnits.Value; endif;
If exists DosePerKg then DosePerKgValue := DosePerKg.Value; endif;
If DosePerKg is not null or callingevent = "FieldChange" then
If OrderName = "OxyCODONE Solution" then
If ((DosePerKgValue as number) >= 0.05 and (DosePerKgValue as number) <= 0.15) then
Dose := DosePerKgValue * WeightValue;
DoseFactor := ((Dose as number) - 0.25) * 10;
rnd_dose := (int((doseFactor + 2.5)/5) * 5) /10;
if rnd_dose > 5 then
OrderedDose.value := 5;
else
Ordereddose.value := rnd_dose;
endif;
else
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Recommended dose is 0.05 mg/kg to 0.15 mg/kg.\n Maximum Dose of 5 mg/Dose\n\n Do you wish to change your entry?","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
if((dialogResult as string) = "Yes") then
DosePerKg.Value := "";
else
Dose := DosePerKgValue * WeightValue;
DoseFactor := ((Dose as number) - 0.25) * 10;
rnd_dose := (int((doseFactor + 2.5)/5) * 5) /10;
if rnd_dose > 5 then
OrderedDose.value := 5;
else
Ordereddose.value := rnd_dose;
endif;
endif;
endif;
elseif OrderName = "OxyCODONE 5mg Tab" then
If ((DosePerKgValue as number) >= 0.05 and (DosePerKgValue as number) <= 0.15) then
Dose := DosePerKgValue * WeightValue;
If (Dose as number) >= 1.25 and (Dose as number) < 2.5 then
OrderedDose.value := 1.25;
ElseIf (Dose as number) >= 2.5 and (Dose as number) < 5 then
OrderedDose.value := 2.5;
Else
OrderedDose.value := 5;
endif;
else
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Recommended dose is 0.05 mg/kg to 0.15 mg/kg.\n Maximum Dose of 5 mg/Dose\n\n Do you wish to change your entry?","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
if((dialogResult as string) = "Yes") then
DosePerKg.Value := "";
else
Dose := DosePerKgValue * WeightValue;
If (Dose as number) >= 1.25 and (Dose as number) < 2.5 then
OrderedDose.value := 1.25;
ElseIf (Dose as number) >= 2.5 and (Dose as number) < 5 then
OrderedDose.value := 2.5;
Else
OrderedDose.value := 5;
endif;
endif;
endif;
endif;
endif;
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns two parameters, of types
//communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,168 @@
maintenance:
title: MEDREC_FILLTEMPLATE;;
mlmname: FORM_MEDREC_FILLTEMPLATE;;
arden: version 2;;
version: 4.50;;
institution: SCH;;
author: Robert Spence Ext 7461;;
specialist: ;;
date: 2010-04-30;;
validation: testing;;
library:
purpose: This MLM sets the fields in the order form to the correct data per Med Rec hence correcting child form issue.
;;
explanation: Blah blah blah
;;
keywords: Called MLMs, Form fields, MED REC,OMP
;;
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;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// marker
// using "MoreThanOneMedRec";
// using namespace "MoreThanOneMedRec";
// test:= new net_object {{{SINGLE-QUOTE}}}MoreThanOne{{{SINGLE-QUOTE}}};
// end of marker
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := FALSE;
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Where am I"
// ,"Tester","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"STOP" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}},"Button2" as {{{SINGLE-QUOTE}}}MessageBoxDefaultButton{{{SINGLE-QUOTE}}};
// Note: Dialog result proves that the objects + call will hold up the MLM, exactly what we wanted.
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
prim_obj := this_communication.PrimaryObj;
frm_modify := prim_obj.Modifier;
itemguid := this_communication.ItemID;
if (frm_modify matches pattern "%Med Reconciliation Order%" and prim_obj.IsForDischarge = false)
then
itemguid := this_communication.ItemID;
orderguid:= prim_obj.GUID;
ClientGuid:=this_communication.ClientGUID;
// tryme := CALL test.retrievedata with itemguid as string,clientguid as string;
/* sqlstatement := " select ao.guid,isnull(orox.toorderguid,0),ao.frequencycode from CV3AlternateOrder as ao with (nolock) "
|| " left join cv3orderreconcileorderxref as orox with (nolock) "
|| " on orox.fromorderguid = ao.guid "
|| " where ao.ordercatalogmasteritemguid = " || itemguid
|| " and ao.clientguid = " || ClientGuid
|| " and ao.repflags = 0 "
|| " and orox.toorderguid is null ";
tryme := CALL test.retrievedata with itemguid as string,clientguid as string, sqlstatement as string;
*/
fromguid,toguid,freqcode := read last {" select ao.guid,isnull(orox.toorderguid,0),ao.frequencycode from CV3AlternateOrder as ao with (nolock) "
|| " left join cv3orderreconcileorderxref as orox with (nolock) "
|| " on orox.fromorderguid = ao.guid "
|| " where ao.ordercatalogmasteritemguid = " || sql(itemguid)
|| " and ao.clientguid = " || sql(ClientGuid)
|| " and ao.repflags = 0 "
|| " and orox.toorderguid is null "
};
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Discharge Order? " || prim_obj.IsForDischarge
// ,"Tester","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"STOP" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}},"Button2" as {{{SINGLE-QUOTE}}}MessageBoxDefaultButton{{{SINGLE-QUOTE}}};
if fromguid is not null
then
dosesql, uomsql,routesql := read last{ " select me.dosagelow,me.uom,me.orderroutecode "
|| " from cv3medicationextension as me with (nolock) "
|| " where me.guid = " ||sql(fromguid)
};
rxinstructsupper,rxinstructs := read last {" select upper(value),value from CV3OrderUserData with (nolock)"
|| " WHERE ClientGUID = " || sql(ClientGUID)
|| " and OrderGUID = " || sql(fromguid)
|| " and userdatacode = {{{SINGLE-QUOTE}}}RX Instructions{{{SINGLE-QUOTE}}} "
};
if (rxinstructs is not null) and (rxinstructs <> "") then
if (rxinstructsupper matches pattern "%PRN%") or
(rxinstructsupper matches pattern "%AS NEEDED%") or
// (rxinstructsupper matches pattern "%LAST DOSE TAKEN%") or
// (rxinstructsupper matches pattern "%DOSE UNKNOWN%") or
(rxinstructsupper matches pattern "%FOR AGITATION%") or
(rxinstructsupper matches pattern "%FOR ANXIETY%") or
(rxinstructsupper matches pattern "%FOR CHEST PAIN%") or
(rxinstructsupper matches pattern "%FOR CONSTIPATION%") or
(rxinstructsupper matches pattern "%FOR DIARRHEA%") or
(rxinstructsupper matches pattern "%FOR DIFFICULTY BREATHING%") or
(rxinstructsupper matches pattern "%FOR FEVER%") or
(rxinstructsupper matches pattern "%FOR HEADACHE%") or
(rxinstructsupper matches pattern "%FOR ITCHING%") or
(rxinstructsupper matches pattern "%FOR NAUSEA%") or
(rxinstructsupper matches pattern "%FOR PAIN%") or
(rxinstructsupper matches pattern "%FOR RESTLESSNESS%") or
(rxinstructsupper matches pattern "%FOR SLEEP%") or
(rxinstructsupper matches pattern "%FOR SPASMS%") or
(rxinstructsupper matches pattern "%FOR WHEEZING%")
then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "This order with Rx Instructions: \n\n" || rxinstructs
|| "\n\nHas been identified as a possible PRN order\n\n"
|| "Would you like to mark this order as PRN?"
,"PRN ALERT","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"STOP" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}},"Button1" as {{{SINGLE-QUOTE}}}MessageBoxDefaultButton{{{SINGLE-QUOTE}}};
resulttext := dialogResult as string;
if resulttext = "Yes"
then
IsPRN := first of (field_list where field_list.DataItemName = "IsPRN");
IsPRN.Value := true;
endif;
endif;
endif;
// do test on fields, see if we can hardcode them. remove this logic at stage 2
dose := first of (field_list where field_list.DataItemName = "DosageLow");
regular_freq := last of (field_list where field_list.DataItemName = "FrequencyCode");
regular_freq_value := regular_freq.value;
dose_route := first of (field_list where field_list.DataItemName = "OrderRouteCode");
dose.value := dosesql as number;
regular_freq_value.FrequencySummary := freqcode;
dose_route := routesql;
endif;
endif;
;;
evoke: // No evoke statement
;;
logic:
//oeUnsigned:=CALL test.ShowDialog;
conclude true;
;;
action:
// This MLM returns two parameters, of types communication_type and form_type respectively.
return this_communication, this_form;
;;
end:

View File

@@ -0,0 +1,172 @@
maintenance:
title: Med With Chem Restraint;;
mlmname: FORM_MED_CHEM_RESTRAINT;;
arden: version 2;;
version: 4.50;;
institution: St Clair;;
author: Eclipsys Corp;;
specialist: Mary Jo Goodwin ;;
date: 2006-12-29;;
validation: testing;;
library:
purpose: Display appropriate fields depending on whether med
if for Chemical Restraint or for a Medical Condition
;;
explanation: This MLM is called from the medication form once the user indicates
if med is for {{{SINGLE-QUOTE}}}Chemical Retraint{{{SINGLE-QUOTE}}} or for a {{{SINGLE-QUOTE}}}Medical Condition{{{SINGLE-QUOTE}}}.
If drug is for a Chemical Restraint then the {{{SINGLE-QUOTE}}}Medical Condition{{{SINGLE-QUOTE}}} field is
grayed out, the FrequencyCode field is hidden and a UDDI to enter the
frequency (it is a subset of frequencies from the main list) is displayed.
A second MLM will run when the frequency in the UDDI is selected and
it will copy value to the hidden FrequencyCode field.
If drug is for a Medical Condition then field {{{SINGLE-QUOTE}}}Medical Condition{{{SINGLE-QUOTE}}} will become mandatory.
Change history
04.12.2013 BB CSR# 26711 MLM - Update MLM to include new Orderset Form checkboxes for toggle gray out.
08.09.2013 TMS Commented out lines that make prn reason box hidden and not mandatory. This is controlled
through the FORM_PRN_REASON MLM to accommodate behavioral health mandatory reason for med
orders. CSR 31639
;;
keywords: Called MLMs, Form fields, Chemical Restraint
;;
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*******************/
/***************************************************************************************/
// Initialize error message
error_message:="";
triggerng_field := this_communication.CALLINGFIELDNAME;
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
// Added for Orderset Forms [BB]
oschem_cb := last of (field_list where field_list.DataItemName = "NUR_Chemical Restraint" and field_List.Control_MultiFieldOccNum = 1);
osmed_cb := last of (field_list where field_list.DataItemName = "NUR_Not Chemical Restraint" and field_List.Control_MultiFieldOccNum = 1);
chem_cb := last of (field_list where field_list.DataItemName = "NUR_Chemical Restraint" );
med_cb := last of (field_list where field_list.DataItemName = "NUR_Not Chemical Restraint" );
med_cond := last of (field_list where field_list.DataItemName = "NUR_Nonchemical Restraint Ind");
restraint_freq := last of (field_list where field_list.DataItemName = "PRX_Chemical Restraint Freq");
regular_freq := last of (field_list where field_list.DataItemName = "FrequencyCode");
is_prn := last of (field_list where field_list.DataItemName = "IsPRN");
is_prn_reason := last of (field_list where field_list.DataItemName = "PRX_PRNCondition");
regular_freq_value := regular_freq.value;
if triggerng_field = "NUR_Chemical Restraint" and chem_cb.value = true then
med_cb.value := FALSE;
med_cb.control_read_only := TRUE;
osmed_cb.value := FALSE;
osmed_cb.control_read_only := TRUE;
elseif triggerng_field = "NUR_Chemical Restraint" and chem_cb.value = false then
med_cb.value := TRUE;
med_cb.control_read_only := FALSE;
chem_cb.control_read_only := TRUE;
elseif triggerng_field = "NUR_Not Chemical Restraint" and med_cb.value = true then
chem_cb.value := false;
chem_cb.control_read_only := true;
elseif triggerng_field = "NUR_Not Chemical Restraint" and med_cb.value = false then
chem_cb.value := TRUE;
chem_cb.control_read_only := false;
med_cb.control_read_only := true;
endif;
// Added to include the logic on the Orderset Form, as it has the same name and multi field occasion number [BB]
if triggerng_field = "NUR_Chemical Restraint|1" and oschem_cb.value = true then
osmed_cb.value := FALSE;
osmed_cb.control_read_only := TRUE;
elseif triggerng_field = "NUR_Chemical Restraint|1" and oschem_cb.value = false then
osmed_cb.value := TRUE;
osmed_cb.control_read_only := FALSE;
oschem_cb.control_read_only := TRUE;
elseif triggerng_field = "NUR_Not Chemical Restraint|1" and osmed_cb.value = true then
oschem_cb.value := false;
oschem_cb.control_read_only := true;
elseif triggerng_field = "NUR_Not Chemical Restraint|1" and osmed_cb.value = false then
oschem_cb.value := TRUE;
oschem_cb.control_read_only := false;
osmed_cb.control_read_only := true;
endif;
if chem_cb.Value = true then
// if chemical restraint then hide the regular frequency field ,
regular_freq.control_read_only := TRUE;
regular_freq.control_mandatory := FALSE;
regular_freq_value.FrequencySummary := NULL;
// display the UDDI with the subset of frequencies
restraint_freq.control_read_only := FALSE;
restraint_freq.control_mandatory := TRUE;
restraint_freq.value := NULL;
// and make the medical condition field read only
med_cond.value := "";
med_cond.control_read_only := TRUE;
med_cond.control_mandatory := FALSE;
// and {{{SINGLE-QUOTE}}}IsPRN{{{SINGLE-QUOTE}}} is no longer an option
is_prn.value := false;
is_prn.control_read_only := TRUE;
is_prn_reason.value := NULL;
// is_prn_reason.control_mandatory := FALSE;
// is_prn_reason.control_visible := FALSE;
elseif med_cb.value = true then
// if medical condition then make the regualr frequency field visible,
regular_freq.control_read_only := FALSE;
regular_freq.control_mandatory := TRUE;
regular_freq_value.FrequencySummary := NULL;
// hide the UDDI for the subset of frequencies
restraint_freq.control_read_only := TRUE;
restraint_freq.control_mandatory := FALSE;
restraint_freq.value := NULL;
// and make the medical condition field visible and mandatory
med_cond.value := "";
med_cond.control_read_only := FALSE;
med_cond.control_mandatory := TRUE;
// and {{{SINGLE-QUOTE}}}IsPRN{{{SINGLE-QUOTE}}} is an option
is_prn.value := FALSE;
is_prn.control_read_only := FALSE;
is_prn_reason.value := NULL;
// is_prn_reason.control_mandatory := FALSE;
// is_prn_reason.control_visible := FALSE;
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:

View File

@@ -0,0 +1,311 @@
maintenance:
title: Med With Irregular Sshedule;;
mlmname: FORM_MED_Irreg_Sched;;
arden: version 2;;
version: 4.50;;
institution: St Clair Isolation Set MLM;;
author: Eclipsys Corp;;
specialist: Mary Jo Goodwin ;;
date: 2007-01-03;;
validation: testing;;
library:
purpose: If {{{SINGLE-QUOTE}}}Irregular Schedule{{{SINGLE-QUOTE}}} is selected then populate {{{SINGLE-QUOTE}}}RequestedDTM{{{SINGLE-QUOTE}}}
with Date and time of earliest date/time in the Schedule
;;
explanation: This MLM is called from the medication form selects the frequency {{{SINGLE-QUOTE}}}Irregular Schedule{{{SINGLE-QUOTE}}}
The Schedule will be reviewed and the earliest date/time identified.
This date/time will be put in to the RequestedDTM field using the {{{SINGLE-QUOTE}}}Scheduled/Start Time{{{SINGLE-QUOTE}}} option.
Change History
02/09/2010 RS: Changes made to call FORM_NOW_AND_THEN
01.30.2013 TMS Added logic to one time frequencies to make start now option not selectable.
03.05.2013 TMS Added logic to use Rx instructions and Rx Comments to transfer "patient friendly"
instructions for User schedule and with meal frequencies for Orders reconciliation.
CSR 31322
04.15.2013 TMS Added logic to append (Humalog or Novolog) after Insulin Aspart orders after any
frequency dialog added to Rx Comments and Rx Instructions for Med Rec. CSR 31323
08.12.2013 TMS Commented out all logic from 3.5.2013 and 4.15.2013 for ORM instructions and moved
to MLM {{{SINGLE-QUOTE}}}FORM_RX_ORM_INSTRUCT{{{SINGLE-QUOTE}}} to enable one MLM to add frequency, synonym, route,
and medication indication to RX Comment and Instruction field for ORM. CSR 31639
08.12.2013 TMS Commented out all logic from 3.5.2013 and 4.15.2013 for ORM instructions and moved
to MLM {{{SINGLE-QUOTE}}}FORM_RX_ORM_INSTRUCT{{{SINGLE-QUOTE}}} to enable one MLM to add frequency, synonym, route,
and medication indication to RX Comment and Instruction field for ORM. CSR 31639
10.8.2013 TMS CSR Added additional frequencies (Variable and QxM) to not all now and then
functionality to be selectable CSR 26926
12.17.2013 STH CSR #: 31706 Update MLM to remove STAT Start Time if a frequency other than STAT is selected.
02.21.2013 TMS Added logic for Stat/Then Orders. Updated Now/Then orders to use Total Doses UDDI that
populates StopAfter field with appropriate number. CSR 31883
06.17.2014 DW CSR# 32133 Added call to Automatic Medication Scheduling mlm
05.16.2018 TMS CSR 33940: Add "With Dialysis Treatment" to all logic that contain As Ordered.
;;
keywords: Called MLMs, Form fields, Irregular Schedule
;;
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;
PrimaryObjdetail:=this_communication.PrimaryObj;
session_type := PrimaryObjdetail.internalprocessingtype;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* These variables must containt he same wording as the options in the drop down list */
/***************************************************************************************/
// Initialize error message
error_message:="";
// References the LOCAL SESSION object
local_session := cds_session.local;
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
// Obtain fields passed in the Form object to the Field object
field_list:= this_form.fields;
requested_date := last of (field_list where field_list.DataItemName = "RequestedDate" );
requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" );
stop_after:= last of (field_list where field_list.DataItemName = "StopAfter" );
stop_after_Value := stop_after.value;
stop_date := last of (field_list where field_list.DataItemName = "StopDate" );
stop_time := last of (field_list where field_list.DataItemName = "StopTime" );
stop_time_value := stop_time.value ;
is_prn := last of (field_list where field_list.DataItemName = "IsPRN" );
regular_freq := last of (field_list where field_list.DataItemName = "FrequencyCode");
requested_time_value := requested_time.value;
regular_freq_value := regular_freq.value;
start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
start_now_value := start_now.value;
stat_then := first of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then");
stat_then_value := stat_then.value;
TotalDosing := first of ( field_list WHERE field_list.DataItemName = "PRX_Dosing Total Doses");
TotalDosing_value := TotalDosing.value;
RX_Comments_field := last of (field_list where field_list.DataItemName = "Rx Comments");
RX_Instructions_field := last of (field_list where field_list.DataItemName = "Rx Instructions");
FreqText := " ";
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
PrimaryObjdetail:=this_communication.PrimaryObj;
OrderName := PrimaryObjdetail.name;
RX_Comments_field_value := RX_Comments_field.value;
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
AutoMedScheduling := MLM {{{SINGLE-QUOTE}}}FORM_Antibiotic_Scheduling{{{SINGLE-QUOTE}}};
FreqTranslate := ();
FreqTranslate := read { "select value from cv3userdictionaryvalue v with (nolock)"
|| " where userdictionarycode = {{{SINGLE-QUOTE}}}PRX_ORM Frequency Translation{{{SINGLE-QUOTE}}} "
|| " and active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
};
If CallingEvent = "FieldChange" and CallingField = "FrequencyCode" then
(this_communication, this_form, client_info_obj) := call AutoMedScheduling
with (this_communication, this_form, client_info_obj);
endif;
// if the frequency is {{{SINGLE-QUOTE}}}As Ordered{{{SINGLE-QUOTE}}} or {{{SINGLE-QUOTE}}}With Dialysis Treatment{{{SINGLE-QUOTE}}} then PRN is is mandatory
If (regular_freq_value.FrequencySummary = "As Ordered" or regular_freq_value.FrequencySummary = "With Dialysis Treatment") then
is_prn.control_read_only := TRUE;
is_prn.value := TRUE;
else
is_prn.control_read_only := FALSE;
endif;
// if One time frequency is ordered disable stat/then, now/then and stop after
If (regular_freq_value.FrequencySummary = "STAT") or
(regular_freq_value.FrequencySummary = "NOW") or
(regular_freq_value.FrequencySummary = "ONCE") or
(regular_freq_value.FrequencySummary = "One Time") or
(regular_freq_value.FrequencySummary = "Today") or
(regular_freq_value.FrequencySummary = "Pre-Transfusion") or
(regular_freq_value.FrequencySummary = "Pre-Procedure") or
// (regular_freq_value.FrequencySummary = "PRE OP") or
(regular_freq_value.FrequencySummary = "Post-Transfusion") or
(regular_freq_value.FrequencySummary = "Post-Procedure") or
// (regular_freq_value.FrequencySummary = "POST OP") or
(regular_freq_value.FrequencySummary = "Per-Protocol") or
(regular_freq_value.FrequencySummary = "Between Blood") or
(regular_freq_value.FrequencySummary = "As Ordered") or
(regular_freq_value.FrequencySummary = "Given in Delivery Room") or
(regular_freq_value.FrequencySummary = "Given in Infusion Center") or
(regular_freq_value.FrequencySummary = "Given in NSY") or
(regular_freq_value.FrequencySummary = "Load") or
(regular_freq_value.FrequencySummary = "With Dialysis Treatment") or
(regular_freq_value.FrequencySummary = "As-Directed")
then
stop_after.control_read_only := True;
stop_after_Value.Number := 0;
stop_after_Value.Option := NULL;
stop_time.value := NULL;
start_now.value := False;
start_now.control_read_only := True;
stat_then.value := False;
stat_then.control_read_only := True;
// if frequency is stat make priority stat
If (regular_freq_value.FrequencySummary = "STAT") then
requested_time_value.ReqTimeValue := NULL;
requested_time_value.ReqTimeCode := "STAT";
endif;
stop_date.value := NULL;
stop_date.control_read_only :=True;
stop_time.control_read_only :=True;
TotalDosing.value := NULL;
TotalDosing.control_read_only := True;
// added 11-25-2013 tms
elseIf
(regular_freq_value.FrequencySummary = "PRE OP") or
(regular_freq_value.FrequencySummary = "POST OP")
then
start_now.value := False;
start_now.control_read_only := True;
stat_then.value := False;
stat_then.control_read_only := True;
stop_date.value := NULL;
stop_date.control_read_only :=True;
stop_time.control_read_only :=True;
stop_after.control_read_only := False;
// end add 11-25-2013 tms
// disable stat/then, now/then for variable interval and QxM frequencies
elseif
(regular_freq_value.FrequencySummary = "<Variable Interval>") or
(regular_freq_value.FrequencySummary = "<QxM>")
then
start_now.value := False;
start_now.control_read_only := True;
stat_then.value := False;
stat_then.control_read_only := True;
TotalDosing.value := NULL;
TotalDosing.control_read_only := True;
// disable stat/then, now/then for Hold session orders
elseif
session_type = "Hold"
then
stop_date.control_read_only :=False;
stop_time.control_read_only :=False;
stop_after.control_read_only := False;
start_now.control_read_only := True;
stat_then.control_read_only := True;
TotalDosing.value := NULL;
TotalDosing.control_read_only := True;
else
stop_date.control_read_only :=False;
stop_time.control_read_only :=False;
stop_after.control_read_only := False;
If start_now.value = true or stat_then.value = true then
stop_after.control_read_only := True;
TotalDosing.control_read_only := False;
else
stop_after.control_read_only := False;
TotalDosing.control_read_only := True;
endif;
start_now.control_read_only := False;
stat_then.control_read_only := False;
endif;
// if the frequency is {{{SINGLE-QUOTE}}}User Schedule{{{SINGLE-QUOTE}}} then PRN, stat/then, now/then is not available
If regular_freq_value.FrequencySummary = "<User Schedule>" then
is_prn.control_visible := FALSE;
start_now.control_read_only := True;
start_now.value := False;
stat_then.value := False;
stat_then.control_read_only := True;
TotalDosing.value := NULL;
TotalDosing.control_read_only := True;
else
is_prn.control_visible := TRUE;
endif;
If (regular_freq_value.FrequencySummary <> "STAT")and (requested_time_value.ReqTimeCode = "STAT")
then
requested_time_value.ReqTimeValue := NULL;
requested_time_value.ReqTimeCode := NULL;
endif;
// if the frequency is {{{SINGLE-QUOTE}}}User Schedule{{{SINGLE-QUOTE}}} and selection is {{{SINGLE-QUOTE}}}Irregular Schedule{{{SINGLE-QUOTE}}} then make requestedDTM = beginning dtm
If regular_freq_value.FrequencySummary = "<User Schedule>" AND regular_freq_value.FreqUOM = "irregular"
then
// obtain a list of the scheduled dates and times
freq_schedules := regular_freq_value.FreqIrregularDtm;
// find the earliest scheduled time
earliest_time := minimum of freq_schedules;
// extract the time from the date_time
sched_hour := EXTRACT HOUR(earliest_time);
sched_minute := EXTRACT MINUTE(earliest_time);
sched_time := sched_hour || ":" || sched_minute;
// Put values on to form
requested_time_value.ReqTimeCode := "Scheduled/Start Time";
requested_time_value.ReqTimeValue := sched_time;
requested_date.value := earliest_time;
// in memory set flag indicating irregular schedule set the Requesteddtm
local_session.irreg_sched := TRUE;
else
// if REquesteddtm was set by user selecting {{{SINGLE-QUOTE}}}irregular schedule{{{SINGLE-QUOTE}}} MLM then clear date
if local_session.irreg_sched = TRUE
then
// Put values on to form
requested_time_value.ReqTimeCode := NULL;
requested_time_value.ReqTimeValue := NULL;
requested_date.value := NULL;
endif;
// in memory set flag indicating irregular schedule din NOTset the Requesteddtm
local_session.irreg_sched := FALSE;
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:

Some files were not shown because too many files have changed in this diff Show More