- MAGDQR74 ;WOIFO/NST,PMK - Imaging Utilities for Query/Retrieve - acc# scan (new); Feb 15, 2022@10:27:25
- ;;3.0;IMAGING;**118,305**;Mar 19, 2002;Build 3
- ;; 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
- ;
- ADD1STD(ACCN,TMPQ) ; Add one Study to temp global by accession number
- ; Input parameters
- ; ================
- ;
- ; ACCN - Accession Number
- ;
- ; Return 0 - nothing added
- ; 1 - a record was added
- ;
- ; TMPQ - reference to an array with studies in format
- ; TMPQ("N^"_MAGD0_"^"_STUDYIX)=""
- ; where MAGD0 is patient DFN
- ; STUDYIX is IEN in IMAGE STUDY file (#2005.62)
- ;
- N STUDYIX,MAGD0,PATREFIX,PATREFDTA,PROCIX,RESULT
- S RESULT=0
- S PROCIX=""
- F S PROCIX=$O(^MAGV(2005.61,"B",ACCN,PROCIX)) Q:PROCIX="" D
- . I $$PROBLEM61^MAGDSTA8(PROCIX) Q ; P305 PMK 12/06/2021
- . S PATREFIX=$P($G(^MAGV(2005.61,PROCIX,6)),"^",1) ; Patient Reference
- . ; Q:'PATREFIX ; Quit if there is no Patient Reference
- . S PATREFDTA=$G(^MAGV(2005.6,PATREFIX,0))
- . ; Q:$P(PATREFDTA,"^",3)'="D" ; Quit if it is not DFN
- . S MAGD0=$P(PATREFDTA,"^",1) ; DFN
- . D:MAGD0'=""
- . . S STUDYIX="" F S STUDYIX=$O(^MAGV(2005.62,"C",PROCIX,STUDYIX)) Q:'STUDYIX D
- . . . I $$PROBLEM62^MAGDSTA8(STUDYIX) Q ; P305 PMK 12/06/2021
- . . . ; Q:$P($G(^MAGV(2005.62,STUDYIX,5)),"^",2)="I" ; study marked inaccessible
- . . . S @TMPQ@("N^"_MAGD0_"^"_STUDYIX)="",RESULT=1
- . . . Q
- . . Q
- . Q
- Q RESULT
- ;
- ADDSTUDY(ACCN,TMPQ,TMPQACCN) ; Add all Studies to temp global by accession number
- ; Input parameters
- ; ================
- ;
- ; ACCN - Accession Number
- ;
- ; Return 0 - nothing added
- ; 1 - a record was added
- ;
- ; TMPQ - reference to array with studies in format
- ; TMPQ("N^"_MAGD0_"^"_STUDYIX)=""
- ; where MAGD0 is patient DFN
- ; STUDYIX is IEN in IMAGE STUDY file (#2005.62)
- ; TMPQACCN - reference to array with accession numbers in format
- ; TMPQACCN(V) where V is accession number
- ;
- N ACNLIST,I,RESULT,V
- S ACNLIST=$$DAYCASE2^MAGJUTL6(ACCN) ; Get Radiology accession numbers
- S:ACNLIST="" ACNLIST=ACCN ; not a Radiology accession number
- S RESULT=0
- F I=1:1:$L(ACNLIST,U) D
- . S V=$P(ACNLIST,U,I) ; Accesion Number
- . S:TMPQACCN'="" @TMPQACCN@(V)="" ; Add it to an accession numbers list
- . S:$$ADD1STD^MAGDQR74(V,TMPQ) RESULT=1
- . Q
- Q RESULT
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGDQR74 3372 printed Feb 18, 2025@23:27:37 Page 2
- MAGDQR74 ;WOIFO/NST,PMK - Imaging Utilities for Query/Retrieve - acc# scan (new); Feb 15, 2022@10:27:25
- +1 ;;3.0;IMAGING;**118,305**;Mar 19, 2002;Build 3
- +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 ;; | The Food and Drug Administration classifies this software as |
- +11 ;; | a medical device. As such, it may not be changed in any way. |
- +12 ;; | Modifications to this software may result in an adulterated |
- +13 ;; | medical device under 21CFR820, the use of which is considered |
- +14 ;; | to be a violation of US Federal Statutes. |
- +15 ;; +---------------------------------------------------------------+
- +16 ;;
- +17 QUIT
- +18 ;
- ADD1STD(ACCN,TMPQ) ; Add one Study to temp global by accession number
- +1 ; Input parameters
- +2 ; ================
- +3 ;
- +4 ; ACCN - Accession Number
- +5 ;
- +6 ; Return 0 - nothing added
- +7 ; 1 - a record was added
- +8 ;
- +9 ; TMPQ - reference to an array with studies in format
- +10 ; TMPQ("N^"_MAGD0_"^"_STUDYIX)=""
- +11 ; where MAGD0 is patient DFN
- +12 ; STUDYIX is IEN in IMAGE STUDY file (#2005.62)
- +13 ;
- +14 NEW STUDYIX,MAGD0,PATREFIX,PATREFDTA,PROCIX,RESULT
- +15 SET RESULT=0
- +16 SET PROCIX=""
- +17 FOR
- SET PROCIX=$ORDER(^MAGV(2005.61,"B",ACCN,PROCIX))
- if PROCIX=""
- QUIT
- Begin DoDot:1
- +18 ; P305 PMK 12/06/2021
- IF $$PROBLEM61^MAGDSTA8(PROCIX)
- QUIT
- +19 ; Patient Reference
- SET PATREFIX=$PIECE($GET(^MAGV(2005.61,PROCIX,6)),"^",1)
- +20 ; Q:'PATREFIX ; Quit if there is no Patient Reference
- +21 SET PATREFDTA=$GET(^MAGV(2005.6,PATREFIX,0))
- +22 ; Q:$P(PATREFDTA,"^",3)'="D" ; Quit if it is not DFN
- +23 ; DFN
- SET MAGD0=$PIECE(PATREFDTA,"^",1)
- +24 if MAGD0'=""
- Begin DoDot:2
- +25 SET STUDYIX=""
- FOR
- SET STUDYIX=$ORDER(^MAGV(2005.62,"C",PROCIX,STUDYIX))
- if 'STUDYIX
- QUIT
- Begin DoDot:3
- +26 ; P305 PMK 12/06/2021
- IF $$PROBLEM62^MAGDSTA8(STUDYIX)
- QUIT
- +27 ; Q:$P($G(^MAGV(2005.62,STUDYIX,5)),"^",2)="I" ; study marked inaccessible
- +28 SET @TMPQ@("N^"_MAGD0_"^"_STUDYIX)=""
- SET RESULT=1
- +29 QUIT
- End DoDot:3
- +30 QUIT
- End DoDot:2
- +31 QUIT
- End DoDot:1
- +32 QUIT RESULT
- +33 ;
- ADDSTUDY(ACCN,TMPQ,TMPQACCN) ; Add all Studies to temp global by accession number
- +1 ; Input parameters
- +2 ; ================
- +3 ;
- +4 ; ACCN - Accession Number
- +5 ;
- +6 ; Return 0 - nothing added
- +7 ; 1 - a record was added
- +8 ;
- +9 ; TMPQ - reference to array with studies in format
- +10 ; TMPQ("N^"_MAGD0_"^"_STUDYIX)=""
- +11 ; where MAGD0 is patient DFN
- +12 ; STUDYIX is IEN in IMAGE STUDY file (#2005.62)
- +13 ; TMPQACCN - reference to array with accession numbers in format
- +14 ; TMPQACCN(V) where V is accession number
- +15 ;
- +16 NEW ACNLIST,I,RESULT,V
- +17 ; Get Radiology accession numbers
- SET ACNLIST=$$DAYCASE2^MAGJUTL6(ACCN)
- +18 ; not a Radiology accession number
- if ACNLIST=""
- SET ACNLIST=ACCN
- +19 SET RESULT=0
- +20 FOR I=1:1:$LENGTH(ACNLIST,U)
- Begin DoDot:1
- +21 ; Accesion Number
- SET V=$PIECE(ACNLIST,U,I)
- +22 ; Add it to an accession numbers list
- if TMPQACCN'=""
- SET @TMPQACCN@(V)=""
- +23 if $$ADD1STD^MAGDQR74(V,TMPQ)
- SET RESULT=1
- +24 QUIT
- End DoDot:1
- +25 QUIT RESULT