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

ORKUTL.m

Go to the documentation of this file.
  1. ORKUTL ; slc/CLA - Utility routine for order checking ;5/21/97 16:25
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**6**;Dec 17, 1997
  1. ONOFF(ORK,ORKUSR,ORKPT) ;Extrinsic function to check param file determines if
  1. ; user ORKUSR should receive order check ORK for patient ORKPT.
  1. ;ORK order check ien from file 864.5 (req'd)
  1. ;ORKUSR user ien from file 200 (req'd)
  1. ;ORKPT patient ien from file 2 (not req'd)
  1. ;
  1. N NODE,ORKNAME,ORKUSRN,ORKUSRF,ORKPTN,ORKLOC,ORKLOCN,ORKLOCF
  1. N ORKSRV,ORKSRVN,ORKSRVF,ORKDIVF,ORKSYSF,ORKPKGF
  1. ;
  1. ;get order check name:
  1. S NODE=$G(^ORD(100.8,ORK,0)) S:$L($G(NODE)) ORKNAME=$P(NODE,U)
  1. ;
  1. ;get user name:
  1. S NODE=$G(^VA(200,ORKUSR,0)) S:$L($G(NODE)) ORKUSRN=$P(NODE,U)
  1. ;
  1. ;get patient name:
  1. S:$L($G(ORKPT)) NODE=$G(^DPT(ORKPT,0)) S:$L($G(NODE)) ORKPTN=$P(NODE,U)
  1. ;
  1. ;get patient's location (INPATIENT ONLY - outpt locations cannot be
  1. ;reliably determined, and many simultaneous outpt locations can occur):
  1. I +$G(ORKPT)>0 D
  1. .N DFN S DFN=ORKPT,VA200="" D OERR^VADPT
  1. .S ORKLOC=+$G(^DIC(42,+VAIN(4),44)) I +$G(ORKLOC)>0 D
  1. ..S ORKLOCN=$P(^SC(+ORKLOC,0),U)
  1. K VA200,VAIN
  1. ;
  1. ;get user's service/section:
  1. S ORKSRV=$G(^VA(200,ORKUSR,5)) I +ORKSRV>0 S ORKSRV=$P(ORKSRV,U) D
  1. .S NODE=$G(^DIC(49,ORKSRV,0)) S:$L($G(NODE)) ORKSRVN=$P(NODE,U)
  1. ;
  1. S ORK="`"_ORK
  1. ;
  1. ;get user's flag:
  1. S ORKUSRF=$$GET^XPAR("USR.`"_+$G(ORKUSR),"ORK PROCESSING FLAG",ORK,"B")
  1. Q:$L($G(ORKUSRF)) $S($P(ORKUSRF,U)="D":"OFF",1:"ON")_"^User value is "_$P(ORKUSRF,U,2)
  1. ;
  1. ;get patient location flag:
  1. I +$G(ORKLOC)>0 D
  1. .S ORKLOCF=$$GET^XPAR("LOC.`"_+$G(ORKLOC),"ORK PROCESSING FLAG",ORK,"B")
  1. Q:$L($G(ORKLOCF)) $S($P(ORKLOCF,U)="D":"OFF",1:"ON")_"^Pt's location "_ORKLOCN_" value is "_$P(ORKLOCF,U,2)
  1. ;
  1. ;get user's service flag:
  1. I +$G(ORKSRV)>0 D
  1. .S ORKSRVF=$$GET^XPAR("SRV.`"_+$G(ORKSRV),"ORK PROCESSING FLAG",ORK,"B")
  1. Q:$L($G(ORKSRVF)) $S($P(ORKSRVF,U)="D":"OFF",1:"ON")_"^User's service "_ORKSRVN_" value is "_$P(ORKSRVF,U,2)
  1. ;
  1. ;get user's division flag:
  1. S ORKDIVF=$$GET^XPAR("DIV","ORK PROCESSING FLAG",ORK,"B")
  1. Q:$L($G(ORKDIVF)) $S($P(ORKDIVF,U)="D":"OFF",1:"ON")_"^Division value is "_$P(ORKDIVF,U,2)
  1. ;
  1. ;get system flag:
  1. S ORKSYSF=$$GET^XPAR("SYS","ORK PROCESSING FLAG",ORK,"B")
  1. Q:$L($G(ORKSYSF)) $S($P(ORKSYSF,U)="D":"OFF",1:"ON")_"^System value is "_$P(ORKSYSF,U,2)
  1. ;
  1. ;get OE/RR package-exported flag:
  1. S ORKPKGF=$$GET^XPAR("PKG","ORK PROCESSING FLAG",ORK,"B")
  1. Q:$L($G(ORKPKGF)) $S($P(ORKPKGF,U)="D":"OFF",1:"ON")_"^OERR value is "_$P(ORKPKGF,U,2)
  1. ;
  1. Q "ON^No value found"
  1. USRCHKS(ORKUSR) ; generate a list of order checks indicating user's recip status
  1. I +$G(ORKUSR)<1 S ORKUSR=DUZ
  1. N ORY,ORYI,ORKY,ORKIEN,ORKNAM,NODE,ORX,DESC,HDR
  1. S ORYI=1
  1. ;
  1. ;prompt for additional information:
  1. W !!,"Would you like help understanding the list of order checks" S %=2 D YN^DICN I %=1 D HLPMSG
  1. K %
  1. ;
  1. ;see if order checking system is disabled:
  1. S ORX=$$GET^XPAR("DIV^SYS^PKG","ORK SYSTEM ENABLE/DISABLE",1,"I")
  1. I ORX="D" D
  1. .S ORY(ORYI)="Order Checking is disabled. No order checks will be processed or displayed."
  1. .S NODE=$G(^VA(200,ORKUSR,0)) S:$L($G(NODE)) HDR="Order Check List for "_$P(NODE,U)
  1. .S DESC="Order check possibilities for a user"
  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)="Order Check ON/OFF For This User and Why",ORYI=ORYI+1
  1. S ORY(ORYI)="-------------------------------- ---------------------------------------------",ORYI=ORYI+1
  1. ;
  1. ;loop thru all order checks and determine recipient status:
  1. S ORKNAM="" F S ORKNAM=$O(^ORD(100.8,"B",ORKNAM)) Q:ORKNAM="" D
  1. .S ORKIEN=0,ORKIEN=$O(^ORD(100.8,"B",ORKNAM,ORKIEN)) I +$G(ORKIEN)>0 D
  1. ..S ORKY(ORKNAM)=ORKIEN
  1. ..S ORX=$$ONOFF(ORKIEN,ORKUSR,"") I $L($G(ORX)) D
  1. ...W "."
  1. ...S ORKNAM=$E(ORKNAM_" ",1,32)
  1. ...S ORY(ORYI)=ORKNAM_" "_$E($P(ORX,U)_" ",1,5)_$P(ORX,U,2),ORYI=ORYI+1
  1. ;
  1. S ORYI=ORYI+1,ORY(ORYI)="",ORYI=ORYI+1,ORY(ORYI)="",ORYI=ORYI+1
  1. S DESC="Order check possibilities for a user"
  1. S NODE=$G(^VA(200,ORKUSR,0)) S:$L($G(NODE)) HDR="Order Check List for "_$P(NODE,U)
  1. D OUTPUT(.ORY,DESC,HDR)
  1. Q
  1. HLPMSG ;display/print help message for a user's order checks
  1. N ORY,ORYI
  1. S ORYI=1
  1. S ORY(ORYI)="The delivery of order checks is determined from values set for Users,",ORYI=ORYI+1
  1. S ORY(ORYI)="Inpatient Locations, Service/Sections, Hospital Divisions, Computer System and",ORYI=ORYI+1
  1. S ORY(ORYI)="OERR. Possible values include 'Enabled' and 'Disabled'. These values indicate",ORYI=ORYI+1
  1. S ORY(ORYI)="a User's, Location's, Service/Section's, Division's, System's and OERR's",ORYI=ORYI+1
  1. S ORY(ORYI)="desire for the order check to be 'Enabled' (displayed under most",ORYI=ORYI+1
  1. S ORY(ORYI)="circumstances) or 'Disabled' (normally not displayed.)",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 their 'Enabled/Disabled'",ORYI=ORYI+1
  1. S ORY(ORYI)="values for each specific order check via the 'Enable/Disable My Order Checks'",ORYI=ORYI+1
  1. S ORY(ORYI)="option under the Personal Preferences and Order Check Management for Users.",ORYI=ORYI+1
  1. S ORY(ORYI)="'ON' indicates the user will receive the order check under normal conditions.",ORYI=ORYI+1
  1. S ORY(ORYI)="'OFF' indicates the user normally will not receive the order check.",ORYI=ORYI+1
  1. S ORY(ORYI)="Order check 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 an order check because a patient is",ORYI=ORYI+1
  1. S ORY(ORYI)="not known when the option is selected.",ORYI=ORYI+1
  1. S ORY(ORYI)="",ORYI=ORYI+1,ORY(ORYI)="",ORYI=ORYI+1
  1. S DESC="Help Message - order check possibilities for a user"
  1. S HDR="Order Check List Help Message"
  1. D OUTPUT(.ORY,DESC,HDR)
  1. Q
  1. OUTPUT(ORY,ORKDESC,ORKHDR) ;prompt for device and send report
  1. N POP,ORBHDR
  1. N ZTRTN,ZTSAVE,ZTDESC
  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 ORBHDR=ORKHDR
  1. .S ZTSAVE("ORY(")="",ZTSAVE("ORBHDR")=""
  1. .S ZTDESC=ORKDESC
  1. .D ^%ZTLOAD
  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 Order checks 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,ORKHDR
  1. W ?(IOM-10),"Page: ",$J(PAGE,3),!!
  1. Q