237 lines
8.7 KiB
Plaintext
237 lines
8.7 KiB
Plaintext
maintenance:
|
|
|
|
title: Toradol with Ibuprofen on Order Set;;
|
|
mlmname: FORM_Set_Toradol_with_Ibuprofen;;
|
|
arden: version 2.5;;
|
|
version: 5.50;;
|
|
institution: St Clair Hospital;;
|
|
author: Debbie Eiler, Allscripts ;;
|
|
specialist: Shawn Head, Allscripts;;
|
|
date: 2013-10-14;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: schedule Ibuprofen for 6 hours after last dose of Toradol
|
|
;;
|
|
|
|
explanation: This MLM is called from the FBC C Section Order Set
|
|
|
|
Change history
|
|
10.14.2013 STH Created as a break/fix solution for FBC C Setion Order set.
|
|
02.03.2014 STH Trackit Ticket #: 163421 correct issue with Hold session
|
|
04.26.2016 TMS CSR 33465: Add call on Form Close to Medication Order Management MLM
|
|
;;
|
|
keywords: Called MLMs, FBC C section, Toradol, Ibuprofen
|
|
;;
|
|
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:="";
|
|
|
|
field_list := this_form.fields;
|
|
CallingEvent := this_communication.CallingEvent;
|
|
itemnames := field_list.value.name;
|
|
|
|
ketorolac_selected := false;
|
|
IBU_selected := false;
|
|
freqOccNum := ();
|
|
RequestedDateOccNum := ();
|
|
RequestedTimeOccNum := ();
|
|
for x in (1 seqto count(field_list)) do
|
|
fielditem_values := field_list[x].value;
|
|
itemnames := fielditem_values.name;
|
|
selected := fielditem_values.isselected;
|
|
if ("Ketorolac Inj" in itemnames) or ("Ibuprofen 800mg Tab" in itemnames) then
|
|
for j in (1 seqto count(itemnames)) do
|
|
if itemnames[j] = "Ketorolac Inj" and selected[j] = true then
|
|
ketorolac_selected := true;
|
|
endif;
|
|
if itemnames[j] = "Ibuprofen 800mg Tab" and selected[j] = true then
|
|
IBU_selected := true;
|
|
endif;
|
|
enddo;
|
|
endif;
|
|
|
|
if trim(field_list[x].DataItemName) = "FrequencyCode" then
|
|
freqOccNum := freqOccNum, field_list[x].Control_MultiFieldOccNum;
|
|
endif;
|
|
|
|
if trim(field_list[x].DataItemName) = "RequestedDate" then
|
|
RequestedDateOccNum := RequestedDateOccNum, field_list[x].Control_MultiFieldOccNum;
|
|
endif;
|
|
|
|
if trim(field_list[x].DataItemName) = "RequestedTime" then
|
|
RequestedTimeOccNum := RequestedTimeOccNum, field_list[x].Control_MultiFieldOccNum;
|
|
endif;
|
|
|
|
enddo;
|
|
|
|
|
|
|
|
// FORM CLOSE EVENT SECTION
|
|
|
|
If CallingEvent = "FormClose" and ketorolac_selected = true and IBU_selected = true Then
|
|
|
|
|
|
freqOccNum := sort Data freqOccNum;
|
|
RequestedDateOccNum := sort data RequestedDateOccNum;
|
|
RequestedTimeOccNum := sort data RequestedTimeOccNum;
|
|
|
|
FrequencyCode_Toradol := first of (field_list where field_list.DataItemName = "FrequencyCode" and field_List.Control_MultiFieldOccNum = freqOccNum[1]);
|
|
StartDate_Toradol := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = RequestedDateOccNum[1]);
|
|
StartTime_Toradol := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = RequestedTimeOccNum[1]);
|
|
StartDate_IBU := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = RequestedDateOccNum[2]);
|
|
StartTime_IBU := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = RequestedTimeOccNum[2]);
|
|
FreqCodeValue_Toradol := FrequencyCode_Toradol.value.FrequencySummary;
|
|
StDateValue_Toradol := StartDate_Toradol.value;
|
|
StTimeValue_Tordol := StartTime_Toradol.value;
|
|
StTimeValue_IBU := StartTime_IBU.value;
|
|
|
|
|
|
THR := Extract Hour NOW;
|
|
TMN := Extract Minute NOW;
|
|
|
|
if THR < 10 then
|
|
THR := "0" || THR;
|
|
endif;
|
|
|
|
if TMN < 10 then
|
|
TMN := "0" || TMN;
|
|
endif;
|
|
|
|
PlusLocation := FIND "+" IN STRING StDateValue_Toradol ;
|
|
TLocation := FIND "T" IN STRING StDateValue_Toradol ;
|
|
|
|
If TLocation = 1 and PlusLocation = 0 then
|
|
StDateValue_Toradol := (now as time);
|
|
StTimeValue_Tordol.ReqTimeCode := "Scheduled/Start Time";
|
|
StTimeValue_Tordol.ReqTimeValue := THR || ":" || TMN;
|
|
endif;
|
|
If PlusLocation > 0 then
|
|
PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF StDateValue_Toradol FROM StDateValue_Toradol ;
|
|
StDateValue_Toradol := (now as time) + (PlusDays as number) day;
|
|
StTimeValue_Tordol.ReqTimeCode := "Scheduled/Start Time";
|
|
StTimeValue_Tordol.ReqTimeValue := THR || ":" || TMN;
|
|
endif;
|
|
|
|
ReqTimeCode_Tordol := StTimeValue_Tordol.ReqTimeCode;
|
|
|
|
SchHour_Tordol:= substring 2 characters from StTimeValue_Tordol.ReqTimeValue as number;
|
|
SchMin_Tordol := substring 2 characters starting at 4 from StTimeValue_Tordol.ReqTimeValue;
|
|
|
|
if (ReqTimeCode_Tordol = "Scheduled/Start Time") then
|
|
HR := SchHour_Tordol;
|
|
MN := SchMin_Tordol;
|
|
else
|
|
HR := Extract Hour NOW;
|
|
MN := Extract Minute Now;
|
|
endif;
|
|
|
|
if HR < 10 then
|
|
HR := "0" || HR;
|
|
endif;
|
|
|
|
if MN < 10 then
|
|
MN := "0" || MN;
|
|
endif;
|
|
|
|
HR_seconds := (60 * (HR as number)) * 60;
|
|
MN_Seconds := (MN as number) * 60;
|
|
Calc_starttime_toradol := ((StDateValue_Toradol + (HR_seconds seconds)) + (MN_Seconds seconds));
|
|
Freq_length := length of FreqCodeValue_Toradol as number;
|
|
freq_endposition := freq_length;
|
|
begin_freq := substring 1 characters from FreqCodeValue_Toradol as string;
|
|
end_freq := substring 1 characters starting at freq_endposition from FreqCodeValue_Toradol as string;
|
|
|
|
if begin_freq = "Q" then
|
|
Freqnum_Toradol := Freq_length - 2;
|
|
Schnum_Toradol := substring Freqnum_Toradol characters starting at 2 from FreqCodeValue_Toradol;
|
|
endif;
|
|
|
|
schnum_toradol := schnum_Toradol as number;
|
|
|
|
if (end_freq = "M") then
|
|
calc_schnum_seconds := (((86400 / (60 * schnum_toradol)) - 1) * (60 * schnum_toradol)); //take the minutes times 60 to get the seconds, divide that
|
|
elseif (end_freq = "H") then
|
|
calc_schnum_seconds := ((((24 / schnum_Toradol)-1) * schnum_toradol) * 60) * 60;
|
|
endif;
|
|
|
|
sched_time := read { "select ScheduledTime from CV3FixedScheduleDefinition fs "
|
|
|| " inner join CV3CodedFreqTranslation ft on fs.ParentGUID = ft.GUID "
|
|
|| " where ft.FrequencyCode = " || sql(FreqCodeValue_Toradol)
|
|
|| " and ft.FrequencyClass = {{{SINGLE-QUOTE}}}<Default>{{{SINGLE-QUOTE}}} "};
|
|
|
|
sched_time := sort data sched_time;
|
|
sched_starttime := "";
|
|
sched_endtime := "";
|
|
if (count(sched_time) = 0) or (ReqTimeCode_Tordol = "Scheduled/Start Time") then
|
|
calc_startDTTM_IBU := (Calc_starttime_toradol + calc_schnum_seconds seconds) + 21600 seconds;
|
|
else
|
|
tmp_starthhmn := HR || MN;
|
|
for s in (1 seqto count(sched_time)) do
|
|
if ((sched_time[s] as number) > (tmp_starthhmn as number)) and sched_starttime = "" then
|
|
sched_starttime := sched_time[s];
|
|
endif;
|
|
if ((sched_time[s] as number) < (tmp_starthhmn as number)) then
|
|
sched_endtime := sched_time[s];
|
|
endif;
|
|
enddo;
|
|
|
|
length_sched_endtime := length (sched_endtime as string);
|
|
sched_minPOS := ((length_sched_endtime as number) - 2) as number;
|
|
calc_schMIN := (substring 2 characters starting at (sched_minPOS + 1) from (sched_endtime as string)) as number;
|
|
calc_schHR := (substring (sched_minPOS as number) characters from (sched_endtime as string)) as number;
|
|
calc_schMIN_Seconds := calc_schMIN * 60;
|
|
calc_schHR_Seconds := (calc_schHR * 60) * 60;
|
|
calc_startDTTM_IBU := (((StDateValue_Toradol + 86400 seconds) + calc_schMIN_Seconds seconds) + calc_schHR_seconds seconds) + 21600 seconds;
|
|
endif;
|
|
|
|
format_hr := extract hour calc_startDTTM_IBU;
|
|
if format_hr < 10 then
|
|
format_hr := "0" || format_hr;
|
|
endif;
|
|
|
|
format_min := extract minute calc_startDTTM_IBU;
|
|
if format_min < 10 then
|
|
format_min := "0" || format_min;
|
|
endif;
|
|
IBU_date_extract := (extract month calc_startDTTM_IBU) || "-" || (extract day calc_startDTTM_IBU) || "-" || (extract year calc_startDTTM_IBU);
|
|
IBU_time_extract := format_hr || ":" || format_min;
|
|
|
|
StTimeValue_IBU.ReqTimeCode := "Scheduled/Start Time";
|
|
StTimeValue_IBU.ReqTimeValue := IBU_time_extract;
|
|
StartDate_IBU.Value := calc_startDTTM_IBU;
|
|
|
|
|
|
endif; // Close Section
|
|
|
|
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;
|
|
|
|
|
|
;;
|
|
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:
|