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

MAGVRS52.m

Go to the documentation of this file.
  1. MAGVRS52 ;WOIFO/EdM/DAC/NST/JSL - Imaging RPCs ,156for Query/Retrieve ; 30 Jan 2015 3:05 PM
  1. ;;3.0;IMAGING;**118,145,138,156**;Mar 19, 2002;Build 10;Jan 3, 2015
  1. ;; Per VHA Directive 2004-038, this routine should not be modified.
  1. ;; +---------------------------------------------------------------+
  1. ;; | Property of the US Government. |
  1. ;; | No permission to copy or redistribute this software is given. |
  1. ;; | Use of unreleased versions of this software requires the user |
  1. ;; | to execute a written test agreement with the VistA Imaging |
  1. ;; | Development Office of the Department of Veterans Affairs, |
  1. ;; | telephone (301) 734-0100. |
  1. ;; | The Food and Drug Administration classifies this software as |
  1. ;; | a medical device. As such, it may not be changed in any way. |
  1. ;; | Modifications to this software may result in an adulterated |
  1. ;; | medical device under 21CFR820, the use of which is considered |
  1. ;; | to be a violation of US Federal Statutes. |
  1. ;; +---------------------------------------------------------------+
  1. ;;
  1. Q
  1. ;
  1. OUTSEP() ; Separator for output data ie. NAME`DOB
  1. Q "`"
  1. MULTISEP() ; Name value separator for multiple values ie. REJECT=1|WARNING=1
  1. Q "|"
  1. SRSEP() ; Service and Role Separator ie. C-Store^SCU^C-Move^SCP
  1. Q "^"
  1. ;
  1. AETITLE(OUT,RTITLE,LOCATION) ; MAG DICOM CHECK AE TITLE RPC
  1. ; Returns AE Title and Security Matrix information for a given AE Title and Location
  1. N AEIEN,AEINST,MATCH,MSEP,I,LOCIEN,OSEP,STATION,SERVTYPE
  1. I $G(RTITLE)="" S OUT(1)="-1,No AE Title specified" Q
  1. I $G(LOCATION)="" S OUT(1)="-3,No Location specified" Q
  1. S AEIEN=0,MATCH=0,I=1,OSEP="`",MSEP="|",SERVTYPE="^"
  1. ; Loop through all entries - match on AE Instance name and Location
  1. F S AEIEN=$O(^MAGV(2006.9192,AEIEN)) Q:(AEIEN="")!(+AEIEN=0) D
  1. . S AEINST=$G(^MAGV(2006.9192,AEIEN,0))
  1. . S LOCIEN=$P(AEINST,U,3)
  1. . Q:LOCIEN=""
  1. . S STATION=$$STA^XUAF4(LOCIEN) ; P145 DAC
  1. . ; Perform case-insensitive DICOM AE Title check
  1. . S AEINST=$$UP^XLFSTR(AEINST) ; IA #10104
  1. . S RTITLE=$$UP^XLFSTR(RTITLE) ; IA #10104
  1. . I (LOCATION=STATION)&(($P(AEINST,U,6))=RTITLE) D ; P145 DAC
  1. . . ; If 1st match write all AE Instance info and Service Role
  1. . . I MATCH=0 D AEINST(.OUT,AEIEN,AEINST,LOCATION) S OUT(1)=OUT(1)_"SERVICE MESSAGE="
  1. . . S I=I+1
  1. . . S MATCH=MATCH+1
  1. . . ; Add Services and Roles to output
  1. . . D AESECMX(.OUT,AEIEN)
  1. . . ;--- Add N-Response Delay (#13) in seconds, N-Response Retries (#14) *79.
  1. . . S OUT(1)=OUT(1)_OSEP_(60*$$GET1^DIQ(2006.9192,AEIEN,13,"I"))
  1. . . S OUT(1)=OUT(1)_OSEP_(1*$$GET1^DIQ(2006.9192,AEIEN,14,"I"))
  1. . . Q
  1. . Q
  1. I MATCH=0 S OUT(1)="-2,No entry for AE Title """_RTITLE_""" at location """_LOCATION_"""."
  1. Q
  1. AEINST(OUT,AEIEN,AEINST,LOCATION) ; Retrieve AE Instance information
  1. N AENAME,AETITLE,FLAGDATA,IP,LABEL,PORT,OSEP,MSEP,MULTOUT,SUBIEN,SUBFILE,FIELD,FLAG,FORCER,ORIGIX,VALUE
  1. I $G(AEIEN)="" S OUT(1)="-4,DICOM AE Security Matrix IEN not defined" Q
  1. I $G(AEINST)="" S OUT(1)="-5,AE Instance data not defined" Q
  1. I $G(LOCATION)="" S OUT(1)="-6,LOCATION not defined" Q
  1. I $G(^MAGV(2006.9192,AEIEN,0))="" S OUT(1)="-7,DICOM AE Security Matrix entry not found" Q
  1. S OSEP=$$OUTSEP,MSEP=$$MULTISEP
  1. S AENAME=$P(AEINST,U,1)
  1. S AETITLE=$P(AEINST,U,2)
  1. S RTITLE=$P(AEINST,U,6)
  1. S IP=$P(AEINST,U,4)
  1. S PORT=$P(AEINST,U,5)
  1. S FORCER=$P(AEINST,U,8)
  1. S ORIGIX=$P(AEINST,U,9)
  1. S OUT(1)="0,"_AENAME_OSEP_RTITLE_OSEP_AETITLE_OSEP_LOCATION_OSEP_IP_OSEP_PORT_OSEP_FORCER_OSEP_ORIGIX_OSEP
  1. S FLAGDATA=$G(^MAGV(2006.9192,AEIEN,2))
  1. S FLAG=""
  1. F FIELD=6:1:11 D
  1. . S LABEL=$$GET1^DID(2006.9192,FIELD,,"LABEL")
  1. . S VALUE=$$GET1^DIQ(2006.9192,AEIEN,FIELD,"I")
  1. . I VALUE'="",FLAG'="" S FLAG=FLAG_MSEP
  1. . I VALUE'="" S FLAG=FLAG_LABEL_"="_VALUE
  1. . Q
  1. I FLAG'="" S OUT(1)=OUT(1)_FLAG
  1. S OUT(1)=OUT(1)_OSEP
  1. Q
  1. AESECMX(OUT,AEIEN) ; Retrieve Security Matrix information
  1. N SERVICE,ROLE,SRSEP,SRIEN,SRDATA,IENS
  1. S SRSEP=$$SRSEP
  1. I $G(AEIEN)="" S OUT(1)="-4,DICOM AE Security Matrix IEN not defined" Q
  1. I $G(^MAGV(2006.9192,AEIEN,0))="" S OUT(1)="-7,DICOM AE Security Matrix entry not found" Q
  1. S SRIEN=0
  1. F S SRIEN=$O(^MAGV(2006.9192,AEIEN,3,SRIEN)) Q:(SRIEN="")!(+SRIEN=0) D
  1. . S IENS=SRIEN_","_AEIEN_","
  1. . S SERVICE=$$GET1^DIQ(2006.919212,IENS,.01)
  1. . S ROLE=$$GET1^DIQ(2006.919212,IENS,1)
  1. . S SRDATA=$G(SRDATA)_SERVICE_SRSEP_ROLE_SRSEP
  1. . Q
  1. S OUT(1)=OUT(1)_$G(SRDATA)
  1. Q
  1. VATITLE(OUT,SERVICE,ROLE,LOCATION) ; RPC = MAG DICOM VISTA AE TITLE
  1. ; The RPC will return the first AE Title with matching provided service, role, and location fields
  1. N DROLE,DSERVICE,IEN,DSRIEN,DSR,AEDATA,OSEP
  1. S OSEP=$$OUTSEP,IEN=0,OUT=""
  1. I $G(LOCATION)="" S OUT="-2"_OSEP_"No LOCATION provided." Q
  1. I $G(SERVICE)="" S OUT="-2"_OSEP_"No SERVICE provided." Q
  1. I $G(ROLE)="" S OUT="-2"_OSEP_"No ROLE provided." Q
  1. F S IEN=$O(^MAGV(2006.9192,IEN)) Q:(+IEN=0)!(IEN="")!(OUT'="") D
  1. . S AEDATA=$G(^MAGV(2006.9192,IEN,0))
  1. . I LOCATION'=$P(AEDATA,U,3) Q
  1. . S DSRIEN=0
  1. . F S DSRIEN=$O(^MAGV(2006.9192,IEN,3,DSRIEN)) Q:(+DSRIEN=0)!(DSRIEN="")!(OUT'="") D
  1. . . S IENS=DSRIEN_","_IEN_","
  1. . . S DSERVICE=$$GET1^DIQ(2006.919212,IENS,.01)
  1. . . S DROLE=$$GET1^DIQ(2006.919212,IENS,1)
  1. . . I (SERVICE=DSERVICE)&(ROLE=DROLE) S OUT=0_OSEP_$P(AEDATA,U,6)
  1. . . Q
  1. . Q
  1. S:OUT="" OUT="-1"_OSEP_"No title for """_SERVICE_""", """_ROLE_""" at location """_LOCATION_"""."
  1. Q
  1. ;