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

BWBRPCD.m

Go to the documentation of this file.
BWBRPCD ;IHS/ANMC/MWR - BROWSE PROCEDURES;27-Feb-2003 22:26;PLS
 ;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  CALLED BY OPTION: "BW BROWSE PROCEDURES" TO BROWSE AND EDIT
 ;;  PROCEDURES.
 ;
 ;---> VARIABLES:
 ;---> BWA:   1=ALL PATIENTS, 0=ONE PATIENT
 ;---> BWDFN: DFN OF SELECTED PATIENT
 ;---> DATES: BWBEGDT=BEGINNING DATE, BWENDDT=ENDING DATE
 ;---> BWD:   1=BOTH ABNORMAL AND NORMAL, 0=NORMAL ONLY
 ;---> SORT SEQUENCE IN BWC:  1=DATE, PATIENT, PRIORITY
 ;--->                        2=PATIENT, DATE, PRIORITY
 ;--->                        3=PRIORITY, DATE, PATIENT
 ;---> USE NODES 1 & 2 IN ^TMP GLOBAL
 ;
 D SETVARS^BWUTL5 S BWPOP=0
 D ^BWBRPCD2 G:BWPOP EXIT
 D SORT
 D COPYGBL
 ;---> NEXT LINE: PASS TITLE, HEADER (IN ^BWUTL7), AND CODE TO
 ;---> EXECUTE BY DIR AT BOTTOM OF SCREEN.
 D DISPLAY^BWBRPCD1(BWTITLE,BWHEADER,BWCODE)
 ;
EXIT ;EP
 D KILLALL^BWUTL8
 Q
 ;
 ;
SORT ;EP
 ;---> SORT AND STORE ARRAY IN ^TMP("BW",$J
 N BWPROC
 K ^TMP("BW",$J)
 ;---> BWBEGDT1=ONE SECOND BEFORE BEGIN DATE.
 ;---> BWENDDT1=THE LAST SECOND OF END DATE.
 S BWBEGDT1=BWBEGDT-.0001,BWENDDT1=BWENDDT+.9999
 ;
 ;***********************
 ;---> BWA=1 ALL PATIENTS
 I BWA D  Q
 .;---> BY DATE GET EITHER ALL OR ABNORMAL ONLY.
 .;---> ("INSUFFICIENT TISSUE" IS INCLUDED IN ABNML XREF.)
 .S BWXREF=$S(BWD:"D",1:"ABNML")
 .S BWDATE=BWBEGDT1
 .F  S BWDATE=$O(^BWPCD(BWXREF,BWDATE)) Q:'BWDATE!(BWDATE>BWENDDT1)  D
 ..S BWIEN=0
 ..F  S BWIEN=$O(^BWPCD(BWXREF,BWDATE,BWIEN)) Q:'BWIEN  D
 ...S Y=^BWPCD(BWIEN,0),BWDFN=$P(Y,U,2),BWPROC=+$P(Y,U,4)
 ...;---> QUIT IF THIS PROCEDURE HAS A RESULT OF "ERROR/DISREGARD".
 ...Q:$P(Y,U,5)=8
 ...;---> QUIT IF NOT SELECTING FOR ALL PROCEDURES AND IF THIS IS
 ...;---> NOT ONE OF THE SELECTED PROCEDURES.
 ...I '$D(BWARR("ALL"))  Q:'$D(BWARR(BWPROC))
 ...;---> QUIT IF NOT "ALL PROCEDURES" AND THIS ENTRY IS "CLOSED".
 ...Q:BWB'="a"&($P(Y,U,14)="c")
 ...;---> QUIT IF SELECTING FOR ONE CASE MANAGER AND THIS DOESN'T MATCH.
 ...I 'BWE Q:$P(^BWP(BWDFN,0),U,10)'=BWCMGR
 ...;---> QUIT IF LISTING "DELINQUENT" AND THIS PROCDURE IS NOT DELINQ.
 ...I BWB="d" Q:$P(Y,U,13)>DT!($P(Y,U,13)="")
 ...;---> QUIT IF LISTING "NEW" AND THIS PROCDURE IS NOT NEW.
 ...Q:BWB="n"&($P(Y,U,14)'="n")
 ...D STORE(BWC,BWIEN,Y)
 ;
 ;**********************
 ;---> BWA=0 ONE PATIENT
 S BWIEN=0
 F  S BWIEN=$O(^BWPCD("C",BWDFN,BWIEN)) Q:'BWIEN  D
 .;---> SET Y=THE ZERO NODE FOR THIS PROCEDURE.
 .S Y=^BWPCD(BWIEN,0)
 .;---> QUIT IF THIS PROCEDURE HAS A RESULT OF "ERROR/DISREGARD".
 .Q:$P(Y,U,5)=8
 .;---> QUIT IF NOT WITHIN DATE RANGE.
 .S BWDATE=$P(Y,U,12)
 .Q:BWDATE'>BWBEGDT1!(BWDATE>BWENDDT1)
 .;---> QUIT IF SELECTING FOR "ABNORMAL" ONLY AND THIS PROCEDURE
 .;---> "NORMAL". ("INSUFF TISSUE" AND "UNSAT EXAM" WILL BE "ABNORMAL".)
 .Q:'BWD&('$$NORMAL^BWUTL4($P(Y,U,5)))
 .;---> QUIT IF "DELINQUENT" OR "OPEN" ONLY AND THIS ENTRY IS "CLOSED".
 .Q:BWB'="a"&($P(Y,U,14)="c")
 .;---> QUIT IF LISTING "DELINQUENT" AND THIS PROCDURE IS NOT DELINQ.
 .I BWB="d" Q:$P(Y,U,13)>DT!($P(Y,U,13)="")
 .Q:BWB="n"&($P(Y,U,14)'="n")
 .D STORE(BWC,BWIEN,Y)
 Q
 ;
STORE(BWC,BWIEN,Y) ;EP
 ;---> CALLED TO STORE PROCEDURES IN ^TMP FOR BROWSING.
 ;---> BWC=LIST ORDER, BWIEN=IEN OR PROCEDURE, Y=ZERO NODE OF PROCEDURE.
 S BWDFN=$P(Y,U,2),BWDATE=$P(Y,U,12)                   ;---> DFN, DATE
 S BWCHRT=$$HRCN^BWUTL1(BWDFN)                         ;---> CHART#
 S BWNAME=$$NAME^BWUTL1(BWDFN)                         ;---> NAME
 S BWACC=$P(Y,U)                                       ;---> ACCESSION#
 S BWSTAT=$E($$STATUS^BWUTL4)                          ;---> STATUS
 S BWDIAG=$$DIAG^BWUTL4($P(Y,U,5))                     ;---> RESULT/DIAG
 S X=$P(Y,U,5),BWPRIO=$$PRIOR^BWUTL4 K X               ;---> PRIORITY
 ;
 S X=BWCHRT_U_BWNAME_U_BWDATE_U_BWACC_U_BWDIAG_U_BWPRIO_U_BWSTAT_U_BWIEN
 I BWC=1 S ^TMP("BW",$J,1,BWDATE,BWNAME,BWPRIO,BWIEN)=X Q
 I BWC=2 S ^TMP("BW",$J,1,BWNAME,BWDATE,BWPRIO,BWIEN)=X Q
 I BWC=3 S ^TMP("BW",$J,1,BWPRIO,BWDATE,BWNAME,BWIEN)=X
 Q
 ;
COPYGBL ;EP
 ;---> CALLED TO FLATTEN THE ^TMP ARRAY OF PROCEDURES FOR BROWSING.
 ;---> COPY ^TMP("BW",$J,1 TO ^TMP("BW",$J,2 TO MAKE IT FLAT.
 N I,M,N,P,Q
 S N=0,I=0
 F  S N=$O(^TMP("BW",$J,1,N)) Q:N=""  D
 .S M=0
 .F  S M=$O(^TMP("BW",$J,1,N,M)) Q:M=""  D
 ..S P=0
 ..F  S P=$O(^TMP("BW",$J,1,N,M,P)) Q:P=""  D
 ...S Q=0
 ...F  S Q=$O(^TMP("BW",$J,1,N,M,P,Q)) Q:Q=""  D
 ....S I=I+1,^TMP("BW",$J,2,I)=^TMP("BW",$J,1,N,M,P,Q)
 Q
 ;
DEQUEUE ;EP
 ;---> FOR TASKMAN QUEUE OF PRINTOUT.
 D SETVARS^BWUTL5,SORT,COPYGBL
 D DISPLAY^BWBRPCD1(BWTITLE,BWHEADER,BWCODE)
 D EXIT
 Q