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

BWUTL2.m

Go to the documentation of this file.
BWUTL2 ;IHS/ANMC/MWR - UTIL: ZIS, XREF, PROSCREEN;17-Apr-2003 12:02;PLS
 ;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  UTILITY: ZIS, MUMPS XREFS ON NORMAL/ABNORMAL AND ON STATUS.
 ;;  PROCSCRN-SCREEN ON RESULT/DIAGNOSIS BASED ON PROCEDURE.
 ;
 ;
ZIS(BWPOP,BWQUE,BWDEF,BWPRMPT,BWMES) ;EP
 ;---> CALL TO ^%ZIS
 ;---> PARAMETERS:
 ;     1 - BWPOP         (RETURNED) BWPOP=1 IF POP=1 (FAIL OR QUIT).
 ;     2 - BWQUE=1       (OPTIONAL) SET=1 IF JOB SHOULD BW QUEUEABLE.
 ;     3 - BWDEF=DEFAULT (OPTIONAL) IF EXISTS, EQUALS DEFAULT DEVICE.
 ;     4 - BWPRMPT       (OPTIONAL) IF EXISTS, EQUALS PROMPT.
 ;     5 - BWMES         (OPTIONAL) A MESSAGE TO DISPLAY IF QUEUED.
 ;
 ;---> EXAMPLE: D ZIS^BWUTL2(.BWPOP,1,"HOME")
 ;
ZIS1 ;EP FOR LOOP BACK FROM FAILED BWQUE.
 S BWPOP=0
 ;
 ;---> BWPRMPT=BWPRMPT.
 S %ZIS("A")=$S($D(BWPRMPT):BWPRMPT,1:"   Select DEVICE: ")
 ;
 ;---> BWDEF=DEFAULT PRINTER.
 ;---> IF NO BWDEF, SET BWDEF="P" FOR CLOSEST PRINTER.
 D
 .I '$D(BWDEF) S %ZIS="P" Q
 .S %ZIS("B")=BWDEF,%ZIS=""
 ;
 ;---> IF BWQUE=1,JOB MAY BE QUEUED.
 I $G(BWQUE)]"" I BWQUE S %ZIS=%ZIS_"Q"
 ;
 W ! D ^%ZIS S:POP BWPOP=1
 ;---> QUIT IF BWPOP (DUOUT OR DTOUT) OR IF NOT BWQUED.
 G:BWPOP!('$D(IO("Q"))) ZISEXIT
 ;
 I IO=IO(0) W !?5,"Cannot queue to screen or slave printer!",! G ZIS1
 ;
 ;---> NEXT LINE: LINE LABEL "ZISQ" ADDED FOR ENTRY WHERE DEVICE
 ;---> INFO HAS ALREADY BEEN ASKED AND USER BWQUED OUTPUT.
ZISQ ;EP
 ;---> NEXT LINES: JOB WAS QUEUED, THEREFORE SET BWPOP=1 SO THAT THE
 ;---> CALLING ROUTINE WILL QUIT (AND LET TASKMAN FINISH THIS JOB).
 S BWPOP=1
 I '$D(ZTRTN) D  G ZISEXIT
 .W !?5,*7,"NO ROUTINE NAMED FOR QUEUEING -- CONTACT PROGRAMMER."
 I '$D(ZTDESC) S ZTDESC=ZTRTN
 S BWMES=$S($D(BWMES):BWMES,1:"W !?5,""Request Queued."",!")
 ;
 S ZTIO=$S($D(ION):ION,1:"")
 I ZTIO]"" D
 .I $D(IO("DOC")) S ZTIO=ZTIO_";"_IOST_";"_IO("DOC") Q
 .S ZTIO=ZTIO_";"_IOST_";"_IOM_";"_IOSL
 D ^%ZTLOAD,^%ZISC
 ;---> SET BWPOP=1 TO TELL CALLING ROUTINE TO QUIT (LET TASKMAN FINISH).
 S BWPOP=1
 X:$D(ZTSK) BWMES H 2
 ;
ZISEXIT ;EP
 K BWMES,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
 Q
 ;
 ;
XREFP05 ;EP
 ;---> CALLED BY MUMPS "ABNML" XREF ON FIELD .05 IN FILE 9002086.1.
 ;---> REINDEX RESULTS FIELD .05 IN BW PROCEDURE FILE, BY DATE
 ;---> (PIECE 12), WHEN RESULT/DIAGNOSIS IS "ABNORMAL" (AS STORED IN
 ;---> PIECE 21 OF THE POINTED TO BW RESULTS/DIAGNOSIS ENTRY).
 ;---> X=IEN BW RESULT/DIAGNOSIS, DA=ENTRY IN BW PROCEDURE FILE.
 Q:'$P(^BWPCD(DA,0),U,12)
 I $P(^BWDIAG(X,0),U,21) S ^BWPCD("ABNML",$P(^BWPCD(DA,0),U,12),DA)="" Q
 K ^BWPCD("ABNML",$P(^BWPCD(DA,0),U,12),DA)
 Q
 ;
XREFP12 ;EP
 ;---> CALLED BY MUMPS "ABNML1" XREF ON FIELD .12 IN FILE 9002086.1.
 ;---> LOGIC TO REINDEX RESULTS FIELD .05 IN BW PROCEDURE FILE WHEN
 ;---> DATE OF PROCEDURE .12 FIELD IS CHANGED.  X=NEWDATE, DA=ENTRY.
 ;---> SEE XREFP05 ABOVE.
 I '$P(^BWPCD(DA,0),U,5) S ^BWPCD("ABNML",X,DA)="" Q
 I $P(^BWDIAG($P(^BWPCD(DA,0),U,5),0),U,21) S ^BWPCD("ABNML",X,DA)="" Q
 K ^BWPCD("ABNML",X,DA)
 Q
 ;
REXREFN ;EP
 ;---> CALLED BY MUMPS XREF ON FIELD .02 IN FILE 9002086.4.
 ;---> LOGIC TO REINDEX STATUS FIELD .14 IN BW NOTIFICATION FILE
 ;---> WHEN DATE NOTIFICATION OPENED .02 FIELD IS CHANGED.
 ;---> X=NEWDATE, DA=ENTRY.
 ;---> NOTE: IF STATUS IS NULL XREF FOR "AOPEN" GETS SET HERE.
 I $P(^BWNOT(DA,0),U,2) K ^BWNOT("AOPEN",$P(^(0),U,2),DA)
 I "o"[$P(^BWNOT(DA,0),U,14) S ^BWNOT("AOPEN",X,DA)=""
 Q
 ;
 ;
PROCSCRN ;EP
 ;---> SCREEN WHEN SELECTING RESULTS/DIAGNOSIS FOR PROCEDURES.
 ;---> CALLED BY DIC("S")="D PROCSCRN^BWUTL2" IN SCREEN FOR SEVERAL
 ;---> FIELDS IN BW PROCEDURE FILE.
 ;---> REQUIRED VARIABLES: BWPN=IEN OF PROCEDURE TYPE
 ;--->                        Y=IEN OF RES/DIAG BEING SCREENED
 ;---> EACH LINE MAKES THE RES/DIAG AVAILABLE FOR SELECTION IF:
 ;---> 1ST LINE: IF SCREEN VARIABLES ARE UNDEFINED (IE, ALL SELECTABLE).
 ;---> 2ND LINE: IF RES/DIAG IS FOR ALL & THIS PROCEDURE IS NOT EXCLUDED
 ;---> 3RD LINE: IF A "P" XREF FOR THIS PROCEDURE AND RES/DIAG EXISTS.
 ;---> 4TH LINE: OTHERWISE RES/DIAG FAILS SCREEN AND IS NOT SELECTABLE.
 Q:'$D(BWPN)!('$D(Y))
 Q:$P(^BWDIAG(Y,0),U,20)
 Q:$D(^BWDIAG("P",BWPN,Y))
 I 0
 Q
 ;
PAPSCRN ;EP
 ;---> SCREEN CALLED BY FILEMAN ^DD.
 ;---> SCREEN WHEN SELECTING THE PAP THAT INITIATED THIS COLPOSCOPY.
 ;---> CALLED BY DIC("S")="D PAPSCRN^BWUTL2" IN FIELD .3 OF
 ;---> BW PROCEDURE FILE: FIRST CHECK IF THE PROCEDURE IS FOR THIS
 ;---> PATIENT, THEN MAKE SURE IT'S A PAP.
 Q:$P(^(0),U,2)=+$G(BWDFN)&($P(^(0),U,4)=1)
 I 0
 Q
 ;
ERRCD(X,W,Y) ;EP
 ;---> DISPLAY ERROR CODE FROM BW ERROR CODE FILE.
 ;---> REQUIRED VARIABLE: X=IEN OF ERROR CODE.
 ;---> OPTIONAL VARIABLE: W=1 IF TEXT SHOULD NOT BE WRITTEN OUT.
 ;---> RETURNED VARIABLE: Y=TEXT OF ERROR CODE.
 ;
 S:$G(W)'=1 W=0
 I '+$G(X) D ERRW() Q
 I '$D(^BWERR(X,0)) D  Q
 .S Y="Error Code does not exist in BW ERROR CODE File." D:'W ERRW(Y)
 S Y=$P(^BWERR(X,0),U,2) D:'W ERRW(Y)
 Q
 ;
ERRW(X) ;EP
 ;---> WRITE OUT ERROR CODE.
 W !!?5,"Data for this Procedure was NOT passed to PCC because:"
 I $G(X)']"" W !?5,"NO ERROR CODE PROVIDED.",! Q
 W !?5,X,! D DIRZ^BWUTL3
 Q