BIREPF2 ;IHS/CMI/MWR - REPORT, FLU IMM; AUG 10,2010
;;8.5;IMMUNIZATION;**5**;JUL 01,2013
;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
;; VIEW INFLUENZA IMMUNIZATION REPORT, GATHER DATA.
;; PATCH 1: Add "Dose#" header to Doses column. HEAD+86
;; PATCH 5: Display new beginning date as July 1. HEAD+38
;
;
;----------
HEAD(BIYEAR,BICC,BIHCF,BICM,BIBEN,BIFH,BIUP) ;EP
;---> Produce Header array for Quarterly Immunization Report.
;---> Parameters:
; 1 - BIYEAR (req) Report Year.
; 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 - BIFH (opt) F=report on Flu Vaccine Group (default), H=H1N1 group.
; 7 - BIUP (req) User Population/Group (Registered, Imm, User, Active).
;
;---> Check for required Variables.
Q:'$G(BIYEAR)
Q:'$D(BICC)
Q:'$D(BIHCF)
Q:'$D(BICM)
Q:'$D(BIBEN)
S:($G(BIFH)="") BIFH="F"
Q:'$D(BIUP)
;
K VALMHDR
N BILINE,X S BILINE=0
;
N X S X=""
;---> If Header array is NOT being for Listmananger include version. vvv83
S:'$D(VALM("BM")) X=$$LMVER^BILOGO()
;
D WH^BIW(.BILINE,X)
S X=$$REPHDR^BIUTL6(DUZ(2)) D CENTERT^BIUTL5(.X)
D WH^BIW(.BILINE,X)
;
S X="* "_$S($G(BIFH)="H":"H1N1",1:"Standard Flu")_" Immunization Report *"
D CENTERT^BIUTL5(.X)
D WH^BIW(.BILINE,X)
;
S X=$$SP^BIUTL5(27)_"Report Date: "_$$SLDT1^BIUTL5(DT)
D WH^BIW(.BILINE,X)
;
;********** PATCH 5, v8.5, JUL 01,2013, IHS/CMI/MWR
;---> Display new beginning date as July 1.
;N BIBEG,BIEND S BIBEG="09/15/"_$P(BIYEAR,U)
N BIBEG,BIEND S BIBEG="07/01/"_$P(BIYEAR,U)
;**********
D
.I $P(BIYEAR,U,2)="m" S BIEND="03/31/"_($P(BIYEAR,U)+1) Q
.S BIEND="12/31/"_$P(BIYEAR,U)
S X=$$SP^BIUTL5(28)_"Date Range: "_BIBEG_" - "_BIEND
D WH^BIW(.BILINE,X,1)
;
S X=" "_$$BIUPTX^BIUTL6(BIUP),X=$$PAD^BIUTL5(X,48)
D WH^BIW(.BILINE,X)
;
D WH^BIW(.BILINE,$$SP^BIUTL5(79,"-"))
;
D
.;---> If specific Communities were selected (not ALL), then print
.;---> the Communities in a subheader at the top of the report.
.D SUBH^BIOUTPT5("BICC","Community",,"^AUTTCOM(",.BILINE,.BIERR,,12)
.I $G(BIERR) D ERRCD^BIUTL2(BIERR,.X) D WH^BIW(.BILINE,X) Q
.;
.;---> If specific Health Care Facilities, print subheader.
.D SUBH^BIOUTPT5("BIHCF","Facility",,"^DIC(4,",.BILINE,.BIERR,,12)
.I $G(BIERR) D ERRCD^BIUTL2(BIERR,.X) D WH^BIW(.BILINE,X) Q
.;
.;---> If specific Case Managers, print Case Manager subheader.
.D SUBH^BIOUTPT5("BICM","Case Manager",,"^VA(200,",.BILINE,.BIERR,,12)
.I $G(BIERR) D ERRCD^BIUTL2(BIERR,.X) D WH^BIW(.BILINE,X) Q
.;
.;---> If specific Beneficiary Types, print Beneficiary Type subheader.
.D SUBH^BIOUTPT5("BIBEN","Beneficiary Type",,"^AUTTBEN(",.BILINE,.BIERR,,12)
.I $G(BIERR) D ERRCD^BIUTL2(BIERR,.X) D WH^BIW(.BILINE,X) Q
.;
.S X=$$SP^BIUTL5(13)_"|"_$$SP^BIUTL5(4)_" Age in months/years on "
.S X=X_$$SLDT2^BIUTL5((BIYEAR-1700)_1231)_$$SP^BIUTL5(12)_"|"
.D WH^BIW(.BILINE,X)
.;
.;********** PATCH 1, v8.4, AUG 01,2010, IHS/CMI/MWR
.;---> Add "Dose#" header to Doses column.
.;S X=$$SP^BIUTL5(13)_"|"_$$SP^BIUTL5(55,"-")_"| Totals"
.S X=" Dose# |"_$$SP^BIUTL5(55,"-")_"| Totals"
.;**********
.;
.D WH^BIW(.BILINE,X)
.S X=" | 10-23m 2-4y 5-17y 18-49y *18-49hr 50-64y 65+yrs"
.S X=$$PAD^BIUTL5(X,69)_"|"
.D WH^BIW(.BILINE,X)
;
;---> If Header array is being built for Listmananger,
;---> reset display window margins for Communities, etc.
D:$D(VALM("BM"))
.S VALM("TM")=BILINE+3
.S VALM("LINES")=VALM("BM")-VALM("TM")+1
.;---> Safeguard to prevent divide/0 error.
.S:VALM("LINES")<1 VALM("LINES")=1
Q
;
;
;----------
START(BIYEAR,BICC,BIHCF,BICM,BIBEN,BIFH,BIUP) ;EP
;---> Produce array for Quarterly Immunization Report.
;---> Parameters:
; 1 - 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)
; 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 - BIFH (opt) F=report on Flu Vaccine Group (default), H=H1N1 group.
; 7 - BIUP (req) User Population/Group (Registered, Imm, User, Active).
;
K ^TMP("BIREPF1",$J)
N BILINE,BITMP,X S BILINE=0,BIPOP=0
;
;---> Check for required Variables.
;
I '$G(BIYEAR) D ERRCD^BIUTL2(679,.X) D WRITERR(BILINE,X) Q
I '$D(BICC) D ERRCD^BIUTL2(614,.X) D WRITERR(BILINE,X) Q
I '$D(BIHCF) D ERRCD^BIUTL2(625,.X) D WRITERR(BILINE,X) Q
I '$D(BICM) D ERRCD^BIUTL2(615,.X) D WRITERR(BILINE,X) Q
I '$D(BIBEN) D ERRCD^BIUTL2(662,.X) D WRITERR(BILINE,X) Q
S:($G(BIFH)="") BIFH="F"
S:$G(BIUP)="" BIUP="u"
;
;---> Write Age Totals line.
D AGETOT^BIREPF3(.BILINE,.BICC,.BIHCF,.BICM,.BIBEN,BIYEAR,.BIPOP,BIFH,BIUP)
Q:BIPOP
;
;---> Write Approp for Age and Vaccine Group lines.
;D APPROP^BIREPF3(.BILINE)
;
;---> Write Statistics lines for each Vaccine Group (BIVGRP).
;F BIVGRP=1,2,6,3,4,7,9,11,15 D VGRP^BIREPF3(.BILINE,BIVGRP)
;---> If report is for H1N1, then display vaccine group 18; otherwise Flu (10).
S BIVGRP=$S(BIFH="H":18,1:10)
D VGRP^BIREPF3(.BILINE,BIVGRP,BIYEAR)
;
;---> For Flu Report (not H1N1) write Approp for Age and Vaccine Group lines.
D:BIVGRP=10 APPROP^BIREPF3(.BILINE)
;
;---> Now write total patients considered who had refusals.
N M,N S (M,N)=0 F S M=$O(BITMP("REFUSALS",M)) Q:'M S N=N+1
S X=" Total Patients included who had Influenza Refusals on record"_$J(N,15)
D WRITE^BIREPF3(.BILINE,X),WRITE^BIREPF3(.BILINE,$$SP^BIUTL5(79,"-"))
;
S X=" *NOTE: The 18-49hr column tallies patients who are High Risk in that"
D WRITE^BIREPF3(.BILINE,X)
S X=" Age Group. They are not included in the normal 18-49y column."
D WRITE^BIREPF3(.BILINE,X),WRITE^BIREPF3(.BILINE,$$SP^BIUTL5(79,"-"))
;
S VALMCNT=BILINE
Q
;
;
;----------
WRITERR(BILINE,X) ;EP
;---> Write error line to report.
;---> Parameters:
; 1 - BILINE (ret) Last line# written.
; 2 - BIVAL (req) Error text.
;
S:'$D(X) X="No error text."
S:'$D(BILINE) BILINE=1
D WRITE^BIREPF3(.BILINE,X) S VALMCNT=BILINE
Q
BIREPF2 ;IHS/CMI/MWR - REPORT, FLU IMM; AUG 10,2010
+1 ;;8.5;IMMUNIZATION;**5**;JUL 01,2013
+2 ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
+3 ;; VIEW INFLUENZA IMMUNIZATION REPORT, GATHER DATA.
+4 ;; PATCH 1: Add "Dose#" header to Doses column. HEAD+86
+5 ;; PATCH 5: Display new beginning date as July 1. HEAD+38
+6 ;
+7 ;
+8 ;----------
HEAD(BIYEAR,BICC,BIHCF,BICM,BIBEN,BIFH,BIUP) ;EP
+1 ;---> Produce Header array for Quarterly Immunization Report.
+2 ;---> Parameters:
+3 ; 1 - BIYEAR (req) Report Year.
+4 ; 2 - BICC (req) Current Community array.
+5 ; 3 - BIHCF (req) Health Care Facility array.
+6 ; 4 - BICM (req) Case Manager array.
+7 ; 5 - BIBEN (req) Beneficiary Type array.
+8 ; 6 - BIFH (opt) F=report on Flu Vaccine Group (default), H=H1N1 group.
+9 ; 7 - BIUP (req) User Population/Group (Registered, Imm, User, Active).
+10 ;
+11 ;---> Check for required Variables.
+12 IF '$GET(BIYEAR)
QUIT
+13 IF '$DATA(BICC)
QUIT
+14 IF '$DATA(BIHCF)
QUIT
+15 IF '$DATA(BICM)
QUIT
+16 IF '$DATA(BIBEN)
QUIT
+17 IF ($GET(BIFH)="")
SET BIFH="F"
+18 IF '$DATA(BIUP)
QUIT
+19 ;
+20 KILL VALMHDR
+21 NEW BILINE,X
SET BILINE=0
+22 ;
+23 NEW X
SET X=""
+24 ;---> If Header array is NOT being for Listmananger include version. vvv83
+25 IF '$DATA(VALM("BM"))
SET X=$$LMVER^BILOGO()
+26 ;
+27 DO WH^BIW(.BILINE,X)
+28 SET X=$$REPHDR^BIUTL6(DUZ(2))
DO CENTERT^BIUTL5(.X)
+29 DO WH^BIW(.BILINE,X)
+30 ;
+31 SET X="* "_$SELECT($GET(BIFH)="H":"H1N1",1:"Standard Flu")_" Immunization Report *"
+32 DO CENTERT^BIUTL5(.X)
+33 DO WH^BIW(.BILINE,X)
+34 ;
+35 SET X=$$SP^BIUTL5(27)_"Report Date: "_$$SLDT1^BIUTL5(DT)
+36 DO WH^BIW(.BILINE,X)
+37 ;
+38 ;********** PATCH 5, v8.5, JUL 01,2013, IHS/CMI/MWR
+39 ;---> Display new beginning date as July 1.
+40 ;N BIBEG,BIEND S BIBEG="09/15/"_$P(BIYEAR,U)
+41 NEW BIBEG,BIEND
SET BIBEG="07/01/"_$PIECE(BIYEAR,U)
+42 ;**********
+43 Begin DoDot:1
+44 IF $PIECE(BIYEAR,U,2)="m"
SET BIEND="03/31/"_($PIECE(BIYEAR,U)+1)
QUIT
+45 SET BIEND="12/31/"_$PIECE(BIYEAR,U)
End DoDot:1
+46 SET X=$$SP^BIUTL5(28)_"Date Range: "_BIBEG_" - "_BIEND
+47 DO WH^BIW(.BILINE,X,1)
+48 ;
+49 SET X=" "_$$BIUPTX^BIUTL6(BIUP)
SET X=$$PAD^BIUTL5(X,48)
+50 DO WH^BIW(.BILINE,X)
+51 ;
+52 DO WH^BIW(.BILINE,$$SP^BIUTL5(79,"-"))
+53 ;
+54 Begin DoDot:1
+55 ;---> If specific Communities were selected (not ALL), then print
+56 ;---> the Communities in a subheader at the top of the report.
+57 DO SUBH^BIOUTPT5("BICC","Community",,"^AUTTCOM(",.BILINE,.BIERR,,12)
+58 IF $GET(BIERR)
DO ERRCD^BIUTL2(BIERR,.X)
DO WH^BIW(.BILINE,X)
QUIT
+59 ;
+60 ;---> If specific Health Care Facilities, print subheader.
+61 DO SUBH^BIOUTPT5("BIHCF","Facility",,"^DIC(4,",.BILINE,.BIERR,,12)
+62 IF $GET(BIERR)
DO ERRCD^BIUTL2(BIERR,.X)
DO WH^BIW(.BILINE,X)
QUIT
+63 ;
+64 ;---> If specific Case Managers, print Case Manager subheader.
+65 DO SUBH^BIOUTPT5("BICM","Case Manager",,"^VA(200,",.BILINE,.BIERR,,12)
+66 IF $GET(BIERR)
DO ERRCD^BIUTL2(BIERR,.X)
DO WH^BIW(.BILINE,X)
QUIT
+67 ;
+68 ;---> If specific Beneficiary Types, print Beneficiary Type subheader.
+69 DO SUBH^BIOUTPT5("BIBEN","Beneficiary Type",,"^AUTTBEN(",.BILINE,.BIERR,,12)
+70 IF $GET(BIERR)
DO ERRCD^BIUTL2(BIERR,.X)
DO WH^BIW(.BILINE,X)
QUIT
+71 ;
+72 SET X=$$SP^BIUTL5(13)_"|"_$$SP^BIUTL5(4)_" Age in months/years on "
+73 SET X=X_$$SLDT2^BIUTL5((BIYEAR-1700)_1231)_$$SP^BIUTL5(12)_"|"
+74 DO WH^BIW(.BILINE,X)
+75 ;
+76 ;********** PATCH 1, v8.4, AUG 01,2010, IHS/CMI/MWR
+77 ;---> Add "Dose#" header to Doses column.
+78 ;S X=$$SP^BIUTL5(13)_"|"_$$SP^BIUTL5(55,"-")_"| Totals"
+79 SET X=" Dose# |"_$$SP^BIUTL5(55,"-")_"| Totals"
+80 ;**********
+81 ;
+82 DO WH^BIW(.BILINE,X)
+83 SET X=" | 10-23m 2-4y 5-17y 18-49y *18-49hr 50-64y 65+yrs"
+84 SET X=$$PAD^BIUTL5(X,69)_"|"
+85 DO WH^BIW(.BILINE,X)
End DoDot:1
+86 ;
+87 ;---> If Header array is being built for Listmananger,
+88 ;---> reset display window margins for Communities, etc.
+89 IF $DATA(VALM("BM"))
Begin DoDot:1
+90 SET VALM("TM")=BILINE+3
+91 SET VALM("LINES")=VALM("BM")-VALM("TM")+1
+92 ;---> Safeguard to prevent divide/0 error.
+93 IF VALM("LINES")<1
SET VALM("LINES")=1
End DoDot:1
+94 QUIT
+95 ;
+96 ;
+97 ;----------
START(BIYEAR,BICC,BIHCF,BICM,BIBEN,BIFH,BIUP) ;EP
+1 ;---> Produce array for Quarterly Immunization Report.
+2 ;---> Parameters:
+3 ; 1 - BIYEAR (req) Report Year^m (if 2nd pc="m", then End Date=March 31 of
+4 ; the report year; otherwise End Date=Dec 31 of BIYEAR)
+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 - BIFH (opt) F=report on Flu Vaccine Group (default), H=H1N1 group.
+10 ; 7 - BIUP (req) User Population/Group (Registered, Imm, User, Active).
+11 ;
+12 KILL ^TMP("BIREPF1",$JOB)
+13 NEW BILINE,BITMP,X
SET BILINE=0
SET BIPOP=0
+14 ;
+15 ;---> Check for required Variables.
+16 ;
+17 IF '$GET(BIYEAR)
DO ERRCD^BIUTL2(679,.X)
DO WRITERR(BILINE,X)
QUIT
+18 IF '$DATA(BICC)
DO ERRCD^BIUTL2(614,.X)
DO WRITERR(BILINE,X)
QUIT
+19 IF '$DATA(BIHCF)
DO ERRCD^BIUTL2(625,.X)
DO WRITERR(BILINE,X)
QUIT
+20 IF '$DATA(BICM)
DO ERRCD^BIUTL2(615,.X)
DO WRITERR(BILINE,X)
QUIT
+21 IF '$DATA(BIBEN)
DO ERRCD^BIUTL2(662,.X)
DO WRITERR(BILINE,X)
QUIT
+22 IF ($GET(BIFH)="")
SET BIFH="F"
+23 IF $GET(BIUP)=""
SET BIUP="u"
+24 ;
+25 ;---> Write Age Totals line.
+26 DO AGETOT^BIREPF3(.BILINE,.BICC,.BIHCF,.BICM,.BIBEN,BIYEAR,.BIPOP,BIFH,BIUP)
+27 IF BIPOP
QUIT
+28 ;
+29 ;---> Write Approp for Age and Vaccine Group lines.
+30 ;D APPROP^BIREPF3(.BILINE)
+31 ;
+32 ;---> Write Statistics lines for each Vaccine Group (BIVGRP).
+33 ;F BIVGRP=1,2,6,3,4,7,9,11,15 D VGRP^BIREPF3(.BILINE,BIVGRP)
+34 ;---> If report is for H1N1, then display vaccine group 18; otherwise Flu (10).
+35 SET BIVGRP=$SELECT(BIFH="H":18,1:10)
+36 DO VGRP^BIREPF3(.BILINE,BIVGRP,BIYEAR)
+37 ;
+38 ;---> For Flu Report (not H1N1) write Approp for Age and Vaccine Group lines.
+39 IF BIVGRP=10
DO APPROP^BIREPF3(.BILINE)
+40 ;
+41 ;---> Now write total patients considered who had refusals.
+42 NEW M,N
SET (M,N)=0
FOR
SET M=$ORDER(BITMP("REFUSALS",M))
IF 'M
QUIT
SET N=N+1
+43 SET X=" Total Patients included who had Influenza Refusals on record"_$JUSTIFY(N,15)
+44 DO WRITE^BIREPF3(.BILINE,X)
DO WRITE^BIREPF3(.BILINE,$$SP^BIUTL5(79,"-"))
+45 ;
+46 SET X=" *NOTE: The 18-49hr column tallies patients who are High Risk in that"
+47 DO WRITE^BIREPF3(.BILINE,X)
+48 SET X=" Age Group. They are not included in the normal 18-49y column."
+49 DO WRITE^BIREPF3(.BILINE,X)
DO WRITE^BIREPF3(.BILINE,$$SP^BIUTL5(79,"-"))
+50 ;
+51 SET VALMCNT=BILINE
+52 QUIT
+53 ;
+54 ;
+55 ;----------
WRITERR(BILINE,X) ;EP
+1 ;---> Write error line to report.
+2 ;---> Parameters:
+3 ; 1 - BILINE (ret) Last line# written.
+4 ; 2 - BIVAL (req) Error text.
+5 ;
+6 IF '$DATA(X)
SET X="No error text."
+7 IF '$DATA(BILINE)
SET BILINE=1
+8 DO WRITE^BIREPF3(.BILINE,X)
SET VALMCNT=BILINE
+9 QUIT