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

MAGDQR74.m

Go to the documentation of this file.
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