BGP8PC68 ; IHS/CMI/LAB - measure I2 ; 02 Feb 2018 11:25 AM
;;18.1;IHS CLINICAL REPORTING;**1**;MAY 25, 2018;Build 65
;
ROTA(P) ;
NEW A42,A730,X,Y,Z,TCVX,TCPT,C,BGPIMMS,D,V,BGPZ
S TCVX=$O(^ATXAX("B","BGP IPC ROTA 2 DOSE CVX CODES",0))
S TCPT=$O(^ATXAX("B","BGP IPC ROTA 2 DOSE CPT CODES",0))
S A42=$$FMADD^XLFDT($$DOB^AUPNPAT(P),42)
S A730=$$FMADD^XLFDT($$DOB^AUPNPAT(P),730)
;FIRST GET 2 DOSE
S X=0 F S X=$O(^AUPNVIMM("AC",P,X)) Q:X'=+X D
.Q:'$D(^AUPNVIMM(X,0)) ;happens
.S Y=$P(^AUPNVIMM(X,0),U)
.Q:'Y ;happens too
.S I=$P($G(^AUTTIMM(Y,0)),U,3) ;get HL7/CVX code
.Q:'$D(^ATXAX(TCVX,21,"B",I))
.S D=$P($P($G(^AUPNVIMM(X,12)),U,1),".")
.I D="" S V=$P(^AUPNVIMM(X,0),U,3) I V S D=$P($P($G(^AUPNVSIT(V,0)),U),".")
.Q:D<A42
.Q:D>A730
.S BGPIMMS(D)=Y
.Q
;go through and set into array if 1 days apart
S X="",Y="",C=0 F S X=$O(BGPIMMS(X)) Q:X'=+X S C=C+1 D
.I C=1 S Y=X Q
.I $$FMDIFF^XLFDT(X,Y)<1 K BGPIMMS(X) Q
.S Y=X
;see if there are 4 of them, if there are quit
S BGPIMMS=0,X=0 F S X=$O(BGPIMMS(X)) Q:X'=+X S BGPIMMS=BGPIMMS+1
I BGPIMMS>1 Q 1_U_"2 2-DOSE ROTA"
;now get cpts
S G="",X=0
F S X=$O(^AUPNVCPT("AC",P,X)) Q:X="" D
.Q:'$D(^AUPNVCPT(X,0))
.S Y=$P(^AUPNVCPT(X,0),U)
.Q:'$$ICD^BGP8UTL2(Y,TCPT,1)
.S V=$P(^AUPNVCPT(X,0),U,3) Q:'V
.S D=$$VD^APCLV(V)
.Q:D<A42
.Q:D>A730
.S BGPIMMS(D)=""
;get tran codes
S X=0 F S X=$O(^AUPNVTC("AC",P,X)) Q:X'=+X D
.Q:'$D(^AUPNVTC(X,0))
.S Y=$P(^AUPNVTC(X,0),U,7) Q:'Y
.Q:'$$ICD^BGP8UTL2(Y,TCPT,1)
.S V=$P(^AUPNVTC(X,0),U,3) Q:'V
.S D=$$VD^APCLV(V)
.Q:D<A42
.Q:D>A730
.S BGPIMMS(D)=""
;
;go through and set into array if 1 days apart
S X="",Y="",C=0 F S X=$O(BGPIMMS(X)) Q:X'=+X S C=C+1 D
.I C=1 S Y=X Q
.I $$FMDIFF^XLFDT(X,Y)<1 K BGPIMMS(X) Q
.S Y=X
;see if there are 2 of them, if there are quit
S BGPIMMS=0,X=0 F S X=$O(BGPIMMS(X)) Q:X'=+X S BGPIMMS=BGPIMMS+1
I BGPIMMS>1 Q 1_U_"2 2-DOSE ROTA"
D3 ;now add in 3 dose and make sure there are 3
S TCVX=$O(^ATXAX("B","BGP IPC ROTA 3 DOSE CVX CODES",0))
S TCPT=$O(^ATXAX("B","BGP IPC ROTA 3 DOSE CPT CODES",0))
S A42=$$FMADD^XLFDT($$DOB^AUPNPAT(P),42)
S A730=$$FMADD^XLFDT($$DOB^AUPNPAT(P),730)
S X=0 F S X=$O(^AUPNVIMM("AC",P,X)) Q:X'=+X D
.Q:'$D(^AUPNVIMM(X,0)) ;happens
.S Y=$P(^AUPNVIMM(X,0),U)
.Q:'Y ;happens too
.S I=$P($G(^AUTTIMM(Y,0)),U,3) ;get HL7/CVX code
.Q:'$D(^ATXAX(TCVX,21,"B",I))
.S D=$P($P($G(^AUPNVIMM(X,12)),U,1),".")
.I D="" S V=$P(^AUPNVIMM(X,0),U,3) I V S D=$P($P($G(^AUPNVSIT(V,0)),U),".")
.Q:D<A42
.Q:D>A730
.S BGPIMMS(D)=Y
.Q
;go through and set into array if 1 days apart
S X="",Y="",C=0 F S X=$O(BGPIMMS(X)) Q:X'=+X S C=C+1 D
.I C=1 S Y=X Q
.I $$FMDIFF^XLFDT(X,Y)<1 K BGPIMMS(X) Q
.S Y=X
;see if there are 4 of them, if there are quit
S BGPIMMS=0,X=0 F S X=$O(BGPIMMS(X)) Q:X'=+X S BGPIMMS=BGPIMMS+1
I BGPIMMS>3 Q 1_U_"3 DOSE ROTA"
;now get cpts
S G="",X=0
F S X=$O(^AUPNVCPT("AC",P,X)) Q:X="" D
.Q:'$D(^AUPNVCPT(X,0))
.S Y=$P(^AUPNVCPT(X,0),U)
.Q:'$$ICD^BGP8UTL2(Y,TCPT,1)
.S V=$P(^AUPNVCPT(X,0),U,3) Q:'V
.S D=$$VD^APCLV(V)
.Q:D<A42
.Q:D>A730
.S BGPIMMS(D)=""
;get tran codes
S X=0 F S X=$O(^AUPNVTC("AC",P,X)) Q:X'=+X D
.Q:'$D(^AUPNVTC(X,0))
.S Y=$P(^AUPNVTC(X,0),U,7) Q:'Y
.Q:'$$ICD^BGP8UTL2(Y,TCPT,1)
.S V=$P(^AUPNVTC(X,0),U,3) Q:'V
.S D=$$VD^APCLV(V)
.Q:D<A42
.Q:D>A730
.S BGPIMMS(D)=""
;
;go through and set into array if 1 days apart
S X="",Y="",C=0 F S X=$O(BGPIMMS(X)) Q:X'=+X S C=C+1 D
.I C=1 S Y=X Q
.I $$FMDIFF^XLFDT(X,Y)<1 K BGPIMMS(X) Q
.S Y=X
;see if there are 2 of them, if there are quit
S BGPIMMS=0,X=0 F S X=$O(BGPIMMS(X)) Q:X'=+X S BGPIMMS=BGPIMMS+1
I BGPIMMS>2 Q 1_U_"3 DOSE ROTA"
;NOW CHECK FOR CONTRAINDICATION
;IMM PKG ANAPHYLACTIS
S BGPZ=0
F S BGPZ=$O(^ATXAX(TCVX,21,"B",BGPZ)) Q:BGPZ=""!(X]"") D
.S X=$$ANNECONT(P,BGPZ,A730)
I X]"" Q 1_U_"ROTA CONTRA ANAPHYLACTIC/IMMUNE DEF"
S X=$$ANSNROTA(P,A730) I X Q 1_U_"ROTA CONTRA ANAPHYLACTIC REACTION"
S X=$$SCID(P,A730) I X Q 1_U_"ROTA CONTRA SCID"
S X=$$INTUSS(P,A730) I X Q 1_U_"ROTA CONTRA INTUSSUSCEPTION"
Q ""
ANSNROTA(P,EDATE) ;
;V POV OR PROBLEM LIST
NEW X,Y,Z,G,T,S,D,I
S (X,Y,I)=0
F S X=$O(^AUPNPROB("AC",P,X)) Q:X'=+X!(I) D
.Q:'$D(^AUPNPROB(X,0))
.Q:$P(^AUPNPROB(X,0),U,12)="D"
.I $P(^AUPNPROB(X,0),U,13),$P(^AUPNPROB(X,0),U,13)>EDATE Q ;if there is a doo and it is after report period skip
.I $P(^AUPNPROB(X,0),U,13)="",$P(^AUPNPROB(X,0),U,8)>EDATE Q ;entered after report period, skip
.S S=$$VAL^XBDIQ1(9000011,X,80001)
.I S=428331000124103 S I=1 Q
.Q
I I Q I
;NOW V POV SNOMED
;NOW SNOMED USING ASNC
S G="",I=""
S S="" F S S=$O(^AUPNVPOV("ASNC",P,S)) Q:S=""!(G) D
.S I=0
.I S=428331000124103 S I=1
.Q:'I
.S D=0 F S D=$O(^AUPNVPOV("ASNC",P,S,D)) Q:D=""!(G) D
..S Y=9999999-D
..Q:Y>EDATE
..S G=1
I G Q G
;REFUSAL FILE
S I="" F S I=$O(^AUPNPREF("AA",P,9002318.4,I)) Q:I=""!(G) D
.I I'=428331000124103 Q ;IF IT'S SNOMED, MUST BE THAT ONE
.S ID=0 F S ID=$O(^AUPNPREF("AA",P,9002318.4,I,ID)) Q:ID=""!(G) D
..S D=9999999-ID
..Q:D>EDATE
..S G=1
Q G
ANNECONT(P,C,ED) ;EP - ANALPHYLAXIS
NEW X,G,Y,R,D
S X=0,G="",Y=$O(^AUTTIMM("C",C,0)) I Y F S X=$O(^BIPC("AC",P,Y,X)) Q:X'=+X!(G) D
.S R=$P(^BIPC(X,0),U,3)
.Q:R=""
.Q:'$D(^BICONT(R,0))
.S D=$P(^BIPC(X,0),U,4)
.Q:D=""
.;Q:$P(^BIPC(X,0),U,4)<BD
.Q:$P(^BIPC(X,0),U,4)>ED
.I $P(^BICONT(R,0),U,1)="Anaphylaxis" S G=D_U_"Contra Anaphylaxis"
.I $P(^BICONT(R,0),U,1)="Immune Deficiency" S G=D_U_"Contra: Immune Deficiency"
Q G
SCID(P,EDATE) ;EP
NEW X,Y,Z,G,T,S,D,E,R,L,J,ME
I $$PLTAXND^BGP8DU(P,"BGP IPC SCID DXS",EDATE,0) Q 1
I $$IPLSNOND^BGP8DU(P,"PXRM BGP IPC SCID",EDATE,0) Q 1
I $$LASTDX^BGP8UTL1(P,"BGP IPC SCID DXS",$$DOB^AUPNPAT(P),EDATE) Q 1
;NOW V POV SNOMED
;NOW SNOMED USING ASNC
S T="PXRM BGP IPC SCID"
S G=""
S S=0 F S S=$O(^XTMP("BGPSNOMEDSUBSET",$J,T,S)) Q:S=""!(G) D
.Q:'$D(^AUPNVPOV("ASNC",P,S))
.S D=0 F S D=$O(^AUPNVPOV("ASNC",P,S,D)) Q:D=""!(G) D
..S Y=9999999-D
..Q:Y>EDATE
..S G=1
Q G
INTUSS(P,EDATE) ;EP
NEW X,Y,Z,G,T,S,D,E,R,L,J,ME
I $$PLTAXND^BGP8DU(P,"BGP IPC INTUSSUSCEPTION DXS",EDATE,0) Q 1
I $$IPLSNOND^BGP8DU(P,"PXRM BGP IPC INTUSSUS",EDATE,0) Q 1
I $$LASTDX^BGP8UTL1(P,"BGP IPC INTUSSUSCEPTION DXS",$$DOB^AUPNPAT(P),EDATE) Q 1
;NOW V POV SNOMED
;NOW SNOMED USING ASNC
S T="PXRM BGP IPC INTUSSUS"
S G=""
S S=0 F S S=$O(^XTMP("BGPSNOMEDSUBSET",$J,T,S)) Q:S=""!(G) D
.Q:'$D(^AUPNVPOV("ASNC",P,S))
.S D=0 F S D=$O(^AUPNVPOV("ASNC",P,S,D)) Q:D=""!(G) D
..S Y=9999999-D
..Q:Y>EDATE
..S G=1
Q G
BGP8PC68 ; IHS/CMI/LAB - measure I2 ; 02 Feb 2018 11:25 AM
+1 ;;18.1;IHS CLINICAL REPORTING;**1**;MAY 25, 2018;Build 65
+2 ;
ROTA(P) ;
+1 NEW A42,A730,X,Y,Z,TCVX,TCPT,C,BGPIMMS,D,V,BGPZ
+2 SET TCVX=$ORDER(^ATXAX("B","BGP IPC ROTA 2 DOSE CVX CODES",0))
+3 SET TCPT=$ORDER(^ATXAX("B","BGP IPC ROTA 2 DOSE CPT CODES",0))
+4 SET A42=$$FMADD^XLFDT($$DOB^AUPNPAT(P),42)
+5 SET A730=$$FMADD^XLFDT($$DOB^AUPNPAT(P),730)
+6 ;FIRST GET 2 DOSE
+7 SET X=0
FOR
SET X=$ORDER(^AUPNVIMM("AC",P,X))
IF X'=+X
QUIT
Begin DoDot:1
+8 ;happens
IF '$DATA(^AUPNVIMM(X,0))
QUIT
+9 SET Y=$PIECE(^AUPNVIMM(X,0),U)
+10 ;happens too
IF 'Y
QUIT
+11 ;get HL7/CVX code
SET I=$PIECE($GET(^AUTTIMM(Y,0)),U,3)
+12 IF '$DATA(^ATXAX(TCVX,21,"B",I))
QUIT
+13 SET D=$PIECE($PIECE($GET(^AUPNVIMM(X,12)),U,1),".")
+14 IF D=""
SET V=$PIECE(^AUPNVIMM(X,0),U,3)
IF V
SET D=$PIECE($PIECE($GET(^AUPNVSIT(V,0)),U),".")
+15 IF D<A42
QUIT
+16 IF D>A730
QUIT
+17 SET BGPIMMS(D)=Y
+18 QUIT
End DoDot:1
+19 ;go through and set into array if 1 days apart
+20 SET X=""
SET Y=""
SET C=0
FOR
SET X=$ORDER(BGPIMMS(X))
IF X'=+X
QUIT
SET C=C+1
Begin DoDot:1
+21 IF C=1
SET Y=X
QUIT
+22 IF $$FMDIFF^XLFDT(X,Y)<1
KILL BGPIMMS(X)
QUIT
+23 SET Y=X
End DoDot:1
+24 ;see if there are 4 of them, if there are quit
+25 SET BGPIMMS=0
SET X=0
FOR
SET X=$ORDER(BGPIMMS(X))
IF X'=+X
QUIT
SET BGPIMMS=BGPIMMS+1
+26 IF BGPIMMS>1
QUIT 1_U_"2 2-DOSE ROTA"
+27 ;now get cpts
+28 SET G=""
SET X=0
+29 FOR
SET X=$ORDER(^AUPNVCPT("AC",P,X))
IF X=""
QUIT
Begin DoDot:1
+30 IF '$DATA(^AUPNVCPT(X,0))
QUIT
+31 SET Y=$PIECE(^AUPNVCPT(X,0),U)
+32 IF '$$ICD^BGP8UTL2(Y,TCPT,1)
QUIT
+33 SET V=$PIECE(^AUPNVCPT(X,0),U,3)
IF 'V
QUIT
+34 SET D=$$VD^APCLV(V)
+35 IF D<A42
QUIT
+36 IF D>A730
QUIT
+37 SET BGPIMMS(D)=""
End DoDot:1
+38 ;get tran codes
+39 SET X=0
FOR
SET X=$ORDER(^AUPNVTC("AC",P,X))
IF X'=+X
QUIT
Begin DoDot:1
+40 IF '$DATA(^AUPNVTC(X,0))
QUIT
+41 SET Y=$PIECE(^AUPNVTC(X,0),U,7)
IF 'Y
QUIT
+42 IF '$$ICD^BGP8UTL2(Y,TCPT,1)
QUIT
+43 SET V=$PIECE(^AUPNVTC(X,0),U,3)
IF 'V
QUIT
+44 SET D=$$VD^APCLV(V)
+45 IF D<A42
QUIT
+46 IF D>A730
QUIT
+47 SET BGPIMMS(D)=""
End DoDot:1
+48 ;
+49 ;go through and set into array if 1 days apart
+50 SET X=""
SET Y=""
SET C=0
FOR
SET X=$ORDER(BGPIMMS(X))
IF X'=+X
QUIT
SET C=C+1
Begin DoDot:1
+51 IF C=1
SET Y=X
QUIT
+52 IF $$FMDIFF^XLFDT(X,Y)<1
KILL BGPIMMS(X)
QUIT
+53 SET Y=X
End DoDot:1
+54 ;see if there are 2 of them, if there are quit
+55 SET BGPIMMS=0
SET X=0
FOR
SET X=$ORDER(BGPIMMS(X))
IF X'=+X
QUIT
SET BGPIMMS=BGPIMMS+1
+56 IF BGPIMMS>1
QUIT 1_U_"2 2-DOSE ROTA"
D3 ;now add in 3 dose and make sure there are 3
+1 SET TCVX=$ORDER(^ATXAX("B","BGP IPC ROTA 3 DOSE CVX CODES",0))
+2 SET TCPT=$ORDER(^ATXAX("B","BGP IPC ROTA 3 DOSE CPT CODES",0))
+3 SET A42=$$FMADD^XLFDT($$DOB^AUPNPAT(P),42)
+4 SET A730=$$FMADD^XLFDT($$DOB^AUPNPAT(P),730)
+5 SET X=0
FOR
SET X=$ORDER(^AUPNVIMM("AC",P,X))
IF X'=+X
QUIT
Begin DoDot:1
+6 ;happens
IF '$DATA(^AUPNVIMM(X,0))
QUIT
+7 SET Y=$PIECE(^AUPNVIMM(X,0),U)
+8 ;happens too
IF 'Y
QUIT
+9 ;get HL7/CVX code
SET I=$PIECE($GET(^AUTTIMM(Y,0)),U,3)
+10 IF '$DATA(^ATXAX(TCVX,21,"B",I))
QUIT
+11 SET D=$PIECE($PIECE($GET(^AUPNVIMM(X,12)),U,1),".")
+12 IF D=""
SET V=$PIECE(^AUPNVIMM(X,0),U,3)
IF V
SET D=$PIECE($PIECE($GET(^AUPNVSIT(V,0)),U),".")
+13 IF D<A42
QUIT
+14 IF D>A730
QUIT
+15 SET BGPIMMS(D)=Y
+16 QUIT
End DoDot:1
+17 ;go through and set into array if 1 days apart
+18 SET X=""
SET Y=""
SET C=0
FOR
SET X=$ORDER(BGPIMMS(X))
IF X'=+X
QUIT
SET C=C+1
Begin DoDot:1
+19 IF C=1
SET Y=X
QUIT
+20 IF $$FMDIFF^XLFDT(X,Y)<1
KILL BGPIMMS(X)
QUIT
+21 SET Y=X
End DoDot:1
+22 ;see if there are 4 of them, if there are quit
+23 SET BGPIMMS=0
SET X=0
FOR
SET X=$ORDER(BGPIMMS(X))
IF X'=+X
QUIT
SET BGPIMMS=BGPIMMS+1
+24 IF BGPIMMS>3
QUIT 1_U_"3 DOSE ROTA"
+25 ;now get cpts
+26 SET G=""
SET X=0
+27 FOR
SET X=$ORDER(^AUPNVCPT("AC",P,X))
IF X=""
QUIT
Begin DoDot:1
+28 IF '$DATA(^AUPNVCPT(X,0))
QUIT
+29 SET Y=$PIECE(^AUPNVCPT(X,0),U)
+30 IF '$$ICD^BGP8UTL2(Y,TCPT,1)
QUIT
+31 SET V=$PIECE(^AUPNVCPT(X,0),U,3)
IF 'V
QUIT
+32 SET D=$$VD^APCLV(V)
+33 IF D<A42
QUIT
+34 IF D>A730
QUIT
+35 SET BGPIMMS(D)=""
End DoDot:1
+36 ;get tran codes
+37 SET X=0
FOR
SET X=$ORDER(^AUPNVTC("AC",P,X))
IF X'=+X
QUIT
Begin DoDot:1
+38 IF '$DATA(^AUPNVTC(X,0))
QUIT
+39 SET Y=$PIECE(^AUPNVTC(X,0),U,7)
IF 'Y
QUIT
+40 IF '$$ICD^BGP8UTL2(Y,TCPT,1)
QUIT
+41 SET V=$PIECE(^AUPNVTC(X,0),U,3)
IF 'V
QUIT
+42 SET D=$$VD^APCLV(V)
+43 IF D<A42
QUIT
+44 IF D>A730
QUIT
+45 SET BGPIMMS(D)=""
End DoDot:1
+46 ;
+47 ;go through and set into array if 1 days apart
+48 SET X=""
SET Y=""
SET C=0
FOR
SET X=$ORDER(BGPIMMS(X))
IF X'=+X
QUIT
SET C=C+1
Begin DoDot:1
+49 IF C=1
SET Y=X
QUIT
+50 IF $$FMDIFF^XLFDT(X,Y)<1
KILL BGPIMMS(X)
QUIT
+51 SET Y=X
End DoDot:1
+52 ;see if there are 2 of them, if there are quit
+53 SET BGPIMMS=0
SET X=0
FOR
SET X=$ORDER(BGPIMMS(X))
IF X'=+X
QUIT
SET BGPIMMS=BGPIMMS+1
+54 IF BGPIMMS>2
QUIT 1_U_"3 DOSE ROTA"
+55 ;NOW CHECK FOR CONTRAINDICATION
+56 ;IMM PKG ANAPHYLACTIS
+57 SET BGPZ=0
+58 FOR
SET BGPZ=$ORDER(^ATXAX(TCVX,21,"B",BGPZ))
IF BGPZ=""!(X]"")
QUIT
Begin DoDot:1
+59 SET X=$$ANNECONT(P,BGPZ,A730)
End DoDot:1
+60 IF X]""
QUIT 1_U_"ROTA CONTRA ANAPHYLACTIC/IMMUNE DEF"
+61 SET X=$$ANSNROTA(P,A730)
IF X
QUIT 1_U_"ROTA CONTRA ANAPHYLACTIC REACTION"
+62 SET X=$$SCID(P,A730)
IF X
QUIT 1_U_"ROTA CONTRA SCID"
+63 SET X=$$INTUSS(P,A730)
IF X
QUIT 1_U_"ROTA CONTRA INTUSSUSCEPTION"
+64 QUIT ""
ANSNROTA(P,EDATE) ;
+1 ;V POV OR PROBLEM LIST
+2 NEW X,Y,Z,G,T,S,D,I
+3 SET (X,Y,I)=0
+4 FOR
SET X=$ORDER(^AUPNPROB("AC",P,X))
IF X'=+X!(I)
QUIT
Begin DoDot:1
+5 IF '$DATA(^AUPNPROB(X,0))
QUIT
+6 IF $PIECE(^AUPNPROB(X,0),U,12)="D"
QUIT
+7 ;if there is a doo and it is after report period skip
IF $PIECE(^AUPNPROB(X,0),U,13)
IF $PIECE(^AUPNPROB(X,0),U,13)>EDATE
QUIT
+8 ;entered after report period, skip
IF $PIECE(^AUPNPROB(X,0),U,13)=""
IF $PIECE(^AUPNPROB(X,0),U,8)>EDATE
QUIT
+9 SET S=$$VAL^XBDIQ1(9000011,X,80001)
+10 IF S=428331000124103
SET I=1
QUIT
+11 QUIT
End DoDot:1
+12 IF I
QUIT I
+13 ;NOW V POV SNOMED
+14 ;NOW SNOMED USING ASNC
+15 SET G=""
SET I=""
+16 SET S=""
FOR
SET S=$ORDER(^AUPNVPOV("ASNC",P,S))
IF S=""!(G)
QUIT
Begin DoDot:1
+17 SET I=0
+18 IF S=428331000124103
SET I=1
+19 IF 'I
QUIT
+20 SET D=0
FOR
SET D=$ORDER(^AUPNVPOV("ASNC",P,S,D))
IF D=""!(G)
QUIT
Begin DoDot:2
+21 SET Y=9999999-D
+22 IF Y>EDATE
QUIT
+23 SET G=1
End DoDot:2
End DoDot:1
+24 IF G
QUIT G
+25 ;REFUSAL FILE
+26 SET I=""
FOR
SET I=$ORDER(^AUPNPREF("AA",P,9002318.4,I))
IF I=""!(G)
QUIT
Begin DoDot:1
+27 ;IF IT'S SNOMED, MUST BE THAT ONE
IF I'=428331000124103
QUIT
+28 SET ID=0
FOR
SET ID=$ORDER(^AUPNPREF("AA",P,9002318.4,I,ID))
IF ID=""!(G)
QUIT
Begin DoDot:2
+29 SET D=9999999-ID
+30 IF D>EDATE
QUIT
+31 SET G=1
End DoDot:2
End DoDot:1
+32 QUIT G
ANNECONT(P,C,ED) ;EP - ANALPHYLAXIS
+1 NEW X,G,Y,R,D
+2 SET X=0
SET G=""
SET Y=$ORDER(^AUTTIMM("C",C,0))
IF Y
FOR
SET X=$ORDER(^BIPC("AC",P,Y,X))
IF X'=+X!(G)
QUIT
Begin DoDot:1
+3 SET R=$PIECE(^BIPC(X,0),U,3)
+4 IF R=""
QUIT
+5 IF '$DATA(^BICONT(R,0))
QUIT
+6 SET D=$PIECE(^BIPC(X,0),U,4)
+7 IF D=""
QUIT
+8 ;Q:$P(^BIPC(X,0),U,4)<BD
+9 IF $PIECE(^BIPC(X,0),U,4)>ED
QUIT
+10 IF $PIECE(^BICONT(R,0),U,1)="Anaphylaxis"
SET G=D_U_"Contra Anaphylaxis"
+11 IF $PIECE(^BICONT(R,0),U,1)="Immune Deficiency"
SET G=D_U_"Contra: Immune Deficiency"
End DoDot:1
+12 QUIT G
SCID(P,EDATE) ;EP
+1 NEW X,Y,Z,G,T,S,D,E,R,L,J,ME
+2 IF $$PLTAXND^BGP8DU(P,"BGP IPC SCID DXS",EDATE,0)
QUIT 1
+3 IF $$IPLSNOND^BGP8DU(P,"PXRM BGP IPC SCID",EDATE,0)
QUIT 1
+4 IF $$LASTDX^BGP8UTL1(P,"BGP IPC SCID DXS",$$DOB^AUPNPAT(P),EDATE)
QUIT 1
+5 ;NOW V POV SNOMED
+6 ;NOW SNOMED USING ASNC
+7 SET T="PXRM BGP IPC SCID"
+8 SET G=""
+9 SET S=0
FOR
SET S=$ORDER(^XTMP("BGPSNOMEDSUBSET",$JOB,T,S))
IF S=""!(G)
QUIT
Begin DoDot:1
+10 IF '$DATA(^AUPNVPOV("ASNC",P,S))
QUIT
+11 SET D=0
FOR
SET D=$ORDER(^AUPNVPOV("ASNC",P,S,D))
IF D=""!(G)
QUIT
Begin DoDot:2
+12 SET Y=9999999-D
+13 IF Y>EDATE
QUIT
+14 SET G=1
End DoDot:2
End DoDot:1
+15 QUIT G
INTUSS(P,EDATE) ;EP
+1 NEW X,Y,Z,G,T,S,D,E,R,L,J,ME
+2 IF $$PLTAXND^BGP8DU(P,"BGP IPC INTUSSUSCEPTION DXS",EDATE,0)
QUIT 1
+3 IF $$IPLSNOND^BGP8DU(P,"PXRM BGP IPC INTUSSUS",EDATE,0)
QUIT 1
+4 IF $$LASTDX^BGP8UTL1(P,"BGP IPC INTUSSUSCEPTION DXS",$$DOB^AUPNPAT(P),EDATE)
QUIT 1
+5 ;NOW V POV SNOMED
+6 ;NOW SNOMED USING ASNC
+7 SET T="PXRM BGP IPC INTUSSUS"
+8 SET G=""
+9 SET S=0
FOR
SET S=$ORDER(^XTMP("BGPSNOMEDSUBSET",$JOB,T,S))
IF S=""!(G)
QUIT
Begin DoDot:1
+10 IF '$DATA(^AUPNVPOV("ASNC",P,S))
QUIT
+11 SET D=0
FOR
SET D=$ORDER(^AUPNVPOV("ASNC",P,S,D))
IF D=""!(G)
QUIT
Begin DoDot:2
+12 SET Y=9999999-D
+13 IF Y>EDATE
QUIT
+14 SET G=1
End DoDot:2
End DoDot:1
+15 QUIT G