416 lines
15 KiB
Plaintext
416 lines
15 KiB
Plaintext
maintenance:
|
|
|
|
title: Set Heparin NurseOrders;;
|
|
mlmname: FORM_Set_CCM_Admission;;
|
|
arden: version 2;;
|
|
version: 4.50;;
|
|
institution: St Clair Admissions;;
|
|
author: Dean Miklavic, Eclipsys Corp ext 7448;;
|
|
specialist: Don Warnick, Eclipsys Corp Ext 7461;;
|
|
date: 2009-05-21;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Used for medication grids that holds heparin in Cardiac heparin protocol order set
|
|
;;
|
|
|
|
explanation: This MLM is called from the heparin in Cardiac heparin protocol order set, form: CCM_Admission_OS (spelling may change)
|
|
|
|
|
|
Change history
|
|
|
|
05.21.2009 DW Change hidden fields to protected fields (control_visible := false --- control_read_only :=true)
|
|
06.14.2009 RS Added logic to see if CBC on Stat Admit order was checked, if so no need to order baseline
|
|
Logic to assign CBC value and added to close event to check for it.
|
|
All code marked with date 06/14/2009
|
|
09.27.2010 TMS Added routine for Hold session date handling
|
|
03.28.2012 JML Added call to functional MLM that will perform a check for existing or unsubmitted
|
|
anticoagulant orders and whether they conflict with the current anticoagulant selection.
|
|
05.16.2012 JML Changed Heparin duplicate medication alert to soft stop.
|
|
03.26.2013 JML CSR #31451: Modifications to CCM Admission order set to display warning message to physicians
|
|
if they try to submit the order set without selecting heparin.
|
|
04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
|
|
|
|
|
|
;;
|
|
keywords: Called MLMs, Cardiac hep protocol
|
|
;;
|
|
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;
|
|
|
|
|
|
//Include standard .Net libraries
|
|
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;
|
|
|
|
|
|
/***************************************************************************************/
|
|
|
|
// Use String parse
|
|
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
|
|
|
// Anticoagulant Conflict Check MLM
|
|
anticoagulant_conflict := MLM {{{SINGLE-QUOTE}}}FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK{{{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;
|
|
user_guid := this_communication.UserGUID;
|
|
|
|
CallingEvent := this_communication.CallingEvent;
|
|
CallingField := this_communication.CallingFieldName;
|
|
//////////////
|
|
Labs_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
|
|
and field_List.Control_MultiFieldOccNum = 4);
|
|
Labs_List := Labs_fld.Value;
|
|
|
|
//Find the three checkboxes that may need to be ordered with this protocol
|
|
Found_Base_CBC:= first of (Labs_list where Labs_list.Name = "CBC No Diff (Hemogram Only)");
|
|
|
|
CheckCBC:=False;
|
|
|
|
///////////////////////// 06/14/2009 RS ADDED CODE TO CHECK STAT ADMIT ORDERS /////////////////
|
|
StatAdm_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
|
|
and field_List.Control_MultiFieldOccNum = 2);
|
|
StatAdm_List := StatAdm_fld.Value;
|
|
|
|
StatCBC := first of (StatAdm_list where StatAdm_list.Name = "CBC (Includes Diff)");
|
|
//////////////////////// END OF RS ADDED CODE 06/14/2009, more on form close event ////////////////
|
|
|
|
|
|
Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
|
|
and field_List.Control_MultiFieldOccNum = 3);
|
|
Lab_Daily_List := Lab_Daily.Value;
|
|
|
|
|
|
primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
|
|
and field_List.Control_MultiFieldOccNum = 1);
|
|
|
|
secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
|
|
and field_List.Control_MultiFieldOccNum = 2);
|
|
thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
|
|
and field_List.Control_MultiFieldOccNum = 3);
|
|
fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
|
|
and field_List.Control_MultiFieldOccNum = 4);
|
|
fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
|
|
and field_List.Control_MultiFieldOccNum = 5);
|
|
|
|
ED_Loc:= last of (field_list where field_list.DataItemName = "ED Location");
|
|
|
|
//////////////
|
|
Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
|
|
and field_List.Control_MultiFieldOccNum = 4);
|
|
|
|
Lab_Rem_List := Lab_Rem.Value;
|
|
|
|
Fnd_Daily := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
|
|
|
|
|
|
///////////////////////
|
|
Heps_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
|
|
and field_List.Control_MultiFieldOccNum = 1);
|
|
Heps_List :=Heps_Grid.Value;
|
|
Fnd_Hep_Inj:= first of (Heps_List where Heps_List.Name = "Heparin Inj");
|
|
/////////////
|
|
|
|
prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
|
|
////////////
|
|
Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
|
|
Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
|
|
|
|
|
|
If CallingEvent = "FieldChange" Then
|
|
|
|
If CallingField = "MultiOrderGrid|1" then
|
|
|
|
If (Fnd_Hep_Inj.IsSelected = True) then
|
|
(stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Fnd_Hep_Inj.Name);
|
|
|
|
if (stop = true) then
|
|
if (severity = "high") then
|
|
this_communication.DisplayForm := "Yes";
|
|
this_communication.Message := stop_message;
|
|
this_communication.MessageType := "Informational";
|
|
|
|
Fnd_Hep_Inj.IsSelected := False;
|
|
Lab_Daily_List.IsReadOnly := (True, True, True, True, True);
|
|
Lab_Daily_List.IsSelected := (False, False, False, False, False);
|
|
|
|
Fnd_Daily.IsReadOnly := True;
|
|
Fnd_Daily.IsSelected := False;
|
|
else
|
|
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
|
|
|
if ((dialogRes as String) = "No") then
|
|
Fnd_Hep_Inj.IsSelected := False;
|
|
Lab_Daily_List.IsReadOnly := (True, True, True, True, True);
|
|
Lab_Daily_List.IsSelected := (False, False, False, False, False);
|
|
|
|
Fnd_Daily.IsReadOnly := True;
|
|
Fnd_Daily.IsSelected := False;
|
|
else
|
|
Lab_Daily_List.IsReadOnly := (True, True, True, True, True);
|
|
Lab_Daily_List.IsSelected := (True, True, True, True, True);
|
|
|
|
Fnd_Daily.IsReadOnly := True;
|
|
Fnd_Daily.IsSelected := True;
|
|
|
|
endif;
|
|
endif;
|
|
else
|
|
Lab_Daily_List.IsReadOnly := (True,True,True,True,True);
|
|
Lab_Daily_List.IsSelected := (True,True,True,True,True);
|
|
|
|
Fnd_Daily.IsReadOnly := True;
|
|
Fnd_Daily.IsSelected := True;
|
|
endif;
|
|
|
|
else
|
|
//Check to see if logged in user is a Physician
|
|
(userOcc) := read last {
|
|
" SELECT OccupationCode, touchedWhen "
|
|
|| " FROM CV3User with (nolock)"
|
|
|| " WHERE GUID = " || Sql(user_guid)
|
|
|| " AND Active = 1 "
|
|
, primarytime = touchedWhen
|
|
};
|
|
|
|
|
|
if (userOcc = "MD" or userOcc = "Physician" or userOcc = "Non-staff Physician") then
|
|
stopMsg := "You are NOT ordering Heparin for DVT Prophylaxis.\n\nPlease document reason in Progress Note.";
|
|
this_communication.DisplayForm := true;
|
|
this_communication.Message := stopMsg;
|
|
this_communication.MessageType := "Informational";
|
|
endif;
|
|
Lab_Daily_List.IsSelected := (False,False,False,False,False);
|
|
Fnd_Daily.IsSelected := False;
|
|
endif;
|
|
|
|
ElseIf CallingField = "RequestedDate|1" then
|
|
|
|
//Set the four remaining order set date fields based on the starting date
|
|
|
|
|
|
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";
|
|
|
|
tomorrow := (today as time) +1 day;
|
|
tom_list := call str_parse with tomorrow, " ";
|
|
tom_dte := first(tom_list);
|
|
lesstomorrow := primreqdate.value < tomorrow;
|
|
|
|
If lesstomorrow = true then
|
|
|
|
this_communication.DisplayForm := "Yes";
|
|
this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")"
|
|
;
|
|
this_communication.MessageType := "Error";
|
|
|
|
primreqdate.value := tomorrow;
|
|
endif;
|
|
|
|
|
|
startdate:= primreqdate.value;
|
|
Order_From.value := primreqdate.value;
|
|
secreqdate.value := startdate + 2 days;
|
|
thirdreqdate.value := startdate + 4 days;
|
|
fourthreqdate.value := startdate + 6 days;
|
|
fifthreqdate.value := startdate + 8 days;
|
|
Order_To.value := fifthreqdate.value;
|
|
|
|
prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
|
|
fourthreqdate.value || "," || fifthreqdate.value;
|
|
endif; //Calling Field
|
|
|
|
elseif CallingEvent = "FormOpen" then
|
|
|
|
if (Fnd_Hep_Inj.IsSelected) then
|
|
(stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Fnd_Hep_Inj.Name);
|
|
|
|
if (stop = true) then
|
|
if (severity = "high") then
|
|
this_communication.DisplayForm := "Yes";
|
|
this_communication.Message := stop_message;
|
|
this_communication.MessageType := "Informational";
|
|
Fnd_Hep_Inj.IsSelected := false;
|
|
Lab_Daily_List.IsSelected := (False, False, False, False, False);
|
|
Fnd_Daily.IsSelected := False;
|
|
else
|
|
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
|
|
|
if ((dialogRes as String) = "No") then
|
|
Fnd_Hep_Inj.IsSelected := false;
|
|
Lab_Daily_List.IsSelected := (False, False, False, False, False);
|
|
Fnd_Daily.IsSelected := False;
|
|
else
|
|
Lab_Daily_List.IsSelected := (True, True, True, True, True);
|
|
|
|
Fnd_Daily.IsSelected := True;
|
|
endif;
|
|
endif;
|
|
else
|
|
Lab_Daily_List.IsSelected := (True, True, True, True, True);
|
|
Fnd_Daily.IsSelected := True;
|
|
endif;
|
|
else
|
|
Lab_Daily_List.IsSelected := (False, False, False, False, False);
|
|
Fnd_Daily.IsSelected := False;
|
|
endif;
|
|
|
|
Lab_Daily_List.IsReadOnly := (True,True,True,True,True);
|
|
Fnd_Daily.IsReadOnly := True;
|
|
|
|
// Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
|
|
PlusLocation := FIND "+" IN STRING primreqdate.value;
|
|
TLocation := FIND "T" IN STRING primreqdate.value;
|
|
If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
|
|
If PlusLocation > 0 then
|
|
PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
|
|
primreqdate.value := (now as time) +(PlusDays as number) day;
|
|
endif;
|
|
|
|
startdate:= primreqdate.value;
|
|
Order_From.value := primreqdate.value;
|
|
secreqdate.value := startdate + 2 days;
|
|
thirdreqdate.value := startdate + 4 days;
|
|
fourthreqdate.value := startdate + 6 days;
|
|
fifthreqdate.value := startdate + 8 days;
|
|
Order_To.value := fifthreqdate.value;
|
|
|
|
prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
|
|
fourthreqdate.value || "," || fifthreqdate.value;
|
|
|
|
|
|
|
|
|
|
elseif CallingEvent = "FormClose" then
|
|
|
|
If (Fnd_Hep_Inj.IsSelected = True) then
|
|
|
|
|
|
If ((Found_Base_CBC.IsSelected =false) and (StatCBC.IsSelected = false)) then // 06/14/2009 RS Added check to stop dups
|
|
|
|
CBC_Val := read last
|
|
{"Select top 1 o.Name"
|
|
|| " 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 >= (DATEADD(hour, -24, getdate())) "
|
|
|| " and o.requesteddtm <= getdate() "
|
|
|| " and o.OrderStatusLevelNum > 15 "
|
|
|| " and o.OrderStatusLevelNum not in (69, 70) "
|
|
|| " order by o.requesteddtm desc "
|
|
};
|
|
|
|
If exists CBC_Val then
|
|
CheckCBC:=False;
|
|
else
|
|
CheckCBC:=True;
|
|
Found_Base_CBC.ISSelected :=True;
|
|
endif;
|
|
|
|
endif;
|
|
|
|
|
|
|
|
//////////////////////
|
|
// Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered in the future...
|
|
// Reset the check boxes if they are.
|
|
|
|
formlist := call str_parse with prx_comment.value, ",";
|
|
|
|
end_date := fifthreqdate.value + 1 day;
|
|
|
|
CBC_daily_dates :=();
|
|
CBC_daily_dates := read
|
|
|
|
{"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
|
|
|| " 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(primreqdate.value)
|
|
|| " 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 exist(CBC_daily_dates) then
|
|
Reset_CBC_Grid:= ();
|
|
singledate := "";
|
|
index_list := 1 seqto (count formlist) ;
|
|
for J in index_list do
|
|
|
|
singledate := formlist[J];
|
|
|
|
Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
|
|
|
|
|
|
enddo;
|
|
|
|
Lab_Daily_List.IsSelected := (Reset_CBC_Grid);
|
|
|
|
|
|
endif; //If exist
|
|
|
|
|
|
// else
|
|
|
|
// this_communication.DisplayForm := "Yes";
|
|
// this_communication.Message := "Please Select a Heparin Order.";
|
|
// 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:
|