- ORB3U2 ; slc/CLA - OE/RR 3 Notifications Utilities routine two ;5/19/97 11:07 [ 04/02/97 2:09 PM ]
- ;;3.0;ORDER ENTRY/RESULTS REPORTING;**9,74,105,179**;Dec 17, 1997
- Q
- USRNOTS(ORBUSR) ; generate a list of notifs indicating user's recip status
- I +$G(ORBUSR)<1 S ORBUSR=DUZ
- N ORY,ORYI,ORBY,ORBIEN,ORBNAM,NODE,ORX,DESC,HDR,ORBENT,ORDIV,ORZ
- ;
- ;get ORBUSR's Division:
- I $$DIV4^XUSER(.ORZ,ORBUSR) D
- .S ORDIV=0,ORDIV=$O(ORZ(ORDIV))
- .I +$G(ORDIV)>0 S ORBENT=ORDIV_";DIC(4,^SYS^PKG"
- I '$L($G(ORBENT)) S ORBENT="SYS^PKG"
- ;
- S ORYI=1
- ;
- ;prompt for additional information:
- W !!,"Would you like help understanding the list of notifications" S %=2 D YN^DICN I %=1 D HLPMSG
- K %
- ;
- ;see if notification system is disabled:
- S ORX=$$GET^XPAR(ORBENT,"ORB SYSTEM ENABLE/DISABLE",1,"I")
- I ORX="D" D
- .S ORY(ORYI)="Notifications is disabled. No notifications will be processed or delivered."
- .S DESC="Notification possibilities for a user"
- .S NODE=$G(^VA(200,ORBUSR,0)) S:$L($G(NODE)) HDR="Notification List for "_$P(NODE,U)
- .D OUTPUT(.ORY,DESC,HDR)
- Q:ORX="D"
- ;
- W !!,"This will take a moment or two, please stand by."
- ;
- S ORY(ORYI)="Notification ON/OFF For This User and Why",ORYI=ORYI+1
- S ORY(ORYI)="-------------------------------- ---------------------------------------------",ORYI=ORYI+1
- ;
- ;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
- ..S ORBY(ORBNAM)=ORBIEN
- ..S ORX=$$ONOFF^ORB3USER(ORBIEN,ORBUSR,"","") I $L($G(ORX)) D
- ...W "."
- ...S ORBNAM=$E(ORBNAM_" ",1,32)
- ...S ORY(ORYI)=ORBNAM_" "_$E($P(ORX,U)_" ",1,5)_$P(ORX,U,3),ORYI=ORYI+1
- ;
- S ORYI=ORYI+1,ORY(ORYI)="",ORYI=ORYI+1,ORY(ORYI)="",ORYI=ORYI+1
- S DESC="Notification possibilities for a user"
- S NODE=$G(^VA(200,ORBUSR,0)) S:$L($G(NODE)) HDR="Notification List for "_$P(NODE,U)
- D OUTPUT(.ORY,DESC,HDR)
- Q
- HLPMSG ;display/print help message for a user's notifications
- N ORY,ORYI
- S ORYI=1
- S ORY(ORYI)="The delivery of notifications as alerts is determined from values set for:",ORYI=ORYI+1
- S ORY(ORYI)="Users, OE/RR Teams, Service/Sections, Inpatient Locations,",ORYI=ORYI+1
- S ORY(ORYI)="Hospital Divisions, Computer System and Order Entry/Results Reporting.",ORYI=ORYI+1
- S ORY(ORYI)="Possible values include 'Enabled', 'Disabled' and 'Mandatory'. These values",ORYI=ORYI+1
- S ORY(ORYI)="indicate a User's, OE/RR Team's, Service's, Location's, Division's, System's",ORYI=ORYI+1
- S ORY(ORYI)="and OERR's desire for the notification to be 'Enabled' (sent under most",ORYI=ORYI+1
- S ORY(ORYI)="conditions), 'Disabled' (not sent), or 'Mandatory' (almost always sent.)",ORYI=ORYI+1
- S ORY(ORYI)="",ORYI=ORYI+1
- S ORY(ORYI)="All values, except the OERR (Order Entry) value, can be set by IRM",ORYI=ORYI+1
- S ORY(ORYI)="or Clinical Coordinators. Individual users can set 'Enabled/Disabled/Mandatory'",ORYI=ORYI+1
- S ORY(ORYI)="values for each specific notification via the 'Enable/Disable My Notifications'",ORYI=ORYI+1
- S ORY(ORYI)="option under the Personal Preferences and Notification Mgmt Menu option menus.",ORYI=ORYI+1
- S ORY(ORYI)="'ON' indicates the user will receive the notification under normal conditions.",ORYI=ORYI+1
- S ORY(ORYI)="'OFF' indicates the user normally will not receive the notification.",ORYI=ORYI+1
- S ORY(ORYI)="Notification recipient determination can also be influenced by patient",ORYI=ORYI+1
- S ORY(ORYI)="location (inpatients only.) This list does not consider patient location",ORYI=ORYI+1
- S ORY(ORYI)="when calculating the ON/OFF value for a notification.",ORYI=ORYI+1
- S ORY(ORYI)="",ORYI=ORYI+1,ORY(ORYI)="",ORYI=ORYI+1
- S DESC="Help Message - notification possibilities for a user"
- S HDR="Notification List Help Message"
- 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 ZTRTN,ZTSAVE,ZTDESC
- .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 List User's Notifications Report
- N END,PAGE,I,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
- LABTHR(ORBADUZ,ORBDFN,ORNUM) ;returns Lab Threshold notif recipients
- ;ORBADUZ: array of notif recipients
- ;ORBDFN: patient identifier
- ;ORNUM: order number (may or may not exist)
- ;
- N ORNUMOI,ORLAB,ORSPEC,ORY,ORI,ORSLT,ORLABSP,OROP,ORX,ORERR,ORPENT,ORPVAL
- ;
- I '$L($G(ORNUM)) D ;prompt for order number
- .K DIR S DIR(0)="NAO^::2",DIR("A")="ORDER NUMBER: "
- .S DIR("?",1)="The Lab Threshold Exceeded notification uses lab order results to determine"
- .S DIR("?",2)="alert recipients. Enter the order number associated with the lab result."
- .S DIR("?",3)="Order number must be entered as a whole number (e.g. 458829)."
- .;
- .S DIR("?")=" "
- .D ^DIR
- .S ORNUM=+Y
- Q:$D(DUOUT)
- K DIR,Y,X,DTOUT,DUOUT,DIRUT
- ;
- Q:+$G(ORNUM)<1
- S ORNUMOI=$$OI^ORQOR2(ORNUM)
- Q:+$G(ORNUMOI)<1
- S ORLAB=+$P(^ORD(101.43,ORNUMOI,0),U,2)
- S ORSPEC=$$VALUE^ORCSAVE2(ORNUM,"SPECIMEN")
- D ORDER^ORQQLR(.ORY,ORBDFN,ORNUM)
- Q:'$D(ORY) ;quit if no results found
- S ORI=0 F S ORI=$O(ORY(ORI)) Q:+$G(ORI)<1 D
- .I ORLAB=$P(ORY(ORI),U) S ORSLT=$P(ORY(ORI),U,3)
- Q:+$G(ORSLT)=0 ;quit if result is non-numeric or null
- ;
- S ORLABSP=ORLAB_";"_ORSPEC
- F OROP="<",">" D
- .D ENVAL^XPAR(.ORX,"ORB LAB "_OROP_" THRESHOLD",ORLABSP,.ORERR)
- .Q:+$G(ORERR)'=0
- .Q:+$G(ORX)=0
- .S ORPENT="" F S ORPENT=$O(ORX(ORPENT)) Q:'ORPENT D
- ..S ORPVAL=ORX(ORPENT,ORLABSP)
- ..I $L(ORPVAL) D
- ...I $P(ORPENT,";",2)="VA(200,",@(ORSLT_OROP_ORPVAL) D
- ....S ORBADUZ(+ORPENT)=""
- Q
- ORB3U2 ; slc/CLA - OE/RR 3 Notifications Utilities routine two ;5/19/97 11:07 [ 04/02/97 2:09 PM ]
- +1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**9,74,105,179**;Dec 17, 1997
- +2 QUIT
- USRNOTS(ORBUSR) ; generate a list of notifs indicating user's recip status
- +1 IF +$GET(ORBUSR)<1
- SET ORBUSR=DUZ
- +2 NEW ORY,ORYI,ORBY,ORBIEN,ORBNAM,NODE,ORX,DESC,HDR,ORBENT,ORDIV,ORZ
- +3 ;
- +4 ;get ORBUSR's Division:
- +5 IF $$DIV4^XUSER(.ORZ,ORBUSR)
- Begin DoDot:1
- +6 SET ORDIV=0
- SET ORDIV=$ORDER(ORZ(ORDIV))
- +7 IF +$GET(ORDIV)>0
- SET ORBENT=ORDIV_";DIC(4,^SYS^PKG"
- End DoDot:1
- +8 IF '$LENGTH($GET(ORBENT))
- SET ORBENT="SYS^PKG"
- +9 ;
- +10 SET ORYI=1
- +11 ;
- +12 ;prompt for additional information:
- +13 WRITE !!,"Would you like help understanding the list of notifications"
- SET %=2
- DO YN^DICN
- IF %=1
- DO HLPMSG
- +14 KILL %
- +15 ;
- +16 ;see if notification system is disabled:
- +17 SET ORX=$$GET^XPAR(ORBENT,"ORB SYSTEM ENABLE/DISABLE",1,"I")
- +18 IF ORX="D"
- Begin DoDot:1
- +19 SET ORY(ORYI)="Notifications is disabled. No notifications will be processed or delivered."
- +20 SET DESC="Notification possibilities for a user"
- +21 SET NODE=$GET(^VA(200,ORBUSR,0))
- IF $LENGTH($GET(NODE))
- SET HDR="Notification List for "_$PIECE(NODE,U)
- +22 DO OUTPUT(.ORY,DESC,HDR)
- End DoDot:1
- +23 IF ORX="D"
- QUIT
- +24 ;
- +25 WRITE !!,"This will take a moment or two, please stand by."
- +26 ;
- +27 SET ORY(ORYI)="Notification ON/OFF For This User and Why"
- SET ORYI=ORYI+1
- +28 SET ORY(ORYI)="-------------------------------- ---------------------------------------------"
- SET ORYI=ORYI+1
- +29 ;
- +30 ;loop thru all notifications and determine recipient status:
- +31 SET ORBNAM=""
- FOR
- SET ORBNAM=$ORDER(^ORD(100.9,"B",ORBNAM))
- IF ORBNAM=""
- QUIT
- Begin DoDot:1
- +32 SET ORBIEN=0
- SET ORBIEN=$ORDER(^ORD(100.9,"B",ORBNAM,ORBIEN))
- IF +$GET(ORBIEN)>0
- Begin DoDot:2
- +33 SET ORBY(ORBNAM)=ORBIEN
- +34 SET ORX=$$ONOFF^ORB3USER(ORBIEN,ORBUSR,"","")
- IF $LENGTH($GET(ORX))
- Begin DoDot:3
- +35 WRITE "."
- +36 SET ORBNAM=$EXTRACT(ORBNAM_" ",1,32)
- +37 SET ORY(ORYI)=ORBNAM_" "_$EXTRACT($PIECE(ORX,U)_" ",1,5)_$PIECE(ORX,U,3)
- SET ORYI=ORYI+1
- End DoDot:3
- End DoDot:2
- End DoDot:1
- +38 ;
- +39 SET ORYI=ORYI+1
- SET ORY(ORYI)=""
- SET ORYI=ORYI+1
- SET ORY(ORYI)=""
- SET ORYI=ORYI+1
- +40 SET DESC="Notification possibilities for a user"
- +41 SET NODE=$GET(^VA(200,ORBUSR,0))
- IF $LENGTH($GET(NODE))
- SET HDR="Notification List for "_$PIECE(NODE,U)
- +42 DO OUTPUT(.ORY,DESC,HDR)
- +43 QUIT
- HLPMSG ;display/print help message for a user's notifications
- +1 NEW ORY,ORYI
- +2 SET ORYI=1
- +3 SET ORY(ORYI)="The delivery of notifications as alerts is determined from values set for:"
- SET ORYI=ORYI+1
- +4 SET ORY(ORYI)="Users, OE/RR Teams, Service/Sections, Inpatient Locations,"
- SET ORYI=ORYI+1
- +5 SET ORY(ORYI)="Hospital Divisions, Computer System and Order Entry/Results Reporting."
- SET ORYI=ORYI+1
- +6 SET ORY(ORYI)="Possible values include 'Enabled', 'Disabled' and 'Mandatory'. These values"
- SET ORYI=ORYI+1
- +7 SET ORY(ORYI)="indicate a User's, OE/RR Team's, Service's, Location's, Division's, System's"
- SET ORYI=ORYI+1
- +8 SET ORY(ORYI)="and OERR's desire for the notification to be 'Enabled' (sent under most"
- SET ORYI=ORYI+1
- +9 SET ORY(ORYI)="conditions), 'Disabled' (not sent), or 'Mandatory' (almost always sent.)"
- SET ORYI=ORYI+1
- +10 SET ORY(ORYI)=""
- SET ORYI=ORYI+1
- +11 SET ORY(ORYI)="All values, except the OERR (Order Entry) value, can be set by IRM"
- SET ORYI=ORYI+1
- +12 SET ORY(ORYI)="or Clinical Coordinators. Individual users can set 'Enabled/Disabled/Mandatory'"
- SET ORYI=ORYI+1
- +13 SET ORY(ORYI)="values for each specific notification via the 'Enable/Disable My Notifications'"
- SET ORYI=ORYI+1
- +14 SET ORY(ORYI)="option under the Personal Preferences and Notification Mgmt Menu option menus."
- SET ORYI=ORYI+1
- +15 SET ORY(ORYI)="'ON' indicates the user will receive the notification under normal conditions."
- SET ORYI=ORYI+1
- +16 SET ORY(ORYI)="'OFF' indicates the user normally will not receive the notification."
- SET ORYI=ORYI+1
- +17 SET ORY(ORYI)="Notification recipient determination can also be influenced by patient"
- SET ORYI=ORYI+1
- +18 SET ORY(ORYI)="location (inpatients only.) This list does not consider patient location"
- SET ORYI=ORYI+1
- +19 SET ORY(ORYI)="when calculating the ON/OFF value for a notification."
- SET ORYI=ORYI+1
- +20 SET ORY(ORYI)=""
- SET ORYI=ORYI+1
- SET ORY(ORYI)=""
- SET ORYI=ORYI+1
- +21 SET DESC="Help Message - notification possibilities for a user"
- +22 SET HDR="Notification List Help Message"
- +23 DO OUTPUT(.ORY,DESC,HDR)
- +24 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 ZTRTN,ZTSAVE,ZTDESC
- +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 List User's Notifications Report
- +1 NEW END,PAGE,I,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
- LABTHR(ORBADUZ,ORBDFN,ORNUM) ;returns Lab Threshold notif recipients
- +1 ;ORBADUZ: array of notif recipients
- +2 ;ORBDFN: patient identifier
- +3 ;ORNUM: order number (may or may not exist)
- +4 ;
- +5 NEW ORNUMOI,ORLAB,ORSPEC,ORY,ORI,ORSLT,ORLABSP,OROP,ORX,ORERR,ORPENT,ORPVAL
- +6 ;
- +7 ;prompt for order number
- IF '$LENGTH($GET(ORNUM))
- Begin DoDot:1
- +8 KILL DIR
- SET DIR(0)="NAO^::2"
- SET DIR("A")="ORDER NUMBER: "
- +9 SET DIR("?",1)="The Lab Threshold Exceeded notification uses lab order results to determine"
- +10 SET DIR("?",2)="alert recipients. Enter the order number associated with the lab result."
- +11 SET DIR("?",3)="Order number must be entered as a whole number (e.g. 458829)."
- +12 ;
- +13 SET DIR("?")=" "
- +14 DO ^DIR
- +15 SET ORNUM=+Y
- End DoDot:1
- +16 IF $DATA(DUOUT)
- QUIT
- +17 KILL DIR,Y,X,DTOUT,DUOUT,DIRUT
- +18 ;
- +19 IF +$GET(ORNUM)<1
- QUIT
- +20 SET ORNUMOI=$$OI^ORQOR2(ORNUM)
- +21 IF +$GET(ORNUMOI)<1
- QUIT
- +22 SET ORLAB=+$PIECE(^ORD(101.43,ORNUMOI,0),U,2)
- +23 SET ORSPEC=$$VALUE^ORCSAVE2(ORNUM,"SPECIMEN")
- +24 DO ORDER^ORQQLR(.ORY,ORBDFN,ORNUM)
- +25 ;quit if no results found
- IF '$DATA(ORY)
- QUIT
- +26 SET ORI=0
- FOR
- SET ORI=$ORDER(ORY(ORI))
- IF +$GET(ORI)<1
- QUIT
- Begin DoDot:1
- +27 IF ORLAB=$PIECE(ORY(ORI),U)
- SET ORSLT=$PIECE(ORY(ORI),U,3)
- End DoDot:1
- +28 ;quit if result is non-numeric or null
- IF +$GET(ORSLT)=0
- QUIT
- +29 ;
- +30 SET ORLABSP=ORLAB_";"_ORSPEC
- +31 FOR OROP="<",">"
- Begin DoDot:1
- +32 DO ENVAL^XPAR(.ORX,"ORB LAB "_OROP_" THRESHOLD",ORLABSP,.ORERR)
- +33 IF +$GET(ORERR)'=0
- QUIT
- +34 IF +$GET(ORX)=0
- QUIT
- +35 SET ORPENT=""
- FOR
- SET ORPENT=$ORDER(ORX(ORPENT))
- IF 'ORPENT
- QUIT
- Begin DoDot:2
- +36 SET ORPVAL=ORX(ORPENT,ORLABSP)
- +37 IF $LENGTH(ORPVAL)
- Begin DoDot:3
- +38 IF $PIECE(ORPENT,";",2)="VA(200,"
- IF @(ORSLT_OROP_ORPVAL)
- Begin DoDot:4
- +39 SET ORBADUZ(+ORPENT)=""
- End DoDot:4
- End DoDot:3
- End DoDot:2
- End DoDot:1
- +40 QUIT