BWBRNOT1 ;IHS/ANMC/MWR - BROWSE NOTIFICATIONS;15-Feb-2003 21:47;PLS
;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
;; DISPLAY CODE FOR BROWSING NOTIFICATIONS. CALLED BY BWBRNOT.
;
DISPLAY ;EP
;---> BWCONF=DISPLAY "CONFIDENTIAL PT INFO" BANNER.
;---> BWTITLE=TITLE AT TOP OF DISPLAY HEADER.
;---> BWSUBH=CODE TO EXECUTE FOR SUBHEADER (COLUMN TITLES).
;---> BWCODE=CODE TO EXECUTE AS 3RD PIECE OF DIR(0) (AFTER DIR READ).
;---> BWCRT=1 IF OUTPUT IS TO SCREEN (ALLOWS SELECTIONS TO EDIT).
;---> BWTAB=6 IF OUTPUT IS TO SCREEN, =3 IF OUTPUT IS TO PRINTER.
;---> BWPRMT(1,Q)=PROMPTS FOR DIR.
;---> BWD=0, TELLS DIRPRMT^BWUTL3 TO DISPLAY SELECTION NUMBERS.
;
U IO
S BWCONF=1
S BWTITLE1=$S(BWC=1:"DATE",BWC=2:"PATIENT",BWC=3:"PRIORITY",1:"?")
S BWTITLE="* * * NOTIFICATIONS LISTED BY "_BWTITLE1_" * * *"
D CENTERT^BWUTL5(.BWTITLE)
S BWSUBH="SUBHEAD^BWBRNOT1"
S BWCODE="D EDIT^BWBRNOT1,SORT^BWBRNOT,COPYGBL^BWBRNOT"
S BWPRMT1=" Press RETURN to continue or '^'to exit, or"
S BWPRMT=" Select a left column number to edit"
S BWPRMTQ=" To edit a Notification, choose a number from the "
S BWPRMTQ=BWPRMTQ_"left column"
S (BWD,BWPOP,N,Z)=0
D TOPHEAD^BWUTL7
S BWTAB=$S(BWCRT:6,1:3)
;
NOMATCH ;EP
;---> QUIT IF NO RECORDS MATCH.
I '$D(^TMP("BW",$J,3)) D Q
.D HEADER1^BWUTL7
.K BWPRMT,BWPRMT1,BWPRMTQ,DIR
.W !!?5,"No records match the selected criteria.",!
.D:BWCRT DIRZ^BWUTL3 W @IOF D ^%ZISC S BWPOP=1
;
DISPLAY1 ;EP
;---> IF A NOTIFICATION IS EDITED ON THE LAST PAGE, GOTO HERE
;---> FROM LINELABEL "END" BELOW.
D HEADER1^BWUTL7
F S N=$O(^TMP("BW",$J,4,N)) Q:'N!(BWPOP) D
.I $Y+6>IOSL D:BWCRT DIRPRMT^BWUTL3 Q:BWPOP D
..S BWPAGE=BWPAGE+1
..D HEADER1^BWUTL7 S Z=0
.S Y=^TMP("BW",$J,4,N),M=N
.W !
.;---> DON'T WRITE CHART# AND NAME IF IT MATCHES THE PREVIOUS RECORD.
.;---> DON'T WRITE BROWSE SELECTION#'S IF IO IS NOT A CRT (BRCRT).
.I $P(Y,U)'=Z D
..W ! W:BWCRT $J(N,3),")" ;BROWSE SELECTION#
..W ?BWTAB,$P(Y,U) ;CHART#
..W ?BWTAB+10,$E($P(Y,U,2),1,22)," " ;NAME
..F I=1:1:22-$L($P(Y,U,2)) W "." ;CONNECTING DOTS
..W:'BWCRT "..." ;ADD DOTS IF NOT A CRT
.I $P(Y,U)=Z D ;IF NEW CHART#...
..W:BWCRT $J(N,3),")" ;BROWSE SELECTION#
..W ?BWTAB,". . . . . . . . . . . . . . . ." ;CONNECTING DOTS
.S Z=$P(Y,U) ;STORE AS PREVIOUS CHRT#
.;
.W ?41,$$SLDT2^BWUTL5($P(Y,U,3)) ;DATE OF NOTIFICATION
.W ?51,$P(Y,U,4) ;ACCESSION#
.W ?62,$P(Y,U,5) ;STATUS
.S X=$P(Y,U,6) ;PRIORITY
.W ?70,$S(X=1:"*",1:" ")
.W $P($P(^DD(9002086.404,.02,0),X_":",2),";") K X
;
END ;EP
W:'BWCRT @IOF
;---> IF A NOTIFICATION HAS BEEN EDITED, SET N=N-5 AND START (GOTO)
;---> DISPLAY1 OVER AGAIN FROM 5 RECORDS PREVIOUS.
I BWCRT&('$D(IO("S")))&('BWPOP) D DIRPRMT^BWUTL3 I N S N=N-1 G NOMATCH
D ^%ZISC
Q
;
SUBHEAD ;EP
;---> SUB HEADER FOR NOTIFICATION BROWSE OUTPUT.
W !?BWTAB,$$PNLB^BWUTL5(DUZ(2))
W ?BWTAB+10,"PATIENT",?41,"DATE",?51,"ACC#"
W ?62,"STATUS",?70,"PRIORITY",!
F I=1:1:80 W "-"
Q
;
EDIT ;EP
;---> FROM BROWSE, POP IN TO EDIT A SINGLE NOTIFICATION.
N (BWLOOP,DT,DTIME,DUZ,M,N,U,X,Z) D SETVARS^BWUTL5
S X=+X,DA=$P(^TMP("BW",$J,4,X),U,7)
S BWNN=X N X
D EDIT2^BWNOTIF(DA)
;---> BACK UP 5 RECORDS AFTER EDIT.
S N=$S(BWNN<6:1,1:BWNN-5),Z=0 K BWNN
Q
BWBRNOT1 ;IHS/ANMC/MWR - BROWSE NOTIFICATIONS;15-Feb-2003 21:47;PLS
+1 ;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
+2 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
+3 ;; DISPLAY CODE FOR BROWSING NOTIFICATIONS. CALLED BY BWBRNOT.
+4 ;
DISPLAY ;EP
+1 ;---> BWCONF=DISPLAY "CONFIDENTIAL PT INFO" BANNER.
+2 ;---> BWTITLE=TITLE AT TOP OF DISPLAY HEADER.
+3 ;---> BWSUBH=CODE TO EXECUTE FOR SUBHEADER (COLUMN TITLES).
+4 ;---> BWCODE=CODE TO EXECUTE AS 3RD PIECE OF DIR(0) (AFTER DIR READ).
+5 ;---> BWCRT=1 IF OUTPUT IS TO SCREEN (ALLOWS SELECTIONS TO EDIT).
+6 ;---> BWTAB=6 IF OUTPUT IS TO SCREEN, =3 IF OUTPUT IS TO PRINTER.
+7 ;---> BWPRMT(1,Q)=PROMPTS FOR DIR.
+8 ;---> BWD=0, TELLS DIRPRMT^BWUTL3 TO DISPLAY SELECTION NUMBERS.
+9 ;
+10 USE IO
+11 SET BWCONF=1
+12 SET BWTITLE1=$SELECT(BWC=1:"DATE",BWC=2:"PATIENT",BWC=3:"PRIORITY",1:"?")
+13 SET BWTITLE="* * * NOTIFICATIONS LISTED BY "_BWTITLE1_" * * *"
+14 DO CENTERT^BWUTL5(.BWTITLE)
+15 SET BWSUBH="SUBHEAD^BWBRNOT1"
+16 SET BWCODE="D EDIT^BWBRNOT1,SORT^BWBRNOT,COPYGBL^BWBRNOT"
+17 SET BWPRMT1=" Press RETURN to continue or '^'to exit, or"
+18 SET BWPRMT=" Select a left column number to edit"
+19 SET BWPRMTQ=" To edit a Notification, choose a number from the "
+20 SET BWPRMTQ=BWPRMTQ_"left column"
+21 SET (BWD,BWPOP,N,Z)=0
+22 DO TOPHEAD^BWUTL7
+23 SET BWTAB=$SELECT(BWCRT:6,1:3)
+24 ;
NOMATCH ;EP
+1 ;---> QUIT IF NO RECORDS MATCH.
+2 IF '$DATA(^TMP("BW",$JOB,3))
Begin DoDot:1
+3 DO HEADER1^BWUTL7
+4 KILL BWPRMT,BWPRMT1,BWPRMTQ,DIR
+5 WRITE !!?5,"No records match the selected criteria.",!
+6 IF BWCRT
DO DIRZ^BWUTL3
WRITE @IOF
DO ^%ZISC
SET BWPOP=1
End DoDot:1
QUIT
+7 ;
DISPLAY1 ;EP
+1 ;---> IF A NOTIFICATION IS EDITED ON THE LAST PAGE, GOTO HERE
+2 ;---> FROM LINELABEL "END" BELOW.
+3 DO HEADER1^BWUTL7
+4 FOR
SET N=$ORDER(^TMP("BW",$JOB,4,N))
IF 'N!(BWPOP)
QUIT
Begin DoDot:1
+5 IF $Y+6>IOSL
IF BWCRT
DO DIRPRMT^BWUTL3
IF BWPOP
QUIT
Begin DoDot:2
+6 SET BWPAGE=BWPAGE+1
+7 DO HEADER1^BWUTL7
SET Z=0
End DoDot:2
+8 SET Y=^TMP("BW",$JOB,4,N)
SET M=N
+9 WRITE !
+10 ;---> DON'T WRITE CHART# AND NAME IF IT MATCHES THE PREVIOUS RECORD.
+11 ;---> DON'T WRITE BROWSE SELECTION#'S IF IO IS NOT A CRT (BRCRT).
+12 IF $PIECE(Y,U)'=Z
Begin DoDot:2
+13 ;BROWSE SELECTION#
WRITE !
IF BWCRT
WRITE $JUSTIFY(N,3),")"
+14 ;CHART#
WRITE ?BWTAB,$PIECE(Y,U)
+15 ;NAME
WRITE ?BWTAB+10,$EXTRACT($PIECE(Y,U,2),1,22)," "
+16 ;CONNECTING DOTS
FOR I=1:1:22-$LENGTH($PIECE(Y,U,2))
WRITE "."
+17 ;ADD DOTS IF NOT A CRT
IF 'BWCRT
WRITE "..."
End DoDot:2
+18 ;IF NEW CHART#...
IF $PIECE(Y,U)=Z
Begin DoDot:2
+19 ;BROWSE SELECTION#
IF BWCRT
WRITE $JUSTIFY(N,3),")"
+20 ;CONNECTING DOTS
WRITE ?BWTAB,". . . . . . . . . . . . . . . ."
End DoDot:2
+21 ;STORE AS PREVIOUS CHRT#
SET Z=$PIECE(Y,U)
+22 ;
+23 ;DATE OF NOTIFICATION
WRITE ?41,$$SLDT2^BWUTL5($PIECE(Y,U,3))
+24 ;ACCESSION#
WRITE ?51,$PIECE(Y,U,4)
+25 ;STATUS
WRITE ?62,$PIECE(Y,U,5)
+26 ;PRIORITY
SET X=$PIECE(Y,U,6)
+27 WRITE ?70,$SELECT(X=1:"*",1:" ")
+28 WRITE $PIECE($PIECE(^DD(9002086.404,.02,0),X_":",2),";")
KILL X
End DoDot:1
+29 ;
END ;EP
+1 IF 'BWCRT
WRITE @IOF
+2 ;---> IF A NOTIFICATION HAS BEEN EDITED, SET N=N-5 AND START (GOTO)
+3 ;---> DISPLAY1 OVER AGAIN FROM 5 RECORDS PREVIOUS.
+4 IF BWCRT&('$DATA(IO("S")))&('BWPOP)
DO DIRPRMT^BWUTL3
IF N
SET N=N-1
GOTO NOMATCH
+5 DO ^%ZISC
+6 QUIT
+7 ;
SUBHEAD ;EP
+1 ;---> SUB HEADER FOR NOTIFICATION BROWSE OUTPUT.
+2 WRITE !?BWTAB,$$PNLB^BWUTL5(DUZ(2))
+3 WRITE ?BWTAB+10,"PATIENT",?41,"DATE",?51,"ACC#"
+4 WRITE ?62,"STATUS",?70,"PRIORITY",!
+5 FOR I=1:1:80
WRITE "-"
+6 QUIT
+7 ;
EDIT ;EP
+1 ;---> FROM BROWSE, POP IN TO EDIT A SINGLE NOTIFICATION.
+2 NEW (BWLOOP,DT,DTIME,DUZ,M,N,U,X,Z)
DO SETVARS^BWUTL5
+3 SET X=+X
SET DA=$PIECE(^TMP("BW",$JOB,4,X),U,7)
+4 SET BWNN=X
NEW X
+5 DO EDIT2^BWNOTIF(DA)
+6 ;---> BACK UP 5 RECORDS AFTER EDIT.
+7 SET N=$SELECT(BWNN<6:1,1:BWNN-5)
SET Z=0
KILL BWNN
+8 QUIT