source: FOIAVistA/trunk/r/HEALTH_SUMMARY-GMTS/GMTSFHWZ.m@ 1742

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

initial load of FOIAVistA 6/30/08 version

File size: 3.3 KB
Line 
1GMTSFHWZ ; SLC/JER - Dietetics extract for export ;12/16/92 09:38
2 ;;2.5;Health Summary;;Dec 16, 1992
3FHWHEA ;; GLRISC/REL - Health Summary ;1/11/91 09:11
4 ;;4.6;;
5 S FH9=9999999,FHS1=$S(GMTS2<1:1,1:FH9-GMTS2),FHS2=$S(GMTS1<1:FHP,1:FH9-GMTS1)
6 K ^UTILITY($J) S (FHN1,FHN2,FHN3)=0
7 ; Nutrition Status in inverse order
8 S FHL=0 F FHX1=GMTS1:0 S FHX1=$O(^FHPT(DFN,"S",FHX1)) Q:FHX1'>0!(FHX1>GMTS2) I $D(^(FHX1,0)) S FHX2=^(0) D NS S ^UTILITY($J,"NS",FHX1,0)=$P(FHX2,"^",1)_"^"_FHY,FHL=FHL+1 I GMTSNDM=FHL Q
9 S FHNOD="A" I ^DG(43,1,"VERSION")'>4.8 S FHNOD="DA"
10 F FHADM=0:0 S FHADM=$O(^FHPT(DFN,FHNOD,FHADM)) Q:FHADM'>0 D CHK
11 I GMTSNDM'>0 G KIL
12 I FHN1>GMTSNDM S FHL=0 F FHI=0:0 S FHI=$O(^UTILITY($J,"DI",FHI)) Q:FHI="" S FHL=FHL+1 I FHL>GMTSNDM K ^UTILITY($J,"DI",FHI)
13 I FHN2>GMTSNDM S FHL=0 F FHI=0:0 S FHI=$O(^UTILITY($J,"TF",FHI)) Q:FHI="" S FHL=FHL+1 I FHL>GMTSNDM K ^UTILITY($J,"TF",FHI)
14 I FHN3>GMTSNDM S FHL=0 F FHI=0:0 S FHI=$O(^UTILITY($J,"SF",FHI)) Q:FHI="" S FHL=FHL+1 I FHL>GMTSNDM K ^UTILITY($J,"SF",FHI)
15 G KIL
16CHK ;
17 I FHNOD="A" S FHY=$S($D(^DGPM(FHADM,0)):$P(^(0),"^",17),1:"") S:FHY>0 FHY=$S($D(^DGPM(+FHY,0)):$P(^(0),"^",1),1:"")
18 I FHNOD="DA" S FHY=$S($D(^DPT(DFN,FHNOD,FHADM,1)):$P(^(1),"^",1),1:"")
19 I FHY,FHY<FHS1 Q
20 ; Diet Order in inverse order
21 S FHP="" F FHI=FHS1:0 S FHI=$O(^FHPT(DFN,FHNOD,FHADM,"AC",FHI)) Q:FHI=""!(FHI>FHS2) I $D(^(FHI,0)) S FHX=^(0) D DI S ^UTILITY($J,"DI",(FH9-FHI),0)=FHX,FHN1=FHN1+1 S:FHP $P(^UTILITY($J,"DI",FHP,0),"^",2)=FHI S FHP=FH9-FHI
22 ; Tubefeeding in inverse order
23 F FHI=0:0 S FHI=$O(^FHPT(DFN,FHNOD,FHADM,"TF",FHI)) Q:FHI="" I $D(^(FHI,0)) S FHX=^(0) D TF I FHX S ^UTILITY($J,"TF",(FH9-FHX1),0)=FHX,FHN2=FHN2+1
24 ; Supplemental feeding in inverse order
25 F FHI=0:0 S FHI=$O(^FHPT(DFN,FHNOD,FHADM,"SF",FHI)) Q:FHI="" I $D(^(FHI,0)) S FHX=^(0) D SF I FHX S ^UTILITY($J,"SF",FH9-FHX1,0)=FHX,FHN3=FHN3+1
26 Q
27DI ; Decode Diet Order
28 S FHX=^FHPT(DFN,FHNOD,FHADM,"DI",$P(FHX,"^",2),0),FHX2=$S($D(^(1)):^(1),1:""),FHX3=""
29 S FHOR=$P(FHX,"^",2,6),FHLD=$P(FHX,"^",7),FHY=""
30 I FHLD'="" S FHDU=";"_$P(^DD(115.02,6,0),"^",3),%=$F(FHDU,";"_FHLD_":") S:%>0 FHY=$P($E(FHDU,%,999),";",1) K % G D1
31 S FHY="" F FHK1=1:1:5 S FHL=$P(FHOR,"^",FHK1) I FHL S:FHY'="" FHY=FHY_", " S FHY=FHY_$S($D(^FH(111,FHL,0)):$P(^(0),"^",7),1:"")
32 S FHX3=$P(FHX,"^",8) S:FHX3'="" FHX3=$S(FHX3="T":"Tray",FHX3="D":"Dining Room",1:"Cafeteria")
33D1 S FHX=FHI_"^"_$P(FHX,"^",10)_"^"_FHY_"^"_FHX2_"^"_FHX3 Q
34SF ; Decode Supp. Fdg.
35 S FHX1=$P(FHX,"^",2) I FHX1<FHS1!(FHX1>FHS2) S FHX="" Q
36 S FHL=4 F FHK1=1:1:3 S FHN(FHK1)="" F FHK2=1:1:4 S FHX2=$P(FHX,"^",FHL+1),FHX3=$P(FHX,"^",FHL+2),FHL=FHL+2 I FHX2 S:FHN(FHK1)'="" FHN(FHK1)=FHN(FHK1)_"; " S FHN(FHK1)=FHN(FHK1)_$S(FHX3:FHX3,1:1)_" "_$S($D(^FH(118,FHX2,0)):$P(^(0),"^",1),1:"")
37 S FHX=FHX1_"^"_$P(FHX,"^",32)_"^"_FHN(1)_"^"_FHN(2)_"^"_FHN(3) Q
38NS ; Decode Nut Status
39 S FHY=$S($D(^FH(115.4,+$P(FHX2,"^",2),0)):$P(^(0),"^",2),1:"") Q
40TF ; Decode Tubefeeding
41 S FHX1=$P(FHX,"^",1) I FHX1<FHS1!(FHX1>FHS2) S FHX="" Q
42 S FHX2=$P(FHX,"^",2),FHX3=$P(FHX,"^",3)
43 S:FHX2 FHX2=$S($D(^FH(118.2,FHX2,0)):$P(^(0),"^",1),1:" ")
44 S:FHX3 FHX3=$S(FHX3=4:"Full",FHX3=1:"1/4",FHX3=2:"1/2",1:"3/4")
45 S FHX=FHX1_"^"_$P(FHX,"^",11)_"^"_FHX2_"^"_FHX3_"^"_$P(FHX,"^",4)_"^"_$P(FHX,"^",6)_"^"_$P(FHX,"^",7)_"^"_$P(FHX,"^",5) Q
46KIL K %,FHADM,FHDU,FHI,FHK1,FHK2,FHL,FHLD,FHN,FHN1,FHN2,FHN3,FHNOD,FHOR,FHP,FHX,FHX1,FHX2,FHX3,FHS1,FHS2,FH9,FHFHY Q
Note: See TracBrowser for help on using the repository browser.