ORDV03 ; slc/dcm - OE/RR Report Extracts ;15-Jun-2010 21:07;PLS
;;3.0;ORDER ENTRY/RESULTS REPORTING;**109,208,1005,215,243**;Dec 17, 1997;Build 47
RI(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Radiology impression
;External Calls: MAIN^GMTSRAE(1)
; Modified - IHS/MSC/PLS - 06/15/2010 - Line RR+33,RRDOD+34 - Annotation
; ^TMP("GMTSRAD",$J) used via DBIA 4333
; ^TMP("RAE",$J) used via DBIA 3968
N ORDT,ORX0,ORJ,ORCNT,GMDATA,GMTSI,GMW,MAX,TEST,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE,GO
Q:'$L(OREXT)
S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
Q:'$L($T(@GO))
S IOST=$G(IOST),GMTSNDM=$S(+$G(ORMAX)>0:ORMAX,1:999),GMTS2=ORALPHA,GMTS1=OROMEGA
S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
K ^TMP("ORDATA",$J),^TMP("RAE",$J) ;DBIA 3968
D @GO
S ORDT=GMTS1,ORCNT=0
F S ORDT=$O(^TMP("RAE",$J,ORDT)) Q:(ORDT'>0)!(ORDT>GMTS2) D
. S ORJ=0 F S ORJ=$O(^TMP("RAE",$J,ORDT,ORJ)) Q:'ORJ I $G(^(ORJ,0)) S ORX0=^(0) D
.. S ORCNT=ORCNT+1
.. S SITE=$S($L($G(^TMP("RAE",$J,ORDT,ORJ,"facility"))):^("facility"),1:ORSITE)
.. S ^TMP("ORDATA",$J,ORCNT,"WP",1)="1^"_SITE ;Station ID
.. S ^TMP("ORDATA",$J,ORCNT,"WP",2)="2^"_$$DATE^ORDVU($P(ORX0,U)) ;date
.. S ^TMP("ORDATA",$J,ORCNT,"WP",3)="3^"_$P(ORX0,U,2) ;procedure
.. S ^TMP("ORDATA",$J,ORCNT,"WP",4)="4^"_$P(ORX0,U,4) ;report status
.. S ^TMP("ORDATA",$J,ORCNT,"WP",5)="5^"_$P(ORX0,U,7) ;cpt code
.. D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"I")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",6)),6) ;impression
.. I $O(^TMP("RAE",$J,ORDT,ORJ,"I",0)) S ^TMP("ORDATA",$J,ORCNT,"WP",8)="8^[+]" ;flag for detail
K ^TMP("RAE",$J)
S ROOT=$NA(^TMP("ORDATA",$J))
Q
RR(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Radiology report
;External Calls: MAIN^GMTSRAE(2)
I $L($T(GCPR^OMGCOAS1)) D ; Call if FHIE station 200
. N BEG,END,MAX
. Q:'$G(ORALPHA) Q:'$G(OROMEGA)
. S MAX=$S(+$G(ORMAX)>0:ORMAX,1:999)
. S BEG=9999999-OROMEGA,END=9999999-ORALPHA
. D GCPR^OMGCOAS1(DFN,"RR",BEG,END,MAX)
N ORDT,ORX0,ORJ,ORCNT,GMDATA,GMTSI,GMW,MAX,TEST,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE,GO,ORMORE
Q:'$L(OREXT)
S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
Q:'$L($T(@GO))
K ^TMP("ORDATA",$J)
S GMTSNDM=$S(+$G(ORMAX)>0:ORMAX,1:999),GMTS1=OROMEGA,GMTS2=ORALPHA
S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
I '$L($T(GCPR^OMGCOAS1)) D
. K ^TMP("RAE",$J)
. D @GO
S ORDT=GMTS1,ORCNT=0
F S ORDT=$O(^TMP("RAE",$J,ORDT)) Q:(ORDT'>0) D
. S ORJ=0 F S ORJ=$O(^TMP("RAE",$J,ORDT,ORJ)) Q:'ORJ D
.. S ORCNT=ORCNT+1,ORMORE=0
.. S ORX0=$G(^TMP("RAE",$J,ORDT,ORJ,0))
.. S SITE=$S($L($G(^TMP("RAE",$J,ORDT,ORJ,"facility"))):^("facility"),1:ORSITE)
.. S ^TMP("ORDATA",$J,ORCNT,"WP",1)="1^"_SITE ;Site ID
.. S ^TMP("ORDATA",$J,ORCNT,"WP",2)="2^"_$$DATE^ORDVU($P(ORX0,U)) ;date
.. S ^TMP("ORDATA",$J,ORCNT,"WP",3)="3^"_$P(ORX0,U,2) ;procedure
.. S ^TMP("ORDATA",$J,ORCNT,"WP",4)="4^"_$S($L($P(ORX0,U,4)):$P(ORX0,U,4),1:"No Report") ;report status
.. S ^TMP("ORDATA",$J,ORCNT,"WP",5)="5^"_$P(ORX0,U,7) ;cpt code
.. I $O(^TMP("RAE",$J,ORDT,ORJ,"S",0)) S ORMORE=1 D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"S")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",6,1)),6) ;reason for study
.. I $O(^TMP("RAE",$J,ORDT,ORJ,"H",0)) S ORMORE=1 D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"H")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",7,1)),7) ;clinical history
.. I $O(^TMP("RAE",$J,ORDT,ORJ,"I",0)) S ORMORE=1 D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"I")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",8,1)),8) ;impression
.. I $O(^TMP("RAE",$J,ORDT,ORJ,"R",0)) S ORMORE=1 D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"R")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",9,1)),9) ;report
.. D ANNOT($P(ORX0,U,11),$P(ORX0,U,2),+ORX0,10) ;IHS/MSC/DKM - Added support for report annotations
.. I ORMORE S ^TMP("ORDATA",$J,ORCNT,"WP",10)="10^[+]" ;flag for detail
K ^TMP("RAE",$J)
S ROOT=$NA(^TMP("ORDATA",$J))
Q
RRDOD(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Radiology report
;External Calls: MAIN^GMTSRAE(2)
;
I $L($T(GCPR^OMGCOAS1)) D ; Call if FHIE station 200
. N BEG,END,MAX
. Q:'$G(ORALPHA) Q:'$G(OROMEGA)
. S MAX=$S(+$G(ORMAX)>0:ORMAX,1:999)
. S BEG=9999999-OROMEGA,END=9999999-ORALPHA
. D GCPR^OMGCOAS1(DFN,"RR",BEG,END,MAX)
;
N ORDT,ORX0,ORJ,ORCNT,GMDATA,GMTSI,GMW,MAX,TEST,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE,GO,ORMORE
Q:'$L(OREXT)
S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
Q:'$L($T(@GO))
K ^TMP("ORDATA",$J)
S GMTSNDM=$S(+$G(ORMAX)>0:ORMAX,1:999),GMTS1=OROMEGA,GMTS2=ORALPHA
S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
I '$L($T(GCPR^OMGCOAS1)) D
. K ^TMP("RAE",$J)
. D @GO
S ORDT=GMTS1,ORCNT=0
F S ORDT=$O(^TMP("RAE",$J,ORDT)) Q:(ORDT'>0) D
. S ORJ=0 F S ORJ=$O(^TMP("RAE",$J,ORDT,ORJ)) Q:'ORJ D
.. S ORCNT=ORCNT+1,ORMORE=0
.. S ORX0=$G(^TMP("RAE",$J,ORDT,ORJ,0))
.. S SITE=$S($L($G(^TMP("RAE",$J,ORDT,ORJ,"facility"))):^("facility"),1:ORSITE)
.. S ^TMP("ORDATA",$J,ORCNT,"WP",1)="1^"_SITE ;Site ID
.. S ^TMP("ORDATA",$J,ORCNT,"WP",2)="2^"_$$DATE^ORDVU($P(ORX0,U)) ;date
.. S ^TMP("ORDATA",$J,ORCNT,"WP",3)="3^"_$P(ORX0,U,2) ;procedure
.. S ^TMP("ORDATA",$J,ORCNT,"WP",4)="4^"_$S($L($P(ORX0,U,4)):$P(ORX0,U,4),1:"No Report") ;report status
.. S ^TMP("ORDATA",$J,ORCNT,"WP",5)="5^"_$P(ORX0,U,7) ;cpt code
.. I $O(^TMP("RAE",$J,ORDT,ORJ,"H",0)) S ORMORE=1 D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"H")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",6,1)),6) ;clinical history
.. I $O(^TMP("RAE",$J,ORDT,ORJ,"I",0)) S ORMORE=1 D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"I")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",7,1)),7) ;impression
.. I $O(^TMP("RAE",$J,ORDT,ORJ,"R",0)) S ORMORE=1 D SPMRG^ORDVU($NA(^TMP("RAE",$J,ORDT,ORJ,"R")),$NA(^TMP("ORDATA",$J,ORCNT,"WP",8,1)),8) ;report
.. D ANNOT($P(ORX0,U,11),$P(ORX0,U,2),+ORX0,10) ;IHS/MSC/DKM - Added support for report annotations
.. I ORMORE S ^TMP("ORDATA",$J,ORCNT,"WP",9)="9^[+]" ;flag for detail
K ^TMP("RAE",$J)
S ROOT=$NA(^TMP("ORDATA",$J))
Q
; IHS/MSC/DKM - Check for annotations
ANNOT(PKGREF,NAME,DATE,SUB) ;
N TIUDA,UND,CANVIEW
Q:'PKGREF
S PKGREF=PKGREF_";RARPT("
S ^TMP("ORDATA",$J,ORCNT,"WP",SUB)=SUB_U_PKGREF_";"_NAME_" performed on "_$$DATE^ORDVU(DATE)
S TIUDA=0,UND=$$REPEAT^XLFSTR("-",80),SUB=SUB+1
F S TIUDA=$O(^TIU(8925,"G",PKGREF,TIUDA)) Q:'TIUDA D
.S CANVIEW=$$CANDO^TIULP(TIUDA,"VIEW")
.I +CANVIEW>0 D
.. N GBL,LP
.. D TGET^TIUSRVR1(.GBL,TIUDA)
.. S LP="",@GBL@(0)=UND
.. F S LP=$O(@GBL@(LP)) Q:'$L(LP) S @GBL@(LP)=SUB_U_@GBL@(LP)
.. M ^TMP("ORDATA",$J,ORCNT,"WP",SUB,TIUDA)=@GBL
.. K @GBL
.. S ORMORE=1
Q
; IHS/MSC/DKM - End mod
RS(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Radiology status
;External calls: GET^GMTSRAD
N ORSITE,SITE,CNT,ORDT,ORDA,ORDA2,REC,GMTSEND,GMTSBEG,GO,STAT
Q:'$L(OREXT)
S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
Q:'$L($T(@GO))
S GMTSBEG=ORDBEG,GMTSEND=ORDEND
S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
K ^TMP("GMTSRAD",$J) ;DBIA 4333
D @GO
S CNT=0,ORDT=OROMEGA
F S ORDT=$O(^TMP("GMTSRAD",$J,ORDT)) Q:(ORDT'>0)!(ORDT>ORALPHA)!(CNT'<ORMAX) D
.S ORDA=0
.F S ORDA=$O(^TMP("GMTSRAD",$J,ORDT,ORDA)) Q:'ORDA!(CNT'<ORMAX) D
..S ORDA2=0
..F S ORDA2=$O(^TMP("GMTSRAD",$J,ORDT,ORDA,ORDA2)) Q:'ORDA2!(CNT'<ORMAX) S REC=^(ORDA2),STAT=$P(REC,"^",2) D
...S CNT=CNT+1
...S SITE=$S($L($G(^TMP("GMTSRAD",$J,ORDT,ORDA,ORDA2,"facility"))):^("facility"),1:ORSITE)
...S ^TMP("ORDATA",$J,ORDT,"WP",1)="1^"_SITE
...S ^TMP("ORDATA",$J,ORDT,"WP",2)="2^"_$$DATE^ORDVU($P(REC,"^"))
...S ^TMP("ORDATA",$J,ORDT,"WP",3)="3^"_$S(STAT="d":"Discontinued",STAT="c":"Complete",STAT="h":"Hold",STAT="p":"Pending",STAT="a":"Active",STAT="s":"Scheduled",STAT="u":"Unreleased",1:STAT)
...S ^TMP("ORDATA",$J,ORDT,"WP",4)="4^"_$P(REC,"^",3)
...S ^TMP("ORDATA",$J,ORDT,"WP",5)="5^"_$$DATE^ORDVU($P(REC,"^",4))
...S ^TMP("ORDATA",$J,ORDT,"WP",6)="6^"_$P(REC,"^",5)
S ROOT=$NA(^TMP("ORDATA",$J))
Q
RAD1 ;Get radiology impression
D MAIN^GMTSRAE(1)
Q
RAD2 ;Get radiology report
D MAIN^GMTSRAE(2)
Q
ORDV03 ; slc/dcm - OE/RR Report Extracts ;15-Jun-2010 21:07;PLS
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**109,208,1005,215,243**;Dec 17, 1997;Build 47
RI(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Radiology impression
+1 ;External Calls: MAIN^GMTSRAE(1)
+2 ; Modified - IHS/MSC/PLS - 06/15/2010 - Line RR+33,RRDOD+34 - Annotation
+3 ; ^TMP("GMTSRAD",$J) used via DBIA 4333
+4 ; ^TMP("RAE",$J) used via DBIA 3968
+5 NEW ORDT,ORX0,ORJ,ORCNT,GMDATA,GMTSI,GMW,MAX,TEST,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE,GO
+6 IF '$LENGTH(OREXT)
QUIT
+7 SET GO=$PIECE(OREXT,";")_"^"_$PIECE(OREXT,";",2)
+8 IF '$LENGTH($TEXT(@GO))
QUIT
+9 SET IOST=$GET(IOST)
SET GMTSNDM=$SELECT(+$GET(ORMAX)>0:ORMAX,1:999)
SET GMTS2=ORALPHA
SET GMTS1=OROMEGA
+10 SET ORSITE=$$SITE^VASITE
SET ORSITE=$PIECE(ORSITE,"^",2)_";"_$PIECE(ORSITE,"^",3)
+11 ;DBIA 3968
KILL ^TMP("ORDATA",$JOB),^TMP("RAE",$JOB)
+12 DO @GO
+13 SET ORDT=GMTS1
SET ORCNT=0
+14 FOR
SET ORDT=$ORDER(^TMP("RAE",$JOB,ORDT))
IF (ORDT'>0)!(ORDT>GMTS2)
QUIT
Begin DoDot:1
+15 SET ORJ=0
FOR
SET ORJ=$ORDER(^TMP("RAE",$JOB,ORDT,ORJ))
IF 'ORJ
QUIT
IF $GET(^(ORJ,0))
SET ORX0=^(0)
Begin DoDot:2
+16 SET ORCNT=ORCNT+1
+17 SET SITE=$SELECT($LENGTH($GET(^TMP("RAE",$JOB,ORDT,ORJ,"facility"))):^("facility"),1:ORSITE)
+18 ;Station ID
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",1)="1^"_SITE
+19 ;date
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",2)="2^"_$$DATE^ORDVU($PIECE(ORX0,U))
+20 ;procedure
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",3)="3^"_$PIECE(ORX0,U,2)
+21 ;report status
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",4)="4^"_$PIECE(ORX0,U,4)
+22 ;cpt code
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",5)="5^"_$PIECE(ORX0,U,7)
+23 ;impression
DO SPMRG^ORDVU($NAME(^TMP("RAE",$JOB,ORDT,ORJ,"I")),$NAME(^TMP("ORDATA",$JOB,ORCNT,"WP",6)),6)
+24 ;flag for detail
IF $ORDER(^TMP("RAE",$JOB,ORDT,ORJ,"I",0))
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",8)="8^[+]"
End DoDot:2
End DoDot:1
+25 KILL ^TMP("RAE",$JOB)
+26 SET ROOT=$NAME(^TMP("ORDATA",$JOB))
+27 QUIT
RR(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Radiology report
+1 ;External Calls: MAIN^GMTSRAE(2)
+2 ; Call if FHIE station 200
IF $LENGTH($TEXT(GCPR^OMGCOAS1))
Begin DoDot:1
+3 NEW BEG,END,MAX
+4 IF '$GET(ORALPHA)
QUIT
IF '$GET(OROMEGA)
QUIT
+5 SET MAX=$SELECT(+$GET(ORMAX)>0:ORMAX,1:999)
+6 SET BEG=9999999-OROMEGA
SET END=9999999-ORALPHA
+7 DO GCPR^OMGCOAS1(DFN,"RR",BEG,END,MAX)
End DoDot:1
+8 NEW ORDT,ORX0,ORJ,ORCNT,GMDATA,GMTSI,GMW,MAX,TEST,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE,GO,ORMORE
+9 IF '$LENGTH(OREXT)
QUIT
+10 SET GO=$PIECE(OREXT,";")_"^"_$PIECE(OREXT,";",2)
+11 IF '$LENGTH($TEXT(@GO))
QUIT
+12 KILL ^TMP("ORDATA",$JOB)
+13 SET GMTSNDM=$SELECT(+$GET(ORMAX)>0:ORMAX,1:999)
SET GMTS1=OROMEGA
SET GMTS2=ORALPHA
+14 SET ORSITE=$$SITE^VASITE
SET ORSITE=$PIECE(ORSITE,"^",2)_";"_$PIECE(ORSITE,"^",3)
+15 IF '$LENGTH($TEXT(GCPR^OMGCOAS1))
Begin DoDot:1
+16 KILL ^TMP("RAE",$JOB)
+17 DO @GO
End DoDot:1
+18 SET ORDT=GMTS1
SET ORCNT=0
+19 FOR
SET ORDT=$ORDER(^TMP("RAE",$JOB,ORDT))
IF (ORDT'>0)
QUIT
Begin DoDot:1
+20 SET ORJ=0
FOR
SET ORJ=$ORDER(^TMP("RAE",$JOB,ORDT,ORJ))
IF 'ORJ
QUIT
Begin DoDot:2
+21 SET ORCNT=ORCNT+1
SET ORMORE=0
+22 SET ORX0=$GET(^TMP("RAE",$JOB,ORDT,ORJ,0))
+23 SET SITE=$SELECT($LENGTH($GET(^TMP("RAE",$JOB,ORDT,ORJ,"facility"))):^("facility"),1:ORSITE)
+24 ;Site ID
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",1)="1^"_SITE
+25 ;date
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",2)="2^"_$$DATE^ORDVU($PIECE(ORX0,U))
+26 ;procedure
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",3)="3^"_$PIECE(ORX0,U,2)
+27 ;report status
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",4)="4^"_$SELECT($LENGTH($PIECE(ORX0,U,4)):$PIECE(ORX0,U,4),1:"No Report")
+28 ;cpt code
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",5)="5^"_$PIECE(ORX0,U,7)
+29 ;reason for study
IF $ORDER(^TMP("RAE",$JOB,ORDT,ORJ,"S",0))
SET ORMORE=1
DO SPMRG^ORDVU($NAME(^TMP("RAE",$JOB,ORDT,ORJ,"S")),$NAME(^TMP("ORDATA",$JOB,ORCNT,"WP",6,1)),6)
+30 ;clinical history
IF $ORDER(^TMP("RAE",$JOB,ORDT,ORJ,"H",0))
SET ORMORE=1
DO SPMRG^ORDVU($NAME(^TMP("RAE",$JOB,ORDT,ORJ,"H")),$NAME(^TMP("ORDATA",$JOB,ORCNT,"WP",7,1)),7)
+31 ;impression
IF $ORDER(^TMP("RAE",$JOB,ORDT,ORJ,"I",0))
SET ORMORE=1
DO SPMRG^ORDVU($NAME(^TMP("RAE",$JOB,ORDT,ORJ,"I")),$NAME(^TMP("ORDATA",$JOB,ORCNT,"WP",8,1)),8)
+32 ;report
IF $ORDER(^TMP("RAE",$JOB,ORDT,ORJ,"R",0))
SET ORMORE=1
DO SPMRG^ORDVU($NAME(^TMP("RAE",$JOB,ORDT,ORJ,"R")),$NAME(^TMP("ORDATA",$JOB,ORCNT,"WP",9,1)),9)
+33 ;IHS/MSC/DKM - Added support for report annotations
DO ANNOT($PIECE(ORX0,U,11),$PIECE(ORX0,U,2),+ORX0,10)
+34 ;flag for detail
IF ORMORE
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",10)="10^[+]"
End DoDot:2
End DoDot:1
+35 KILL ^TMP("RAE",$JOB)
+36 SET ROOT=$NAME(^TMP("ORDATA",$JOB))
+37 QUIT
RRDOD(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Radiology report
+1 ;External Calls: MAIN^GMTSRAE(2)
+2 ;
+3 ; Call if FHIE station 200
IF $LENGTH($TEXT(GCPR^OMGCOAS1))
Begin DoDot:1
+4 NEW BEG,END,MAX
+5 IF '$GET(ORALPHA)
QUIT
IF '$GET(OROMEGA)
QUIT
+6 SET MAX=$SELECT(+$GET(ORMAX)>0:ORMAX,1:999)
+7 SET BEG=9999999-OROMEGA
SET END=9999999-ORALPHA
+8 DO GCPR^OMGCOAS1(DFN,"RR",BEG,END,MAX)
End DoDot:1
+9 ;
+10 NEW ORDT,ORX0,ORJ,ORCNT,GMDATA,GMTSI,GMW,MAX,TEST,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE,GO,ORMORE
+11 IF '$LENGTH(OREXT)
QUIT
+12 SET GO=$PIECE(OREXT,";")_"^"_$PIECE(OREXT,";",2)
+13 IF '$LENGTH($TEXT(@GO))
QUIT
+14 KILL ^TMP("ORDATA",$JOB)
+15 SET GMTSNDM=$SELECT(+$GET(ORMAX)>0:ORMAX,1:999)
SET GMTS1=OROMEGA
SET GMTS2=ORALPHA
+16 SET ORSITE=$$SITE^VASITE
SET ORSITE=$PIECE(ORSITE,"^",2)_";"_$PIECE(ORSITE,"^",3)
+17 IF '$LENGTH($TEXT(GCPR^OMGCOAS1))
Begin DoDot:1
+18 KILL ^TMP("RAE",$JOB)
+19 DO @GO
End DoDot:1
+20 SET ORDT=GMTS1
SET ORCNT=0
+21 FOR
SET ORDT=$ORDER(^TMP("RAE",$JOB,ORDT))
IF (ORDT'>0)
QUIT
Begin DoDot:1
+22 SET ORJ=0
FOR
SET ORJ=$ORDER(^TMP("RAE",$JOB,ORDT,ORJ))
IF 'ORJ
QUIT
Begin DoDot:2
+23 SET ORCNT=ORCNT+1
SET ORMORE=0
+24 SET ORX0=$GET(^TMP("RAE",$JOB,ORDT,ORJ,0))
+25 SET SITE=$SELECT($LENGTH($GET(^TMP("RAE",$JOB,ORDT,ORJ,"facility"))):^("facility"),1:ORSITE)
+26 ;Site ID
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",1)="1^"_SITE
+27 ;date
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",2)="2^"_$$DATE^ORDVU($PIECE(ORX0,U))
+28 ;procedure
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",3)="3^"_$PIECE(ORX0,U,2)
+29 ;report status
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",4)="4^"_$SELECT($LENGTH($PIECE(ORX0,U,4)):$PIECE(ORX0,U,4),1:"No Report")
+30 ;cpt code
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",5)="5^"_$PIECE(ORX0,U,7)
+31 ;clinical history
IF $ORDER(^TMP("RAE",$JOB,ORDT,ORJ,"H",0))
SET ORMORE=1
DO SPMRG^ORDVU($NAME(^TMP("RAE",$JOB,ORDT,ORJ,"H")),$NAME(^TMP("ORDATA",$JOB,ORCNT,"WP",6,1)),6)
+32 ;impression
IF $ORDER(^TMP("RAE",$JOB,ORDT,ORJ,"I",0))
SET ORMORE=1
DO SPMRG^ORDVU($NAME(^TMP("RAE",$JOB,ORDT,ORJ,"I")),$NAME(^TMP("ORDATA",$JOB,ORCNT,"WP",7,1)),7)
+33 ;report
IF $ORDER(^TMP("RAE",$JOB,ORDT,ORJ,"R",0))
SET ORMORE=1
DO SPMRG^ORDVU($NAME(^TMP("RAE",$JOB,ORDT,ORJ,"R")),$NAME(^TMP("ORDATA",$JOB,ORCNT,"WP",8,1)),8)
+34 ;IHS/MSC/DKM - Added support for report annotations
DO ANNOT($PIECE(ORX0,U,11),$PIECE(ORX0,U,2),+ORX0,10)
+35 ;flag for detail
IF ORMORE
SET ^TMP("ORDATA",$JOB,ORCNT,"WP",9)="9^[+]"
End DoDot:2
End DoDot:1
+36 KILL ^TMP("RAE",$JOB)
+37 SET ROOT=$NAME(^TMP("ORDATA",$JOB))
+38 QUIT
+39 ; IHS/MSC/DKM - Check for annotations
ANNOT(PKGREF,NAME,DATE,SUB) ;
+1 NEW TIUDA,UND,CANVIEW
+2 IF 'PKGREF
QUIT
+3 SET PKGREF=PKGREF_";RARPT("
+4 SET ^TMP("ORDATA",$JOB,ORCNT,"WP",SUB)=SUB_U_PKGREF_";"_NAME_" performed on "_$$DATE^ORDVU(DATE)
+5 SET TIUDA=0
SET UND=$$REPEAT^XLFSTR("-",80)
SET SUB=SUB+1
+6 FOR
SET TIUDA=$ORDER(^TIU(8925,"G",PKGREF,TIUDA))
IF 'TIUDA
QUIT
Begin DoDot:1
+7 SET CANVIEW=$$CANDO^TIULP(TIUDA,"VIEW")
+8 IF +CANVIEW>0
Begin DoDot:2
+9 NEW GBL,LP
+10 DO TGET^TIUSRVR1(.GBL,TIUDA)
+11 SET LP=""
SET @GBL@(0)=UND
+12 FOR
SET LP=$ORDER(@GBL@(LP))
IF '$LENGTH(LP)
QUIT
SET @GBL@(LP)=SUB_U_@GBL@(LP)
+13 MERGE ^TMP("ORDATA",$JOB,ORCNT,"WP",SUB,TIUDA)=@GBL
+14 KILL @GBL
+15 SET ORMORE=1
End DoDot:2
End DoDot:1
+16 QUIT
+17 ; IHS/MSC/DKM - End mod
RS(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Radiology status
+1 ;External calls: GET^GMTSRAD
+2 NEW ORSITE,SITE,CNT,ORDT,ORDA,ORDA2,REC,GMTSEND,GMTSBEG,GO,STAT
+3 IF '$LENGTH(OREXT)
QUIT
+4 SET GO=$PIECE(OREXT,";")_"^"_$PIECE(OREXT,";",2)
+5 IF '$LENGTH($TEXT(@GO))
QUIT
+6 SET GMTSBEG=ORDBEG
SET GMTSEND=ORDEND
+7 SET ORSITE=$$SITE^VASITE
SET ORSITE=$PIECE(ORSITE,"^",2)_";"_$PIECE(ORSITE,"^",3)
+8 ;DBIA 4333
KILL ^TMP("GMTSRAD",$JOB)
+9 DO @GO
+10 SET CNT=0
SET ORDT=OROMEGA
+11 FOR
SET ORDT=$ORDER(^TMP("GMTSRAD",$JOB,ORDT))
IF (ORDT'>0)!(ORDT>ORALPHA)!(CNT'<ORMAX)
QUIT
Begin DoDot:1
+12 SET ORDA=0
+13 FOR
SET ORDA=$ORDER(^TMP("GMTSRAD",$JOB,ORDT,ORDA))
IF 'ORDA!(CNT'<ORMAX)
QUIT
Begin DoDot:2
+14 SET ORDA2=0
+15 FOR
SET ORDA2=$ORDER(^TMP("GMTSRAD",$JOB,ORDT,ORDA,ORDA2))
IF 'ORDA2!(CNT'<ORMAX)
QUIT
SET REC=^(ORDA2)
SET STAT=$PIECE(REC,"^",2)
Begin DoDot:3
+16 SET CNT=CNT+1
+17 SET SITE=$SELECT($LENGTH($GET(^TMP("GMTSRAD",$JOB,ORDT,ORDA,ORDA2,"facility"))):^("facility"),1:ORSITE)
+18 SET ^TMP("ORDATA",$JOB,ORDT,"WP",1)="1^"_SITE
+19 SET ^TMP("ORDATA",$JOB,ORDT,"WP",2)="2^"_$$DATE^ORDVU($PIECE(REC,"^"))
+20 SET ^TMP("ORDATA",$JOB,ORDT,"WP",3)="3^"_$SELECT(STAT="d":"Discontinued",STAT="c":"Complete",STAT="h":"Hold",STAT="p":"Pending",STAT="a":"Active",STAT="s":"Scheduled",STAT="u":"Unreleased",1:STAT)
+21 SET ^TMP("ORDATA",$JOB,ORDT,"WP",4)="4^"_$PIECE(REC,"^",3)
+22 SET ^TMP("ORDATA",$JOB,ORDT,"WP",5)="5^"_$$DATE^ORDVU($PIECE(REC,"^",4))
+23 SET ^TMP("ORDATA",$JOB,ORDT,"WP",6)="6^"_$PIECE(REC,"^",5)
End DoDot:3
End DoDot:2
End DoDot:1
+24 SET ROOT=$NAME(^TMP("ORDATA",$JOB))
+25 QUIT
RAD1 ;Get radiology impression
+1 DO MAIN^GMTSRAE(1)
+2 QUIT
RAD2 ;Get radiology report
+1 DO MAIN^GMTSRAE(2)
+2 QUIT