Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ORB3U2

ORB3U2.m

Go to the documentation of this file.
  1. 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
  1. Q
  1. USRNOTS(ORBUSR) ; generate a list of notifs indicating user's recip status
  1. I +$G(ORBUSR)<1 S ORBUSR=DUZ
  1. N ORY,ORYI,ORBY,ORBIEN,ORBNAM,NODE,ORX,DESC,HDR,ORBENT,ORDIV,ORZ
  1. ;
  1. ;get ORBUSR's Division:
  1. I $$DIV4^XUSER(.ORZ,ORBUSR) D
  1. .S ORDIV=0,ORDIV=$O(ORZ(ORDIV))
  1. .I +$G(ORDIV)>0 S ORBENT=ORDIV_";DIC(4,^SYS^PKG"
  1. I '$L($G(ORBENT)) S ORBENT="SYS^PKG"
  1. ;
  1. S ORYI=1
  1. ;
  1. ;prompt for additional information:
  1. W !!,"Would you like help understanding the list of notifications" S %=2 D YN^DICN I %=1 D HLPMSG
  1. K %
  1. ;
  1. ;see if notification system is disabled:
  1. S ORX=$$GET^XPAR(ORBENT,"ORB SYSTEM ENABLE/DISABLE",1,"I")
  1. I ORX="D" D
  1. .S ORY(ORYI)="Notifications is disabled. No notifications will be processed or delivered."
  1. .S DESC="Notification possibilities for a user"
  1. .S NODE=$G(^VA(200,ORBUSR,0)) S:$L($G(NODE)) HDR="Notification List for "_$P(NODE,U)
  1. .D OUTPUT(.ORY,DESC,HDR)
  1. Q:ORX="D"
  1. ;
  1. W !!,"This will take a moment or two, please stand by."
  1. ;
  1. S ORY(ORYI)="Notification ON/OFF For This User and Why",ORYI=ORYI+1
  1. S ORY(ORYI)="-------------------------------- ---------------------------------------------",ORYI=ORYI+1
  1. ;
  1. ;loop thru all notifications and determine recipient status:
  1. S ORBNAM="" F S ORBNAM=$O(^ORD(100.9,"B",ORBNAM)) Q:ORBNAM="" D
  1. .S ORBIEN=0,ORBIEN=$O(^ORD(100.9,"B",ORBNAM,ORBIEN)) I +$G(ORBIEN)>0 D
  1. ..S ORBY(ORBNAM)=ORBIEN
  1. ..S ORX=$$ONOFF^ORB3USER(ORBIEN,ORBUSR,"","") I $L($G(ORX)) D
  1. ...W "."
  1. ...S ORBNAM=$E(ORBNAM_" ",1,32)
  1. ...S ORY(ORYI)=ORBNAM_" "_$E($P(ORX,U)_" ",1,5)_$P(ORX,U,3),ORYI=ORYI+1
  1. ;
  1. S ORYI=ORYI+1,ORY(ORYI)="",ORYI=ORYI+1,ORY(ORYI)="",ORYI=ORYI+1
  1. S DESC="Notification possibilities for a user"
  1. S NODE=$G(^VA(200,ORBUSR,0)) S:$L($G(NODE)) HDR="Notification List for "_$P(NODE,U)
  1. D OUTPUT(.ORY,DESC,HDR)
  1. Q
  1. HLPMSG ;display/print help message for a user's notifications
  1. N ORY,ORYI
  1. S ORYI=1
  1. S ORY(ORYI)="The delivery of notifications as alerts is determined from values set for:",ORYI=ORYI+1
  1. S ORY(ORYI)="Users, OE/RR Teams, Service/Sections, Inpatient Locations,",ORYI=ORYI+1
  1. S ORY(ORYI)="Hospital Divisions, Computer System and Order Entry/Results Reporting.",ORYI=ORYI+1
  1. S ORY(ORYI)="Possible values include 'Enabled', 'Disabled' and 'Mandatory'. These values",ORYI=ORYI+1
  1. S ORY(ORYI)="indicate a User's, OE/RR Team's, Service's, Location's, Division's, System's",ORYI=ORYI+1
  1. S ORY(ORYI)="and OERR's desire for the notification to be 'Enabled' (sent under most",ORYI=ORYI+1
  1. S ORY(ORYI)="conditions), 'Disabled' (not sent), or 'Mandatory' (almost always sent.)",ORYI=ORYI+1
  1. S ORY(ORYI)="",ORYI=ORYI+1
  1. S ORY(ORYI)="All values, except the OERR (Order Entry) value, can be set by IRM",ORYI=ORYI+1
  1. S ORY(ORYI)="or Clinical Coordinators. Individual users can set 'Enabled/Disabled/Mandatory'",ORYI=ORYI+1
  1. S ORY(ORYI)="values for each specific notification via the 'Enable/Disable My Notifications'",ORYI=ORYI+1
  1. S ORY(ORYI)="option under the Personal Preferences and Notification Mgmt Menu option menus.",ORYI=ORYI+1
  1. S ORY(ORYI)="'ON' indicates the user will receive the notification under normal conditions.",ORYI=ORYI+1
  1. S ORY(ORYI)="'OFF' indicates the user normally will not receive the notification.",ORYI=ORYI+1
  1. S ORY(ORYI)="Notification recipient determination can also be influenced by patient",ORYI=ORYI+1
  1. S ORY(ORYI)="location (inpatients only.) This list does not consider patient location",ORYI=ORYI+1
  1. S ORY(ORYI)="when calculating the ON/OFF value for a notification.",ORYI=ORYI+1
  1. S ORY(ORYI)="",ORYI=ORYI+1,ORY(ORYI)="",ORYI=ORYI+1
  1. S DESC="Help Message - notification possibilities for a user"
  1. S HDR="Notification List Help Message"
  1. D OUTPUT(.ORY,DESC,HDR)
  1. Q
  1. OUTPUT(ORY,ORBDESC,ORBHDR) ;prompt for device and send report
  1. N POP
  1. ;prompt for device:
  1. S %ZIS="Q" ;prompt for Queueing
  1. D ^%ZIS
  1. Q:$G(POP)>0
  1. I $D(IO("Q")) D ;queue the report
  1. .S ZTRTN="PRINT^ORB3U1"
  1. .S ZTSAVE("ORY(")="",ZTSAVE("ORBHDR")=""
  1. .S ZTDESC=ORBDESC
  1. .D ^%ZTLOAD
  1. .K ZTRTN,ZTSAVE,ZTDESC
  1. .I $D(ZTSK)[0 W !!?5,"Report canceled!"
  1. .E W !!?5,"Report queued."
  1. .D HOME^%ZIS
  1. K %ZIS
  1. I $D(IO("Q")) K IO("Q") Q
  1. PRINT ;print body of List User's Notifications Report
  1. N END,PAGE,I,X
  1. S (END,PAGE,I)=0
  1. U IO
  1. D @("HDR"_(2-($E(IOST,1,2)="C-")))
  1. F S I=$O(ORY(I)) Q:I=""!(END=1) D
  1. .D HDR:$Y+5>IOSL
  1. .Q:END=1
  1. .W !,ORY(I)
  1. I END=1 W !!," - Report Interrupted -",!
  1. E W " - End of Report -",!
  1. I ($E(IOST,1,2)="C-") W !,"Press RETURN to continue: " R X:DTIME
  1. D ^%ZISC
  1. D:$G(ZTSK) KILL^%ZTLOAD
  1. Q
  1. HDR ;print header of report
  1. I PAGE,($E(IOST,1,2)="C-") D
  1. .W !,"Press RETURN to continue or '^' to exit: "
  1. .R X:DTIME S END='$T!(X="^")
  1. Q:END=1
  1. HDR1 W:'($E(IOST,1,2)='"C-"&'PAGE) @IOF
  1. HDR2 S PAGE=PAGE+1 W ?20,ORBHDR
  1. W ?(IOM-10),"Page: ",$J(PAGE,3),!!
  1. Q
  1. LABTHR(ORBADUZ,ORBDFN,ORNUM) ;returns Lab Threshold notif recipients
  1. ;ORBADUZ: array of notif recipients
  1. ;ORBDFN: patient identifier
  1. ;ORNUM: order number (may or may not exist)
  1. ;
  1. N ORNUMOI,ORLAB,ORSPEC,ORY,ORI,ORSLT,ORLABSP,OROP,ORX,ORERR,ORPENT,ORPVAL
  1. ;
  1. I '$L($G(ORNUM)) D ;prompt for order number
  1. .K DIR S DIR(0)="NAO^::2",DIR("A")="ORDER NUMBER: "
  1. .S DIR("?",1)="The Lab Threshold Exceeded notification uses lab order results to determine"
  1. .S DIR("?",2)="alert recipients. Enter the order number associated with the lab result."
  1. .S DIR("?",3)="Order number must be entered as a whole number (e.g. 458829)."
  1. .;
  1. .S DIR("?")=" "
  1. .D ^DIR
  1. .S ORNUM=+Y
  1. Q:$D(DUOUT)
  1. K DIR,Y,X,DTOUT,DUOUT,DIRUT
  1. ;
  1. Q:+$G(ORNUM)<1
  1. S ORNUMOI=$$OI^ORQOR2(ORNUM)
  1. Q:+$G(ORNUMOI)<1
  1. S ORLAB=+$P(^ORD(101.43,ORNUMOI,0),U,2)
  1. S ORSPEC=$$VALUE^ORCSAVE2(ORNUM,"SPECIMEN")
  1. D ORDER^ORQQLR(.ORY,ORBDFN,ORNUM)
  1. Q:'$D(ORY) ;quit if no results found
  1. S ORI=0 F S ORI=$O(ORY(ORI)) Q:+$G(ORI)<1 D
  1. .I ORLAB=$P(ORY(ORI),U) S ORSLT=$P(ORY(ORI),U,3)
  1. Q:+$G(ORSLT)=0 ;quit if result is non-numeric or null
  1. ;
  1. S ORLABSP=ORLAB_";"_ORSPEC
  1. F OROP="<",">" D
  1. .D ENVAL^XPAR(.ORX,"ORB LAB "_OROP_" THRESHOLD",ORLABSP,.ORERR)
  1. .Q:+$G(ORERR)'=0
  1. .Q:+$G(ORX)=0
  1. .S ORPENT="" F S ORPENT=$O(ORX(ORPENT)) Q:'ORPENT D
  1. ..S ORPVAL=ORX(ORPENT,ORLABSP)
  1. ..I $L(ORPVAL) D
  1. ...I $P(ORPENT,";",2)="VA(200,",@(ORSLT_OROP_ORPVAL) D
  1. ....S ORBADUZ(+ORPENT)=""
  1. Q
  1. WHRECIP(ORBADUZ,ORN,ORBDFN,ORBU) ;returns Women's Health notif recipients
  1. N ORSOURCE,ORTYPE,ORREF,ORPROV,ORDIV,ORSTATUS,ORPKG,ORSUBSCRIPT,ORINVDATE
  1. N ORLABDFN,OREXIT,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. I $G(ORN)=86 D Q:$D(DUOUT) 0
  1. .F D Q:($G(ORDIV)>0)!($G(OREXIT))
  1. ..S DIR(0)="NAO"_U_"::2"_U,DIR("A")="ORDER NUMBER: "
  1. ..S DIR("?",1)="When a laboratory pregnancy test result indicates a status that conflicts with"
  1. ..S DIR("?",2)="the pregnancy status stored in the Women's health package, the PREGNANCY STATUS"
  1. ..S DIR("?",3)="REVIEW notification uses the order associated with that result to determine"
  1. ..S DIR("?",4)="alert recipients. Enter the order number associated with the laboratory"
  1. ..S DIR("?",5)="pregnancy test result. Order number must be entered as a whole number"
  1. ..S DIR("?")="(e.g. 458829) and is optional."
  1. ..S DIR(0)=DIR(0)_"I ($P($G(^OR(100,X,0)),U,2)'="""_ORBDFN_";DPT("")"
  1. ..S ORSTATUS=+$O(^ORD(100.01,"B","COMPLETE",0))
  1. ..I ORSTATUS<1 D Q
  1. ...W !,"Could not find an entry named COMPLETE in the ORDER STATUS file (#100.01).",!
  1. ...W "Selection of a laboratory order is not possible at this time.",!
  1. ...S OREXIT=1
  1. ..S DIR(0)=DIR(0)_"!($P($G(^OR(100,X,3)),U,3)'="_ORSTATUS_")"
  1. ..S ORPKG=$$FIND1^DIC(9.4,"","","LAB SERVICE")
  1. ..I ORPKG="" D Q
  1. ...D MSG^DIALOG("WE")
  1. ...K ^TMP("DIERR",$J)
  1. ...W !,"Selection of a laboratory order is not possible at this time.",!
  1. ...S OREXIT=1
  1. ..S DIR(0)=DIR(0)_"!($P($G(^OR(100,X,0)),U,14)'="_ORPKG_")"
  1. ..S DIR(0)=DIR(0)_"!($P($G(^OR(100,X,4)),"";"",4)="""")"
  1. ..S DIR(0)=DIR(0)_"!($P($G(^OR(100,X,4)),"";"",5)="""") K X"
  1. ..D ^DIR
  1. ..I +Y<1 S OREXIT=1 Q
  1. ..S ORREF=$G(^OR(100,+Y,4)),ORPROV=+$P($G(^OR(100,+Y,0)),U,4)
  1. ..K DIR,X,Y
  1. ..I ORPROV>0 S ORBADUZ(ORPROV)="ORDERING PROVIDER"
  1. ..S ORLABDFN=+$G(^DPT(ORBDFN,"LR"))
  1. ..I (ORLABDFN=0)!('$D(^LR(ORLABDFN))) D Q
  1. ...W !,"Could not find the patient's entry in the LAB DATA file (#63).",!
  1. ...W "Selection of a laboratory order is not possible at this time.",!
  1. ...S OREXIT=1
  1. ..S ORSUBSCRIPT=$P(ORREF,";",4),ORINVDATE=$P(ORREF,";",5)
  1. ..S ORDIV=+$G(^LR(ORLABDFN,ORSUBSCRIPT,ORINVDATE,"RF"))
  1. ..I ORDIV<1 D Q
  1. ...W !,"Could not retrieve the releasing site from the LAB DATA file (#63).",!
  1. ...K ORDIV
  1. ..S ORSOURCE="LAB"
  1. I $G(ORSOURCE)="" D Q:$D(DIRUT) 0
  1. .S DIR(0)="PA"_U_"44:EQV",DIR("A")="LOCATION FOR CURRENT ACTIVITY (req'd): "
  1. .S DIR("?",1)="When an ICD code is added to an encounter or a problem is added to the problem"
  1. .S DIR("?",2)="list, the notification uses the location for current activities at the time of"
  1. .S DIR("?",3)="addition to determine the alert recipients. Enter the location associated with"
  1. .S DIR("?")="the hypothetical activity."
  1. .S DIR("S")="I (""C""[$P($G(^SC(Y,0)),U,3)),($$ACTLOC^ORWU(Y))"
  1. .D ^DIR
  1. .Q:$D(DIRUT)
  1. .S ORDIV=$P($G(^SC(+Y,0)),U,4)
  1. .I +ORDIV<1 D
  1. ..S ORDIV=+$$SITE^VASITE(,+$P($G(^SC(+Y,0)),U,15))
  1. ..I ORDIV>0 Q
  1. ..W !,"Unable to obtain a valid location; using your sign-on division instead.",!
  1. ..S ORDIV=DUZ(2)
  1. .S ORSOURCE="CODE"
  1. S ORTYPE=$E($P($G(^ORD(100.9,ORN,0)),U,1),1)
  1. D GETRECIPS^WVRPCPT1(.ORBADUZ,ORBDFN,ORSOURCE,ORTYPE,1,$G(ORDIV))
  1. I $G(ORBADUZ(0))'="" D
  1. .S ORBU=1+$G(ORBU),ORBU(ORBU)="WOMEN'S HEALTH: "_$P(ORBADUZ(0),U,2)
  1. .K ORBADUZ(0)
  1. Q 1
  1. GETRCPNT(ORY,ALERTID) ;
  1. N I,IDX,USERNAME,XQALUSRS,FIRST,SORT
  1. D USERLIST^XQALBUTL(ALERTID)
  1. S IDX=0,FIRST=1
  1. S I=0 F S I=$O(XQALUSRS(I)) Q:'I D
  1. . S USERNAME=$P(XQALUSRS(I),U,2)
  1. . I $L(USERNAME) D
  1. . . I FIRST S FIRST=0,IDX=IDX+1,ORY(IDX)="Alert Recipients:"
  1. . . S SORT(USERNAME)=""
  1. I $D(SORT) S I="" F S I=$O(SORT(I)) Q:I="" S IDX=IDX+1,ORY(IDX)=" "_I
  1. Q