BIEXP ;IHS/CMI/MWR - EXPORT IMMUNIZATION RECORDS.; MAY 10, 2010
;;8.5;IMMUNIZATION;**9**;OCT 01,2014
;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
;; EXPORT IMMUNIZATION RECORDS: MAIN DRIVER.
;; PATCH 9: Changes to include Default Volume and Component fields in
;; Vaccine Table export. EXPVT+14
;
;
;----------
START ;EP
;---> Export Immunization Data.
;
D SETVARS^BIUTL5 N BIRTN
;
;---> Introduction.
N BIPOP S BIPOP=0
S BITL="EXPORT IMMUNIZATION RECORDS"
D TITLE^BIUTL5(BITL),TEXT1
D DIRZ^BIUTL3(.BIPOP)
Q:BIPOP
;
;
F D Q:BIPOP
.;---> Choose to select either individually or by group.
.N A,X,Y
.D TITLE^BIUTL5(BITL),TEXT2
.S A=" Enter either 1 or 2: "
.S X="SOAB^1:Individually;2:Group"
.D DIR^BIFMAN(X,.Y,.BIPOP,A)
.Q:BIPOP
.;
.;---> Select Patients individually and export data.
.I Y=1 D ^BIEXP1 Q
.;---> Select Patients by group and export data.
.D ^BIEXP2
;
D EXIT
Q
;
;
;----------
TEXT1 ;EP
;;
;;This program will allow you to select a group of patients and to
;;export their demographic and immunization data either to a file
;;or to your screen (for capture by a PC).
;;
;;You will have the opportunity to either select individual patients
;;(by Name or Chart#), or to select a group of patients by specifying
;;Status in the Register, Visit History, Age Range, Facility, and
;;Current Community. You will also be able to limit the export data
;;to specific Vaccines.
;;
;;Lastly, you will be given the option of exporting the data in
;;either an ASCII text format or Immserve data format.
;;
D PRINTX("TEXT1")
Q
;
;
;----------
TEXT2 ;EP
;;
;;Do you wish to:
;;
;; 1) Select patients INDIVIDUALLY by entering their Names
;; or Chart Numbers,
;;or
;; 2) Select patients by GROUP, specifying Age Range, Status,
;; Current Community, etc.
;;
D PRINTX("TEXT2")
Q
;
;
;----------
PRINTX(BILINL,BITAB) ;EP
Q:$G(BILINL)=""
N I,T,X S T="" S:'$D(BITAB) BITAB=5 F I=1:1:BITAB S T=T_" "
F I=1:1 S X=$T(@BILINL+I) Q:X'[";;" W !,T,$P(X,";;",2)
Q
;
;
;----------
EXIT ;EP
;---> EOJ cleanup.
K ^TMP("BIEXP1",$J),^TMP("BIEXP2",$J)
D KILLALL^BIUTL8(1)
D CLEAR^VALM1
D FULL^VALM1
Q
;
;
;----------
EXPVT ;EP
;---> Export Vaccine Table to a CVS (Excel compatible) host file.
D SETVARS^BIUTL5
N BIFLNM,BIPATH,BIPOP
S BIFLNM="RPMS Vaccine Table.csv"
D HFS^BIEXPRT8(BIFLNM,.BIPATH,1,.BIPOP)
I $G(BIPOP) D ^%ZISC W !!?3,"Failure to open Host File." D DIRZ^BIUTL3() Q
;
;---> Host file is open.
;---> Use "," for CSV delimiter.
N Q,D S Q="""",D=Q_","_Q
;
;---> Write Header row.
W Q_"CVX Code"_D_"Name"_D_"Short Name"_D_"Vaccine Group"_D_"VIS Date"_D_"Active"
;
;********** PATCH 9, v8.5, OCT 01,2014, IHS/CMI/MWR
;---> Include Default Volume and Component fields.
W D_"Default Volume"
W D_"Related Contra CVX's"_D_"1st Brand Name"_D_"2nd Brand Name"
W D_"Component 1"_D_"Comp1 CVX"_D_"Component 2"_D_"Comp2 CVX"
W D_"Component 3"_D_"Comp3 CVX"_D_"Component 4"_D_"Comp4 CVX"
W D_"Component 5"_D_"Comp5 CVX"_D_"Component 6"_D_"Comp6 CVX"
W D_"Long Name"_Q
;
;---> Write data records.
N N S N=0
F S N=$O(^BITN(N)) Q:'N D
.N Y,Z S Y=^BITN(N,0),Z=$G(^BITN(N,1))
.W !,Q_$P(Y,U,3)_D_$P(Y,U,1)_D_$P(Y,U,2)_D_$$VGROUP^BIUTL2($P(Y,U,9))
.W D_$$SLDT1^BIUTL5($P(Y,U,13))_D_$S($P(Y,U,7)=1:"Inactive",1:"Active")
.;
.;********** PATCH 9, v8.5, OCT 01,2014, IHS/CMI/MWR
.;---> Include Default Volume and Component Fields.
.W D_$P(Y,U,18)
.W D_$P(Y,U,12)_D_$P(Z,U,1)_D_$P(Z,U,3)
.N I F I=21:1:26 D
..I '$P(Y,U,I) W D_D Q
..W D_$$VNAME^BIUTL2($P(Y,U,I))_D_$$CODE^BIUTL2($P(Y,U,I))
.;**********
.W D_$P(Z,U,14)_Q
;
;---> Close the host file and report its location.
D ^%ZISC
D TITLE^BIUTL5("EXPORT VACCINE TABLE TO EXCEL FILE")
W !!?5,"The Vaccine Table has been exported to:"
W !!?10,BIPATH_BIFLNM
D TEXT3
D DIRZ^BIUTL3()
Q
;
;
;----------
TEXT3 ;EP
;;
;;
;;
;;Note that the path ("folder" or "directory") in which the file
;;was placed is taken from the Immunization Site Parameter #6.
;;You can change that to a different location by editing the site
;;parameter (IMM-->MGR-->ESP-->6).
;;
;
D PRINTX("TEXT3")
Q
BIEXP ;IHS/CMI/MWR - EXPORT IMMUNIZATION RECORDS.; MAY 10, 2010
+1 ;;8.5;IMMUNIZATION;**9**;OCT 01,2014
+2 ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
+3 ;; EXPORT IMMUNIZATION RECORDS: MAIN DRIVER.
+4 ;; PATCH 9: Changes to include Default Volume and Component fields in
+5 ;; Vaccine Table export. EXPVT+14
+6 ;
+7 ;
+8 ;----------
START ;EP
+1 ;---> Export Immunization Data.
+2 ;
+3 DO SETVARS^BIUTL5
NEW BIRTN
+4 ;
+5 ;---> Introduction.
+6 NEW BIPOP
SET BIPOP=0
+7 SET BITL="EXPORT IMMUNIZATION RECORDS"
+8 DO TITLE^BIUTL5(BITL)
DO TEXT1
+9 DO DIRZ^BIUTL3(.BIPOP)
+10 IF BIPOP
QUIT
+11 ;
+12 ;
+13 FOR
Begin DoDot:1
+14 ;---> Choose to select either individually or by group.
+15 NEW A,X,Y
+16 DO TITLE^BIUTL5(BITL)
DO TEXT2
+17 SET A=" Enter either 1 or 2: "
+18 SET X="SOAB^1:Individually;2:Group"
+19 DO DIR^BIFMAN(X,.Y,.BIPOP,A)
+20 IF BIPOP
QUIT
+21 ;
+22 ;---> Select Patients individually and export data.
+23 IF Y=1
DO ^BIEXP1
QUIT
+24 ;---> Select Patients by group and export data.
+25 DO ^BIEXP2
End DoDot:1
IF BIPOP
QUIT
+26 ;
+27 DO EXIT
+28 QUIT
+29 ;
+30 ;
+31 ;----------
TEXT1 ;EP
+1 ;;
+2 ;;This program will allow you to select a group of patients and to
+3 ;;export their demographic and immunization data either to a file
+4 ;;or to your screen (for capture by a PC).
+5 ;;
+6 ;;You will have the opportunity to either select individual patients
+7 ;;(by Name or Chart#), or to select a group of patients by specifying
+8 ;;Status in the Register, Visit History, Age Range, Facility, and
+9 ;;Current Community. You will also be able to limit the export data
+10 ;;to specific Vaccines.
+11 ;;
+12 ;;Lastly, you will be given the option of exporting the data in
+13 ;;either an ASCII text format or Immserve data format.
+14 ;;
+15 DO PRINTX("TEXT1")
+16 QUIT
+17 ;
+18 ;
+19 ;----------
TEXT2 ;EP
+1 ;;
+2 ;;Do you wish to:
+3 ;;
+4 ;; 1) Select patients INDIVIDUALLY by entering their Names
+5 ;; or Chart Numbers,
+6 ;;or
+7 ;; 2) Select patients by GROUP, specifying Age Range, Status,
+8 ;; Current Community, etc.
+9 ;;
+10 DO PRINTX("TEXT2")
+11 QUIT
+12 ;
+13 ;
+14 ;----------
PRINTX(BILINL,BITAB) ;EP
+1 IF $GET(BILINL)=""
QUIT
+2 NEW I,T,X
SET T=""
IF '$DATA(BITAB)
SET BITAB=5
FOR I=1:1:BITAB
SET T=T_" "
+3 FOR I=1:1
SET X=$TEXT(@BILINL+I)
IF X'[";;"
QUIT
WRITE !,T,$PIECE(X,";;",2)
+4 QUIT
+5 ;
+6 ;
+7 ;----------
EXIT ;EP
+1 ;---> EOJ cleanup.
+2 KILL ^TMP("BIEXP1",$JOB),^TMP("BIEXP2",$JOB)
+3 DO KILLALL^BIUTL8(1)
+4 DO CLEAR^VALM1
+5 DO FULL^VALM1
+6 QUIT
+7 ;
+8 ;
+9 ;----------
EXPVT ;EP
+1 ;---> Export Vaccine Table to a CVS (Excel compatible) host file.
+2 DO SETVARS^BIUTL5
+3 NEW BIFLNM,BIPATH,BIPOP
+4 SET BIFLNM="RPMS Vaccine Table.csv"
+5 DO HFS^BIEXPRT8(BIFLNM,.BIPATH,1,.BIPOP)
+6 IF $GET(BIPOP)
DO ^%ZISC
WRITE !!?3,"Failure to open Host File."
DO DIRZ^BIUTL3()
QUIT
+7 ;
+8 ;---> Host file is open.
+9 ;---> Use "," for CSV delimiter.
+10 NEW Q,D
SET Q=""""
SET D=Q_","_Q
+11 ;
+12 ;---> Write Header row.
+13 WRITE Q_"CVX Code"_D_"Name"_D_"Short Name"_D_"Vaccine Group"_D_"VIS Date"_D_"Active"
+14 ;
+15 ;********** PATCH 9, v8.5, OCT 01,2014, IHS/CMI/MWR
+16 ;---> Include Default Volume and Component fields.
+17 WRITE D_"Default Volume"
+18 WRITE D_"Related Contra CVX's"_D_"1st Brand Name"_D_"2nd Brand Name"
+19 WRITE D_"Component 1"_D_"Comp1 CVX"_D_"Component 2"_D_"Comp2 CVX"
+20 WRITE D_"Component 3"_D_"Comp3 CVX"_D_"Component 4"_D_"Comp4 CVX"
+21 WRITE D_"Component 5"_D_"Comp5 CVX"_D_"Component 6"_D_"Comp6 CVX"
+22 WRITE D_"Long Name"_Q
+23 ;
+24 ;---> Write data records.
+25 NEW N
SET N=0
+26 FOR
SET N=$ORDER(^BITN(N))
IF 'N
QUIT
Begin DoDot:1
+27 NEW Y,Z
SET Y=^BITN(N,0)
SET Z=$GET(^BITN(N,1))
+28 WRITE !,Q_$PIECE(Y,U,3)_D_$PIECE(Y,U,1)_D_$PIECE(Y,U,2)_D_$$VGROUP^BIUTL2($PIECE(Y,U,9))
+29 WRITE D_$$SLDT1^BIUTL5($PIECE(Y,U,13))_D_$SELECT($PIECE(Y,U,7)=1:"Inactive",1:"Active")
+30 ;
+31 ;********** PATCH 9, v8.5, OCT 01,2014, IHS/CMI/MWR
+32 ;---> Include Default Volume and Component Fields.
+33 WRITE D_$PIECE(Y,U,18)
+34 WRITE D_$PIECE(Y,U,12)_D_$PIECE(Z,U,1)_D_$PIECE(Z,U,3)
+35 NEW I
FOR I=21:1:26
Begin DoDot:2
+36 IF '$PIECE(Y,U,I)
WRITE D_D
QUIT
+37 WRITE D_$$VNAME^BIUTL2($PIECE(Y,U,I))_D_$$CODE^BIUTL2($PIECE(Y,U,I))
End DoDot:2
+38 ;**********
+39 WRITE D_$PIECE(Z,U,14)_Q
End DoDot:1
+40 ;
+41 ;---> Close the host file and report its location.
+42 DO ^%ZISC
+43 DO TITLE^BIUTL5("EXPORT VACCINE TABLE TO EXCEL FILE")
+44 WRITE !!?5,"The Vaccine Table has been exported to:"
+45 WRITE !!?10,BIPATH_BIFLNM
+46 DO TEXT3
+47 DO DIRZ^BIUTL3()
+48 QUIT
+49 ;
+50 ;
+51 ;----------
TEXT3 ;EP
+1 ;;
+2 ;;
+3 ;;
+4 ;;Note that the path ("folder" or "directory") in which the file
+5 ;;was placed is taken from the Immunization Site Parameter #6.
+6 ;;You can change that to a different location by editing the site
+7 ;;parameter (IMM-->MGR-->ESP-->6).
+8 ;;
+9 ;
+10 DO PRINTX("TEXT3")
+11 QUIT