- ORB3U2 ; SLC/CLA - OE/RR 3 Notifications Utilities routine two ;Dec 06, 2021@15:40
- ;;3.0;ORDER ENTRY/RESULTS REPORTING;**9,74,105,179,498,405**;Dec 17, 1997;Build 211
- 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
- WHRECIP(ORBADUZ,ORN,ORBDFN,ORBU) ;returns Women's Health notif recipients
- N ORSOURCE,ORTYPE,ORREF,ORPROV,ORDIV,ORSTATUS,ORPKG,ORSUBSCRIPT,ORINVDATE
- N ORLABDFN,OREXIT,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
- I $G(ORN)=86 D Q:$D(DUOUT) 0
- .F D Q:($G(ORDIV)>0)!($G(OREXIT))
- ..S DIR(0)="NAO"_U_"::2"_U,DIR("A")="ORDER NUMBER: "
- ..S DIR("?",1)="When a laboratory pregnancy test result indicates a status that conflicts with"
- ..S DIR("?",2)="the pregnancy status stored in the Women's health package, the PREGNANCY STATUS"
- ..S DIR("?",3)="REVIEW notification uses the order associated with that result to determine"
- ..S DIR("?",4)="alert recipients. Enter the order number associated with the laboratory"
- ..S DIR("?",5)="pregnancy test result. Order number must be entered as a whole number"
- ..S DIR("?")="(e.g. 458829) and is optional."
- ..S DIR(0)=DIR(0)_"I ($P($G(^OR(100,X,0)),U,2)'="""_ORBDFN_";DPT("")"
- ..S ORSTATUS=+$O(^ORD(100.01,"B","COMPLETE",0))
- ..I ORSTATUS<1 D Q
- ...W !,"Could not find an entry named COMPLETE in the ORDER STATUS file (#100.01).",!
- ...W "Selection of a laboratory order is not possible at this time.",!
- ...S OREXIT=1
- ..S DIR(0)=DIR(0)_"!($P($G(^OR(100,X,3)),U,3)'="_ORSTATUS_")"
- ..S ORPKG=$$FIND1^DIC(9.4,"","","LAB SERVICE")
- ..I ORPKG="" D Q
- ...D MSG^DIALOG("WE")
- ...K ^TMP("DIERR",$J)
- ...W !,"Selection of a laboratory order is not possible at this time.",!
- ...S OREXIT=1
- ..S DIR(0)=DIR(0)_"!($P($G(^OR(100,X,0)),U,14)'="_ORPKG_")"
- ..S DIR(0)=DIR(0)_"!($P($G(^OR(100,X,4)),"";"",4)="""")"
- ..S DIR(0)=DIR(0)_"!($P($G(^OR(100,X,4)),"";"",5)="""") K X"
- ..D ^DIR
- ..I +Y<1 S OREXIT=1 Q
- ..S ORREF=$G(^OR(100,+Y,4)),ORPROV=+$P($G(^OR(100,+Y,0)),U,4)
- ..K DIR,X,Y
- ..I ORPROV>0 S ORBADUZ(ORPROV)="ORDERING PROVIDER"
- ..S ORLABDFN=+$G(^DPT(ORBDFN,"LR"))
- ..I (ORLABDFN=0)!('$D(^LR(ORLABDFN))) D Q
- ...W !,"Could not find the patient's entry in the LAB DATA file (#63).",!
- ...W "Selection of a laboratory order is not possible at this time.",!
- ...S OREXIT=1
- ..S ORSUBSCRIPT=$P(ORREF,";",4),ORINVDATE=$P(ORREF,";",5)
- ..S ORDIV=+$G(^LR(ORLABDFN,ORSUBSCRIPT,ORINVDATE,"RF"))
- ..I ORDIV<1 D Q
- ...W !,"Could not retrieve the releasing site from the LAB DATA file (#63).",!
- ...K ORDIV
- ..S ORSOURCE="LAB"
- I $G(ORSOURCE)="" D Q:$D(DIRUT) 0
- .S DIR(0)="PA"_U_"44:EQV",DIR("A")="LOCATION FOR CURRENT ACTIVITY (req'd): "
- .S DIR("?",1)="When an ICD code is added to an encounter or a problem is added to the problem"
- .S DIR("?",2)="list, the notification uses the location for current activities at the time of"
- .S DIR("?",3)="addition to determine the alert recipients. Enter the location associated with"
- .S DIR("?")="the hypothetical activity."
- .S DIR("S")="I (""C""[$P($G(^SC(Y,0)),U,3)),($$ACTLOC^ORWU(Y))"
- .D ^DIR
- .Q:$D(DIRUT)
- .S ORDIV=$P($G(^SC(+Y,0)),U,4)
- .I +ORDIV<1 D
- ..S ORDIV=+$$SITE^VASITE(,+$P($G(^SC(+Y,0)),U,15))
- ..I ORDIV>0 Q
- ..W !,"Unable to obtain a valid location; using your sign-on division instead.",!
- ..S ORDIV=DUZ(2)
- .S ORSOURCE="CODE"
- S ORTYPE=$E($P($G(^ORD(100.9,ORN,0)),U,1),1)
- D GETRECIPS^WVRPCPT1(.ORBADUZ,ORBDFN,ORSOURCE,ORTYPE,1,$G(ORDIV))
- I $G(ORBADUZ(0))'="" D
- .S ORBU=1+$G(ORBU),ORBU(ORBU)="WOMEN'S HEALTH: "_$P(ORBADUZ(0),U,2)
- .K ORBADUZ(0)
- Q 1
- GETRCPNT(ORY,ALERTID) ;
- N I,IDX,USERNAME,XQALUSRS,FIRST,SORT
- D USERLIST^XQALBUTL(ALERTID)
- S IDX=0,FIRST=1
- S I=0 F S I=$O(XQALUSRS(I)) Q:'I D
- . S USERNAME=$P(XQALUSRS(I),U,2)
- . I $L(USERNAME) D
- . . I FIRST S FIRST=0,IDX=IDX+1,ORY(IDX)="Alert Recipients:"
- . . S SORT(USERNAME)=""
- I $D(SORT) S I="" F S I=$O(SORT(I)) Q:I="" S IDX=IDX+1,ORY(IDX)=" "_I
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORB3U2 10229 printed Feb 18, 2025@23:54:07 Page 2
- ORB3U2 ; SLC/CLA - OE/RR 3 Notifications Utilities routine two ;Dec 06, 2021@15:40
- +1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**9,74,105,179,498,405**;Dec 17, 1997;Build 211
- +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
- WHRECIP(ORBADUZ,ORN,ORBDFN,ORBU) ;returns Women's Health notif recipients
- +1 NEW ORSOURCE,ORTYPE,ORREF,ORPROV,ORDIV,ORSTATUS,ORPKG,ORSUBSCRIPT,ORINVDATE
- +2 NEW ORLABDFN,OREXIT,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
- +3 IF $GET(ORN)=86
- Begin DoDot:1
- +4 FOR
- Begin DoDot:2
- +5 SET DIR(0)="NAO"_U_"::2"_U
- SET DIR("A")="ORDER NUMBER: "
- +6 SET DIR("?",1)="When a laboratory pregnancy test result indicates a status that conflicts with"
- +7 SET DIR("?",2)="the pregnancy status stored in the Women's health package, the PREGNANCY STATUS"
- +8 SET DIR("?",3)="REVIEW notification uses the order associated with that result to determine"
- +9 SET DIR("?",4)="alert recipients. Enter the order number associated with the laboratory"
- +10 SET DIR("?",5)="pregnancy test result. Order number must be entered as a whole number"
- +11 SET DIR("?")="(e.g. 458829) and is optional."
- +12 SET DIR(0)=DIR(0)_"I ($P($G(^OR(100,X,0)),U,2)'="""_ORBDFN_";DPT("")"
- +13 SET ORSTATUS=+$ORDER(^ORD(100.01,"B","COMPLETE",0))
- +14 IF ORSTATUS<1
- Begin DoDot:3
- +15 WRITE !,"Could not find an entry named COMPLETE in the ORDER STATUS file (#100.01).",!
- +16 WRITE "Selection of a laboratory order is not possible at this time.",!
- +17 SET OREXIT=1
- End DoDot:3
- QUIT
- +18 SET DIR(0)=DIR(0)_"!($P($G(^OR(100,X,3)),U,3)'="_ORSTATUS_")"
- +19 SET ORPKG=$$FIND1^DIC(9.4,"","","LAB SERVICE")
- +20 IF ORPKG=""
- Begin DoDot:3
- +21 DO MSG^DIALOG("WE")
- +22 KILL ^TMP("DIERR",$JOB)
- +23 WRITE !,"Selection of a laboratory order is not possible at this time.",!
- +24 SET OREXIT=1
- End DoDot:3
- QUIT
- +25 SET DIR(0)=DIR(0)_"!($P($G(^OR(100,X,0)),U,14)'="_ORPKG_")"
- +26 SET DIR(0)=DIR(0)_"!($P($G(^OR(100,X,4)),"";"",4)="""")"
- +27 SET DIR(0)=DIR(0)_"!($P($G(^OR(100,X,4)),"";"",5)="""") K X"
- +28 DO ^DIR
- +29 IF +Y<1
- SET OREXIT=1
- QUIT
- +30 SET ORREF=$GET(^OR(100,+Y,4))
- SET ORPROV=+$PIECE($GET(^OR(100,+Y,0)),U,4)
- +31 KILL DIR,X,Y
- +32 IF ORPROV>0
- SET ORBADUZ(ORPROV)="ORDERING PROVIDER"
- +33 SET ORLABDFN=+$GET(^DPT(ORBDFN,"LR"))
- +34 IF (ORLABDFN=0)!('$DATA(^LR(ORLABDFN)))
- Begin DoDot:3
- +35 WRITE !,"Could not find the patient's entry in the LAB DATA file (#63).",!
- +36 WRITE "Selection of a laboratory order is not possible at this time.",!
- +37 SET OREXIT=1
- End DoDot:3
- QUIT
- +38 SET ORSUBSCRIPT=$PIECE(ORREF,";",4)
- SET ORINVDATE=$PIECE(ORREF,";",5)
- +39 SET ORDIV=+$GET(^LR(ORLABDFN,ORSUBSCRIPT,ORINVDATE,"RF"))
- +40 IF ORDIV<1
- Begin DoDot:3
- +41 WRITE !,"Could not retrieve the releasing site from the LAB DATA file (#63).",!
- +42 KILL ORDIV
- End DoDot:3
- QUIT
- +43 SET ORSOURCE="LAB"
- End DoDot:2
- if ($GET(ORDIV)>0)!($GET(OREXIT))
- QUIT
- End DoDot:1
- if $DATA(DUOUT)
- QUIT 0
- +44 IF $GET(ORSOURCE)=""
- Begin DoDot:1
- +45 SET DIR(0)="PA"_U_"44:EQV"
- SET DIR("A")="LOCATION FOR CURRENT ACTIVITY (req'd): "
- +46 SET DIR("?",1)="When an ICD code is added to an encounter or a problem is added to the problem"
- +47 SET DIR("?",2)="list, the notification uses the location for current activities at the time of"
- +48 SET DIR("?",3)="addition to determine the alert recipients. Enter the location associated with"
- +49 SET DIR("?")="the hypothetical activity."
- +50 SET DIR("S")="I (""C""[$P($G(^SC(Y,0)),U,3)),($$ACTLOC^ORWU(Y))"
- +51 DO ^DIR
- +52 if $DATA(DIRUT)
- QUIT
- +53 SET ORDIV=$PIECE($GET(^SC(+Y,0)),U,4)
- +54 IF +ORDIV<1
- Begin DoDot:2
- +55 SET ORDIV=+$$SITE^VASITE(,+$PIECE($GET(^SC(+Y,0)),U,15))
- +56 IF ORDIV>0
- QUIT
- +57 WRITE !,"Unable to obtain a valid location; using your sign-on division instead.",!
- +58 SET ORDIV=DUZ(2)
- End DoDot:2
- +59 SET ORSOURCE="CODE"
- End DoDot:1
- if $DATA(DIRUT)
- QUIT 0
- +60 SET ORTYPE=$EXTRACT($PIECE($GET(^ORD(100.9,ORN,0)),U,1),1)
- +61 DO GETRECIPS^WVRPCPT1(.ORBADUZ,ORBDFN,ORSOURCE,ORTYPE,1,$GET(ORDIV))
- +62 IF $GET(ORBADUZ(0))'=""
- Begin DoDot:1
- +63 SET ORBU=1+$GET(ORBU)
- SET ORBU(ORBU)="WOMEN'S HEALTH: "_$PIECE(ORBADUZ(0),U,2)
- +64 KILL ORBADUZ(0)
- End DoDot:1
- +65 QUIT 1
- GETRCPNT(ORY,ALERTID) ;
- +1 NEW I,IDX,USERNAME,XQALUSRS,FIRST,SORT
- +2 DO USERLIST^XQALBUTL(ALERTID)
- +3 SET IDX=0
- SET FIRST=1
- +4 SET I=0
- FOR
- SET I=$ORDER(XQALUSRS(I))
- if 'I
- QUIT
- Begin DoDot:1
- +5 SET USERNAME=$PIECE(XQALUSRS(I),U,2)
- +6 IF $LENGTH(USERNAME)
- Begin DoDot:2
- +7 IF FIRST
- SET FIRST=0
- SET IDX=IDX+1
- SET ORY(IDX)="Alert Recipients:"
- +8 SET SORT(USERNAME)=""
- End DoDot:2
- End DoDot:1
- +9 IF $DATA(SORT)
- SET I=""
- FOR
- SET I=$ORDER(SORT(I))
- if I=""
- QUIT
- SET IDX=IDX+1
- SET ORY(IDX)=" "_I
- +10 QUIT