MAGVCAE ;;WOIFO/MAT - DICOM Storage Commit RPCs ; 23 Oct 2012 3:01 AM
;;3.0;IMAGING;**138**;Mar 19, 2002;Build 5380;Sep 03, 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
;
; Adapted from MAGVRS52 [RPC: MAG DICOM CHECK AE TITLE]
;
;##### GET DICOM AE SECURITY MATRIX (#2006.9192) Data for input AE TITLE
; RPC: MAG DICOM GET AE ENTRY
;
AENAME(OUT,APPNAME,LOCATION) ;
; Returns AE Title and Security Matrix information for a given AE Title and Location
N AEIEN,AEINST,MATCH,MSEP,I,LOCIEN,OSEP,STATION,SERVTYPE
I $G(APPNAME)="" S OUT(1)="-1,No Application Name specified" Q
I $G(LOCATION)="" S OUT(1)="-3,No Location specified" Q
S AEIEN=0,MATCH=0,I=1,OSEP="`",MSEP="|",SERVTYPE="^"
; Loop through all entries - match on AE Instance name and Location
F S AEIEN=$O(^MAGV(2006.9192,AEIEN)) Q:(AEIEN="")!(+AEIEN=0) D
. S AEINST=$G(^MAGV(2006.9192,AEIEN,0))
. S LOCIEN=$P(AEINST,U,3) ; Pointer to INSTITUTION file (#4)
. Q:LOCIEN="" S STATION=$$STA^XUAF4(LOCIEN) ; IA #2171
. I (LOCATION=STATION)&(($P(AEINST,U,1))=APPNAME) D
. . ; If 1st match write all AE Instance info and Service Role
. . I MATCH=0 D AEINST^MAGVRS52(.OUT,AEIEN,AEINST,LOCATION) S OUT(1)=OUT(1)_"SERVICE MESSAGE="
. . S I=I+1
. . S MATCH=MATCH+1
. . ; Add Services and Roles to output
. . D AESECMX^MAGVRS52(.OUT,AEIEN)
. . ;--- Add N-Response Delay (#13) in seconds, N-Response Retries (#14) *79.
. . S OUT(1)=OUT(1)_OSEP_(60*$$GET1^DIQ(2006.9192,AEIEN,13,"I"))
. . S OUT(1)=OUT(1)_OSEP_$$GET1^DIQ(2006.9192,AEIEN,14,"I")
. Q
I MATCH=0 S OUT(1)="-2,No entry for Application Name """_APPNAME_""" at location """_LOCATION_"""."
Q
AENTRYLC(OUT,SERVICE,ROLE,LOCATION) ; RPC = MAG DICOM GET AE ENTRY LOC
; The RPC will return the AE SEC MX Entry with matching provided service, role, and location fields
N DROLE,DSERVICE,IEN,DSRIEN,DSR,AEDATA,OSEP
S OSEP=$$OUTSEP,IEN=0,OUT(1)=""
I $G(LOCATION)="" S OUT(1)="-2"_OSEP_"No LOCATION provided." Q
I $G(SERVICE)="" S OUT(1)="-2"_OSEP_"No SERVICE provided." Q
I $G(ROLE)="" S OUT(1)="-2"_OSEP_"No ROLE provided." Q
F S IEN=$O(^MAGV(2006.9192,IEN)) Q:(+IEN=0)!(IEN="")!(OUT(1)'="") D
. S AEDATA=$G(^MAGV(2006.9192,IEN,0))
. I LOCATION'=$P(AEDATA,U,3) Q
. N IENS
. S DSRIEN=0
. F S DSRIEN=$O(^MAGV(2006.9192,IEN,3,DSRIEN)) Q:(+DSRIEN=0)!(DSRIEN="")!(OUT(1)'="") D
. . S IENS=DSRIEN_","_IEN_","
. . S DSERVICE=$$GET1^DIQ(2006.919212,IENS,.01)
. . S DROLE=$$GET1^DIQ(2006.919212,IENS,1)
. . I (SERVICE=DSERVICE)&(ROLE=DROLE) D AENTRYLD(IEN)
. . Q
. Q
S:OUT(1)="" OUT(1)="-1"_OSEP_"No title for """_SERVICE_""", """_ROLE_""" at location """_LOCATION_"""."
Q
;
;+++++ Entry point from above, which has chosen the entry to process.
;
AENTRYLD(AEIEN) ;
S AEINST=$G(^MAGV(2006.9192,AEIEN,0))
D AEINST^MAGVRS52(.OUT,AEIEN,AEINST,LOCATION) S OUT(1)=OUT(1)_"SERVICE MESSAGE="
; Add Services and Roles to output
D AESECMX^MAGVRS52(.OUT,AEIEN)
;--- Add N-Response Delay (#13) in seconds, N-Response Retries (#14) *79.
S OUT(1)=OUT(1)_OSEP_(60*$$GET1^DIQ(2006.9192,AEIEN,13,"I"))
S OUT(1)=OUT(1)_OSEP_$$GET1^DIQ(2006.9192,AEIEN,14,"I")
Q
;--- Set separator values.
;
OUTSEP() ; Separator for output data ie. NAME`DOB
Q "`"
MULTISEP() ; Name value separator for multiple values ie. REJECT=1|WARNING=1
Q "|"
SRSEP() ; Service and Role Separator ie. C-Store^SCU^C-Move^SCP
Q "^"
;
; MAGVCAE
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGVCAE 4398 printed Nov 22, 2024@17:19:36 Page 2
MAGVCAE ;;WOIFO/MAT - DICOM Storage Commit RPCs ; 23 Oct 2012 3:01 AM
+1 ;;3.0;IMAGING;**138**;Mar 19, 2002;Build 5380;Sep 03, 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 ;
+19 ; Adapted from MAGVRS52 [RPC: MAG DICOM CHECK AE TITLE]
+20 ;
+21 ;##### GET DICOM AE SECURITY MATRIX (#2006.9192) Data for input AE TITLE
+22 ; RPC: MAG DICOM GET AE ENTRY
+23 ;
AENAME(OUT,APPNAME,LOCATION) ;
+1 ; Returns AE Title and Security Matrix information for a given AE Title and Location
+2 NEW AEIEN,AEINST,MATCH,MSEP,I,LOCIEN,OSEP,STATION,SERVTYPE
+3 IF $GET(APPNAME)=""
SET OUT(1)="-1,No Application Name specified"
QUIT
+4 IF $GET(LOCATION)=""
SET OUT(1)="-3,No Location specified"
QUIT
+5 SET AEIEN=0
SET MATCH=0
SET I=1
SET OSEP="`"
SET MSEP="|"
SET SERVTYPE="^"
+6 ; Loop through all entries - match on AE Instance name and Location
+7 FOR
SET AEIEN=$ORDER(^MAGV(2006.9192,AEIEN))
if (AEIEN="")!(+AEIEN=0)
QUIT
Begin DoDot:1
+8 SET AEINST=$GET(^MAGV(2006.9192,AEIEN,0))
+9 ; Pointer to INSTITUTION file (#4)
SET LOCIEN=$PIECE(AEINST,U,3)
+10 ; IA #2171
if LOCIEN=""
QUIT
SET STATION=$$STA^XUAF4(LOCIEN)
+11 IF (LOCATION=STATION)&(($PIECE(AEINST,U,1))=APPNAME)
Begin DoDot:2
+12 ; If 1st match write all AE Instance info and Service Role
+13 IF MATCH=0
DO AEINST^MAGVRS52(.OUT,AEIEN,AEINST,LOCATION)
SET OUT(1)=OUT(1)_"SERVICE MESSAGE="
+14 SET I=I+1
+15 SET MATCH=MATCH+1
+16 ; Add Services and Roles to output
+17 DO AESECMX^MAGVRS52(.OUT,AEIEN)
+18 ;--- Add N-Response Delay (#13) in seconds, N-Response Retries (#14) *79.
+19 SET OUT(1)=OUT(1)_OSEP_(60*$$GET1^DIQ(2006.9192,AEIEN,13,"I"))
+20 SET OUT(1)=OUT(1)_OSEP_$$GET1^DIQ(2006.9192,AEIEN,14,"I")
End DoDot:2
+21 QUIT
End DoDot:1
+22 IF MATCH=0
SET OUT(1)="-2,No entry for Application Name """_APPNAME_""" at location """_LOCATION_"""."
+23 QUIT
AENTRYLC(OUT,SERVICE,ROLE,LOCATION) ; RPC = MAG DICOM GET AE ENTRY LOC
+1 ; The RPC will return the AE SEC MX Entry with matching provided service, role, and location fields
+2 NEW DROLE,DSERVICE,IEN,DSRIEN,DSR,AEDATA,OSEP
+3 SET OSEP=$$OUTSEP
SET IEN=0
SET OUT(1)=""
+4 IF $GET(LOCATION)=""
SET OUT(1)="-2"_OSEP_"No LOCATION provided."
QUIT
+5 IF $GET(SERVICE)=""
SET OUT(1)="-2"_OSEP_"No SERVICE provided."
QUIT
+6 IF $GET(ROLE)=""
SET OUT(1)="-2"_OSEP_"No ROLE provided."
QUIT
+7 FOR
SET IEN=$ORDER(^MAGV(2006.9192,IEN))
if (+IEN=0)!(IEN="")!(OUT(1)'="")
QUIT
Begin DoDot:1
+8 SET AEDATA=$GET(^MAGV(2006.9192,IEN,0))
+9 IF LOCATION'=$PIECE(AEDATA,U,3)
QUIT
+10 NEW IENS
+11 SET DSRIEN=0
+12 FOR
SET DSRIEN=$ORDER(^MAGV(2006.9192,IEN,3,DSRIEN))
if (+DSRIEN=0)!(DSRIEN="")!(OUT(1)'="")
QUIT
Begin DoDot:2
+13 SET IENS=DSRIEN_","_IEN_","
+14 SET DSERVICE=$$GET1^DIQ(2006.919212,IENS,.01)
+15 SET DROLE=$$GET1^DIQ(2006.919212,IENS,1)
+16 IF (SERVICE=DSERVICE)&(ROLE=DROLE)
DO AENTRYLD(IEN)
+17 QUIT
End DoDot:2
+18 QUIT
End DoDot:1
+19 if OUT(1)=""
SET OUT(1)="-1"_OSEP_"No title for """_SERVICE_""", """_ROLE_""" at location """_LOCATION_"""."
+20 QUIT
+21 ;
+22 ;+++++ Entry point from above, which has chosen the entry to process.
+23 ;
AENTRYLD(AEIEN) ;
+1 SET AEINST=$GET(^MAGV(2006.9192,AEIEN,0))
+2 DO AEINST^MAGVRS52(.OUT,AEIEN,AEINST,LOCATION)
SET OUT(1)=OUT(1)_"SERVICE MESSAGE="
+3 ; Add Services and Roles to output
+4 DO AESECMX^MAGVRS52(.OUT,AEIEN)
+5 ;--- Add N-Response Delay (#13) in seconds, N-Response Retries (#14) *79.
+6 SET OUT(1)=OUT(1)_OSEP_(60*$$GET1^DIQ(2006.9192,AEIEN,13,"I"))
+7 SET OUT(1)=OUT(1)_OSEP_$$GET1^DIQ(2006.9192,AEIEN,14,"I")
+8 QUIT
+9 ;--- Set separator values.
+10 ;
OUTSEP() ; Separator for output data ie. NAME`DOB
+1 QUIT "`"
MULTISEP() ; Name value separator for multiple values ie. REJECT=1|WARNING=1
+1 QUIT "|"
SRSEP() ; Service and Role Separator ie. C-Store^SCU^C-Move^SCP
+1 QUIT "^"
+2 ;
+3 ; MAGVCAE