source: FOIAVistA/trunk/r/SCHEDULING-SD-SC/SCRPW54.m@ 1354

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

initial load of FOIAVistA 6/30/08 version

File size: 7.6 KB
Line 
1SCRPW54 ;RENO/KEITH - Means Test Summary of Visits & Uniques (OP3, OP4, OP5) or (IP3, IP4, IP5) ; 5/21/01 3:32pm
2 ;;5.3;Scheduling;**144,258,466**;AUG 13, 1993;Build 2
3 S SDSTA=$G(SDSTA,2)
4 D RQUE^SCRPW50("START^SCRPW54","Means Test Summary of Visits & Uniques "_$S(SDSTA=8:"(IP3, IP4, IP5)",1:"(OP3, OP4, OP5)"),1) Q
5 ;
6START ;Print report
7 K ^TMP("SCRPW",$J) S (SDSTOP,SDOUT,DFN)=0
8 F S DFN=$O(^SCE("ADFN",DFN)) Q:'DFN!SDOUT S SDT=SD("FYD") F S SDT=$O(^SCE("ADFN",DFN,SDT)) Q:'SDT!SDOUT!(SDT>SD("EDT")) S SDOE=0 F S SDOE=$O(^SCE("ADFN",DFN,SDT,SDOE)) Q:'SDOE!SDOUT D
9 .S SDOE0=$$GETOE^SDOE(SDOE),SDIV=$P(SDOE0,U,11) I $$VALID() D SET(SDIV) D:SDMD SET(0)
10 G:SDOUT EXIT S (SDVCT,SDIV)=""
11 F S SDIV=$O(^TMP("SCRPW",$J,SDIV)) Q:SDIV="" D DLIST,STOP Q:SDOUT D
12 .F SDMT="N","C","G","X","AN","AS" D
13 ..S DFN=0 F S DFN=$O(^TMP("SCRPW",$J,SDIV,SDMT,DFN)) Q:'DFN D
14 ...S SDT=0 F S SDT=$O(^TMP("SCRPW",$J,SDIV,SDMT,DFN,SDT)) Q:'SDT S ^TMP("SCRPW",$J,SDIV,0,DFN,SDT)=SDMT
15 ...Q
16 ..Q
17 .S DFN=0 F S DFN=$O(^TMP("SCRPW",$J,SDIV,0,DFN)) Q:'DFN S SDFV=1,SDT="" F S SDT=$O(^TMP("SCRPW",$J,SDIV,0,DFN,SDT),-1) Q:SDT="" S SDMT=^TMP("SCRPW",$J,SDIV,0,DFN,SDT) D S1(SDMT) S SDFV=0
18 .S SDMT=0 F S SDMT=$O(^TMP("SCRPW",$J,SDIV,SDMT)) Q:SDMT="" D
19 ..I '$G(^TMP("SCRPW",$J,SDIV,SDMT,"TOTAL")) S (^TMP("SCRPW",$J,SDIV,SDMT,"TOTAL"),^TMP("SCRPW",$J,SDIV,SDMT,"AVERAGE AGE"))=0 Q
20 ..S ^TMP("SCRPW",$J,SDIV,SDMT,"AVERAGE AGE")=^TMP("SCRPW",$J,SDIV,SDMT,"AVERAGE AGE")\^TMP("SCRPW",$J,SDIV,SDMT,"TOTAL")
21 ..Q
22 .D AA(SDIV) Q
23 G:SDOUT EXIT S SDLINE="",$P(SDLINE,"-",(IOM+1))="" D NOW^%DTC S Y=% X ^DD("DD") S SDPNOW=$P(Y,":",1,2),SDTIT(1)="<*> MEANS TEST SUMMARY OF VISITS & UNIQUES "_$S(SDSTA=8:"(IP3, IP4, IP5)",1:"(OP3, OP4, OP5)")_" <*>",SDPG=0
24 D:$E(IOST)="C" DISP0^SCRPW23
25 I '$D(^TMP("SCRPW",$J)) S SDPAGE=1,SDX="No activity found within report parameters." D HDR G:SDOUT EXIT W !!?(IOM-$L(SDX)\2),SDX G EXIT
26 G:SDOUT EXIT S SDIVN="" F S SDIVN=$O(SDIV(SDIVN)) Q:SDIVN=""!SDOUT D DPRT(SDIV(SDIVN))
27 G:SDOUT EXIT D:SDVCT>1 DPRT(0)
28EXIT I $E(IOST)="C",'SDOUT N DIR S DIR(0)="E" D ^DIR
29 K ^TMP("SCRPW",$J),%,%H,%I,DFN,DIR,SD,SDAGE,SDDIV,SDFAA,SDFTOT,SDFV,SDH,SDI,SDIV,SDIVN,SDLAB,SDLINE,SDLT,SDMD,SDMO,SDMOTO,SDMT,SDOE,SDOE0,SDSTA
30 K SDPAGE,SDOUT,SDPATE,SDPG,SDPNOW,SDPT0,SDR,SDSC,SDSTOP,SDT,SDTIT,SDTOT,SDV,SDVCT,SDX,SDYR,SDYRTO,X,Y Q
31 ;
32AA(SDIV) ;Average age
33 I '$G(SDFTOT(SDIV)) S (SDFAA(SDIV),SDFTOT(SDIV))=0 Q
34 S SDFAA(SDIV)=SDFAA(SDIV)\SDFTOT(SDIV) Q
35 ;
36DPRT(SDV) ;Print division
37 ;Required input: SDV=division ifn or '0' for combined divisions
38 I SDV S SDTIT(2)="For "_$S(SDDIV["DIVISIONS":"division",1:"facility")_": "_SDIVN
39 I 'SDV S SDTIT(2)="Report for: "_$P(SDDIV,U,2) D
40 .S SDI=2,SDIVN="" F S SDIVN=$O(SDIV(SDIVN)) Q:SDIVN="" S SDI=SDI+1,SDTIT(SDI)=$J("Division: ",$L(SDIVN))_SDIVN
41 .Q
42 S SDPAGE=1 D HDR,HD1(1) Q:SDOUT S SDSC=0 D PLINE1(1) Q:SDOUT
43 W ! D:$Y>(IOSL-8) HDR Q:SDOUT D HD1(2) D PLINE1(2) Q:SDOUT
44 W ! D:$Y>(IOSL-8) HDR Q:SDOUT D HD2
45 F SDLT="MALE","FEMALE","TOTAL","POW STATUS","AVERAGE AGE","UNDER 24","25 - 34","35 - 44","45 - 54","55 - 64","65 - 74","75 - 84","85 - 94","95 & ABOVE" D PLINE2(SDLT) Q:SDOUT
46 Q
47 ;
48PLINE1(SDH) ;Print output line
49 ;Required input: SDH=subheader number
50 S (SDMOTO,SDYRTO)=0
51 ;D PL("CATEGORY A SERVICE CONNECTED","AS") Q:SDOUT
52 D PL("SC - MT COPAY EXEMPT","AS") Q:SDOUT
53 ;D PL("CATEGORY A NON-SERVICE CONNECTED","AN") Q:SDOUT
54 D PL("NSC - MT COPAY EXEMPT","AN") Q:SDOUT
55 ;D PL("TOTAL CATEGORY A MEANS TEST","TA") Q:SDOUT
56 D PL("TOTAL MT COPAY EXEMPT","TA") Q:SDOUT
57 ;D PL("CATEGORY C","C") Q:SDOUT
58 D PL("MT COPAY REQUIRED","C") Q:SDOUT
59 D PL("GMT COPAY REQUIRED","G") Q:SDOUT
60 D PL("NON VETERAN","N") Q:SDOUT
61 D PL("NON APPLICABLE","X") Q:SDOUT
62 S SDX="CURRENT MONTH % OF YEAR TO DATE TOTALS: "_$S('SDYRTO:0,1:SDMOTO*100\SDYRTO)_"%" W !!?(132-$L(SDX)\2),SDX
63 Q
64 ;
65PL(SDLAB,SDMT) ;Print line
66 I $Y>(IOSL-4) D HDR Q:SDOUT D HD1(SDH)
67 S SDMO=+$G(^TMP("SCRPW",$J,SDV,SDMT,$S(SDH=1:"MOVIS",1:"MOTOT")))
68 S SDYR=+$G(^TMP("SCRPW",$J,SDV,SDMT,$S(SDH=1:"VIS",1:"TOTAL")))
69 S SDMOTO=SDMOTO+SDMO,SDYRTO=SDYRTO+SDYR
70 W !?18,$J(SDLAB_":",33),?54,$J(SDMO,9,0),?69,$J(SDLAB_":",33),?105,$J(SDYR,9,0)
71 Q
72 ;
73PLINE2(SDLT) ;Print output line
74 ;Required input: SDLT=output line tag
75 I $Y>(IOSL-4) D HDR Q:SDOUT D HD2
76 W !?6,$J(SDLT_":",12) S (SDTOT,SDI)=0 F SDMT="AS","AN","TA","C","G","N","X" S SDX=+$G(^TMP("SCRPW",$J,SDV,SDMT,SDLT)) W ?(20+(12*SDI)),$J(SDX,10,0) S SDI=SDI+1 S:SDI'=3 SDTOT=SDTOT+SDX
77 S:SDLT="AVERAGE AGE" SDTOT=SDFAA(SDV) W ?104,$J(SDTOT,10,0) Q
78 ;
79HDR ;Print header
80 I $E(IOST)="C",SDPG N DIR S DIR(0)="E" W ! D ^DIR S SDOUT=Y'=1 Q:SDOUT
81 D STOP Q:SDOUT W:SDPG!($E(IOST)="C") $$XY^SCRPW50(IOF,1,0) W:$X $$XY^SCRPW50("",0,0)
82 N SDI S SDI=0 W SDLINE F S SDI=$O(SDTIT(SDI)) Q:'SDI W !?(IOM-$L(SDTIT(SDI))\2),SDTIT(SDI)
83 W !,SDLINE,!,"For Fiscal Year activity through ",SD("PEDT"),!,"Date printed: ",SDPNOW,?(IOM-6-$L(SDPAGE)),"Page: ",SDPAGE,!,SDLINE S SDPAGE=SDPAGE+1,SDPG=1 Q
84 ;
85HD1(SDR) ;Print subheader
86 Q:SDOUT S SDX="**** MEANS TEST VISIT SUMMARY"_$S(SDR=2:" (UNIQUE SSNS BASED ON LATEST VISIT)",1:"")_" ****" W !!?(132-$L(SDX)\2),$E(SDLINE,1,$L(SDX)),!?(132-$L(SDX)\2),SDX,!?(132-$L(SDX)\2),$E(SDLINE,1,$L(SDX))
87 S SDX="CURRENT MONTH MEANS TEST "_$S(SDR=1:"VISITS",1:"UNIQUES") W !!?18,$J(SDX_":",33),?58,"TOTAL"
88 S SDX="YEAR TO DATE MEANS TEST "_$S(SDR=1:"VISITS",1:"UNIQUES") W ?69,$J(SDX_":",33),?109,"TOTAL",!?18,$E(SDLINE,1,45),?69,$E(SDLINE,1,45)
89 Q
90 ;
91HD2 ;Print subheader
92 Q:SDOUT S SDX="**** MEANS TEST UNIQUES BY GENDER, POW STATUS AND AGE ****" W !!?(132-$L(SDX)\2),$E(SDLINE,1,$L(SDX)),!?(132-$L(SDX)\2),SDX,!?(132-$L(SDX)\2),$E(SDLINE,1,$L(SDX))
93 W !?24,"SC",?35,"NSC",?45,"TOTAL"
94 W !?20,"MT COPAY",?32,"MT COPAY",?44,"MT COPAY",?56,"MT COPAY",?68,"GMT COPAY",?87,"NON",?99,"NOT",?109,"GRAND"
95 W !?10,"UNIQUES:",?21,"EXEMPT",?33,"EXEMPT",?45,"EXEMPT",?56,"REQUIRED",?68,"REQUIRED",?83,"VETERAN",?92,"APPLICABLE",?109,"TOTAL"
96 W !?6,$E(SDLINE,1,12) F SDI=0:1:7 W ?(20+(12*SDI)),$E(SDLINE,1,10)
97 Q
98 ;
99DLIST ;Create alphabetic list of divisions found
100 Q:'SDIV S SDX=$P($G(^DG(40.8,SDIV,0)),U) S:'$L(SDX) SDX="**** UNKNOWN ****" S SDIV(SDX)=SDIV,SDVCT=SDVCT+1 Q
101 ;
102VALID() ;Check encounter record
103 I $P(SDOE0,U,4),$P($G(^SC($P(SDOE0,U,4),0)),U,17)="Y" Q 0
104 I SDIV,$$DIV(),$P(SDOE0,U),$P(SDOE0,U,2),'$P(SDOE0,U,6),$P(SDOE0,U,7),$P(SDOE0,U,12)=SDSTA,$P(SDOE0,U,10),$P(SDOE0,U,13) Q 1
105 Q 0
106 ;
107DIV() ;Check division
108 Q:'SDDIV 1 Q $D(SDDIV(SDIV))
109 ;
110STOP ;Check for stop task request
111 S:$D(ZTQUEUED) (SDOUT,ZTSTOP)=$S($$S^%ZTLOAD:1,1:0) Q
112 ;
113SET(SDIV) ;Set division lists
114 ;Required input: SDIV=division ifn or '0' for summary
115 S SDSTOP=SDSTOP+1 I SDSTOP#3000=0 D STOP^SCRPW40 Q:SDOUT
116 S SDMT=$$MTI^SCDXUTL0(DFN,$P(SDOE0,U),$P(SDOE0,U,13),$P(SDOE0,U,10),SDOE) Q:SDMT="U" S ^TMP("SCRPW",$J,SDIV,SDMT,DFN,$P(SDT,"."))=""
117 Q
118 ;
119S1(SDMT) S ^TMP("SCRPW",$J,SDIV,SDMT,"VIS")=$G(^TMP("SCRPW",$J,SDIV,SDMT,"VIS"))+1
120 S:SDT>SD("MOD") ^TMP("SCRPW",$J,SDIV,SDMT,"MOVIS")=$G(^TMP("SCRPW",$J,SDIV,SDMT,"MOVIS"))+1
121 D:(SDMT="AN"!(SDMT="AS")) S1("TA") Q:'SDFV
122 S SDPT0=$G(^DPT(DFN,0)) S SDX=$$SEX()_U_"TOTAL"_U_$$AGE()_$$POW()_$$MOT()
123 F SDI=1:1:$L(SDX,U) S ^TMP("SCRPW",$J,SDIV,SDMT,$P(SDX,U,SDI))=$G(^TMP("SCRPW",$J,SDIV,SDMT,$P(SDX,U,SDI)))+1
124 Q
125 ;
126MOT() Q $S(SDT>SD("MOD"):"^MOTOT",1:"")
127 ;
128SEX() Q $S($P(SDPT0,U,2)="M":"MALE",1:"FEMALE")
129 ;
130POW() Q $S($P($G(^DPT(DFN,.52)),U,5)="Y":"^POW STATUS",1:"")
131 ;
132AGE() S SDAGE=$P(SDPT0,U,3),SDAGE=$E(SDT,1,3)-$E(SDAGE,1,3)-($E(SDT,4,7)<$E(SDAGE,4,7)),^TMP("SCRPW",$J,SDIV,SDMT,"AVERAGE AGE")=$G(^TMP("SCRPW",$J,SDIV,SDMT,"AVERAGE AGE"))+SDAGE
133 I SDMT'="TA" S SDFAA(SDIV)=$G(SDFAA(SDIV))+SDAGE,SDFTOT(SDIV)=$G(SDFTOT(SDIV))+1
134 Q $S(SDAGE<25:"UNDER 24",SDAGE<35:"25 - 34",SDAGE<45:"35 - 44",SDAGE<55:"45 - 54",SDAGE<65:"55 - 64",SDAGE<75:"65 - 74",SDAGE<85:"75 - 84",SDAGE<95:"85 - 94",1:"95 & ABOVE")
Note: See TracBrowser for help on using the repository browser.