source: FOIAVistA/tag/r/DIETETICS-FH/FHWOR5R.m@ 1550

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

initial load of FOIAVistA 6/30/08 version

File size: 1.9 KB
Line 
1FHWOR5R ; HISC/NCA - HL7 Tubefeeding Function Call ;6/28/96 16:28
2 ;;5.5;DIETETICS;**1**;Jan 28, 2005
3QUAN(FHS,FHQ) ; Entry Point for OE to get Tubefeeding Quantity.
4 N A1,A2,A3,DX,K,QUA,S1,S2,STR,T,TC,TK,TT,X,FDG
5 S QUA=FHQ,A1=+QUA,A2=$E($P(QUA,"&",2),1),A3=$P(QUA,"^",2),FDG=$P(QUA,"^",3),TC=""
6 S X=A1_A2_"/"_A3
7 I FDG'="","XH"'[$E(FDG,1) S FDG=""
8 S:'$E(FDG,2,99) FDG=""
9 I FDG'="" S X=X_$S($E(FDG,1)="H":"X"_$E(FDG,2,99),1:FDG_"F")
10 S QUA=X,A2=A2_"/"_$P(QUA,"/",2)
11 S TT=+$P(FHS,"-",1) I 'TT G:'TT EXIT
12 S STR=+$P(FHS,"-",2) Q:'STR
13 S T(0)=$G(^FH(118.2,+TT,0))
14 S A3=$P(A2,"/",2),A2=$P(A2,"/",1)
15 I $E($P(T(0),"^",3),$L($P(T(0),"^",3)))?1"G" S:$E(A2,1)'="G" A1=A1*+$P(T(0),"^",3),A2="GRAM"
16 F K=1:1:11 S S1=$P("KCAL CC ML OZ UNITS BOTTLES CANS PKG TBSP GMS GRAMS"," ",K) G:$P(S1,A2,1)="" F3
17 G EXIT
18F3 S S1=$S(K=1:1,K<4:2,K=4:3,K=9:5,K>9:6,1:4),A2=$P(A3,"X",1),A3=$P(A3,"X",2)
19 G:A2'?1U.E EXIT I $L(A2)=1,"DH"'[A2 G EXIT
20 S S2=$F("DAY QD QH HOUR HR BID TID Q2H Q3H Q4H Q6H QID",A2) G:'S2 EXIT S S2=$S(S2<8:1,S2<19:2,S2<23:3,S2<27:4,S2<31:5,S2<35:6,S2<39:7,1:8)
21 S QUA=A1_" "_$P("KCAL ML OZ UNITS TBSP GM"," ",S1),QUA=QUA_" "_$P($T(F6),";",S2+2)
22 S:A3'="" QUA=QUA_" X "_(+A3)_" "_$S(A3["F":"fdgs",1:"hrs")
23 I S1=1 S DX=$P(T(0),"^",4) G:'DX EXIT S TK=A1,TC=A1/DX*$S(STR=4:1,STR=3:1.333,STR=2:2,1:4)
24 I S1=4 S DX=+$P(T(0),"^",3) G:'DX EXIT S TC=A1*DX*$S(STR=4:1,STR=3:1.333,STR=2:2,1:4)
25 S:S1=2 TC=A1 S:S1=3 TC=A1*29.5 S:S1=5 TC=A1*15 I S1=6 S TC=0,A3=0 G C1
26ML I 'A3 S A3=$P("1,24,2,3,12,8,6,4",",",S2) G C1
27 I A3'["F" S A3=$S(S2=1:1,S2=2:A3,S2=3:2,S2=4:3,S2=5:A3\2,S2=6:A3\3,S2=7:A3\4,1:A3\6)
28 E S:S2=1 A3=1
29C1 S TC=$J(TC*A3,0,0)
30 ;S:TC'<1 TP=$S(STR=4:TC,STR=3:TC*.75,STR=2:TC/2,1:TC/4),TP=$J(TP,0,0),TW=TC-TP
31 ;I S1'=1!(S1'=6) S TK="",DX=$P(T(0),"^",4) I DX S TK=DX*TP,TK=$J(TK,0,0)
32EXIT Q TC
33F6 ;;per Day;per Hour;Twice a Day;Three times a Day;Every 2 Hours;Every 3 Hours;Every 4 Hours;Every 6 Hours
Note: See TracBrowser for help on using the repository browser.