Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BWNOTIF

BWNOTIF.m

Go to the documentation of this file.
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