426 lines
22 KiB
Plaintext
426 lines
22 KiB
Plaintext
maintenance:
|
|
|
|
title: TPN Order Set;;
|
|
mlmname: FORM_Set_TPN;;
|
|
arden: version 2.5;;
|
|
version: 5.50;;
|
|
institution: St Clair Hospital;;
|
|
author: Bryan Berkeybile, Allscripts ;;
|
|
specialist: Don Warnick, Allscripts;;
|
|
date: 2012-11-05;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Based upon time of day and active patient orders already on the patient,
|
|
the MLM will select/de-select lab baseline and follow-up orders and determine appropriate start date/time.
|
|
;;
|
|
|
|
explanation: This MLM is called from the TPN Parental Nutrition Order Set (TPN Parent Nut Ord)
|
|
|
|
Change history
|
|
11.01.11 DJW CSR# copied from FORM_Set_PostOp_Lumbar_Lam
|
|
12.18.19 STH/TMS CSR# 35713 - Added new lab section that needs to work in conjuction with the other lab sections correctly.
|
|
;;
|
|
keywords: Called MLMs, TPN Parent Nut Ord
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
// Communication object Form object Arden ClientInfo object
|
|
(this_communication, this_form, client_info_obj) := 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;
|
|
CallingEvent := this_communication.CallingEvent;
|
|
CallingField := this_communication.CallingFieldName;
|
|
|
|
|
|
// Get the current time (hours and minutes zero padded to 2 digits), then determine the time range
|
|
If (Extract Hour NOW) in(0,1,2,3,4,5,6,7,8,9)then HR:="0"||(Extract Hour NOW); else HR:=(Extract Hour NOW); endif;
|
|
If (Extract Minute NOW)in(0,1,2,3,4,5,6,7,8,9)then MN:="0"||(Extract Minute NOW);else MN:= (Extract Minute NOW);endif;
|
|
TimeOfDay := HR || MN;
|
|
|
|
if TimeOfDay >= "0000" and TimeOfDay <= "0300" then TimeRange:= "1";
|
|
elseif TimeOfDay >= "0301" and TimeOfDay <= "0930" then TimeRange:= "2";
|
|
elseif TimeOfDay >= "0931" and TimeOfDay <= "1400" then TimeRange:= "3";
|
|
else TimeRange:= "4";
|
|
endif;
|
|
|
|
// Get the current day of week, to detemine Daily Order stop dates
|
|
|
|
DayOfWeekToday := read last {" select DATEPART(dw, GETDATE())"};
|
|
DayOfWeekTomorrow := read last {" select DATEPART(dw, GETDATE()+1)"};
|
|
|
|
|
|
// Set the future date vaules used for populating the order start date and reminder stop date fields
|
|
|
|
T_Plus_1 := (NOW + 1 day) FORMATTED WITH "%.2t";
|
|
T_Plus_2 := (NOW + 2 day) FORMATTED WITH "%.2t";
|
|
T_Plus_5 := (NOW + 5 day) FORMATTED WITH "%.2t";
|
|
T_Plus_8 := (NOW + 8 day) FORMATTED WITH "%.2t"; //added for the new days 4 through 7 labs
|
|
|
|
T_Plus_14 := (NOW + 14 day) FORMATTED WITH "%.2t";
|
|
T_Plus_15 := (NOW + 15 day) FORMATTED WITH "%.2t";
|
|
T_Plus_16 := (NOW + 16 day) FORMATTED WITH "%.2t";
|
|
T_Plus_17 := (NOW + 17 day) FORMATTED WITH "%.2t";
|
|
T_Plus_18 := (NOW + 18 day) FORMATTED WITH "%.2t";
|
|
T_Plus_19 := (NOW + 19 day) FORMATTED WITH "%.2t";
|
|
T_Plus_20 := (NOW + 20 day) FORMATTED WITH "%.2t";
|
|
T_Plus_21 := (NOW + 21 day) FORMATTED WITH "%.2t";
|
|
T_Plus_22 := (NOW + 22 day) FORMATTED WITH "%.2t";
|
|
|
|
|
|
// Date and Time Fields (hidden)
|
|
|
|
Baseline_Date := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
|
|
Followup_Start_Date_1 := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
|
|
Followup_Start_Date_2 := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
|
|
|
|
Reminder_Date_1 := first of (field_list where field_list.DataItemName = "Nur_ToDate" and field_List.Control_MultiFieldOccNum = 1);
|
|
Reminder_Date_2 := first of (field_list where field_list.DataItemName = "Nur_ToDate" and field_List.Control_MultiFieldOccNum = 2);
|
|
|
|
Time_Field_1 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 1);
|
|
Time_Field_2 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 2);
|
|
|
|
Time_Field_1_Value := Time_Field_1.value;
|
|
Time_Field_2_Value := Time_Field_2.value;
|
|
|
|
// Order Checkbox Sections
|
|
|
|
Baseline_Today_Checkbox:= first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 4);
|
|
AddOn_Today_Checkbox:= first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 7);
|
|
AM_Rounds_Checkbox := first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 5);
|
|
AM_Rounds4t7_Checkbox := first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 8);
|
|
|
|
Baseline_Today_List := Baseline_Today_Checkbox.Value;
|
|
AddOn_Today_Checkbox_Value := AddOn_Today_Checkbox.value;
|
|
AM_Rounds_List := AM_Rounds_Checkbox.Value;
|
|
AM_Rounds4t7_List := AM_Rounds4t7_Checkbox.Value;
|
|
|
|
Comment_Field := first of (field_list where field_list.DataItemName = "Lab_Info" and field_List.Control_MultiFieldOccNum = 1);
|
|
|
|
// Get the Baseline order names and search the patient record for them
|
|
|
|
Baseline_Today_List_Names:= Baseline_Today_List.Name;
|
|
OrderNames := " ";
|
|
index_list2 := 1 seqto (count Baseline_Today_List_Names) ;
|
|
|
|
for J in index_list2 do
|
|
OrderNames := OrderNames || "{{{SINGLE-QUOTE}}}" || Baseline_Today_List_Names[J] || "{{{SINGLE-QUOTE}}}," ;
|
|
enddo;
|
|
OrderNames := OrderNames || "{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel Fasting{{{SINGLE-QUOTE}}}";
|
|
|
|
CurrentOrdersListToday := read
|
|
{ " select distinct "
|
|
|| " case when om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}} "
|
|
|| " when om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Calcium Ionized{{{SINGLE-QUOTE}}} else om.Name end "
|
|
|| " from cv3ordercatalogmasteritem om with (nolock) "
|
|
|| " join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = om.guid and o.typecode = {{{SINGLE-QUOTE}}}diagnostic{{{SINGLE-QUOTE}}} "
|
|
|| " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
|
|
|| " and convert(char(10),o.SignificantDtm,20) = convert(char(10), GETDATE(),20) "
|
|
|| " where o.chartguid = " || SQL(chart_guid) || " and o.clientguid = " || SQL(client_guid) || " and o.clientvisitguid = " || SQL(visit_guid) || " "
|
|
|| " and (om.Name in (" || OrderNames ||") or om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} or om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}})"
|
|
};
|
|
|
|
CurrentOrdersListTodayTubeTypeCount := read last
|
|
{ " select count (distinct ctv.value) "
|
|
|| " from cv3ordercatalogmasteritem om with (nolock) "
|
|
|| " join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = om.guid and o.typecode = {{{SINGLE-QUOTE}}}diagnostic{{{SINGLE-QUOTE}}} "
|
|
|| " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
|
|
|| " and convert(char(10),o.SignificantDtm,20) = convert(char(10), GETDATE(),20) "
|
|
|| " join cv3catalogclasstypevalue ctv with (nolock) on ctv.catalogmasterguid = om.guid "
|
|
|| " and ctv.Value in ({{{SINGLE-QUOTE}}}Light Green{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lavender{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Kelly Green{{{SINGLE-QUOTE}}}) "
|
|
|| " where o.chartguid = " || SQL(chart_guid) || " and o.clientguid = " || SQL(client_guid) || " and o.clientvisitguid = " || SQL(visit_guid) || " "
|
|
};
|
|
|
|
if CurrentOrdersListTodayTubeTypeCount = 3 then NewBloodDrawNeeded := "No";
|
|
else NewBloodDrawNeeded := "Yes";
|
|
endif;
|
|
|
|
CurrentOrdersListTomorrow := read
|
|
{ " select distinct "
|
|
|| " case when om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}} "
|
|
|| " when om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Calcium Ionized{{{SINGLE-QUOTE}}} else om.Name end "
|
|
|| " from cv3ordercatalogmasteritem om with (nolock) "
|
|
|| " join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = om.guid and o.typecode = {{{SINGLE-QUOTE}}}diagnostic{{{SINGLE-QUOTE}}} "
|
|
|| " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
|
|
|| " and convert(char(10),o.SignificantDtm,20) = convert(char(10), GETDATE()+1,20) "
|
|
|| " where o.chartguid = " || SQL(chart_guid) || " and o.clientguid = " || SQL(client_guid) || " and o.clientvisitguid = " || SQL(visit_guid) || " "
|
|
|| " and (om.Name in (" || OrderNames ||") or om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} or om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}})"
|
|
};
|
|
|
|
// Get the AM Rounds X3 order names and search the patient record for them
|
|
|
|
AM_Rounds_List_Names:= AM_Rounds_List.Name;
|
|
OrderNames := " ";
|
|
index_list2 := 1 seqto (count AM_Rounds_List_Names) ;
|
|
|
|
for J in index_list2 do
|
|
OrderNames := OrderNames || "{{{SINGLE-QUOTE}}}" || AM_Rounds_List_Names[J] || "{{{SINGLE-QUOTE}}}," ;
|
|
enddo;
|
|
OrderNames := OrderNames || "{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}";
|
|
|
|
CurrentOrders_3days_Starting_Tomorrow := read
|
|
{ " CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), orderid varchar(100),orddate datetime) "
|
|
|| " INSERT INTO #tmp_aaa (orderid, orddate) "
|
|
|| " select distinct "
|
|
|| " case when om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}} "
|
|
|| " when om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Calcium Ionized{{{SINGLE-QUOTE}}} else om.Name end, "
|
|
|| " convert(char(10),o.SignificantDtm,20) "
|
|
|| " from cv3ordercatalogmasteritem om with (nolock) "
|
|
|| " join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = om.guid and o.typecode = {{{SINGLE-QUOTE}}}diagnostic{{{SINGLE-QUOTE}}} "
|
|
|| " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
|
|
|| " and convert(char(10),o.SignificantDtm,20) > convert(char(10), GETDATE(),20) "
|
|
|| " and convert(char(10),o.SignificantDtm,20) < convert(char(10), GETDATE()+4,20) "
|
|
|| " where o.chartguid = " || SQL(chart_guid) || " and o.clientguid = " || SQL(client_guid) || " and o.clientvisitguid = " || SQL(visit_guid) || " "
|
|
|| " and (om.Name in (" || OrderNames ||") or om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} or om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}})"
|
|
|| " CREATE TABLE #tmp_bbb( ID int IDENTITY(1, 1), orderid varchar(100), tot int) "
|
|
|| " INSERT INTO #tmp_bbb (orderid,tot) "
|
|
|| " SELECT orderid, COUNT(orderid) as Total FROM #tmp_aaa GROUP BY orderid ORDER BY Total DESC "
|
|
|| " select orderid from #tmp_bbb where tot =3 "
|
|
|| " drop table #tmp_aaa "
|
|
|| " drop table #tmp_bbb "
|
|
};
|
|
|
|
CurrentOrders_3days_Starting_Day_After_Tomorrow := read
|
|
{ " CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), orderid varchar(100),orddate datetime) "
|
|
|| " INSERT INTO #tmp_aaa (orderid, orddate) "
|
|
|| " select distinct "
|
|
|| " case when om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}} "
|
|
|| " when om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Calcium Ionized{{{SINGLE-QUOTE}}} else om.Name end, "
|
|
|| " convert(char(10),o.SignificantDtm,20) "
|
|
|| " from cv3ordercatalogmasteritem om with (nolock) "
|
|
|| " join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = om.guid and o.typecode = {{{SINGLE-QUOTE}}}diagnostic{{{SINGLE-QUOTE}}} "
|
|
|| " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
|
|
|| " and convert(char(10),o.SignificantDtm,20) > convert(char(10), GETDATE()+1,20) "
|
|
|| " and convert(char(10),o.SignificantDtm,20) < convert(char(10), GETDATE()+5,20) "
|
|
|| " where o.chartguid = " || SQL(chart_guid) || " and o.clientguid = " || SQL(client_guid) || " and o.clientvisitguid = " || SQL(visit_guid) || " "
|
|
|| " and (om.Name in (" || OrderNames ||") or om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} or om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}})"
|
|
|| " CREATE TABLE #tmp_bbb( ID int IDENTITY(1, 1), orderid varchar(100), tot int) "
|
|
|| " INSERT INTO #tmp_bbb (orderid,tot) "
|
|
|| " SELECT orderid, COUNT(orderid) as Total FROM #tmp_aaa GROUP BY orderid ORDER BY Total DESC "
|
|
|| " select orderid from #tmp_bbb where tot =3 "
|
|
|| " drop table #tmp_aaa "
|
|
|| " drop table #tmp_bbb "
|
|
};
|
|
|
|
|
|
// OPEN EVENT SECTION
|
|
If CallingEvent = "FormOpen" Then
|
|
|
|
// If Before 1400
|
|
|
|
if TimeRange = "1" or Timerange = "2" or Timerange = "3" then
|
|
|
|
// Deselect active orders scheduled for today in Baseline Today section
|
|
|
|
index_list := 1 seqto (count CurrentOrdersListToday) ;
|
|
for J in index_list do
|
|
CurrentOrder := CurrentOrdersListToday[J];
|
|
Baseline_Today_Item := first of (Baseline_Today_List where Baseline_Today_List.Name = CurrentOrder);
|
|
Baseline_Today_Item.ISSelected := false;
|
|
Baseline_Today_Item.ISReadOnly := true;
|
|
enddo;
|
|
|
|
// Once the looping is complete, look for the senario where the patient has no CMP, but has a BMP
|
|
|
|
if "Comprehensive Metabolic Panel" not in CurrentOrdersListToday and
|
|
("Basic Metabolic Panel" in CurrentOrdersListToday or "Basic Metabolic Panel Fasting" in CurrentOrdersListToday)
|
|
then
|
|
AddOn_Today_Checkbox_Value.IsSelected := (true); // set all Add-On checkboxes to true
|
|
Baseline_Today_Item := first of (Baseline_Today_List where Baseline_Today_List.Name = "Comprehensive Metabolic Panel");
|
|
Baseline_Today_Item.ISSelected := false;
|
|
Baseline_Today_Item.ISReadOnly := true;
|
|
else
|
|
AddOn_Today_Checkbox_Value.ISReadOnly := (true); // set all Add-On checkboxes to read only
|
|
endif;
|
|
|
|
|
|
// Deselect AM rounds orders that have a current order scheduled for all 3 days (starting tomorrow)
|
|
|
|
index_list := 1 seqto (count CurrentOrders_3days_Starting_Tomorrow) ;
|
|
for J in index_list do
|
|
CurrentOrder := CurrentOrders_3days_Starting_Tomorrow[J];
|
|
AM_Rounds_Item := first of (AM_Rounds_List where AM_Rounds_List.Name = CurrentOrder);
|
|
AM_Rounds_Item.ISSelected := false;
|
|
AM_Rounds_Item.ISReadOnly := true;
|
|
enddo;
|
|
|
|
if TimeRange = "1"
|
|
then
|
|
if NewBloodDrawNeeded = "Yes"
|
|
then Time_Field_1_Value.ReqTimeCode := "AM Rounds";
|
|
else Time_Field_1_Value.ReqTimeCode := "Routine Collected Specimen";
|
|
endif;
|
|
|
|
elseif TimeRange = "2"
|
|
then
|
|
if NewBloodDrawNeeded = "Yes"
|
|
then Time_Field_1_Value.ReqTimeCode := "Today";
|
|
else Time_Field_1_Value.ReqTimeCode := "Routine Collected Specimen";
|
|
endif;
|
|
|
|
else // TimeRange = "3"
|
|
if NewBloodDrawNeeded = "Yes"
|
|
then Time_Field_1_Value.ReqTimeCode := "STAT";
|
|
else Time_Field_1_Value.ReqTimeCode := "STAT Collected Specimen";
|
|
endif;
|
|
endif;
|
|
|
|
// Set the Daily Reminder Order Dates - Baseline Order is Today
|
|
|
|
if DayOfWeekToday = 2 then Reminder_Date_1.Value := T_Plus_21; Reminder_Date_2.Value := T_Plus_17; // Mon
|
|
elseif DayOfWeekToday = 3 then Reminder_Date_1.Value := T_Plus_20; Reminder_Date_2.Value := T_Plus_16; // Tue
|
|
elseif DayOfWeekToday = 4 then Reminder_Date_1.Value := T_Plus_19; Reminder_Date_2.Value := T_Plus_15; // Wed
|
|
elseif DayOfWeekToday = 5 then Reminder_Date_1.Value := T_Plus_18; Reminder_Date_2.Value := T_Plus_14; // Thu
|
|
|
|
elseif DayOfWeekToday = 6 then Reminder_Date_1.Value := T_Plus_20; Reminder_Date_2.Value := T_Plus_17; // Fri
|
|
elseif DayOfWeekToday = 7 then Reminder_Date_1.Value := T_Plus_19; Reminder_Date_2.Value := T_Plus_16; // Sat
|
|
elseif DayOfWeekToday = 1 then Reminder_Date_1.Value := T_Plus_18; Reminder_Date_2.Value := T_Plus_15; // Sun
|
|
endif;
|
|
|
|
|
|
endif; // Before 1400
|
|
|
|
|
|
// If After 14:00
|
|
|
|
|
|
if TimeRange = "4" then
|
|
|
|
// Deselect active orders scheduled for tomorrow in Baseline Today section
|
|
|
|
index_list := 1 seqto (count CurrentOrdersListTomorrow) ;
|
|
for J in index_list do
|
|
CurrentOrder := CurrentOrdersListTomorrow[J];
|
|
Baseline_Today_Item := first of (Baseline_Today_List where Baseline_Today_List.Name = CurrentOrder);
|
|
Baseline_Today_Item.ISSelected := false;
|
|
Baseline_Today_Item.ISReadOnly := true;
|
|
enddo;
|
|
|
|
// Once the looping is complete, look for the senario where the patient has no CMP, but has a BMP
|
|
|
|
if "Comprehensive Metabolic Panel" not in CurrentOrdersListTomorrow and
|
|
("Basic Metabolic Panel" in CurrentOrdersListTomorrow or "Basic Metabolic Panel Fasting" in CurrentOrdersListTomorrow)
|
|
then
|
|
AddOn_Today_Checkbox_Value.IsSelected := (true); // Set all Add-On checkboxes to true
|
|
Baseline_Today_Item := first of (Baseline_Today_List where Baseline_Today_List.Name = "Comprehensive Metabolic Panel");
|
|
Baseline_Today_Item.ISSelected := false;
|
|
Baseline_Today_Item.ISReadOnly := true;
|
|
else
|
|
AddOn_Today_Checkbox_Value.ISReadOnly := (true); // set all Add-On checkboxes to read only
|
|
endif;
|
|
|
|
// Deselect AM rounds orders that have a current order scheduled for all 3 days (starting day after tomorrow)
|
|
|
|
index_list := 1 seqto (count CurrentOrders_3days_Starting_Day_After_Tomorrow) ;
|
|
for J in index_list do
|
|
CurrentOrder := CurrentOrders_3days_Starting_Day_After_Tomorrow[J];
|
|
AM_Rounds_Item := first of (AM_Rounds_List where AM_Rounds_List.Name = CurrentOrder);
|
|
AM_Rounds_Item.ISSelected := false;
|
|
AM_Rounds_Item.ISReadOnly := true;
|
|
enddo;
|
|
|
|
// Set the days ahead by 1 and time to AM Rounds
|
|
|
|
Baseline_Date.Value := T_Plus_1;
|
|
Followup_Start_Date_1.Value := T_Plus_2;
|
|
Followup_Start_Date_2.Value := T_Plus_5;
|
|
Time_Field_1_Value.ReqTimeCode := "AM Rounds";
|
|
Time_Field_2_Value.ReqTimeCode := "Routine";
|
|
|
|
|
|
|
|
// Set the Daily Reminder Order Dates - Basline Order is Tomorrow
|
|
// Tod - Tom
|
|
|
|
if DayOfWeekTomorrow = 2 then Reminder_Date_1.Value := T_Plus_22; Reminder_Date_2.Value := T_Plus_18; // Sun - Mon
|
|
elseif DayOfWeekTomorrow = 3 then Reminder_Date_1.Value := T_Plus_21; Reminder_Date_2.Value := T_Plus_17; // Mon - Tue
|
|
elseif DayOfWeekTomorrow = 4 then Reminder_Date_1.Value := T_Plus_20; Reminder_Date_2.Value := T_Plus_16; // Tue - Wed
|
|
elseif DayOfWeekTomorrow = 5 then Reminder_Date_1.Value := T_Plus_19; Reminder_Date_2.Value := T_Plus_15; // Wed - Thu
|
|
|
|
elseif DayOfWeekTomorrow = 6 then Reminder_Date_1.Value := T_Plus_21; Reminder_Date_2.Value := T_Plus_18; // Thu - Fri
|
|
elseif DayOfWeekTomorrow = 7 then Reminder_Date_1.Value := T_Plus_20; Reminder_Date_2.Value := T_Plus_17; // Fri - Sat
|
|
elseif DayOfWeekTomorrow = 1 then Reminder_Date_1.Value := T_Plus_19; Reminder_Date_2.Value := T_Plus_16; // Sat - Sun
|
|
endif;
|
|
|
|
endif; // After 1400
|
|
|
|
FU_StartDate_DayOfWeek := read last {" select DATEPART(dw, " || sql(Followup_Start_Date_2.Value) || ")"};
|
|
|
|
|
|
if (FU_StartDate_DayOfWeek = 2) then
|
|
AM_Rounds4t7_List.IsSelected := (true, false, true, false, true, false);
|
|
AM_Rounds4t7_List.IsReadOnly := (false, true, false, true, false, true);
|
|
elseif (FU_StartDate_DayOfWeek in (1,3,4,5,6,7)) then
|
|
AM_Rounds4t7_List.IsSelected := (false, true, false, true, false, true);
|
|
AM_Rounds4t7_List.IsReadOnly := (true, false, true, false, true, false);
|
|
else
|
|
AM_Rounds4t7_List.IsSelected := (false, false, false, false, false, false);
|
|
AM_Rounds4t7_List.IsReadOnly := (true, true, true, true, true, true);
|
|
endif;
|
|
|
|
|
|
|
|
// Comment Box Section
|
|
|
|
Comment:= "For Baseline Lab orders entered at " || HR || ":" || MN || ", ";
|
|
|
|
If NewBloodDrawNeeded = "No" and timerange <> "4" then
|
|
Comment:= Comment || "with the required blood already in the lab,";
|
|
endif;
|
|
|
|
Comment:= Comment || " the schedule is """ || Time_Field_1_Value.ReqTimeCode || """ ";
|
|
|
|
If timerange = "4" then
|
|
Comment:= Comment || " Tomorrow.";
|
|
endif;
|
|
|
|
If NewBloodDrawNeeded = "No" and timerange <> "4" then
|
|
Comment:= Comment || " * IMPORTANT * You must ""Add Specimen"" to the BaseLine Labs and send the Delivery Document to the Laboratory.";
|
|
endif;
|
|
|
|
Comment_Field.Value := Comment;
|
|
|
|
|
|
Endif; // Open
|
|
|
|
|
|
|
|
// CLOSE EVENT SECTION
|
|
|
|
|
|
If CallingEvent = "FormClose" Then
|
|
|
|
If NewBloodDrawNeeded = "No" and timerange <> "4" then
|
|
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\nBe sure to ""Add Specimen"" to the BaseLine Labs and send the Delivery Document to the Laboratory.", "Important Reminder","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
|
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:
|