134 lines
4.9 KiB
Plaintext
134 lines
4.9 KiB
Plaintext
maintenance:
|
|
|
|
title: Calculates Body Mass Index (BMI);;
|
|
mlmname: SYS_CALC_BMI;;
|
|
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 Body Mass Index (BMI).
|
|
;;
|
|
explanation: Calculates the Body Mass Index using the following rules:
|
|
|
|
1. The Body Mass Index is calculated using the following equation:
|
|
BMI = Weight(kg) /[Height(m)**2].
|
|
|
|
This formula can be changed by client sites as needed.
|
|
|
|
2. Arguments passed in from the calling program or other MLM:
|
|
|
|
ht_val - patient{{{SINGLE-QUOTE}}}s actual height number in centimeters (cm)
|
|
wt_val - patient{{{SINGLE-QUOTE}}}s actual weight number in kilograms (kg)
|
|
client_info_obj - Arden ClientInfo object
|
|
|
|
3. Values returned to the calling program or other MLM
|
|
|
|
error_message - text string containing error message
|
|
BMI_value_rounded - The BMI value, rounded to two decimal places
|
|
BMI_formula - A text string that describes the formula used to perform the calculation.
|
|
Sites can change the formula or text string as needed.
|
|
Configured message currently returned to the application reads:
|
|
"BMI calculated using formula: (WeightKg / (HeightM) ^ 2))".
|
|
|
|
;;
|
|
keywords: Body Mass Index, BMI;
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
/* Arguments are passed in from the calling C++ program or MLM */
|
|
(ht_val, //number in centimeters (cm)
|
|
wt_val, //number in kilograms (kg)
|
|
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;
|
|
|
|
/************************************************************************************/
|
|
|
|
error_message:="";
|
|
fatal_error := false;
|
|
|
|
;;
|
|
evoke:
|
|
;;
|
|
logic:
|
|
|
|
/*----------------*/
|
|
/* Set error flag */
|
|
/*----------------*/
|
|
|
|
if not (exist ht_val) or (ht_val <= 0)
|
|
then
|
|
fatal_error := true;
|
|
error_message := error_message || "Invalid height for BMI calculation. ";
|
|
endif;
|
|
|
|
if not (exist wt_val) or (wt_val <= 0)
|
|
then
|
|
fatal_error := true;
|
|
error_message := error_message || "Invalid weight for BMI calculation. ";
|
|
endif;
|
|
|
|
/*--------------------------------*/
|
|
/* calculate BMI only if no error */
|
|
/*--------------------------------*/
|
|
|
|
if not fatal_error
|
|
then
|
|
/*------------------------------------------------------*/
|
|
/* Body Mass Index calculation (convert cm to meters) */
|
|
/*------------------------------------------------------*/
|
|
|
|
BMI_value := wt_val / ((ht_val/100 ) **2);
|
|
BMI_formula := "BMI calculated using formula: WeightKg / (HeightM^2)";
|
|
|
|
/*----------------------------------------*/
|
|
/* Rounds the BMI to two decimal points */
|
|
/*----------------------------------------*/
|
|
|
|
BMI_value_rounded:= (int ((BMI_value + 0.005) * 100))/100;
|
|
endif; /* no errors */
|
|
|
|
/*--------------------------------------------------------*/
|
|
/* Always conclude True to return values or error_message */
|
|
/*--------------------------------------------------------*/
|
|
|
|
conclude TRUE;
|
|
|
|
;;
|
|
action:
|
|
if fatal_error
|
|
then
|
|
return error_message;
|
|
else
|
|
/* Return the BMI - object layer will set to Null if needed */
|
|
return (error_message, BMI_value_rounded, BMI_formula);
|
|
endif;
|
|
;;
|
|
end:
|