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

109 lines
3.2 KiB
Plaintext

maintenance:
title: FORM_RX_NEONATAL_MORPHINE_LABEL ;;
mlmname: FORM_RX_NEONATAL_MORPHINE_LABEL;;
arden: version 2.5;;
version: 1.00;;
institution: St.Clair Hospital ;;
author: Sandy Zhang ;;
specialist: Sandy Zhang ;;
date: 2017-07-31;;
validation: testing;;
library:
purpose:
;;
explanation: Takes the calculated dose/volume of neonatal morphine and inserts it into the instructions field, thereby printing on pharmacy label. Typically the pharmacist needs to manipulate
the label text at order verification for the calculated dose/volume to be included.
Change History
07.31.2017 SZ CSR #31162 - Neonatal Morphine Dose/Volume Label
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
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;
// the calculated dose/volume is stored in the Note Comment
note_comment := first(this_form.Fields where this_form.Fields.DataItemName = "PRX_NOTECOMMENT0");
calculated_dose_volume := note_comment.Value;
instruction_field := first(this_form.Fields where this_form.Fields.DataItemName = "AdminInstructions");
instruction_value := instruction_field.value;
// appends the calculated dose/volume onto end of instructions text when “ok” button is clicked
// if dose is edited, then new dose is inserted into instructions field and removes old dose
if (this_communication.CallingEvent = "FormClose") then
// if text was entered in instructions field then use the formating below
if (exist instruction_value) then
colon_match := instruction_value MATCHES PATTERN "%::%";
mg_match := instruction_value MATCHES PATTERN "%mg =%";
if (colon_match = true) then
// instruction_field.value := "";
string_count_before_colon := find " :: " in string instruction_value;
text_before_colon := substring string_count_before_colon characters starting at 1 from (instruction_value);
label_instruction := text_before_colon || ":: " || calculated_dose_volume;
instruction_field.value := label_instruction;
elseif (mg_match = true) and (colon_match = false) then
label_instruction := calculated_dose_volume;
instruction_field.value := label_instruction;
else
label_instruction := instruction_value || " :: " || calculated_dose_volume;
instruction_field.value := label_instruction;
endif;
endif;
// if NO text was entered in instructions field then use the formating below
if (not exist instruction_value) then
label_instruction := calculated_dose_volume;
instruction_field.value := label_instruction;
endif;
endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: //return this_communication, this_form;
;;
Urgency: 50;;
end: