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

APCLCAR1.m

Go to the documentation of this file.
APCLCAR1 ; IHS/CMI/LAB - calif area GPRA ; 
 ;;2.0;IHS PCC SUITE;**2**;MAY 14, 2009
 ;
 ;
PROC ;EP - called from XBDBQUE
 S APCLJ=$J,APCLH=$H
 K ^XTMP("APCLCAR",APCLJ,APCLH),^XTMP("APCLCARUNCAT",APCLJ,APCLH)
 D XTMP^APCLOSUT("APCLCAR","CALIF STATE ANNUAL REPORT")
 K ^TMP($J,"PATIENTS19"),APCLRACE,APCLAGEG,APCLINC,APCLSEX,APCLETH,APCLS4
 S (APCLCNT,APCLTOTR,APCLSPE1,APCLSPE2,APCLNCPT,APCLTOTV,APCLNPRV,APCLTO25)=0
 S APCLOD=APCLBD
 F  S APCLOD=$O(^AUPNVSIT("B",APCLOD)) Q:APCLOD=""!($E(APCLOD,1,3)>$E(APCLED,1,3))  D
 .S APCLVSIT=0 F  S APCLVSIT=$O(^AUPNVSIT("B",APCLOD,APCLVSIT)) Q:APCLVSIT'=+APCLVSIT  D
 ..Q:'$D(^AUPNVSIT(APCLVSIT,0))
 ..S APCLV0=^AUPNVSIT(APCLVSIT,0)
 ..Q:$P(APCLV0,U,11)
 ..Q:'$P(APCLV0,U,9)
 ..Q:$P(APCLV0,U,5)=""  ;no patient
 ..Q:$$DEMO^APCLUTL($P(APCLV0,U,5),$G(APCLDEMO))
 ..I $P(APCLV0,U,6)="" Q  ;no location entered???
 ..I $O(APCLLOCT(0)),'$D(APCLLOCT($P(APCLV0,U,6))) Q  ;not a location of interest
 ..Q:'$D(^AUPNVPRV("AD",APCLVSIT))
 ..Q:$$PRIMPROV^APCLV(APCLVSIT,"D")=""
 ..Q:$$PRIMPROV^APCLV(APCLVSIT,"F")=""
 ..Q:'$D(^AUPNVPOV("AD",APCLVSIT))
 ..S APCLPOV=$$PRIMPOV^APCLV(APCLVSIT,"C") Q:APCLPOV=""
 ..Q:$E(APCLPOV)="."
 ..Q:$E(APCLPOV)="E"
 ..Q:$$CLINIC^APCLV(APCLVSIT,"C")=11  ;NOT HOME CARE PER NATALIE
 ..Q:"ICTNEDX"[$P(APCLV0,U,7)  ;ignore chart rev, tele, not found, x and ancillary, in hosp
 ..Q:"CV"[$P(APCLV0,U,3)  ;ignore contract and va type visits
 ..S DFN=$P(APCLV0,U,5)
 ..D SECT2 ;do section 2, line 51-65
 ..I APCLPPPP D
 ...D SECT4
 ...D SECT5^APCLCAR2
RACE ..;
 ..I '$D(^TMP($J,"PATIENTS19",DFN)) S ^TMP($J,"PATIENTS19",DFN)="" S APCLRACE(10)=$G(APCLRACE(10))+1 D
 ...;tally race
 ...S X=$P(^DPT(DFN,0),U,6) I 'X S APCLRACE(9)=$G(APCLRACE(9))+1
 ...I X S Y=$$UP^XLFSTR($P(^DIC(10,X,0),U,2)),X=$$UP^XLFSTR($P(^DIC(10,X,0),U,1)) D
 ....I Y=3!(Y="Z")!(Y="AIAN") S APCLRACE(3)=$G(APCLRACE(3))+1 Q
 ....I Y="A"!(Y=5)!(Y="H") S APCLRACE(4)=$G(APCLRACE(4))+1 Q
 ....I Y="B"!(Y=2)!(Y=4) S APCLRACE(2)=$G(APCLRACE(2))+1 Q
 ....I Y="W"!(Y=1)!(Y=6) S APCLRACE(1)=$G(APCLRACE(1))+1 Q
 ....I Y="U"!(Y=7)!(Y="D") S APCLRACE(9)=$G(APCLRACE(9))+1 Q
 ....I X["WHITE" S APCLRACE(1)=$G(APCLRACE(1))+1 Q
 ....I X["BLACK" S APCLRACE(2)=$G(APCLRACE(2))+1 Q
 ....I X["NATIVE" S APCLRACE(3)=$G(APCLRACE(3))+1 Q
 ....I X["ASIAN" S APCLRACE(4)=$G(APCLRACE(4))+1 Q
 ....I X["PACIFIC ISLANDER" S APCLRACE(4)=$G(APCLRACE(4))+1 Q
 ....I X["FILIPINO" S APCLRACE(4)=$G(APCLRACE(4))+1 Q
 ....I X["HISPANIC" S APCLRACE(1)=$G(APCLRACE(1))+1 Q
 ....S APCLRACE(9)=$G(APCLRACE(9))+1
 ....Q
ETH ...;ETHNICITY
 ...S Z=0,E="" F  S Z=$O(^DPT(DFN,.06,Z)) Q:Z'=+Z!(E]"")  D  I E]"" G AGE
 ....S E=$P($G(^DPT(DFN,.06,Z,0)),U)
 ....Q:E=""
 ....S E=$P($G(^DIC(10.2,E,0)),U,1)
 ....I E="HISPANIC OR LATINO" S APCLRACE(11)=$G(APCLRACE(11))+1 Q
 ....S APCLRACE(12)=$G(APCLRACE(12))+1
 ...S X=$P(^DPT(DFN,0),U,6) S:X X=$P(^DIC(10,X,0),U) D
 ....I X="" S APCLETH(13)=$G(APCLETH(13))+1 Q
 ....I X["HISPANIC" S APCLETH(11)=$G(APCLETH(11))+1 Q
 ....S APCLETH(12)=$G(APCLETH(12))+1
AGE ...;tally age
 ...S AGE=$$AGE^AUPNPAT(DFN,($E(APCLBD,1,3)_"0630"))
 ...S SEX=$P(^DPT(DFN,0),U,2),SEX=$S(SEX="M":1,1:2),APCLSEX(SEX)=$G(APCLSEX(SEX))+1
 ...S G=$$AGEG(AGE),$P(APCLAGEG(G),U,SEX)=$P($G(APCLAGEG(G)),U,SEX)+1
INC ...;
 ...S N=$P(^AUPNPAT(DFN,0),U,35),I=$P(^AUPNPAT(DFN,0),U,36)
 ...I N<1!(I="") S APCLINC("UNKNOWN/UNREPORTED")=$G(APCLINC("UNKNOWN/UNREPORTED"))+1 Q
 ...I N<11 D  Q
 ....S X=$O(^APCLCIL("B",N,0)),L=$P(^APCLCIL(X,0),U,2),H=$P(^APCLCIL(X,0),U,3)
 ....I I'>L S APCLINC("UNDER 100%")=$G(APCLINC("UNDER 100%"))+1 Q
 ....I I'<H S APCLINC("ABOVE 200%")=$G(APCLINC("ABOVE 200%"))+1 Q
 ....S APCLINC("100-200%")=$G(APCLINC("100-200%"))+1
 ...I N>10 D
 ....S X=$O(^APCLCIL("B",10,0)),L=$P(^APCLCIL(X,0),U,2),H=$P(^APCLCIL(X,0),U,3)
 ....F %=10:1:N S L=L+2820,H=H+2820
 ....I I'>L S APCLINC("UNDER 100%")=$G(APCLINC("UNDER 100%"))+1 Q
 ....I I'<H S APCLINC("ABOVE 200%")=$G(APCLINC("ABOVE 200%"))+1 Q
 ....S APCLINC("100-200%")=$G(APCLINC("100-200%"))+1
 ..S AGE=$$AGE^AUPNPAT(DFN,($E(APCLBD,1,3)_"0630"))
 ..S G=0
 K ^TMP($J)
 Q
 ;
P(D,A) ;disc, age
 I A>19,D=1 Q 1
 I A>19,D=2 Q 2
 I A>19,D=3 Q 3
 I A>19,D=4 Q 4
 I A<20&(A>12),D=1 Q 5
 I A<20&(A>12),D=2 Q 6
 I A<20&(A>12),D=3 Q 7
 I A<20&(A>12),D=4 Q 8
 I A<13,D=1 Q 9
 I A<13,D=2 Q 10
 I A<13,D=3 Q 11
 I A<13,D=4 Q 12
 Q ""
AGEG(A) ;
 I A<1 Q "Under 1 year"
 I A>0&(A<5) Q "1-4 years"
 I A>4&(A<13) Q "5-12 years"
 I A>12&(A<15) Q "13-14 years"
 I A>14&(A<20) Q "15-19 years"
 I A>19&(A<35) Q "20-34 years"
 I A>34&(A<45) Q "35-44 years"
 I A>44&(A<65) Q "45-64 years"
 I A>64 Q "65 and over"
 Q ""
S(J,H,N,P,V) ;
 S $P(^XTMP("APCLCAR",J,H,N),U,P)=$P($G(^XTMP("APCLCAR",J,H,N)),U,P)+V
 Q
SECT4 ;primary pov
 S APCLS4(25)=$G(APCLS4(25))+1
 I $D(^AUPNVDEN("AD",APCLVSIT)) S APCLS4(19)=$G(APCLS4(19))+1 Q
 I $$CLINIC^APCLV(APCLVSIT,"C")=56 S APCLS4(19)=$G(APCLS4(19))+1 Q
 I $E(APCLPOV)="V",$E(APCLPOV,2,3)<90 S APCLS4(18)=$G(APCLS4(18))+1 Q
 I $E(APCLPOV)="V" S APCLS4(21)=$G(APCLS4(21))+1 Q
 I $E(APCLPOV,1,3)<140 S APCLS4(1)=$G(APCLS4(1))+1 Q
 I $E(APCLPOV,1,3)<240 S APCLS4(2)=$G(APCLS4(2))+1 Q
 I $E(APCLPOV,1,3)<280 S APCLS4(3)=$G(APCLS4(3))+1 Q
 I $E(APCLPOV,1,3)<290 S APCLS4(4)=$G(APCLS4(4))+1 Q
 I $E(APCLPOV,1,3)<320 S APCLS4(5)=$G(APCLS4(5))+1 Q
 I $E(APCLPOV,1,3)<390 S APCLS4(6)=$G(APCLS4(6))+1 Q
 I $E(APCLPOV,1,3)<460 S APCLS4(7)=$G(APCLS4(7))+1 Q
 I $E(APCLPOV,1,3)<520 S APCLS4(8)=$G(APCLS4(8))+1 Q
 I $E(APCLPOV,1,3)<580,$E(APCLPOV,1,3)>529.99 S APCLS4(9)=$G(APCLS4(9))+1 Q
 I $E(APCLPOV,1,3)<630 S APCLS4(10)=$G(APCLS4(10))+1 Q
 I $E(APCLPOV,1,3)<680 S APCLS4(11)=$G(APCLS4(11))+1 Q
 I $E(APCLPOV,1,3)<710 S APCLS4(12)=$G(APCLS4(12))+1 Q
 I $E(APCLPOV,1,3)<740 S APCLS4(13)=$G(APCLS4(13))+1 Q
 I $E(APCLPOV,1,3)<760 S APCLS4(14)=$G(APCLS4(14))+1 Q
 I $E(APCLPOV,1,3)<780 S APCLS4(15)=$G(APCLS4(15))+1 Q
 I $E(APCLPOV,1,3)<800 S APCLS4(16)=$G(APCLS4(16))+1 Q
 I $E(APCLPOV,1,3)<1000 S APCLS4(17)=$G(APCLS4(17))+1 Q
 S APCLS4(21)=$G(APCLS4(21))+1 ;W "OTHER: ",APCLPOV
 Q
SECT2 ;
 S APCLTOTV=APCLTOTV+1
 S X=$$PRIMPROV^APCLV(APCLVSIT,"F")
 Q:X=""
 S APCLPPPP=1
 I APCL60T,$D(^ATXAX(APCL60T,21,"B",X)) D S(APCLJ,APCLH,2,1,1),S(APCLJ,APCLH,2,14,1) S APCLTO25=APCLTO25+1 Q
 I APCL61T,$D(^ATXAX(APCL61T,21,"B",X)) D S(APCLJ,APCLH,2,2,1),S(APCLJ,APCLH,2,14,1) S APCLTO25=APCLTO25+1 Q
 I APCL62T,$D(^ATXAX(APCL62T,21,"B",X)) D S(APCLJ,APCLH,2,3,1),S(APCLJ,APCLH,2,14,1) S APCLTO25=APCLTO25+1 Q
 I APCL63T,$D(^ATXAX(APCL63T,21,"B",X)) D S(APCLJ,APCLH,2,4,1),S(APCLJ,APCLH,2,14,1) S APCLTO25=APCLTO25+1 Q
 I APCL64T,$D(^ATXAX(APCL64T,21,"B",X)) D S(APCLJ,APCLH,2,5,1),S(APCLJ,APCLH,2,14,1) S APCLTO25=APCLTO25+1 Q
 I APCL65T,$D(^ATXAX(APCL65T,21,"B",X)) D S(APCLJ,APCLH,2,6,1),S(APCLJ,APCLH,2,14,1) S APCLTO25=APCLTO25+1 Q
 I APCL66T,$D(^ATXAX(APCL66T,21,"B",X)) D S(APCLJ,APCLH,2,7,1),S(APCLJ,APCLH,2,14,1) S APCLTO25=APCLTO25+1 Q
 I APCL67T,$D(^ATXAX(APCL67T,21,"B",X)) D S(APCLJ,APCLH,2,8,1),S(APCLJ,APCLH,2,14,1) S APCLTO25=APCLTO25+1 Q
 I APCL68T,$D(^ATXAX(APCL68T,21,"B",X)) D S(APCLJ,APCLH,2,9,1),S(APCLJ,APCLH,2,14,1) S APCLTO25=APCLTO25+1 Q
 I APCL69T,$D(^ATXAX(APCL69T,21,"B",X)) D S(APCLJ,APCLH,2,10,1),S(APCLJ,APCLH,2,14,1) S APCLTO25=APCLTO25+1 Q
 I APCL70T,$D(^ATXAX(APCL70T,21,"B",X)) D S(APCLJ,APCLH,2,11,1),S(APCLJ,APCLH,2,14,1) S APCLTO25=APCLTO25+1 Q
 I APCL74T,$D(^ATXAX(APCL74T,21,"B",X)) D S(APCLJ,APCLH,2,12,1),S(APCLJ,APCLH,2,14,1) S APCLTO25=APCLTO25+1 Q
 S APCLPPPP=0
 I APCL80T,$D(^ATXAX(APCL80T,21,"B",X)) D S(APCLJ,APCLH,2,15,1),S(APCLJ,APCLH,2,30,1) S APCLTO25=APCLTO25+1 Q
 I APCL81T,$D(^ATXAX(APCL81T,21,"B",X)) D S(APCLJ,APCLH,2,16,1),S(APCLJ,APCLH,2,30,1) Q
 I APCL82T,$D(^ATXAX(APCL82T,21,"B",X)) D S(APCLJ,APCLH,2,17,1),S(APCLJ,APCLH,2,30,1) Q
 I APCL83T,$D(^ATXAX(APCL83T,21,"B",X)) D S(APCLJ,APCLH,2,18,1),S(APCLJ,APCLH,2,30,1) Q
 I APCL84T,$D(^ATXAX(APCL84T,21,"B",X)) D S(APCLJ,APCLH,2,19,1),S(APCLJ,APCLH,2,30,1) Q
 I APCL85T,$D(^ATXAX(APCL85T,21,"B",X)) D S(APCLJ,APCLH,2,20,1),S(APCLJ,APCLH,2,30,1) Q
 I APCL86T,$D(^ATXAX(APCL86T,21,"B",X)) D S(APCLJ,APCLH,2,21,1),S(APCLJ,APCLH,2,30,1) Q
 I APCL87T,$D(^ATXAX(APCL87T,21,"B",X)) D S(APCLJ,APCLH,2,22,1),S(APCLJ,APCLH,2,30,1) Q
 I APCL88T,$D(^ATXAX(APCL88T,21,"B",X)) D S(APCLJ,APCLH,2,23,1),S(APCLJ,APCLH,2,30,1) Q
 I APCL89T,$D(^ATXAX(APCL89T,21,"B",X)) D S(APCLJ,APCLH,2,24,1),S(APCLJ,APCLH,2,30,1) Q
 I APCL90T,$D(^ATXAX(APCL90T,21,"B",X)) D S(APCLJ,APCLH,2,25,1),S(APCLJ,APCLH,2,30,1) Q
 I APCL94T,$D(^ATXAX(APCL94T,21,"B",X)) D S(APCLJ,APCLH,2,26,1),S(APCLJ,APCLH,2,30,1) Q
 S APCLNPRV=APCLNPRV+1
 S ^XTMP("APCLCARUNCAT",APCLJ,APCLH,X,$$PRIMPROV^APCLV(APCLVSIT,"N"))=""
 Q
DISC(V) ;
 I '$G(V) Q ""
 NEW D
 S D=$$PRIMPROV^APCLV(V,"D")
 S D=$O(^APCLCPD("B",D,0)) I 'D Q ""
 Q $P(^APCLCPD(D,0),U,2)
 ;