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

259 lines
9.7 KiB
Plaintext

maintenance:
title: Methotrexate Orders;;
mlmname: FORM_Set_Methotrexate_Orders;;
arden: version 2;;
version: 15.10;;
institution: St Clair Admissions;;
author: Teresa Spicuzza, Eclipsys Corp ext 7448;;
specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
date: 2016-01-06;;
validation: testing;;
library:
purpose: Used for methotrexate orders to allow user to easily enter weekly schedules
and creating a <User Schedule> from their selections.
;;
explanation: This MLM is called from the methotrexate order set
Change history
01.26.2016 TMS Initial build CSR 33699
04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
;;
keywords: Called MLMs, methotrexate
;;
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";
/***************************************************************************************/
// 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;
//Find the baseline order checkbox that may need to be ordered with this protocol
DoseA := last of (field_list where field_list.DataItemName = "MethotrexateDose" and field_List.Control_MultiFieldOccNum = 1);
DoseA_value := DoseA.value;
Dosage := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 1);
Dosage_val := dosage.value;
AltDaysDoseA := last of (field_list where field_list.DataItemName = "PRX_AltSchedule1" and field_List.Control_MultiFieldOccNum = 1);
AltDaysDoseA_list := AltDaysDoseA.value;
AdminTimesDoseA := last of (field_list where field_list.DataItemName = "PRX_WeeklyAdminTime" and field_List.Control_MultiFieldOccNum = 1);
AdminTimesDoseA_list := AdminTimesDoseA.value;
NonWeeklyFreqDoseA := last of (field_list where field_list.DataItemName = "PRX_NonWeeklySchedule" and field_List.Control_MultiFieldOccNum = 1);
NonWeeklyFreqDoseA_list := NonWeeklyFreqDoseA.value;
DoseADays := last of (field_list where field_list.DataItemName = "PRX_Scheddays1" and field_List.Control_MultiFieldOccNum = 1);
DoseATimes := last of (field_list where field_list.DataItemName = "PRX_SchedTimes" and field_List.Control_MultiFieldOccNum = 1);
NonWeeklyCB := last of (field_list where field_list.DataItemName = "PRX_Generic_CB" and field_List.Control_MultiFieldOccNum = 1);
NonWeeklyCB_value := NonWeeklyCB.value;
Frequency := last of (field_list where field_list.DataItemName = "FrequencyCode" and field_List.Control_MultiFieldOccNum = 1);
Frequency_val := Frequency.value;
DailyFreq := last of (field_list where field_list.DataItemName = "PRX_Std_Schedule" and field_List.Control_MultiFieldOccNum = 1);
DailyFreq_value := DailyFreq.value;
DoseAStartdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 1);
Instructions := first of (field_list where field_list.DataItemName = "AdminInstructions" and field_List.Control_MultiFieldOccNum = 1);
If CallingEvent = "FieldChange" or CallingEvent = "FormClose" Then
//Make appropriate fields available on the form for weekly and one time frequencies
If CallingField = "PRX_Generic_CB|1" then
If NonWeeklyCB.Value = false then
AltDaysDoseA.control_read_only := False;
AdminTimesDoseA.control_read_only := False;
Frequency_val.frequencysummary := Null;
NonWeeklyFreqDoseA.control_read_only := true;
NonWeeklyFreqDoseA.value:= Null;
elseif NonWeeklyCB_Value = true then
AltDaysDoseA.value := Null;
AltDaysDoseA.control_read_only := True;
AdminTimesDoseA.control_read_only := True;
AdminTimesDoseA.value := Null;
DoseADays.value := "None";
DoseATimes.value := "None";
NonWeeklyFreqDoseA.control_read_only := false;
endif;
endif;
// Determine the day of the week for today and the following 6 days
ThisTime := (now as time) ;
FormatDate := extract month ThisTime ||"-" || extract day ThisTime ||"-" ||extract year ThisTime;
ThisDay := extract year ThisTime || "-" || extract month ThisTime ||"-" || extract day ThisTime;
DayofWeek1 := read last {"SELECT DATENAME(dw, GETDATE ())"};
DayofWeek2 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,1,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
DayofWeek3 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,2,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
DayofWeek4 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,3,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
DayofWeek5 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,4,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
DayofWeek6 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,5,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
DayofWeek7 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,6,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
If CallingField = "PRX_NonWeeklySchedule|1" then
Frequency_val.frequencysummary := NonWeeklyFreqDoseA.value;
DailyFreq.value := Frequency_val.frequencysummary;
endif;
If CallingField = "MultiOrderGrid|1" and DoseA_value is Null then
dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Please select Dose of Methotrexate and Frequency from selection options. " ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
Grid1Orders_List.IsReadOnly := (True);
Grid1Orders_List.IsSelected := (False);
endif;
// Add dose selected, days selected and times selected to hidden fields to map to order
If CallingField = "MethotrexateDose|1" then
If DoseA_value is not null then
(doselist) := call str_parse with DoseA_value," ";
for r in doselist do
dosage.value := doselist [1];
enddo;
numtabs := (dosage.value as number) / 2.5;
endif;
endif;
If CallingField = "PRX_WeeklyAdminTime|1" then
if AdminTimesDoseA.value is not null then
DoseATimes.value := AdminTimesDoseA_list;
(adminlist) := call str_parse with AdminTimesDoseA_list,",";
admin_count := count adminlist;
endif;
endif;
// Loop through days selected, compare with days of the week to determine starting day
if callingfield = "PRX_AltSchedule1|1" then
if AltDaysDoseA.value is not null then
DoseADays.value := AltDaysDoseA_list;
StartDay1A := "NO";
StartDay2A := "NO";
StartDay3A := "NO";
StartDay4A := "NO";
StartDay5A := "NO";
StartDay6A := "NO";
StartDay7A := "NO";
ListOfDaysA := call str_parse with DoseADays.value, ",";
for r in 1 seqto (count ListOfDaysA) do
If DayofWeek1 = ListOfDaysA [r] then
StartDay1A := "YES";
elseif DayofWeek2 = ListOfDaysA [r] then
StartDay2A := "Yes";
elseif DayofWeek3 = ListOfDaysA [r] then
StartDay3A := "Yes";
elseif DayofWeek4 = ListOfDaysA [r] then
StartDay4A := "Yes";
elseif DayofWeek5 = ListOfDaysA [r] then
StartDay5A := "Yes";
elseif DayofWeek6 = ListOfDaysA [r] then
StartDay6A := "Yes";
elseif DayofWeek7 = ListOfDaysA [r] then
StartDay7A := "Yes";
endif;
enddo;
endif;
endif;
// Determine start date for order
If StartDay1A = "Yes" then
DoseAStartDate.value := Thistime;
elseif StartDay2A = "Yes" then
DoseAStartDate.value := Thistime + 1 day;
elseif StartDay3A = "Yes" then
DoseAStartDate.value := Thistime + 2 day;
elseif StartDay4A = "Yes" then
DoseAStartDate.value := Thistime + 3 day;
elseif StartDay5A = "Yes" then
DoseAStartDate.value := Thistime + 4 day;
elseif StartDay6A = "Yes" then
DoseAStartDate.value := Thistime + 5 day;
elseif StartDay7A = "Yes" then
DoseAStartDate.value := Thistime + 6 day;
endif;
endif; //CallingEvent = "FieldChange" or CallingEvent = "FormClose"
If CallingEvent = "FormClose" then
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;
// Determine how many tablets to administer for dose selected add to admin instructions
numtabs := (dosage.value as number) / 2.5;
If (numtabs is not null) then
If (DoseATimes.value <> "None") and (DoseADays.value <> "None") then
instructions.value := "Give " || numtabs || " tablets, every " || DoseADays.value || " at " || DoseATimes.value;
elseif (DoseATimes.value = "None") and (DoseADays.value = "None") then
instructions.value := "Give " || numtabs || " tablets " ;
endif;
else
instructions.value := "";
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: