BGPD4 ; IHS/CMI/LAB - indicator 4 ;
;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
;
I4A ;EP ;EP - indicator 4a
;Q:'$D(BGPIND(9))
Q:'BGPDMPAT ;not in the simple population for denominator
S BGP4LP=$$LIPID(DFN,BGPEDATE)
S BGP4TG=$$TRIG(DFN,BGPEDATE)
S BGP4LDL=$$LDL(DFN,BGPEDATE)
S BGP4HDL=$$HDL(DFN,BGPEDATE)
S BGPL=9
NUM ;
S V=""
I BGP4LP="",BGP4TG="",BGP4LDL="",BGP4HDL="" S P=5,V="" D ST Q ;none of the above E
I BGP4LP S P=1,V="LP " D ST G LDS
I BGP4TG,BGP4LDL,BGP4HDL S P=1,V="HDL,LDL,TG" D ST G LDS
I BGP4LDL,(BGP4TG!(BGP4HDL)) S P=2,V="LDL & HDL/TG" D ST G LDS
I 'BGP4LDL S P=3,V="TG or TG/HDL" D ST Q
I BGP4LDL S P=4,V="LDL ONLY" D ST G LDS
Q
LDS ;
S P=6 D ST
I $P(BGP4LDL,U,2)]"" S P=7,V=V_" "_$P(BGP4LDL,U,2) D ST
I $P(BGP4LDL,U,2)]"",+$P(BGP4LDL,U,2)<130 S P=8 D ST
Q
ST ;
D S(BGPRPT,$S(BGPTIME=1:14,BGPTIME=0:44,BGPTIME=8:84,1:999),P,1)
I $D(BGPLIST(BGPL)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",BGPL,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)=$P(V,U)
Q
LDSB ;
S P=14 D ST
I $P(BGP4LDL,U,2)]"" S P=15,V=V_" "_$P(BGP4LDL,U,2) D ST
I $P(BGP4LDL,U,2)]"",$P(BGP4LDL,U,2)<130 S P=16 D ST
Q
LDSC ;
S P=22 D ST
I $P(BGP4LDL,U,2)]"" S P=23,V=V_" "_$P(BGP4LDL,U,2) D ST
I $P(BGP4LDL,U,2)]"",$P(BGP4LDL,U,2)<130 S P=24 D ST
Q
I4B ;EP
;Q:'$D(BGPIND(10))
Q:'BGPDMPAT ;not in the simple population for denominator
Q:'BGP2BD
S BGPL=10
S V=""
I BGP4LP="",BGP4TG="",BGP4LDL="",BGP4HDL="" S P=13,V="" D ST Q ;none of the above E
I BGP4LP S P=9,V="LP " D ST G LDSB
I BGP4TG,BGP4LDL,BGP4HDL S P=9,V="HDL,LDL,TG" D ST G LDSB
I BGP4LDL,(BGP4TG!(BGP4HDL)) S P=10,V="LDL & HDL/TG" D ST G LDSB
I 'BGP4LDL S P=11,V="TG or TG/HDL" D ST Q
I BGP4LDL S P=12,V="LDL ONLY" D ST G LDSB
K BGPL
Q
I4C ;EP
;Q:'$D(BGPIND(11))
Q:'BGPDMPAT ;not in the simple population for denominator
Q:'BGP2CD
S BGPL=11
S V=""
I BGP4LP="",BGP4TG="",BGP4LDL="",BGP4HDL="" S P=21,V="" D ST Q ;none of the above E
I BGP4LP S P=17,V="LP " D ST G LDSC
I BGP4TG,BGP4LDL,BGP4HDL S P=17,V="HDL,LDL,TG" D ST G LDSC
I BGP4LDL,(BGP4TG!(BGP4HDL)) S P=18,V="LDL & HDL/TG" D ST G LDSC
I 'BGP4LDL S P=19,V="TG or TG/HDL" D ST Q
I BGP4LDL S P=20,V="LDL ONLY" D ST G LDSC
K BGPL
Q
S(R,N,P,V) ;
I 'V Q ;no value to add
S $P(^BGPD(R,N),U,P)=$P($G(^BGPD(R,N)),U,P)+V
Q
LIPID(P,EDATE) ;
NEW %,E,D,BGPG
K BGPG
S D=$$FMADD^XLFDT(EDATE,-365)
S %=P_"^LAST LAB [DM AUDIT LIPID PROFILE TAX;DURING "_$$FMTE^XLFDT(D)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
I $D(BGPG(1)) Q 1
S E=+$$CODEN^ICPTCOD(80061),%=$$CPTI^BGPDU(P,D,EDATE,E)
Q %
TRIG(P,EDATE) ;
NEW %,E,D,BGPG
K BGPG
S D=$$FMADD^XLFDT(EDATE,-365)
S %=P_"^LAST LAB [DM AUDIT TRIGLYCERIDE TAX;DURING "_$$FMTE^XLFDT(D)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
I $D(BGPG(1)) Q 1
S E=+$$CODEN^ICPTCOD(84478),%=$$CPTI^BGPDU(P,D,EDATE,E)
Q %
HDL(P,EDATE) ;
NEW %,E,D,BGPG
K BGPG
S D=$$FMADD^XLFDT(EDATE,-365)
S %=P_"^LAST LAB [DM AUDIT HDL TAX;DURING "_$$FMTE^XLFDT(D)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
I $D(BGPG(1)) Q 1
Q ""
LDL(P,EDATE) ;
NEW %,E,D,BGPG
K BGPG
S D=$$FMADD^XLFDT(EDATE,-365)
S %=P_"^LAST LAB [DM AUDIT LDL CHOLESTEROL TAX;DURING "_$$FMTE^XLFDT(D)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
S %="" I $D(BGPG(1)) D Q %
.S E=$P(^AUPNVLAB(+$P(BGPG(1),U,4),0),U,4)
.I $$UP^XLFSTR(E)="COMMENT" S %=1 Q
.I +E S %="1^"_E Q
.S %=1
S E=+$$CODEN^ICPTCOD(80061),%=$$CPTI^BGPDU(P,D,EDATE,E)
Q %
BGPD4 ; IHS/CMI/LAB - indicator 4 ;
+1 ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
+2 ;
I4A ;EP ;EP - indicator 4a
+1 ;Q:'$D(BGPIND(9))
+2 ;not in the simple population for denominator
IF 'BGPDMPAT
QUIT
+3 SET BGP4LP=$$LIPID(DFN,BGPEDATE)
+4 SET BGP4TG=$$TRIG(DFN,BGPEDATE)
+5 SET BGP4LDL=$$LDL(DFN,BGPEDATE)
+6 SET BGP4HDL=$$HDL(DFN,BGPEDATE)
+7 SET BGPL=9
NUM ;
+1 SET V=""
+2 ;none of the above E
IF BGP4LP=""
IF BGP4TG=""
IF BGP4LDL=""
IF BGP4HDL=""
SET P=5
SET V=""
DO ST
QUIT
+3 IF BGP4LP
SET P=1
SET V="LP "
DO ST
GOTO LDS
+4 IF BGP4TG
IF BGP4LDL
IF BGP4HDL
SET P=1
SET V="HDL,LDL,TG"
DO ST
GOTO LDS
+5 IF BGP4LDL
IF (BGP4TG!(BGP4HDL))
SET P=2
SET V="LDL & HDL/TG"
DO ST
GOTO LDS
+6 IF 'BGP4LDL
SET P=3
SET V="TG or TG/HDL"
DO ST
QUIT
+7 IF BGP4LDL
SET P=4
SET V="LDL ONLY"
DO ST
GOTO LDS
+8 QUIT
LDS ;
+1 SET P=6
DO ST
+2 IF $PIECE(BGP4LDL,U,2)]""
SET P=7
SET V=V_" "_$PIECE(BGP4LDL,U,2)
DO ST
+3 IF $PIECE(BGP4LDL,U,2)]""
IF +$PIECE(BGP4LDL,U,2)<130
SET P=8
DO ST
+4 QUIT
ST ;
+1 DO S(BGPRPT,$SELECT(BGPTIME=1:14,BGPTIME=0:44,BGPTIME=8:84,1:999),P,1)
+2 IF $DATA(BGPLIST(BGPL))
IF BGPTIME=1
SET ^XTMP("BGPD",BGPJ,BGPH,"LIST",BGPL,$SELECT($PIECE($GET(^AUPNPAT(DFN,11)),U,18)]"":$PIECE(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$PIECE(^DPT(DFN,0),U,2),BGPAGEE,DFN)=$PIECE(V,U)
+3 QUIT
LDSB ;
+1 SET P=14
DO ST
+2 IF $PIECE(BGP4LDL,U,2)]""
SET P=15
SET V=V_" "_$PIECE(BGP4LDL,U,2)
DO ST
+3 IF $PIECE(BGP4LDL,U,2)]""
IF $PIECE(BGP4LDL,U,2)<130
SET P=16
DO ST
+4 QUIT
LDSC ;
+1 SET P=22
DO ST
+2 IF $PIECE(BGP4LDL,U,2)]""
SET P=23
SET V=V_" "_$PIECE(BGP4LDL,U,2)
DO ST
+3 IF $PIECE(BGP4LDL,U,2)]""
IF $PIECE(BGP4LDL,U,2)<130
SET P=24
DO ST
+4 QUIT
I4B ;EP
+1 ;Q:'$D(BGPIND(10))
+2 ;not in the simple population for denominator
IF 'BGPDMPAT
QUIT
+3 IF 'BGP2BD
QUIT
+4 SET BGPL=10
+5 SET V=""
+6 ;none of the above E
IF BGP4LP=""
IF BGP4TG=""
IF BGP4LDL=""
IF BGP4HDL=""
SET P=13
SET V=""
DO ST
QUIT
+7 IF BGP4LP
SET P=9
SET V="LP "
DO ST
GOTO LDSB
+8 IF BGP4TG
IF BGP4LDL
IF BGP4HDL
SET P=9
SET V="HDL,LDL,TG"
DO ST
GOTO LDSB
+9 IF BGP4LDL
IF (BGP4TG!(BGP4HDL))
SET P=10
SET V="LDL & HDL/TG"
DO ST
GOTO LDSB
+10 IF 'BGP4LDL
SET P=11
SET V="TG or TG/HDL"
DO ST
QUIT
+11 IF BGP4LDL
SET P=12
SET V="LDL ONLY"
DO ST
GOTO LDSB
+12 KILL BGPL
+13 QUIT
I4C ;EP
+1 ;Q:'$D(BGPIND(11))
+2 ;not in the simple population for denominator
IF 'BGPDMPAT
QUIT
+3 IF 'BGP2CD
QUIT
+4 SET BGPL=11
+5 SET V=""
+6 ;none of the above E
IF BGP4LP=""
IF BGP4TG=""
IF BGP4LDL=""
IF BGP4HDL=""
SET P=21
SET V=""
DO ST
QUIT
+7 IF BGP4LP
SET P=17
SET V="LP "
DO ST
GOTO LDSC
+8 IF BGP4TG
IF BGP4LDL
IF BGP4HDL
SET P=17
SET V="HDL,LDL,TG"
DO ST
GOTO LDSC
+9 IF BGP4LDL
IF (BGP4TG!(BGP4HDL))
SET P=18
SET V="LDL & HDL/TG"
DO ST
GOTO LDSC
+10 IF 'BGP4LDL
SET P=19
SET V="TG or TG/HDL"
DO ST
QUIT
+11 IF BGP4LDL
SET P=20
SET V="LDL ONLY"
DO ST
GOTO LDSC
+12 KILL BGPL
+13 QUIT
S(R,N,P,V) ;
+1 ;no value to add
IF 'V
QUIT
+2 SET $PIECE(^BGPD(R,N),U,P)=$PIECE($GET(^BGPD(R,N)),U,P)+V
+3 QUIT
LIPID(P,EDATE) ;
+1 NEW %,E,D,BGPG
+2 KILL BGPG
+3 SET D=$$FMADD^XLFDT(EDATE,-365)
+4 SET %=P_"^LAST LAB [DM AUDIT LIPID PROFILE TAX;DURING "_$$FMTE^XLFDT(D)_"-"_$$FMTE^XLFDT(EDATE)
SET E=$$START1^APCLDF(%,"BGPG(")
+5 IF $DATA(BGPG(1))
QUIT 1
+6 SET E=+$$CODEN^ICPTCOD(80061)
SET %=$$CPTI^BGPDU(P,D,EDATE,E)
+7 QUIT %
TRIG(P,EDATE) ;
+1 NEW %,E,D,BGPG
+2 KILL BGPG
+3 SET D=$$FMADD^XLFDT(EDATE,-365)
+4 SET %=P_"^LAST LAB [DM AUDIT TRIGLYCERIDE TAX;DURING "_$$FMTE^XLFDT(D)_"-"_$$FMTE^XLFDT(EDATE)
SET E=$$START1^APCLDF(%,"BGPG(")
+5 IF $DATA(BGPG(1))
QUIT 1
+6 SET E=+$$CODEN^ICPTCOD(84478)
SET %=$$CPTI^BGPDU(P,D,EDATE,E)
+7 QUIT %
HDL(P,EDATE) ;
+1 NEW %,E,D,BGPG
+2 KILL BGPG
+3 SET D=$$FMADD^XLFDT(EDATE,-365)
+4 SET %=P_"^LAST LAB [DM AUDIT HDL TAX;DURING "_$$FMTE^XLFDT(D)_"-"_$$FMTE^XLFDT(EDATE)
SET E=$$START1^APCLDF(%,"BGPG(")
+5 IF $DATA(BGPG(1))
QUIT 1
+6 QUIT ""
LDL(P,EDATE) ;
+1 NEW %,E,D,BGPG
+2 KILL BGPG
+3 SET D=$$FMADD^XLFDT(EDATE,-365)
+4 SET %=P_"^LAST LAB [DM AUDIT LDL CHOLESTEROL TAX;DURING "_$$FMTE^XLFDT(D)_"-"_$$FMTE^XLFDT(EDATE)
SET E=$$START1^APCLDF(%,"BGPG(")
+5 SET %=""
IF $DATA(BGPG(1))
Begin DoDot:1
+6 SET E=$PIECE(^AUPNVLAB(+$PIECE(BGPG(1),U,4),0),U,4)
+7 IF $$UP^XLFSTR(E)="COMMENT"
SET %=1
QUIT
+8 IF +E
SET %="1^"_E
QUIT
+9 SET %=1
End DoDot:1
QUIT %
+10 SET E=+$$CODEN^ICPTCOD(80061)
SET %=$$CPTI^BGPDU(P,D,EDATE,E)
+11 QUIT %