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

WVBRNOT.m

Go to the documentation of this file.
WVBRNOT ;HCIOFO/FT,JR IHS/ANMC/MWR - BROWSE NOTIFICATIONS; ;7/30/98  11:02
 ;;1.0;WOMEN'S HEALTH;;Sep 30, 1998
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  CALLED BY OPTION: "WV BROWSE NOTIFICATIONS" TO BROWSE AND EDIT
 ;;  NOTIFICATIONS.
 ;
 ;---> VARIABLES:
 ;---> WVA:   1=ALL PATIENTS, 0=ONE PATIENT
 ;---> WVDFN: DFN OF SELECTED PATIENT
 ;---> DATES: WVBEGDT=BEGINNING DATE, WVENDDT=ENDING DATE
 ;---> WVB:   d=DELINQUENT, o=OPEN, q=queued, a=ALL (includes CLOSED).
 ;---> SORT SEQUENCE IN WVC:  1=DATE, PATIENT, PRIORITY
 ;--->                        2=PATIENT, DATE, PRIORITY
 ;--->                        3=PRIORITY, DATE, PATIENT
 ;---> USE NODES 3 & 4 IN ^TMP GLOBAL.
 ;
 D SETVARS^WVUTL5
 D ^WVBRNOT2 G:WVPOP EXIT
 D SORT
 D COPYGBL
 D ^WVBRNOT1
 ;
EXIT ;EP
 D KILLALL^WVUTL8
 Q
 ;
 ;
SORT ;EP
 ;---> SORT AND STORE ARRAY IN ^TMP("WV",$J
 K ^TMP("WV",$J)
 ;---> WVBEGDT1=ONE SECOND BEFORE BEGIN DATE.
 ;---> WVENDDT1=THE LAST SECOND OF END DATE.
 S WVBEGDT1=WVBEGDT-.0001,WVENDDT1=WVENDDT+.9999
 ;
 ;**************************
 ;---> WVA=1: ALL PATIENTS
 I WVA D  Q
 .;---> BY DATE GET EITHER ALL OR OPEN ONLY.
 .N WVDFN,WVIEN,Y
 .S WVXREF=$S(WVB="a":"D",WVB="q":"APRT",1:"AOPEN")
 .S WVDATE=WVBEGDT1
 .F  S WVDATE=$O(^WV(790.4,WVXREF,WVDATE)) Q:'WVDATE!(WVDATE>WVENDDT1)  D
 ..S WVIEN=0
 ..F  S WVIEN=$O(^WV(790.4,WVXREF,WVDATE,WVIEN)) Q:'WVIEN  D
 ...Q:'$D(^WV(790.4,WVIEN,0))
 ...S Y=^WV(790.4,WVIEN,0),WVDFN=$P(Y,U)
 ...;---> QUIT IF SELECTING FOR ONE CASE MANAGER AND THIS DOESN'T MATCH.
 ...I 'WVE Q:$P(^WV(790,WVDFN,0),U,10)'=WVCMGR
 ...;---> QUIT IF LISTING "DELINQUENT" AND THIS PROCDURE IS NOT DELINQ.
 ...I WVB="d" Q:$P(Y,U,13)'<DT!($P(Y,U,13)="")
 ...D STORE
 ;
 ;**************************
 ;---> WVA=0: ONE PATIENT
 N WVIEN,Y S WVIEN=0
 F  S WVIEN=$O(^WV(790.4,"B",WVDFN,WVIEN)) Q:'WVIEN  D
 .S Y=^WV(790.4,WVIEN,0)
 .;---> QUIT IF NOT WITHIN DATE RANGE.
 .S WVDATE=$P(Y,U,2)
 .Q:WVDATE'>WVBEGDT1!(WVDATE>WVENDDT1)
 .;---> QUIT IF "QUEUED" AND THIS NOTIFICATION IS NOT QUEUED.
 .I WVB="q" Q:'$P(Y,U,11)  Q:'$D(^WV(790.4,"APRT",$P(Y,U,11),WVIEN))
 .;---> QUIT IF "DELINQUENT" OR OPEN ONLY AND THIS ENTRY IS CLOSED.
 .Q:"do"[WVB&($P(Y,U,14)="c")
 .I WVB="d" Q:$P(Y,U,13)'<DT!($P(Y,U,13)="")
 .D STORE
 Q
 ;
STORE ;EP
 ;--->WVDATE IS ALREADY SET FROM LL SORT ABOVE.      ;---> DATE
 S WVCHRT=$$SSN^WVUTL1(WVDFN)_" "                    ;---> SSN#
 S WVNAME=$$NAME^WVUTL1(WVDFN)                       ;---> NAME
 S WVACC=$P(Y,U,6)                                   ;---> ACCESSION#
 I WVACC]"" S WVACC=$P(^WV(790.1,WVACC,0),U)
 S WVSTAT=$$STATUS^WVUTL4                            ;---> STATUS
 S WVPRIO=9
 S:$P(Y,U,4)]"" WVPRIO=$P(^WV(790.404,$P(Y,U,4),0),U,2)  ;---> PRIORITY
 ;
 S X=WVCHRT_U_WVNAME_U_WVDATE_U_WVACC_U_WVSTAT_U_WVPRIO_U_WVIEN
 I WVC=1 S ^TMP("WV",$J,3,WVDATE,WVNAME,WVPRIO,WVIEN)=X Q
 I WVC=2 S ^TMP("WV",$J,3,WVNAME,WVDATE,WVPRIO,WVIEN)=X Q
 I WVC=3 S ^TMP("WV",$J,3,WVPRIO,WVDATE,WVNAME,WVIEN)=X
 Q
 ;
COPYGBL ;EP
 ;---> COPY ^TMP("WV",$J,3 TO ^TMP("WV",$J,4 TO MAKE IT FLAT.
 N I,M,N,P,Q
 S N=0,I=0
 F  S N=$O(^TMP("WV",$J,3,N)) Q:N=""  D
 .S M=0
 .F  S M=$O(^TMP("WV",$J,3,N,M)) Q:M=""  D
 ..S P=0
 ..F  S P=$O(^TMP("WV",$J,3,N,M,P)) Q:P=""  D
 ...S Q=0
 ...F  S Q=$O(^TMP("WV",$J,3,N,M,P,Q)) Q:Q=""  D
 ....S I=I+1,^TMP("WV",$J,4,I)=^TMP("WV",$J,3,N,M,P,Q)
 Q
 ;
 ;
DEQUEUE ;EP
 ;---> TASKMAN QUEUE OF PRINTOUT.
 D SETVARS^WVUTL5,SORT,COPYGBL,^WVBRNOT1,EXIT
 Q
 ;
FOLLOW(WVDFN) ;EP
 ;---> CALLED FROM PROCEDURE FOLLOWUP MENU.
 D SETVARS^WVUTL5
 S WVA=0,WVB="o",WVBEGDT=(DT-50000),WVC=1,WVE=1,WVENDDT=DT
 D DEVICE^WVBRNOT2 Q:WVPOP
 S WVLOOP=1
 D SORT,COPYGBL,^WVBRNOT1
 Q