Initial Checking with all 820 MLMs
This commit is contained in:
432
MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_CARDIAC_INIT.mlm
Normal file
432
MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_CARDIAC_INIT.mlm
Normal file
@@ -0,0 +1,432 @@
|
||||
maintenance:
|
||||
|
||||
title: Set Heparin NurseOrders;;
|
||||
mlmname: FORM_Set_Heparin_Cardiac_Init;;
|
||||
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 protocol order set
|
||||
;;
|
||||
|
||||
explanation: This MLM is called from the heparin in Cardiac heparin protocol order set, form: OS_CardiacCCMHeparin
|
||||
Change History
|
||||
09.27.2010 TMS Added routine for Hold session date handling
|
||||
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;
|
||||
|
||||
|
||||
/*******************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;
|
||||
//////////////
|
||||
Labs_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
|
||||
and field_List.Control_MultiFieldOccNum = 1);
|
||||
Labs_List := Labs_fld.Value;
|
||||
|
||||
//Find the three checkboxes that may need to be ordered with this protocol
|
||||
Found_CBC:= first of (Labs_list where Labs_list.Name = "CBC No Diff (Hemogram Only)");
|
||||
Found_INR:= first of (Labs_list where Labs_list.Name = "Prothrombin/INR");
|
||||
Found_APTT:= first of (Labs_list where Labs_list.Name = "APTT");
|
||||
|
||||
|
||||
CheckAPTT:=False;
|
||||
CheckCBC:=False;
|
||||
CheckINR:=False;
|
||||
|
||||
/////////////////////////
|
||||
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");
|
||||
|
||||
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 = 1);
|
||||
|
||||
Lab_Rem_List := Lab_Rem.Value;
|
||||
|
||||
Fnd_Daily := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
|
||||
|
||||
|
||||
///////////////////////
|
||||
Mlt_Order_Line:= first of (field_list where field_list.DataItemName = "MultiOrderInline"
|
||||
and field_List.Control_MultiFieldOccNum = 1);
|
||||
Mlt_List := Mlt_Order_Line.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");
|
||||
|
||||
/////////////
|
||||
|
||||
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|4" then
|
||||
|
||||
If Fnd_Hep_Con.IsSelected = True
|
||||
then
|
||||
Fnd_Hep_Inf.IsReadOnly := True;
|
||||
|
||||
Lab_Daily_List.IsReadOnly := (False,True,True,True,True,True);
|
||||
Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
|
||||
|
||||
Fnd_Daily.IsReadOnly := True;
|
||||
Fnd_Daily.IsSelected := True;
|
||||
|
||||
If Ed_Loc.Value matches pattern "ER%" then
|
||||
Mlt_List.IsSelected := (True,True,True,True,True,True,True,True);
|
||||
else
|
||||
Mlt_List.IsSelected := (True,True,True,True,True,True,True,False);
|
||||
endif;
|
||||
else
|
||||
Fnd_Hep_Inf.IsReadOnly := False;
|
||||
endif;
|
||||
|
||||
If Fnd_Hep_Inf.IsSelected = True
|
||||
then
|
||||
Fnd_Hep_Con.IsReadOnly := True;
|
||||
|
||||
Lab_Daily_List.IsReadOnly := (False,True,True,True,True,True);
|
||||
Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
|
||||
|
||||
Fnd_Daily.IsReadOnly := True;
|
||||
Fnd_Daily.IsSelected := True;
|
||||
|
||||
If Ed_Loc.Value matches pattern "ER%" then
|
||||
Mlt_List.IsSelected := (True,True,True,True,True,True,True,True);
|
||||
else
|
||||
Mlt_List.IsSelected := (True,True,True,True,True,True,True,False);
|
||||
endif;
|
||||
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,False,False,False,False);
|
||||
Fnd_Daily.IsSelected := False;
|
||||
|
||||
Mlt_List.IsSelected := (False,False,False,False,False,False,False,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
|
||||
|
||||
//Retrieve Patient{{{SINGLE-QUOTE}}}s Current Location
|
||||
LocName:= read last
|
||||
{"SELECT currentlocation "
|
||||
|| " FROM cv3clientvisit "
|
||||
|| " WHERE ClientGUID = " || SQL(client_guid )
|
||||
|| " And GUID = " || SQL(visit_guid)};
|
||||
Ed_Loc.Value := LocName;
|
||||
|
||||
Mlt_List.IsReadOnly := (True,True,True,True,True,True,True,True);
|
||||
|
||||
If Ed_Loc.Value matches pattern "ER%" then
|
||||
Mlt_List.IsSelected := (True,True,True,True,True,True,True,True);
|
||||
else
|
||||
Mlt_List.IsSelected := (True,True,True,True,True,True,True,False);
|
||||
endif;
|
||||
|
||||
Fnd_Hep_Inf.IsReadOnly := True;
|
||||
Lab_Daily_List.IsReadOnly := (False,True,True,True,True,True);
|
||||
Fnd_Daily.IsReadOnly := True;
|
||||
Fnd_Daily.IsSelected := 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_Con.IsSelected = True) or (Fnd_Hep_Inf.IsSelected = True) then
|
||||
|
||||
|
||||
If (Found_CBC.IsSelected =false) or (Found_INR.IsSelected = false) or (Found_APTT.IsSelected= false) then
|
||||
|
||||
If Found_CBC.ISSelected = False then
|
||||
|
||||
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_CBC.ISSelected :=True;
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
// Now for INR
|
||||
|
||||
If Found_INR.ISSelected = False then
|
||||
|
||||
INR_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}}}Prothrombin/INR{{{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 INR_Val then
|
||||
CheckINR:=False;
|
||||
else
|
||||
Found_INR.ISSelected :=True;
|
||||
CheckINR:=True;
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
// Now for APTT
|
||||
|
||||
If Found_APTT.ISSelected = False then
|
||||
|
||||
APTT_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}}}APTT{{{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 APTT_Val then
|
||||
CheckAPTT:=False;
|
||||
else
|
||||
Found_APTT.ISSelected :=True;
|
||||
CheckAPTT:=True;
|
||||
endif;
|
||||
|
||||
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 := (Fnd_APTT.IsSelected,Reset_CBC_Grid);
|
||||
|
||||
|
||||
|
||||
|
||||
endif; //If exist
|
||||
|
||||
|
||||
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:
|
||||
Reference in New Issue
Block a user