MAGNWRK1 ;WOIFO/NST - Work items calls ; Dec 05, 2018@13:36:00
;;3.0;IMAGING;**201,221**;Dec 02, 2009;Build 163
;;Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
Q
;
NWI2005(MAGVOUT,MAGGDA) ;Create a new MAG WORK ITEM for an image stored in IMAGE file (#2005)
; MAGGDA - IEN in IMAGE file (#2005)
;
;
N CRTUSR,CRTAPP,DFN,ICN,IEN,J,MAGGRP,MSGTAGS,TYPE,SUBTYPE,STATUS,PLACEID,PRIORITY,Y,TMP
N MODALITY,MAGPDATA,REFTYPE,REFIEN
;
S IEN=+$G(MAGGDA) Q:'IEN
;
S PLACEID=$$GET1^DIQ(2005,IEN,.05,"I") ; ACQUISITION SITE
S:'PLACEID PLACEID=DUZ(2)
;
Q:'$$GET^XPAR("DIV.`"_PLACEID_"^SYS","MAG PRECACHE ACQ ENABLED",,"I") ; IA# 2263
;
Q:$$GET1^DIQ(2005,IEN,1,"I")="" ; FILEREF
S DFN=$$GET1^DIQ(2005,IEN,5,"I") ; PATIENT
S MAGGRP=$$GET1^DIQ(2005,IEN,14,"I") ; GROUP PARENT
;
; TAGS
S J=0
S J=J+1,MSGTAGS(J)="storage`2005" ; image is in file #2005
S J=J+1,MSGTAGS(J)="imageIen`"_IEN ; IMAGE IEN
S:MAGGRP J=J+1,MSGTAGS(J)="studyIen`"_MAGGRP ; GRP IEN
S:DFN J=J+1,MSGTAGS(J)="patientDfn`"_DFN
I $L($T(GETICN^MPIF001)) D
. S ICN=$$GETICN^MPIF001(DFN)
. S:ICN>1 J=J+1,MSGTAGS(J)="patientIcn`"_ICN
. Q
S J=J+1,MSGTAGS(J)="acquisition`1" ; precash flag
;
S MAGPDATA=$$GET1^DIQ(2005,IEN,16,"I") ; Parent Data File
S REFTYPE=$S(MAGPDATA=74:"RAD",MAGPDATA=8925:"TIU",1:"")
I REFTYPE'="" D
. S REFIEN=$$GET1^DIQ(2005,IEN,17,"I")
. S J=J+1,MSGTAGS(J)="contextId`"_$TR($$CPRSCTX^MAGNU003(REFTYPE,REFIEN),"^","~") ; Create CPRS Context ID and translate ^ to ~
. Q
;
S J=J+1,MSGTAGS(J)="imageFileName`"_$$FILENAME^MAGGAII(IEN,"FULL",.TMP)
S J=J+1,MSGTAGS(J)="imageShortDescr`"_$$GET1^DIQ(2005,IEN,10,"I")
S J=J+1,MSGTAGS(J)="imageObjectType`"_$$GET1^DIQ(2005,IEN,3,"I")
S MODALITY=$$MODALITY(IEN)
S:MODALITY'="" J=J+1,MSGTAGS(J)="imageModality`"_MODALITY
;
S TYPE="PRECACHE"
S SUBTYPE="ACQUISITION"
S STATUS="New"
S PRIORITY=0
;
S PLACEID=$$STA^XUAF4(PLACEID) ;IA # 2171
;
S CRTUSR=$$GET1^DIQ(2005,IEN,8,"I") ; IMAGE SAVE BY
S:'CRTUSR CRTUSR=DUZ
;
S CRTAPP=$$GET1^DIQ(2005,IEN,8.1,"I") ; CAPTURE APPLICATION
S CRTAPP=$S(CRTAPP="D":"DICOM",CRTAPP="C":"CAPTURE",1:"IMPORTER")
;
D CRTITEM^MAGVIM01(.MAGVOUT,TYPE,SUBTYPE,STATUS,PLACEID,PRIORITY,.MSGTAGS,CRTUSR,CRTAPP)
Q
;
NWI34(MAGVOUT,PIEN,IEN) ; ;Create a new MAG WORK ITEM for an image stored in P34 stucture
; PIEN = IEN in IMAGE SOP INSTANCE file (#2005.64)
; IEN = IMAGE INSTANCE FILE file (#2005.65)
;
N CPRSCNTX,CRTUSR,CRTAPP,DFN,ICN,J,MAGGRP,MSGTAGS,TYPE,SUBTYPE,STATUS,PLACEID,PRIORITY,Y
N MAGAENT,MAGMODAL,REFTYPE,REFIEN
;
S PLACEID=$$GET1^DIQ(2005.64,PIEN,"11:31:.01","I") ; ACQUISITION LOCATION in file #2005.63
S PLACEID=$S($P(PLACEID,";",2)="DIC(4,":+PLACEID,1:"")
S:'PLACEID PLACEID=DUZ(2)
;
Q:'$$GET^XPAR("DIV.`"_PLACEID_"^SYS","MAG PRECACHE ACQ ENABLED",,"I") ; IA# 2263
;
S DFN=""
S MAGAENT=$$GET1^DIQ(2005.64,PIEN,"11:11:13:.02","I") ; ASSIGNING AUTHORITY in file #2005.6
I MAGAENT="V" S DFN=$$GET1^DIQ(2005.64,PIEN,"11:11:13:.01","I") ; ENTERPRISE PATIENT ID in file #2005.6
;
S MAGMODAL=$$GET1^DIQ(2005.64,PIEN,"11:3","I") ; MODALITY in file #2005.63
;
S MAGGRP=$$GET1^DIQ(2005.64,PIEN,"11:11","I") ; Study IEN in file #2005.62
;
; TAGS
S J=0
S J=J+1,MSGTAGS(J)="storage`2005.64" ; image is in P34 data structure
S J=J+1,MSGTAGS(J)="imageIen`"_PIEN ; IEN in IMAGE SOP INSTANCE file (#2005.64)
S:MAGGRP J=J+1,MSGTAGS(J)="studyIen`"_MAGGRP ;Study IEN in IMAGE STUDY file (#2005.62)
S:DFN J=J+1,MSGTAGS(J)="patientDfn`"_DFN
I $L($T(GETICN^MPIF001)) D
. S ICN=$$GETICN^MPIF001(DFN)
. S:ICN>1 J=J+1,MSGTAGS(J)="patientIcn`"_ICN
. Q
S:MAGMODAL'="" J=J+1,MSGTAGS(J)="modality`"_MAGMODAL ; MODALITY in file #2005.63
;
D AINST(.MSGTAGS,.J,IEN) ; Add Add Artifact Instance tags
;
S J=J+1,MSGTAGS(J)="acquisition`1" ; precash flag
;
S CPRSCNTX=$$CPRSCTXS(MAGGRP) ; Create CPRS Context ID by Study IEN
I CPRSCNTX'="" D
. S J=J+1,MSGTAGS(J)="contextId`"_$TR(CPRSCNTX,"^","~") ; translate ^ to ~
. Q
;
S TYPE="PRECACHE"
S SUBTYPE="ACQUISITION"
S STATUS="New"
S PRIORITY=0
S PLACEID=$$STA^XUAF4(PLACEID) ;IA # 2171
;
S CRTUSR="" ; IMAGE SAVE BY
S:'CRTUSR CRTUSR=DUZ
;
S CRTAPP="D" ; CAPTURE APPLICATION
S CRTAPP=$S(CRTAPP="D":"DICOM",CRTAPP="C":"CAPTURE",1:"IMPORTER")
;
D CRTITEM^MAGVIM01(.MAGVOUT,TYPE,SUBTYPE,STATUS,PLACEID,PRIORITY,.MSGTAGS,CRTUSR,CRTAPP)
Q
;
CPRSCTXS(STUDYIEN) ; Get CPRS context by Study IEN in IMAGE STUDY file (#2005.62)
N ACNUMB,CONTEXT,REFTYPE,REFIEN
S ACNUMB=$$GET1^DIQ(2005.62,STUDYIEN,.02,"I")
D REFBYACN^MAGNU003(.REFTYPE,.REFIEN,ACNUMB) ; Set Reference type by Accession Number
S CONTEXT=$$CPRSCTX^MAGNU003(REFTYPE,REFIEN)
Q CONTEXT
;
AINST(MSGTAGS,J,INSTIEN) ; Add Artifact Instance
; INSTIEN = IEN in IMAGE INSTANCE FILE file (#2005.65)
;
N CNT,KEY,VALUE,LINE,IEN,I,RES,TMPARR,TOKEN,QT
S TOKEN=$$GET1^DIQ(2005.65,INSTIEN,.01,"I") ; Artifact Token
D GETAIENT^MAGVAG02(.RES,TOKEN,"") ; Get not deleted Artifact IEN by Token
I '$$ISOK^MAGVAF02(RES) Q
S IEN=$$GETVAL^MAGVAF02(RES)
D GETAINST^MAGVAG04(.TMPARR,IEN)
I '$$ISOK^MAGVAF02(TMPARR(0)) Q
S QT=$C(34)
S CNT=0
S I=1
F S I=$O(TMPARR(I)) Q:'I S LINE=TMPARR(I) Q:LINE["</ARTIFACTINSTANCES" D
. I LINE["<ARTIFACTINSTANCE" S CNT=CNT+1 Q
. I LINE["</ARTIFACTINSTANCE" Q
. S KEY=$P(TMPARR(I),"=",1)
. S VALUE=$TR($P(TMPARR(I),"=",2),QT,"")
. S VALUE=$P(VALUE," >") ; special handling because of XML result set
. I (KEY="PK")!(KEY="ARTIFACT")!(KEY="DISKVOLUME") S J=J+1,MSGTAGS(J)="ai_"_KEY_"_"_CNT_"`"_VALUE
. I KEY="STORAGEPROVIDER" D ; Add Storage provider name
. . S J=J+1,MSGTAGS(J)="ai_storeProvType_"_CNT_"`"_$$GET1^DIQ(2006.917,VALUE,"2")
. . Q
. Q
Q
;
MODALITY(IMGIEN) ; Get Image modality
N G,M,P,MAGFILD,MAGFILG,X
S MAGFILD=$$FILE^MAGGI11(IMGIEN)
S X=$S(MAGFILD:$G(^MAG(MAGFILD,IMGIEN,0)),1:"")
S G=+$P(X,"^",10) ;Group IEN
S M=$P(X,"^",8) ;Procedure
S:$E(M,1,4)="RAD " M=$E(M,5,$L(M))
Q:M="" ""
S MAGFILG=$$FILE^MAGGI11(G)
S G=$S(MAGFILG:$P($G(^MAG(MAGFILG,G,2)),"^",6),1:"") ;Parent Data File# for Group IEN
S P=$S(MAGFILD:$P($G(^MAG(MAGFILD,IMGIEN,2)),"^",6),1:"") ;Parent Data File# for IEN
I P'=74,G'=74 Q "" ;quit if not RAD/NUC MED REPORTS file (#74)
Q M
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGNWRK1 7388 printed Dec 13, 2024@02:07:40 Page 2
MAGNWRK1 ;WOIFO/NST - Work items calls ; Dec 05, 2018@13:36:00
+1 ;;3.0;IMAGING;**201,221**;Dec 02, 2009;Build 163
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;; +---------------------------------------------------------------+
+4 ;; | Property of the US Government. |
+5 ;; | No permission to copy or redistribute this software is given. |
+6 ;; | Use of unreleased versions of this software requires the user |
+7 ;; | to execute a written test agreement with the VistA Imaging |
+8 ;; | Development Office of the Department of Veterans Affairs, |
+9 ;; | telephone (301) 734-0100. |
+10 ;; | |
+11 ;; | The Food and Drug Administration classifies this software as |
+12 ;; | a medical device. As such, it may not be changed in any way. |
+13 ;; | Modifications to this software may result in an adulterated |
+14 ;; | medical device under 21CFR820, the use of which is considered |
+15 ;; | to be a violation of US Federal Statutes. |
+16 ;; +---------------------------------------------------------------+
+17 ;;
+18 QUIT
+19 ;
NWI2005(MAGVOUT,MAGGDA) ;Create a new MAG WORK ITEM for an image stored in IMAGE file (#2005)
+1 ; MAGGDA - IEN in IMAGE file (#2005)
+2 ;
+3 ;
+4 NEW CRTUSR,CRTAPP,DFN,ICN,IEN,J,MAGGRP,MSGTAGS,TYPE,SUBTYPE,STATUS,PLACEID,PRIORITY,Y,TMP
+5 NEW MODALITY,MAGPDATA,REFTYPE,REFIEN
+6 ;
+7 SET IEN=+$GET(MAGGDA)
if 'IEN
QUIT
+8 ;
+9 ; ACQUISITION SITE
SET PLACEID=$$GET1^DIQ(2005,IEN,.05,"I")
+10 if 'PLACEID
SET PLACEID=DUZ(2)
+11 ;
+12 ; IA# 2263
if '$$GET^XPAR("DIV.`"_PLACEID_"^SYS","MAG PRECACHE ACQ ENABLED",,"I")
QUIT
+13 ;
+14 ; FILEREF
if $$GET1^DIQ(2005,IEN,1,"I")=""
QUIT
+15 ; PATIENT
SET DFN=$$GET1^DIQ(2005,IEN,5,"I")
+16 ; GROUP PARENT
SET MAGGRP=$$GET1^DIQ(2005,IEN,14,"I")
+17 ;
+18 ; TAGS
+19 SET J=0
+20 ; image is in file #2005
SET J=J+1
SET MSGTAGS(J)="storage`2005"
+21 ; IMAGE IEN
SET J=J+1
SET MSGTAGS(J)="imageIen`"_IEN
+22 ; GRP IEN
if MAGGRP
SET J=J+1
SET MSGTAGS(J)="studyIen`"_MAGGRP
+23 if DFN
SET J=J+1
SET MSGTAGS(J)="patientDfn`"_DFN
+24 IF $LENGTH($TEXT(GETICN^MPIF001))
Begin DoDot:1
+25 SET ICN=$$GETICN^MPIF001(DFN)
+26 if ICN>1
SET J=J+1
SET MSGTAGS(J)="patientIcn`"_ICN
+27 QUIT
End DoDot:1
+28 ; precash flag
SET J=J+1
SET MSGTAGS(J)="acquisition`1"
+29 ;
+30 ; Parent Data File
SET MAGPDATA=$$GET1^DIQ(2005,IEN,16,"I")
+31 SET REFTYPE=$SELECT(MAGPDATA=74:"RAD",MAGPDATA=8925:"TIU",1:"")
+32 IF REFTYPE'=""
Begin DoDot:1
+33 SET REFIEN=$$GET1^DIQ(2005,IEN,17,"I")
+34 ; Create CPRS Context ID and translate ^ to ~
SET J=J+1
SET MSGTAGS(J)="contextId`"_$TRANSLATE($$CPRSCTX^MAGNU003(REFTYPE,REFIEN),"^","~")
+35 QUIT
End DoDot:1
+36 ;
+37 SET J=J+1
SET MSGTAGS(J)="imageFileName`"_$$FILENAME^MAGGAII(IEN,"FULL",.TMP)
+38 SET J=J+1
SET MSGTAGS(J)="imageShortDescr`"_$$GET1^DIQ(2005,IEN,10,"I")
+39 SET J=J+1
SET MSGTAGS(J)="imageObjectType`"_$$GET1^DIQ(2005,IEN,3,"I")
+40 SET MODALITY=$$MODALITY(IEN)
+41 if MODALITY'=""
SET J=J+1
SET MSGTAGS(J)="imageModality`"_MODALITY
+42 ;
+43 SET TYPE="PRECACHE"
+44 SET SUBTYPE="ACQUISITION"
+45 SET STATUS="New"
+46 SET PRIORITY=0
+47 ;
+48 ;IA # 2171
SET PLACEID=$$STA^XUAF4(PLACEID)
+49 ;
+50 ; IMAGE SAVE BY
SET CRTUSR=$$GET1^DIQ(2005,IEN,8,"I")
+51 if 'CRTUSR
SET CRTUSR=DUZ
+52 ;
+53 ; CAPTURE APPLICATION
SET CRTAPP=$$GET1^DIQ(2005,IEN,8.1,"I")
+54 SET CRTAPP=$SELECT(CRTAPP="D":"DICOM",CRTAPP="C":"CAPTURE",1:"IMPORTER")
+55 ;
+56 DO CRTITEM^MAGVIM01(.MAGVOUT,TYPE,SUBTYPE,STATUS,PLACEID,PRIORITY,.MSGTAGS,CRTUSR,CRTAPP)
+57 QUIT
+58 ;
NWI34(MAGVOUT,PIEN,IEN) ; ;Create a new MAG WORK ITEM for an image stored in P34 stucture
+1 ; PIEN = IEN in IMAGE SOP INSTANCE file (#2005.64)
+2 ; IEN = IMAGE INSTANCE FILE file (#2005.65)
+3 ;
+4 NEW CPRSCNTX,CRTUSR,CRTAPP,DFN,ICN,J,MAGGRP,MSGTAGS,TYPE,SUBTYPE,STATUS,PLACEID,PRIORITY,Y
+5 NEW MAGAENT,MAGMODAL,REFTYPE,REFIEN
+6 ;
+7 ; ACQUISITION LOCATION in file #2005.63
SET PLACEID=$$GET1^DIQ(2005.64,PIEN,"11:31:.01","I")
+8 SET PLACEID=$SELECT($PIECE(PLACEID,";",2)="DIC(4,":+PLACEID,1:"")
+9 if 'PLACEID
SET PLACEID=DUZ(2)
+10 ;
+11 ; IA# 2263
if '$$GET^XPAR("DIV.`"_PLACEID_"^SYS","MAG PRECACHE ACQ ENABLED",,"I")
QUIT
+12 ;
+13 SET DFN=""
+14 ; ASSIGNING AUTHORITY in file #2005.6
SET MAGAENT=$$GET1^DIQ(2005.64,PIEN,"11:11:13:.02","I")
+15 ; ENTERPRISE PATIENT ID in file #2005.6
IF MAGAENT="V"
SET DFN=$$GET1^DIQ(2005.64,PIEN,"11:11:13:.01","I")
+16 ;
+17 ; MODALITY in file #2005.63
SET MAGMODAL=$$GET1^DIQ(2005.64,PIEN,"11:3","I")
+18 ;
+19 ; Study IEN in file #2005.62
SET MAGGRP=$$GET1^DIQ(2005.64,PIEN,"11:11","I")
+20 ;
+21 ; TAGS
+22 SET J=0
+23 ; image is in P34 data structure
SET J=J+1
SET MSGTAGS(J)="storage`2005.64"
+24 ; IEN in IMAGE SOP INSTANCE file (#2005.64)
SET J=J+1
SET MSGTAGS(J)="imageIen`"_PIEN
+25 ;Study IEN in IMAGE STUDY file (#2005.62)
if MAGGRP
SET J=J+1
SET MSGTAGS(J)="studyIen`"_MAGGRP
+26 if DFN
SET J=J+1
SET MSGTAGS(J)="patientDfn`"_DFN
+27 IF $LENGTH($TEXT(GETICN^MPIF001))
Begin DoDot:1
+28 SET ICN=$$GETICN^MPIF001(DFN)
+29 if ICN>1
SET J=J+1
SET MSGTAGS(J)="patientIcn`"_ICN
+30 QUIT
End DoDot:1
+31 ; MODALITY in file #2005.63
if MAGMODAL'=""
SET J=J+1
SET MSGTAGS(J)="modality`"_MAGMODAL
+32 ;
+33 ; Add Add Artifact Instance tags
DO AINST(.MSGTAGS,.J,IEN)
+34 ;
+35 ; precash flag
SET J=J+1
SET MSGTAGS(J)="acquisition`1"
+36 ;
+37 ; Create CPRS Context ID by Study IEN
SET CPRSCNTX=$$CPRSCTXS(MAGGRP)
+38 IF CPRSCNTX'=""
Begin DoDot:1
+39 ; translate ^ to ~
SET J=J+1
SET MSGTAGS(J)="contextId`"_$TRANSLATE(CPRSCNTX,"^","~")
+40 QUIT
End DoDot:1
+41 ;
+42 SET TYPE="PRECACHE"
+43 SET SUBTYPE="ACQUISITION"
+44 SET STATUS="New"
+45 SET PRIORITY=0
+46 ;IA # 2171
SET PLACEID=$$STA^XUAF4(PLACEID)
+47 ;
+48 ; IMAGE SAVE BY
SET CRTUSR=""
+49 if 'CRTUSR
SET CRTUSR=DUZ
+50 ;
+51 ; CAPTURE APPLICATION
SET CRTAPP="D"
+52 SET CRTAPP=$SELECT(CRTAPP="D":"DICOM",CRTAPP="C":"CAPTURE",1:"IMPORTER")
+53 ;
+54 DO CRTITEM^MAGVIM01(.MAGVOUT,TYPE,SUBTYPE,STATUS,PLACEID,PRIORITY,.MSGTAGS,CRTUSR,CRTAPP)
+55 QUIT
+56 ;
CPRSCTXS(STUDYIEN) ; Get CPRS context by Study IEN in IMAGE STUDY file (#2005.62)
+1 NEW ACNUMB,CONTEXT,REFTYPE,REFIEN
+2 SET ACNUMB=$$GET1^DIQ(2005.62,STUDYIEN,.02,"I")
+3 ; Set Reference type by Accession Number
DO REFBYACN^MAGNU003(.REFTYPE,.REFIEN,ACNUMB)
+4 SET CONTEXT=$$CPRSCTX^MAGNU003(REFTYPE,REFIEN)
+5 QUIT CONTEXT
+6 ;
AINST(MSGTAGS,J,INSTIEN) ; Add Artifact Instance
+1 ; INSTIEN = IEN in IMAGE INSTANCE FILE file (#2005.65)
+2 ;
+3 NEW CNT,KEY,VALUE,LINE,IEN,I,RES,TMPARR,TOKEN,QT
+4 ; Artifact Token
SET TOKEN=$$GET1^DIQ(2005.65,INSTIEN,.01,"I")
+5 ; Get not deleted Artifact IEN by Token
DO GETAIENT^MAGVAG02(.RES,TOKEN,"")
+6 IF '$$ISOK^MAGVAF02(RES)
QUIT
+7 SET IEN=$$GETVAL^MAGVAF02(RES)
+8 DO GETAINST^MAGVAG04(.TMPARR,IEN)
+9 IF '$$ISOK^MAGVAF02(TMPARR(0))
QUIT
+10 SET QT=$CHAR(34)
+11 SET CNT=0
+12 SET I=1
+13 FOR
SET I=$ORDER(TMPARR(I))
if 'I
QUIT
SET LINE=TMPARR(I)
if LINE["</ARTIFACTINSTANCES"
QUIT
Begin DoDot:1
+14 IF LINE["<ARTIFACTINSTANCE"
SET CNT=CNT+1
QUIT
+15 IF LINE["</ARTIFACTINSTANCE"
QUIT
+16 SET KEY=$PIECE(TMPARR(I),"=",1)
+17 SET VALUE=$TRANSLATE($PIECE(TMPARR(I),"=",2),QT,"")
+18 ; special handling because of XML result set
SET VALUE=$PIECE(VALUE," >")
+19 IF (KEY="PK")!(KEY="ARTIFACT")!(KEY="DISKVOLUME")
SET J=J+1
SET MSGTAGS(J)="ai_"_KEY_"_"_CNT_"`"_VALUE
+20 ; Add Storage provider name
IF KEY="STORAGEPROVIDER"
Begin DoDot:2
+21 SET J=J+1
SET MSGTAGS(J)="ai_storeProvType_"_CNT_"`"_$$GET1^DIQ(2006.917,VALUE,"2")
+22 QUIT
End DoDot:2
+23 QUIT
End DoDot:1
+24 QUIT
+25 ;
MODALITY(IMGIEN) ; Get Image modality
+1 NEW G,M,P,MAGFILD,MAGFILG,X
+2 SET MAGFILD=$$FILE^MAGGI11(IMGIEN)
+3 SET X=$SELECT(MAGFILD:$GET(^MAG(MAGFILD,IMGIEN,0)),1:"")
+4 ;Group IEN
SET G=+$PIECE(X,"^",10)
+5 ;Procedure
SET M=$PIECE(X,"^",8)
+6 if $EXTRACT(M,1,4)="RAD "
SET M=$EXTRACT(M,5,$LENGTH(M))
+7 if M=""
QUIT ""
+8 SET MAGFILG=$$FILE^MAGGI11(G)
+9 ;Parent Data File# for Group IEN
SET G=$SELECT(MAGFILG:$PIECE($GET(^MAG(MAGFILG,G,2)),"^",6),1:"")
+10 ;Parent Data File# for IEN
SET P=$SELECT(MAGFILD:$PIECE($GET(^MAG(MAGFILD,IMGIEN,2)),"^",6),1:"")
+11 ;quit if not RAD/NUC MED REPORTS file (#74)
IF P'=74
IF G'=74
QUIT ""
+12 QUIT M