RAORD ;HISC/CAH,FPT,GJC AISC/RMO-Rad/NM Order Entry Main Menu ;3/13/98 12:16
;;5.0;Radiology/Nuclear Medicine;;Mar 16, 1998
2 ;;Schedule a Request
N RAPTLOCK
21 ; Patient lookup
S DIC="^DPT(",DIC(0)="AEMQ" W ! D ^DIC K DIC G Q2:Y<0
I $$ORVR^RAORDU()'<3 D G:'RAPTLOCK 21
. S RAPTLOCK=$$LK^RAUTL19(+Y_";DPT(")
. Q
S RADFN=+Y,RANME=$S($D(^DPT(RADFN,0)):$P(^(0),"^"),1:"Unknown")
S (RAOFNS,RAOPTN)="Schedule",RAOVSTS="3;5"
W ! D ^RAORDS G Q2:'$D(RAORDS)
S %DT("A")="Schedule Request Date/Time: ",%DT="AEFXT"
W ! D ^%DT K %DT G Q2:Y<0 S RAOSCH=Y,RAOLP=0
F S RAOLP=+$O(RAORDS(RAOLP)) Q:'RAOLP!('+$G(RAORDS(RAOLP))) D
. S RAOIFN=$G(RAORDS(RAOLP)),RAOSTS=8 D ^RAORDU
. Q
D Q2 G 21
Q2 ; Unlock if appropriate, kill vars
I $$ORVR^RAORDU()'<3,(+$G(RAPTLOCK)),(+$G(RADFN)) D
. D ULK^RAUTL19(RADFN_";DPT(")
K %DT,C,D,D0,DA,I,RADFN,RADIV,RANME,RAOFNS,RAOIFN,RAOLP,RAORDS,RAOSCH
K RAOPTN,RAOSTS,RAOVSTS,X,Y
K RAPARENT
K A1,D1,DDER,DDH,DI,DIPGM,POP,^TMP($J,"PRO-ORD")
Q
;
3 ;;Cancel a Request
N RAPTLOCK,RAXIT S RAXIT=0,RAPKG=""
31 ; Patient lookup
S DIC="^DPT(",DIC(0)="AEMQ" W ! D ^DIC K DIC G Q3:Y<0
I $$ORVR^RAORDU()'<3 D G:'RAPTLOCK 31
. S RAPTLOCK=$$LK^RAUTL19(+Y_";DPT(")
. Q
S RADFN=+Y,RANME=$S($D(^DPT(RADFN,0)):$P(^(0),"^"),1:"Unknown")
S (RAOFNS,RAOPTN)="Cancel"
D CHKUSR^RAUTL2 S RAOVSTS=$S(RAMSG:"3;5;8",1:"5")
W ! D ^RAORDS G Q3:'$D(RAORDS)
D REASON G Q3:RAXIT!(+$G(OREND))
ENCAN ;OE/RR Entry Point for the CANCEL ACTION Option
K ORSTRT,ORSTOP,ORTO,ORTX,ORIT,ORCOST,ORPURG
I $D(RAPKG) W !?3,"...will now 'CANCEL' selected request(s)..."
S RAOLP=0
F S RAOLP=+$O(RAORDS(RAOLP)) Q:'RAOLP!('+$G(RAORDS(RAOLP))) D
. S RAOIFN=$G(RAORDS(RAOLP)),RAOSTS=1 D ^RAORDU
. I $D(RAPKG),$D(^RAO(75.1,RAOIFN,0)),$D(^RAMIS(71,+$P(^(0),"^",2),0)) W !?10,"...",$P(^(0),"^")," cancelled..."
. ; Print Cancelled Requests if appropriate
. K RA751,RA791 S RA751=$G(^RAO(75.1,RAOIFN,0))
. S RA791=$G(^RA(79.1,+$P(RA751,"^",20),0))
. I $P(RA791,"^",24)]""!(+$P($G(^RA(79.1,+$O(^RA(79.1,0)),0)),"^",24)) D
.. K RACRHD,RAION,RAPGE,RAX S RAPGE=0,(RACRHD,RAX)=""
.. ; RAOIFN already defined, RADFN may/maynot be defined!
.. I '$D(RADFN) N RADFN S RADFN=+$P(RA751,"^")
.. S RAION=$S($P(RA791,"^",24)]"":$P(RA791,"^",24),1:+$P($G(^RA(79.1,+$O(^RA(79.1,0)),0)),"^",24))
.. S RAION=$$GET1^DIQ(3.5,RAION_",",.01)
.. D PCR ; Print Cancelled Request subroutine
.. K RACRHD,RAION,RAPGE,RAX
.. Q
. K RA751,RA791
. Q
Q3 ; unlock if appropriate, kill variables
I $$ORVR^RAORDU()'<3,(+$G(RAPTLOCK)),(+$G(RADFN)) D
. D ULK^RAUTL19(RADFN_";DPT(")
K %,%DT,C,D,D0,DA,POP,RADFN,RADIV,RAMSG,RANME,RAOFNS,RAOIFN,RAOLP
K RAOPTN,RAORDS,RAOSTS,RAOVSTS I $D(RAPKG) K OREND,RAPKG
I '$D(N)!($D(RAOREA)<10) K RAPARENT,X,Y
I '$D(N)!($D(RAOREA)<10) K RAOREA G Q35
I $D(RAOREA)>1,$G(N) K RAOREA(N),N I $D(RAOREA)<10 K RAOREA
K RAPARENT,X,Y
Q35 K DIPGM,I
Q
CHECK ; Check on the status of the order
S OREND=$S(ORSTS=5:0,ORSTS=11:0,1:1) W:OREND !!,"Only orders in a Pending or Unreleased status can be cancelled.",$C(7)
Q
REASON ; Select a Cancel Reason
S DIC("A")="Select CANCEL REASON: ",DIC("S")="I $P(^(0),U,2)=1!($P(^(0),U,2)=9)",DIC="^RA(75.2,",DIC(0)="AEMQ"
W ! D ^DIC K DIC
I +Y<0,(X["^") S RAXIT=1 Q
I +Y<0 W !!?3,"A Cancel Reason is required to proceed." G REASON
S OREND=0,RAOREA($S($D(ORPK):ORPK,$D(ORIFN):ORIFN,1:1))=+Y
Q
4 ;;Hold a Request
N RAPTLOCK
40 ; Patient lookup
S DIC="^DPT(",DIC(0)="AEMQ" W ! D ^DIC K DIC G Q4:Y<0
I $$ORVR^RAORDU()'<3 D G:'RAPTLOCK 40
. S RAPTLOCK=$$LK^RAUTL19(+Y_";DPT(")
. Q
S RADFN=+Y,RANME=$S($D(^DPT(RADFN,0)):$P(^(0),"^"),1:"Unknown")
S (RAOFNS,RAOPTN)="Hold",RAOVSTS="5;8"
W ! D ^RAORDS G Q4:'$D(RAORDS)
41 ; Select a Hold Reason
S DIC("A")="Select HOLD REASON: ",DIC("S")="I $P(^(0),U,2)=3!($P(^(0),U,2)=9)",DIC="^RA(75.2,",DIC(0)="AEMQ" W ! D ^DIC K DIC
I +Y<0,(X["^") D Q4 Q
I +Y<0 W !!?3,"A Hold Reason is required to proceed." G 41
S RAOREA=+Y
W !?3,"...will now 'HOLD' selected request(s)..." S RAOLP=0
F S RAOLP=+$O(RAORDS(RAOLP)) Q:'RAOLP!('+$G(RAORDS(RAOLP))) D
. S RAOIFN=$G(RAORDS(RAOLP)),RAOSTS=3 D ^RAORDU
. I $D(^RAO(75.1,RAOIFN,0)),$D(^RAMIS(71,+$P(^(0),"^",2),0)) W !?10,"...",$P(^(0),"^")," held..."
. Q
D Q4 G 40
Q4 ; unlock if appropriate, kill variables
I $$ORVR^RAORDU()'<3,(+$G(RAPTLOCK)),(+$G(RADFN)) D
. D ULK^RAUTL19(RADFN_";DPT(")
K %DT,C,D,D0,DA,I,POP,RADFN,RADIV,RANME,RAOFNS,RAOIFN,RAOLP,RAORDS
K RAOPTN,RAOREA,RAOSTS,RAOVSTS,X,Y
K D1,DDER,DI,DIPGM,DISYS,DUOUT,RAPARENT,^TMP($J,"PRO-ORD"),^("XQALSET")
Q
;
9 ;;Print Selected Requests by Patient
K ^TMP($J,"RA PRINT HS BY PAT")
S DIC="^DPT(",DIC(0)="AEMQ" W ! D ^DIC K DIC G Q9:Y<0 S RADFN=+Y,RANME=$S($D(^DPT(RADFN,0)):$P(^(0),"^"),1:"Unknown"),RAOFNS="Print",RAOVSTS="1;2;3;5;6;8" W ! D ^RAORDS G Q9:'$D(RAORDS)
S RAOIFNS="" F RAOLP=1:1 Q:'$D(RAORDS(RAOLP)) S RAOIFNS=RAOIFNS_+RAORDS(RAOLP)_";"
W ! K DIR,DIROUT,DIRUT,DTOUT,DUOUT
S DIR(0)="Y",DIR("B")="No"
S DIR("?")="Answer 'Y'es to print the report, 'N'o to quit."
S DIR("A")="Do you wish to generate a Health Summary Report"
D ^DIR G:$D(DIRUT) Q9 S RAGMTS=+Y
S ZTRTN="START9^RAORD",ZTSAVE("RADFN")="",ZTSAVE("RAOIFNS")=""
S ZTSAVE("RAGMTS")="" S:$D(RAOPT) ZTSAVE("RAOPT(")=""
W ! D ZIS^RAUTL G Q9:RAPOP
;
START9 ; Start printing requests
U IO S RAX="" N RA751
F RAOLP=1:1 S RAOIFN=$P(RAOIFNS,";",RAOLP) Q:'RAOIFN!(RAX["^") D
. S RAPGE=0 D ^RAORD5 Q:RAX["^"
. D CRCHK^RAORD6 Q:RAX["^"
. Q:'RAGMTS ; quit if 'No' to 'generate a Health Summary Report'.
. S RA751(0)=$G(^RAO(75.1,RAOIFN,0)),RA751(2)=$P(RA751(0),"^",2)
. S GMTSTYP=$P($G(^RAMIS(71,+RA751(2),0)),"^",13)
. I GMTSTYP>0,('$D(^TMP($J,"RA PRINT HS BY PAT",GMTSTYP,RADFN))) D
.. W:$Y>0 @IOF D ENX^GMTSDVR(RADFN,GMTSTYP)
.. S ^TMP($J,"RA PRINT HS BY PAT",GMTSTYP,RADFN)=""
.. Q
. Q
Q9 K %DT,C,D,D0,DA,DFN,GMTSTYP,I,POP,RACNI,RADFN,RADIV,RADTI,RANME,RAOFNS
K RAOIFN,RAOIFNS,RAOLP,RAORDS,RAOSTS,RAOVSTS,RAPARENT,RAPGE,RAPOP,RAX
K RAGMTS,VAI,VAIN,X,Y,Z,^TMP($J,"RA PRINT HS BY PAT")
K RAMES,ZTDESC,ZTRTN,ZTSAVE
K DIR,DIROUT,DIRUT,DTOUT,DUOUT
K DIPGM,DISYS,DIW,DIWT,DN,RA6,RA7,^TMP($J,"PRO-ORD")
W ! D CLOSE^RAUTL
Q
KILL ; kill variables - called from RAORD1
K %,%DT,D,D0,D1,DA,DFN,DIC,DIK,DIROUT,DIRUT,DIV,DR,DTOUT,DUOUT,DWPK,J,OREND,RABLNK,RACNT,RACT,RADIV,RAEXMUL,RAFIN,RAFIN1,RAI,RAILOC,RAIMGTYI,RAIP,RAJ,RAL0,RALOC,RALIFN,RALOCFLG
K RAMOD,RAMT,RANUM,RAOIFN,RAORD0,RAOUT,RAPIFN,RAPRC,RAPRI,RAPREG,RAPREOP1,RAREASK,RAREQDT,RAREQPRT,RARU,RARX,RASEQ,RAS3,RASEX,RASKPREG,RASTOP,RASX,RAWHEN,RAX,VAERR,VA200,VAI,VAIP,X,Y
K RAACI
I '$D(RAPKG),$G(XQORS)>1,$G(^TMP("XQORS",$J,XQORS-1,"ITM"))'=$G(^("TOT")) Q ;don't kill clin hist if order entry quick orders not all proccessed
K ^TMP($J,"RAWP")
Q
PCR ; Print Cancelled Requests. Called from the 'Cancel A Request' option.
N I,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
S ZTDESC="Rad/Nuc Med Cancelled Request Print",ZTDTH=$H,ZTIO=RAION
S ZTRTN="^RAORD5"
F I="RACRHD","RADFN","RAOIFN","RAPGE","RAX" S ZTSAVE(I)=""
D ^%ZTLOAD W:$D(ZTSK) !!?3,$C(7),"Task "_ZTSK_": cancellation queued to print on device ",RAION,!
D HOME^%ZIS
Q
RAORD ;HISC/CAH,FPT,GJC AISC/RMO-Rad/NM Order Entry Main Menu ;3/13/98 12:16
+1 ;;5.0;Radiology/Nuclear Medicine;;Mar 16, 1998
2 ;;Schedule a Request
+1 NEW RAPTLOCK
21 ; Patient lookup
+1 SET DIC="^DPT("
SET DIC(0)="AEMQ"
WRITE !
DO ^DIC
KILL DIC
IF Y<0
GOTO Q2
+2 IF $$ORVR^RAORDU()'<3
Begin DoDot:1
+3 SET RAPTLOCK=$$LK^RAUTL19(+Y_";DPT(")
+4 QUIT
End DoDot:1
IF 'RAPTLOCK
GOTO 21
+5 SET RADFN=+Y
SET RANME=$SELECT($DATA(^DPT(RADFN,0)):$PIECE(^(0),"^"),1:"Unknown")
+6 SET (RAOFNS,RAOPTN)="Schedule"
SET RAOVSTS="3;5"
+7 WRITE !
DO ^RAORDS
IF '$DATA(RAORDS)
GOTO Q2
+8 SET %DT("A")="Schedule Request Date/Time: "
SET %DT="AEFXT"
+9 WRITE !
DO ^%DT
KILL %DT
IF Y<0
GOTO Q2
SET RAOSCH=Y
SET RAOLP=0
+10 FOR
SET RAOLP=+$ORDER(RAORDS(RAOLP))
IF 'RAOLP!('+$GET(RAORDS(RAOLP)))
QUIT
Begin DoDot:1
+11 SET RAOIFN=$GET(RAORDS(RAOLP))
SET RAOSTS=8
DO ^RAORDU
+12 QUIT
End DoDot:1
+13 DO Q2
GOTO 21
Q2 ; Unlock if appropriate, kill vars
+1 IF $$ORVR^RAORDU()'<3
IF (+$GET(RAPTLOCK))
IF (+$GET(RADFN))
Begin DoDot:1
+2 DO ULK^RAUTL19(RADFN_";DPT(")
End DoDot:1
+3 KILL %DT,C,D,D0,DA,I,RADFN,RADIV,RANME,RAOFNS,RAOIFN,RAOLP,RAORDS,RAOSCH
+4 KILL RAOPTN,RAOSTS,RAOVSTS,X,Y
+5 KILL RAPARENT
+6 KILL A1,D1,DDER,DDH,DI,DIPGM,POP,^TMP($JOB,"PRO-ORD")
+7 QUIT
+8 ;
3 ;;Cancel a Request
+1 NEW RAPTLOCK,RAXIT
SET RAXIT=0
SET RAPKG=""
31 ; Patient lookup
+1 SET DIC="^DPT("
SET DIC(0)="AEMQ"
WRITE !
DO ^DIC
KILL DIC
IF Y<0
GOTO Q3
+2 IF $$ORVR^RAORDU()'<3
Begin DoDot:1
+3 SET RAPTLOCK=$$LK^RAUTL19(+Y_";DPT(")
+4 QUIT
End DoDot:1
IF 'RAPTLOCK
GOTO 31
+5 SET RADFN=+Y
SET RANME=$SELECT($DATA(^DPT(RADFN,0)):$PIECE(^(0),"^"),1:"Unknown")
+6 SET (RAOFNS,RAOPTN)="Cancel"
+7 DO CHKUSR^RAUTL2
SET RAOVSTS=$SELECT(RAMSG:"3;5;8",1:"5")
+8 WRITE !
DO ^RAORDS
IF '$DATA(RAORDS)
GOTO Q3
+9 DO REASON
IF RAXIT!(+$GET(OREND))
GOTO Q3
ENCAN ;OE/RR Entry Point for the CANCEL ACTION Option
+1 KILL ORSTRT,ORSTOP,ORTO,ORTX,ORIT,ORCOST,ORPURG
+2 IF $DATA(RAPKG)
WRITE !?3,"...will now 'CANCEL' selected request(s)..."
+3 SET RAOLP=0
+4 FOR
SET RAOLP=+$ORDER(RAORDS(RAOLP))
IF 'RAOLP!('+$GET(RAORDS(RAOLP)))
QUIT
Begin DoDot:1
+5 SET RAOIFN=$GET(RAORDS(RAOLP))
SET RAOSTS=1
DO ^RAORDU
+6 IF $DATA(RAPKG)
IF $DATA(^RAO(75.1,RAOIFN,0))
IF $DATA(^RAMIS(71,+$PIECE(^(0),"^",2),0))
WRITE !?10,"...",$PIECE(^(0),"^")," cancelled..."
+7 ; Print Cancelled Requests if appropriate
+8 KILL RA751,RA791
SET RA751=$GET(^RAO(75.1,RAOIFN,0))
+9 SET RA791=$GET(^RA(79.1,+$PIECE(RA751,"^",20),0))
+10 IF $PIECE(RA791,"^",24)]""!(+$PIECE($GET(^RA(79.1,+$ORDER(^RA(79.1,0)),0)),"^",24))
Begin DoDot:2
+11 KILL RACRHD,RAION,RAPGE,RAX
SET RAPGE=0
SET (RACRHD,RAX)=""
+12 ; RAOIFN already defined, RADFN may/maynot be defined!
+13 IF '$DATA(RADFN)
NEW RADFN
SET RADFN=+$PIECE(RA751,"^")
+14 SET RAION=$SELECT($PIECE(RA791,"^",24)]"":$PIECE(RA791,"^",24),1:+$PIECE($GET(^RA(79.1,+$ORDER(^RA(79.1,0)),0)),"^",24))
+15 SET RAION=$$GET1^DIQ(3.5,RAION_",",.01)
+16 ; Print Cancelled Request subroutine
DO PCR
+17 KILL RACRHD,RAION,RAPGE,RAX
+18 QUIT
End DoDot:2
+19 KILL RA751,RA791
+20 QUIT
End DoDot:1
Q3 ; unlock if appropriate, kill variables
+1 IF $$ORVR^RAORDU()'<3
IF (+$GET(RAPTLOCK))
IF (+$GET(RADFN))
Begin DoDot:1
+2 DO ULK^RAUTL19(RADFN_";DPT(")
End DoDot:1
+3 KILL %,%DT,C,D,D0,DA,POP,RADFN,RADIV,RAMSG,RANME,RAOFNS,RAOIFN,RAOLP
+4 KILL RAOPTN,RAORDS,RAOSTS,RAOVSTS
IF $DATA(RAPKG)
KILL OREND,RAPKG
+5 IF '$DATA(N)!($DATA(RAOREA)<10)
KILL RAPARENT,X,Y
+6 IF '$DATA(N)!($DATA(RAOREA)<10)
KILL RAOREA
GOTO Q35
+7 IF $DATA(RAOREA)>1
IF $GET(N)
KILL RAOREA(N),N
IF $DATA(RAOREA)<10
KILL RAOREA
+8 KILL RAPARENT,X,Y
Q35 KILL DIPGM,I
+1 QUIT
CHECK ; Check on the status of the order
+1 SET OREND=$SELECT(ORSTS=5:0,ORSTS=11:0,1:1)
IF OREND
WRITE !!,"Only orders in a Pending or Unreleased status can be cancelled.",$CHAR(7)
+2 QUIT
REASON ; Select a Cancel Reason
+1 SET DIC("A")="Select CANCEL REASON: "
SET DIC("S")="I $P(^(0),U,2)=1!($P(^(0),U,2)=9)"
SET DIC="^RA(75.2,"
SET DIC(0)="AEMQ"
+2 WRITE !
DO ^DIC
KILL DIC
+3 IF +Y<0
IF (X["^")
SET RAXIT=1
QUIT
+4 IF +Y<0
WRITE !!?3,"A Cancel Reason is required to proceed."
GOTO REASON
+5 SET OREND=0
SET RAOREA($SELECT($DATA(ORPK):ORPK,$DATA(ORIFN):ORIFN,1:1))=+Y
+6 QUIT
4 ;;Hold a Request
+1 NEW RAPTLOCK
40 ; Patient lookup
+1 SET DIC="^DPT("
SET DIC(0)="AEMQ"
WRITE !
DO ^DIC
KILL DIC
IF Y<0
GOTO Q4
+2 IF $$ORVR^RAORDU()'<3
Begin DoDot:1
+3 SET RAPTLOCK=$$LK^RAUTL19(+Y_";DPT(")
+4 QUIT
End DoDot:1
IF 'RAPTLOCK
GOTO 40
+5 SET RADFN=+Y
SET RANME=$SELECT($DATA(^DPT(RADFN,0)):$PIECE(^(0),"^"),1:"Unknown")
+6 SET (RAOFNS,RAOPTN)="Hold"
SET RAOVSTS="5;8"
+7 WRITE !
DO ^RAORDS
IF '$DATA(RAORDS)
GOTO Q4
41 ; Select a Hold Reason
+1 SET DIC("A")="Select HOLD REASON: "
SET DIC("S")="I $P(^(0),U,2)=3!($P(^(0),U,2)=9)"
SET DIC="^RA(75.2,"
SET DIC(0)="AEMQ"
WRITE !
DO ^DIC
KILL DIC
+2 IF +Y<0
IF (X["^")
DO Q4
QUIT
+3 IF +Y<0
WRITE !!?3,"A Hold Reason is required to proceed."
GOTO 41
+4 SET RAOREA=+Y
+5 WRITE !?3,"...will now 'HOLD' selected request(s)..."
SET RAOLP=0
+6 FOR
SET RAOLP=+$ORDER(RAORDS(RAOLP))
IF 'RAOLP!('+$GET(RAORDS(RAOLP)))
QUIT
Begin DoDot:1
+7 SET RAOIFN=$GET(RAORDS(RAOLP))
SET RAOSTS=3
DO ^RAORDU
+8 IF $DATA(^RAO(75.1,RAOIFN,0))
IF $DATA(^RAMIS(71,+$PIECE(^(0),"^",2),0))
WRITE !?10,"...",$PIECE(^(0),"^")," held..."
+9 QUIT
End DoDot:1
+10 DO Q4
GOTO 40
Q4 ; unlock if appropriate, kill variables
+1 IF $$ORVR^RAORDU()'<3
IF (+$GET(RAPTLOCK))
IF (+$GET(RADFN))
Begin DoDot:1
+2 DO ULK^RAUTL19(RADFN_";DPT(")
End DoDot:1
+3 KILL %DT,C,D,D0,DA,I,POP,RADFN,RADIV,RANME,RAOFNS,RAOIFN,RAOLP,RAORDS
+4 KILL RAOPTN,RAOREA,RAOSTS,RAOVSTS,X,Y
+5 KILL D1,DDER,DI,DIPGM,DISYS,DUOUT,RAPARENT,^TMP($JOB,"PRO-ORD"),^("XQALSET")
+6 QUIT
+7 ;
9 ;;Print Selected Requests by Patient
+1 KILL ^TMP($JOB,"RA PRINT HS BY PAT")
+2 SET DIC="^DPT("
SET DIC(0)="AEMQ"
WRITE !
DO ^DIC
KILL DIC
IF Y<0
GOTO Q9
SET RADFN=+Y
SET RANME=$SELECT($DATA(^DPT(RADFN,0)):$PIECE(^(0),"^"),1:"Unknown")
SET RAOFNS="Print"
SET RAOVSTS="1;2;3;5;6;8"
WRITE !
DO ^RAORDS
IF '$DATA(RAORDS)
GOTO Q9
+3 SET RAOIFNS=""
FOR RAOLP=1:1
IF '$DATA(RAORDS(RAOLP))
QUIT
SET RAOIFNS=RAOIFNS_+RAORDS(RAOLP)_";"
+4 WRITE !
KILL DIR,DIROUT,DIRUT,DTOUT,DUOUT
+5 SET DIR(0)="Y"
SET DIR("B")="No"
+6 SET DIR("?")="Answer 'Y'es to print the report, 'N'o to quit."
+7 SET DIR("A")="Do you wish to generate a Health Summary Report"
+8 DO ^DIR
IF $DATA(DIRUT)
GOTO Q9
SET RAGMTS=+Y
+9 SET ZTRTN="START9^RAORD"
SET ZTSAVE("RADFN")=""
SET ZTSAVE("RAOIFNS")=""
+10 SET ZTSAVE("RAGMTS")=""
IF $DATA(RAOPT)
SET ZTSAVE("RAOPT(")=""
+11 WRITE !
DO ZIS^RAUTL
IF RAPOP
GOTO Q9
+12 ;
START9 ; Start printing requests
+1 USE IO
SET RAX=""
NEW RA751
+2 FOR RAOLP=1:1
SET RAOIFN=$PIECE(RAOIFNS,";",RAOLP)
IF 'RAOIFN!(RAX["^")
QUIT
Begin DoDot:1
+3 SET RAPGE=0
DO ^RAORD5
IF RAX["^"
QUIT
+4 DO CRCHK^RAORD6
IF RAX["^"
QUIT
+5 ; quit if 'No' to 'generate a Health Summary Report'.
IF 'RAGMTS
QUIT
+6 SET RA751(0)=$GET(^RAO(75.1,RAOIFN,0))
SET RA751(2)=$PIECE(RA751(0),"^",2)
+7 SET GMTSTYP=$PIECE($GET(^RAMIS(71,+RA751(2),0)),"^",13)
+8 IF GMTSTYP>0
IF ('$DATA(^TMP($JOB,"RA PRINT HS BY PAT",GMTSTYP,RADFN)))
Begin DoDot:2
+9 IF $Y>0
WRITE @IOF
DO ENX^GMTSDVR(RADFN,GMTSTYP)
+10 SET ^TMP($JOB,"RA PRINT HS BY PAT",GMTSTYP,RADFN)=""
+11 QUIT
End DoDot:2
+12 QUIT
End DoDot:1
Q9 KILL %DT,C,D,D0,DA,DFN,GMTSTYP,I,POP,RACNI,RADFN,RADIV,RADTI,RANME,RAOFNS
+1 KILL RAOIFN,RAOIFNS,RAOLP,RAORDS,RAOSTS,RAOVSTS,RAPARENT,RAPGE,RAPOP,RAX
+2 KILL RAGMTS,VAI,VAIN,X,Y,Z,^TMP($JOB,"RA PRINT HS BY PAT")
+3 KILL RAMES,ZTDESC,ZTRTN,ZTSAVE
+4 KILL DIR,DIROUT,DIRUT,DTOUT,DUOUT
+5 KILL DIPGM,DISYS,DIW,DIWT,DN,RA6,RA7,^TMP($JOB,"PRO-ORD")
+6 WRITE !
DO CLOSE^RAUTL
+7 QUIT
KILL ; kill variables - called from RAORD1
+1 KILL %,%DT,D,D0,D1,DA,DFN,DIC,DIK,DIROUT,DIRUT,DIV,DR,DTOUT,DUOUT,DWPK,J,OREND,RABLNK,RACNT,RACT,RADIV,RAEXMUL,RAFIN,RAFIN1,RAI,RAILOC,RAIMGTYI,RAIP,RAJ,RAL0,RALOC,RALIFN,RALOCFLG
+2 KILL RAMOD,RAMT,RANUM,RAOIFN,RAORD0,RAOUT,RAPIFN,RAPRC,RAPRI,RAPREG,RAPREOP1,RAREASK,RAREQDT,RAREQPRT,RARU,RARX,RASEQ,RAS3,RASEX,RASKPREG,RASTOP,RASX,RAWHEN,RAX,VAERR,VA200,VAI,VAIP,X,Y
+3 KILL RAACI
+4 ;don't kill clin hist if order entry quick orders not all proccessed
IF '$DATA(RAPKG)
IF $GET(XQORS)>1
IF $GET(^TMP("XQORS",$JOB,XQORS-1,"ITM"))'=$GET(^("TOT"))
QUIT
+5 KILL ^TMP($JOB,"RAWP")
+6 QUIT
PCR ; Print Cancelled Requests. Called from the 'Cancel A Request' option.
+1 NEW I,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
+2 SET ZTDESC="Rad/Nuc Med Cancelled Request Print"
SET ZTDTH=$HOROLOG
SET ZTIO=RAION
+3 SET ZTRTN="^RAORD5"
+4 FOR I="RACRHD","RADFN","RAOIFN","RAPGE","RAX"
SET ZTSAVE(I)=""
+5 DO ^%ZTLOAD
IF $DATA(ZTSK)
WRITE !!?3,$CHAR(7),"Task "_ZTSK_": cancellation queued to print on device ",RAION,!
+6 DO HOME^%ZIS
+7 QUIT