BWNOTIF ;IHS/ANMC/MWR - BW ADD/EDIT BW NOTIFICATIONS;27-Mar-2003 14:36;PLS
;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
;; CALLED BY DIFFERENT OPTIONS TO ADD/EDIT NOTIFICATIONS.
;
;
ADD ;EP
;---> CALLED BY OPTION: "BW ADD A NEW NOTIFICATION".
D SETVARS^BWUTL5
D TITLE^BWUTL5("ADD NEW NOTIFICATION")
D PATLKUP^BWUTL8(.Y)
D:Y>0 NEW(+Y)
D EXIT
Q
;
;
EDIT ;EP
;---> CALLED BY OPTION: "BW EDIT NOTIFICATION".
;---> EDIT AN EXISTING NOTIFICATION.
D SETVARS^BWUTL5
N Y
D TITLE^BWUTL5("EDIT A NOTIFICATION")
D DIC^BWFMAN(9002086.4,"QEMA",.Y," Select PATIENT: ")
G:Y<0 EXIT
D EDIT2(+Y),EXIT
Q
;
EXIT ;EP
D KILLALL^BWUTL8
Q
;
;
NEW(BWDFN,BWACCN) ;EP
;---> STUFF NEW ENTRY IN BW NOTIFICATION FILE, .01=DFN.
;---> REQUIRED VARIABLE: BWDFN=IEN OF BW PATIENT, FILE 9002086.
;---> OPTIONAL VARIABLE: BWACCN=ACCESSION# FOR PROCEDURE.
I $$DECEASED^BWUTL1(BWDFN) D Q
.W !!?5,"This patient is registered as deceased." D DIRZ^BWUTL3
N DA,DIC,X
S X=BWDFN K DD,DO
S DIC="^BWNOT(",DIC(0)="ML",DLAYGO=9002086
S DIC("DR")=".02///T;.06///"_$S($D(BWACCN):$P(BWACCN,","),1:"")
S DIC("DR")=DIC("DR")_";.07////"_$G(DUZ(2))_";.14///o"
D FILE^DICN K DD,DO,DIC
;---> IF Y<0, CHECK PERMISSIONS.
I Y<0 D ERROR1 Q
D EDIT2(+Y)
Q
;
;
EDIT2(DA) ;EP - FROM BWBRNOT2
;---> REQUIRED VARIABLES: DA=IEN IN ^BWNOT(.
N BWDA D SETVARS^BWUTL5
S BWDFN=$P(^BWNOT(DA,0),U)
D SCREEN(DA,BWDFN,.BWPOP)
Q:BWPOP
I $G(DA) S BWDA=DA D PRINTNOW
;---> OPPORTUNITY TO EDIT PATIENT'S CASE DATA.
;---> IF $D(BWLOOP), NEW (ABOVE) WAS CALLED FROM CASEDATA^BWPATE,
;---> SO DON'T LOOP THROUGH AGAIN.
D:'$D(BWLOOP) CASEDATA^BWPATE(BWDFN)
Q
;
;
SCREEN(DA,BWDFN,BWPOP) ;EP
;---> EDIT WITH SCREENMAN.
;---> NEEDS BWDFN FOR SCREEN ON ACCESSION# FIELD LOOKUP.
S DDSFILE=9002086.4,DR="[BW NOTIF-FORM-1]",BWPOP=0
;---> IF THIS NOTIFICATION HAS ALREADY BEEN PRINTED, THEN DISALLOW
;---> THE USER TO EDIT MOST FIELDS BY USING FORM-2 BELOW.
S:$P(^BWNOT(DA,0),U,10) DR="[BW NOTIF-FORM-2]"
D DDS^BWFMAN(DDSFILE,DR,DA,"","",.BWPOP)
Q
;
;
PRINTNOW ;EP
;---> PRINT OR VIEW NOTIFICATION NOW, IF IT'S A LETTER.
;---> REQUIRED VARIABLE: BWDA=IEN IN ^BWNOT
Q:'$D(BWDA)
;---> QUIT IF THIS NOTIFICATION DOES NOT HAVE A "TYPE OF NOTIFICATION".
Q:'$P(^BWNOT(BWDA,0),U,3)
;---> QUIT IF TYPE OF NOTIFICATION IS NOT PRINTABLE.
Q:'$P(^BWNOTT($P(^BWNOT(BWDA,0),U,3),0),U,2)
;---> QUIT IF THIS NOTIFICATION HAS ALREADY BEEN PRINTED.
;Q:$P(^BWNOT(BWDA,0),U,10) ;DISABLED FOR NOW, ALLOW VIEW OR REPRINT.
F D Q:BWPOP Q:$P(^BWNOT(BWDA,0),U,10)
.N BWCRT,DA,DIR
.W !!,"Do you wish to PREVIEW or PRINT this letter now?"
.S DIR(0)="Y",DIR("B")="NO" D HELP2
.D ^DIR K DIR W !
.I $D(DIRUT)!(Y<1) S BWPOP=1 Q
.;---> QUIT IF NOT ASSOCIATED WITH THE USER'S CURRENT FACILITY.
.N BWFACIL S BWFACIL=$P(^BWNOT(BWDA,0),U,7)
.I ((BWFACIL'=DUZ(2))&(BWFACIL)) D S BWPOP=1 Q
..D TEXT1^BWLETPR,DIRZ^BWUTL3
.I Y D DEVICE^BWLETPR Q:BWPOP D PRINT^BWLETPR
Q
;
ERROR1 ;EP
W !!?10,*7,"NEW NOTIFICATION ENTRY FOR THIS PATIENT FAILED."
D DIRZ^BWUTL3
Q
;
ADDNOTIF ;EP
;---> ADD NEW NOTIFICATION.
;---> AT PRESENT THIS EP IS NOT CALLED BY ANTHING.
W !,"Do you wish to add a NEW Notification for this patient?"
S DIR(0)="Y",DIR("B")="NO" D HELP1
D ^DIR K DIR W !
I Y D
.N BWLOOP,DIC,DIE,Y
.S Y=BWDFN,BWLOOP=1 D NEW(BWDFN)
Q
;
HELP1 ;EP
;;Enter YES to add a NEW Notification for this patient. If the
;;notification is a letter, the letter may be queued to print shortly
;;before the patient's next appointment by selecting an appropriate
;;"Print Date".
S BWTAB=5,BWLINL="HELP1" D HELPTX
Q
;
HELP2 ;EP
;;"Preview" allows you to look at the letter that has just been queued.
;;To preview this letter, select HOME at the "DEVICE: " prompt.
;;
;;"Print" will print the letter now (regardless of its "Print Date")
;;and remove it from the queue of letters waiting to print.
;;To print this letter now, select a printer at the "DEVICE: " prompt.
S BWTAB=5,BWLINL="HELP2" D HELPTX
Q
;
HELPTX ;EP
;---> CREATES DIR ARRAY FOR DIR. REQUIRED VARIABLES: BWTAB,BWLINL.
N I,T,X S T="" F I=1:1:BWTAB S T=T_" "
F I=1:1 S X=$T(@BWLINL+I) Q:X'[";;" S DIR("?",I)=T_$P(X,";;",2)
S DIR("?")=DIR("?",I-1) K DIR("?",I-1)
Q
BWNOTIF ;IHS/ANMC/MWR - BW ADD/EDIT BW NOTIFICATIONS;27-Mar-2003 14:36;PLS
+1 ;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
+2 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
+3 ;; CALLED BY DIFFERENT OPTIONS TO ADD/EDIT NOTIFICATIONS.
+4 ;
+5 ;
ADD ;EP
+1 ;---> CALLED BY OPTION: "BW ADD A NEW NOTIFICATION".
+2 DO SETVARS^BWUTL5
+3 DO TITLE^BWUTL5("ADD NEW NOTIFICATION")
+4 DO PATLKUP^BWUTL8(.Y)
+5 IF Y>0
DO NEW(+Y)
+6 DO EXIT
+7 QUIT
+8 ;
+9 ;
EDIT ;EP
+1 ;---> CALLED BY OPTION: "BW EDIT NOTIFICATION".
+2 ;---> EDIT AN EXISTING NOTIFICATION.
+3 DO SETVARS^BWUTL5
+4 NEW Y
+5 DO TITLE^BWUTL5("EDIT A NOTIFICATION")
+6 DO DIC^BWFMAN(9002086.4,"QEMA",.Y," Select PATIENT: ")
+7 IF Y<0
GOTO EXIT
+8 DO EDIT2(+Y)
DO EXIT
+9 QUIT
+10 ;
EXIT ;EP
+1 DO KILLALL^BWUTL8
+2 QUIT
+3 ;
+4 ;
NEW(BWDFN,BWACCN) ;EP
+1 ;---> STUFF NEW ENTRY IN BW NOTIFICATION FILE, .01=DFN.
+2 ;---> REQUIRED VARIABLE: BWDFN=IEN OF BW PATIENT, FILE 9002086.
+3 ;---> OPTIONAL VARIABLE: BWACCN=ACCESSION# FOR PROCEDURE.
+4 IF $$DECEASED^BWUTL1(BWDFN)
Begin DoDot:1
+5 WRITE !!?5,"This patient is registered as deceased."
DO DIRZ^BWUTL3
End DoDot:1
QUIT
+6 NEW DA,DIC,X
+7 SET X=BWDFN
KILL DD,DO
+8 SET DIC="^BWNOT("
SET DIC(0)="ML"
SET DLAYGO=9002086
+9 SET DIC("DR")=".02///T;.06///"_$SELECT($DATA(BWACCN):$PIECE(BWACCN,","),1:"")
+10 SET DIC("DR")=DIC("DR")_";.07////"_$GET(DUZ(2))_";.14///o"
+11 DO FILE^DICN
KILL DD,DO,DIC
+12 ;---> IF Y<0, CHECK PERMISSIONS.
+13 IF Y<0
DO ERROR1
QUIT
+14 DO EDIT2(+Y)
+15 QUIT
+16 ;
+17 ;
EDIT2(DA) ;EP - FROM BWBRNOT2
+1 ;---> REQUIRED VARIABLES: DA=IEN IN ^BWNOT(.
+2 NEW BWDA
DO SETVARS^BWUTL5
+3 SET BWDFN=$PIECE(^BWNOT(DA,0),U)
+4 DO SCREEN(DA,BWDFN,.BWPOP)
+5 IF BWPOP
QUIT
+6 IF $GET(DA)
SET BWDA=DA
DO PRINTNOW
+7 ;---> OPPORTUNITY TO EDIT PATIENT'S CASE DATA.
+8 ;---> IF $D(BWLOOP), NEW (ABOVE) WAS CALLED FROM CASEDATA^BWPATE,
+9 ;---> SO DON'T LOOP THROUGH AGAIN.
+10 IF '$DATA(BWLOOP)
DO CASEDATA^BWPATE(BWDFN)
+11 QUIT
+12 ;
+13 ;
SCREEN(DA,BWDFN,BWPOP) ;EP
+1 ;---> EDIT WITH SCREENMAN.
+2 ;---> NEEDS BWDFN FOR SCREEN ON ACCESSION# FIELD LOOKUP.
+3 SET DDSFILE=9002086.4
SET DR="[BW NOTIF-FORM-1]"
SET BWPOP=0
+4 ;---> IF THIS NOTIFICATION HAS ALREADY BEEN PRINTED, THEN DISALLOW
+5 ;---> THE USER TO EDIT MOST FIELDS BY USING FORM-2 BELOW.
+6 IF $PIECE(^BWNOT(DA,0),U,10)
SET DR="[BW NOTIF-FORM-2]"
+7 DO DDS^BWFMAN(DDSFILE,DR,DA,"","",.BWPOP)
+8 QUIT
+9 ;
+10 ;
PRINTNOW ;EP
+1 ;---> PRINT OR VIEW NOTIFICATION NOW, IF IT'S A LETTER.
+2 ;---> REQUIRED VARIABLE: BWDA=IEN IN ^BWNOT
+3 IF '$DATA(BWDA)
QUIT
+4 ;---> QUIT IF THIS NOTIFICATION DOES NOT HAVE A "TYPE OF NOTIFICATION".
+5 IF '$PIECE(^BWNOT(BWDA,0),U,3)
QUIT
+6 ;---> QUIT IF TYPE OF NOTIFICATION IS NOT PRINTABLE.
+7 IF '$PIECE(^BWNOTT($PIECE(^BWNOT(BWDA,0),U,3),0),U,2)
QUIT
+8 ;---> QUIT IF THIS NOTIFICATION HAS ALREADY BEEN PRINTED.
+9 ;Q:$P(^BWNOT(BWDA,0),U,10) ;DISABLED FOR NOW, ALLOW VIEW OR REPRINT.
+10 FOR
Begin DoDot:1
+11 NEW BWCRT,DA,DIR
+12 WRITE !!,"Do you wish to PREVIEW or PRINT this letter now?"
+13 SET DIR(0)="Y"
SET DIR("B")="NO"
DO HELP2
+14 DO ^DIR
KILL DIR
WRITE !
+15 IF $DATA(DIRUT)!(Y<1)
SET BWPOP=1
QUIT
+16 ;---> QUIT IF NOT ASSOCIATED WITH THE USER'S CURRENT FACILITY.
+17 NEW BWFACIL
SET BWFACIL=$PIECE(^BWNOT(BWDA,0),U,7)
+18 IF ((BWFACIL'=DUZ(2))&(BWFACIL))
Begin DoDot:2
+19 DO TEXT1^BWLETPR
DO DIRZ^BWUTL3
End DoDot:2
SET BWPOP=1
QUIT
+20 IF Y
DO DEVICE^BWLETPR
IF BWPOP
QUIT
DO PRINT^BWLETPR
End DoDot:1
IF BWPOP
QUIT
IF $PIECE(^BWNOT(BWDA,0),U,10)
QUIT
+21 QUIT
+22 ;
ERROR1 ;EP
+1 WRITE !!?10,*7,"NEW NOTIFICATION ENTRY FOR THIS PATIENT FAILED."
+2 DO DIRZ^BWUTL3
+3 QUIT
+4 ;
ADDNOTIF ;EP
+1 ;---> ADD NEW NOTIFICATION.
+2 ;---> AT PRESENT THIS EP IS NOT CALLED BY ANTHING.
+3 WRITE !,"Do you wish to add a NEW Notification for this patient?"
+4 SET DIR(0)="Y"
SET DIR("B")="NO"
DO HELP1
+5 DO ^DIR
KILL DIR
WRITE !
+6 IF Y
Begin DoDot:1
+7 NEW BWLOOP,DIC,DIE,Y
+8 SET Y=BWDFN
SET BWLOOP=1
DO NEW(BWDFN)
End DoDot:1
+9 QUIT
+10 ;
HELP1 ;EP
+1 ;;Enter YES to add a NEW Notification for this patient. If the
+2 ;;notification is a letter, the letter may be queued to print shortly
+3 ;;before the patient's next appointment by selecting an appropriate
+4 ;;"Print Date".
+5 SET BWTAB=5
SET BWLINL="HELP1"
DO HELPTX
+6 QUIT
+7 ;
HELP2 ;EP
+1 ;;"Preview" allows you to look at the letter that has just been queued.
+2 ;;To preview this letter, select HOME at the "DEVICE: " prompt.
+3 ;;
+4 ;;"Print" will print the letter now (regardless of its "Print Date")
+5 ;;and remove it from the queue of letters waiting to print.
+6 ;;To print this letter now, select a printer at the "DEVICE: " prompt.
+7 SET BWTAB=5
SET BWLINL="HELP2"
DO HELPTX
+8 QUIT
+9 ;
HELPTX ;EP
+1 ;---> CREATES DIR ARRAY FOR DIR. REQUIRED VARIABLES: BWTAB,BWLINL.
+2 NEW I,T,X
SET T=""
FOR I=1:1:BWTAB
SET T=T_" "
+3 FOR I=1:1
SET X=$TEXT(@BWLINL+I)
IF X'[";;"
QUIT
SET DIR("?",I)=T_$PIECE(X,";;",2)
+4 SET DIR("?")=DIR("?",I-1)
KILL DIR("?",I-1)
+5 QUIT