source: WorldVistAEHR/trunk/r/GEN_MED_OTHER-GMV/GMVBMI.m@ 1742

Last change on this file since 1742 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 1.9 KB
Line 
1GMVBMI ;HIOFO/YH,FT-EXTRACT HEIGHT TO CALCULATE BMI FOR WEIGHT; 3/24/97 ;11/8/01 14:38
2 ;;5.0;GEN. MED. REC. - VITALS;**3**;Oct 31, 2002
3 ;
4 ; This routine uses the following IAs:
5 ; <None>
6 ;
7HT ;OBTAIN THE LATEST HEIGHT FOR THE CURRENT WEIGHT
8 K GHEIGHT S GI=$O(^GMRD(120.51,"B","HEIGHT",0)) Q:GI'>0
9 S GH=0 F S GH=$O(^GMR(120.5,"AA",DFN,GI,GH)) Q:GH'>0 S GH(1)=0 F S GH(1)=$O(^GMR(120.5,"AA",DFN,GI,GH,GH(1))) Q:GH(1)'>0 I $D(^GMR(120.5,GH(1),0)),'$D(^GMR(120.5,GH(1),2)),$P(^GMR(120.5,GH(1),0),"^",8)'="" D
10 . I $P(^GMR(120.5,GH(1),0),"^",8)>0 S GHEIGHT($P(^(0),"^"))=$P(^(0),"^",8)
11 Q
12CALBMI(GBMI) ;OBTAIN HEIGHT TO CALCULATE BMI
13 N GDATE,GMRVHT S GMRVHT="" D HT I '$D(GHEIGHT) K GHEIGHT,GI,GH Q
14 ;HEIGHT AND WEIGHT WERE OBTAINED AT THE SAME TIME
15 I $D(GHEIGHT(GBMI(1))) D K GHEIGHT,GH,GI Q
16 . S GBMI(2)=GBMI(2)/2.2,GMRVHT=+GHEIGHT(GBMI(1))*2.54/100
17 . I +GMRVHT'>0 S GBMI=$J(0,0,0) Q
18 . S GBMI=$J(GBMI(2)/(GMRVHT*GMRVHT),0,2) S GBMI=GBMI_$S(GBMI>27:"*",1:"")
19 ;EXTRACT THE HEIGHT TAKEN BEFORE THE WEIGHT WAS TAKEN
20 S GDATE=9999999-GBMI(1),GDATE(1)=0 F S GDATE=$O(^GMR(120.5,"AA",DFN,GI,GDATE)) Q:GDATE'>0!(GDATE(1)>0) D
21 . S G=$O(^GMR(120.5,"AA",DFN,GI,GDATE,0)) Q:G'>0 I $P($G(^GMR(120.5,G,0)),"^",8)'>0 Q
22 . S GDATE(1)=GDATE
23 ;EXTRACT THE HEIGHT TAKEN AFTER THE WEIGHT WAS TAKEN
24 I GDATE(1)>0,$D(GHEIGHT(9999999-GDATE(1))) D K GHEIGHT,GH,GI Q
25 . S GDATE(1)=9999999-GDATE(1),GMRVHT=+GHEIGHT(GDATE(1))
26 . S GBMI(2)=GBMI(2)/2.2,GMRVHT=GMRVHT*2.54/100
27 . I +GMRVHT'>0 S GBMI=$J(0,0,0) Q
28 . S GBMI=$J(GBMI(2)/(GMRVHT*GMRVHT),0,2),GBMI=GBMI_$S(GBMI>27:"*",1:"")
29 S GDATE=GBMI(1),GDATE(1)=0 F S GDATE=$O(GHEIGHT(GDATE)) Q:GDATE'>0!(GDATE(1)>0) S GDATE(1)=GDATE
30 I GDATE(1)>0 D K GHEIGHT,GH,GI,G Q
31 . S GMRVHT=+GHEIGHT(GDATE(1))
32 . S GBMI(2)=GBMI(2)/2.2,GMRVHT=GMRVHT*2.54/100
33 . I +GMRVHT'>0 S GBMI=$J(0,0,0) Q
34 . S GBMI=$J(GBMI(2)/(GMRVHT*GMRVHT),0,2),GBMI=GBMI_$S(GBMI>27:"*",1:"")
35 K GHEIGHT,GI,GH,G Q
Note: See TracBrowser for help on using the repository browser.