ORB3FN ; slc/CLA - Functions which return OE/RR Notification information ;1/13/03
;;3.0;ORDER ENTRY/RESULTS REPORTING;**31,74,91,170**;Dec 17, 1997
Q
ONOFF(ORBN) ;extrinsic function returns '1' if notif is to be processed
N ORBERR,ORBE,ORBX,ORBV
S ORBX=0
K ^TMP("ORBP",$J)
D ENVAL^XPAR($NA(^TMP("ORBP",$J)),"ORB PROCESSING FLAG",ORBN,.ORBERR,1)
I 'ORBERR,$G(^TMP("ORBP",$J))>0 D
.S ORBE="" F S ORBE=$O(^TMP("ORBP",$J,ORBE)) Q:'ORBE!ORBX>0 D
..S ORBV=$G(^TMP("ORBP",$J,ORBE,ORBN))
..S:ORBV="M" ORBX=1
..S:ORBV="E" ORBX=2
K ^TMP("ORBP",$J),ORBERR
I ORBX=1 Q "1^Mandatory Entity(s) exist."
I ORBX=2 Q "1^Enabled Entity(s) exist."
D ENVAL^XPAR($NA(^TMP("ORBP",$J)),"ORB DEFAULT RECIPIENT DEVICES",ORBN,.ORBERR,1)
I 'ORBERR,$G(^TMP("ORBP",$J))>0 Q "1^Default Recipient Device(s) exist."
K ^TMP("ORBP",$J),ORBERR
S ORBX=0
D ENVAL^XPAR($NA(^TMP("ORBP",$J)),"ORB DEFAULT RECIPIENTS",ORBN,.ORBERR,1)
I 'ORBERR,$G(^TMP("ORBP",$J))>0 D
.S ORBE="" F S ORBE=$O(^TMP("ORBP",$J,ORBE)) Q:'ORBE!ORBX>0 D
..S ORBV=$G(^TMP("ORBP",$J,ORBE,ORBN))
..S:ORBV=1 ORBX=1
K ^TMP("ORBP",$J)
I ORBX=1 Q "1^Default Recipient(s) exist."
Q "0^No Mandatory or enabled entities and no default recipients."
LIST(Y) ;return list of notifications from Notification File [#100.9]
; RETURN IEN^NAME^URGENCY
N I,J,V
S I=1
S J=0 F S J=$O(^ORD(100.9,"B",J)) Q:J="" S V=0,V=$O(^ORD(100.9,"B",J,V)) S Y(I)=V_"^"_J_"^"_^ORD(100.9,V,3),I=I+1
Q
LISTON(ORY,ORBUSR) ;return notifications the user has turned On or OFF
; RETURN NOTIF IEN^NOTIF NAME^ON/OFF FLAG
N ORSX,ORUX,ORMX,ORBNAM,ORBIEN,ORYI
S ORYI=0
;see if notification system is disabled:
S ORSX=$$GET^XPAR("DIV^SYS^PKG","ORB SYSTEM ENABLE/DISABLE",1,"I")
I ORSX="D" S ORMX="OFF"
;
;loop thru all notifications and determine recipient status:
S ORBNAM="" F S ORBNAM=$O(^ORD(100.9,"B",ORBNAM)) Q:ORBNAM="" D
.S ORBIEN=0,ORBIEN=$O(^ORD(100.9,"B",ORBNAM,ORBIEN)) I +$G(ORBIEN)>0 D
..I $G(ORSX)'="D" D
...S ORUX="",ORUX=$$ONOFF^ORB3USER(ORBIEN,ORBUSR,"","")
...I $L(ORUX) S ORMX=$P(ORUX,U)
..S ORYI=ORYI+1
..S ORY(ORYI)=ORBIEN_U_ORBNAM_U_ORMX
;
Q
PTLOC(ORBPT) ;get patient's location (INPATIENT ONLY - outpt locations
;cannot be reliably determined, and many simultaneous outpt locations
;can occur) - returns pt location in format: location ien^location name
;outpatients return "0^Outpt"
N ORBLOC,ORBLOCN,ORBRES
S ORBRES="0^Outpt"
I +$G(ORBPT)>0 D
.N DFN S DFN=ORBPT,VA200="" D OERR^VADPT
.S ORBLOC=+$G(^DIC(42,+VAIN(4),44)) I +$G(ORBLOC)>0 D
..S ORBLOCN=$P(^SC(+ORBLOC,0),U)
..S ORBRES=ORBLOC_U_ORBLOCN
K VA200,VAIN
Q ORBRES
ORB3FN ; slc/CLA - Functions which return OE/RR Notification information ;1/13/03
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**31,74,91,170**;Dec 17, 1997
+2 QUIT
ONOFF(ORBN) ;extrinsic function returns '1' if notif is to be processed
+1 NEW ORBERR,ORBE,ORBX,ORBV
+2 SET ORBX=0
+3 KILL ^TMP("ORBP",$JOB)
+4 DO ENVAL^XPAR($NAME(^TMP("ORBP",$JOB)),"ORB PROCESSING FLAG",ORBN,.ORBERR,1)
+5 IF 'ORBERR
IF $GET(^TMP("ORBP",$JOB))>0
Begin DoDot:1
+6 SET ORBE=""
FOR
SET ORBE=$ORDER(^TMP("ORBP",$JOB,ORBE))
IF 'ORBE!ORBX>0
QUIT
Begin DoDot:2
+7 SET ORBV=$GET(^TMP("ORBP",$JOB,ORBE,ORBN))
+8 IF ORBV="M"
SET ORBX=1
+9 IF ORBV="E"
SET ORBX=2
End DoDot:2
End DoDot:1
+10 KILL ^TMP("ORBP",$JOB),ORBERR
+11 IF ORBX=1
QUIT "1^Mandatory Entity(s) exist."
+12 IF ORBX=2
QUIT "1^Enabled Entity(s) exist."
+13 DO ENVAL^XPAR($NAME(^TMP("ORBP",$JOB)),"ORB DEFAULT RECIPIENT DEVICES",ORBN,.ORBERR,1)
+14 IF 'ORBERR
IF $GET(^TMP("ORBP",$JOB))>0
QUIT "1^Default Recipient Device(s) exist."
+15 KILL ^TMP("ORBP",$JOB),ORBERR
+16 SET ORBX=0
+17 DO ENVAL^XPAR($NAME(^TMP("ORBP",$JOB)),"ORB DEFAULT RECIPIENTS",ORBN,.ORBERR,1)
+18 IF 'ORBERR
IF $GET(^TMP("ORBP",$JOB))>0
Begin DoDot:1
+19 SET ORBE=""
FOR
SET ORBE=$ORDER(^TMP("ORBP",$JOB,ORBE))
IF 'ORBE!ORBX>0
QUIT
Begin DoDot:2
+20 SET ORBV=$GET(^TMP("ORBP",$JOB,ORBE,ORBN))
+21 IF ORBV=1
SET ORBX=1
End DoDot:2
End DoDot:1
+22 KILL ^TMP("ORBP",$JOB)
+23 IF ORBX=1
QUIT "1^Default Recipient(s) exist."
+24 QUIT "0^No Mandatory or enabled entities and no default recipients."
LIST(Y) ;return list of notifications from Notification File [#100.9]
+1 ; RETURN IEN^NAME^URGENCY
+2 NEW I,J,V
+3 SET I=1
+4 SET J=0
FOR
SET J=$ORDER(^ORD(100.9,"B",J))
IF J=""
QUIT
SET V=0
SET V=$ORDER(^ORD(100.9,"B",J,V))
SET Y(I)=V_"^"_J_"^"_^ORD(100.9,V,3)
SET I=I+1
+5 QUIT
LISTON(ORY,ORBUSR) ;return notifications the user has turned On or OFF
+1 ; RETURN NOTIF IEN^NOTIF NAME^ON/OFF FLAG
+2 NEW ORSX,ORUX,ORMX,ORBNAM,ORBIEN,ORYI
+3 SET ORYI=0
+4 ;see if notification system is disabled:
+5 SET ORSX=$$GET^XPAR("DIV^SYS^PKG","ORB SYSTEM ENABLE/DISABLE",1,"I")
+6 IF ORSX="D"
SET ORMX="OFF"
+7 ;
+8 ;loop thru all notifications and determine recipient status:
+9 SET ORBNAM=""
FOR
SET ORBNAM=$ORDER(^ORD(100.9,"B",ORBNAM))
IF ORBNAM=""
QUIT
Begin DoDot:1
+10 SET ORBIEN=0
SET ORBIEN=$ORDER(^ORD(100.9,"B",ORBNAM,ORBIEN))
IF +$GET(ORBIEN)>0
Begin DoDot:2
+11 IF $GET(ORSX)'="D"
Begin DoDot:3
+12 SET ORUX=""
SET ORUX=$$ONOFF^ORB3USER(ORBIEN,ORBUSR,"","")
+13 IF $LENGTH(ORUX)
SET ORMX=$PIECE(ORUX,U)
End DoDot:3
+14 SET ORYI=ORYI+1
+15 SET ORY(ORYI)=ORBIEN_U_ORBNAM_U_ORMX
End DoDot:2
End DoDot:1
+16 ;
+17 QUIT
PTLOC(ORBPT) ;get patient's location (INPATIENT ONLY - outpt locations
+1 ;cannot be reliably determined, and many simultaneous outpt locations
+2 ;can occur) - returns pt location in format: location ien^location name
+3 ;outpatients return "0^Outpt"
+4 NEW ORBLOC,ORBLOCN,ORBRES
+5 SET ORBRES="0^Outpt"
+6 IF +$GET(ORBPT)>0
Begin DoDot:1
+7 NEW DFN
SET DFN=ORBPT
SET VA200=""
DO OERR^VADPT
+8 SET ORBLOC=+$GET(^DIC(42,+VAIN(4),44))
IF +$GET(ORBLOC)>0
Begin DoDot:2
+9 SET ORBLOCN=$PIECE(^SC(+ORBLOC,0),U)
+10 SET ORBRES=ORBLOC_U_ORBLOCN
End DoDot:2
End DoDot:1
+11 KILL VA200,VAIN
+12 QUIT ORBRES