ORB3U1 ; slc/CLA - Utilities which support OE/RR 3 Notifications ;12/15/97
;;3.0;ORDER ENTRY/RESULTS REPORTING;**9,74,88,91,105,179,220,250**;Dec 17, 1997;Build 1
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="AET",%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,ORBSMSG,ORY,DESC,HDR
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)
..S ORBSMSG=$P(ORBAL,U,2)
..S ORY(ORJ)="RECIPIENTS OF ALERT: "_ORBSMSG,ORJ=ORJ+1
..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 ALERTS 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,ORBMSGP1,ORBMSGP2
;
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=$P(ORBMSG,"): ",2)
...S ORBMSGP1=$P(ORBMSG,":",1) ;jeh
...S ORBMSGP2=$P(ORBMSG,":",2,3) ;jeh
...I $G(ORBMSGP1)="Order(s) needing clarification" D ;jeh Shorten output to make room for OR IEN
....S ORBMSGP1="Order needs clarifying" ;jeh
....S ORBMSG=ORBMSGP1_":"_ORBMSGP2 ;jeh
...S ORBMSG=$E(ORBMSG_$S($L(ORNUM):" "_$G(ORNUM),1:"")_U_" ",1,60)
...S ^TMP("OR",$J,"ALERTS","B",9999999-ORBDT_ORBAID)=ORBAID_U_$P(ORBMSG,U)_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
.S ^TMP("OR",$J,"ALERTS",LCNT,0)=$$LJ^XLFSTR(NUM,4)_$$LJ^XLFSTR(ORBMSG,61)_$$LJ^XLFSTR(ORBDT,15)
.D CNTRL^VALM10(LCNT,1,5,IOINHI,IOINORM)
;
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
;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))
;
;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,"","")
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 ?20,ORBHDR
W ?(IOM-10),"Page: ",$J(PAGE,3),!!
Q
ORB3U1 ; slc/CLA - Utilities which support OE/RR 3 Notifications ;12/15/97
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**9,74,88,91,105,179,220,250**;Dec 17, 1997;Build 1
+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="AET"
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,ORBSMSG,ORY,DESC,HDR
+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 SET ORBSMSG=$PIECE(ORBAL,U,2)
+12 SET ORY(ORJ)="RECIPIENTS OF ALERT: "_ORBSMSG
SET ORJ=ORJ+1
+13 ;get recipient data
DO GETRECS(ORBAID)
+14 SET ORJ=ORJ+1
SET ORY(ORJ)=""
SET ORJ=ORJ+1
SET ORY(ORJ)=""
SET ORJ=ORJ+1
End DoDot:2
End DoDot:1
+15 SET DESC="Recipients of a Kernel Alert"
+16 SET HDR="RECIPIENTS OF ALERTS FOR PATIENT: "_ORBPT
+17 DO OUTPUT(.ORY,DESC,HDR)
+18 SET VALMBCK="R"
+19 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,ORBMSGP1,ORBMSGP2
+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 SET ORBMSG=$PIECE(ORBMSG,"): ",2)
+21 ;jeh
SET ORBMSGP1=$PIECE(ORBMSG,":",1)
+22 ;jeh
SET ORBMSGP2=$PIECE(ORBMSG,":",2,3)
+23 ;jeh Shorten output to make room for OR IEN
IF $GET(ORBMSGP1)="Order(s) needing clarification"
Begin DoDot:4
+24 ;jeh
SET ORBMSGP1="Order needs clarifying"
+25 ;jeh
SET ORBMSG=ORBMSGP1_":"_ORBMSGP2
End DoDot:4
+26 SET ORBMSG=$EXTRACT(ORBMSG_$SELECT($LENGTH(ORNUM):" "_$GET(ORNUM),1:"")_U_" ",1,60)
+27 SET ^TMP("OR",$JOB,"ALERTS","B",9999999-ORBDT_ORBAID)=ORBAID_U_$PIECE(ORBMSG,U)_U_$$FMTE^XLFDT($EXTRACT(ORBDT,1,12),"2")
End DoDot:3
End DoDot:2
End DoDot:1
+28 ;
+29 SET (LCNT,NUM)=0
+30 SET ORX=""
FOR
SET ORX=$ORDER(^TMP("OR",$JOB,"ALERTS","B",ORX))
IF ORX=""
QUIT
Begin DoDot:1
+31 SET ORY=^TMP("OR",$JOB,"ALERTS","B",ORX)
+32 SET ORBMSG=$PIECE(ORY,U,2)
+33 SET ORBDT=$PIECE(ORY,U,3)
+34 SET LCNT=LCNT+1
SET NUM=NUM+1
+35 ;alert id^text^date/time
SET ^TMP("OR",$JOB,"ALERTS","IDX",NUM)=ORY
+36 SET ^TMP("OR",$JOB,"ALERTS",LCNT,0)=$$LJ^XLFSTR(NUM,4)_$$LJ^XLFSTR(ORBMSG,61)_$$LJ^XLFSTR(ORBDT,15)
+37 DO CNTRL^VALM10(LCNT,1,5,IOINHI,IOINORM)
End DoDot:1
+38 ;
+39 SET ^TMP("OR",$JOB,"ALERTS",0)=LCNT_U_NUM_U_"Patient Alerts"
+40 SET ^TMP("OR",$JOB,"ALERTS","#")=$ORDER(^ORD(101,"B","OR SELECT ALERTS",0))_"^1:"_NUM
+41 KILL VALMHDR
+42 SET VALMCNT=LCNT
SET VALMBG=1
SET VALMBCK="R"
+43 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
+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 ;prompt for pkg-defined recips if normally occurs with notif:
+36 IF (ORN=21)!(ORN=22)!(ORN=23)!(ORN=27)!(ORN=30)!(ORN=51)!(ORN=52)!(ORN=53)!(ORN=63)
Begin DoDot:1
+37 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
+38 IF $DATA(DUOUT)
QUIT
+39 KILL DIC,Y,DUOUT,DTOUT
+40 ;
+41 ;prompt for recips entered at special GUI recipients prompts:
+42 IF (ORN=6)!(ORN=33)
Begin DoDot:1
+43 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
+44 IF $DATA(DUOUT)
QUIT
+45 KILL DIC,Y,DUOUT,DTOUT
+46 ;
+47 WRITE !,"Processing, please stand by..."
+48 ;determine recipients and why:
+49 SET ORY="1"
+50 DO UTL^ORB3(.ORY,ORN,ORBDFN,$GET(ORNUM),.ORBADUZ,"","")
+51 SET DESC="Determine Notification Recipients Report"
+52 SET HDR="DETERMINE NOTIFICATION RECIPIENTS REPORT"
+53 DO OUTPUT(.ORY,DESC,HDR)
+54 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 ?20,ORBHDR
+1 WRITE ?(IOM-10),"Page: ",$JUSTIFY(PAGE,3),!!
+2 QUIT