BIEXP2 ;IHS/CMI/MWR - EXPORT IMMUNIZATION RECORDS.; MAY 10, 2010
;;8.5;IMMUNIZATION;;SEP 01,2011
;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
;; EXPORT IMMUNIZATION RECORDS: SELECT PATIENTS BY GROUP.
;
;
;----------
START ;EP
;---> Listman Screen for selecting Export Parameters, by Group.
;
D SETVARS^BIUTL5
;---> Main entry point for Export by Individual Patients.
D EN^VALM("BI EXPORT BY GROUP")
D EXIT
Q
;
;
;----------
INIT ;EP
;---> Initialize variables and list array.
;
S VALM("TITLE")=$$LMVER^BILOGO
S VALMSG="Select a left column number to change an item."
N BILINE,X S BILINE=0
D WRITE(.BILINE)
S X=IOUON_"EXPORT DATA BY GROUP" D CENTERT^BIUTL5(.X,42)
D WRITE(.BILINE,X_IOINORM,1)
K X
;
;---> Survey Date.
S:'$G(BISVDT) BISVDT=DT
S X=" 1 - Survey Date..............: "_$$TXDT1^BIUTL5(BISVDT)
D WRITE(.BILINE,X,1)
K X
;
;---> Age Range.
S:$G(BIAG)="" BIAG="1-72"
N BIAG1
D
.I BIAG="ALL" S BIAG1="All Ages" Q
.S BIAG1=$$MTHYR^BIAGE(BIAG)
S X=" 2 - Age Range................: "_BIAG1
D WRITE(.BILINE,X,1)
K X
;
;
;---> Patient Group.
S:('$G(BIPG)!($G(BIPG)=9)) BIPG=1 N X
D
.I BIPG=1 S X="ACTIVE in the Register." Q
.I BIPG=2 S X="BOTH Active and Inactive." Q
.I BIPG=3 S X="ALL who have had an Immunization." Q
.I BIPG=4 S X="ALL who have had a Visit of any kind." Q
.I BIPG=5 S X="ALL Patients (including those w/o a Visit)." Q
.S X="Make a selection." Q
S X=" 3 - Patient Group............: "_X
D WRITE(.BILINE,X,1)
K X
;
;---> Health Care Facility.
N BIHCF1 S BIHCF1=""
D
.S:'$D(BIHCF) BIHCF("ALL")=""
.I $D(BIHCF("ALL")) S BIHCF1="ALL" Q
.N I,M,N
.S N=0
.F I=0:1 S N=$O(BIHCF(N)) Q:'N S M=N
.I I=1 S BIHCF1=$$INSTTX^BIUTL6(M) Q
.S BIHCF1="List (Select ""4"" to review list.)"
S X=" 4 - Health Care Facility.....: "_BIHCF1
D WRITE(.BILINE,X)
K X
;
;---> Current Community.
N BICC1 S BICC1=""
D
.S:'$D(BICC) BICC("ALL")=""
.I $D(BICC("ALL")) S BICC1="ALL" Q
.N I,M,N
.S N=0
.F I=0:1 S N=$O(BICC(N)) Q:'N S M=N
.I I=1 S BICC1=$$CCTX^BIUTL6(M) Q
.S BICC1="List (Select ""5"" to review list.)"
S X=" 5 - Community................: "_BICC1
D WRITE(.BILINE,X)
K X
;
;---> Immunizations Received.
N BIMMR1 S BIMMR1=""
D
.S:'$D(BIMMR) BIMMR("ALL")=""
.I $D(BIMMR("ALL")) S BIMMR1="ALL" Q
.N I,M,N
.S N=0
.F I=0:1 S N=$O(BIMMR(N)) Q:'N S M=N
.I I=1 S BIMMR1=$$VNAME^BIUTL2(M) Q
.S BIMMR1="List (Select ""6"" to review list.)"
S X=" 6 - Immunizations Received...: "_BIMMR1
D WRITE(.BILINE,X,1)
K X
;
;---> Data Elements.
N BIDE1 S BIDE1=""
D
.I '$D(BIDE) S BIDE1="None" Q
.I $D(BIDE("ALL")) S BIDE1="ALL" Q
.N I,M,N
.S N=0
.F I=0:1 S N=$O(BIDE(N)) Q:'N S M=N
.I I=1 S BIDE1=$$DETX^BIUTL6(M) Q
.S BIDE1="List (Select ""7"" to review list.)"
S X=" 7 - Data Elements............: "_BIDE1
D WRITE(.BILINE,X,1)
K X
;
;---> File Format (1=ASCII,2=HL7,3=ImmServe).
S:'$G(BIFMT) BIFMT=1
N BIFMT1
S BIFMT1=$S(BIFMT=2:"HL7",BIFMT=3:"ImmServe",1:"ASCII")
S X=" 8 - File Format..............: "_BIFMT1
D WRITE(.BILINE,X,1)
K X
;
;---> Output.
D
.I '$G(BIOUT) S BIOUT=0,BIFLNM="" Q
.I $G(BIFLNM)="" S BIOUT=0
N BIOUT1
S BIOUT1=$S(BIOUT:"File: "_$G(BIPATH)_BIFLNM,1:"SCREEN")
S X=" 9 - Output Device............: "_BIOUT1
D WRITE(.BILINE,X)
K X
;
;---> Finish up Listmanager List Count.
S VALMCNT=BILINE
S BIRTN="BIEXP2"
Q
;
;
;----------
WRITE(BILINE,BIVAL,BIBLNK) ;EP
;---> Write lines to ^TMP (see documentation in ^BIW).
;---> Parameters:
; 1 - BILINE (ret) Last line# written.
; 2 - BIVAL (opt) Value/text of line (Null=blank line).
; 3 - BIBLNK (opt) Number of blank lines to add after line sent.
;
Q:'$D(BILINE)
D WL^BIW(.BILINE,"BIEXP2",$G(BIVAL),$G(BIBLNK))
Q
;
;
;----------
RESET ;EP
;---> Update partition for return to Listmanager.
I $D(VALMQUIT) S VALMBCK="Q" Q
D TERM^VALM0 S VALMBCK="R"
D INIT Q
;
;
;----------
HELP ;EP
;---> Help code.
D FULL^VALM1 N BIPOP
D TITLE^BIUTL5("EXPORT DATA BY GROUP - HELP, page 1 of 2")
D TEXT1,DIRZ^BIUTL3(.BIPOP)
I $G(BIPOP) D RESET Q
D TITLE^BIUTL5("EXPORT DATA BY GROUP - HELP, page 2 of 2")
D TEXT2,DIRZ^BIUTL3()
D RESET
Q
;
;
;----------
TEXT1 ;
;;The EXPORT DATA BY GROUP screen provides a menu of options for
;;exporting the data of groups of patients.
;;
;;There are 8 items or "parameters" on the screen that you may
;;change in order to specify which patients and which data will be
;;exported, as well as the output device for the export.
;;
;;To change an item, enter its left column number (1-8) at the
;;prompt on the bottom of the screen. Use "?" at any prompt where
;;you would like help or more information on the parameter you are
;;changing.
;;
;;Once you have the parameters set to retrieve the patients and data
;;you want, select E to Export the data.
;;
D PRINTX("TEXT1")
Q
;
;
;----------
TEXT2 ;EP
;;COMMUNITIES: If you select for specific Communities, only patients
;;whose Current Community (under Patient Registration) is one of the
;;selected Communities will be included in the export.
;;
;;HEALTH CARE FACILITIES: If you select for specific Health Care
;;Facilities, only patients who have had AT LEAST ONE immunization
;;at one of the selected Health Care Facilities will be included in
;;the export.
;;
;;VACCINES: If you select for specific Vaccines, only immunizations
;;given with the selected vaccines will be included in the export.
;;
;;DATE ELEMENTS: Select the group of Data Elements you wish to export
;;for each immunization.
;;
;;SURVEY DATE, PATIENT GROUP, FILE FORMAT and OUTPUT DEVICE:
;;Detailed help will be given when you select these items.
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("BIEXP2",$J)
D CLEAR^VALM1
D FULL^VALM1
Q
BIEXP2 ;IHS/CMI/MWR - EXPORT IMMUNIZATION RECORDS.; MAY 10, 2010
+1 ;;8.5;IMMUNIZATION;;SEP 01,2011
+2 ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
+3 ;; EXPORT IMMUNIZATION RECORDS: SELECT PATIENTS BY GROUP.
+4 ;
+5 ;
+6 ;----------
START ;EP
+1 ;---> Listman Screen for selecting Export Parameters, by Group.
+2 ;
+3 DO SETVARS^BIUTL5
+4 ;---> Main entry point for Export by Individual Patients.
+5 DO EN^VALM("BI EXPORT BY GROUP")
+6 DO EXIT
+7 QUIT
+8 ;
+9 ;
+10 ;----------
INIT ;EP
+1 ;---> Initialize variables and list array.
+2 ;
+3 SET VALM("TITLE")=$$LMVER^BILOGO
+4 SET VALMSG="Select a left column number to change an item."
+5 NEW BILINE,X
SET BILINE=0
+6 DO WRITE(.BILINE)
+7 SET X=IOUON_"EXPORT DATA BY GROUP"
DO CENTERT^BIUTL5(.X,42)
+8 DO WRITE(.BILINE,X_IOINORM,1)
+9 KILL X
+10 ;
+11 ;---> Survey Date.
+12 IF '$GET(BISVDT)
SET BISVDT=DT
+13 SET X=" 1 - Survey Date..............: "_$$TXDT1^BIUTL5(BISVDT)
+14 DO WRITE(.BILINE,X,1)
+15 KILL X
+16 ;
+17 ;---> Age Range.
+18 IF $GET(BIAG)=""
SET BIAG="1-72"
+19 NEW BIAG1
+20 Begin DoDot:1
+21 IF BIAG="ALL"
SET BIAG1="All Ages"
QUIT
+22 SET BIAG1=$$MTHYR^BIAGE(BIAG)
End DoDot:1
+23 SET X=" 2 - Age Range................: "_BIAG1
+24 DO WRITE(.BILINE,X,1)
+25 KILL X
+26 ;
+27 ;
+28 ;---> Patient Group.
+29 IF ('$GET(BIPG)!($GET(BIPG)=9))
SET BIPG=1
NEW X
+30 Begin DoDot:1
+31 IF BIPG=1
SET X="ACTIVE in the Register."
QUIT
+32 IF BIPG=2
SET X="BOTH Active and Inactive."
QUIT
+33 IF BIPG=3
SET X="ALL who have had an Immunization."
QUIT
+34 IF BIPG=4
SET X="ALL who have had a Visit of any kind."
QUIT
+35 IF BIPG=5
SET X="ALL Patients (including those w/o a Visit)."
QUIT
+36 SET X="Make a selection."
QUIT
End DoDot:1
+37 SET X=" 3 - Patient Group............: "_X
+38 DO WRITE(.BILINE,X,1)
+39 KILL X
+40 ;
+41 ;---> Health Care Facility.
+42 NEW BIHCF1
SET BIHCF1=""
+43 Begin DoDot:1
+44 IF '$DATA(BIHCF)
SET BIHCF("ALL")=""
+45 IF $DATA(BIHCF("ALL"))
SET BIHCF1="ALL"
QUIT
+46 NEW I,M,N
+47 SET N=0
+48 FOR I=0:1
SET N=$ORDER(BIHCF(N))
IF 'N
QUIT
SET M=N
+49 IF I=1
SET BIHCF1=$$INSTTX^BIUTL6(M)
QUIT
+50 SET BIHCF1="List (Select ""4"" to review list.)"
End DoDot:1
+51 SET X=" 4 - Health Care Facility.....: "_BIHCF1
+52 DO WRITE(.BILINE,X)
+53 KILL X
+54 ;
+55 ;---> Current Community.
+56 NEW BICC1
SET BICC1=""
+57 Begin DoDot:1
+58 IF '$DATA(BICC)
SET BICC("ALL")=""
+59 IF $DATA(BICC("ALL"))
SET BICC1="ALL"
QUIT
+60 NEW I,M,N
+61 SET N=0
+62 FOR I=0:1
SET N=$ORDER(BICC(N))
IF 'N
QUIT
SET M=N
+63 IF I=1
SET BICC1=$$CCTX^BIUTL6(M)
QUIT
+64 SET BICC1="List (Select ""5"" to review list.)"
End DoDot:1
+65 SET X=" 5 - Community................: "_BICC1
+66 DO WRITE(.BILINE,X)
+67 KILL X
+68 ;
+69 ;---> Immunizations Received.
+70 NEW BIMMR1
SET BIMMR1=""
+71 Begin DoDot:1
+72 IF '$DATA(BIMMR)
SET BIMMR("ALL")=""
+73 IF $DATA(BIMMR("ALL"))
SET BIMMR1="ALL"
QUIT
+74 NEW I,M,N
+75 SET N=0
+76 FOR I=0:1
SET N=$ORDER(BIMMR(N))
IF 'N
QUIT
SET M=N
+77 IF I=1
SET BIMMR1=$$VNAME^BIUTL2(M)
QUIT
+78 SET BIMMR1="List (Select ""6"" to review list.)"
End DoDot:1
+79 SET X=" 6 - Immunizations Received...: "_BIMMR1
+80 DO WRITE(.BILINE,X,1)
+81 KILL X
+82 ;
+83 ;---> Data Elements.
+84 NEW BIDE1
SET BIDE1=""
+85 Begin DoDot:1
+86 IF '$DATA(BIDE)
SET BIDE1="None"
QUIT
+87 IF $DATA(BIDE("ALL"))
SET BIDE1="ALL"
QUIT
+88 NEW I,M,N
+89 SET N=0
+90 FOR I=0:1
SET N=$ORDER(BIDE(N))
IF 'N
QUIT
SET M=N
+91 IF I=1
SET BIDE1=$$DETX^BIUTL6(M)
QUIT
+92 SET BIDE1="List (Select ""7"" to review list.)"
End DoDot:1
+93 SET X=" 7 - Data Elements............: "_BIDE1
+94 DO WRITE(.BILINE,X,1)
+95 KILL X
+96 ;
+97 ;---> File Format (1=ASCII,2=HL7,3=ImmServe).
+98 IF '$GET(BIFMT)
SET BIFMT=1
+99 NEW BIFMT1
+100 SET BIFMT1=$SELECT(BIFMT=2:"HL7",BIFMT=3:"ImmServe",1:"ASCII")
+101 SET X=" 8 - File Format..............: "_BIFMT1
+102 DO WRITE(.BILINE,X,1)
+103 KILL X
+104 ;
+105 ;---> Output.
+106 Begin DoDot:1
+107 IF '$GET(BIOUT)
SET BIOUT=0
SET BIFLNM=""
QUIT
+108 IF $GET(BIFLNM)=""
SET BIOUT=0
End DoDot:1
+109 NEW BIOUT1
+110 SET BIOUT1=$SELECT(BIOUT:"File: "_$GET(BIPATH)_BIFLNM,1:"SCREEN")
+111 SET X=" 9 - Output Device............: "_BIOUT1
+112 DO WRITE(.BILINE,X)
+113 KILL X
+114 ;
+115 ;---> Finish up Listmanager List Count.
+116 SET VALMCNT=BILINE
+117 SET BIRTN="BIEXP2"
+118 QUIT
+119 ;
+120 ;
+121 ;----------
WRITE(BILINE,BIVAL,BIBLNK) ;EP
+1 ;---> Write lines to ^TMP (see documentation in ^BIW).
+2 ;---> Parameters:
+3 ; 1 - BILINE (ret) Last line# written.
+4 ; 2 - BIVAL (opt) Value/text of line (Null=blank line).
+5 ; 3 - BIBLNK (opt) Number of blank lines to add after line sent.
+6 ;
+7 IF '$DATA(BILINE)
QUIT
+8 DO WL^BIW(.BILINE,"BIEXP2",$GET(BIVAL),$GET(BIBLNK))
+9 QUIT
+10 ;
+11 ;
+12 ;----------
RESET ;EP
+1 ;---> Update partition for return to Listmanager.
+2 IF $DATA(VALMQUIT)
SET VALMBCK="Q"
QUIT
+3 DO TERM^VALM0
SET VALMBCK="R"
+4 DO INIT
QUIT
+5 ;
+6 ;
+7 ;----------
HELP ;EP
+1 ;---> Help code.
+2 DO FULL^VALM1
NEW BIPOP
+3 DO TITLE^BIUTL5("EXPORT DATA BY GROUP - HELP, page 1 of 2")
+4 DO TEXT1
DO DIRZ^BIUTL3(.BIPOP)
+5 IF $GET(BIPOP)
DO RESET
QUIT
+6 DO TITLE^BIUTL5("EXPORT DATA BY GROUP - HELP, page 2 of 2")
+7 DO TEXT2
DO DIRZ^BIUTL3()
+8 DO RESET
+9 QUIT
+10 ;
+11 ;
+12 ;----------
TEXT1 ;
+1 ;;The EXPORT DATA BY GROUP screen provides a menu of options for
+2 ;;exporting the data of groups of patients.
+3 ;;
+4 ;;There are 8 items or "parameters" on the screen that you may
+5 ;;change in order to specify which patients and which data will be
+6 ;;exported, as well as the output device for the export.
+7 ;;
+8 ;;To change an item, enter its left column number (1-8) at the
+9 ;;prompt on the bottom of the screen. Use "?" at any prompt where
+10 ;;you would like help or more information on the parameter you are
+11 ;;changing.
+12 ;;
+13 ;;Once you have the parameters set to retrieve the patients and data
+14 ;;you want, select E to Export the data.
+15 ;;
+16 DO PRINTX("TEXT1")
+17 QUIT
+18 ;
+19 ;
+20 ;----------
TEXT2 ;EP
+1 ;;COMMUNITIES: If you select for specific Communities, only patients
+2 ;;whose Current Community (under Patient Registration) is one of the
+3 ;;selected Communities will be included in the export.
+4 ;;
+5 ;;HEALTH CARE FACILITIES: If you select for specific Health Care
+6 ;;Facilities, only patients who have had AT LEAST ONE immunization
+7 ;;at one of the selected Health Care Facilities will be included in
+8 ;;the export.
+9 ;;
+10 ;;VACCINES: If you select for specific Vaccines, only immunizations
+11 ;;given with the selected vaccines will be included in the export.
+12 ;;
+13 ;;DATE ELEMENTS: Select the group of Data Elements you wish to export
+14 ;;for each immunization.
+15 ;;
+16 ;;SURVEY DATE, PATIENT GROUP, FILE FORMAT and OUTPUT DEVICE:
+17 ;;Detailed help will be given when you select these items.
+18 DO PRINTX("TEXT2")
+19 QUIT
+20 ;
+21 ;
+22 ;----------
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("BIEXP2",$JOB)
+3 DO CLEAR^VALM1
+4 DO FULL^VALM1
+5 QUIT