APCLSILA ;IHS/CMI/LAB - AGGREGATE ILI REPORT; ; 31 Mar 2014 8:08 AM
;;3.0;IHS PCC REPORTS;**24,25,26,27,29,30**;FEB 05, 1997;Build 27
;
MEDS ;EP
NEW C,X,Y,Z,T,L,M,N
S T=$O(^ATXAX("B","FLU ANTIVIRAL MEDS",0))
S C="",X=0 F S X=$O(^AUPNVMED("AD",APCLVDFN,X)) Q:X'=+X!(C) S Y=$P($G(^AUPNVMED(X,0)),U) D
.Q:'Y
.Q:'$D(^PSDRUG(Y,0))
.S Z=0
.S N=$P(^PSDRUG(Y,0),U)
.I $D(^ATXAX(T,21,"B",Y)) S Z=1
.I N["OSELTAMIVIR" S Z=1
.I N["ZANAMIVIR" S Z=1
.Q:'Z
.S $P(APCLMEDS(N),U,1)=$P($G(APCLMEDS(N)),U,1)+1
.;Q:$D(APCLMEDP(N,$P(APCLVREC,U,5)))
.Q:$D(^XTMP("APCLSILR",APCLJ,APCLH,"APCLMEDP",$P(APCLVREC,U,5),N))
.S $P(APCLMEDS(N),U,2)=$P($G(APCLMEDS(N)),U,2)+1
.;S APCLMEDP(N,$P(APCLVREC,U,5))=""
.S ^XTMP("APCLSILR",APCLJ,APCLH,"APCLMEDP",$P(APCLVREC,U,5),N)=""
Q
VACAGE ;EP
;S H=$$HASVAC^APCLSILI(APCLVDFN)
S I=$$HASIVAC^APCLSILI(APCLVDFN)
I 'I Q
S S2="A"
S APCLAY=$$AGE^APCLSILU($P(APCLVREC,U,5),1,$$VD^APCLV(APCLVDFN))
I APCLAY["<"!(APCLAY<5) D Q
.S APCLAY=$$AGE^APCLSILU($P(APCLVREC,U,5),2,$$VD^APCLV(APCLVDFN))
.I APCLAY<6 Q
.S A=$$AGEGM^APCLSILR(APCLAY)
.I I S APCLIMMG("I",S2,A)=$G(APCLIMMG("I",S2,A))+1,APCLIMMG("I",S2,"TOTAL")=$G(APCLIMMG("I",S2,"TOTAL"))+1 D
..S APCLIMML(APCLLOCN,"I",S2,A)=$G(APCLIMML(APCLLOCN,"I",S2,A))+1,APCLIMML(APCLLOCN,"I",S2,"TOTAL")=$G(APCLIMML(APCLLOCN,"I",S2,"TOTAL"))+1
;.I H S APCLIMMG("H",S2,A)=$G(APCLIMMG("H",S2,A))+1,APCLIMMG("H",S2,"TOTAL")=$G(APCLIMMG("H",S2,"TOTAL"))+1 D
;..S APCLIMML(APCLLOCN,"H",S2,A)=$G(APCLIMML(APCLLOCN,"H",S2,A))+1,APCLIMML(APCLLOCN,"H",S2,"TOTAL")=$G(APCLIMML(APCLLOCN,"H",S2,"TOTAL"))+1
S A=$$AGEG^APCLSILR(APCLAY)
I I S APCLIMMG("I",S2,A)=$G(APCLIMMG("I",S2,A))+1,APCLIMMG("I",S2,"TOTAL")=$G(APCLIMMG("I",S2,"TOTAL"))+1 D
.S APCLIMML(APCLLOCN,"I",S2,A)=$G(APCLIMML(APCLLOCN,"I",S2,A))+1,APCLIMML(APCLLOCN,"I",S2,"TOTAL")=$G(APCLIMML(APCLLOCN,"I",S2,"TOTAL"))+1
;I H S APCLIMMG("H",S2,A)=$G(APCLIMMG("H",S2,A))+1,APCLIMMG("H",S2,"TOTAL")=$G(APCLIMMG("H",S2,"TOTAL"))+1 D
;.S APCLIMML(APCLLOCN,"H",S2,A)=$G(APCLIMML(APCLLOCN,"H",S2,A))+1,APCLIMML(APCLLOCN,"H",S2,"TOTAL")=$G(APCLIMML(APCLLOCN,"H",S2,"TOTAL"))+1
Q
APCLSILA ;IHS/CMI/LAB - AGGREGATE ILI REPORT; ; 31 Mar 2014 8:08 AM
+1 ;;3.0;IHS PCC REPORTS;**24,25,26,27,29,30**;FEB 05, 1997;Build 27
+2 ;
MEDS ;EP
+1 NEW C,X,Y,Z,T,L,M,N
+2 SET T=$ORDER(^ATXAX("B","FLU ANTIVIRAL MEDS",0))
+3 SET C=""
SET X=0
FOR
SET X=$ORDER(^AUPNVMED("AD",APCLVDFN,X))
IF X'=+X!(C)
QUIT
SET Y=$PIECE($GET(^AUPNVMED(X,0)),U)
Begin DoDot:1
+4 IF 'Y
QUIT
+5 IF '$DATA(^PSDRUG(Y,0))
QUIT
+6 SET Z=0
+7 SET N=$PIECE(^PSDRUG(Y,0),U)
+8 IF $DATA(^ATXAX(T,21,"B",Y))
SET Z=1
+9 IF N["OSELTAMIVIR"
SET Z=1
+10 IF N["ZANAMIVIR"
SET Z=1
+11 IF 'Z
QUIT
+12 SET $PIECE(APCLMEDS(N),U,1)=$PIECE($GET(APCLMEDS(N)),U,1)+1
+13 ;Q:$D(APCLMEDP(N,$P(APCLVREC,U,5)))
+14 IF $DATA(^XTMP("APCLSILR",APCLJ,APCLH,"APCLMEDP",$PIECE(APCLVREC,U,5),N))
QUIT
+15 SET $PIECE(APCLMEDS(N),U,2)=$PIECE($GET(APCLMEDS(N)),U,2)+1
+16 ;S APCLMEDP(N,$P(APCLVREC,U,5))=""
+17 SET ^XTMP("APCLSILR",APCLJ,APCLH,"APCLMEDP",$PIECE(APCLVREC,U,5),N)=""
End DoDot:1
+18 QUIT
VACAGE ;EP
+1 ;S H=$$HASVAC^APCLSILI(APCLVDFN)
+2 SET I=$$HASIVAC^APCLSILI(APCLVDFN)
+3 IF 'I
QUIT
+4 SET S2="A"
+5 SET APCLAY=$$AGE^APCLSILU($PIECE(APCLVREC,U,5),1,$$VD^APCLV(APCLVDFN))
+6 IF APCLAY["<"!(APCLAY<5)
Begin DoDot:1
+7 SET APCLAY=$$AGE^APCLSILU($PIECE(APCLVREC,U,5),2,$$VD^APCLV(APCLVDFN))
+8 IF APCLAY<6
QUIT
+9 SET A=$$AGEGM^APCLSILR(APCLAY)
+10 IF I
SET APCLIMMG("I",S2,A)=$GET(APCLIMMG("I",S2,A))+1
SET APCLIMMG("I",S2,"TOTAL")=$GET(APCLIMMG("I",S2,"TOTAL"))+1
Begin DoDot:2
+11 SET APCLIMML(APCLLOCN,"I",S2,A)=$GET(APCLIMML(APCLLOCN,"I",S2,A))+1
SET APCLIMML(APCLLOCN,"I",S2,"TOTAL")=$GET(APCLIMML(APCLLOCN,"I",S2,"TOTAL"))+1
End DoDot:2
End DoDot:1
QUIT
+12 ;.I H S APCLIMMG("H",S2,A)=$G(APCLIMMG("H",S2,A))+1,APCLIMMG("H",S2,"TOTAL")=$G(APCLIMMG("H",S2,"TOTAL"))+1 D
+13 ;..S APCLIMML(APCLLOCN,"H",S2,A)=$G(APCLIMML(APCLLOCN,"H",S2,A))+1,APCLIMML(APCLLOCN,"H",S2,"TOTAL")=$G(APCLIMML(APCLLOCN,"H",S2,"TOTAL"))+1
+14 SET A=$$AGEG^APCLSILR(APCLAY)
+15 IF I
SET APCLIMMG("I",S2,A)=$GET(APCLIMMG("I",S2,A))+1
SET APCLIMMG("I",S2,"TOTAL")=$GET(APCLIMMG("I",S2,"TOTAL"))+1
Begin DoDot:1
+16 SET APCLIMML(APCLLOCN,"I",S2,A)=$GET(APCLIMML(APCLLOCN,"I",S2,A))+1
SET APCLIMML(APCLLOCN,"I",S2,"TOTAL")=$GET(APCLIMML(APCLLOCN,"I",S2,"TOTAL"))+1
End DoDot:1
+17 ;I H S APCLIMMG("H",S2,A)=$G(APCLIMMG("H",S2,A))+1,APCLIMMG("H",S2,"TOTAL")=$G(APCLIMMG("H",S2,"TOTAL"))+1 D
+18 ;.S APCLIMML(APCLLOCN,"H",S2,A)=$G(APCLIMML(APCLLOCN,"H",S2,A))+1,APCLIMML(APCLLOCN,"H",S2,"TOTAL")=$G(APCLIMML(APCLLOCN,"H",S2,"TOTAL"))+1
+19 QUIT