source: FOIAVistA/tag/r/DIETETICS-FH/FHPRC11.m@ 1618

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

initial load of FOIAVistA 6/30/08 version

File size: 3.9 KB
Line 
1FHPRC11 ; HISC/NCA - Meal Analysis (cont.) ;2/15/95 16:10
2 ;;5.5;DIETETICS;;Jan 28, 2005
3 D Q1^FHPRC14
4PRT ; Print Meal Analysis
5 D NOW^%DTC S DT=%,DTP=DT D DTP^FH S (DAY,PG)=0 G:SUM ^FHPRC12
6P1 S DAY=$O(^TMP($J,"R",DAY)) G:DAY="" ^FHPRC12 S MEAL=0,NEW=1
7P2 S MEAL=$O(^TMP($J,"R",DAY,MEAL)) G:MEAL="" P3
8 I 'NEW W !!,"Meal ",MEAL,! S X=$G(^TMP($J,"RECIPES",DAY,MEAL,0)) S Y=$E($P($G(^FH(116.1,+$P(X,"^",1),0)),"^",1),1,22) W Y,!,"Prod Diet: " S Y=$E($P($G(^FH(116.2,+$P(X,"^",2),0)),"^",1),1,14) W Y,!
9 D:NEW HEAD,HD1
10 S RNAM="" F S RNAM=$O(^TMP($J,"R",DAY,MEAL,RNAM)) Q:RNAM="" S X0=$G(^(RNAM,0)),X1=$G(^(1)),X2=$G(^(2)),X3=$G(^(3)),X4=$G(^(4)),SVG=+X0 D:$Y>(IOSL-8) HEAD,HD1 W !,$J(SVG,4)," ",RNAM,?24,$J($P(X0,"^",2),5,0) D LIS^FHNU2
11 D:$Y>(IOSL-10) HEAD,HD1 W !!?7,"Recipe Total",?29 S X1=$G(^TMP($J,"M",DAY,MEAL,1)),X2=$G(^(2)),X3=$G(^(3)),X4=$G(^(4)) D LIS^FHNU2
12 W !?7,"% of Kcal",?36 S Z1=$P(X1,"^",4) S:'Z1 Z1=1 F KK=1,3,2 W $J($P(X1,"^",KK)*$S(KK=2:900,1:400)/Z1,7,0)
13 G P2
14P3 D:$Y>(IOSL-12) HEAD,HD1 W !!,"Daily Total",?29 S X1=$G(^TMP($J,"D",DAY,1)),X2=$G(^(2)),X3=$G(^(3)),X4=$G(^(4)) D LIS^FHNU2
15 I RDA W !,"% DRI",?29 D RDA^FHNU9
16 W !,"% of Kcal",?36 S Z1=$P(X1,"^",4) S:'Z1 Z1=1 F KK=1,3,2 W $J($P(X1,"^",KK)*$S(KK=2:900,1:400)/Z1,7,0)
17 W:$P(X1,"^",1) !!,"Kcal:N Ratio = ",$J(6.25*$P(X1,"^",4)/$P(X1,"^",1),0,0),":1"
18P4 S MEAL=0,NEW=1
19P5 S MEAL=$O(^TMP($J,"R",DAY,MEAL)) G:MEAL="" P6
20 I 'NEW W !!,"Meal ",MEAL,! S X=$G(^TMP($J,"RECIPES",DAY,MEAL,0)) S Y=$E($P($G(^FH(116.1,+$P(X,"^",1),0)),"^",1),1,14) W Y,!,"PD: " S Y=$E($P($G(^FH(116.2,+$P(X,"^",2),0)),"^",1),1,11) W Y,!
21 D:NEW HEAD,HD2
22 S RNAM="" F S RNAM=$O(^TMP($J,"R",DAY,MEAL,RNAM)) Q:RNAM="" S X0=$G(^(RNAM,0)),X1=$G(^(1)),X2=$G(^(2)),X3=$G(^(3)),X4=$G(^(4)),SVG=+X0 D:$Y>(IOSL-8) HEAD,HD2 W !,$E(RNAM,1,10),?12 D LIS^FHNU2
23 D:$Y>(IOSL-9) HEAD,HD2 W !!?3,"Total",?12 S X1=$G(^TMP($J,"M",DAY,MEAL,1)),X2=$G(^(2)),X3=$G(^(3)),X4=$G(^(4)) D LIS^FHNU2 G P5
24P6 D:$Y>(IOSL-10) HEAD,HD2 W !!,"Daily Total",?12 S X1=$G(^TMP($J,"D",DAY,1)),X2=$G(^(2)),X3=$G(^(3)),X4=$G(^(4)) D LIS^FHNU2
25 I RDA W !,"% DRI",?12 D RDA^FHNU9
26 G P1
27HEAD ; Print Header
28 W:'($E(IOST,1,2)'="C-"&'PG) @IOF S PG=PG+1 D:PG=1 SITE^FH G:NAM'="" HEAD1
29 W !,"Station #: ",SITE(1),?42,"A N A L Y S I S O F M E A L P O R T I O N",?124,"Page ",PG
30 W !,"Station Name: ",SITE,?57,DTP W:RDA ?110,"DRI: ",$P(^FH(112.2,RDA,0),U,1)
31 W !?(132-$L(MNAM)\2),MNAM S NEW=0 Q
32HEAD1 W !?42,"A N A L Y S I S O F M E A L P O R T I O N",?124,"Page ",PG,!?57,DTP
33 W !?(132-$L(MNAM)\2),MNAM S NEW=0
34 W !!,"Patient: ",NAM,?63,$S(SEX="M":"Male",1:"Female"),?124,"Age: ",AGE,! Q
35HD1 W !!,"Day ",DAY,!! W:MEAL'="" "Meal ",MEAL S:MEAL'="" X=$G(^TMP($J,"RECIPES",DAY,MEAL,0)) S Y=$S(MEAL'="":$E($P($G(^FH(116.1,+$P(X,"^",1),0)),"^",1),1,22),1:"") W !
36 W Y,?24,"Quant Energ Pro CHO Fat Sod Pot Calc Phos Iron Zinc Mag Man Cop Sel DFib" S Y=$S(MEAL'="":$E($P($G(^FH(116.2,+$P(X,"^",2),0)),"^",1),1,14),1:"")
37 W ! W:MEAL'="" "Prod Diet: ",Y W ?27,"Gm KCal Gm Gm Gm Mg Mg Mg Mg Mg Mg Mg Mg Mg Mcg Gm",!
38 ;NUT String contains 7 characters per nut: 1=node in ^FHNU,2-3=pos. in ^FHNU, 4=field size, 5=# decimals, 6-7=pos. of DRI in ^FH(112.2
39 S NUT="104700010171011037100102710011370191127020108701111170121097114114711511071131167218115621746661222376100" Q
40HD2 W !!,"Day ",DAY,!! W:MEAL'="" "Meal ",MEAL S:MEAL'="" X=$G(^TMP($J,"RECIPES",DAY,MEAL,0)) S Y=$S(MEAL'="":$E($P($G(^FH(116.1,+$P(X,"^",1),0)),"^",1),1,14),1:"") W !
41 W Y,?18,"K A C E Rib Thi Nia B6 B12 Fol Pant Chol 18C2 18C3 Mono PuFA SaFa" S Y=$S(MEAL'="":$E($P($G(^FH(116.2,+$P(X,"^",2),0)),"^",1),1,11),1:"")
42 W ! W:MEAL'="" "PD: ",Y W ?16,"Mcg RE Mg Mg Mg Mg Mg Mg Mcg Mcg Mg Mg Gm Gm Gm Gm Gm",!
43 S NUT="46571262337002119710411771032217206120720522272072247208226721022572092237216229700022771002287100231710023271002307100" Q
Note: See TracBrowser for help on using the repository browser.