ACDRR1PB ;IHS/ADC/EDE/KML - BROKE UP ACDRR1P;
;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
;
ALCDRUG ;EP-alcohol/drug problem
D F Q:ACDQ
W !!,?50,"SEX",?68,"AGE",!
W "PATIENT COUNT BY ALCOHOL/DRUG PROBLEM",?48,"M",?55,"F",?62,"<13",?67,"13-20",?75,"21+",!!
; seen
D F Q:ACDQ
F %="M","F" S @%=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN",%)
F %=1:1:3 S %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN","AGE",%)
W ?2,$$LJRF^ACD("TOTAL SEEN",28,".")," ",X,?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5),!
; alcohol
D F Q:ACDQ
S Y=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL")
F %="M","F" S @%=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL",%)
F %=1:1:3 S %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL","AGE",%)
W ?2,$$LJRF^ACD("ALCOHOL",28,".")," ",Y I Y W ?37,$J((Y/X*100),3,0),"%",?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5)
W !
; drugs
D F Q:ACDQ
S Y=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS")
F %="M","F" S @%=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS",%)
F %=1:1:3 S %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS","AGE",%)
W ?2,$$LJRF^ACD("DRUGS",28,".")," ",Y I Y W ?37,$J((Y/X*100),3,0),"%",?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5)
W !
; alcohol&drugs
D F Q:ACDQ
S Y=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL&DRUGS")
F %="M","F" S @%=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL&DRUGS",%)
F %=1:1:3 S %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL&DRUGS","AGE",%)
W ?2,$$LJRF^ACD("ALCOHOL&DRUGS",28,".")," ",Y I Y W ?37,$J((Y/X*100),3,0),"%",?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5)
W !
; alcohol only
D F Q:ACDQ
S Y=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL ONLY")
F %="M","F" S @%=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL ONLY",%)
F %=1:1:3 S %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL ONLY","AGE",%)
W ?2,$$LJRF^ACD("ALCOHOL ONLY",28,".")," ",Y I Y W ?37,$J((Y/X*100),3,0),"%",?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5)
W !
; drugs only
D F Q:ACDQ
S Y=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS ONLY")
F %="M","F" S @%=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS ONLY",%)
F %=1:1:3 S %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS ONLY","AGE",%)
W ?2,$$LJRF^ACD("DRUGS ONLY",28,".")," ",Y I Y W ?37,$J((Y/X*100),3,0),"%",?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5)
W !
; neither
D F Q:ACDQ
S Y=^TMP("ACDRR1",ACDJOB,ACDBT,"NEITHER")
F %="M","F" S @%=^TMP("ACDRR1",ACDJOB,ACDBT,"NEITHER",%)
F %=1:1:3 S %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"NEITHER","AGE",%)
W ?2,$$LJRF^ACD("NEITHER",28,".")," ",Y I Y W ?37,$J((Y/X*100),3,0),"%",?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5)
W !
Q
;
DAYSCS ;EP-alcohol/drug problem days used & client service info
D F Q:ACDQ
W !
W ?30,"AVG",?40,"CLIENT SERVICE INFO",!
W ?27,"DAYS USED",?41,"AVG #CS",?51,"AVG HRS",!!
; alcohol
D F Q:ACDQ
S Y=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL")
S W=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL","CS")
S V=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL","DAYS")
S Z=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL","HRS")
W ?2,$$LJRF^ACD("ALCOHOL",28,".") I Y W " ",$P(V/Y,"."),?42,$J(W/Y,5,0),?55,$J(Z/Y,2,0)
W !
; drugs
D F Q:ACDQ
S Y=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS")
S W=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS","CS")
S V=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS","DAYS")
S Z=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS","HRS")
W ?2,$$LJRF^ACD("DRUGS",28,".") I Y W " ",$P(V/Y,"."),?42,$J(W/Y,5,0),?55,$J(Z/Y,2,0)
W !
; alcohol&drugs
D F Q:ACDQ
S Y=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL&DRUGS")
S W=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL&DRUGS","CS")
S V=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL&DRUGS","DAYS")
S Z=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL&DRUGS","HRS")
W ?2,$$LJRF^ACD("ALCOHOL&DRUGS",28,".") I Y W " ",$P(V/Y,"."),?42,$J(W/Y,5,0),?55,$J(Z/Y,2,0)
W !
; alcohol only
D F Q:ACDQ
S Y=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL ONLY")
S W=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL ONLY","CS")
S V=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL ONLY","DAYS")
S Z=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL ONLY","HRS")
W ?2,$$LJRF^ACD("ALCOHOL ONLY",28,".") I Y W " ",$P(V/Y,"."),?42,$J(W/Y,5,0),?55,$J(Z/Y,2,0)
W !
; drugs only
D F Q:ACDQ
S Y=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS ONLY")
S W=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS ONLY","CS")
S V=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS ONLY","DAYS")
S Z=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS ONLY","HRS")
W ?2,$$LJRF^ACD("DRUGS ONLY",28,".") I Y W " ",$P(V/Y,"."),?42,$J(W/Y,5,0),?55,$J(Z/Y,2,0)
W !
; neither
D F Q:ACDQ
S Y=^TMP("ACDRR1",ACDJOB,ACDBT,"NEITHER")
S W=^TMP("ACDRR1",ACDJOB,ACDBT,"NEITHER","CS")
S Z=^TMP("ACDRR1",ACDJOB,ACDBT,"NEITHER","HRS")
W ?2,$$LJRF^ACD("NEITHER",28,".") I Y W ?42,$J(W/Y,5,0),?55,$J(Z/Y,2,0)
W !
Q
;
TOBACCO ;EP-tobacco
D F Q:ACDQ
W !!,?50,"SEX",?68,"AGE",!
W "PATIENT COUNT BY TOBACCO USE",?48,"M",?55,"F",?62,"<13",?67,"13-20",?75,"21+",!!
F %="M","F" S @%=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN",%)
F %=1:1:3 S %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN","AGE",%)
W ?2,$$LJRF^ACD("TOTAL SEEN",28,".")," ",X,?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5),!
F T=1,2,3 D
. Q:'$D(^TMP("ACDRR1",ACDJOB,ACDBT,"TOBACCO",T))
. D F Q:ACDQ
. S Y=^TMP("ACDRR1",ACDJOB,ACDBT,"TOBACCO",T)
. F %="M","F" S @%=^TMP("ACDRR1",ACDJOB,ACDBT,"TOBACCO",T,%)
. F %=1:1:3 S %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"TOBACCO",T,"AGE",%)
. S T=$S(T=1:"(SMOKING)",T=2:"(SMOKELESS)",1:"(SMOKING&SMOKELESS)")
. W ?2,$$LJRF^ACD("TOBACCO"_T,28,".")," ",Y I Y W ?37,$J((Y/X*100),3,0),"%",?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5)
. W !
. Q
Q
;
PRIPROB ;EP-primary problem
D F Q:ACDQ
W !!,?50,"SEX",?68,"AGE",!
W "PATIENT COUNT BY PRIMARY PROBLEM",?48,"M",?55,"F",?62,"<13",?67,"13-20",?75,"21+",!!
F %="M","F" S @%=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN",%)
F %=1:1:3 S %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN","AGE",%)
W ?2,$$LJRF^ACD("TOTAL SEEN",28,".")," ",X,?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5),!
S Y="A"
F S Y=$O(^TMP("ACDRR1",ACDJOB,ACDBT,"PRI PROB",Y),-1) Q:'Y D Q:ACDQ
. S ACDPRIEN=0
. F S ACDPRIEN=$O(^TMP("ACDRR1",ACDJOB,ACDBT,"PRI PROB",Y,ACDPRIEN)) Q:'ACDPRIEN S M=$G(^(ACDPRIEN,"M")),F=$G(^("F")) S %(1)=^("AGE",1),%(2)=^(2),%(3)=^(3) D Q:ACDQ
.. S Z=$P($G(^ACDPROB(ACDPRIEN,0)),U)
.. D F Q:ACDQ
.. W ?2,$$LJRF^ACD(Z,28,".")," ",Y,?37,$J((Y/X*100),3,0),"%",?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5),!
.. Q
. Q
Q
;
PROBLEM ;EP-problem
D F Q:ACDQ
W !!,?50,"SEX",?68,"AGE",!
W "PATIENT COUNT BY PROBLEM",?48,"M",?55,"F",?62,"<13",?67,"13-20",?75,"21+",!!
F %="M","F" S @%=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN",%)
F %=1:1:3 S %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN","AGE",%)
W ?2,$$LJRF^ACD("TOTAL SEEN",28,".")," ",X,?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5),!
S Y="A"
F S Y=$O(^TMP("ACDRR1",ACDJOB,ACDBT,"PROBLEM",Y),-1) Q:'Y D Q:ACDQ
. S ACDPRIEN=0
. F S ACDPRIEN=$O(^TMP("ACDRR1",ACDJOB,ACDBT,"PROBLEM",Y,ACDPRIEN)) Q:'ACDPRIEN S M=$G(^(ACDPRIEN,"M")),F=$G(^("F")) S %(1)=^("AGE",1),%(2)=^(2),%(3)=^(3) D Q:ACDQ
.. S Z=$P($G(^ACDPROB(ACDPRIEN,0)),U)
.. D F Q:ACDQ
.. W ?2,$$LJRF^ACD(Z,28,".")," ",Y,?37,$J((Y/X*100),3,0),"%",?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5),!
.. Q
. Q
Q
;
DRUGUSED ;EP-drug used
D F Q:ACDQ
W !!,?50,"SEX",?68,"AGE",!
W "PATIENT COUNT BY DRUG USED",?48,"M",?55,"F",?62,"<13",?67,"13-20",?75,"21+",!!
NEW X
S X=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS")
Q:X<1 ; quit if no drugs used
F %="M","F" S @%=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS",%)
F %=1:1:3 S %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS","AGE",%)
W ?2,$$LJRF^ACD("TOTAL USING DRUGS",28,".")," ",X,?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5),!
S Y="A"
F S Y=$O(^TMP("ACDRR1",ACDJOB,ACDBT,"DRUG",Y),-1) Q:'Y D Q:ACDQ
. S ACDDIEN=0
. F S ACDDIEN=$O(^TMP("ACDRR1",ACDJOB,ACDBT,"DRUG",Y,ACDDIEN)) Q:'ACDDIEN S M=$G(^(ACDDIEN,"M")),F=$G(^("F")) S %(1)=^("AGE",1),%(2)=^(2),%(3)=^(3) D Q:ACDQ
.. S Z=$P($G(^ACDDRUG(ACDDIEN,0)),U) S:Z="" Z=ACDDIEN
.. D F Q:ACDQ
.. W ?2,$$LJRF^ACD(Z,28,".")," ",Y,?37,$J((Y/X*100),3,0),"%",?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5),!
.. Q
. Q
Q
;
DRUGCMB ;EP-drug combinations
I $D(^TMP("ACDRR1",ACDJOB,ACDBT,"DRUG COMBO")) D
. D F Q:ACDQ
. W !!,?50,"SEX",?68,"AGE",!
. W "PATIENT COUNT BY ALCOHOL/DRUG COMBINATIONS",?48,"M",?55,"F",?62,"<13",?67,"13-20",?75,"21+",!
. S Y="A"
. F S Y=$O(^TMP("ACDRR1",ACDJOB,ACDBT,"DRUG COMBO",Y),-1) Q:'Y D Q:ACDQ
.. S ACDCMBO=""
.. F S ACDCMBO=$O(^TMP("ACDRR1",ACDJOB,ACDBT,"DRUG COMBO",Y,ACDCMBO)) Q:ACDCMBO="" S M=$G(^(ACDCMBO,"M")),F=$G(^("F")) S %1=^("AGE",1),%2=^(2),%3=^(3) D Q:ACDQ
... W !
... S Z=""
... F %=1:1 S ACDDIEN=$P(ACDCMBO,",",%) Q:ACDDIEN="" D F Q:ACDQ W:Z'="" ?2,Z,! S Z="" S:ACDDIEN="A" Z="ALCOHOL" I Z="" S Z=$P($G(^ACDDRUG(ACDDIEN,0)),U) S:Z="" Z=ACDDIEN
... D F Q:ACDQ
... W ?2,$$LJRF^ACD(Z,28,".")," ",Y,?37,$J((Y/X*100),3,0),"%",?44,$J(M,5),?51,$J(F,5),?60,$J(%(1),5),?67,$J(%(2),5),?73,$J(%(3),5),!
... Q
.. Q
. Q
Q
;
F ;Form feed
NEW V,W,X,Y,Z
I $Y+4>IOSL D
. I '$D(ZTQUEUED),'$D(IO("S")),$E(IOST,1,2)'="P-" D PAUSE^ACDDEU S:$D(DIRUT) ACDQ=1
. W @IOF
. W !
. Q
Q
ACDRR1PB ;IHS/ADC/EDE/KML - BROKE UP ACDRR1P;
+1 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
+2 ;
ALCDRUG ;EP-alcohol/drug problem
+1 DO F
IF ACDQ
QUIT
+2 WRITE !!,?50,"SEX",?68,"AGE",!
+3 WRITE "PATIENT COUNT BY ALCOHOL/DRUG PROBLEM",?48,"M",?55,"F",?62,"<13",?67,"13-20",?75,"21+",!!
+4 ; seen
+5 DO F
IF ACDQ
QUIT
+6 FOR %="M","F"
SET @%=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN",%)
+7 FOR %=1:1:3
SET %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN","AGE",%)
+8 WRITE ?2,$$LJRF^ACD("TOTAL SEEN",28,".")," ",X,?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5),!
+9 ; alcohol
+10 DO F
IF ACDQ
QUIT
+11 SET Y=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL")
+12 FOR %="M","F"
SET @%=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL",%)
+13 FOR %=1:1:3
SET %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL","AGE",%)
+14 WRITE ?2,$$LJRF^ACD("ALCOHOL",28,".")," ",Y
IF Y
WRITE ?37,$JUSTIFY((Y/X*100),3,0),"%",?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5)
+15 WRITE !
+16 ; drugs
+17 DO F
IF ACDQ
QUIT
+18 SET Y=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS")
+19 FOR %="M","F"
SET @%=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS",%)
+20 FOR %=1:1:3
SET %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS","AGE",%)
+21 WRITE ?2,$$LJRF^ACD("DRUGS",28,".")," ",Y
IF Y
WRITE ?37,$JUSTIFY((Y/X*100),3,0),"%",?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5)
+22 WRITE !
+23 ; alcohol&drugs
+24 DO F
IF ACDQ
QUIT
+25 SET Y=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL&DRUGS")
+26 FOR %="M","F"
SET @%=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL&DRUGS",%)
+27 FOR %=1:1:3
SET %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL&DRUGS","AGE",%)
+28 WRITE ?2,$$LJRF^ACD("ALCOHOL&DRUGS",28,".")," ",Y
IF Y
WRITE ?37,$JUSTIFY((Y/X*100),3,0),"%",?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5)
+29 WRITE !
+30 ; alcohol only
+31 DO F
IF ACDQ
QUIT
+32 SET Y=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL ONLY")
+33 FOR %="M","F"
SET @%=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL ONLY",%)
+34 FOR %=1:1:3
SET %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL ONLY","AGE",%)
+35 WRITE ?2,$$LJRF^ACD("ALCOHOL ONLY",28,".")," ",Y
IF Y
WRITE ?37,$JUSTIFY((Y/X*100),3,0),"%",?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5)
+36 WRITE !
+37 ; drugs only
+38 DO F
IF ACDQ
QUIT
+39 SET Y=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS ONLY")
+40 FOR %="M","F"
SET @%=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS ONLY",%)
+41 FOR %=1:1:3
SET %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS ONLY","AGE",%)
+42 WRITE ?2,$$LJRF^ACD("DRUGS ONLY",28,".")," ",Y
IF Y
WRITE ?37,$JUSTIFY((Y/X*100),3,0),"%",?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5)
+43 WRITE !
+44 ; neither
+45 DO F
IF ACDQ
QUIT
+46 SET Y=^TMP("ACDRR1",ACDJOB,ACDBT,"NEITHER")
+47 FOR %="M","F"
SET @%=^TMP("ACDRR1",ACDJOB,ACDBT,"NEITHER",%)
+48 FOR %=1:1:3
SET %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"NEITHER","AGE",%)
+49 WRITE ?2,$$LJRF^ACD("NEITHER",28,".")," ",Y
IF Y
WRITE ?37,$JUSTIFY((Y/X*100),3,0),"%",?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5)
+50 WRITE !
+51 QUIT
+52 ;
DAYSCS ;EP-alcohol/drug problem days used & client service info
+1 DO F
IF ACDQ
QUIT
+2 WRITE !
+3 WRITE ?30,"AVG",?40,"CLIENT SERVICE INFO",!
+4 WRITE ?27,"DAYS USED",?41,"AVG #CS",?51,"AVG HRS",!!
+5 ; alcohol
+6 DO F
IF ACDQ
QUIT
+7 SET Y=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL")
+8 SET W=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL","CS")
+9 SET V=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL","DAYS")
+10 SET Z=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL","HRS")
+11 WRITE ?2,$$LJRF^ACD("ALCOHOL",28,".")
IF Y
WRITE " ",$PIECE(V/Y,"."),?42,$JUSTIFY(W/Y,5,0),?55,$JUSTIFY(Z/Y,2,0)
+12 WRITE !
+13 ; drugs
+14 DO F
IF ACDQ
QUIT
+15 SET Y=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS")
+16 SET W=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS","CS")
+17 SET V=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS","DAYS")
+18 SET Z=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS","HRS")
+19 WRITE ?2,$$LJRF^ACD("DRUGS",28,".")
IF Y
WRITE " ",$PIECE(V/Y,"."),?42,$JUSTIFY(W/Y,5,0),?55,$JUSTIFY(Z/Y,2,0)
+20 WRITE !
+21 ; alcohol&drugs
+22 DO F
IF ACDQ
QUIT
+23 SET Y=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL&DRUGS")
+24 SET W=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL&DRUGS","CS")
+25 SET V=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL&DRUGS","DAYS")
+26 SET Z=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL&DRUGS","HRS")
+27 WRITE ?2,$$LJRF^ACD("ALCOHOL&DRUGS",28,".")
IF Y
WRITE " ",$PIECE(V/Y,"."),?42,$JUSTIFY(W/Y,5,0),?55,$JUSTIFY(Z/Y,2,0)
+28 WRITE !
+29 ; alcohol only
+30 DO F
IF ACDQ
QUIT
+31 SET Y=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL ONLY")
+32 SET W=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL ONLY","CS")
+33 SET V=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL ONLY","DAYS")
+34 SET Z=^TMP("ACDRR1",ACDJOB,ACDBT,"ALCOHOL ONLY","HRS")
+35 WRITE ?2,$$LJRF^ACD("ALCOHOL ONLY",28,".")
IF Y
WRITE " ",$PIECE(V/Y,"."),?42,$JUSTIFY(W/Y,5,0),?55,$JUSTIFY(Z/Y,2,0)
+36 WRITE !
+37 ; drugs only
+38 DO F
IF ACDQ
QUIT
+39 SET Y=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS ONLY")
+40 SET W=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS ONLY","CS")
+41 SET V=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS ONLY","DAYS")
+42 SET Z=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS ONLY","HRS")
+43 WRITE ?2,$$LJRF^ACD("DRUGS ONLY",28,".")
IF Y
WRITE " ",$PIECE(V/Y,"."),?42,$JUSTIFY(W/Y,5,0),?55,$JUSTIFY(Z/Y,2,0)
+44 WRITE !
+45 ; neither
+46 DO F
IF ACDQ
QUIT
+47 SET Y=^TMP("ACDRR1",ACDJOB,ACDBT,"NEITHER")
+48 SET W=^TMP("ACDRR1",ACDJOB,ACDBT,"NEITHER","CS")
+49 SET Z=^TMP("ACDRR1",ACDJOB,ACDBT,"NEITHER","HRS")
+50 WRITE ?2,$$LJRF^ACD("NEITHER",28,".")
IF Y
WRITE ?42,$JUSTIFY(W/Y,5,0),?55,$JUSTIFY(Z/Y,2,0)
+51 WRITE !
+52 QUIT
+53 ;
TOBACCO ;EP-tobacco
+1 DO F
IF ACDQ
QUIT
+2 WRITE !!,?50,"SEX",?68,"AGE",!
+3 WRITE "PATIENT COUNT BY TOBACCO USE",?48,"M",?55,"F",?62,"<13",?67,"13-20",?75,"21+",!!
+4 FOR %="M","F"
SET @%=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN",%)
+5 FOR %=1:1:3
SET %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN","AGE",%)
+6 WRITE ?2,$$LJRF^ACD("TOTAL SEEN",28,".")," ",X,?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5),!
+7 FOR T=1,2,3
Begin DoDot:1
+8 IF '$DATA(^TMP("ACDRR1",ACDJOB,ACDBT,"TOBACCO",T))
QUIT
+9 DO F
IF ACDQ
QUIT
+10 SET Y=^TMP("ACDRR1",ACDJOB,ACDBT,"TOBACCO",T)
+11 FOR %="M","F"
SET @%=^TMP("ACDRR1",ACDJOB,ACDBT,"TOBACCO",T,%)
+12 FOR %=1:1:3
SET %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"TOBACCO",T,"AGE",%)
+13 SET T=$SELECT(T=1:"(SMOKING)",T=2:"(SMOKELESS)",1:"(SMOKING&SMOKELESS)")
+14 WRITE ?2,$$LJRF^ACD("TOBACCO"_T,28,".")," ",Y
IF Y
WRITE ?37,$JUSTIFY((Y/X*100),3,0),"%",?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5)
+15 WRITE !
+16 QUIT
End DoDot:1
+17 QUIT
+18 ;
PRIPROB ;EP-primary problem
+1 DO F
IF ACDQ
QUIT
+2 WRITE !!,?50,"SEX",?68,"AGE",!
+3 WRITE "PATIENT COUNT BY PRIMARY PROBLEM",?48,"M",?55,"F",?62,"<13",?67,"13-20",?75,"21+",!!
+4 FOR %="M","F"
SET @%=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN",%)
+5 FOR %=1:1:3
SET %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN","AGE",%)
+6 WRITE ?2,$$LJRF^ACD("TOTAL SEEN",28,".")," ",X,?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5),!
+7 SET Y="A"
+8 FOR
SET Y=$ORDER(^TMP("ACDRR1",ACDJOB,ACDBT,"PRI PROB",Y),-1)
IF 'Y
QUIT
Begin DoDot:1
+9 SET ACDPRIEN=0
+10 FOR
SET ACDPRIEN=$ORDER(^TMP("ACDRR1",ACDJOB,ACDBT,"PRI PROB",Y,ACDPRIEN))
IF 'ACDPRIEN
QUIT
SET M=$GET(^(ACDPRIEN,"M"))
SET F=$GET(^("F"))
SET %(1)=^("AGE",1)
SET %(2)=^(2)
SET %(3)=^(3)
Begin DoDot:2
+11 SET Z=$PIECE($GET(^ACDPROB(ACDPRIEN,0)),U)
+12 DO F
IF ACDQ
QUIT
+13 WRITE ?2,$$LJRF^ACD(Z,28,".")," ",Y,?37,$JUSTIFY((Y/X*100),3,0),"%",?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5),!
+14 QUIT
End DoDot:2
IF ACDQ
QUIT
+15 QUIT
End DoDot:1
IF ACDQ
QUIT
+16 QUIT
+17 ;
PROBLEM ;EP-problem
+1 DO F
IF ACDQ
QUIT
+2 WRITE !!,?50,"SEX",?68,"AGE",!
+3 WRITE "PATIENT COUNT BY PROBLEM",?48,"M",?55,"F",?62,"<13",?67,"13-20",?75,"21+",!!
+4 FOR %="M","F"
SET @%=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN",%)
+5 FOR %=1:1:3
SET %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"SEEN","AGE",%)
+6 WRITE ?2,$$LJRF^ACD("TOTAL SEEN",28,".")," ",X,?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5),!
+7 SET Y="A"
+8 FOR
SET Y=$ORDER(^TMP("ACDRR1",ACDJOB,ACDBT,"PROBLEM",Y),-1)
IF 'Y
QUIT
Begin DoDot:1
+9 SET ACDPRIEN=0
+10 FOR
SET ACDPRIEN=$ORDER(^TMP("ACDRR1",ACDJOB,ACDBT,"PROBLEM",Y,ACDPRIEN))
IF 'ACDPRIEN
QUIT
SET M=$GET(^(ACDPRIEN,"M"))
SET F=$GET(^("F"))
SET %(1)=^("AGE",1)
SET %(2)=^(2)
SET %(3)=^(3)
Begin DoDot:2
+11 SET Z=$PIECE($GET(^ACDPROB(ACDPRIEN,0)),U)
+12 DO F
IF ACDQ
QUIT
+13 WRITE ?2,$$LJRF^ACD(Z,28,".")," ",Y,?37,$JUSTIFY((Y/X*100),3,0),"%",?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5),!
+14 QUIT
End DoDot:2
IF ACDQ
QUIT
+15 QUIT
End DoDot:1
IF ACDQ
QUIT
+16 QUIT
+17 ;
DRUGUSED ;EP-drug used
+1 DO F
IF ACDQ
QUIT
+2 WRITE !!,?50,"SEX",?68,"AGE",!
+3 WRITE "PATIENT COUNT BY DRUG USED",?48,"M",?55,"F",?62,"<13",?67,"13-20",?75,"21+",!!
+4 NEW X
+5 SET X=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS")
+6 ; quit if no drugs used
IF X<1
QUIT
+7 FOR %="M","F"
SET @%=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS",%)
+8 FOR %=1:1:3
SET %(%)=^TMP("ACDRR1",ACDJOB,ACDBT,"DRUGS","AGE",%)
+9 WRITE ?2,$$LJRF^ACD("TOTAL USING DRUGS",28,".")," ",X,?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5),!
+10 SET Y="A"
+11 FOR
SET Y=$ORDER(^TMP("ACDRR1",ACDJOB,ACDBT,"DRUG",Y),-1)
IF 'Y
QUIT
Begin DoDot:1
+12 SET ACDDIEN=0
+13 FOR
SET ACDDIEN=$ORDER(^TMP("ACDRR1",ACDJOB,ACDBT,"DRUG",Y,ACDDIEN))
IF 'ACDDIEN
QUIT
SET M=$GET(^(ACDDIEN,"M"))
SET F=$GET(^("F"))
SET %(1)=^("AGE",1)
SET %(2)=^(2)
SET %(3)=^(3)
Begin DoDot:2
+14 SET Z=$PIECE($GET(^ACDDRUG(ACDDIEN,0)),U)
IF Z=""
SET Z=ACDDIEN
+15 DO F
IF ACDQ
QUIT
+16 WRITE ?2,$$LJRF^ACD(Z,28,".")," ",Y,?37,$JUSTIFY((Y/X*100),3,0),"%",?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5),!
+17 QUIT
End DoDot:2
IF ACDQ
QUIT
+18 QUIT
End DoDot:1
IF ACDQ
QUIT
+19 QUIT
+20 ;
DRUGCMB ;EP-drug combinations
+1 IF $DATA(^TMP("ACDRR1",ACDJOB,ACDBT,"DRUG COMBO"))
Begin DoDot:1
+2 DO F
IF ACDQ
QUIT
+3 WRITE !!,?50,"SEX",?68,"AGE",!
+4 WRITE "PATIENT COUNT BY ALCOHOL/DRUG COMBINATIONS",?48,"M",?55,"F",?62,"<13",?67,"13-20",?75,"21+",!
+5 SET Y="A"
+6 FOR
SET Y=$ORDER(^TMP("ACDRR1",ACDJOB,ACDBT,"DRUG COMBO",Y),-1)
IF 'Y
QUIT
Begin DoDot:2
+7 SET ACDCMBO=""
+8 FOR
SET ACDCMBO=$ORDER(^TMP("ACDRR1",ACDJOB,ACDBT,"DRUG COMBO",Y,ACDCMBO))
IF ACDCMBO=""
QUIT
SET M=$GET(^(ACDCMBO,"M"))
SET F=$GET(^("F"))
SET %1=^("AGE",1)
SET %2=^(2)
SET %3=^(3)
Begin DoDot:3
+9 WRITE !
+10 SET Z=""
+11 FOR %=1:1
SET ACDDIEN=$PIECE(ACDCMBO,",",%)
IF ACDDIEN=""
QUIT
DO F
IF ACDQ
QUIT
IF Z'=""
WRITE ?2,Z,!
SET Z=""
IF ACDDIEN="A"
SET Z="ALCOHOL"
IF Z=""
SET Z=$PIECE($GET(^ACDDRUG(ACDDIEN,0)),U)
IF Z=""
SET Z=ACDDIEN
+12 DO F
IF ACDQ
QUIT
+13 WRITE ?2,$$LJRF^ACD(Z,28,".")," ",Y,?37,$JUSTIFY((Y/X*100),3,0),"%",?44,$JUSTIFY(M,5),?51,$JUSTIFY(F,5),?60,$JUSTIFY(%(1),5),?67,$JUSTIFY(%(2),5),?73,$JUSTIFY(%(3),5),!
+14 QUIT
End DoDot:3
IF ACDQ
QUIT
+15 QUIT
End DoDot:2
IF ACDQ
QUIT
+16 QUIT
End DoDot:1
+17 QUIT
+18 ;
F ;Form feed
+1 NEW V,W,X,Y,Z
+2 IF $Y+4>IOSL
Begin DoDot:1
+3 IF '$DATA(ZTQUEUED)
IF '$DATA(IO("S"))
IF $EXTRACT(IOST,1,2)'="P-"
DO PAUSE^ACDDEU
IF $DATA(DIRUT)
SET ACDQ=1
+4 WRITE @IOF
+5 WRITE !
+6 QUIT
End DoDot:1
+7 QUIT