MAGVD002 ;WOIFO/DAC,MLH - Delete old and new studies ; 3 Feb 2012 01:19 PM
;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 01, 2013
;; 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
; Input Variables:
; MAGARR(1..n,"IMAGES")
; MAGARR(1..n,"MAGDFN") - Patient DFN
; MAGARR(1..n,"MAGD1") - Radiology DT
; MAGARR(1..n,"MAGD2") - Radiology P
; REASON - Reason for deletion
;
; Output Variable:
; OUT - status`status message
; 0 indicates success, a negative integer indicates an error occurred
;
DELACC(OUT,MAGARR,REASON) ; Delete old and new studies using MAGARR info - called from option MAG SYS-DELETE STUDY
N SSEP,ISEP,IMAGEIEN,OUTAUD,EVENT,HOST,APP,MESSAGE,DATA,I,STUDIEN
N RESULT
S SSEP=$$STATSEP^MAGVRS41
S ISEP=$$INPUTSEP^MAGVRS41
I $G(REASON)="" S OUT=-8_SSEP_"No reason provided" Q
I '$D(MAGARR(1,"IMAGES")) S OUT=-9_SSEP_"No image IENs provided" Q
S IMAGEIEN="",OUT=""
F I=1:1 Q:'$D(MAGARR(I,"IMAGES"))!(OUT'="") D
. F S IMAGEIEN=$O(MAGARR(I,"IMAGES",IMAGEIEN)) Q:IMAGEIEN="" D
. . I MAGARR(I,"IMAGES",IMAGEIEN)="" D
. . . D IMAGEDEL^MAGGTID(.RESULT,IMAGEIEN,1,REASON)
. . . I $P($G(RESULT(0)),"^")=0 S OUT=-10_SSEP_$P($G(RESULT(0)),"^",2) Q
. . . Q
. . I MAGARR(I,"IMAGES",IMAGEIEN)'="" D
. . . S STUDIEN=MAGARR(I,"IMAGES",IMAGEIEN)
. . . D INACTIVT^MAGVRS41(.RESULT,2005.62,STUDIEN,"",1,REASON)
. . . I +$G(RESULT(1))<0 S OUT=RESULT(1) Q
. . . Q
. . Q
. Q
I OUT="" S OUT=0 ; set success value
S EVENT="DELETE"
S HOST=""
S APP="MAG SYS-DELETE STUDY"
S MESSAGE=""
S DATA(1)="DUZ"_ISEP_DUZ
D EVENT^MAGUAUD(.OUTAUD,EVENT,HOST,APP,MESSAGE,.DATA)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGVD002 2608 printed Sep 02, 2024@18:54:48 Page 2
MAGVD002 ;WOIFO/DAC,MLH - Delete old and new studies ; 3 Feb 2012 01:19 PM
+1 ;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 01, 2013
+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 ; Input Variables:
+19 ; MAGARR(1..n,"IMAGES")
+20 ; MAGARR(1..n,"MAGDFN") - Patient DFN
+21 ; MAGARR(1..n,"MAGD1") - Radiology DT
+22 ; MAGARR(1..n,"MAGD2") - Radiology P
+23 ; REASON - Reason for deletion
+24 ;
+25 ; Output Variable:
+26 ; OUT - status`status message
+27 ; 0 indicates success, a negative integer indicates an error occurred
+28 ;
DELACC(OUT,MAGARR,REASON) ; Delete old and new studies using MAGARR info - called from option MAG SYS-DELETE STUDY
+1 NEW SSEP,ISEP,IMAGEIEN,OUTAUD,EVENT,HOST,APP,MESSAGE,DATA,I,STUDIEN
+2 NEW RESULT
+3 SET SSEP=$$STATSEP^MAGVRS41
+4 SET ISEP=$$INPUTSEP^MAGVRS41
+5 IF $GET(REASON)=""
SET OUT=-8_SSEP_"No reason provided"
QUIT
+6 IF '$DATA(MAGARR(1,"IMAGES"))
SET OUT=-9_SSEP_"No image IENs provided"
QUIT
+7 SET IMAGEIEN=""
SET OUT=""
+8 FOR I=1:1
if '$DATA(MAGARR(I,"IMAGES"))!(OUT'="")
QUIT
Begin DoDot:1
+9 FOR
SET IMAGEIEN=$ORDER(MAGARR(I,"IMAGES",IMAGEIEN))
if IMAGEIEN=""
QUIT
Begin DoDot:2
+10 IF MAGARR(I,"IMAGES",IMAGEIEN)=""
Begin DoDot:3
+11 DO IMAGEDEL^MAGGTID(.RESULT,IMAGEIEN,1,REASON)
+12 IF $PIECE($GET(RESULT(0)),"^")=0
SET OUT=-10_SSEP_$PIECE($GET(RESULT(0)),"^",2)
QUIT
+13 QUIT
End DoDot:3
+14 IF MAGARR(I,"IMAGES",IMAGEIEN)'=""
Begin DoDot:3
+15 SET STUDIEN=MAGARR(I,"IMAGES",IMAGEIEN)
+16 DO INACTIVT^MAGVRS41(.RESULT,2005.62,STUDIEN,"",1,REASON)
+17 IF +$GET(RESULT(1))<0
SET OUT=RESULT(1)
QUIT
+18 QUIT
End DoDot:3
+19 QUIT
End DoDot:2
+20 QUIT
End DoDot:1
+21 ; set success value
IF OUT=""
SET OUT=0
+22 SET EVENT="DELETE"
+23 SET HOST=""
+24 SET APP="MAG SYS-DELETE STUDY"
+25 SET MESSAGE=""
+26 SET DATA(1)="DUZ"_ISEP_DUZ
+27 DO EVENT^MAGUAUD(.OUTAUD,EVENT,HOST,APP,MESSAGE,.DATA)
+28 QUIT