MAGDQR72 ;WOIFO/MLH,DAC - Imaging RPCs for Query/Retrieve - acc# scan for rad recs (old DB) ; 22 Dec 2015 3:07 PM
;;3.0;IMAGING;**118,162**;Mar 19, 2002;Build 22;Dec 22, 2015
;; 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
; called by MAGDQR07
;
ACCRAD(REQ,T,P,ACC) ; scan old structure for Radiology Related Images (including site-specific accession numbers)
N TMPQ,I,V,MAGD0,MAGD1,MAGD2,RPTIX
S TMPQ=$NA(^TMP("MAG",$J,"QR")) K @TMPQ@(5)
S I=$$MATCHD^MAGDQR03(REQ(T,P),"^RADPT(""ADC"",LOOP)","@TMPQ@(5,LOOP)")
S I=$$MATCHD^MAGDQR03(REQ(T,P),"^RADPT(""ADC1"",LOOP)","@TMPQ@(5,LOOP)")
S V="" F S V=$O(@TMPQ@(5,V)) Q:V="" D
. S MAGD0="" F S MAGD0=$O(^RADPT("ADC",V,MAGD0)) Q:MAGD0="" D
. . S MAGD1="" F S MAGD1=$O(^RADPT("ADC",V,MAGD0,MAGD1)) Q:MAGD1="" D
. . . S MAGD2="" F S MAGD2=$O(^RADPT("ADC",V,MAGD0,MAGD1,MAGD2)) Q:MAGD2="" D
. . . . S RPTIX=$P($G(^RADPT(MAGD0,"DT",MAGD1,"P",MAGD2,0)),"^",17) Q:'RPTIX ; no report on file
. . . . Q:'$D(^RARPT(RPTIX,2005)) ; report doesn't have images in old structure
. . . . S @TMPQ@(6,"R^"_MAGD0_"^"_MAGD1_"^"_MAGD2)="",ACC=1
. . . . Q
. . . Q
. . Q
. Q
; P162 DAC - Match site specific accession numbers - ADC1 index
S V="" F S V=$O(@TMPQ@(5,V)) Q:V="" D
. S MAGD0="" F S MAGD0=$O(^RADPT("ADC1",V,MAGD0)) Q:MAGD0="" D
. . S MAGD1="" F S MAGD1=$O(^RADPT("ADC1",V,MAGD0,MAGD1)) Q:MAGD1="" D
. . . S MAGD2="" F S MAGD2=$O(^RADPT("ADC1",V,MAGD0,MAGD1,MAGD2)) Q:MAGD2="" D
. . . . S RPTIX=$P($G(^RADPT(MAGD0,"DT",MAGD1,"P",MAGD2,0)),"^",17) Q:'RPTIX ; no report on file
. . . . Q:'$D(^RARPT(RPTIX,2005)) ; report doesn't have images in old structure
. . . . S @TMPQ@(6,"R^"_MAGD0_"^"_MAGD1_"^"_MAGD2)="",ACC=1
. . . . Q
. . . Q
. . Q
. Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGDQR72 2717 printed Oct 16, 2024@18:01:52 Page 2
MAGDQR72 ;WOIFO/MLH,DAC - Imaging RPCs for Query/Retrieve - acc# scan for rad recs (old DB) ; 22 Dec 2015 3:07 PM
+1 ;;3.0;IMAGING;**118,162**;Mar 19, 2002;Build 22;Dec 22, 2015
+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 ; called by MAGDQR07
+19 ;
ACCRAD(REQ,T,P,ACC) ; scan old structure for Radiology Related Images (including site-specific accession numbers)
+1 NEW TMPQ,I,V,MAGD0,MAGD1,MAGD2,RPTIX
+2 SET TMPQ=$NAME(^TMP("MAG",$JOB,"QR"))
KILL @TMPQ@(5)
+3 SET I=$$MATCHD^MAGDQR03(REQ(T,P),"^RADPT(""ADC"",LOOP)","@TMPQ@(5,LOOP)")
+4 SET I=$$MATCHD^MAGDQR03(REQ(T,P),"^RADPT(""ADC1"",LOOP)","@TMPQ@(5,LOOP)")
+5 SET V=""
FOR
SET V=$ORDER(@TMPQ@(5,V))
if V=""
QUIT
Begin DoDot:1
+6 SET MAGD0=""
FOR
SET MAGD0=$ORDER(^RADPT("ADC",V,MAGD0))
if MAGD0=""
QUIT
Begin DoDot:2
+7 SET MAGD1=""
FOR
SET MAGD1=$ORDER(^RADPT("ADC",V,MAGD0,MAGD1))
if MAGD1=""
QUIT
Begin DoDot:3
+8 SET MAGD2=""
FOR
SET MAGD2=$ORDER(^RADPT("ADC",V,MAGD0,MAGD1,MAGD2))
if MAGD2=""
QUIT
Begin DoDot:4
+9 ; no report on file
SET RPTIX=$PIECE($GET(^RADPT(MAGD0,"DT",MAGD1,"P",MAGD2,0)),"^",17)
if 'RPTIX
QUIT
+10 ; report doesn't have images in old structure
if '$DATA(^RARPT(RPTIX,2005))
QUIT
+11 SET @TMPQ@(6,"R^"_MAGD0_"^"_MAGD1_"^"_MAGD2)=""
SET ACC=1
+12 QUIT
End DoDot:4
+13 QUIT
End DoDot:3
+14 QUIT
End DoDot:2
+15 QUIT
End DoDot:1
+16 ; P162 DAC - Match site specific accession numbers - ADC1 index
+17 SET V=""
FOR
SET V=$ORDER(@TMPQ@(5,V))
if V=""
QUIT
Begin DoDot:1
+18 SET MAGD0=""
FOR
SET MAGD0=$ORDER(^RADPT("ADC1",V,MAGD0))
if MAGD0=""
QUIT
Begin DoDot:2
+19 SET MAGD1=""
FOR
SET MAGD1=$ORDER(^RADPT("ADC1",V,MAGD0,MAGD1))
if MAGD1=""
QUIT
Begin DoDot:3
+20 SET MAGD2=""
FOR
SET MAGD2=$ORDER(^RADPT("ADC1",V,MAGD0,MAGD1,MAGD2))
if MAGD2=""
QUIT
Begin DoDot:4
+21 ; no report on file
SET RPTIX=$PIECE($GET(^RADPT(MAGD0,"DT",MAGD1,"P",MAGD2,0)),"^",17)
if 'RPTIX
QUIT
+22 ; report doesn't have images in old structure
if '$DATA(^RARPT(RPTIX,2005))
QUIT
+23 SET @TMPQ@(6,"R^"_MAGD0_"^"_MAGD1_"^"_MAGD2)=""
SET ACC=1
+24 QUIT
End DoDot:4
+25 QUIT
End DoDot:3
+26 QUIT
End DoDot:2
+27 QUIT
End DoDot:1
+28 QUIT