Initial Checking with all 820 MLMs
This commit is contained in:
@@ -0,0 +1,249 @@
|
||||
maintenance:
|
||||
|
||||
title: FORM_Set_AcetaminophenInj_with_AcetaminophenCaplet;;
|
||||
mlmname: FORM_Set_AcetaminophenInj_with_AcetaminophenCaplet;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Allscripts ;;
|
||||
specialist: Allscripts;;
|
||||
date: 2013-11-29;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: schedule AcetaminophenCaplet for 6 hours after last dose of AcetaminophenInj
|
||||
;;
|
||||
|
||||
explanation: This MLM is called from the Total Hip Replacement Post op Set and Total knee Replacement Post op Set
|
||||
|
||||
02.03.2014 STH Trackit Ticket #: 163421 correct issue with Hold session
|
||||
2016.04.26 TMS CSR 33465: Add call on Form Close to Medication Order Management MLM
|
||||
2017-04-12 STH CSR #35293: Correct issues with timing of ordering when the hours or minutes are in the 0# format (e.g. 04 hour or 04 minute).
|
||||
Also had to change the formatting of the oral Acetaminophen as someone changed the spacing of the drug name causing this MLM not to work.
|
||||
2014-09-28 TMS CSR #35222 Upadated MLM to include Acetaminophen Extra Strength Tab 500mg to allow use of MLM on Post Op Colon Resection order set. Changed all variable names
|
||||
with reference to ibuprofen and toradol to tylenol and ofirmev to reduce confusion within logic.
|
||||
;;
|
||||
keywords: Called MLMs, Total Hip Replacement Post op Set , AcetaminophenInj,Total knee Replacement Post op Set
|
||||
Called from : Foot and Ankle Post Op Orders; Fractured Hip Post Op Orders; Total Hip Replacement Post Op Orders; Total Knee Replacement Post Op Orders and Post Op Colon Resection
|
||||
;;
|
||||
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:="";
|
||||
userguid := this_communication.userguid;
|
||||
|
||||
field_list := this_form.fields;
|
||||
CallingEvent := this_communication.CallingEvent;
|
||||
itemnames := field_list.value.name;
|
||||
|
||||
ofirmev_selected:= false;
|
||||
Tylenol_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 ("Acetaminophen Inj" in itemnames) or ("Acetaminophen Caplet 325mg" in itemnames) or ("Acetaminophen Extra Strength Tab 500mg" in itemnames) then
|
||||
for j in (1 seqto count(itemnames)) do
|
||||
if itemnames[j] = "Acetaminophen Inj" and selected[j] = true then
|
||||
ofirmev_selected:= true;
|
||||
endif;
|
||||
if (itemnames[j] = "Acetaminophen Caplet 325mg" and selected[j] = true) or (itemnames[j] = "Acetaminophen Extra Strength Tab 500mg" and selected[j] = true) then
|
||||
Tylenol_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 ofirmev_selected = true and Tylenol_selected = true Then
|
||||
|
||||
|
||||
freqOccNum := sort Data freqOccNum;
|
||||
RequestedDateOccNum := sort data RequestedDateOccNum;
|
||||
RequestedTimeOccNum := sort data RequestedTimeOccNum;
|
||||
|
||||
FrequencyCode_Ofirmev := first of (field_list where field_list.DataItemName = "FrequencyCode" and field_List.Control_MultiFieldOccNum = freqOccNum[1]);
|
||||
StartDate_Ofirmev := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = RequestedDateOccNum[2]); //jp , was 1
|
||||
StartTime_Ofirmev := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = RequestedTimeOccNum[1]);
|
||||
|
||||
StartDate_Tylenol := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = RequestedDateOccNum[3]); //jp, was 2
|
||||
StartTime_Tylenol := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = RequestedTimeOccNum[2]);
|
||||
FreqCodeValue_Ofirmev := FrequencyCode_Ofirmev.value.FrequencySummary;
|
||||
StDateValue_Ofirmev := StartDate_Ofirmev.value;
|
||||
StTimeValue_Ofirmev := StartTime_Ofirmev.value;
|
||||
StTimeValue_Tylenol := StartTime_Tylenol.value;
|
||||
|
||||
z := StartDate_Ofirmev.Records__;
|
||||
//
|
||||
|
||||
|
||||
//begin-section added by STH for hold session issue 1-29-2014
|
||||
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_Ofirmev ;
|
||||
TLocation := FIND "T" IN STRING StDateValue_Ofirmev ;
|
||||
|
||||
If TLocation = 1 and PlusLocation = 0 then
|
||||
StDateValue_Ofirmev := (now as time);
|
||||
StTimeValue_Ofirmev.ReqTimeCode := "Scheduled/Start Time";
|
||||
StTimeValue_Ofirmev.ReqTimeValue := THR || ":" || TMN;
|
||||
endif;
|
||||
|
||||
If PlusLocation > 0 then
|
||||
PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF StDateValue_Ofirmev FROM StDateValue_Ofirmev ;
|
||||
StDateValue_Ofirmev := (now as time) + (PlusDays as number) day;
|
||||
StTimeValue_Ofirmev.ReqTimeCode := "Scheduled/Start Time";
|
||||
StTimeValue_Ofirmev.ReqTimeValue := THR || ":" || TMN;
|
||||
endif;
|
||||
//end-section added by STH for hold session issue 1-29-2014
|
||||
|
||||
ReqTimeCode_Ofirmev := StTimeValue_Ofirmev.ReqTimeCode;
|
||||
|
||||
SchHour_Ofirmev:= substring 2 characters from StTimeValue_Ofirmev.ReqTimeValue as number;
|
||||
SchMin_Ofirmev := substring 2 characters starting at 4 from StTimeValue_Ofirmev.ReqTimeValue;
|
||||
|
||||
if (ReqTimeCode_Ofirmev = "Scheduled/Start Time") then
|
||||
HR := SchHour_Ofirmev;
|
||||
MN := SchMin_Ofirmev;
|
||||
else
|
||||
HR := Extract Hour NOW;
|
||||
MN := Extract Minute Now;
|
||||
endif;
|
||||
|
||||
if HR < 10 then
|
||||
HR := "0" || HR;
|
||||
//HR := HR as number;
|
||||
endif;
|
||||
|
||||
if MN < 10 then
|
||||
MN := "0" || MN;
|
||||
//MN := MN as number;
|
||||
endif;
|
||||
|
||||
|
||||
HR_seconds := (60 * (HR as number)) * 60;
|
||||
MN_Seconds := (MN as number) * 60;
|
||||
Calc_starttime_Ofirmev := ((StDateValue_Ofirmev + (HR_seconds seconds)) + (MN_Seconds seconds));
|
||||
Freq_length := length of FreqCodeValue_Ofirmev as number;
|
||||
freq_endposition := freq_length;
|
||||
begin_freq := substring 1 characters from FreqCodeValue_Ofirmev as string;
|
||||
end_freq := substring 1 characters starting at freq_endposition from FreqCodeValue_Ofirmev as string;
|
||||
|
||||
if begin_freq = "Q" then
|
||||
Freqnum_Ofirmev := Freq_length - 2;
|
||||
Schnum_Ofirmev := substring Freqnum_Ofirmev characters starting at 2 from FreqCodeValue_Ofirmev;
|
||||
endif;
|
||||
|
||||
schnum_Ofirmev := schnum_Ofirmev as number;
|
||||
|
||||
if (end_freq = "M") then
|
||||
calc_schnum_seconds := (((86400 / (60 * schnum_Ofirmev)) - 1) * (60 * schnum_Ofirmev)); //take the minutes times 60 to get the seconds, divide that
|
||||
elseif (end_freq = "H") then
|
||||
calc_schnum_seconds := ((((24 / schnum_Ofirmev)-1) * schnum_Ofirmev) * 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_Ofirmev)
|
||||
|| " 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_Ofirmev = "Scheduled/Start Time") then
|
||||
calc_startDTTM_Tylenol := (Calc_starttime_Ofirmev + 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_Tylenol := (((StDateValue_Ofirmev + 86400 seconds) + calc_schMIN_Seconds seconds) + calc_schHR_seconds seconds) + 21600 seconds;
|
||||
endif;
|
||||
|
||||
format_hr := extract hour calc_startDTTM_Tylenol;
|
||||
if format_hr < 10 then
|
||||
format_hr := "0" || format_hr;
|
||||
endif;
|
||||
|
||||
format_min := extract minute calc_startDTTM_Tylenol;
|
||||
if format_min < 10 then
|
||||
format_min := "0" || format_min;
|
||||
endif;
|
||||
Tylenol_date_extract := (extract month calc_startDTTM_Tylenol) || "-" || (extract day calc_startDTTM_Tylenol) || "-" || (extract year calc_startDTTM_Tylenol);
|
||||
Tylenol_time_extract := format_hr || ":" || format_min;
|
||||
|
||||
StTimeValue_Tylenol.ReqTimeCode := "Scheduled/Start Time";
|
||||
StTimeValue_Tylenol.ReqTimeValue := Tylenol_time_extract;
|
||||
StartDate_Tylenol.Value := calc_startDTTM_Tylenol;
|
||||
|
||||
|
||||
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:
|
||||
Reference in New Issue
Block a user