source: WorldVistAEHR/trunk/r/DIETETICS-FH/FHORDR.m@ 703

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

initial load of WorldVistAEHR

File size: 1.6 KB
Line 
1FHORDR ; HISC/REL - Production Diet Recode ;3/28/95 12:09
2 ;;5.5;DIETETICS;;Jan 28, 2005
3 S FLG=0
4CODE ; Recode diet
5 Q:"^^^^"[FHOR I FHOR="1^^^^" S Z=1 G C1
6 Q:PDFLG
7 S MP=$O(^FH(111.1,"AB",FHOR,0))
8 S Z=$P($G(^FH(111.1,+MP,0)),"^",7) G:Z C1
9 S M="^" F K1=1:1:5 S Z=$P(FHOR,"^",K1) Q:Z<1 S M=M_+$P(^FH(111,Z,0),"^",5)_"^"
10 F LC=0:0 S LC=$O(^FH(116.2,"AR",LC)) Q:LC<1 S X=^(LC) F K1=1:1 S X1=$P(X,"^",K1) Q:X1<1 D REC G:Z C1
11 S Z=0 D:FLG MIS
12C1 S:Z $P(^FHPT(FHDFN,"A",ADM,"DI",FHORD,0),"^",13)=Z Q
13MIS ; No recoding of diet order
14 D PATNAME^FHOMUTL I DFN="" Q
15 W !,$P($G(^DPT(DFN,0)),"^",1),", Admission ",ADM,", Diet Order ",FHORD," not recoded" Q
16 Q
17REC S Z=$P(X1,":",1),X1=$P(X1,":",2) F K2=1:1 S C=$P(X1," ",K2) Q:C<1 G:M'[("^"_C_"^") R1
18 Q
19R1 S Z=0 Q
20SET ; Rebuild 'AR' recode cross-reference
21 K M,^FH(116.2,"AR") F K1=0:0 S K1=$O(^FH(116.2,K1)) Q:K1<1 D S1
22 S LC=1,X="" F M=0:0 S M=$O(M(M)) Q:M<1 S Z=M(M) D S2
23 S:X'="" ^FH(116.2,"AR",LC)=$E(X,2,999) K FHORD,K1,K2,LC,M,X,Z Q
24S1 S X="",M=+$P(^FH(116.2,K1,0),"^",5) Q:'M Q:$D(^FH(116.2,K1,"I"))
25 F K2=0:0 S K2=$O(^FH(116.2,K1,"R",K2)) Q:K2<1 S Z=^(K2,0) S:Z X=X_" "_Z
26 S:X="" X=" "_K1 S M(M)=K1_":"_$E(X,2,999) Q
27S2 I $L(X)+$L(Z)>245 S ^FH(116.2,"AR",LC)=$E(X,2,999),X="",LC=LC+1
28 S X=X_"^"_Z Q
29INP ; Recode all inpatients
30 D SET S FLG=1,PDFLG=0
31 F W1=0:0 S W1=$O(^FHPT("AW",W1)) Q:W1'>0 F FHDFN=0:0 S FHDFN=$O(^FHPT("AW",W1,FHDFN)) Q:FHDFN<1 S ADM=$G(^FHPT("AW",W1,FHDFN)) D:ADM Z1
32 K ADM,C,D,FHDFN,DFN,FHOR,FHORD,FLG,I,K1,K2,LC,M,W1,X,X1,Z Q
33Z1 F FHORD=0:0 S FHORD=$O(^FHPT(FHDFN,"A",ADM,"DI",FHORD)) Q:FHORD<1 D Z2
34 Q
35Z2 S Z=$G(^FHPT(FHDFN,"A",ADM,"DI",FHORD,0)),FHOR=$P(Z,"^",2,6) Q:"^^^^"[FHOR D CODE Q
Note: See TracBrowser for help on using the repository browser.