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

BWDIAG.m

Go to the documentation of this file.
BWDIAG ;IHS/ANMC/MWR - PRINTOUT OF BW DIAGNOSIS FILE;15-Feb-2003 21:50;PLS
 ;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  CALLED BY OPTION: "BW PRINT RES/DIAG FILE" TO PRINT THE
 ;;  RESULTS/DIAGNOSIS TABLE FILE.
 ;
 D SETUP
 D TITLE^BWUTL5("LISTING OF RESULTS/DIAGNOSIS FILE")
 D DEVICE Q:BWPOP
 D SORT
 D DISPLAY
 ;
EXIT ;EP
 D KILLALL^BWUTL8
 Q
 ;
SETUP ;EP
 D SETVARS^BWUTL5 S BWPOP=0
 S BWLINE="-" F I=1:1:79 S BWLINE=BWLINE_"-"
 Q
 ;
DEVICE ;EP
 ;---> GET DEVICE AND POSSIBLY QUEUE TO TASKMAN.
 S ZTRTN="DEQUEUE^BWDIAG"
 F BWSV="BWLINE","BWTITLE" D
 .I $D(BWSV) S ZTSAVE(BWSV)=""
 D ZIS^BWUTL2(.BWPOP,1)
 Q
 ;
SORT ;EP
 ;---> SORT BY RESULT/DIAGNOSIS.  STORED IN ^TMP("BW",$J,1
 N N,X,Y K ^TMP("BW",$J)
 S N=0
 F  S N=$O(^BWDIAG("B",N)) Q:N=""  D
 .S M=$O(^BWDIAG("B",N,0))
 .S Y=^BWDIAG(M,0),BWDIAG=N
 .F I=3:1:19 I $P(Y,U,I) D
 ..S BWPN=$E($P(^BWPN($P(Y,U,I),0),U),1,30)
 ..S X=$P(Y,U,21),BWNORM=$S(X=0:"NORMAL",X=2:"NO RES",1:"ABNORM")
 ..S BWPRIO=$P(Y,U,2)
 ..S X=BWDIAG_U_BWPRIO_U_BWNORM_U_BWPN
 ..S ^TMP("BW",$J,1,BWDIAG,BWPN,1)=X
 .I $P(Y,U,20) D
 ..S X=$P(Y,U,21),BWNORM=$S(X=0:"NORMAL",X=2:"NO RES",1:"ABNORM")
 ..S BWPRIO=$P(Y,U,2),BWPN="ALL PROCEDURES"
 ..S X=BWDIAG_U_BWPRIO_U_BWNORM_U_BWPN
 ..S ^TMP("BW",$J,1,BWDIAG,BWPN,1)=X
 ;
 ;---> SORT BY PROCEDURE TYPE.  STORED IN ^TMP("BW",$J,2
 S N=0
 F  S N=$O(^BWDIAG("P",N)) Q:N=""  D
 .S M=0
 .F  S M=$O(^BWDIAG("P",N,M)) Q:M=""  D
 ..S Y=^BWDIAG(M,0)
 ..S BWPN=$P(^BWPN(N,0),U),BWDIAG=$P(Y,U)
 ..S X=$P(Y,U,21),BWNORM=$S(X=0:"NORMAL",X=2:"NO RES",1:"ABNORM")
 ..S BWPRIO=$P(Y,U,2)
 ..S X=BWPN_U_BWDIAG_U_BWPRIO_U_BWNORM
 ..S ^TMP("BW",$J,2,BWPN,BWPRIO,BWDIAG)=X
 ;
 ;---> ASSOCIATED WITH ALL PROCEDURES
 S N=0
 F  S N=$O(^BWDIAG(N)) Q:'N  D
 .S Y=^BWDIAG(N,0)
 .Q:'$P(Y,U,20)
 .S BWDIAG=$P(Y,U),BWPRIO=$P(Y,U,2)
 .S X=$P(Y,U,21),BWNORM=$S(X=0:"NORMAL",X=2:"NO RES",1:"ABNORM")
 .S M=0
 .F  S M=$O(^BWPN(M)) Q:'M  D
 ..S BWPN=$P(^BWPN(M,0),U)
 ..Q:$P(^BWPN(M,0),U,12)
 ..S X=BWPN_U_BWDIAG_U_BWPRIO_U_BWNORM
 ..S ^TMP("BW",$J,2,BWPN,BWPRIO,BWDIAG)=X
 ;
 ;---> SORT BY PRIORITY.  STORED IN ^TMP("BW",$J,3
 S N=0
 F  S N=$O(^BWDIAG("B",N)) Q:N=""  D
 .S M=$O(^BWDIAG("B",N,0))
 .S Y=^BWDIAG(M,0),BWDIAG=N,BWPRIO=$P(Y,U,2)
 .S X=$P(Y,U,21),BWNORM=$S(X=0:"NORMAL",X=2:"NO RES",1:"ABNORM")
 .S X=BWDIAG_U_BWPRIO_U_BWNORM
 .S ^TMP("BW",$J,3,BWPRIO,BWDIAG,1)=X
 ;
 ;---> COPY TO TMP IN A SINGLE SUBSCRIPT.
 F BWS=1,2,3 S BWSS=BWS_BWS D COPYGBL
 Q
 ;
DISPLAY ;EP
 U IO
 S BWTITLE1="*  WOMEN'S HEALTH: LISTING OF RESULTS/DIAGNOSIS FILE  *"
 D CENTERT^BWUTL5(.BWTITLE1)
 S BWCRT=$S($E(IOST)="C":1,1:0),(BWPAGE,BWPOP)=0
 F BWI=22,33,11 D @("DISPLY"_BWI) Q:BWPOP
 W:'BWCRT @IOF
 D ^%ZISC
 Q
 ;
DISPLY11 ;EP
 ;---> LIST BY RESULT/DIAGNOSIS
 ;Q
 S BWTITLE2=" * BY DIAGNOSIS *" D CENTERT^BWUTL5(.BWTITLE2)
 S BWSUB="W !?3,""RESULT/DIAGNOSIS"",?31,""PRIORITY"",?42,""NORMAL"","
 S BWSUB=BWSUB_"?50,""ASSOCIATED PROCEDURES"""
 N Z S (BWPOP,N,Z)=0
 W:BWCRT @IOF D HEADER
 F  S N=$O(^TMP("BW",$J,BWI,N)) Q:'N!(BWPOP)  D
 .I $Y+8>IOSL D:BWCRT DIRZ^BWUTL3 Q:BWPOP  D HEADER
 .S Y=^TMP("BW",$J,BWI,N) W !
 .I $P(Y,U)'=Z W !?3,$P(Y,U),?37,$J($P(Y,U,2),2),?42,$P(Y,U,3)
 .W ?50,$P(Y,U,4)
 .S Z=$P(Y,U)
 I BWCRT&('BWPOP) W !! D DIRZ^BWUTL3
 Q
 ;
DISPLY22 ;EP
 ;---> LIST BY RESULT/DIAGNOSIS
 S BWTITLE2=" * BY PROCEDURE *" D CENTERT^BWUTL5(.BWTITLE2)
 S BWSUB="W !?3,""PROCEDURE"",?35,""RESULT/DIAGNOSIS"""
 S BWSUB=BWSUB_",?62,""PRIORITY"",?72,""NORMAL"""
 N Z S (BWPOP,N,Z)=0
 W:BWCRT @IOF D HEADER
 F  S N=$O(^TMP("BW",$J,BWI,N)) Q:'N!(BWPOP)  D
 .I $Y+6>IOSL D:BWCRT DIRZ^BWUTL3 Q:BWPOP  D HEADER
 .S Y=^TMP("BW",$J,BWI,N) W !
 .I $P(Y,U)'=Z W !?3,$P(Y,U)
 .W ?35,$P(Y,U,2),?68,$J($P(Y,U,3),2),?72,$P(Y,U,4)
 .S Z=$P(Y,U)
 I BWCRT&('BWPOP) W !! D DIRZ^BWUTL3
 Q
 ;
DISPLY33 ;EP
 ;---> LIST BY RESULT/DIAGNOSIS
 S BWTITLE2=" * BY PRIORITY *" D CENTERT^BWUTL5(.BWTITLE2)
 S BWSUB="W !?3,""RESULT/DIAGNOSIS"",?32,""PRIORITY"",?44,""NORMAL"""
 N Z S (BWPOP,N,Z)=0
 W:BWCRT @IOF D HEADER
 F  S N=$O(^TMP("BW",$J,BWI,N)) Q:'N!(BWPOP)  D
 .I $Y+6>IOSL D:BWCRT DIRZ^BWUTL3 Q:BWPOP  D HEADER
 .S Y=^TMP("BW",$J,BWI,N)
 .W !?3,$P(Y,U),?37,$J($P(Y,U,2),2),?44,$P(Y,U,3)
 .S Z=$P(Y,U)
 I BWCRT&('BWPOP) W !! D DIRZ^BWUTL3
 Q
 ;
 ;
 W:BWPAGE @IOF S BWPAGE=BWPAGE+1,Z=0
 W BWTITLE1,?70,"PAGE ",BWPAGE,!,BWTITLE2
 W !,BWLINE X BWSUB W !,BWLINE
 Q
 ;
COPYGBL ;EP
 ;---> COPY ^TMP("BW",$J,BWS TO ^TMP("BW",$J,BWSS TO MAKE IT FLAT.
 N I,M,N,P,Q
 S N=0,I=0
 F  S N=$O(^TMP("BW",$J,BWS,N)) Q:N=""  D
 .S M=0
 .F  S M=$O(^TMP("BW",$J,BWS,N,M)) Q:M=""  D
 ..S P=0
 ..F  S P=$O(^TMP("BW",$J,BWS,N,M,P)) Q:P=""  D
 ...S I=I+1,^TMP("BW",$J,BWSS,I)=^TMP("BW",$J,BWS,N,M,P)
 Q
 ;
DEQUEUE ;EP
 ;---> CALLED BY TASKMAN
 D SETVARS^BWUTL5,SORT,DISPLAY,EXIT
 Q