source: FOIAVistA/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRUGS.m@ 677

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

initial load of FOIAVistA 6/30/08 version

File size: 3.5 KB
Line 
1DGRUGS ;ALB/MLI,PHH - RUG-II STATUS REPORT ; 13 SEPT 88 @2000
2 ;;5.3;Registration;**89,173,568**;Aug 13, 1993
3 ;
4EN D Q,ASK2^SDDIV G:Y<0 Q
5 N ERR S ERR=$$CHOSE^DGRUGU1()
6 I +ERR<0 G Q
7 I $D(DGCL),$D(DGW) I '+$O(DGCL(0))&(+'$O(DGW(0)))&(DGW'=1)&(DGCL'=1) Q
8 S SEL=$P(ERR,"^",2)
9ASK W !!,"Sort by (A)ssessment or (T)ransfer/Admission Date: T//" S Z="^TRANSFER/ADMISSION^ASSESSMENT" R X:DTIME G Q:X["^"!('$T) I X="" S X="T" W X
10 D IN^DGHELP
11 I %=-1 W !!,?12,"CHOOSE FROM:",!?12,"A - Date range for the search is by Assessment Date",!?12,"T - Date range is by Transfer or admission date",! S %="" G ASK
12 S DGX=$S(X="T":"AC",1:"AA")
13 D DATE^DGSDUTL G:POP Q K BEGDATE,ENDATE
14 S DGB=SDBD-.1,DGE=SDED+.9
15 S DGPGM="1^DGRUGS",DGVAR="VAUTD#^DGW#^DGB^DGE^DGX^DGCL#"
16 D ZIS^DGUTQ G:POP Q
171 U IO S I=DGB
18 F S I=$O(^DG(45.9,DGX,I)) Q:I'>0!(I>DGE) D
19 .S J=""
20 .F S J=$O(^DG(45.9,DGX,I,J)) Q:J'>0!'$D(^DG(45.9,+J,0))!'$D(^("R"))!'$D(^("C")) D
21 ..S DGR=^("R"),DG0=^(0),DGC=^("C"),DGWD=$P(DGR,"^")
22 ..I $P(DG0,"^",6)'=3,$D(^DIC(42,+DGWD,0)) S DGS=^(0) D S
23 ..I $P(DG0,"^",6)=3,$D(^FBAAV(+DGWD,0)) S DGS=^(0) D S
24 S (DGNEW,DGPG)=0,I="" D NOW^DGPTOTRL
25 S DGFL=0,FIRST=1
26 F S I=$O(^UTILITY($J,"S",I)) Q:I=""!(DGFL) D
27 .D HD
28 .S FIRST=FIRST+1
29 .Q:DGFL
30 .S J=""
31 .F S DGHJ=J,J=$O(^UTILITY($J,"S",I,J)) Q:J=""!(DGFL) D
32 ..S K=""
33 ..F S K=$O(^UTILITY($J,"S",I,J,K)) Q:K=""!(DGFL) D
34 ...S L=""
35 ...F S L=$O(^UTILITY($J,"S",I,J,K,L)) Q:L=""!(DGFL) D
36 ....D PT
37 ....Q:DGFL
38Q W ! K %,^UTILITY($J),DG0,DGAD,DGAS,DGB,DGC,DGDV,DGE,DGHJ,DFN,DGFL
39 K DGNEW,DGNM,DGNOW,DGPG,DGPGM,DGR,DGS,DGSSN,DGVAR,DGW,DGWD,DGWN,DGX
40 K DGYR,ENDDATE,I,J,K,L,M,PG,SDBD,SDED,X,Y,VAUTD,Z,FIRST,DGCL,SEL
41 D CLOSE^DGUTQ
42 Q
43S S DGWN=$P(DGS,"^") ;ward or cnh name
44 I $P(DG0,"^",6)'=3 S DGDV=$S($P(DGS,"^",11)]"":$P(DGS,"^",11),1:$O(^DG(40.8,0))) Q:'VAUTD&'$D(VAUTD(+DGDV))
45 I $P(DG0,"^",6)'=3 Q:'$D(DGW) Q:'DGW&'$D(DGW(+DGWD))
46 I $P(DG0,"^",6)=3 Q:'$D(DGCL) Q:'DGCL&'$D(DGCL(+DGWD))
47 Q:'$D(^DPT($P(DG0,"^"),0))
48 S DGNM=$P(^(0),"^"),DGSSN=$S($P(^(0),"^",9)]"":$P(^(0),"^",9),1:0)
49 S DGS=$P(DGC,"^")
50 S DGS=$S(DGS=1:"COMPLETED",DGS=2:"CLOSED",DGS=3:"RELEASED",DGS=4:"TRANSMITTED",DGS=5:"INCOMPLETE",DGS=0:"OPEN",1:"UNSPECIFIED")
51 S DGAS=$P(DG0,"^",2)
52 S ^UTILITY($J,"S",DGWN,DGS,DGNM,DGSSN,DGAS)=$P(DG0,"^",2)_"^"_$P(DG0,"^",6)_"^"_$P(DG0,"^",7)_"^"_$P(DGR,"^",2)_"^"_$P(DGR,"^",3)
53 Q
54PT F M=0:0 S M=$O(^UTILITY($J,"S",I,J,K,L,M)) Q:'M D
55 .S DG0=^UTILITY($J,"S",I,J,K,L,M)
56 .W ! W:DGHJ'=J!DGNEW !,$E(J,1,6)
57 .S DGHJ=J
58 .W ?10,$E(K,1,15),?27,L,?41
59 .W $$FMTE^XLFDT($P(DG0,"^"),"5DZ")
60 .W " ",$S($P(DG0,"^",2)=1:"A/T",$P(DG0,"^",2)=2:"S-A",$P(DG0,"^",2)=3:"CNH")
61 .D W
62 Q
63W W ?58,$$FMTE^XLFDT($P(DG0,U,3),"5DZ")
64 W ?71,$J($P(DG0,"^",5),2),?76,$J($P(DG0,"^",4),2)
65 D FY
66 S DGNEW=0
67 I $Y>(IOSL-6)&($O(^UTILITY($J,"S",I,J,K))'="") D HD S DGNEW=1
68 Q
69HD D END
70 Q:DGFL
71 S DGPG=DGPG+1
72 I FIRST>1!($E(IOST)="C") W @IOF
73 W !?28,"RUG-II RECORD STATUS REPORT",!?30,$$FMTE^XLFDT(DGB+.1,"5DZ")," - ",$$FMTE^XLFDT(DGE,"5DZ"),!?32,"RUN: ",DGNOW,!!,"LOCATION: ",I,?71,"PAGE: ",$J(DGPG,3)
74 W !!,"RECORD",?13,"PATIENT",?42,"ASSESSMENT",?70,"ADL",!,"STATUS",?13,"NAME",?30,"SSN",?42,"DATE/PURPOSE",?58,"A/T DATE",?70,"SUM",?75,"RUG",?81,"WWU" K X S $P(X,"_",85)="" W !,X,!
75 Q
76END S DGFL=0
77 Q:'DGPG!($E(IOST)'="C")
78 F PG=$Y:1:(IOSL-6) W !
79 R !!,"Enter <RETURN> to continue, '^' to halt",X:DTIME
80 S:(X["^")!('$T) DGFL=1
81 Q
82FY Q:'$P(DG0,"^",4)
83 K DGWWU
84 S DGAD=$P(DG0,"^",1),DGYR=$E(DGAD,1,3)_"0000"
85 S:$E(DGAD,4,5)>9 DGYR=DGYR+10000
86 W ?80,$J($S($D(^DG(45.91,$P(DG0,"^",4),"FY",DGYR,0)):$P(^(0),"^",2),1:"N/A"),4)
87 Q
Note: See TracBrowser for help on using the repository browser.