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

143 lines
4.1 KiB
Plaintext

maintenance:
title: Form_Switch_Diluent;;
mlmname: Form_Switch_Diluent;;
arden: version 2.5;;
version: 16.3;;
institution: St. Clair Hospital;;
author: Teresa M. Spicuzza ;;
specialist: Teresa M. Spicuzza ;;
date: 2017-08-07;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
08.07.2017 TMS Initial build MLM allows user to switch between D5W and NSS by selecting checkbox on form. CSR 33563
;;
keywords:
Diluent, Base Solution;
;;
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;
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
comm_obj := this_communication.primaryobj;
called_by := this_communication.CallingEvent;
call_field := this_communication.CallingFieldName;
if called_by_editor then
client_guid := "9000001369400200";
visit_guid := visit_obj.GUID;
chart_guid := "9000001918900170";
orderId := "1000002689073001";
called_by := "FormOpen";
else
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGuid;
orderid := this_comm.ItemID;
endif;
//Initialize MLM pointers:
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
// Define fields
BaseSolution_obj := OBJECT [Name, ItemID, Dose, UOM, OrderCatalogMasterItemGUID];
BaseSolution_field := first of (field_list where field_list.DataItemName = "BASESOLUTION");
If exists BaseSolution_field then
BaseSolution_value := BaseSolution_field.value;
BaseSolution_name := BaseSolution_field.name;
BaseSolution_dose := BaseSolution_field.dose;
BaseSolution_uom := BaseSolution_field.uom;
endif;
MLMfromOrderSet := last of (field_list where field_list.DataItemName = "MLM_From Order Set");
SwapDiluent := first of (field_list where field_list.DataItemName = "PRX_ResetDiluent");
if (call_field = "PRX_ResetDiluent" and called_by = "FieldChange") then
solution_map_list :=(
// Old Base Soln|New Base Solution|Vol|UOM
"D5W 50ml .|0.9% NaCl 50ml .|50|mL",
"D5W 100ml .|0.9% NaCl 100ml .|100|mL",
"D5W 250ml .|0.9% NaCl 250ml .|250|mL",
"D5W 500ml .|0.9% NaCl 500ml|500|mL",
// "D5W 500ml .|0.9% NaCl 500ml .|500|mL",
"D5W .|0.9% NaCl .||",
"0.9% NaCl 50ml .|D5W 50ml .|50|mL",
"0.9% NaCl 100ml .|D5W 100ml .|100|mL",
"0.9% NaCl 250ml .|D5W 250ml .|250|mL",
"0.9% NaCl 500ml|D5W 500ml .|500|mL",
"0.9% NaCl 500ml .|D5W 500ml .|500|mL",
"0.9% NaCl .|D5W .||"
);
for m in 1 seqto count solution_map_list do
soln_element_list := call str_parse with solution_map_list[m], "|";
Old_Soln := soln_element_list[1];
New_Soln := soln_element_list[2];
New_Vol := soln_element_list[3];
New_UOM := soln_element_list[4];
New_Vol_value := (New_Vol as number);
If BaseSolution_value.name = Old_Soln then
If BaseSolution_value.dose is null then
New_Solution_Dose := New_Vol_value;
New_Solution_UOM := New_Uom;
else
New_Solution_Dose := BaseSolution_value.dose;
New_Solution_UOM := BaseSolution_value.UOM ;
endif;
New_Solution_Value := new_soln;
endif;
enddo; /* for i in 1 seqto count solution_map_list do */
BaseSolution_value.name := New_Solution_Value;
BaseSolution_value.dose := New_Solution_Dose as number;
BaseSolution_value.UOM := New_Solution_UOM;
SwapDiluent.value := False;
endif;
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns two parameters, of types
//communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end: