Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ACDRR2P

ACDRR2P.m

Go to the documentation of this file.
ACDRR2P ;IHS/ADC/EDE/KML - PRINT REPORT;
 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
 ;
START ;
 D INIT
 D BODY
 D EOJ
 Q
 ;
INIT ;
 U IO
 I '$D(ZTQUEUED),'$D(IO("S")),$E(IOST,1,2)="C-" W @IOF
 S ACDPAGE=0,ACDSHDR=""
 D HEADER
 Q
 ;
BODY ; WRITE BODY OF REPORT
 NEW C,H,Z
 S ACDQ=0
 D TOTALS
 Q:ACDQ
 D PROVS
 Q:ACDQ
 Q
 ;
TOTALS ; TOTALS REPORT
 S X=^TMP("ACDRR2",ACDJOB,ACDBT,"SEEN")
 W !
 W $$LJRF^ACD("TOTAL PATIENTS SEEN",37,".")," ",X,!
 W "  (INFO/REFERRALS,CRISIS BRIEFS & INTERVENTIONS EXCLUDED)",!
 ;
 S ACDSHDR="W ""TOTAL HOURS BY VISIT TYPE"""
 D SUBHDR
 Q:ACDQ
 S ACDVT=""
 F  S ACDVT=$O(^TMP("ACDRR2",ACDJOB,ACDBT,"VISIT TYPE",ACDVT)) Q:ACDVT=""  S Z=+$G(^(ACDVT,"HOURS")) D  Q:ACDQ
 .  D F Q:ACDQ
 .  S X=$$PRTVT(ACDVT)
 .  W ?2,$$LJRF^ACD(X,35,".")," ",Z,!
 .  Q
 Q:ACDQ
 ;
 S ACDSHDR="W ""TOTAL HOURS BY CLIENT SERVICE"""
 D SUBHDR
 Q:ACDQ
 S Y=0
 F  S Y=$O(^TMP("ACDRR2",ACDJOB,ACDBT,"VISIT TYPE","CS",Y)) Q:'Y  S Z=+$G(^(Y,"HOURS")) D  Q:ACDQ
 .  D F Q:ACDQ
 .  S X=$P(^ACDSERV(Y,0),U)
 .  W ?2,$$LJRF^ACD(X,35,".")," ",Z,!
 .  Q
 Q:ACDQ
 ;
 S ACDSHDR="W ""TOTAL HOURS BY PREVENTION ACTIVITY"""
 D SUBHDR
 Q:ACDQ
 S Y=0
 F  S Y=$O(^TMP("ACDRR2",ACDJOB,ACDBT,"VISIT TYPE","PREV",Y)) Q:'Y  S Z=+$G(^(Y,"HOURS")) D  Q:ACDQ
 .  D F Q:ACDQ
 .  S X=$P(^ACDPREV(9002170.9,Y,0),U)
 .  W ?2,$$LJRF^ACD(X,35,".")," ",Z,!
 .  Q
 Q:ACDQ
 Q
 ;
PROVS ; PROVIDER REPORTS
 ;
 S ACDPROV=""
 F  S ACDPROV=$O(^TMP("ACDRR2",ACDJOB,ACDBT,"PROV",ACDPROV)) Q:ACDPROV=""  D PROVIDER Q:ACDQ
 Q:ACDQ
 Q
 ;
PROVIDER ; WRITE ONE PROVIDERS INFO
 S ACDSHDR="W ""PROVIDER WORKLOAD INFORMATION"""
 D EOP
 Q:ACDQ
 W "PROVIDER:  ",ACDPROV,!
 ; total pp pats, total hours, total without hours
 S Z=+$G(^TMP("ACDRR2",ACDJOB,ACDBT,"PROV",ACDPROV,"PP"))
 W ?2,$$LJRF^ACD("PRIMARY PROVIDER PATIENT COUNT",35,".")," ",Z,!
 S Z=+$G(^TMP("ACDRR2",ACDJOB,ACDBT,"PROV",ACDPROV,"TOT","TOTAL HOURS"))
 W ?2,$$LJRF^ACD("TOTAL HOURS",35,".")," ",Z,!
 S Z=+$G(^TMP("ACDRR2",ACDJOB,ACDBT,"PROV",ACDPROV,"TOT","HOURS NR"))
 W ?2,$$LJRF^ACD("HOURS NOT RECORDED VISIT COUNT",35,".")," ",Z,!
 ; counts by visit type
 S ACDSHDR="W ""HOURS/COUNT BY VISIT TYPE"",?38,""TOTAL"",?49,""AVG"",?61,""HC"",?71,""NRC"""
 D SUBHDR
 Q:ACDQ
 F ACDTC="IN","RE","TD","FU","IR","OT","CS","PREV","INTV" D  Q:ACDQ
 .  Q:'$D(^TMP("ACDRR2",ACDJOB,ACDBT,"PROV",ACDPROV,"VT",ACDTC))
 .  D F Q:ACDQ
 .  S H=+$G(^TMP("ACDRR2",ACDJOB,ACDBT,"PROV",ACDPROV,"VT",ACDTC,"HOURS"))
 .  S C=+$G(^TMP("ACDRR2",ACDJOB,ACDBT,"PROV",ACDPROV,"VT",ACDTC,"HOURS CNT"))
 .  S Z=+$G(^TMP("ACDRR2",ACDJOB,ACDBT,"PROV",ACDPROV,"VT",ACDTC,"HOURS NR"))
 .  S ACDTC=$$PRTVT(ACDTC)
 .  W ?2,$$LJRF^ACD(ACDTC,35,".")," ",H,?48,$S(C:$J(H/C,5,2),1:" 0"),?61,C,?71,Z,!
 .  Q
 Q:ACDQ
 ; hours/counts by client service
 S ACDSHDR="W ""HOURS/COUNT BY CLIENT SERVICE"",?38,""TOTAL"",?49,""AVG"",?61,""HC"",?71,""NRC"""
 D SUBHDR
 Q:ACDQ
 S ACDCS=0
 F  S ACDCS=$O(^TMP("ACDRR2",ACDJOB,ACDBT,"PROV",ACDPROV,"VT","CS",ACDCS)) Q:'ACDCS  D  Q:ACDQ
 .  D F Q:ACDQ
 .  S H=+$G(^TMP("ACDRR2",ACDJOB,ACDBT,"PROV",ACDPROV,"VT","CS",ACDCS,"HOURS"))
 .  S C=+$G(^TMP("ACDRR2",ACDJOB,ACDBT,"PROV",ACDPROV,"VT","CS",ACDCS,"HOURS CNT"))
 .  S X=$P($G(^ACDSERV(ACDCS,0)),U)
 .  S Z=0
 .  W ?2,$$LJRF^ACD(X,35,".")," ",H,?48,$S(C:$J(H/C,5,2),1:" 0"),?61,C,?71,Z,!
 .  Q
 Q:ACDQ
 ; hours/counts by prevention
 S ACDSHDR="W ""HOURS/COUNT BY PREVENTION ACTIVITY"",?38,""TOTAL"",?49,""AVG"",?61,""HC"",?71,""NRC"""
 D SUBHDR
 Q:ACDQ
 S ACDPREV=0
 F  S ACDPREV=$O(^TMP("ACDRR2",ACDJOB,ACDBT,"PROV",ACDPROV,"VT","PREV",ACDPREV)) Q:'ACDPREV  D  Q:ACDQ
 .  D F Q:ACDQ
 .  S H=+$G(^TMP("ACDRR2",ACDJOB,ACDBT,"PROV",ACDPROV,"VT","PREV",ACDPREV,"HOURS"))
 .  S C=+$G(^TMP("ACDRR2",ACDJOB,ACDBT,"PROV",ACDPROV,"VT","PREV",ACDPREV,"HOURS CNT"))
 .  S X=$P($G(^ACDPREV(9002170.9,ACDPREV,0)),U)
 .  S Z=0
 .  W ?2,$$LJRF^ACD(X,35,".")," ",H,?48,$S(C:$J(H/C,5,2),1:" 0"),?61,C,?71,Z,!
 .  Q
 Q:ACDQ
 ;
 Q
 ;
F ;Form feed
 NEW V,W,X,Y,Z
 I $Y+4>IOSL D EOP
 Q
 ;
EOP ; END OF PAGE
 S ACDQ=0
 D PAUSE
 Q:ACDQ
 W @IOF
 D HEADER
 Q
 ;
PAUSE ; PAUSE FOR USER
 I '$D(ZTQUEUED),'$D(IO("S")),$E(IOST,1,2)'="P-" D PAUSE^ACDDEU S:$D(DIRUT) ACDQ=1
 Q
 ;
 S ACDPAGE=ACDPAGE+1
 W !,$$CTR^ACD("CDMIS PROVIDER WORKLOAD REPORT",80),!!
 W "Run at ",ACDSITE," for ",$$USR^ACD()," on ",$$FMTE^XLFDT(DT),!
 W "for date range ",$$FMTE^XLFDT(ACDDTLO)," through ",$$FMTE^XLFDT(ACDDTHI),?72,"Page ",$J(ACDPAGE,3),!
 W $$REPEAT^XLFSTR("=",80),!
 D SUBHDR
 Q
 ;
SUBHDR ; WRITE SUB HEADER
 Q:ACDSHDR=""
 I $Y+7>IOSL D EOP Q
 W !
 X ACDSHDR
 W !!
 Q
 ;
PRTVT(VT) ; RETURN PRINTABLE VISIT TYPE
 NEW X
 S X=$T(@("VT"_VT)),X=$P(X,";;",2)
 S:X="" X="???"
 W:X="???" "-->"_VT_"<--",!
 Q X
VTCS ;;CLIENT SERVICE
VTIN ;;INITIAL
VTRE ;;REOPEN
VTTD ;;TRANSFER/DISCHARGE/CLOSE
VTFU ;;FOLLOWUP
VTIR ;;INFO/REFERRAL
VTOT ;;CRISIS BRIEF
VTPREV ;;PREVENTION
VTINTV ;;INTERVENTION
 ;
EOJ ;
 W:IO'=IO(0) @IOF
 K ^TMP("ACDRR2",ACDJOB,ACDBT)
 Q