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

232 lines
7.5 KiB
Plaintext

maintenance:
title: Set Heparin NurseOrders;;
mlmname: FORM_Set_Heparin_Cardiac_Maint;;
arden: version 2;;
version: 4.50;;
institution: St Clair Admissions;;
author: Robert Spence, Eclipsys Corp Ext 7461;;
specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
date: 2008-05-20;;
validation: testing;;
library:
purpose: Used for medication grids that holds heparin in Cardiac heparin maintenance protocol order set
;;
explanation: This MLM is called from the heparin in Cardiac heparin maintenance protocol order set, form: OS_CardiacHeparinAdj
Change History:
04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
;;
keywords: Called MLMs, Cardiac hep protocol maintenance
;;
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;
/***************************************************************************************/
// Use String parse
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
// 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;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
/////////////////////////
Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
and field_List.Control_MultiFieldOccNum = 2);
Lab_Daily_List := Lab_Daily.Value;
Fnd_APTT := first of (Lab_Daily_List where Lab_Daily_List.Name = "APTT");
Fnd_CBC := first of (Lab_Daily_List where Lab_Daily_List.Name = "CBC No Diff (Hemogram Only)");
primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate");
primreqtime:= last of (field_list where field_list.DataItemName = "RequestedTime");
primreqtime_value := primreqtime.value;
/////////////
Heps_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
and field_List.Control_MultiFieldOccNum = 4);
Heps_List :=Heps_Grid.Value;
Fnd_Hep_Con:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units+ D5W 500ml");
Fnd_Hep_Inf:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units+ 0.9% NaCl 500ml");
If CallingEvent = "FieldChange" Then
If CallingField = "MultiOrderGrid|4" then
If Fnd_Hep_Con.IsSelected = True
then
Fnd_Hep_Inf.IsReadOnly := True;
else
Fnd_Hep_Inf.IsReadOnly := False;
endif;
If Fnd_Hep_Inf.IsSelected = True
then
Fnd_Hep_Con.IsReadOnly := True;
else
Fnd_Hep_Con.IsReadOnly := False;
endif;
If (Fnd_Hep_Con.IsSelected = False) and (Fnd_Hep_Inf.IsSelected = False)
then
Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False);
endif;
endif; // Callingfield = multiorder grid 4
elseif CallingEvent = "FormOpen" then
Fnd_Hep_Inf.IsReadOnly := True;
Lab_Daily_List.IsReadOnly := (False,True);
elseif CallingEvent = "FormClose" then
If (Fnd_Hep_Con.IsSelected = True) or (Fnd_Hep_Inf.IsSelected = True) then
//////////////////////
// Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered today to 2 days from now.
// Set the check box as needed
// Only need if:
// Today Today + 1 Day Today + 2 Days Order for
// None None None Today + 1 day
// None None Order Today
// Order None None Today + 2 days
// primreqdate;
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:= yr || "-" || mn || "-" || dd || "T00:00:00";
tempday := call str_parse with (today as time), " ";
today0 := first(tempday);
tempday := call str_parse with ((today as time) + 1 day), " ";
today1 := first(tempday);
tempday := call str_parse with ((today as time) + 2 day), " ";
today2 := first(tempday);
end_date := (today as time) + 3 days;
CBC_daily_dates :=();
CBC_daily_dates := read
{"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20)"
|| " From cv3order as o with (nolock) "
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|| " and ocmi.active = 1 "
|| " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
|| " where o.clientguid = " || SQL(client_guid)
|| " and o.chartguid = " || SQL(chart_guid)
|| " and o.requesteddtm >= " || SQL(today)
|| " and o.requesteddtm < " || SQL(end_date)
|| " and o.OrderStatusLevelNum > 15 "
|| " and o.OrderStatusLevelNum not in (69, 70) "
|| " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
If (today0 not in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 not in CBC_daily_dates) then
primreqdate.value := (today as time) + 1 day;
Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True);
Message_Date := "GRID CBC order should be set with date: " ||(today as time) + 1 day;
elseif (today0 not in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 in CBC_daily_dates) then
primreqdate.value := (today as time) ;
primreqtime_value.ReqTimeCode := "Today";
Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True);
Message_Date := "GRID CBC order should be set with date: " || (today as time) || "\n with time " || "Today";
elseif (today0 in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 not in CBC_daily_dates) then
primreqdate.value := (today as time) + 2 days;
Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,Reset_CBC_Grid);
Message_Date := "GRID CBC order should be set with date: " || (today as time) + 2 days;
else
Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False);
Message_Date := "GRID CBC order should not be checked";
endif;
else
this_communication.DisplayForm := "Yes";
this_communication.Message := "Please Select a Heparin Infusion Order.\n\n" ||
" 500ml D5W (Standard Concentration)\n" ||
" or \n" ||
" 500ml 0.9% NaCl (If Specifically Requested By Physician)";
this_communication.MessageType := "Error";
endif; // 1 of 2 heparin boxes checked
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;
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: