ORB3U1 ;SLC/CLA - Utilities which support OE/RR 3 Notifications ;Nov 03, 2020@14:21
;;3.0;ORDER ENTRY/RESULTS REPORTING;**9,74,88,91,105,179,220,250,379,377,498**;Dec 17, 1997;Build 38
Q
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
;
ALRTHX ;report the recipients for an alert, when received, action taken
N ORBDFN,ORBSDT,ORBEDT
;prompt for patient (required):
K DIC S DIC="^DPT(",DIC("A")="PATIENT (req'd): ",DIC(0)="AEQNM" D ^DIC
I Y<1 K DIC,Y Q
S ORBDFN=+Y,ORBPT=$P(Y,U,2)
K DIC,Y,DUOUT,DTOUT
;
S %DT="AET",%DT("A")="Start Date/Time (req'd): ",%DT("B")="T-30" D ^%DT
I Y<1 K %DT,Y Q
S ORBSDT=Y
;
S %DT="AERS",%DT("A")="End Date/Time (req'd): ",%DT("B")="NOW" D ^%DT
I Y<1 K %DT,Y Q
S ORBEDT=Y
;
;get alerts for this patient from the alert tracking file:
D PATIENT^XQALERT("^TMP(""ORB"",$J)",ORBDFN,ORBSDT,ORBEDT)
W !!,"Processing..."
;
D EN^VALM("OR PATIENT ALERTS")
Q
SELECT ;if one or more alerts selected, display/print recipient data:
N ORN,ORNUMS,ORI,ORJ,ORBAL,ORBAID,ORY,DESC,HDR,ORLINES,ORLINE
S ORNUMS=$P(XQORNOD(0),"=",2)
Q:'$L(ORNUMS)
D FULL^VALM1
;
S ORJ=1
F ORI=1:1:$L(ORNUMS,",")-1 D
.S ORN=$P(ORNUMS,",",ORI)
.S ORBAL=$G(^TMP("OR",$J,"ALERTS","IDX",ORN)) I $L(ORBAL) D
..S ORBAID=$P(ORBAL,U)
..D WRAP^ORUTL("RECIPIENTS OF ALERT: "_$P(ORBAL,U,2),"ORLINES")
..F ORLINE=1:1:ORLINES I $G(ORLINES(ORLINE))'="" S ORY(ORJ)=ORLINES(ORLINE),ORJ=ORJ+1
..K ORLINES
..D GETRECS(ORBAID) ;get recipient data
..S ORJ=ORJ+1,ORY(ORJ)="",ORJ=ORJ+1,ORY(ORJ)="",ORJ=ORJ+1
S DESC="Recipients of a Kernel Alert"
S HDR="RECIPIENTS OF ALERT FOR PATIENT: "_ORBPT
D OUTPUT(.ORY,DESC,HDR)
S VALMBCK="R"
Q
LMHDR ; header for ListMgr display
S VALMHDR(1)="Alerts for "_ORBPT
Q
LMHELP ; help for List Mgr display
N X
D FULL^VALM1 S VALMBCK="R"
W !!,"Enter the display number of the alert whose recipients you wish to review in detail."
W !!,"Press <return> to continue ..."
R X:DTIME
Q
LMEXIT ; exit code for List Mgr display
D CLEAR^VALM1
K ORBPT,^TMP("OR",$J,"ALERTS"),XQORM("ALT"),^TMP("ORB",$J)
Q
LMALT ; alternative selection code
D FULL^VALM1
S VALMBCK="R"
Q
LMENTRY ; entry code for List Mgr display
N ORBA,ORBAID,ORBDT,ORBMSG,ORBX,ORNUM,ORDATA,ORAD,LCNT,NUM
N ORX,ORY,ORLINE,ORLINES
;
D CLEAN^VALM10
;
S ORBA="" F S ORBA=$O(^TMP("ORB",$J,ORBA)) Q:ORBA="" D
.S ORBX=$G(^TMP("ORB",$J,ORBA)) I $L(ORBX) D
..S ORBAID=$P(ORBX,U,2)
..Q:$P(ORBAID,",")'="OR" ;quit if not "OR" (OE/RR Notifications) alert
..W "."
..;
..;get alert details:
..D ALERTDAT^XQALBUTL(ORBAID,"ORAD")
..S ORBMSG=ORAD(1.01) I $L(ORBMSG) D
...S ORBDT=$P(ORAD(.02),U)
...S ORDATA=$G(ORAD(2))
...S ORNUM=""
...I ORDATA["@" S ORNUM=$P(ORDATA,"@")
...S ORNUM=$S(+$G(ORNUM)>0:"["_+ORNUM_"]",1:"")
...S ORBMSG=$S($F(ORBMSG,": "):$E(ORBMSG,$F(ORBMSG,": "),$L(ORBMSG)),1:"") ;p379
...S ORBMSG=ORBMSG_$S($L(ORNUM):" "_$G(ORNUM),1:"")
...S ^TMP("OR",$J,"ALERTS","B",9999999-ORBDT_ORBAID)=ORBAID_U_ORBMSG_U_$$FMTE^XLFDT($E(ORBDT,1,12),"2")
;
S (LCNT,NUM)=0
S ORX="" F S ORX=$O(^TMP("OR",$J,"ALERTS","B",ORX)) Q:ORX="" D
.S ORY=^TMP("OR",$J,"ALERTS","B",ORX)
.S ORBMSG=$P(ORY,U,2)
.S ORBDT=$P(ORY,U,3)
.S LCNT=LCNT+1,NUM=NUM+1
.S ^TMP("OR",$J,"ALERTS","IDX",NUM)=ORY ;alert id^text^date/time
.D WRAP^ORUTL(ORBMSG,"ORLINES",0,0,,,60)
.F ORLINE=1:1:ORLINES D
..Q:$G(ORLINES(ORLINE))=""
..I ORLINE=1 D
...S ^TMP("OR",$J,"ALERTS",LCNT,0)=$$LJ^XLFSTR(NUM,4)_$$LJ^XLFSTR(ORLINES(ORLINE),61)_$$LJ^XLFSTR(ORBDT,15)
...D CNTRL^VALM10(LCNT,1,4,IOINHI,IOINORM)
..I ORLINE>1 D
...S LCNT=LCNT+1
...S ^TMP("OR",$J,"ALERTS",LCNT,0)=$$REPEAT^XLFSTR(" ",4)_$$LJ^XLFSTR(ORLINES(ORLINE),61)
.K ORLINES
;
S ^TMP("OR",$J,"ALERTS",0)=LCNT_U_NUM_U_"Patient Alerts"
S ^TMP("OR",$J,"ALERTS","#")=$O(^ORD(101,"B","OR SELECT ALERTS",0))_"^1:"_NUM
K VALMHDR
S VALMCNT=LCNT,VALMBG=1,VALMBCK="R"
Q
GETRECS(ORBAID) ;get recipient data for an alert
N ORX,ORBI,ORBR,ORBHX
D AHISTORY^XQALBUTL(ORBAID,"ORBHX")
S:$L($G(ORBHX(20,0))) ORX=$P(ORBHX(20,0),U,4)
F ORBI=1:1:ORX D
.S ORBR=ORBHX(20,ORBI,0)
.S ORY(ORJ)="",ORJ=ORJ+1
.S ORY(ORJ)=$P(^VA(200,$P(ORBR,U),0),U),ORJ=ORJ+1
.S ORY(ORJ)=" 1st displayed to recipient: "_$$FMTE^XLFDT($P(ORBR,U,2),"1"),ORJ=ORJ+1
.S ORY(ORJ)=" 1st selected by recipient: "_$$FMTE^XLFDT($P(ORBR,U,3),"1"),ORJ=ORJ+1
.S ORY(ORJ)=" Processed by recipient: "_$$FMTE^XLFDT($P(ORBR,U,4),"1"),ORJ=ORJ+1
.S ORY(ORJ)=" Deleted: "_$$FMTE^XLFDT($P(ORBR,U,5),"1"),ORJ=ORJ+1
.S ORY(ORJ)=" Auto deleted: "_$$FMTE^XLFDT($P(ORBR,U,6),"1"),ORJ=ORJ+1
.S ORY(ORJ)=" Forwarded by: "_$S($P(ORBR,U,7):$P(^VA(200,$P(ORBR,U,7),0),U),1:""),ORJ=ORJ+1
.S ORY(ORJ)=" Forwarded to recipient: "_$$FMTE^XLFDT($P(ORBR,U,8),"1"),ORJ=ORJ+1
.S ORY(ORJ)=" Non-process deletion by: "_$S($P(ORBR,U,9):$P(^VA(200,$P(ORBR,U,9),0),U),1:""),ORJ=ORJ+1
Q
RECIPS ;determine/report the list of recipients for a notification
N ORY,ORN,ORBDFN,ORNUM,ORBADUZ,DESC,HDR,ORBPR,ORDIV,ORADD,ORLINE
;prompt for patient (required):
K DIC S DIC="^DPT(",DIC("A")="PATIENT (req'd): ",DIC(0)="AEQNM" D ^DIC Q:Y<1
S ORBDFN=+Y
Q:$D(DUOUT)
K DIC,Y,DUOUT,DTOUT
;
;prompt for notification (required):
S DIC="^ORD(100.9,",DIC("A")="NOTIFICATION (req'd): ",DIC(0)="AEQN" D ^DIC Q:Y<1
S ORN=+Y
Q:$D(DUOUT)
K DIC,Y,DUOUT,DTOUT
;
S ORBPR=$$GET^XPAR("DIV^SYS^PKG","ORB PROVIDER RECIPIENTS",ORN,"I")
;
;prompt for order num if notif processes order num or is a flagged oi:
I (ORN=32)!(ORN=41)!(ORN=60)!(ORN=61)!(ORN=64)!(ORN=65)!(ORBPR["O")!(ORBPR["E") D
.K DIR S DIR(0)="NAO^::2",DIR("A")="ORDER NUMBER: "
.S DIR("?",1)="This notification uses order number to help determine alert recipients."
.S DIR("?",2)="Enter the order number associated with the alert for most accurate results."
.S DIR("?",3)="Order number must be entered as a whole number (e.g. 458829)."
.;
.S DIR("?")=" "
.D ^DIR
.S ORNUM=+Y
.I +$G(ORNUM)>0 D
..S ORDIV=$$ORDIV^ORB31(ORNUM)
..S:+$G(ORDIV)>0 ORBPR=$$GET^XPAR(ORDIV_";DIV(4,^SYS^PKG","ORB PROVIDER RECIPIENTS",ORN,"I")
Q:$D(DUOUT)
K DIR,Y,X,DTOUT,DUOUT,DIRUT
;
; get recipients for Lab Threshold notif:
I ORN=68 D LABTHR^ORB3U2(.ORBADUZ,ORBDFN,$G(ORNUM))
;
; get recipients for Women's Health notif:
I (ORN=86)!(ORN=87) I '$$WHRECIP^ORB3U2(.ORBADUZ,ORN,ORBDFN,.ORADD) Q
;
;prompt for pkg-defined recips if normally occurs with notif:
I (ORN=21)!(ORN=22)!(ORN=23)!(ORN=27)!(ORN=30)!(ORN=51)!(ORN=52)!(ORN=53)!(ORN=63) D
.F K DIC,Y S DIC="^VA(200,",DIC(0)="AEQN",DIC("A")="RECIPIENT(S) FROM PACKAGE WHEN NOTIF WAS TRIGGERED: " D ^DIC Q:Y<1 S ORBADUZ(+Y)=""
Q:$D(DUOUT)
K DIC,Y,DUOUT,DTOUT
;
;prompt for recips entered at special GUI recipients prompts:
I (ORN=6)!(ORN=33) D
.F K DIC,Y S DIC="^VA(200,",DIC(0)="AEQN",DIC("A")="RECIPIENT(S) ENTERED AT GUI PROMPTS: " D ^DIC Q:Y<1 S ORBADUZ(+Y)=""
Q:$D(DUOUT)
K DIC,Y,DUOUT,DTOUT
;
W !,"Processing, please stand by..."
;determine recipients and why:
S ORY="1"
D UTL^ORB3(.ORY,ORN,ORBDFN,$G(ORNUM),.ORBADUZ,"","")
I $D(ORADD) D
.S ORLINE=1+$O(ORY("?"),-1),ORY(ORLINE)="",ORLINE=ORLINE+1
.S ORY(ORLINE)="Message(s) Supplied by the Package:",ORLINE=ORLINE+1
.S ORADD="" F S ORADD=$O(ORADD(ORADD)) Q:'+ORADD D
..S ORY(ORLINE)=ORADD(ORADD),ORLINE=ORLINE+1
S DESC="Determine Notification Recipients Report"
S HDR="DETERMINE NOTIFICATION RECIPIENTS REPORT"
D OUTPUT(.ORY,DESC,HDR)
Q
OUTPUT(ORY,ORBDESC,ORBHDR) ;prompt for device and send report
N POP
;prompt for device:
S %ZIS="Q" ;prompt for Queueing
D ^%ZIS
Q:$G(POP)>0
I $D(IO("Q")) D ;queue the report
.S ZTRTN="PRINT^ORB3U1"
.S ZTSAVE("ORY(")="",ZTSAVE("ORBHDR")=""
.S ZTDESC=ORBDESC
.D ^%ZTLOAD
.K ZTDESC,ZTRTN,ZTSAVE
.I $D(ZTSK)[0 W !!?5,"Report canceled!"
.E W !!?5,"Report queued."
.D HOME^%ZIS
K %ZIS
I $D(IO("Q")) K IO("Q") Q
PRINT ;print body of Determine Notification Recipients Report
N END,PAGE,X
S (END,PAGE,I)=0
U IO
D @("HDR"_(2-($E(IOST,1,2)="C-")))
F S I=$O(ORY(I)) Q:I=""!(END=1) D
.D HDR:$Y+5>IOSL
.Q:END=1
.W !,ORY(I)
I END=1 W !!," - Report Interrupted -",!
E W !!!," - End of Report -",!
I ($E(IOST,1,2)="C-") W !,"Press RETURN to continue: " R X:DTIME
D ^%ZISC
D:$G(ZTSK) KILL^%ZTLOAD
Q
HDR ;print header of report
I PAGE,($E(IOST,1,2)="C-") D
.W !,"Press RETURN to continue or '^' to exit: "
.R X:DTIME S END='$T!(X="^")
Q:END=1
HDR1 W:'($E(IOST,1,2)='"C-"&'PAGE) @IOF
HDR2 S PAGE=PAGE+1 W ?10,$E(ORBHDR,1,(IOM-20))
W ?(IOM-10),"Page: ",$J(PAGE,3),!!
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORB3U1 8918 printed Nov 22, 2024@17:37:30 Page 2
ORB3U1 ;SLC/CLA - Utilities which support OE/RR 3 Notifications ;Nov 03, 2020@14:21
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**9,74,88,91,105,179,220,250,379,377,498**;Dec 17, 1997;Build 38
+2 QUIT
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
+6 ;
ALRTHX ;report the recipients for an alert, when received, action taken
+1 NEW ORBDFN,ORBSDT,ORBEDT
+2 ;prompt for patient (required):
+3 KILL DIC
SET DIC="^DPT("
SET DIC("A")="PATIENT (req'd): "
SET DIC(0)="AEQNM"
DO ^DIC
+4 IF Y<1
KILL DIC,Y
QUIT
+5 SET ORBDFN=+Y
SET ORBPT=$PIECE(Y,U,2)
+6 KILL DIC,Y,DUOUT,DTOUT
+7 ;
+8 SET %DT="AET"
SET %DT("A")="Start Date/Time (req'd): "
SET %DT("B")="T-30"
DO ^%DT
+9 IF Y<1
KILL %DT,Y
QUIT
+10 SET ORBSDT=Y
+11 ;
+12 SET %DT="AERS"
SET %DT("A")="End Date/Time (req'd): "
SET %DT("B")="NOW"
DO ^%DT
+13 IF Y<1
KILL %DT,Y
QUIT
+14 SET ORBEDT=Y
+15 ;
+16 ;get alerts for this patient from the alert tracking file:
+17 DO PATIENT^XQALERT("^TMP(""ORB"",$J)",ORBDFN,ORBSDT,ORBEDT)
+18 WRITE !!,"Processing..."
+19 ;
+20 DO EN^VALM("OR PATIENT ALERTS")
+21 QUIT
SELECT ;if one or more alerts selected, display/print recipient data:
+1 NEW ORN,ORNUMS,ORI,ORJ,ORBAL,ORBAID,ORY,DESC,HDR,ORLINES,ORLINE
+2 SET ORNUMS=$PIECE(XQORNOD(0),"=",2)
+3 if '$LENGTH(ORNUMS)
QUIT
+4 DO FULL^VALM1
+5 ;
+6 SET ORJ=1
+7 FOR ORI=1:1:$LENGTH(ORNUMS,",")-1
Begin DoDot:1
+8 SET ORN=$PIECE(ORNUMS,",",ORI)
+9 SET ORBAL=$GET(^TMP("OR",$JOB,"ALERTS","IDX",ORN))
IF $LENGTH(ORBAL)
Begin DoDot:2
+10 SET ORBAID=$PIECE(ORBAL,U)
+11 DO WRAP^ORUTL("RECIPIENTS OF ALERT: "_$PIECE(ORBAL,U,2),"ORLINES")
+12 FOR ORLINE=1:1:ORLINES
IF $GET(ORLINES(ORLINE))'=""
SET ORY(ORJ)=ORLINES(ORLINE)
SET ORJ=ORJ+1
+13 KILL ORLINES
+14 ;get recipient data
DO GETRECS(ORBAID)
+15 SET ORJ=ORJ+1
SET ORY(ORJ)=""
SET ORJ=ORJ+1
SET ORY(ORJ)=""
SET ORJ=ORJ+1
End DoDot:2
End DoDot:1
+16 SET DESC="Recipients of a Kernel Alert"
+17 SET HDR="RECIPIENTS OF ALERT FOR PATIENT: "_ORBPT
+18 DO OUTPUT(.ORY,DESC,HDR)
+19 SET VALMBCK="R"
+20 QUIT
LMHDR ; header for ListMgr display
+1 SET VALMHDR(1)="Alerts for "_ORBPT
+2 QUIT
LMHELP ; help for List Mgr display
+1 NEW X
+2 DO FULL^VALM1
SET VALMBCK="R"
+3 WRITE !!,"Enter the display number of the alert whose recipients you wish to review in detail."
+4 WRITE !!,"Press <return> to continue ..."
+5 READ X:DTIME
+6 QUIT
LMEXIT ; exit code for List Mgr display
+1 DO CLEAR^VALM1
+2 KILL ORBPT,^TMP("OR",$JOB,"ALERTS"),XQORM("ALT"),^TMP("ORB",$JOB)
+3 QUIT
LMALT ; alternative selection code
+1 DO FULL^VALM1
+2 SET VALMBCK="R"
+3 QUIT
LMENTRY ; entry code for List Mgr display
+1 NEW ORBA,ORBAID,ORBDT,ORBMSG,ORBX,ORNUM,ORDATA,ORAD,LCNT,NUM
+2 NEW ORX,ORY,ORLINE,ORLINES
+3 ;
+4 DO CLEAN^VALM10
+5 ;
+6 SET ORBA=""
FOR
SET ORBA=$ORDER(^TMP("ORB",$JOB,ORBA))
if ORBA=""
QUIT
Begin DoDot:1
+7 SET ORBX=$GET(^TMP("ORB",$JOB,ORBA))
IF $LENGTH(ORBX)
Begin DoDot:2
+8 SET ORBAID=$PIECE(ORBX,U,2)
+9 ;quit if not "OR" (OE/RR Notifications) alert
if $PIECE(ORBAID,",")'="OR"
QUIT
+10 WRITE "."
+11 ;
+12 ;get alert details:
+13 DO ALERTDAT^XQALBUTL(ORBAID,"ORAD")
+14 SET ORBMSG=ORAD(1.01)
IF $LENGTH(ORBMSG)
Begin DoDot:3
+15 SET ORBDT=$PIECE(ORAD(.02),U)
+16 SET ORDATA=$GET(ORAD(2))
+17 SET ORNUM=""
+18 IF ORDATA["@"
SET ORNUM=$PIECE(ORDATA,"@")
+19 SET ORNUM=$SELECT(+$GET(ORNUM)>0:"["_+ORNUM_"]",1:"")
+20 ;p379
SET ORBMSG=$SELECT($FIND(ORBMSG,": "):$EXTRACT(ORBMSG,$FIND(ORBMSG,": "),$LENGTH(ORBMSG)),1:"")
+21 SET ORBMSG=ORBMSG_$SELECT($LENGTH(ORNUM):" "_$GET(ORNUM),1:"")
+22 SET ^TMP("OR",$JOB,"ALERTS","B",9999999-ORBDT_ORBAID)=ORBAID_U_ORBMSG_U_$$FMTE^XLFDT($EXTRACT(ORBDT,1,12),"2")
End DoDot:3
End DoDot:2
End DoDot:1
+23 ;
+24 SET (LCNT,NUM)=0
+25 SET ORX=""
FOR
SET ORX=$ORDER(^TMP("OR",$JOB,"ALERTS","B",ORX))
if ORX=""
QUIT
Begin DoDot:1
+26 SET ORY=^TMP("OR",$JOB,"ALERTS","B",ORX)
+27 SET ORBMSG=$PIECE(ORY,U,2)
+28 SET ORBDT=$PIECE(ORY,U,3)
+29 SET LCNT=LCNT+1
SET NUM=NUM+1
+30 ;alert id^text^date/time
SET ^TMP("OR",$JOB,"ALERTS","IDX",NUM)=ORY
+31 DO WRAP^ORUTL(ORBMSG,"ORLINES",0,0,,,60)
+32 FOR ORLINE=1:1:ORLINES
Begin DoDot:2
+33 if $GET(ORLINES(ORLINE))=""
QUIT
+34 IF ORLINE=1
Begin DoDot:3
+35 SET ^TMP("OR",$JOB,"ALERTS",LCNT,0)=$$LJ^XLFSTR(NUM,4)_$$LJ^XLFSTR(ORLINES(ORLINE),61)_$$LJ^XLFSTR(ORBDT,15)
+36 DO CNTRL^VALM10(LCNT,1,4,IOINHI,IOINORM)
End DoDot:3
+37 IF ORLINE>1
Begin DoDot:3
+38 SET LCNT=LCNT+1
+39 SET ^TMP("OR",$JOB,"ALERTS",LCNT,0)=$$REPEAT^XLFSTR(" ",4)_$$LJ^XLFSTR(ORLINES(ORLINE),61)
End DoDot:3
End DoDot:2
+40 KILL ORLINES
End DoDot:1
+41 ;
+42 SET ^TMP("OR",$JOB,"ALERTS",0)=LCNT_U_NUM_U_"Patient Alerts"
+43 SET ^TMP("OR",$JOB,"ALERTS","#")=$ORDER(^ORD(101,"B","OR SELECT ALERTS",0))_"^1:"_NUM
+44 KILL VALMHDR
+45 SET VALMCNT=LCNT
SET VALMBG=1
SET VALMBCK="R"
+46 QUIT
GETRECS(ORBAID) ;get recipient data for an alert
+1 NEW ORX,ORBI,ORBR,ORBHX
+2 DO AHISTORY^XQALBUTL(ORBAID,"ORBHX")
+3 if $LENGTH($GET(ORBHX(20,0)))
SET ORX=$PIECE(ORBHX(20,0),U,4)
+4 FOR ORBI=1:1:ORX
Begin DoDot:1
+5 SET ORBR=ORBHX(20,ORBI,0)
+6 SET ORY(ORJ)=""
SET ORJ=ORJ+1
+7 SET ORY(ORJ)=$PIECE(^VA(200,$PIECE(ORBR,U),0),U)
SET ORJ=ORJ+1
+8 SET ORY(ORJ)=" 1st displayed to recipient: "_$$FMTE^XLFDT($PIECE(ORBR,U,2),"1")
SET ORJ=ORJ+1
+9 SET ORY(ORJ)=" 1st selected by recipient: "_$$FMTE^XLFDT($PIECE(ORBR,U,3),"1")
SET ORJ=ORJ+1
+10 SET ORY(ORJ)=" Processed by recipient: "_$$FMTE^XLFDT($PIECE(ORBR,U,4),"1")
SET ORJ=ORJ+1
+11 SET ORY(ORJ)=" Deleted: "_$$FMTE^XLFDT($PIECE(ORBR,U,5),"1")
SET ORJ=ORJ+1
+12 SET ORY(ORJ)=" Auto deleted: "_$$FMTE^XLFDT($PIECE(ORBR,U,6),"1")
SET ORJ=ORJ+1
+13 SET ORY(ORJ)=" Forwarded by: "_$SELECT($PIECE(ORBR,U,7):$PIECE(^VA(200,$PIECE(ORBR,U,7),0),U),1:"")
SET ORJ=ORJ+1
+14 SET ORY(ORJ)=" Forwarded to recipient: "_$$FMTE^XLFDT($PIECE(ORBR,U,8),"1")
SET ORJ=ORJ+1
+15 SET ORY(ORJ)=" Non-process deletion by: "_$SELECT($PIECE(ORBR,U,9):$PIECE(^VA(200,$PIECE(ORBR,U,9),0),U),1:"")
SET ORJ=ORJ+1
End DoDot:1
+16 QUIT
RECIPS ;determine/report the list of recipients for a notification
+1 NEW ORY,ORN,ORBDFN,ORNUM,ORBADUZ,DESC,HDR,ORBPR,ORDIV,ORADD,ORLINE
+2 ;prompt for patient (required):
+3 KILL DIC
SET DIC="^DPT("
SET DIC("A")="PATIENT (req'd): "
SET DIC(0)="AEQNM"
DO ^DIC
if Y<1
QUIT
+4 SET ORBDFN=+Y
+5 if $DATA(DUOUT)
QUIT
+6 KILL DIC,Y,DUOUT,DTOUT
+7 ;
+8 ;prompt for notification (required):
+9 SET DIC="^ORD(100.9,"
SET DIC("A")="NOTIFICATION (req'd): "
SET DIC(0)="AEQN"
DO ^DIC
if Y<1
QUIT
+10 SET ORN=+Y
+11 if $DATA(DUOUT)
QUIT
+12 KILL DIC,Y,DUOUT,DTOUT
+13 ;
+14 SET ORBPR=$$GET^XPAR("DIV^SYS^PKG","ORB PROVIDER RECIPIENTS",ORN,"I")
+15 ;
+16 ;prompt for order num if notif processes order num or is a flagged oi:
+17 IF (ORN=32)!(ORN=41)!(ORN=60)!(ORN=61)!(ORN=64)!(ORN=65)!(ORBPR["O")!(ORBPR["E")
Begin DoDot:1
+18 KILL DIR
SET DIR(0)="NAO^::2"
SET DIR("A")="ORDER NUMBER: "
+19 SET DIR("?",1)="This notification uses order number to help determine alert recipients."
+20 SET DIR("?",2)="Enter the order number associated with the alert for most accurate results."
+21 SET DIR("?",3)="Order number must be entered as a whole number (e.g. 458829)."
+22 ;
+23 SET DIR("?")=" "
+24 DO ^DIR
+25 SET ORNUM=+Y
+26 IF +$GET(ORNUM)>0
Begin DoDot:2
+27 SET ORDIV=$$ORDIV^ORB31(ORNUM)
+28 if +$GET(ORDIV)>0
SET ORBPR=$$GET^XPAR(ORDIV_";DIV(4,^SYS^PKG","ORB PROVIDER RECIPIENTS",ORN,"I")
End DoDot:2
End DoDot:1
+29 if $DATA(DUOUT)
QUIT
+30 KILL DIR,Y,X,DTOUT,DUOUT,DIRUT
+31 ;
+32 ; get recipients for Lab Threshold notif:
+33 IF ORN=68
DO LABTHR^ORB3U2(.ORBADUZ,ORBDFN,$GET(ORNUM))
+34 ;
+35 ; get recipients for Women's Health notif:
+36 IF (ORN=86)!(ORN=87)
IF '$$WHRECIP^ORB3U2(.ORBADUZ,ORN,ORBDFN,.ORADD)
QUIT
+37 ;
+38 ;prompt for pkg-defined recips if normally occurs with notif:
+39 IF (ORN=21)!(ORN=22)!(ORN=23)!(ORN=27)!(ORN=30)!(ORN=51)!(ORN=52)!(ORN=53)!(ORN=63)
Begin DoDot:1
+40 FOR
KILL DIC,Y
SET DIC="^VA(200,"
SET DIC(0)="AEQN"
SET DIC("A")="RECIPIENT(S) FROM PACKAGE WHEN NOTIF WAS TRIGGERED: "
DO ^DIC
if Y<1
QUIT
SET ORBADUZ(+Y)=""
End DoDot:1
+41 if $DATA(DUOUT)
QUIT
+42 KILL DIC,Y,DUOUT,DTOUT
+43 ;
+44 ;prompt for recips entered at special GUI recipients prompts:
+45 IF (ORN=6)!(ORN=33)
Begin DoDot:1
+46 FOR
KILL DIC,Y
SET DIC="^VA(200,"
SET DIC(0)="AEQN"
SET DIC("A")="RECIPIENT(S) ENTERED AT GUI PROMPTS: "
DO ^DIC
if Y<1
QUIT
SET ORBADUZ(+Y)=""
End DoDot:1
+47 if $DATA(DUOUT)
QUIT
+48 KILL DIC,Y,DUOUT,DTOUT
+49 ;
+50 WRITE !,"Processing, please stand by..."
+51 ;determine recipients and why:
+52 SET ORY="1"
+53 DO UTL^ORB3(.ORY,ORN,ORBDFN,$GET(ORNUM),.ORBADUZ,"","")
+54 IF $DATA(ORADD)
Begin DoDot:1
+55 SET ORLINE=1+$ORDER(ORY("?"),-1)
SET ORY(ORLINE)=""
SET ORLINE=ORLINE+1
+56 SET ORY(ORLINE)="Message(s) Supplied by the Package:"
SET ORLINE=ORLINE+1
+57 SET ORADD=""
FOR
SET ORADD=$ORDER(ORADD(ORADD))
if '+ORADD
QUIT
Begin DoDot:2
+58 SET ORY(ORLINE)=ORADD(ORADD)
SET ORLINE=ORLINE+1
End DoDot:2
End DoDot:1
+59 SET DESC="Determine Notification Recipients Report"
+60 SET HDR="DETERMINE NOTIFICATION RECIPIENTS REPORT"
+61 DO OUTPUT(.ORY,DESC,HDR)
+62 QUIT
OUTPUT(ORY,ORBDESC,ORBHDR) ;prompt for device and send report
+1 NEW POP
+2 ;prompt for device:
+3 ;prompt for Queueing
SET %ZIS="Q"
+4 DO ^%ZIS
+5 if $GET(POP)>0
QUIT
+6 ;queue the report
IF $DATA(IO("Q"))
Begin DoDot:1
+7 SET ZTRTN="PRINT^ORB3U1"
+8 SET ZTSAVE("ORY(")=""
SET ZTSAVE("ORBHDR")=""
+9 SET ZTDESC=ORBDESC
+10 DO ^%ZTLOAD
+11 KILL ZTDESC,ZTRTN,ZTSAVE
+12 IF $DATA(ZTSK)[0
WRITE !!?5,"Report canceled!"
+13 IF '$TEST
WRITE !!?5,"Report queued."
+14 DO HOME^%ZIS
End DoDot:1
+15 KILL %ZIS
+16 IF $DATA(IO("Q"))
KILL IO("Q")
QUIT
PRINT ;print body of Determine Notification Recipients Report
+1 NEW END,PAGE,X
+2 SET (END,PAGE,I)=0
+3 USE IO
+4 DO @("HDR"_(2-($EXTRACT(IOST,1,2)="C-")))
+5 FOR
SET I=$ORDER(ORY(I))
if I=""!(END=1)
QUIT
Begin DoDot:1
+6 if $Y+5>IOSL
DO HDR
+7 if END=1
QUIT
+8 WRITE !,ORY(I)
End DoDot:1
+9 IF END=1
WRITE !!," - Report Interrupted -",!
+10 IF '$TEST
WRITE !!!," - End of Report -",!
+11 IF ($EXTRACT(IOST,1,2)="C-")
WRITE !,"Press RETURN to continue: "
READ X:DTIME
+12 DO ^%ZISC
+13 if $GET(ZTSK)
DO KILL^%ZTLOAD
+14 QUIT
HDR ;print header of report
+1 IF PAGE
IF ($EXTRACT(IOST,1,2)="C-")
Begin DoDot:1
+2 WRITE !,"Press RETURN to continue or '^' to exit: "
+3 READ X:DTIME
SET END='$TEST!(X="^")
End DoDot:1
+4 if END=1
QUIT
HDR1 if '($EXTRACT(IOST,1,2)='"C-"&'PAGE)
WRITE @IOF
HDR2 SET PAGE=PAGE+1
WRITE ?10,$EXTRACT(ORBHDR,1,(IOM-20))
+1 WRITE ?(IOM-10),"Page: ",$JUSTIFY(PAGE,3),!!
+2 QUIT