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

375 lines
12 KiB
Plaintext

maintenance:
title: Alcohol Withdrawal Protocol Orders;;
mlmname: FORM_Set_AWP;;
arden: version 2.5;;
version: 5.50;;
institution: St Clair Hospital;;
author: Teresa Spicuzza, Allscripts ;;
specialist: Teresa Spicuzza, Allscripts;;
date: 2011-09-20;;
validation: testing;;
library:
purpose: Used for - Alcohol Withdrawal Protocol
;;
explanation: This MLM is called from ... Alcohol Withdrawal Protocol Orderset
Change history
09.20.2011 TMS Copy of ED Admit AWP with coding added to schedule Ativan orders when ordered on Nurse Unit.
01.20.2012 TMS Added logic to schedule correct day when start time between 18:00 and 22:00 HD Ticket 146364
04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
;;
keywords: Called MLMs, Lab Grids on Order Sets, Alcohol Withdrawal Protocol
;;
knowledge:
type: data-driven;;
data:
// Use String parse
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// 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;
/***************************************************************************************/
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
RequestedTime_obj := OBJECT [ReqTimeCode, RegTimeValue, ReqTimeUOM,
ReqTimeEventModifier, ReqTimeEventCode];
//Get the multi order grid check box value
Checkbox_fld := last of (field_list where field_list.DataItemName = "PRX_Checkbox1");
// and field_List.Control_MultiFieldOccNum = 1);
Ativan_grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
and field_List.Control_MultiFieldOccNum = 64);
Ativan_list :=Ativan_grid.Value;
Ativan_SelList := Ativan_List.IsSelected;
Other_Med_Grid:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 66);
Other_Med_list := Other_Med_Grid.Value;
Nurse_Inst_Grid:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 48);
Nurse_Inst_List := Nurse_Inst_Grid.Value;
Day1reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 1);
Day2reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 2);
Day3reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 3);
Day4reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 4);
Day5reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 5);
Day6reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
and field_List.Control_MultiFieldOccNum = 6);
Day1reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 1);
Day2reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 2);
Day3reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 3);
Day4reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 4);
Day5reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 5);
Day6reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
and field_List.Control_MultiFieldOccNum = 6);
If exists Day1reqtime then ReqTimeValue := Day1reqtime.Value;
// Found_DeSelect:= First of (Grid_list where Grid_list.Name = DeSelect );
If CallingEvent = "FieldChange" Then
If Callingfield = "PRX_Checkbox1|1" then
If Checkbox_fld.Value = False then
ListMembs:= count Ativan_SelList;
FalseList := ();
for k in (1 seqto ListMembs) do
FalseList := FalseList,False;
enddo;
Ativan_List.IsSelected:= FalseList;
ReqTimeValue.ReqTimeCode := NULL;
Day6reqtimeValue.ReqTimeCode := NULL;
endif;
//
If Checkbox_fld.Value = False then
InstMembs:= count Nurse_Inst_List;
schedlist:= (True, False, False);
p:=4;
for p in (4 seqto InstMembs) do
schedlist := schedlist, Nurse_Inst_List.isselected [p];
enddo;
Nurse_Inst_List.IsSelected := schedlist;
endif;
//
If Checkbox_fld.Value = True then
ListMembs:= count Ativan_SelList;
TrueList := ();
for k in (1 seqto ListMembs) do
TrueList := TrueList,True;
enddo;
Ativan_List.IsSelected:= TrueList;
endif;
//
If Checkbox_fld.Value = True then
InstMembs:= count Nurse_Inst_List;
schedlist:= (True, True, True);
p:=4;
for p in (4 seqto InstMembs) do
schedlist := schedlist, Nurse_Inst_List.isselected [p];
enddo;
Nurse_Inst_List.IsSelected := schedlist;
endif;
//
If Checkbox_fld.Value = True then
// If exists Day1reqtime then
// ReqTimeValue := Day1reqtime.Value;
ReqTimeValue.ReqTimeCode := "Scheduled/Start Time";
endif;
endif;
//
endif;
endif;
If CallingField = "RequestedTime|1" or CallingField = "RequestedDate|1" then
StartDate := day1reqdate.value;
StartTime := Day1reqtime.value;
StartTime_code := starttime.reqtimecode;
StartTime_value := starttime.reqtimevalue;
ParseTime_list := call str_parse with StartTime_value, ":";
hourvalue := first(ParseTime_list);
minvalue := last(ParseTime_list);
q6hour := StartTime_Value;
q8hour := (hourvalue as number) + 2;
if q8hour >= 24 then q8hour := q8hour - 24; endif;
if q8hour < 10 then q8hour := "0" || q8hour; endif;
q8hour := q8hour || ":" || minvalue;
q12hour := (hourvalue as number) + 6;
if q12hour >= 24 then q12hour := q12hour - 24; endif;
if q12hour < 10 then q12hour := "0" || q12hour; endif;
q12hour := q12hour || ":" || minvalue;
/* //changed to logic below to address issue with start times between 18:00 and 21:00
If starttime_value >= "22:00" then skipday := "true";
day2reqdate.value := startdate + 1 day;
day3reqdate.value := startdate + 2 day;
day4reqdate.value := startdate + 3 day;
day5reqdate.value := startdate + 5 day;
day6reqdate.value := startdate + 6 day;
else skipday := false;
day2reqdate.value := startdate + 1 day;
day3reqdate.value := startdate + 2 day;
day4reqdate.value := startdate + 3 day;
day5reqdate.value := startdate + 4 day;
day6reqdate.value := startdate + 5 day;
endif;
*/
If starttime_value >= "18:00" then
If starttime_value < "22:00" then
day2reqdate.value := startdate + 1 day;
day3reqdate.value := startdate + 2 day;
day4reqdate.value := startdate + 3 day;
day5reqdate.value := startdate + 4 day;
day6reqdate.value := startdate + 6 day;
else
day2reqdate.value := startdate + 1 day;
day3reqdate.value := startdate + 2 day;
day4reqdate.value := startdate + 3 day;
day5reqdate.value := startdate + 5 day;
day6reqdate.value := startdate + 6 day;
endif;
else
day2reqdate.value := startdate + 1 day;
day3reqdate.value := startdate + 2 day;
day4reqdate.value := startdate + 3 day;
day5reqdate.value := startdate + 4 day;
day6reqdate.value := startdate + 5 day;
endif;
Day2reqtimeValue := Day2reqtime.Value;
Day2reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
Day2reqtimeValue.ReqTimeValue := q6hour;
Day3reqtimeValue := Day3reqtime.Value;
Day3reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
Day3reqtimeValue.ReqTimeValue := q6hour;
Day4reqtimeValue := Day4reqtime.Value;
Day4reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
Day4reqtimeValue.ReqTimeValue := q6hour;
Day5reqtimeValue := Day5reqtime.Value;
Day5reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
Day5reqtimeValue.ReqTimeValue := q8hour;
Day6reqtimeValue := Day6reqtime.Value;
Day6reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
Day6reqtimeValue.ReqTimeValue := q12hour;
endif;
/*
// Found_DeSelect:= First of (Grid_list where Grid_list.Name = DeSelect );
If CallingEvent = "FieldChange" Then
If Callingfield = "PRX_Checkbox1|1" then
If Checkbox_fld.Value = False then
ListMembs:= count Ativan_SelList;
FalseList := ();
for k in (1 seqto ListMembs) do
FalseList := FalseList,False;
enddo;
Ativan_List.IsSelected:= FalseList;
endif;
//
If Checkbox_fld.Value = False then
InstMembs:= count Nurse_Inst_List;
schedlist:= (True, False, False);
p:=4;
for p in (4 seqto InstMembs) do
schedlist := schedlist, Nurse_Inst_List.isselected [p];
enddo;
Nurse_Inst_List.IsSelected := schedlist;
endif;
//
If Checkbox_fld.Value = True then
ListMembs:= count Ativan_SelList;
TrueList := ();
for k in (1 seqto ListMembs) do
TrueList := TrueList,True;
enddo;
Ativan_List.IsSelected:= TrueList;
endif;
//
If Checkbox_fld.Value = True then
InstMembs:= count Nurse_Inst_List;
schedlist:= (True, True, True);
p:=4;
for p in (4 seqto InstMembs) do
schedlist := schedlist, Nurse_Inst_List.isselected [p];
enddo;
Nurse_Inst_List.IsSelected := schedlist;
If exists Day1reqtime then
Day1reqtimeValue := Day1reqtime.Value;
Day1reqtimeValue.ReqTimeCode := "Scheduled/Start Time"; endif;
endif;
//
endif;
endif; */
If CallingField = "MultiOrderGrid|66" and CallingEvent = "FieldChange" Then
blocklist2 := (False, False, False);
blocklist3 := (False, False);
truelist2 := (False, False, False);
truelist3 := (False, False);
If Other_Med_list.IsSelected [1] = true
then truelist2 := (True, False, False);
blocklist2 := (False, True, True);
endif;
If
Other_Med_list.IsSelected [2] = true
then truelist2 := (False, True, False);
blocklist2 := (True, False, True);
endif;
If
Other_Med_list.IsSelected [3] = true
then truelist2 := (False, False, True);
blocklist2 := (True, True, False);
endif;
If Other_Med_list.IsSelected [4] = true
then truelist3 := (True, False);
blocklist3 := (False, True);
endif;
If Other_Med_list.IsSelected [5] = true
then truelist3 := (False, True);
blocklist3 := (True, False);
endif;
blocklistA:= blocklist2, blocklist3;
truelistA:= truelist2, truelist3;
r:=6;
listother := count Other_Med_list;
for r in (6 seqto listother) do
truelistA := truelistA, other_med_list.isselected [r];
blocklistA := blocklistA, false;
enddo;
Other_Med_list.IsSelected := truelistA;
Other_Med_list.IsReadOnly := blocklistA;
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;
//dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Other_med_list: "||Other_Med_list.IsSelected ||"\n truelist2: "|| truelist2 ||"\n Value of r: "|| r ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
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:', N'8a189793-bc89-48b9-8d3f-670bc7bedebc', 2, N'Alcohol Withdrawal Protocol Orders', N'2.5', N'5.50', CAST(N'2011-09-20T00:00:00.000' AS DateTime), NULL)