Files
St.Clair/MLMStripper/bin/Debug/SYS/SYS_CALC_WT.mlm

190 lines
6.5 KiB
Plaintext

maintenance:
title: Calculates Ideal or Adjusted Weights;;
mlmname: SYS_CALC_WT;;
arden: version 2.5;;
version: 18.4;;
institution: Allscripts, System MLM;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: ;;
date: 2018-10-26;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose: Calculates a patient{{{SINGLE-QUOTE}}}s Ideal or Adjusted weight.
;;
explanation: Calculates the BSA using the following rules:
1. If the formula preference = Ideal, then the ideal Weight formula is used.
Ideal weight = (((HeightCm / 2.54) - 60) * 2.3) + GenderConstant (50 for male; 45.5 for female)
2. If the formula preference = Adjusted, then the adjusted Weight formula is used.
Adjusted Weight = ((Actual wt - Ideal wt) * 0.25) + Ideal wt
;;
keywords: Weight Calculation; Ideal; Adjusted ;
;;
knowledge:
type: data-driven;;
data:
/* Arguments are passed in from the calling C++ program or MLM */
(Weight_formula_preference, //string - valid strings are Ideal or Adjusted
ht_val, //number in kilograms (kg)
wt_val, //number in centimeters (cm)
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;
/* What is the HEIGHT limit for using the Ideal weight calculation? */
/* The calculation will be done if the height is GREATER THAN OR EQUAL TO this number listed below */
ideal_WT_height_limit:= 150; /* cm */
/* Change text between quotes to change text message displayed in Calculated Weights */
Calc_Wt_Display_Message:= "Please see tool tip for calculation formulas.";
under_limits_message := "Calculations performed only if height => " ||ideal_WT_height_limit|| " cm.";
/***************************************************************************************/
/* Retrieves birthdate and gender from ClientInfo Object that is passed as an argument */
if exist client_info_obj
then
(birthdate,
birth_year,
patient_gender ):= read last
{ClientInfo: birthdate, BirthYearNum, GenderTypeIntlCode
REFERENCING client_info_obj};
endif; // if exist client_info_obj
/*-----------------------------------------------------*/
/* Calculate a patient{{{SINGLE-QUOTE}}}s age - NOT USED AT THIS TIME */
/*-----------------------------------------------------*/
if exist birthdate
and birth_year > 0
and birthdate is time
then
patient_age:= (NOW - birthdate) / (1 year);
endif; /* if exist birthdate */
/* Initialize return values */
WeightKg:= 0;
Tooltip_Formula := " ";
/*-------------------------------------------*/
/* Convert a string value to an Arden number */
/*-------------------------------------------*/
ht_val := ht_val as number;
wt_val := wt_val as number;
/*------------------------------------*/
/* Check for missing values or errors */
/*------------------------------------*/
fatal_error := false;
if not (exist ht_val and ht_val > 0)
then
WeightKg_rounded := 0;
Tooltip_Formula := "Missing height value";
Calc_Wt_Display_Message := "No calculation performed.";
fatal_error := true;
else
if ht_val < ideal_WT_height_limit
then
WeightKg_rounded := 0;
Tooltip_Formula := "Height is below limits.";
Calc_Wt_Display_Message := under_limits_message;
fatal_error := true;
endif;
endif;
if not (exist patient_gender
and (patient_gender = "F" or patient_gender = "M"))
then
WeightKg_rounded := 0;
Tooltip_Formula := "Unknown patient gender";
Calc_Wt_Display_Message := "Calculation performed only when gender is known.";
fatal_error := true;
endif;
;;
evoke:
;;
logic:
if not fatal_error
then
/*---------------------------------------*/
/* Calculates the patient{{{SINGLE-QUOTE}}}s Ideal Weight */
/*---------------------------------------*/
if (Weight_formula_preference = "Ideal") or (Weight_formula_preference = "Adjusted")
then if patient_gender = "F"
then
WeightKg:= ((((ht_val /2.54)-60)* 2.3)+45.5);
Tooltip_Formula := "Formula used: (((Height(cm)/2.54)-60)* 2.3)+45.5";
else
WeightKg:= ((((ht_val/2.54)-60)* 2.3)+50);
Tooltip_Formula := "Formula used: (((Height(cm)/2.54)-60)* 2.3)+50";
endif; //if patient_gender = "F"
ideal_wt := WeightKg;
endif; //if (Weight_formula_preference = "Ideal" ) or (Weight_formula_preference = "Adjusted")
/*------------------------------------------*/
/* Calculates the patient{{{SINGLE-QUOTE}}}s Adjusted Weight */
/*------------------------------------------*/
if (Weight_formula_preference = "Adjusted")
then
if (exist wt_val AND wt_val > 0)
then
actual_wt := wt_val;
WeightKg:=((actual_wt - ideal_wt)* 0.25) + ideal_wt;
Tooltip_Formula := "Formula used: ((Actual wt - Ideal wt) * 0.25) + Ideal wt";
else
WeightKg:= 0;
Tooltip_Formula := "Adjusted weight cannot be calculated without actual weight";
endif; /* (exist wt_val AND wt_val > 0) */
endif; /* if Weight_formula_preference */
/*------------------------------------------*/
/* Rounds the weight to two decimal points */
/*------------------------------------------*/
WeightKg_rounded:= (int ((WeightKg + 0.005) * 100))/100;
endif; // no fatal errors
conclude TRUE; // always, to return all values
;;
action:
/* Returns the weight */
return ( WeightKg_rounded, Tooltip_Formula, Calc_Wt_Display_Message) ;
;;
end: