BILETVW1 ;IHS/CMI/MWR - VIEW/EDIT FORM LETTERS; MAY 10, 2010
;;8.5;IMMUNIZATION;;SEP 01,2011
;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
;; INIT FOR VIEW/EDIT FORM LETTERS.
;
;
;----------
INIT ;EP
;---> Initialize variables and list array.
;
;---> If BIIEN not supplied, set Error Code and quit.
I '$G(BIIEN) D ERRCD^BIUTL2(609,,1) S VALMQUIT="" Q
I '$D(^BILET(BIIEN,0)) D ERRCD^BIUTL2(610,,1) S VALMQUIT="" Q
;
;---> Set Lower Frame Bar and Screen Title.
S VALMSG="Enter ?? for more actions."
;
;---> Build Listmanager array from Form Letter global.
K ^TMP("BILMLT",$J)
S BILINE=0
;
;---> If Forecast comes first, set BIFF=1
N BIFF S BIFF=$P(^BILET(BIIEN,0),U,6)
;
D SECTION(BIIEN,.BILINE,1,"top")
D
.I BIFF D FORECAST(BIIEN,.BILINE) Q
.D HISTORY(BIIEN,.BILINE)
D SECTION(BIIEN,.BILINE,2,"middle")
D
.I BIFF D HISTORY(BIIEN,.BILINE) Q
.D FORECAST(BIIEN,.BILINE)
D SECTION(BIIEN,.BILINE,3,"bottom")
D DATELOC(BIIEN,.BILINE)
D SECTION(BIIEN,.BILINE,4,"closing")
;
;---> Finish up Listmanager List Count.
S VALMCNT=BILINE
I VALMCNT>12 D
.S VALMSG="Scroll down to view more. Type ?? for more actions."
Q
;
;
;----------
SECTION(BIIEN,BILINE,BISEC,BISECLB) ;EP
;---> Set a Section of a Form Letter into Listman array.
;---> Parameters:
; 1 - BIIEN (req) IEN of Form Letter.
; 2 - BILINE (ret) Last line written into Listman array.
; 3 - BISEC (req) Section of Form Letter to retrieve.
; 4 - BISECLB (req) Section Label.
;
Q:'$G(BIIEN)
Q:'$G(BISEC)
S:'$G(BILINE) BILINE=0
S:$G(BISECLB)="" BISECLB="UNLABELED SECTION"
;
D SECTBRK(.BILINE,BISECLB)
;
D:$D(^BILET(BIIEN,BISEC,0))
.N N S N=0
.F S N=$O(^BILET(BIIEN,BISEC,N)) Q:'N D
..S BILINE=BILINE+1
..S ^TMP("BILMLT",$J,BILINE,0)=^BILET(BIIEN,BISEC,N,0)
;
Q
;
;
;----------
HISTORY(BIIEN,L) ;EP
;---> Set an example of a patient's Immunization History Section
;---> of a Form Letter into Listman array.
;---> Parameters:
; 1 - BIIEN (req) IEN of Form Letter.
; 2 - L (ret) Last line written into Listman array.
;
Q:'$G(BIIEN)
S:'$G(L) L=0
Q:'$P(^BILET(BIIEN,0),U,2)
D SECTBRK(.L,"history")
;
N BIFORM,X
S BIFORM=$P(^BILET(BIIEN,0),U,2)
I BIFORM=1 D Q
.;---> Example list of Immunization History by Date.
.S X=" 12-Aug-1994: 1-DTP, 1-OPV, 1-PEDVAXHIB, 1-HEP B VAC"
.D WRITE(.L,X)
.S X=" 10-Oct-1994: 2-DTP, 2-OPV, 2-PEDVAXHIB, 2-HEP B VAC"
.D WRITE(.L,X)
;
I BIFORM=2 D Q
.;---> Example list of Immunization History by Date.
.S X=" 12-Aug-1994: 1-DTP (099E), 1-OPV (7845F), 1-PEDVAXHIB"
.S X=X_" (78T032)"
.D WRITE(.L,X)
.S X=" 2-HEP B VAC (900RT4)"
.D WRITE(.L,X)
.S X=" 10-Oct-1994: 2-DTP (101E2), 2-OPV (877K1), 2-PEDVAXHIB"
.D WRITE(.L,X)
;
;---> Example list of Immunization History by Vaccine.
S X=" Immunization Date Received Location"
S:BIFORM=4 X=X_" Lot#"
D WRITE(.L,X)
S X=" ------------ ------------- ---------------"
S:BIFORM=4 X=X_" ----------"
D WRITE(.L,X)
S X=" 1-DTP 12-Aug-1994 Anch Med Ctr"
S:BIFORM=4 X=X_" 0900E"
D WRITE(.L,X)
S X=" 2-DTP 12-Oct-1994 Kotzebue Hospital"
S:BIFORM=4 X=X_" 94-56t"
D WRITE(.L,X)
S X=" 3-DTP 19-Dec-1994 Anch Med Ctr"
S:BIFORM=4 X=X_" 0901F"
D WRITE(.L,X)
D WRITE(.L)
S X=" 1-OPV 12-Aug-1994 Anch Med Ctr"
S:BIFORM=4 X=X_" 468-781b"
D WRITE(.L,X)
S X=" 2-OPV 12-Oct-1994 Kotzebue Hospital"
S:BIFORM=4 X=X_" 468-732f"
D WRITE(.L,X)
S X=" 3-OPV 25-Oct-1995 RedLake Hospital"
S:BIFORM=4 X=X_" 468-81a"
D WRITE(.L,X)
D WRITE(.L)
S X=" 1-PEDVAXHIB 12-Aug-1994 Anch Med Ctr"
D WRITE(.L,X)
S X=" 2-PEDVAXHIB 12-Oct-1994 Kotzebue Hospital"
S:BIFORM=4 X=X_" zr987v"
D WRITE(.L,X)
S X=" 3-PEDVAXHIB 12-Jul-1995 Anch Med Ctr"
D WRITE(.L,X)
D WRITE(.L)
S X=" 1-HEP B 29-Jun-1994 Anch Med Ctr"
S:BIFORM=4 X=X_" 500s-01"
D WRITE(.L,X)
S X=" 2-HEP B 12-Aug-1994 Anch Med Ctr"
D WRITE(.L,X)
S X=" 3-HEP B 19-Dec-1994 Anch Med Ctr"
D WRITE(.L,X)
D WRITE(.L)
S X=" 1-MMR 12-Jul-1995 Anch Med Ctr"
S:BIFORM=4 X=X_" 345-101t"
D WRITE(.L,X)
;
;---> Example list of Skin Tests.
D WRITE(.L),WRITE(.L)
S X=" Skin Test Date Received Location"
S X=X_" Result"
D WRITE(.L,X)
S X=" ------------ ------------- ---------------"
S X=X_" ---------"
D WRITE(.L,X)
S X=" MONO-VAC 12-Aug-1994 Anch Med Ctr"
S X=X_" Negative"
D WRITE(.L,X)
Q
;
;
;----------
WRITE(BILINE,X) ;EP
;---> Set text (X) in Listman Edit Letter temp global.
;---> Parameters:
; 1 - BILINE (req) Last line written into Listman array.
; 2 - X (opt) Text of line. If X=null, insert blank line.
;
S BILINE=BILINE+1
S:$G(X)="" X=" "
S ^TMP("BILMLT",$J,BILINE,0)=X
Q
;
;
;----------
FORECAST(BIIEN,BILINE) ;EP
;---> Set an example of a patient's Immunization Forecast Section
;---> of a Form Letter into Listman array.
;---> Parameters:
; 1 - BIIEN (req) IEN of Form Letter.
; 2 - BILINE (ret) Last line written into Listman array.
;
Q:'$G(BIIEN)
S:'$G(BILINE) BILINE=0
Q:'$P(^BILET(BIIEN,0),U,3)
D SECTBRK(.BILINE,"forecast")
;
N X
S BILINE=BILINE+1
S X=" DTP"
S ^TMP("BILMLT",$J,BILINE,0)=X
S BILINE=BILINE+1
S X=" HEP B VAC"
S ^TMP("BILMLT",$J,BILINE,0)=X
Q
;
;
;----------
DATELOC(BIIEN,BILINE) ;EP
;---> Set an example of a Date Location line of a Form Letter
;---> into Listman array.
;---> Parameters:
; 1 - BIIEN (req) IEN of Form Letter.
; 2 - BILINE (ret) Last line written into Listman array.
;
Q:'$G(BIIEN)
S:'$G(BILINE) BILINE=0
Q:'$P(^BILET(BIIEN,0),U,4)
D SECTBRK(.BILINE,"date/location")
;
N X
S BILINE=BILINE+1
S X=" 10-Dec-1994 at Kiddy Klinic, Alaska Native Medical Center"
S ^TMP("BILMLT",$J,BILINE,0)=X
Q
;
;
;----------
SECTBRK(BILINE,BISECLB) ;EP
;---> Insert a Section Break in Listman array.
;---> Parameters:
; 1 - BILINE (ret) IEN of Form Letter.
; 2 - BISECLB (req) Section Label.
;
S:'$G(BILINE) BILINE=0
S:$G(BISECLB)="" BISECLB="UNLABELED SECTION"
S BISECLB=IORVON_BISECLB_":"_IOINORM
N BISECBK S BISECBK=$$SP^BIUTL5(79,"-")
;
S BILINE=BILINE+1,^TMP("BILMLT",$J,BILINE,0)=BISECBK
S BILINE=BILINE+1,^TMP("BILMLT",$J,BILINE,0)=BISECLB
S BILINE=BILINE+1,^TMP("BILMLT",$J,BILINE,0)=""
Q
BILETVW1 ;IHS/CMI/MWR - VIEW/EDIT FORM LETTERS; MAY 10, 2010
+1 ;;8.5;IMMUNIZATION;;SEP 01,2011
+2 ;;* MICHAEL REMILLARD, DDS * CIMARRON MEDICAL INFORMATICS, FOR IHS *
+3 ;; INIT FOR VIEW/EDIT FORM LETTERS.
+4 ;
+5 ;
+6 ;----------
INIT ;EP
+1 ;---> Initialize variables and list array.
+2 ;
+3 ;---> If BIIEN not supplied, set Error Code and quit.
+4 IF '$GET(BIIEN)
DO ERRCD^BIUTL2(609,,1)
SET VALMQUIT=""
QUIT
+5 IF '$DATA(^BILET(BIIEN,0))
DO ERRCD^BIUTL2(610,,1)
SET VALMQUIT=""
QUIT
+6 ;
+7 ;---> Set Lower Frame Bar and Screen Title.
+8 SET VALMSG="Enter ?? for more actions."
+9 ;
+10 ;---> Build Listmanager array from Form Letter global.
+11 KILL ^TMP("BILMLT",$JOB)
+12 SET BILINE=0
+13 ;
+14 ;---> If Forecast comes first, set BIFF=1
+15 NEW BIFF
SET BIFF=$PIECE(^BILET(BIIEN,0),U,6)
+16 ;
+17 DO SECTION(BIIEN,.BILINE,1,"top")
+18 Begin DoDot:1
+19 IF BIFF
DO FORECAST(BIIEN,.BILINE)
QUIT
+20 DO HISTORY(BIIEN,.BILINE)
End DoDot:1
+21 DO SECTION(BIIEN,.BILINE,2,"middle")
+22 Begin DoDot:1
+23 IF BIFF
DO HISTORY(BIIEN,.BILINE)
QUIT
+24 DO FORECAST(BIIEN,.BILINE)
End DoDot:1
+25 DO SECTION(BIIEN,.BILINE,3,"bottom")
+26 DO DATELOC(BIIEN,.BILINE)
+27 DO SECTION(BIIEN,.BILINE,4,"closing")
+28 ;
+29 ;---> Finish up Listmanager List Count.
+30 SET VALMCNT=BILINE
+31 IF VALMCNT>12
Begin DoDot:1
+32 SET VALMSG="Scroll down to view more. Type ?? for more actions."
End DoDot:1
+33 QUIT
+34 ;
+35 ;
+36 ;----------
SECTION(BIIEN,BILINE,BISEC,BISECLB) ;EP
+1 ;---> Set a Section of a Form Letter into Listman array.
+2 ;---> Parameters:
+3 ; 1 - BIIEN (req) IEN of Form Letter.
+4 ; 2 - BILINE (ret) Last line written into Listman array.
+5 ; 3 - BISEC (req) Section of Form Letter to retrieve.
+6 ; 4 - BISECLB (req) Section Label.
+7 ;
+8 IF '$GET(BIIEN)
QUIT
+9 IF '$GET(BISEC)
QUIT
+10 IF '$GET(BILINE)
SET BILINE=0
+11 IF $GET(BISECLB)=""
SET BISECLB="UNLABELED SECTION"
+12 ;
+13 DO SECTBRK(.BILINE,BISECLB)
+14 ;
+15 IF $DATA(^BILET(BIIEN,BISEC,0))
Begin DoDot:1
+16 NEW N
SET N=0
+17 FOR
SET N=$ORDER(^BILET(BIIEN,BISEC,N))
IF 'N
QUIT
Begin DoDot:2
+18 SET BILINE=BILINE+1
+19 SET ^TMP("BILMLT",$JOB,BILINE,0)=^BILET(BIIEN,BISEC,N,0)
End DoDot:2
End DoDot:1
+20 ;
+21 QUIT
+22 ;
+23 ;
+24 ;----------
HISTORY(BIIEN,L) ;EP
+1 ;---> Set an example of a patient's Immunization History Section
+2 ;---> of a Form Letter into Listman array.
+3 ;---> Parameters:
+4 ; 1 - BIIEN (req) IEN of Form Letter.
+5 ; 2 - L (ret) Last line written into Listman array.
+6 ;
+7 IF '$GET(BIIEN)
QUIT
+8 IF '$GET(L)
SET L=0
+9 IF '$PIECE(^BILET(BIIEN,0),U,2)
QUIT
+10 DO SECTBRK(.L,"history")
+11 ;
+12 NEW BIFORM,X
+13 SET BIFORM=$PIECE(^BILET(BIIEN,0),U,2)
+14 IF BIFORM=1
Begin DoDot:1
+15 ;---> Example list of Immunization History by Date.
+16 SET X=" 12-Aug-1994: 1-DTP, 1-OPV, 1-PEDVAXHIB, 1-HEP B VAC"
+17 DO WRITE(.L,X)
+18 SET X=" 10-Oct-1994: 2-DTP, 2-OPV, 2-PEDVAXHIB, 2-HEP B VAC"
+19 DO WRITE(.L,X)
End DoDot:1
QUIT
+20 ;
+21 IF BIFORM=2
Begin DoDot:1
+22 ;---> Example list of Immunization History by Date.
+23 SET X=" 12-Aug-1994: 1-DTP (099E), 1-OPV (7845F), 1-PEDVAXHIB"
+24 SET X=X_" (78T032)"
+25 DO WRITE(.L,X)
+26 SET X=" 2-HEP B VAC (900RT4)"
+27 DO WRITE(.L,X)
+28 SET X=" 10-Oct-1994: 2-DTP (101E2), 2-OPV (877K1), 2-PEDVAXHIB"
+29 DO WRITE(.L,X)
End DoDot:1
QUIT
+30 ;
+31 ;---> Example list of Immunization History by Vaccine.
+32 SET X=" Immunization Date Received Location"
+33 IF BIFORM=4
SET X=X_" Lot#"
+34 DO WRITE(.L,X)
+35 SET X=" ------------ ------------- ---------------"
+36 IF BIFORM=4
SET X=X_" ----------"
+37 DO WRITE(.L,X)
+38 SET X=" 1-DTP 12-Aug-1994 Anch Med Ctr"
+39 IF BIFORM=4
SET X=X_" 0900E"
+40 DO WRITE(.L,X)
+41 SET X=" 2-DTP 12-Oct-1994 Kotzebue Hospital"
+42 IF BIFORM=4
SET X=X_" 94-56t"
+43 DO WRITE(.L,X)
+44 SET X=" 3-DTP 19-Dec-1994 Anch Med Ctr"
+45 IF BIFORM=4
SET X=X_" 0901F"
+46 DO WRITE(.L,X)
+47 DO WRITE(.L)
+48 SET X=" 1-OPV 12-Aug-1994 Anch Med Ctr"
+49 IF BIFORM=4
SET X=X_" 468-781b"
+50 DO WRITE(.L,X)
+51 SET X=" 2-OPV 12-Oct-1994 Kotzebue Hospital"
+52 IF BIFORM=4
SET X=X_" 468-732f"
+53 DO WRITE(.L,X)
+54 SET X=" 3-OPV 25-Oct-1995 RedLake Hospital"
+55 IF BIFORM=4
SET X=X_" 468-81a"
+56 DO WRITE(.L,X)
+57 DO WRITE(.L)
+58 SET X=" 1-PEDVAXHIB 12-Aug-1994 Anch Med Ctr"
+59 DO WRITE(.L,X)
+60 SET X=" 2-PEDVAXHIB 12-Oct-1994 Kotzebue Hospital"
+61 IF BIFORM=4
SET X=X_" zr987v"
+62 DO WRITE(.L,X)
+63 SET X=" 3-PEDVAXHIB 12-Jul-1995 Anch Med Ctr"
+64 DO WRITE(.L,X)
+65 DO WRITE(.L)
+66 SET X=" 1-HEP B 29-Jun-1994 Anch Med Ctr"
+67 IF BIFORM=4
SET X=X_" 500s-01"
+68 DO WRITE(.L,X)
+69 SET X=" 2-HEP B 12-Aug-1994 Anch Med Ctr"
+70 DO WRITE(.L,X)
+71 SET X=" 3-HEP B 19-Dec-1994 Anch Med Ctr"
+72 DO WRITE(.L,X)
+73 DO WRITE(.L)
+74 SET X=" 1-MMR 12-Jul-1995 Anch Med Ctr"
+75 IF BIFORM=4
SET X=X_" 345-101t"
+76 DO WRITE(.L,X)
+77 ;
+78 ;---> Example list of Skin Tests.
+79 DO WRITE(.L)
DO WRITE(.L)
+80 SET X=" Skin Test Date Received Location"
+81 SET X=X_" Result"
+82 DO WRITE(.L,X)
+83 SET X=" ------------ ------------- ---------------"
+84 SET X=X_" ---------"
+85 DO WRITE(.L,X)
+86 SET X=" MONO-VAC 12-Aug-1994 Anch Med Ctr"
+87 SET X=X_" Negative"
+88 DO WRITE(.L,X)
+89 QUIT
+90 ;
+91 ;
+92 ;----------
WRITE(BILINE,X) ;EP
+1 ;---> Set text (X) in Listman Edit Letter temp global.
+2 ;---> Parameters:
+3 ; 1 - BILINE (req) Last line written into Listman array.
+4 ; 2 - X (opt) Text of line. If X=null, insert blank line.
+5 ;
+6 SET BILINE=BILINE+1
+7 IF $GET(X)=""
SET X=" "
+8 SET ^TMP("BILMLT",$JOB,BILINE,0)=X
+9 QUIT
+10 ;
+11 ;
+12 ;----------
FORECAST(BIIEN,BILINE) ;EP
+1 ;---> Set an example of a patient's Immunization Forecast Section
+2 ;---> of a Form Letter into Listman array.
+3 ;---> Parameters:
+4 ; 1 - BIIEN (req) IEN of Form Letter.
+5 ; 2 - BILINE (ret) Last line written into Listman array.
+6 ;
+7 IF '$GET(BIIEN)
QUIT
+8 IF '$GET(BILINE)
SET BILINE=0
+9 IF '$PIECE(^BILET(BIIEN,0),U,3)
QUIT
+10 DO SECTBRK(.BILINE,"forecast")
+11 ;
+12 NEW X
+13 SET BILINE=BILINE+1
+14 SET X=" DTP"
+15 SET ^TMP("BILMLT",$JOB,BILINE,0)=X
+16 SET BILINE=BILINE+1
+17 SET X=" HEP B VAC"
+18 SET ^TMP("BILMLT",$JOB,BILINE,0)=X
+19 QUIT
+20 ;
+21 ;
+22 ;----------
DATELOC(BIIEN,BILINE) ;EP
+1 ;---> Set an example of a Date Location line of a Form Letter
+2 ;---> into Listman array.
+3 ;---> Parameters:
+4 ; 1 - BIIEN (req) IEN of Form Letter.
+5 ; 2 - BILINE (ret) Last line written into Listman array.
+6 ;
+7 IF '$GET(BIIEN)
QUIT
+8 IF '$GET(BILINE)
SET BILINE=0
+9 IF '$PIECE(^BILET(BIIEN,0),U,4)
QUIT
+10 DO SECTBRK(.BILINE,"date/location")
+11 ;
+12 NEW X
+13 SET BILINE=BILINE+1
+14 SET X=" 10-Dec-1994 at Kiddy Klinic, Alaska Native Medical Center"
+15 SET ^TMP("BILMLT",$JOB,BILINE,0)=X
+16 QUIT
+17 ;
+18 ;
+19 ;----------
SECTBRK(BILINE,BISECLB) ;EP
+1 ;---> Insert a Section Break in Listman array.
+2 ;---> Parameters:
+3 ; 1 - BILINE (ret) IEN of Form Letter.
+4 ; 2 - BISECLB (req) Section Label.
+5 ;
+6 IF '$GET(BILINE)
SET BILINE=0
+7 IF $GET(BISECLB)=""
SET BISECLB="UNLABELED SECTION"
+8 SET BISECLB=IORVON_BISECLB_":"_IOINORM
+9 NEW BISECBK
SET BISECBK=$$SP^BIUTL5(79,"-")
+10 ;
+11 SET BILINE=BILINE+1
SET ^TMP("BILMLT",$JOB,BILINE,0)=BISECBK
+12 SET BILINE=BILINE+1
SET ^TMP("BILMLT",$JOB,BILINE,0)=BISECLB
+13 SET BILINE=BILINE+1
SET ^TMP("BILMLT",$JOB,BILINE,0)=""
+14 QUIT