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

BGP6DP1L.m

Go to the documentation of this file.
BGP6DP1L ; IHS/CMI/LAB - print ind 1 12 Nov 2010 7:38 AM ;
 ;;16.1;IHS CLINICAL REPORTING;;MAR 22, 2016;Build 170
 ;
 ;HIV SCREENING AGE DIST
I1AGE ;EP  special age tallies
 Q:$G(BGPSUMON)
 S BGPHD1="Active Clinical Pts 5+ w/Persistent Asthma",BGPHD2="Active Clinical Pts 5+ ",BGPHD3=" w/ Persistent Asthma"
 K BGPDAC,BGPDAP,BGPDAB
 S (BGPX,BGPDD)=0 F BGPXX=12:1:22 D I1AGE1
 D I1AGEP
 Q
I1AGE1 ;
 ;
 I BGPXX=12 S BGPP1=2,BGPP2=3
 I BGPXX=13 S BGPP1=4,BGPP2=5
 I BGPXX=14 S BGPP1=6,BGPP2=7
 I BGPXX=15 S BGPP1=8,BGPP2=9
 I BGPXX=16 S BGPP1=10,BGPP2=11
 I BGPXX=17 S BGPP1=12,BGPP2=13
 I BGPXX=18 S BGPP1=14,BGPP2=15
 I BGPXX=19 S BGPP1=16,BGPP2=17
 I BGPXX=20 S BGPP1=18,BGPP2=19
 I BGPXX=21 S BGPP1=20,BGPP2=21
 I BGPXX=22 S BGPP1=22,BGPP2=23
 S BGPZ="A",BGPX=1 D AGES
 S BGPZ="B",BGPX=2 D AGES
 S BGPZ="C",BGPX=3 D AGES
 S BGPZ="D",BGPX=4 D AGES
 Q
AGES ;
 S BGPF="AA.A."_BGPXX_BGPZ S BGPPC=$O(^BGPINDMC("C",BGPF,0))
 D
 .S BGPDF=$P(^BGPINDMC(BGPPC,0),U,8)
 .S BGPNP=$P(^DD(90556.03,BGPDF,0),U,4),N=$P(BGPNP,";"),P=$P(BGPNP,";",2)
 .S $P(BGPDAC(BGPX),U)=$$V^BGP6DP1C(1,BGPRPT,N,P)
 .S $P(BGPDAP(BGPX),U)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V^BGP6DP1C(3,BGPRPT,N,P,2)
 ;S BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
 ;S BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
 ;S BGPBLP=$S(BGPBLD:((BGPBLN/BGPBLD)*100),1:"")
 Q
I1AGEP ;
 S BGPYSTP=1
 I '$G(BGPSUMON),BGPPTYPE="P" D HEADER^BGP6DPH Q:BGPQUIT  D W^BGP6DP(^BGPINDM(BGPIC,53,1,0),0,1,BGPPTYPE) D:$D(^BGPINDM(BGPIC,53,2,0)) W^BGP6DP(^BGPINDM(BGPIC,53,2,0),0,1,BGPPTYPE) D AH
 I BGPPTYPE'="P" D W^BGP6DP("",0,2,BGPPTYPE) D AH
 D W^BGP6DP("CURRENT REPORT PERIOD",0,1,BGPPTYPE)
 D W^BGP6DP($S(BGPPTYPE="P":BGPHD2,1:BGPHD1),0,1,BGPPTYPE)
 I BGPPTYPE="P" D W^BGP6DP(BGPHD3,0,1,BGPPTYPE)
 S BGPARR="BGPDAC" D I1AGEP1
 I '$G(BGPSUMON),BGPPTYPE="P" D HEADER^BGP6DPH Q:BGPQUIT  D W^BGP6DP(^BGPINDM(BGPIC,53,1,0),0,1,BGPPTYPE) D:$D(^BGPINDM(BGPIC,53,2,0)) W^BGP6DP(^BGPINDM(BGPIC,53,2,0),0,1,BGPPTYPE) D AH
 I BGPPTYPE'="P" D W^BGP6DP("",0,2,BGPPTYPE) D AH
 D W^BGP6DP("PREVIOUS REPORT PERIOD",0,1,BGPPTYPE)
 D W^BGP6DP($S(BGPPTYPE="P":BGPHD2,1:BGPHD1),0,1,BGPPTYPE)
 I BGPPTYPE="P" D W^BGP6DP(BGPHD3,0,1,BGPPTYPE)
 S BGPARR="BGPDAP" D I1AGEP1
 I '$G(BGPSUMON),BGPPTYPE="P" D HEADER^BGP6DPH Q:BGPQUIT  D W^BGP6DP(^BGPINDM(BGPIC,53,1,0),0,1,BGPPTYPE) D:$D(^BGPINDM(BGPIC,53,2,0)) W^BGP6DP(^BGPINDM(BGPIC,53,2,0),0,1,BGPPTYPE) D AH
 I BGPPTYPE'="P" D W^BGP6DP("",0,2,BGPPTYPE) D AH
 D W^BGP6DP("BASELINE REPORT PERIOD",0,1,BGPPTYPE)
 D W^BGP6DP($S(BGPPTYPE="P":BGPHD2,1:BGPHD1),0,1,BGPPTYPE)
 I BGPPTYPE="P" D W^BGP6DP(BGPHD3,0,1,BGPPTYPE)
 S BGPARR="BGPDAB" D I1AGEP1
 Q
I1AGEP1 ;
 S T=30 F X=1:1:4 S V=$P(@BGPARR@(X),U) D W^BGP6DP($S(BGPPTYPE="P":$$C(V,0,6),1:$S(V:V,1:0)),0,0,BGPPTYPE,X+1,T) S T=T+11
 D W^BGP6DP("# w/ Management Plan",0,2,BGPPTYPE)
 S T=31 F X=1:1:4 S V=$P(@BGPARR@(X),U,2) D W^BGP6DP($S(BGPPTYPE="P":$$C(V,0,6),1:$S(V:V,1:0)),0,0,BGPPTYPE,X+1,T) S T=T+11
 D W^BGP6DP("% w/ Management Plan",0,1,BGPPTYPE)
 S T=30 F X=1:1:4 S V=$P(@BGPARR@(X),U,3) D W^BGP6DP($S(BGPPTYPE="P":$J(V,6,1),1:$$SB($J(V,6,1))),0,0,BGPPTYPE,X+1,T) S T=T+11
 D W^BGP6DP("# w/ Severity Documented",0,2,BGPPTYPE)
 S T=31 F X=1:1:4 S V=$P(@BGPARR@(X),U,4) D W^BGP6DP($S(BGPPTYPE="P":$$C(V,0,6),1:$S(V:V,1:0)),0,0,BGPPTYPE,X+1,T) S T=T+11
 D W^BGP6DP("% w/ Severity Documented",0,1,BGPPTYPE)
 S T=30 F X=1:1:4 S V=$P(@BGPARR@(X),U,5) D W^BGP6DP($S(BGPPTYPE="P":$J(V,6,1),1:$$SB($J(V,6,1))),0,0,BGPPTYPE,X+1,T) S T=T+11
 D W^BGP6DP("% w/ Control Documented",0,2,BGPPTYPE)
 S T=31 F X=1:1:4 S V=$P(@BGPARR@(X),U,6) D W^BGP6DP($S(BGPPTYPE="P":$$C(V,0,6),1:$S(V:V,1:0)),0,0,BGPPTYPE,X+1,T) S T=T+11
 D W^BGP6DP("% w/ Control Documented",0,1,BGPPTYPE)
 S T=30 F X=1:1:4 S V=$P(@BGPARR@(X),U,7) D W^BGP6DP($S(BGPPTYPE="P":$J(V,6,1),1:$$SB($J(V,6,1))),0,0,BGPPTYPE,X+1,T) S T=T+11
 D W^BGP6DP("# w/ Symptom Free Days Assessed",0,2,BGPPTYPE)
 S T=31 F X=1:1:4 S V=$P(@BGPARR@(X),U,8) D W^BGP6DP($S(BGPPTYPE="P":$$C(V,0,6),1:$S(V:V,1:0)),0,0,BGPPTYPE,X+1,T) S T=T+11
 D W^BGP6DP("% w/ Symptom Free Days Assessed",0,1,BGPPTYPE)
 S T=30 F X=1:1:4 S V=$P(@BGPARR@(X),U,9) D W^BGP6DP($S(BGPPTYPE="P":$J(V,6,1),1:$$SB($J(V,6,1))),0,0,BGPPTYPE,X+1,T) S T=T+11
 D W^BGP6DP("# w/ Symptom Free Days 0-5",0,2,BGPPTYPE)
 S T=31 F X=1:1:4 S V=$P(@BGPARR@(X),U,10) D W^BGP6DP($S(BGPPTYPE="P":$$C(V,0,6),1:$S(V:V,1:0)),0,0,BGPPTYPE,X+1,T) S T=T+11
 D W^BGP6DP("% w/ Symptom Free Days 0-5",0,1,BGPPTYPE)
 S T=30 F X=1:1:4 S V=$P(@BGPARR@(X),U,11) D W^BGP6DP($S(BGPPTYPE="P":$J(V,6,1),1:$$SB($J(V,6,1))),0,0,BGPPTYPE,X+1,T) S T=T+11
 D W^BGP6DP("# w/ Symptom Free Days 6-12",0,2,BGPPTYPE)
 S T=31 F X=1:1:4 S V=$P(@BGPARR@(X),U,12) D W^BGP6DP($S(BGPPTYPE="P":$$C(V,0,6),1:$S(V:V,1:0)),0,0,BGPPTYPE,X+1,T) S T=T+11
 D W^BGP6DP("% w/ Symptom Free Days 6-12",0,1,BGPPTYPE)
 S T=30 F X=1:1:4 S V=$P(@BGPARR@(X),U,13) D W^BGP6DP($S(BGPPTYPE="P":$J(V,6,1),1:$$SB($J(V,6,1))),0,0,BGPPTYPE,X+1,T) S T=T+11
 D W^BGP6DP("# w/ Symptom Free Days 13-14",0,2,BGPPTYPE)
 S T=31 F X=1:1:4 S V=$P(@BGPARR@(X),U,14) D W^BGP6DP($S(BGPPTYPE="P":$$C(V,0,6),1:$S(V:V,1:0)),0,0,BGPPTYPE,X+1,T) S T=T+11
 D W^BGP6DP("% w/ Symptom Free Days 13-14",0,1,BGPPTYPE)
 S T=30 F X=1:1:4 S V=$P(@BGPARR@(X),U,15) D W^BGP6DP($S(BGPPTYPE="P":$J(V,6,1),1:$$SB($J(V,6,1))),0,0,BGPPTYPE,X+1,T) S T=T+11
 I BGPPTYPE="D" D W^BGP6DP("# w/ School/Work Days Missed",0,2,BGPPTYPE)
 I BGPPTYPE="P" D W^BGP6DP("# w/ School/Work Days",0,2,BGPPTYPE),W^BGP6DP(" Missed",0,1,BGPPTYPE)
 S T=31 F X=1:1:4 S V=$P(@BGPARR@(X),U,16) D W^BGP6DP($S(BGPPTYPE="P":$$C(V,0,6),1:$S(V:V,1:0)),0,0,BGPPTYPE,X+1,T) S T=T+11
 I BGPPTYPE="D" D W^BGP6DP("% w/ School/Work Days Missed",0,1,BGPPTYPE)
 I BGPPTYPE="P" D W^BGP6DP("% w/ School/Work Days",0,1,BGPPTYPE),W^BGP6DP(" Missed",0,1,BGPPTYPE)
 S T=30 F X=1:1:4 S V=$P(@BGPARR@(X),U,17) D W^BGP6DP($S(BGPPTYPE="P":$J(V,6,1),1:$$SB($J(V,6,1))),0,0,BGPPTYPE,X+1,T) S T=T+11
 I BGPPTYPE="D" D W^BGP6DP("# w/ School/Work Days Missed 0-2",0,2,BGPPTYPE)
 I BGPPTYPE="P" D W^BGP6DP("# w/ School/Work Days",0,2,BGPPTYPE),W^BGP6DP(" Missed 0-2",0,1,BGPPTYPE)
 S T=31 F X=1:1:4 S V=$P(@BGPARR@(X),U,18) D W^BGP6DP($S(BGPPTYPE="P":$$C(V,0,6),1:$S(V:V,1:0)),0,0,BGPPTYPE,X+1,T) S T=T+11
 I BGPPTYPE="D" D W^BGP6DP("% w/ School/Work Days Missed 0-2",0,1,BGPPTYPE)
 I BGPPTYPE="P" D W^BGP6DP("% w/ School/Work Days",0,1,BGPPTYPE),W^BGP6DP(" Missed 0-2",0,1,BGPPTYPE)
 S T=30 F X=1:1:4 S V=$P(@BGPARR@(X),U,19) D W^BGP6DP($S(BGPPTYPE="P":$J(V,6,1),1:$$SB($J(V,6,1))),0,0,BGPPTYPE,X+1,T) S T=T+11
 I BGPPTYPE="D" D W^BGP6DP("# w/ School/Work Days Missed 3-7",0,2,BGPPTYPE)
 I BGPPTYPE="P" D W^BGP6DP("# w/ School/Work Days",0,2,BGPPTYPE),W^BGP6DP(" Missed 3-7",0,1,BGPPTYPE)
 S T=31 F X=1:1:4 S V=$P(@BGPARR@(X),U,20) D W^BGP6DP($S(BGPPTYPE="P":$$C(V,0,6),1:$S(V:V,1:0)),0,0,BGPPTYPE,X+1,T) S T=T+11
 I BGPPTYPE="D" D W^BGP6DP("% w/ School/Work Days Missed 3-7",0,1,BGPPTYPE)
 I BGPPTYPE="P" D W^BGP6DP("% w/ School/Work Days",0,1,BGPPTYPE),W^BGP6DP(" Missed 3-7",0,1,BGPPTYPE)
 S T=30 F X=1:1:4 S V=$P(@BGPARR@(X),U,21) D W^BGP6DP($S(BGPPTYPE="P":$J(V,6,1),1:$$SB($J(V,6,1))),0,0,BGPPTYPE,X+1,T) S T=T+11
 I BGPPTYPE="D" D W^BGP6DP("# w/ School/Work Days Missed 8-14",0,2,BGPPTYPE)
 I BGPPTYPE="P" D W^BGP6DP("# w/ School/Work Days",0,2,BGPPTYPE),W^BGP6DP(" Missed 8-14",0,1,BGPPTYPE)
 S T=31 F X=1:1:4 S V=$P(@BGPARR@(X),U,22) D W^BGP6DP($S(BGPPTYPE="P":$$C(V,0,6),1:$S(V:V,1:0)),0,0,BGPPTYPE,X+1,T) S T=T+11
 I BGPPTYPE="D" D W^BGP6DP("% w/ School/Work Days Missed 8-14",0,1,BGPPTYPE)
 I BGPPTYPE="P" D W^BGP6DP("% w/ School/Work Days",0,1,BGPPTYPE),W^BGP6DP(" Missed 8-14",0,1,BGPPTYPE)
 S T=30 F X=1:1:4 S V=$P(@BGPARR@(X),U,23) D W^BGP6DP($S(BGPPTYPE="P":$J(V,6,1),1:$$SB($J(V,6,1))),0,0,BGPPTYPE,X+1,T) S T=T+11
 I BGPARR="BGPDAP"!(BGPARR="BGPDAB") D
 .D W^BGP6DP("CHANGE FROM "_$S(BGPARR="BGPDAP":"PREVIOUS YR %",1:"BASELINE YR %"),0,2,BGPPTYPE)
 .S L="# w/ Management Plan",P=3 D PBY
 .S L="# w/ Severity Documented",P=5 D PBY
 .S L="# w/ Control Documented",P=7 D PBY
 .I BGPPTYPE="P" D W^BGP6DP("# w/ Symptom Free Days",0,1,BGPPTYPE) S L=" Assessed",P=9 D PBY
 .I BGPPTYPE="D" S L="# w/ Symptom Free Days",P=9 D PBY
 .S L="# w/ Symptom Free Days 0-5",P=11 D PBY
 .S L="# w/ Symptom Free Days 6-12",P=13 D PBY
 .S L="# w/ Symptom Free Days 13-14",P=15 D PBY
 .I BGPPTYPE="P" D W^BGP6DP("# w/School/Work Days",0,1,BGPPTYPE) S L=" Missed",P=17 D PBY
 .I BGPPTYPE="D" S L="# w/School/Work Days Missed",P=17 D PBY
 .I BGPPTYPE="P" D W^BGP6DP("# w/School/Work Days",0,1,BGPPTYPE) S L=" Missed 0-2",P=19 D PBY
 .I BGPPTYPE="D" S L="# w/School/Work Days Missed 0-2",P=19 D PBY
 .I BGPPTYPE="P" D W^BGP6DP("# w/School/Work Days",0,1,BGPPTYPE) S L=" Missed 3-7",P=21 D PBY
 .I BGPPTYPE="D" S L="# w/School/Work Days Missed 3-7",P=21 D PBY
 .I BGPPTYPE="P" D W^BGP6DP("# w/School/Work Days",0,1,BGPPTYPE) S L=" Missed 8-14",P=23 D PBY
 .I BGPPTYPE="D" S L="# w/School/Work Days Missed 8-14",P=23 D PBY
 .Q
 Q
PBY ;
 D W^BGP6DP(L,0,1,BGPPTYPE)
 S T=30 F X=1:1:4 S N=$P(BGPDAC(X),U,P),O=$P(@BGPARR@(X),U,3) S:N="" N=0 S:O="" O=0 S Y=$S(BGPPTYPE="P":$J($FN((N-O),"+,",1),6),1:$$SB($J((N-O),6,1))) D W^BGP6DP(Y,0,0,BGPPTYPE,X+1,T) S T=T+11
 Q
C(X,X2,X3) ;
 D COMMA^%DTC
 Q X
AH ;EP
 Q:$G(BGPSUMON)
 D W^BGP6DP(BGPHD1,1,2,BGPPTYPE)
 ;D W^BGP6DP("Asthma Assessments",0,1,BGPPTYPE)
 D W^BGP6DP(" 5-14",0,1,BGPPTYPE,2,34)
 D W^BGP6DP("15-34",0,0,BGPPTYPE,3,45)
 D W^BGP6DP("35-64",0,0,BGPPTYPE,4,56)
 D W^BGP6DP("65+",0,0,BGPPTYPE,5,67)
 Q
SB(X) ;EP - Strip
 X ^DD("FUNC",$O(^DD("FUNC","B","STRIPBLANKS",0)),1)
 Q X