Initial Checking with all 820 MLMs
This commit is contained in:
311
MLMStripper/bin/Debug/FORM/FORM_MED_IRREG_SCHED.mlm
Normal file
311
MLMStripper/bin/Debug/FORM/FORM_MED_IRREG_SCHED.mlm
Normal file
@@ -0,0 +1,311 @@
|
||||
maintenance:
|
||||
|
||||
title: Med With Irregular Sshedule;;
|
||||
mlmname: FORM_MED_Irreg_Sched;;
|
||||
arden: version 2;;
|
||||
version: 4.50;;
|
||||
institution: St Clair Isolation Set MLM;;
|
||||
author: Eclipsys Corp;;
|
||||
specialist: Mary Jo Goodwin ;;
|
||||
date: 2007-01-03;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: If {{{SINGLE-QUOTE}}}Irregular Schedule{{{SINGLE-QUOTE}}} is selected then populate {{{SINGLE-QUOTE}}}RequestedDTM{{{SINGLE-QUOTE}}}
|
||||
with Date and time of earliest date/time in the Schedule
|
||||
|
||||
;;
|
||||
|
||||
explanation: This MLM is called from the medication form selects the frequency {{{SINGLE-QUOTE}}}Irregular Schedule{{{SINGLE-QUOTE}}}
|
||||
|
||||
The Schedule will be reviewed and the earliest date/time identified.
|
||||
This date/time will be put in to the RequestedDTM field using the {{{SINGLE-QUOTE}}}Scheduled/Start Time{{{SINGLE-QUOTE}}} option.
|
||||
|
||||
Change History
|
||||
|
||||
02/09/2010 RS: Changes made to call FORM_NOW_AND_THEN
|
||||
01.30.2013 TMS Added logic to one time frequencies to make start now option not selectable.
|
||||
03.05.2013 TMS Added logic to use Rx instructions and Rx Comments to transfer "patient friendly"
|
||||
instructions for User schedule and with meal frequencies for Orders reconciliation.
|
||||
CSR 31322
|
||||
04.15.2013 TMS Added logic to append (Humalog or Novolog) after Insulin Aspart orders after any
|
||||
frequency dialog added to Rx Comments and Rx Instructions for Med Rec. CSR 31323
|
||||
08.12.2013 TMS Commented out all logic from 3.5.2013 and 4.15.2013 for ORM instructions and moved
|
||||
to MLM {{{SINGLE-QUOTE}}}FORM_RX_ORM_INSTRUCT{{{SINGLE-QUOTE}}} to enable one MLM to add frequency, synonym, route,
|
||||
and medication indication to RX Comment and Instruction field for ORM. CSR 31639
|
||||
08.12.2013 TMS Commented out all logic from 3.5.2013 and 4.15.2013 for ORM instructions and moved
|
||||
to MLM {{{SINGLE-QUOTE}}}FORM_RX_ORM_INSTRUCT{{{SINGLE-QUOTE}}} to enable one MLM to add frequency, synonym, route,
|
||||
and medication indication to RX Comment and Instruction field for ORM. CSR 31639
|
||||
10.8.2013 TMS CSR Added additional frequencies (Variable and QxM) to not all now and then
|
||||
functionality to be selectable CSR 26926
|
||||
12.17.2013 STH CSR #: 31706 Update MLM to remove STAT Start Time if a frequency other than STAT is selected.
|
||||
02.21.2013 TMS Added logic for Stat/Then Orders. Updated Now/Then orders to use Total Doses UDDI that
|
||||
populates StopAfter field with appropriate number. CSR 31883
|
||||
06.17.2014 DW CSR# 32133 Added call to Automatic Medication Scheduling mlm
|
||||
05.16.2018 TMS CSR 33940: Add "With Dialysis Treatment" to all logic that contain As Ordered.
|
||||
|
||||
;;
|
||||
keywords: Called MLMs, Form fields, Irregular Schedule
|
||||
;;
|
||||
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;
|
||||
|
||||
PrimaryObjdetail:=this_communication.PrimaryObj;
|
||||
session_type := PrimaryObjdetail.internalprocessingtype;
|
||||
/*******************Make Changes To Spelling And Flags In This Section*******************/
|
||||
|
||||
/* These variables must containt he same wording as the options in the drop down list */
|
||||
|
||||
/***************************************************************************************/
|
||||
|
||||
// Initialize error message
|
||||
error_message:="";
|
||||
|
||||
// References the LOCAL SESSION object
|
||||
local_session := cds_session.local;
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
|
||||
// Obtain fields passed in the Form object to the Field object
|
||||
field_list:= this_form.fields;
|
||||
requested_date := last of (field_list where field_list.DataItemName = "RequestedDate" );
|
||||
requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" );
|
||||
stop_after:= last of (field_list where field_list.DataItemName = "StopAfter" );
|
||||
stop_after_Value := stop_after.value;
|
||||
stop_date := last of (field_list where field_list.DataItemName = "StopDate" );
|
||||
stop_time := last of (field_list where field_list.DataItemName = "StopTime" );
|
||||
stop_time_value := stop_time.value ;
|
||||
is_prn := last of (field_list where field_list.DataItemName = "IsPRN" );
|
||||
regular_freq := last of (field_list where field_list.DataItemName = "FrequencyCode");
|
||||
requested_time_value := requested_time.value;
|
||||
regular_freq_value := regular_freq.value;
|
||||
start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
|
||||
start_now_value := start_now.value;
|
||||
stat_then := first of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then");
|
||||
stat_then_value := stat_then.value;
|
||||
TotalDosing := first of ( field_list WHERE field_list.DataItemName = "PRX_Dosing Total Doses");
|
||||
TotalDosing_value := TotalDosing.value;
|
||||
RX_Comments_field := last of (field_list where field_list.DataItemName = "Rx Comments");
|
||||
RX_Instructions_field := last of (field_list where field_list.DataItemName = "Rx Instructions");
|
||||
FreqText := " ";
|
||||
|
||||
CallingEvent := this_communication.CallingEvent;
|
||||
CallingField := this_communication.CallingFieldName;
|
||||
|
||||
PrimaryObjdetail:=this_communication.PrimaryObj;
|
||||
OrderName := PrimaryObjdetail.name;
|
||||
|
||||
RX_Comments_field_value := RX_Comments_field.value;
|
||||
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
||||
AutoMedScheduling := MLM {{{SINGLE-QUOTE}}}FORM_Antibiotic_Scheduling{{{SINGLE-QUOTE}}};
|
||||
FreqTranslate := ();
|
||||
FreqTranslate := read { "select value from cv3userdictionaryvalue v with (nolock)"
|
||||
|| " where userdictionarycode = {{{SINGLE-QUOTE}}}PRX_ORM Frequency Translation{{{SINGLE-QUOTE}}} "
|
||||
|| " and active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
|
||||
};
|
||||
|
||||
If CallingEvent = "FieldChange" and CallingField = "FrequencyCode" then
|
||||
|
||||
(this_communication, this_form, client_info_obj) := call AutoMedScheduling
|
||||
with (this_communication, this_form, client_info_obj);
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// if the frequency is {{{SINGLE-QUOTE}}}As Ordered{{{SINGLE-QUOTE}}} or {{{SINGLE-QUOTE}}}With Dialysis Treatment{{{SINGLE-QUOTE}}} then PRN is is mandatory
|
||||
If (regular_freq_value.FrequencySummary = "As Ordered" or regular_freq_value.FrequencySummary = "With Dialysis Treatment") then
|
||||
is_prn.control_read_only := TRUE;
|
||||
is_prn.value := TRUE;
|
||||
else
|
||||
is_prn.control_read_only := FALSE;
|
||||
endif;
|
||||
|
||||
// if One time frequency is ordered disable stat/then, now/then and stop after
|
||||
If (regular_freq_value.FrequencySummary = "STAT") or
|
||||
(regular_freq_value.FrequencySummary = "NOW") or
|
||||
(regular_freq_value.FrequencySummary = "ONCE") or
|
||||
(regular_freq_value.FrequencySummary = "One Time") or
|
||||
(regular_freq_value.FrequencySummary = "Today") or
|
||||
(regular_freq_value.FrequencySummary = "Pre-Transfusion") or
|
||||
(regular_freq_value.FrequencySummary = "Pre-Procedure") or
|
||||
// (regular_freq_value.FrequencySummary = "PRE OP") or
|
||||
(regular_freq_value.FrequencySummary = "Post-Transfusion") or
|
||||
(regular_freq_value.FrequencySummary = "Post-Procedure") or
|
||||
// (regular_freq_value.FrequencySummary = "POST OP") or
|
||||
(regular_freq_value.FrequencySummary = "Per-Protocol") or
|
||||
(regular_freq_value.FrequencySummary = "Between Blood") or
|
||||
(regular_freq_value.FrequencySummary = "As Ordered") or
|
||||
(regular_freq_value.FrequencySummary = "Given in Delivery Room") or
|
||||
(regular_freq_value.FrequencySummary = "Given in Infusion Center") or
|
||||
(regular_freq_value.FrequencySummary = "Given in NSY") or
|
||||
(regular_freq_value.FrequencySummary = "Load") or
|
||||
(regular_freq_value.FrequencySummary = "With Dialysis Treatment") or
|
||||
(regular_freq_value.FrequencySummary = "As-Directed")
|
||||
then
|
||||
|
||||
stop_after.control_read_only := True;
|
||||
stop_after_Value.Number := 0;
|
||||
|
||||
stop_after_Value.Option := NULL;
|
||||
stop_time.value := NULL;
|
||||
start_now.value := False;
|
||||
start_now.control_read_only := True;
|
||||
stat_then.value := False;
|
||||
stat_then.control_read_only := True;
|
||||
|
||||
|
||||
// if frequency is stat make priority stat
|
||||
If (regular_freq_value.FrequencySummary = "STAT") then
|
||||
requested_time_value.ReqTimeValue := NULL;
|
||||
requested_time_value.ReqTimeCode := "STAT";
|
||||
endif;
|
||||
|
||||
stop_date.value := NULL;
|
||||
stop_date.control_read_only :=True;
|
||||
stop_time.control_read_only :=True;
|
||||
TotalDosing.value := NULL;
|
||||
TotalDosing.control_read_only := True;
|
||||
|
||||
// added 11-25-2013 tms
|
||||
elseIf
|
||||
(regular_freq_value.FrequencySummary = "PRE OP") or
|
||||
(regular_freq_value.FrequencySummary = "POST OP")
|
||||
then
|
||||
|
||||
start_now.value := False;
|
||||
start_now.control_read_only := True;
|
||||
stat_then.value := False;
|
||||
stat_then.control_read_only := True;
|
||||
stop_date.value := NULL;
|
||||
stop_date.control_read_only :=True;
|
||||
stop_time.control_read_only :=True;
|
||||
stop_after.control_read_only := False;
|
||||
|
||||
// end add 11-25-2013 tms
|
||||
// disable stat/then, now/then for variable interval and QxM frequencies
|
||||
elseif
|
||||
|
||||
(regular_freq_value.FrequencySummary = "<Variable Interval>") or
|
||||
(regular_freq_value.FrequencySummary = "<QxM>")
|
||||
|
||||
then
|
||||
start_now.value := False;
|
||||
start_now.control_read_only := True;
|
||||
stat_then.value := False;
|
||||
stat_then.control_read_only := True;
|
||||
TotalDosing.value := NULL;
|
||||
TotalDosing.control_read_only := True;
|
||||
|
||||
// disable stat/then, now/then for Hold session orders
|
||||
elseif
|
||||
session_type = "Hold"
|
||||
then
|
||||
stop_date.control_read_only :=False;
|
||||
stop_time.control_read_only :=False;
|
||||
stop_after.control_read_only := False;
|
||||
start_now.control_read_only := True;
|
||||
stat_then.control_read_only := True;
|
||||
TotalDosing.value := NULL;
|
||||
TotalDosing.control_read_only := True;
|
||||
|
||||
else
|
||||
|
||||
stop_date.control_read_only :=False;
|
||||
stop_time.control_read_only :=False;
|
||||
stop_after.control_read_only := False;
|
||||
|
||||
If start_now.value = true or stat_then.value = true then
|
||||
stop_after.control_read_only := True;
|
||||
TotalDosing.control_read_only := False;
|
||||
else
|
||||
stop_after.control_read_only := False;
|
||||
TotalDosing.control_read_only := True;
|
||||
endif;
|
||||
start_now.control_read_only := False;
|
||||
stat_then.control_read_only := False;
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
// if the frequency is {{{SINGLE-QUOTE}}}User Schedule{{{SINGLE-QUOTE}}} then PRN, stat/then, now/then is not available
|
||||
If regular_freq_value.FrequencySummary = "<User Schedule>" then
|
||||
is_prn.control_visible := FALSE;
|
||||
start_now.control_read_only := True;
|
||||
start_now.value := False;
|
||||
stat_then.value := False;
|
||||
stat_then.control_read_only := True;
|
||||
TotalDosing.value := NULL;
|
||||
TotalDosing.control_read_only := True;
|
||||
|
||||
else
|
||||
|
||||
is_prn.control_visible := TRUE;
|
||||
|
||||
endif;
|
||||
|
||||
If (regular_freq_value.FrequencySummary <> "STAT")and (requested_time_value.ReqTimeCode = "STAT")
|
||||
then
|
||||
requested_time_value.ReqTimeValue := NULL;
|
||||
requested_time_value.ReqTimeCode := NULL;
|
||||
endif;
|
||||
|
||||
// if the frequency is {{{SINGLE-QUOTE}}}User Schedule{{{SINGLE-QUOTE}}} and selection is {{{SINGLE-QUOTE}}}Irregular Schedule{{{SINGLE-QUOTE}}} then make requestedDTM = beginning dtm
|
||||
If regular_freq_value.FrequencySummary = "<User Schedule>" AND regular_freq_value.FreqUOM = "irregular"
|
||||
then
|
||||
|
||||
// obtain a list of the scheduled dates and times
|
||||
freq_schedules := regular_freq_value.FreqIrregularDtm;
|
||||
|
||||
// find the earliest scheduled time
|
||||
earliest_time := minimum of freq_schedules;
|
||||
|
||||
// extract the time from the date_time
|
||||
sched_hour := EXTRACT HOUR(earliest_time);
|
||||
sched_minute := EXTRACT MINUTE(earliest_time);
|
||||
sched_time := sched_hour || ":" || sched_minute;
|
||||
|
||||
// Put values on to form
|
||||
requested_time_value.ReqTimeCode := "Scheduled/Start Time";
|
||||
requested_time_value.ReqTimeValue := sched_time;
|
||||
requested_date.value := earliest_time;
|
||||
|
||||
// in memory set flag indicating irregular schedule set the Requesteddtm
|
||||
local_session.irreg_sched := TRUE;
|
||||
|
||||
else
|
||||
// if REquesteddtm was set by user selecting {{{SINGLE-QUOTE}}}irregular schedule{{{SINGLE-QUOTE}}} MLM then clear date
|
||||
if local_session.irreg_sched = TRUE
|
||||
then
|
||||
// Put values on to form
|
||||
requested_time_value.ReqTimeCode := NULL;
|
||||
requested_time_value.ReqTimeValue := NULL;
|
||||
requested_date.value := NULL;
|
||||
endif;
|
||||
|
||||
// in memory set flag indicating irregular schedule din NOTset the Requesteddtm
|
||||
local_session.irreg_sched := FALSE;
|
||||
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