Files
St.Clair/MLMStripper/bin/Debug/FORM/FORM_SET_SUBCUTANEOUS_INSULIN.mlm

230 lines
8.5 KiB
Plaintext

maintenance:
title: Subcutaneous Insulin;;
mlmname: FORM_Set_Subcutaneous_Insulin;;
arden: version 2;;
version: 4.50;;
institution: St Clairs;;
author: Juliet M. Law, Allscripts Corp ext 7461;;
specialist: Shawn Head, Allscripts Corp Ext 7468;;
date: 2011-07-25;;
validation: testing;;
library:
purpose: Used for medication grids to disable dosing instruction checkbox in Subcutaneous Insulin order set
;;
explanation: This MLM is called from the Subcutaneous Insulin order set
Change history
07.25.2011 JML Copied from FORM_Set_VTE_Prophylaxis
07.01-2013 STH Updated to handle the Diabetes and Nutritional Education orders only allowing it to be order if
there is not already an active order on the patients chart.
11.18.2013 JML CSR 31945: If patient does not a recent NPO or Carb-Controlled Diet order, automatically
select the diet order on Form Close.
03.22.2014 STH CSR 32245: Update outpatient diabetes education order names to be unique for Diabetes and Nutritional education required.
05.13.2014 JML WO# 164724: Remove Subcutaneous Insulin automatic checking of Carb Controlled Diet order.
;;
keywords: Called MLMs, Subcutaneous Insulin
;;
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;
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;
/***************************************************************************************/
// 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;
Dosing_Guidelines := last of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 5);
Dosing_Guidelines_List := Dosing_Guidelines.Value;
//CSR 31945: JML Change
Diet_Order := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
and field_list.Control_MultiFieldOccNum = 6);
Diet_Order_List := Diet_Order.Value;
/*
Nutritional_Text := last of ( field_list WHERE field_list.DataItemName = "OS_ Free Text IF order"
and field_list.Control_MultiFieldOccNum = 1);
*/
//--------BEGIN DIABETES AND NUTRITIONAL SERVICE EDUCATION SECTION ADDED 7-1-2013 STH
diabetes_education := null;
nutritional_education := null;
clientGuid := this_communication.ClientGUID;
clientvisitGuid := this_communication.ClientVisitGUID;
check_for_diabetes_order := read last {"select top 1 {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} as {{{SINGLE-QUOTE}}}diabetes_order{{{SINGLE-QUOTE}}} "
|| " from CV3Order o with (Nolock) "
|| " where o.ClientGUID = " || SQL(clientGuid) //{{{SINGLE-QUOTE}}}9000063678500200{{{SINGLE-QUOTE}}}
|| " and o.ClientVisitGUID = " || SQL(clientvisitGuid) //{{{SINGLE-QUOTE}}}9000368574700270{{{SINGLE-QUOTE}}}
|| " and o.name = {{{SINGLE-QUOTE}}}Diabetes Education, Outpatient{{{SINGLE-QUOTE}}} "
|| " and (o.OrderStatusCode like {{{SINGLE-QUOTE}}}au%{{{SINGLE-QUOTE}}} or o.OrderStatusCode = {{{SINGLE-QUOTE}}}discd{{{SINGLE-QUOTE}}}) "};
check_for_nutritional_order := read last {"select top 1 {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} as {{{SINGLE-QUOTE}}}diabetes_order{{{SINGLE-QUOTE}}} "
|| " from CV3Order o with (Nolock) "
|| " where o.ClientGUID = " || SQL(clientGuid) //{{{SINGLE-QUOTE}}}9000063678500200{{{SINGLE-QUOTE}}}
|| " and o.ClientVisitGUID = " || SQL(clientvisitGuid) //{{{SINGLE-QUOTE}}}9000368574700270{{{SINGLE-QUOTE}}}
|| " and o.name = {{{SINGLE-QUOTE}}}Diabetes Nutritional Counseling, Outpatient{{{SINGLE-QUOTE}}} "
|| " and (o.OrderStatusCode like {{{SINGLE-QUOTE}}}au%{{{SINGLE-QUOTE}}} or o.OrderStatusCode = {{{SINGLE-QUOTE}}}discd{{{SINGLE-QUOTE}}}) "};
update_itemlist := ();
update_itemcheck := ();
update_itemname := ();
update_itemRO := ();
update_itemflds := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
and field_List.Control_MultiFieldOccNum = 4);
update_itemlist := update_itemflds.Value;
update_itemcheck := update_itemlist.IsSelected;
update_itemname := update_itemlist.name;
update_itemRO := update_itemlist.IsReadOnly;
//--------END DIABETES AND NUTRITIONAL SERVICE EDUCATION SECTION ADDED 7-1-2013 STH
if CallingEvent = "FormOpen" then
Dosing_Guidelines_List.IsReadOnly := (True);
//BEGIN DIABETES AND NUTRIONAL SERVICE EDUCATION UPDATE SECTION ADDED 7-1-2013 STH
if check_for_nutritional_order = "YES" then
update_itemcheck[3] := false;
update_itemRO[3] := true;
else
update_itemcheck[3] := true;
update_itemRO[3] := false;
endif;
if check_for_diabetes_order = "YES" then
update_itemcheck[2] := false;
update_itemRO[2] := true;
else
update_itemcheck[2] := true;
update_itemRO[2] := false;
endif;
update_itemlist.IsSelected := update_itemcheck;
update_itemlist.IsReadOnly := update_itemRO;
//END DIABETES AND NUTRIONAL SERVICE EDUCATION UPDATE SECTION ADDED 7-1-2013 STH
//BEGIN WO# 164724 Changes JML
/*
elseif (CallingEvent = "FormClose") then
//********** Begin CSR 31945: JML Changes *************************
if ( NOT ( Nutritional_Text.Value IS NULL ) ) then
oName := Nutritional_Text.Value;
elseif ( NOT ( local_session.SessionUnsubmittedOrdersSubcutInsulinDiets = "" ) ) then
oName := local_session.SessionUnsubmittedOrdersSubcutInsulinDiets;
else
//Retrieve most recent active diet order for patient
(oGuid, oName) := read last {"SELECT o.GUID, o.Name"
|| " FROM CV3Order o"
|| " WHERE o.ClientGUID = " || Sql(ClientGuid)
|| " AND o.ClientVisitGUID = " || Sql(ClientVisitGuid)
|| " AND (o.Name = {{{SINGLE-QUOTE}}}Diet{{{SINGLE-QUOTE}}}"
|| " OR o.Name = {{{SINGLE-QUOTE}}}NPO{{{SINGLE-QUOTE}}}"
|| " OR o.Name = {{{SINGLE-QUOTE}}}Tube Feeding{{{SINGLE-QUOTE}}}"
|| " OR o.Name = {{{SINGLE-QUOTE}}}NPO for Testing/Procedure{{{SINGLE-QUOTE}}})"
|| " AND ((o.OrderStatusLevelNum > 15"
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))"
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
|| " ORDER BY o.CreatedWhen ASC"};
endif;
if ( not ( exists oName ) ) then
//Autocheck diet order
autoCheckDiet := true;
elseif ( ( oName = "NPO" ) OR ( oName = "Tube Feeding" ) OR ( oName = "NPO for Testing/Procedure" ) ) then
//if NPO order, don{{{SINGLE-QUOTE}}}t autcheck diet order
autoCheckDiet := false;
else
if ( oName = "Diet" ) then
//Check if diet is for carb controlled
(oCarbCode, oCarbValue) := read {"SELECT oud.UserDataCode, oud.Value"
|| " FROM CV3OrderUserData oud"
|| " WHERE oud.OrderGUID = " || Sql(oGuid)
|| " AND (oud.UserDataCode = {{{SINGLE-QUOTE}}}DIET_DSD_Liquid{{{SINGLE-QUOTE}}}"
|| " OR oud.UserDataCode = {{{SINGLE-QUOTE}}}DIET_DSD_ADA or Calorie{{{SINGLE-QUOTE}}})"};
if ( not ( exists oCarbCode ) ) then
autoCheckDiet := true;
else
stopCheck := false;
for i IN 1 seqto ( count oCarbValue ) do
if ( oCarbValue[i] matches pattern "%Controlled Carbohydrate%" ) then
autoCheckDiet := false;
stopCheck := true;
elseif ( oCarbValue[i] matches pattern "%Consistent Carbohydrate%" ) then
autoCheckDiet := false;
stopCheck := true;
else
if (not stopCheck) then
autoCheckDiet := true;
else
autoCheckDiet := false;
endif;
endif;
enddo;
endif;
elseif ( oName matches pattern "Diet%Carb%" ) then
autoCheckDiet := false;
endif;
endif;
if (autoCheckDiet) then
Diet_Order_List.IsSelected := true;
endif;
//***************** End CSR 31945: JML Changes **********************
*/
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: