Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: APCL2A3

APCL2A3.m

Go to the documentation of this file.
APCL2A3 ; IHS/CMI/LAB - BODY MASS INDEX & RELATIVE WEIGHT FOR MEASUREMENT TRANSFORMS ;
 ;;2.0;IHS PCC SUITE;**4**;MAY 14, 2009
 ;DL/IHS/TPA 12-2-91
 ;IHS/TUCSON/LAB - patch 1 adds $G statement on error code 06/02/97
 ;
BMI(APCLPAT,APCLWT,APCLSDAT) ; ENTRY POINT - TO OBTAIN BODY MASS INDEX
 NEW APCLDOB,APCLSEX,APCLAGE,APCLSX,APCLHT,APCLBMI,APCLPRW,APCLSWT,APCLCOMT,APCLRW,APCLMDT,APCLDA
 ;------------
 I (APCLWT="")!(APCLSDAT="")!(APCLPAT="") G ERROR
 ;------------
 D COMMON G:$E(APCLCOMT)="!" ERROR
 ;S APCLWT=(APCLWT/5)*2.3,APCLHT=(APCLHT*2.5),APCLHT=(APCLHT*APCLHT)/10000,APCLBMI=(APCLWT/APCLHT),APCLBMI=$J(APCLBMI,5,1)
 S APCLWT=APCLWT*.45359,APCLHT=(APCLHT*.0254),APCLHT=(APCLHT*APCLHT),APCLBMI=(APCLWT/APCLHT),APCLBMI=$J(APCLBMI,5,1)
 S APCLSWT=APCLBMI_$S(APCLCOMT]"":" **",1:"   ")
 G EXIT
 ;
RW(APCLPAT,APCLWT,APCLSDAT) ; ENTRY POINT - TO OBTAIN RELATIVE WEIGHT PERCENTAGE
 NEW APCLDOB,APCLSEX,APCLAGE,APCLSX,APCLHT,APCLBMI,APCLPRW,APCLSWT,APCLCOMT,APCLRW,APCLMDT,APCLDA
 ;------------
 I (APCLWT="")!(APCLSDAT="")!(APCLPAT="") G ERROR
 ;------------
 D COMMON G:$E(APCLCOMT)="!" ERROR
 I (APCLHT>70)!(APCLHT<58)&(APCLSEX="F") S APCLCOMT="!HEIGHT OUT OF RANGE FOR SEX." G ERROR
 I (APCLHT>75)!(APCLHT<61)&(APCLSEX="M") S APCLCOMT="!HEIGHT OUT OF RANGE FOR SEX." G ERROR
 S APCLHT=APCLHT-57,APCLRW=$P($T(SIZES+APCLHT),";;",APCLSX),APCLPRW=(APCLWT*100/APCLRW)\1
 S APCLSWT=APCLPRW_"%"_$S(APCLCOMT]"":" **",1:"   ")
 G EXIT
ERROR S:$G(APCLCOMT)="" APCLCOMT="" S APCLSWT="***",APCLCOMT="*** "_$E(APCLCOMT,2,$L(APCLCOMT)) ;IHS/TUCSON/LAB patch 1 added $G statement
EXIT K X,X1,X2 ; note that the rest of the variables were NEWed
 S Y=APCLSWT_"^"_$G(APCLCOMT)
 K APCLDOB,APCLSEX,APCLAGE,APCLSX,APCLHT,APCLBMI,APCLPRW,APCLSWT,APCLCOMT,APCLRW,APCLMDT,APCLDA,APCLSDAT
 Q Y
 ;
COMMON ;OBTAIN DOB, AGE, SEX, and COMN
 ;------------
 I '$D(^AUPNVMSR("AA",APCLPAT,1)) S APCLCOMT="!NO HEIGHT FOR PATIENT." Q
 S APCLDOB=$P(^DPT(APCLPAT,0),U,3),APCLSEX=$P(^DPT(APCLPAT,0),U,2),X2=APCLDOB,X1=DT D ^%DTC S APCLAGE=X,APCLSX=$S(APCLSEX="M":2,APCLSEX="F":3,1:"")
 S APCLCOMT=""
 S APCLDA="",APCLHDA=""
NXTHT S APCLDA=0 F  S APCLDA=$O(^AUPNVMSR("AA",APCLPAT,1,APCLSDAT,APCLDA)) Q:APCLDA'=+APCLDA  D
 .Q:$P($G(^AUPNVMSR(APCLDA,2)),U,1)
 .S APCLHDA=APCLDA
 S APCLDA=APCLHDA
 G:APCLDA]"" HITE
NXTDATE S APCLSDAT=$O(^AUPNVMSR("AA",APCLPAT,1,APCLSDAT)) G:APCLSDAT]"" NXTHT
 S APCLCOMT="!NO HEIGHT FOUND." Q
HITE S X1=9999999-(APCLSDAT\1),X2=APCLDOB D ^%DTC S APCLMDT=X
 S APCLHT=$P(^AUPNVMSR(APCLDA,0),U,4),X1=DT,X2=9999999-(APCLSDAT\1) D ^%DTC
 I ((X>90)&(APCLAGE<1096))!((X>180)&(APCLAGE<4381))!((X>365)&(APCLAGE<6571))!((APCLMDT<6571)&(APCLAGE>6571)) S APCLCOMT="** HEIGHT MAY BE OLD."
 Q
 ;
 ;; TEMPORARY ENTRY POINTS UNTIL FILEMAN WILL ACCEPT $$FUNCTIONS
 ;
SIZES ;;
 ;;;;107
 ;;;;110
 ;;;;113
 ;;120;;116
 ;;123;;119
 ;;126;;123
 ;;130;;126
 ;;133;;130
 ;;138;;134
 ;;142;;138
 ;;146;;143
 ;;150;;147
 ;;155;;152
 ;;159
 ;;164
 ;;168
 ;;173
 ;;177