BWGRVLU2 ; IHS/CMI/LAB - GEN RETR UTILITIES - CON'T ;03-Sep-2003 20:09;PLS
;;2.0;WOMEN'S HEALTH;**9**;SEP 02, 2003
; Print Notifications Types that contain the TXT value in their name
; VIEN = Represents either Patient or Procedure IEN dependent upon report context
; TXT = Notification Type must contain this text if present
; PRM = 0= just time, 1=time and date, 2=time, date, and type
NOTIFP(VIEN,TXT,PRM) ;
N NIEN,XRF,LP
S TXT=$G(TXT,""),PRM=$G(PRM,0)
I BWGRPTVS="P" D
.; Process patient
.S XRF="B"
.S LP=VIEN
E D
.; Process procedure
.S XRF="C"
.S LP=$$GET1^DIQ(9002086.1,VIEN,.01,"I")
S NIEN=0 F S NIEN=$O(^BWNOT(XRF,LP,NIEN)) Q:NIEN="" D
.D ADDNOTIF(NIEN,TXT,PRM)
Q
ADDNOTIF(NIEN,TXT,PRM) ; Add notification to array
N NTYP,VAL
S NTYP=$$GET1^DIQ(9002086.4,NIEN,.03,"E")
; Check to see if notification types have been restricted
Q:($L(TXT)&(NTYP'[TXT))
S VAL=$$GET1^DIQ(9002086.4,NIEN,.15,"I")
S:PRM>0 VAL=VAL_" "_$$FMTE^XLFDT($$GET1^DIQ(9002086.4,NIEN,.02,"I"),"5ZD")
S:PRM>1 VAL=VAL_" "_NTYP
S BWGRPCNT=$G(BWGRPCNT)+1,BWGRPRNM(BWGRPCNT)=VAL
Q
; Time Required Notification Screen
; VIEN = Represents either Patient or Procedure IEN dependent upon report context
; TXT = Notification Type must contain this text if present
;
NOTIFS(VIEN,TXT) ;
N NIEN,XRF,LP,TM,RVAL1,RVAL2
S TXT=$G(TXT,"")
I BWGRPTVS="P" D
.; Process patient
.S XRF="B"
.S LP=VIEN
E D
.; Process procedure
.S XRF="C"
.S LP=$$GET1^DIQ(9002086.1,VIEN,.01,"I")
S NIEN=0 F S NIEN=$O(^BWNOT(XRF,LP,NIEN)) Q:NIEN="" D
.S RVAL1=$P(^BWGRTRPT(BWGRRPT,11,BWGRI,11,1,0),U),RVAL2=$P(^(0),U,2)
.S TM=$$GET1^DIQ(9002086.4,NIEN,.15,"I")
.Q:RVAL1>TM!(X>RVAL2)
.S X(RVAL1)=""
Q
; Notification Screen
; Populate X array with Notifications matching selected screen type
; Input: SCNTYP = Screen Type
; "P"= Purpose
; "T"= Type
; "S"= Status
; "N" = Notification IEN array
NOTIFSCN(SCNTYP) ;
N BWNIEN,BWNTYP,BWNDT,BWNPURP,BWNOUT,BWNBDT,BWNEDT,BWNSTAT,NODE0
Q:$L($G(SCNTYP))<1
S BWNBDT=$G(BWGRBD,0)
S BWNEDT=$G(BWGRED,9999999)
S BWNIEN=0
F S BWNIEN=$O(^BWNOT("B",DFN,BWNIEN)) Q:'BWNIEN D
.S NODE0=^BWNOT(BWNIEN,0)
.S BWNTYP=$P(NODE0,U,3)
.S BWNDT=$P(NODE0,U,2)
.S BWNPURP=$P(NODE0,U,4)
.S BWNOUT=$P(NODE0,U,5)
.S BWNSTAT=$P(NODE0,U,14)
.; Compare notification date with date range
.Q:BWNDT<BWNBDT!(BWNDT>BWNEDT)
.I SCNTYP="T" D
..S:BWNTYP X(BWNTYP)=""
.E I SCNTYP="P" D
..S:BWNPURP X(BWNPURP)=""
.E I SCNTYP="O" D
..S:BWNOUT X(BWNOUT)=""
.E I SCNTYP="S" D
..S:$L(BWNSTAT) X(BWNSTAT)=""
.E I SCNTYP="N" D
..S X(BWNIEN)=""
Q
; Build Print array for Notification Types/Purposes
NOTIFPTP(SCNTYP) ;
N X,BWNIEN,VAL,BWNDTE,FLD
S SCNTYP=$G(SCNTYP)
S FLD=$S(SCNTYP="P":.04,SCNTYP="T":.03,SCNTYP="O":.05,SCNTYP="S":.14,1:"")
Q:'FLD
D NOTIFSCN("N")
S BWNIEN=0 F S BWNIEN=$O(X(BWNIEN)) Q:'BWNIEN D
.S BWNDTE=$$FMTE^XLFDT($$GET1^DIQ(9002086.4,BWNIEN,.02,"I"),"5Z")
.S VAL=$E($$GET1^DIQ(9002086.4,BWNIEN,FLD),1,20)
.S:SCNTYP'="S" VAL=$S('$L(VAL):"??",1:VAL)_" on "_BWNDTE
.S BWGRPCNT=$G(BWGRPCNT)+1,BWGRPRNM(BWGRPCNT)=VAL
Q
BWGRVLU2 ; IHS/CMI/LAB - GEN RETR UTILITIES - CON'T ;03-Sep-2003 20:09;PLS
+1 ;;2.0;WOMEN'S HEALTH;**9**;SEP 02, 2003
+2 ; Print Notifications Types that contain the TXT value in their name
+3 ; VIEN = Represents either Patient or Procedure IEN dependent upon report context
+4 ; TXT = Notification Type must contain this text if present
+5 ; PRM = 0= just time, 1=time and date, 2=time, date, and type
NOTIFP(VIEN,TXT,PRM) ;
+1 NEW NIEN,XRF,LP
+2 SET TXT=$GET(TXT,"")
SET PRM=$GET(PRM,0)
+3 IF BWGRPTVS="P"
Begin DoDot:1
+4 ; Process patient
+5 SET XRF="B"
+6 SET LP=VIEN
End DoDot:1
+7 IF '$TEST
Begin DoDot:1
+8 ; Process procedure
+9 SET XRF="C"
+10 SET LP=$$GET1^DIQ(9002086.1,VIEN,.01,"I")
End DoDot:1
+11 SET NIEN=0
FOR
SET NIEN=$ORDER(^BWNOT(XRF,LP,NIEN))
IF NIEN=""
QUIT
Begin DoDot:1
+12 DO ADDNOTIF(NIEN,TXT,PRM)
End DoDot:1
+13 QUIT
ADDNOTIF(NIEN,TXT,PRM) ; Add notification to array
+1 NEW NTYP,VAL
+2 SET NTYP=$$GET1^DIQ(9002086.4,NIEN,.03,"E")
+3 ; Check to see if notification types have been restricted
+4 IF ($LENGTH(TXT)&(NTYP'[TXT))
QUIT
+5 SET VAL=$$GET1^DIQ(9002086.4,NIEN,.15,"I")
+6 IF PRM>0
SET VAL=VAL_" "_$$FMTE^XLFDT($$GET1^DIQ(9002086.4,NIEN,.02,"I"),"5ZD")
+7 IF PRM>1
SET VAL=VAL_" "_NTYP
+8 SET BWGRPCNT=$GET(BWGRPCNT)+1
SET BWGRPRNM(BWGRPCNT)=VAL
+9 QUIT
+10 ; Time Required Notification Screen
+11 ; VIEN = Represents either Patient or Procedure IEN dependent upon report context
+12 ; TXT = Notification Type must contain this text if present
+13 ;
NOTIFS(VIEN,TXT) ;
+1 NEW NIEN,XRF,LP,TM,RVAL1,RVAL2
+2 SET TXT=$GET(TXT,"")
+3 IF BWGRPTVS="P"
Begin DoDot:1
+4 ; Process patient
+5 SET XRF="B"
+6 SET LP=VIEN
End DoDot:1
+7 IF '$TEST
Begin DoDot:1
+8 ; Process procedure
+9 SET XRF="C"
+10 SET LP=$$GET1^DIQ(9002086.1,VIEN,.01,"I")
End DoDot:1
+11 SET NIEN=0
FOR
SET NIEN=$ORDER(^BWNOT(XRF,LP,NIEN))
IF NIEN=""
QUIT
Begin DoDot:1
+12 SET RVAL1=$PIECE(^BWGRTRPT(BWGRRPT,11,BWGRI,11,1,0),U)
SET RVAL2=$PIECE(^(0),U,2)
+13 SET TM=$$GET1^DIQ(9002086.4,NIEN,.15,"I")
+14 IF RVAL1>TM!(X>RVAL2)
QUIT
+15 SET X(RVAL1)=""
End DoDot:1
+16 QUIT
+17 ; Notification Screen
+18 ; Populate X array with Notifications matching selected screen type
+19 ; Input: SCNTYP = Screen Type
+20 ; "P"= Purpose
+21 ; "T"= Type
+22 ; "S"= Status
+23 ; "N" = Notification IEN array
NOTIFSCN(SCNTYP) ;
+1 NEW BWNIEN,BWNTYP,BWNDT,BWNPURP,BWNOUT,BWNBDT,BWNEDT,BWNSTAT,NODE0
+2 IF $LENGTH($GET(SCNTYP))<1
QUIT
+3 SET BWNBDT=$GET(BWGRBD,0)
+4 SET BWNEDT=$GET(BWGRED,9999999)
+5 SET BWNIEN=0
+6 FOR
SET BWNIEN=$ORDER(^BWNOT("B",DFN,BWNIEN))
IF 'BWNIEN
QUIT
Begin DoDot:1
+7 SET NODE0=^BWNOT(BWNIEN,0)
+8 SET BWNTYP=$PIECE(NODE0,U,3)
+9 SET BWNDT=$PIECE(NODE0,U,2)
+10 SET BWNPURP=$PIECE(NODE0,U,4)
+11 SET BWNOUT=$PIECE(NODE0,U,5)
+12 SET BWNSTAT=$PIECE(NODE0,U,14)
+13 ; Compare notification date with date range
+14 IF BWNDT<BWNBDT!(BWNDT>BWNEDT)
QUIT
+15 IF SCNTYP="T"
Begin DoDot:2
+16 IF BWNTYP
SET X(BWNTYP)=""
End DoDot:2
+17 IF '$TEST
IF SCNTYP="P"
Begin DoDot:2
+18 IF BWNPURP
SET X(BWNPURP)=""
End DoDot:2
+19 IF '$TEST
IF SCNTYP="O"
Begin DoDot:2
+20 IF BWNOUT
SET X(BWNOUT)=""
End DoDot:2
+21 IF '$TEST
IF SCNTYP="S"
Begin DoDot:2
+22 IF $LENGTH(BWNSTAT)
SET X(BWNSTAT)=""
End DoDot:2
+23 IF '$TEST
IF SCNTYP="N"
Begin DoDot:2
+24 SET X(BWNIEN)=""
End DoDot:2
End DoDot:1
+25 QUIT
+26 ; Build Print array for Notification Types/Purposes
NOTIFPTP(SCNTYP) ;
+1 NEW X,BWNIEN,VAL,BWNDTE,FLD
+2 SET SCNTYP=$GET(SCNTYP)
+3 SET FLD=$SELECT(SCNTYP="P":.04,SCNTYP="T":.03,SCNTYP="O":.05,SCNTYP="S":.14,1:"")
+4 IF 'FLD
QUIT
+5 DO NOTIFSCN("N")
+6 SET BWNIEN=0
FOR
SET BWNIEN=$ORDER(X(BWNIEN))
IF 'BWNIEN
QUIT
Begin DoDot:1
+7 SET BWNDTE=$$FMTE^XLFDT($$GET1^DIQ(9002086.4,BWNIEN,.02,"I"),"5Z")
+8 SET VAL=$EXTRACT($$GET1^DIQ(9002086.4,BWNIEN,FLD),1,20)
+9 IF SCNTYP'="S"
SET VAL=$SELECT('$LENGTH(VAL):"??",1:VAL)_" on "_BWNDTE
+10 SET BWGRPCNT=$GET(BWGRPCNT)+1
SET BWGRPRNM(BWGRPCNT)=VAL
End DoDot:1
+11 QUIT