- BIREPF4 ;IHS/CMI/MWR - REPORT, FLU IMM; OCT 15, 2010
- ;;8.5;IMMUNIZATION;**15**;SEP 30,2017
- ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
- ;; INFLUENZA IMM REPORT, GATHER/STORE PATIENTS.
- ;; PATCH 1: Exclude patients whose Inactive Date=Not in Register. CHKSET+31
- ;; PATCH 2: Filter for Active Clinical, all ages, using $$ACTCLIN^BIUTL6 call.
- ;; CHKSET+39
- ;; PATCH 5: Begin Flu Report on July 1. CHKSET+107
- ;; PATCH 13: Reincorporate Flu High Risk check with a value of "4". CHKSET+41
- ;; PATCH 15: Reincorporate Flu High Risk check with a value of "4". CHKSET+46
- ;; Update list of CVX's that count as Flu refusal. CHKSET+87
- ;
- ;
- ;----------
- GETPATS(BIBEGDT,BIENDDT,BIAGRP,BICC,BIHCF,BICM,BIBEN,BIQDT,BIFH,BIYEAR,BIUP) ;EP
- ;---> Get patients from VA PATIENT File, ^DPT(.
- ;---> Parameters:
- ; 1 - BIBEGDT (req) Begin DOB for this group.
- ; 2 - BIENDDT (req) End DOB for this group.
- ; 3 - BIAGRP (req) Node/number for this Age Group.
- ; 4 - BICC (req) Current Community array.
- ; 5 - BIHCF (req) Health Care Facility array.
- ; 6 - BICM (req) Case Manager array.
- ; 7 - BIBEN (req) Beneficiary Type array.
- ; 8 - BIQDT (req) Quarter Ending Date.
- ; 9 - BIFH (req) F=report on Flu Vaccine Group (default), H=H1N1 group.
- ; 10 - BIYEAR (req) Report Year^m (if 2nd pc="m", then End Date=March 31 of
- ; the report year; otherwise End Date=Dec 31 of BIYEAR)
- ; 11 - BIUP (req) User Population/Group (Registered, Imm, User, Active).
- ;
- ;---> Set begin and end dates for search through PATIENT File.
- ;
- Q:'$G(BIBEGDT) Q:'$G(BIENDDT) Q:'$G(BIAGRP) Q:'$G(BIYEAR)
- ;---> Start 1 day prior to Begin Date and $O into the desired DOB's.
- N N S N=BIBEGDT-1
- F S N=$O(^DPT("ADOB",N)) Q:(N>BIENDDT!('N)) D
- .S BIDFN=0
- .F S BIDFN=$O(^DPT("ADOB",N,BIDFN)) Q:'BIDFN D
- ..D CHKSET(BIDFN,.BICC,.BIHCF,.BICM,.BIBEN,BIAGRP,BIQDT,BIFH,BIYEAR,BIUP)
- Q
- ;
- ;
- ;----------
- CHKSET(BIDFN,BICC,BIHCF,BICM,BIBEN,BIAGRP,BIQDT,BIFH,BIYEAR,BIUP) ;EP
- ;---> Check if this patient fits criteria; if so, set DFN
- ;---> in ^TMP("BIREPF1".
- ;---> Parameters:
- ; 1 - BIDFN (req) Patient IEN.
- ; 2 - BICC (req) Current Community array.
- ; 3 - BIHCF (req) Health Care Facility array.
- ; 4 - BICM (req) Case Manager array.
- ; 5 - BIBEN (req) Beneficiary Type array.
- ; 6 - BIAGRP (req) Node/number for this Age Group.
- ; 7 - BIQDT (req) Quarter Ending Date.
- ; 8 - BIFH (req) F=report on Flu Vaccine Group, H=H1N1 group.
- ; 9 - BIYEAR (req) Report Year^m (if 2nd pc="m", then End Date=March 31 of
- ; the report year; otherwise End Date=Dec 31 of BIYEAR)
- ; 10 - BIUP (req) User Population/Group (Registered, Imm, User, Active).
- ;
- Q:'$G(BIDFN)
- Q:'$D(BICC)
- Q:'$D(BIHCF)
- Q:'$D(BICM)
- Q:'$D(BIBEN)
- Q:'$G(BIAGRP)
- Q:'$G(BIQDT)
- S:($G(BIFH)="") BIFH="F"
- Q:'$G(BIYEAR)
- Q:$G(BIUP)=""
- ;
- ;---> Quit if patient is not in the Register.
- Q:'$D(^BIP(BIDFN,0))
- ;
- ;---> Filter for standard Patient Population parameter.
- Q:'$$PPFILTR^BIREP(BIDFN,.BIHCF,BIQDT,BIUP)
- ;
- ;---> For first Age Group, 10-23m, filter by Active in Imm Register.
- ;---> Quit if patient became Inactive before the Quarter Ending Date.
- ;I BIAGRP=1 N X S X=$$INACT^BIUTL1(BIDFN) I X]"" Q:X<BIQDT
- ;
- ;---> For 18-49y Age Group, if this patient is High Risk for Flu set BIRISKI=1.
- N BIRISKI S BIRISKI=0
- ;
- ;
- ;********** PATCH 13, v8.5, AUG 01,2016, IHS/CMI/MWR
- ;---> Reincorporate Flu High Risk check with new parameter value of "4".
- ;---> Note: Third parameter=1 (retrieve Flu risk only).
- ;D:BIAGRP=4 RISK^BIDX(BIDFN,$E(BIQDT,1,3)_"0901",1,.BIRISKI)
- ;
- ;
- ;********** PATCH 15, v8.5, SEP 30,2017, IHS/CMI/MWR
- ;---> Return Flu High Risk Value for ages >18 yrs and <50 yrs.
- ;D:BIAGRP=4 RISK^BIDX(BIDFN,$E(BIQDT,1,3)_"0901",4,.BIRISKI)
- D:BIAGRP=4 RISKF^BIDX(BIDFN,$E(BIQDT,1,3)_"0901",.BIRISKI)
- ;**********
- ;
- ;
- ;---> Uncomment next line to test High Risk.
- ;S:(BIDFN=30) BIRISKI=1 ;MWRZZZ
- ;---> If this patient is (18-49y) High Risk, change Age Group to 5.
- I BIRISKI S BIAGRP=5
- ;
- ;---> Quit if Current Community doesn't match.
- Q:$$CURCOM^BIEXPRT2(BIDFN,.BICC)
- ;
- ;---> Quit if Case Manager doesn't match.
- Q:$$CMGR^BIDUR(BIDFN,.BICM)
- ;
- ;---> Quit if Beneficiary Type doesn't match.
- Q:$$BENT^BIDUR1(BIDFN,.BIBEN)
- ;
- ;---> Store Patient in Age Group.
- S ^TMP("BIREPF1",$J,"PATS",BIAGRP,BIDFN)=""
- ;
- ;---> RPC to gather Immunization History.
- N BI31,BIDE,BIRETVAL,BIRETERR,I S BI31=$C(31)_$C(31),BIRETVAL=""
- ;---> 55=Vaccine Group IEN, 56=Date of Visit (Fileman), 65=Dose Override.
- F I=55,56,65 S BIDE(I)=""
- ;---> Fourth parameter=0: Do not return Skin Tests.
- ;---> Fifth parameter=0: Split out combinations as if given individually.
- D IMMHX^BIRPC(.BIRETVAL,BIDFN,.BIDE,0,0)
- ;
- ;---> If BIRETERR has a value, store it and quit.
- S BIRETERR=$P(BIRETVAL,BI31,2)
- Q:BIRETERR]""
- ;
- ;---> Add refusals, if any.
- N Z D CONTRA^BIUTL11(BIDFN,.Z,1) I $O(Z(0)) D
- .;---> If this refusal is for an Influenza vaccine, count it.
- .;
- .;********** PATCH 15, v8.5, SEP 30,2017, IHS/CMI/MWR
- .;---> Update list of CVX's that count as Flu refusal.
- .;N I F I=15,16,88,111,123,135 I $D(Z(I)) S BITMP("REFUSALS",BIDFN)=""
- .N I F I=15,16,88,111,123,125,126,127,128,135,140,141 I $D(Z(I)) S BITMP("REFUSALS",BIDFN)=""
- .F I=144,149,150,151,153,155,158,161,166,168,171,185,186 I $D(Z(I)) S BITMP("REFUSALS",BIDFN)=""
- .;**********
- ;
- ;---> Set BIHX=to a valid Immunization History.
- N BIHX S BIHX=$P(BIRETVAL,BI31,1)
- ;
- ;---> Add this Patient's History to stats.
- N I,Y
- ;---> Loop through "^"-pieces of Imm History, getting data.
- F I=1:1 S Y=$P(BIHX,U,I) Q:Y="" D
- .;
- .;---> Set this immunization in the STATS array by:
- .;---> Vaccine Group (V), Dose# (D), and Age (A), and Current Season (C).
- .N A,C,D,Q,V
- .S A=BIAGRP,V=$P(Y,"|",2)
- .;
- .;---> Quit if this is not a Flu vaccine or H1N1.
- .I BIFH="H" Q:(V'=18)
- .;---> Default="F" (Flu).
- .I BIFH'="H" Q:(V'=10)
- .;I $G(BIFH)'="H" Q:(V'=18)
- .;
- .;---> Quit if this dose is marked INVALID.
- .I $P(Y,"|",4),$P(Y,"|",4)<9 Q
- .;
- .;---> Quit (don't count) if Visit was AFTER the Report Year End Date.
- .N BIDT S BIDT=$P(Y,"|",3)
- .;---> If the Report End Date is not March 31, then quit if visit is after
- .;---> the Quarter Ending Date (12/31 of the Report Year).
- .I $P(BIYEAR,U,2)'="m" Q:(BIDT>BIQDT)
- .;---> Quit if visit is after March Report End Date (following the Report Year).
- .Q:(BIDT>(($E(BIQDT,1,3)+1)_"0331"))
- .;
- .;---> If this was in the current season, C=1; otherwise C=0 (before this season).
- .D
- ..;********** PATCH 5, v8.5, JUL 01,2013, IHS/CMI/MWR
- ..;---> Begin Flu Report on July 1.
- ..;I BIDT<($E(BIQDT,1,3)_"0901") S C=0 Q
- ..I BIDT<($E(BIQDT,1,3)_"0701") S C=0 Q
- ..;**********
- ..S C=1
- .;
- .;---> Set Dose# (increment by 1's to assign highest/latest dose#).
- .S D=1,Q=0
- .F Q:Q D
- ..;---> Set: BIHX(Vaccine Grp, Current Season, Dose)
- ..I $D(BIHX(V,C,D)) S D=D+1 Q
- ..S BIHX(V,C,D)="",Q=1
- .;
- .;---> Set: BITMP(Vaccine Grp, Season, Dose, Age Grp)
- .N Z S Z=$G(BITMP("STATS",V,C,D,A)) S BITMP("STATS",V,C,D,A)=Z+1
- .;---> If Age Group 18-19y and pt is High Risk, set stat for Age Group 5.
- .;Q:((A'=4)!('BIRISKI))
- .;S Z=$G(BITMP("STATS",V,C,D,5)) S BITMP("STATS",V,C,D,5)=Z+1
- ;
- ;
- ;---> Next Section:
- ;---> If this patient has the minimum required immunizations for
- ;---> his/her Age Group, then increment by 1 the "Appro for Age"
- ;---> tally for that Age Group.
- ;---> The code examines Imm Hx array BIHX(VacGrp, Current Season, Dose#) for
- ;---> each patient.
- ;---> Each Quit represents a condition that a child in that age group
- ;---> must meet in order to be "appropriate for age."
- ;
- ;---> Following lines matrix: Vaccine Group, Dose#.
- ;
- ;---> X=1 is NOT Current/appropriate for age; X=2 IS Current/appropriate for age.
- N X
- ;---> For 6-23m old patients (BIAGRP=1).
- S X=1
- I BIAGRP=1 D D STOR(BIDFN,BIQDT,X) Q
- .Q:'$D(BIHX(10))
- .;---> If patient has Flu, Current season, 2 doses; then he's appropriate.
- .I $D(BIHX(10,1,2)) D APPRO(BIAGRP) S X=2 Q
- .;---> If pt has Current season, 1 dose; Past season, 1 dose; then appropriate.
- .I $D(BIHX(10,1,1)),$D(BIHX(10,0,1)) D APPRO(BIAGRP) S X=2 Q
- ;
- ;---> For 2-4y old patients (BIAGRP=2).
- S X=1
- I BIAGRP=2 D D STOR(BIDFN,BIQDT,X) Q
- .Q:'$D(BIHX(10))
- .;---> If patient has Flu, Current season, 2 doses; then he's appropriate.
- .I $D(BIHX(10,1,2)) D APPRO(BIAGRP) S X=2 Q
- .;---> If pt has Current season, 1 dose; Past season, 2 doses; then appropriate.
- .I $D(BIHX(10,1,1)),$D(BIHX(10,0,2)) D APPRO(BIAGRP) S X=2 Q
- ;
- S X=1
- ;---> For all other Age Groups.
- D D STOR(BIDFN,BIQDT,X)
- .Q:'$D(BIHX(10))
- .;---> If patient has Flu, Current season 1 dose; then he's appropriate.
- .;---> Also, if this is 18-49 and the patient is High Risk set in Group 5.
- .I $D(BIHX(10,1,1)) D APPRO(BIAGRP) D:((BIAGRP=4)&BIRISKI) APPRO(5) S X=2 Q
- Q
- ;
- ;
- ;----------
- APPRO(BIAGRP) ;EP
- ;---> Store Patient in Appropriate for Age Group.
- ;---> Parameters:
- ; 1 - BIAGRP (req) Node/number for this Age Group.
- ;
- ;---> Store Patient in Age Group.
- N Z S Z=$G(BITMP("STATS","APPRO",BIAGRP))
- S BITMP("STATS","APPRO",BIAGRP)=Z+1
- Q
- ;
- ;
- ;----------
- STOR(BIDFN,BIQDT,BIVAL) ;EP
- ;---> Store in ^TMP for displaying List of Patients.
- ;---> Parameters:
- ; 1 - BIDFN (req) Patient IEN.
- ; 2 - BIQDT (req) Quarter Ending Date.
- ; 3 - BIVAL (opt) Value to set ^TMP(Pat...) node equal to.
- ;
- Q:'$G(BIDFN) S:'$G(BIQDT) BIQDT=DT
- ;D UPDATE^BIPATUP(BIDFN,DT,,1)
- D STORE^BIDUR1(BIDFN,BIQDT,1,,$G(BIVAL))
- Q
- BIREPF4 ;IHS/CMI/MWR - REPORT, FLU IMM; OCT 15, 2010
- +1 ;;8.5;IMMUNIZATION;**15**;SEP 30,2017
- +2 ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
- +3 ;; INFLUENZA IMM REPORT, GATHER/STORE PATIENTS.
- +4 ;; PATCH 1: Exclude patients whose Inactive Date=Not in Register. CHKSET+31
- +5 ;; PATCH 2: Filter for Active Clinical, all ages, using $$ACTCLIN^BIUTL6 call.
- +6 ;; CHKSET+39
- +7 ;; PATCH 5: Begin Flu Report on July 1. CHKSET+107
- +8 ;; PATCH 13: Reincorporate Flu High Risk check with a value of "4". CHKSET+41
- +9 ;; PATCH 15: Reincorporate Flu High Risk check with a value of "4". CHKSET+46
- +10 ;; Update list of CVX's that count as Flu refusal. CHKSET+87
- +11 ;
- +12 ;
- +13 ;----------
- GETPATS(BIBEGDT,BIENDDT,BIAGRP,BICC,BIHCF,BICM,BIBEN,BIQDT,BIFH,BIYEAR,BIUP) ;EP
- +1 ;---> Get patients from VA PATIENT File, ^DPT(.
- +2 ;---> Parameters:
- +3 ; 1 - BIBEGDT (req) Begin DOB for this group.
- +4 ; 2 - BIENDDT (req) End DOB for this group.
- +5 ; 3 - BIAGRP (req) Node/number for this Age Group.
- +6 ; 4 - BICC (req) Current Community array.
- +7 ; 5 - BIHCF (req) Health Care Facility array.
- +8 ; 6 - BICM (req) Case Manager array.
- +9 ; 7 - BIBEN (req) Beneficiary Type array.
- +10 ; 8 - BIQDT (req) Quarter Ending Date.
- +11 ; 9 - BIFH (req) F=report on Flu Vaccine Group (default), H=H1N1 group.
- +12 ; 10 - BIYEAR (req) Report Year^m (if 2nd pc="m", then End Date=March 31 of
- +13 ; the report year; otherwise End Date=Dec 31 of BIYEAR)
- +14 ; 11 - BIUP (req) User Population/Group (Registered, Imm, User, Active).
- +15 ;
- +16 ;---> Set begin and end dates for search through PATIENT File.
- +17 ;
- +18 IF '$GET(BIBEGDT)
- QUIT
- IF '$GET(BIENDDT)
- QUIT
- IF '$GET(BIAGRP)
- QUIT
- IF '$GET(BIYEAR)
- QUIT
- +19 ;---> Start 1 day prior to Begin Date and $O into the desired DOB's.
- +20 NEW N
- SET N=BIBEGDT-1
- +21 FOR
- SET N=$ORDER(^DPT("ADOB",N))
- IF (N>BIENDDT!('N))
- QUIT
- Begin DoDot:1
- +22 SET BIDFN=0
- +23 FOR
- SET BIDFN=$ORDER(^DPT("ADOB",N,BIDFN))
- IF 'BIDFN
- QUIT
- Begin DoDot:2
- +24 DO CHKSET(BIDFN,.BICC,.BIHCF,.BICM,.BIBEN,BIAGRP,BIQDT,BIFH,BIYEAR,BIUP)
- End DoDot:2
- End DoDot:1
- +25 QUIT
- +26 ;
- +27 ;
- +28 ;----------
- CHKSET(BIDFN,BICC,BIHCF,BICM,BIBEN,BIAGRP,BIQDT,BIFH,BIYEAR,BIUP) ;EP
- +1 ;---> Check if this patient fits criteria; if so, set DFN
- +2 ;---> in ^TMP("BIREPF1".
- +3 ;---> Parameters:
- +4 ; 1 - BIDFN (req) Patient IEN.
- +5 ; 2 - BICC (req) Current Community array.
- +6 ; 3 - BIHCF (req) Health Care Facility array.
- +7 ; 4 - BICM (req) Case Manager array.
- +8 ; 5 - BIBEN (req) Beneficiary Type array.
- +9 ; 6 - BIAGRP (req) Node/number for this Age Group.
- +10 ; 7 - BIQDT (req) Quarter Ending Date.
- +11 ; 8 - BIFH (req) F=report on Flu Vaccine Group, H=H1N1 group.
- +12 ; 9 - BIYEAR (req) Report Year^m (if 2nd pc="m", then End Date=March 31 of
- +13 ; the report year; otherwise End Date=Dec 31 of BIYEAR)
- +14 ; 10 - BIUP (req) User Population/Group (Registered, Imm, User, Active).
- +15 ;
- +16 IF '$GET(BIDFN)
- QUIT
- +17 IF '$DATA(BICC)
- QUIT
- +18 IF '$DATA(BIHCF)
- QUIT
- +19 IF '$DATA(BICM)
- QUIT
- +20 IF '$DATA(BIBEN)
- QUIT
- +21 IF '$GET(BIAGRP)
- QUIT
- +22 IF '$GET(BIQDT)
- QUIT
- +23 IF ($GET(BIFH)="")
- SET BIFH="F"
- +24 IF '$GET(BIYEAR)
- QUIT
- +25 IF $GET(BIUP)=""
- QUIT
- +26 ;
- +27 ;---> Quit if patient is not in the Register.
- +28 IF '$DATA(^BIP(BIDFN,0))
- QUIT
- +29 ;
- +30 ;---> Filter for standard Patient Population parameter.
- +31 IF '$$PPFILTR^BIREP(BIDFN,.BIHCF,BIQDT,BIUP)
- QUIT
- +32 ;
- +33 ;---> For first Age Group, 10-23m, filter by Active in Imm Register.
- +34 ;---> Quit if patient became Inactive before the Quarter Ending Date.
- +35 ;I BIAGRP=1 N X S X=$$INACT^BIUTL1(BIDFN) I X]"" Q:X<BIQDT
- +36 ;
- +37 ;---> For 18-49y Age Group, if this patient is High Risk for Flu set BIRISKI=1.
- +38 NEW BIRISKI
- SET BIRISKI=0
- +39 ;
- +40 ;
- +41 ;********** PATCH 13, v8.5, AUG 01,2016, IHS/CMI/MWR
- +42 ;---> Reincorporate Flu High Risk check with new parameter value of "4".
- +43 ;---> Note: Third parameter=1 (retrieve Flu risk only).
- +44 ;D:BIAGRP=4 RISK^BIDX(BIDFN,$E(BIQDT,1,3)_"0901",1,.BIRISKI)
- +45 ;
- +46 ;
- +47 ;********** PATCH 15, v8.5, SEP 30,2017, IHS/CMI/MWR
- +48 ;---> Return Flu High Risk Value for ages >18 yrs and <50 yrs.
- +49 ;D:BIAGRP=4 RISK^BIDX(BIDFN,$E(BIQDT,1,3)_"0901",4,.BIRISKI)
- +50 IF BIAGRP=4
- DO RISKF^BIDX(BIDFN,$EXTRACT(BIQDT,1,3)_"0901",.BIRISKI)
- +51 ;**********
- +52 ;
- +53 ;
- +54 ;---> Uncomment next line to test High Risk.
- +55 ;S:(BIDFN=30) BIRISKI=1 ;MWRZZZ
- +56 ;---> If this patient is (18-49y) High Risk, change Age Group to 5.
- +57 IF BIRISKI
- SET BIAGRP=5
- +58 ;
- +59 ;---> Quit if Current Community doesn't match.
- +60 IF $$CURCOM^BIEXPRT2(BIDFN,.BICC)
- QUIT
- +61 ;
- +62 ;---> Quit if Case Manager doesn't match.
- +63 IF $$CMGR^BIDUR(BIDFN,.BICM)
- QUIT
- +64 ;
- +65 ;---> Quit if Beneficiary Type doesn't match.
- +66 IF $$BENT^BIDUR1(BIDFN,.BIBEN)
- QUIT
- +67 ;
- +68 ;---> Store Patient in Age Group.
- +69 SET ^TMP("BIREPF1",$JOB,"PATS",BIAGRP,BIDFN)=""
- +70 ;
- +71 ;---> RPC to gather Immunization History.
- +72 NEW BI31,BIDE,BIRETVAL,BIRETERR,I
- SET BI31=$CHAR(31)_$CHAR(31)
- SET BIRETVAL=""
- +73 ;---> 55=Vaccine Group IEN, 56=Date of Visit (Fileman), 65=Dose Override.
- +74 FOR I=55,56,65
- SET BIDE(I)=""
- +75 ;---> Fourth parameter=0: Do not return Skin Tests.
- +76 ;---> Fifth parameter=0: Split out combinations as if given individually.
- +77 DO IMMHX^BIRPC(.BIRETVAL,BIDFN,.BIDE,0,0)
- +78 ;
- +79 ;---> If BIRETERR has a value, store it and quit.
- +80 SET BIRETERR=$PIECE(BIRETVAL,BI31,2)
- +81 IF BIRETERR]""
- QUIT
- +82 ;
- +83 ;---> Add refusals, if any.
- +84 NEW Z
- DO CONTRA^BIUTL11(BIDFN,.Z,1)
- IF $ORDER(Z(0))
- Begin DoDot:1
- +85 ;---> If this refusal is for an Influenza vaccine, count it.
- +86 ;
- +87 ;********** PATCH 15, v8.5, SEP 30,2017, IHS/CMI/MWR
- +88 ;---> Update list of CVX's that count as Flu refusal.
- +89 ;N I F I=15,16,88,111,123,135 I $D(Z(I)) S BITMP("REFUSALS",BIDFN)=""
- +90 NEW I
- FOR I=15,16,88,111,123,125,126,127,128,135,140,141
- IF $DATA(Z(I))
- SET BITMP("REFUSALS",BIDFN)=""
- +91 FOR I=144,149,150,151,153,155,158,161,166,168,171,185,186
- IF $DATA(Z(I))
- SET BITMP("REFUSALS",BIDFN)=""
- +92 ;**********
- End DoDot:1
- +93 ;
- +94 ;---> Set BIHX=to a valid Immunization History.
- +95 NEW BIHX
- SET BIHX=$PIECE(BIRETVAL,BI31,1)
- +96 ;
- +97 ;---> Add this Patient's History to stats.
- +98 NEW I,Y
- +99 ;---> Loop through "^"-pieces of Imm History, getting data.
- +100 FOR I=1:1
- SET Y=$PIECE(BIHX,U,I)
- IF Y=""
- QUIT
- Begin DoDot:1
- +101 ;
- +102 ;---> Set this immunization in the STATS array by:
- +103 ;---> Vaccine Group (V), Dose# (D), and Age (A), and Current Season (C).
- +104 NEW A,C,D,Q,V
- +105 SET A=BIAGRP
- SET V=$PIECE(Y,"|",2)
- +106 ;
- +107 ;---> Quit if this is not a Flu vaccine or H1N1.
- +108 IF BIFH="H"
- IF (V'=18)
- QUIT
- +109 ;---> Default="F" (Flu).
- +110 IF BIFH'="H"
- IF (V'=10)
- QUIT
- +111 ;I $G(BIFH)'="H" Q:(V'=18)
- +112 ;
- +113 ;---> Quit if this dose is marked INVALID.
- +114 IF $PIECE(Y,"|",4)
- IF $PIECE(Y,"|",4)<9
- QUIT
- +115 ;
- +116 ;---> Quit (don't count) if Visit was AFTER the Report Year End Date.
- +117 NEW BIDT
- SET BIDT=$PIECE(Y,"|",3)
- +118 ;---> If the Report End Date is not March 31, then quit if visit is after
- +119 ;---> the Quarter Ending Date (12/31 of the Report Year).
- +120 IF $PIECE(BIYEAR,U,2)'="m"
- IF (BIDT>BIQDT)
- QUIT
- +121 ;---> Quit if visit is after March Report End Date (following the Report Year).
- +122 IF (BIDT>(($EXTRACT(BIQDT,1,3)+1)_"0331"))
- QUIT
- +123 ;
- +124 ;---> If this was in the current season, C=1; otherwise C=0 (before this season).
- +125 Begin DoDot:2
- +126 ;********** PATCH 5, v8.5, JUL 01,2013, IHS/CMI/MWR
- +127 ;---> Begin Flu Report on July 1.
- +128 ;I BIDT<($E(BIQDT,1,3)_"0901") S C=0 Q
- +129 IF BIDT<($EXTRACT(BIQDT,1,3)_"0701")
- SET C=0
- QUIT
- +130 ;**********
- +131 SET C=1
- End DoDot:2
- +132 ;
- +133 ;---> Set Dose# (increment by 1's to assign highest/latest dose#).
- +134 SET D=1
- SET Q=0
- +135 FOR
- IF Q
- QUIT
- Begin DoDot:2
- +136 ;---> Set: BIHX(Vaccine Grp, Current Season, Dose)
- +137 IF $DATA(BIHX(V,C,D))
- SET D=D+1
- QUIT
- +138 SET BIHX(V,C,D)=""
- SET Q=1
- End DoDot:2
- +139 ;
- +140 ;---> Set: BITMP(Vaccine Grp, Season, Dose, Age Grp)
- +141 NEW Z
- SET Z=$GET(BITMP("STATS",V,C,D,A))
- SET BITMP("STATS",V,C,D,A)=Z+1
- +142 ;---> If Age Group 18-19y and pt is High Risk, set stat for Age Group 5.
- +143 ;Q:((A'=4)!('BIRISKI))
- +144 ;S Z=$G(BITMP("STATS",V,C,D,5)) S BITMP("STATS",V,C,D,5)=Z+1
- End DoDot:1
- +145 ;
- +146 ;
- +147 ;---> Next Section:
- +148 ;---> If this patient has the minimum required immunizations for
- +149 ;---> his/her Age Group, then increment by 1 the "Appro for Age"
- +150 ;---> tally for that Age Group.
- +151 ;---> The code examines Imm Hx array BIHX(VacGrp, Current Season, Dose#) for
- +152 ;---> each patient.
- +153 ;---> Each Quit represents a condition that a child in that age group
- +154 ;---> must meet in order to be "appropriate for age."
- +155 ;
- +156 ;---> Following lines matrix: Vaccine Group, Dose#.
- +157 ;
- +158 ;---> X=1 is NOT Current/appropriate for age; X=2 IS Current/appropriate for age.
- +159 NEW X
- +160 ;---> For 6-23m old patients (BIAGRP=1).
- +161 SET X=1
- +162 IF BIAGRP=1
- Begin DoDot:1
- +163 IF '$DATA(BIHX(10))
- QUIT
- +164 ;---> If patient has Flu, Current season, 2 doses; then he's appropriate.
- +165 IF $DATA(BIHX(10,1,2))
- DO APPRO(BIAGRP)
- SET X=2
- QUIT
- +166 ;---> If pt has Current season, 1 dose; Past season, 1 dose; then appropriate.
- +167 IF $DATA(BIHX(10,1,1))
- IF $DATA(BIHX(10,0,1))
- DO APPRO(BIAGRP)
- SET X=2
- QUIT
- End DoDot:1
- DO STOR(BIDFN,BIQDT,X)
- QUIT
- +168 ;
- +169 ;---> For 2-4y old patients (BIAGRP=2).
- +170 SET X=1
- +171 IF BIAGRP=2
- Begin DoDot:1
- +172 IF '$DATA(BIHX(10))
- QUIT
- +173 ;---> If patient has Flu, Current season, 2 doses; then he's appropriate.
- +174 IF $DATA(BIHX(10,1,2))
- DO APPRO(BIAGRP)
- SET X=2
- QUIT
- +175 ;---> If pt has Current season, 1 dose; Past season, 2 doses; then appropriate.
- +176 IF $DATA(BIHX(10,1,1))
- IF $DATA(BIHX(10,0,2))
- DO APPRO(BIAGRP)
- SET X=2
- QUIT
- End DoDot:1
- DO STOR(BIDFN,BIQDT,X)
- QUIT
- +177 ;
- +178 SET X=1
- +179 ;---> For all other Age Groups.
- +180 Begin DoDot:1
- +181 IF '$DATA(BIHX(10))
- QUIT
- +182 ;---> If patient has Flu, Current season 1 dose; then he's appropriate.
- +183 ;---> Also, if this is 18-49 and the patient is High Risk set in Group 5.
- +184 IF $DATA(BIHX(10,1,1))
- DO APPRO(BIAGRP)
- IF ((BIAGRP=4)&BIRISKI)
- DO APPRO(5)
- SET X=2
- QUIT
- End DoDot:1
- DO STOR(BIDFN,BIQDT,X)
- +185 QUIT
- +186 ;
- +187 ;
- +188 ;----------
- APPRO(BIAGRP) ;EP
- +1 ;---> Store Patient in Appropriate for Age Group.
- +2 ;---> Parameters:
- +3 ; 1 - BIAGRP (req) Node/number for this Age Group.
- +4 ;
- +5 ;---> Store Patient in Age Group.
- +6 NEW Z
- SET Z=$GET(BITMP("STATS","APPRO",BIAGRP))
- +7 SET BITMP("STATS","APPRO",BIAGRP)=Z+1
- +8 QUIT
- +9 ;
- +10 ;
- +11 ;----------
- STOR(BIDFN,BIQDT,BIVAL) ;EP
- +1 ;---> Store in ^TMP for displaying List of Patients.
- +2 ;---> Parameters:
- +3 ; 1 - BIDFN (req) Patient IEN.
- +4 ; 2 - BIQDT (req) Quarter Ending Date.
- +5 ; 3 - BIVAL (opt) Value to set ^TMP(Pat...) node equal to.
- +6 ;
- +7 IF '$GET(BIDFN)
- QUIT
- IF '$GET(BIQDT)
- SET BIQDT=DT
- +8 ;D UPDATE^BIPATUP(BIDFN,DT,,1)
- +9 DO STORE^BIDUR1(BIDFN,BIQDT,1,,$GET(BIVAL))
- +10 QUIT