MAGVDGWP ;WOIFO/NST/RRB - Retrieve DGW settings ; 09 Jul 2012 2:53 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
;
;***** Return list of Instruments in DGW from DICOM GATEWAY INSTRUMENT DICTIONARY file (#2006.911)
; RPC: MAGV DGW INSTRUMENT LIST
;
; Input Parameters
; ================
; HOSTNAME - Host name;
; If HOSTNAME is blank all setting will be returned
;
; Return Values
; =============
; if error found during execution
; MAGRY(0) = "-1^Error getting instrument list"
; if success
; MAGRY(0) = "0^#CNT" - where #CNT is a number of records returned
; MAGRY(1) = "HOSTNAME^DATETIME^NICKNAME^DESCRIPTION^SERVICE^PORT^SITE ID^SITE^MACHINE ID"
; MAGRY(2..n) = "^" delimited string with values of fields listed in MAGRY(1)
;
Q
;
INSTRMNT(MAGRY,HOSTNAME) ;RPC [MAGV DGW INSTRUMENT LIST]
N OUT,I,CNT,MAGNIEN,MAGNHOST,MAGNDATE
N X
I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
E S X="ERR^MAGGTERR",@^%ZOSF("TRAP")
S MAGRY(0)="-1^Error getting instrument list"
S HOSTNAME=$TR(HOSTNAME,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
D LIST^DIC(2006.911,"","@;.01;2","PI","","","","","","","OUT")
I $D(OUT("DIERR")) Q ; Error getting the list
S I=0
S CNT=1
F S I=$O(OUT("DILIST",I)) Q:'+I D
. S X=OUT("DILIST",I,0)
. S MAGNIEN=$P(X,"^",1)
. S MAGNHOST=$P(X,"^",2)
. S MAGNDATE=$P(X,"^",3)
. I HOSTNAME'="" Q:HOSTNAME'=MAGNHOST ; Check if HOSTNAME parameter
. D GETINSTR(.MAGRY,.CNT,MAGNIEN,MAGNHOST,MAGNDATE)
. Q
S MAGRY(0)="0^"_(CNT-1)
S MAGRY(1)="HOSTNAME^DATETIME^NICKNAME^DESCRIPTION^SERVICE^PORT^SITE ID^SITE^MACHINE ID"
Q
;
GETINSTR(MAGRY,CNT,MAGNIEN,MAGNHOST,MAGNDATE) ; Get list of instruments for a hostname
;
N OUT,MSG,I,STATION,SITEIEN
D LIST^DIC(2006.9112,","_MAGNIEN_",","@;.01;2;3I;4;5I;5;6","P","","","","","","","OUT","MSG")
I $D(MSG("DIERR")) Q ; Error getting the list
S I=0
F S I=$O(OUT("DILIST",I)) Q:'+I D
. S CNT=CNT+1
. ; Get site IEN
. S SITEIEN=$P(OUT("DILIST",I,0),"^",6)
. ; Get station based on site IEN
. S STATION=$$STA^XUAF4(SITEIEN) ; IA #2171 Get Station Number
. ; Set station into return array
. S $P(OUT("DILIST",I,0),"^",6)=STATION
. S MAGRY(CNT)=MAGNHOST_"^"_MAGNDATE_"^"_$P(OUT("DILIST",I,0),"^",2,8)
. Q
Q
;
;***** Return list of Modalities in DGW from DICOM GATEWAY MODALITY DICTIONARY file (#2006.912)
; RPC: MAGV DGW MODALITY LIST
;
; Input Parameters
; ================
; HOSTNAME - Host name;
; If HOSTNAME is blank all setting will be returned
;
; Return Values
; =============
; if error found during execution
; MAGRY(0) = "-1^Error getting modality list"
; if success
; MAGRY(0) = "0^#CNT" - where #CNT is a number of records returned
; MAGRY(1) = "HOSTNAME^DATETIME^MANUFACTURER^MODEL^MODALITY^IMAGING SERVICE^ACTIVE"
; MAGRY(2..n) = "^" delimited string with values of fields listed in MAGRY(1)
;
MODALITY(MAGRY,HOSTNAME) ;RPC [MAGV DGW MODALITY LIST]
N OUT,I,CNT,MAGNIEN,MAGNHOST,MAGNDATE
N X
I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
E S X="ERR^MAGGTERR",@^%ZOSF("TRAP")
S MAGRY(0)="-1^Error getting modality list"
S HOSTNAME=$TR(HOSTNAME,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
D LIST^DIC(2006.912,"","@;.01;2","PI","","","","","","","OUT")
I $D(OUT("DIERR")) Q ; Error getting the list
S I=0
S CNT=1
F S I=$O(OUT("DILIST",I)) Q:'+I D
. S X=OUT("DILIST",I,0)
. S MAGNIEN=$P(X,"^",1)
. S MAGNHOST=$P(X,"^",2)
. S MAGNDATE=$P(X,"^",3)
. I HOSTNAME'="" Q:HOSTNAME'=MAGNHOST ; Check if HOSTNAME parameter
. D GETMODAL(.MAGRY,.CNT,MAGNIEN,MAGNHOST,MAGNDATE)
. Q
S MAGRY(0)="0^"_(CNT-1)
S MAGRY(1)="HOSTNAME^DATETIME^MANUFACTURER^MODEL^MODALITY^IMAGING SERVICE^ACTIVE"
Q
;
GETMODAL(MAGRY,CNT,MAGNIEN,MAGNHOST,MAGNDATE) ; Get list of modalities for a hostname
;
N OUT,MSG,I
D LIST^DIC(2006.9122,","_MAGNIEN_",","@;.01;2;3;8;9","PI","","","","","","","OUT","MSG")
I $D(MSG("DIERR")) Q ; Error getting the list
S I=0
F S I=$O(OUT("DILIST",I)) Q:'+I D
. S CNT=CNT+1
. S MAGRY(CNT)=MAGNHOST_"^"_MAGNDATE_"^"_$P(OUT("DILIST",I,0),"^",2,7)
. Q
Q
;
;***** Return list of UID
; from DICOM UID SPECIFIC ACTION file (#2006.539)
; RPC: MAGV DGW ACTION UID LIST
;
; Input Parameters
; ================
; MAGTYPE - Type (e.g. "SOP Class")
; MAGSUBT - Subtype (e.g. "Storage")
; MAGACT - Action Type (e.g. "Storage SCP")
;
; Return Values
; =============
; if error found during execution
; MAGRY(0) = "-1^Error getting actions list"
; if success
; MAGRY(0) = "0^#CNT" - where #CNT is a number of records returned
; MAGRY(1) = "UID^DESCRIPTION^ACTION CODE^ACTION COMMENT"
; MAGRY(2..n) = "^" delimited string with values of fields listed in MAGRY(1)
;
ACTUIDS(MAGRY,MAGTYPE,MAGSUBT,MAGACT) ;RPC [MAGV DGW ACTION UID LIST]
I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
E S X="ERR^MAGGTERR",@^%ZOSF("TRAP")
N OUT,OUT2,MAGA,IEN,MAGX,CNT
I (MAGTYPE="")!(MAGSUBT="")!(MAGACT="") S MAGRY(0)="-1^Blank parameters" Q
;
S MAGRY(0)="-1^Error getting action UID list"
;
S MAGA(1)=MAGTYPE ;"SOP Class"
S MAGA(2)=MAGSUBT ;"Storage"
D FIND^DIC(2006.539,"","@;.01;2;","PQX",.MAGA,"*","D","","","OUT")
I $D(OUT("DIERR")) Q ; Error getting the list
S I=0
S CNT=1
F S I=$O(OUT("DILIST",I)) Q:'+I D
. S MAGX=OUT("DILIST",I,0)
. S IEN=$P(MAGX,"^",1)
. D FIND^DIC(2006.5391,","_IEN_",","@;2;3","PQX",MAGACT,"*","B","","","OUT2")
. I '$D(OUT2("DILIST","1",0)) Q
. S CNT=CNT+1
. S MAGRY(CNT)=$P(MAGX,"^",2,3)_"^"_$P(OUT2("DILIST","1",0),"^",2,3)
. Q
S MAGRY(0)="0^"_(CNT-1)
S MAGRY(1)="UID^DESCRIPTION^ACTION CODE^ACTION COMMENT"
Q
;
;***** Update DICOM GATEWAY INSTRUMENT DICTIONARY file (#2006.911)
; from DICOM Gateway file (#2006.581)
; RPC: MAGV DICOM SET INSTRUMENT LIST
;
; Input Parameters
; ================
; HOSTNAME - DICOM Gateway host name
; LOCATION - Identifies the institution where this DICOM Gateway computer resides
; MAGDATA - Data in DICOM Gateway file (#2006.581)
;
; Return Values
; =============
; if error found during execution
; MAGRY = "-1^Error updating list"
; if success
; MAGRY = 0
;
SETINSTR(MAGRY,HOSTNAME,LOCATION,MAGDATA) ; RPC [MAGV DICOM SET INSTRUMENT LIST]
I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGGTERR"
E S X="ERR^MAGGTERR",@^%ZOSF("TRAP")
N NOW,DA,DIK,D0,IENS,X,MAGNFDA,MAGNIEN,MAGNXE,ERR
S MAGRY="-1^Error updating file (#2006.911)"
I $G(HOSTNAME)="" S MAGRY="-1^No HostName provided." Q
I '$G(LOCATION) S MAGRY="-1^No location provided." Q
S HOSTNAME=$TR(HOSTNAME,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
S NOW=$$HTFM^XLFDT($H)
D FIND^DIC(2006.911,"","@;IX","PQX",HOSTNAME,"1","","","","X")
I $D(X("DILIST","1",0)) D
. S D0=$P(X("DILIST","1",0),"^",1)
. S DIK="^MAGDICOM(2006.911,"
. S DA=D0
. D ^DIK
. S MAGNIEN(1)=D0
. Q
S IENS="?+1,"
S MAGNFDA(2006.911,IENS,.01)=HOSTNAME
S MAGNFDA(2006.911,IENS,1)=LOCATION
S MAGNFDA(2006.911,IENS,2)=NOW
D UPDATE^DIE("SK","MAGNFDA","MAGNIEN","MAGNXE")
I $D(MAGNXE("DIERR","E")) Q ; MAGRY is set at the beginning
S D0=MAGNIEN(1)
S IENS="+1,"_D0_","
S I=""
S ERR=0
F S I=$O(MAGDATA(I)) Q:(I="")!ERR D
. K MAGNFDA,MAGNIEN,MAGNXE
. S X=MAGDATA(I)
. S MAGNFDA("2006.9112",IENS,".01")=$P(X,"^",1) ; "CR1"
. S MAGNFDA("2006.9112",IENS,"2")=$P(X,"^",2) ; "Test CR"
. S MAGNFDA("2006.9112",IENS,"3")=$P(X,"^",3) ;"RAD"
. S MAGNFDA("2006.9112",IENS,"4")=$P(X,"^",4) ;"60100"
. S MAGNFDA("2006.9112",IENS,"5")=$P(X,"^",5) ;"660"
. S MAGNFDA("2006.9112",IENS,"6")=$P(X,"^",6) ;""
. D UPDATE^DIE("SK","MAGNFDA","MAGNIEN","MAGNXE")
. I $D(MAGNXE("DIERR","E")) S ERR=1
. Q
I ERR Q ; MAGRY is set at the beginning
;
S MAGRY=0
Q
;
;***** Update DICOM GATEWAY MODALITY DICTIONARY file (#2006.912)
; from DICOM Gateway file (#2006.582)
; RPC: MAGV DICOM SET MODALITY LIST
;
; Input Parameters
; ================
; HOSTNAME - DICOM Gateway host name
; LOCATION - Identifies the institution where this DICOM Gateway computer resides
; MAGDATA - Data in DICOM Gateway file (#2006.582)
;
; Return Values
; =============
; if error found during execution
; MAGRY = "-1^Error updating list"
; if success
; MAGRY = "0"
;
SETMODAL(MAGRY,HOSTNAME,LOCATION,MAGDATA) ; RPC [MAGV DICOM SET MODALITY LIST]
I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGGTERR"
E S X="ERR^MAGGTERR",@^%ZOSF("TRAP")
N NOW,DA,DIK,D0,IENS,X,MAGNFDA,MAGNIEN,MAGNXE,ERR
S MAGRY="-1^Error updating file (#2006.912)"
I $G(HOSTNAME)="" S MAGRY="-1^No HostName provided." Q
I '$G(LOCATION) S MAGRY="-1^No location provided." Q
S HOSTNAME=$TR(HOSTNAME,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
S NOW=$$HTFM^XLFDT($H)
D FIND^DIC(2006.912,"","@;IX","PQX",HOSTNAME,"1","","","","X")
I $D(X("DILIST","1",0)) D
. S D0=$P(X("DILIST","1",0),"^",1)
. S DIK="^MAGDICOM(2006.912,"
. S DA=D0
. D ^DIK
. S MAGNIEN(1)=D0
. Q
S IENS="?+1,"
S MAGNFDA(2006.912,IENS,.01)=HOSTNAME
S MAGNFDA(2006.912,IENS,1)=LOCATION
S MAGNFDA(2006.912,IENS,2)=NOW
D UPDATE^DIE("SK","MAGNFDA","MAGNIEN","MAGNXE")
I $D(MAGNXE("DIERR","E")) Q ; MAGRY is set at the beginning
S D0=MAGNIEN(1)
S IENS="+1,"_D0_","
S I=""
S ERR=0
F S I=$O(MAGDATA(I)) Q:(I="")!ERR D
. K MAGNFDA,MAGNIEN,MAGNXE
. S X=MAGDATA(I)
. S MAGNFDA("2006.9122",IENS,".01")=$P(X,"^",1)
. S MAGNFDA("2006.9122",IENS,"2")=$P(X,"^",2)
. S MAGNFDA("2006.9122",IENS,"3")=$P(X,"^",3)
. S MAGNFDA("2006.9122",IENS,"4")=$P(X,"^",4)
. S MAGNFDA("2006.9122",IENS,"5")=$P(X,"^",5)
. S MAGNFDA("2006.9122",IENS,"6")=$P(X,"^",6)
. S MAGNFDA("2006.9122",IENS,"7")=$P(X,"^",7)
. S MAGNFDA("2006.9122",IENS,"8")=$P(X,"^",8)
. S MAGNFDA("2006.9122",IENS,"9")=$P(X,"^",9)
. D UPDATE^DIE("SK","MAGNFDA","MAGNIEN","MAGNXE")
. I $D(MAGNXE("DIERR","E")) S ERR=1
. Q
I ERR Q ; MAGRY is set at the beginning
;
S MAGRY=0
Q
;
;***** Return DGW email configuration entries from DICOM Gateway Mail (#2006.9191)
; RPC: MAGV GET DGW CONFIG
;
; Input Parameters
; ================
; HOSTNAME - Host name;
; If HOSTNAME error message will be returned
;
; Return Values
; =============
; if error found during execution
; MAGRY = "-1^Error message"
; if success
; MAGRY = HOSTNAME~MAILGROUP~POSTOFFICE~POSTPORT~IMPORTER~STATION NUMBER
;
GETGWCFG(MAGRY,HOSTNAME) ;RPC [MAGV GET DGW CONFIG]
N OUT,I,CNT,MAGNIEN,MAGNHOST,MAILGROUP,POSTOFFICE,POSTPORT,IMPORTER,SITEIEN,STATION
N X
I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
E S X="ERR^MAGGTERR",@^%ZOSF("TRAP")
S MAGRY="-1~Error getting DGW Config info"
I $G(HOSTNAME)="" S MAGRY="-1~No HostName provided" Q
S HOSTNAME=$TR(HOSTNAME,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
D LIST^DIC(2006.9191,"","@;.01;1;2;3;4;5","PI","","","","","","","OUT")
I $D(OUT("DIERR")) Q ; Error getting the list
S I=0
F S I=$O(OUT("DILIST",I)) Q:'+I D Q:HOSTNAME=MAGNHOST
. S X=OUT("DILIST",I,0)
. S MAGNIEN=$P(X,"^",1)
. S MAGNHOST=$P(X,"^",2)
. S MAILGROUP=$P(X,"^",3)
. S POSTOFFICE=$P(X,"^",4)
. S POSTPORT=$P(X,"^",5)
. S IMPORTER=$P(X,"^",6)
. S SITEIEN=$P(X,"^",7)
. S STATION=$$STA^XUAF4(SITEIEN) ; IA #2171 Get Station Number
. Q
I HOSTNAME'=MAGNHOST D Q ; Check if HOSTNAME parameter matches return
. S MAGRY="-1~HostName returned from DB,"_MAGNHOST_", doesn't match request."
. Q
;
S MAGRY="0~"_HOSTNAME_"~"_MAILGROUP_"~"_POSTOFFICE_"~"_POSTPORT_"~"_IMPORTER_"~"_STATION
Q
;
;
;***** Set DGW email configuration entries into DICOM Gateway Mail (#2006.9191)
; RPC: MAGV SET DGW CONFIG
;
; Input Parameters
; ================
; HOSTNAME
; MAILGROUP
; POSTOFFICE
; POSTPORT
; [IMPORTER]
; LOCATION
; If any of the input parameters are missing an error message will be returned.
;
; Return Values
; =============
; 0 - Success
; -1 - Error
;
SETGWCFG(MAGRY,HOSTNAME,MAILGROUP,POSTOFFICE,POSTPORT,IMPORTER,LOCATION) ; RPC [MAGV SET DGW CONFIG]
I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGGTERR"
E S X="ERR^MAGGTERR",@^%ZOSF("TRAP")
N NOW,IENS,X,MAGNFDA,MAGNXE
S MAGRY="-1~Error updating file (#2006.9191)"
I $G(HOSTNAME)="" S MAGRY="-1~No HostName provided." Q
I $G(MAILGROUP)="" S MAGRY="-1~No MailGroup provided." Q
I $G(POSTOFFICE)="" S MAGRY="-1~No PostOffice provided." Q
I $G(POSTPORT)="" S MAGRY="-1~No PostPort provided." Q
I $G(LOCATION)="" S MAGRY="-1~No Location provided." Q
S HOSTNAME=$TR(HOSTNAME,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
S NOW=$$HTFM^XLFDT($H)
S IENS="?+1,"
S MAGNFDA(2006.9191,IENS,.01)=HOSTNAME
S MAGNFDA(2006.9191,IENS,1)=MAILGROUP
S MAGNFDA(2006.9191,IENS,2)=POSTOFFICE
S MAGNFDA(2006.9191,IENS,3)=POSTPORT
S MAGNFDA(2006.9191,IENS,4)=$G(IMPORTER)
S MAGNFDA(2006.9191,IENS,5)=LOCATION
D UPDATE^DIE("SK","MAGNFDA","","MAGNXE")
I $D(MAGNXE("DIERR","E")) Q ; MAGRY set at the beginning
S MAGRY="0~DGW Config info update ok"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGVDGWP 14342 printed Dec 13, 2024@02:09:46 Page 2
MAGVDGWP ;WOIFO/NST/RRB - Retrieve DGW settings ; 09 Jul 2012 2:53 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 ;
+19 ;***** Return list of Instruments in DGW from DICOM GATEWAY INSTRUMENT DICTIONARY file (#2006.911)
+20 ; RPC: MAGV DGW INSTRUMENT LIST
+21 ;
+22 ; Input Parameters
+23 ; ================
+24 ; HOSTNAME - Host name;
+25 ; If HOSTNAME is blank all setting will be returned
+26 ;
+27 ; Return Values
+28 ; =============
+29 ; if error found during execution
+30 ; MAGRY(0) = "-1^Error getting instrument list"
+31 ; if success
+32 ; MAGRY(0) = "0^#CNT" - where #CNT is a number of records returned
+33 ; MAGRY(1) = "HOSTNAME^DATETIME^NICKNAME^DESCRIPTION^SERVICE^PORT^SITE ID^SITE^MACHINE ID"
+34 ; MAGRY(2..n) = "^" delimited string with values of fields listed in MAGRY(1)
+35 ;
+36 QUIT
+37 ;
INSTRMNT(MAGRY,HOSTNAME) ;RPC [MAGV DGW INSTRUMENT LIST]
+1 NEW OUT,I,CNT,MAGNIEN,MAGNHOST,MAGNDATE
+2 NEW X
+3 IF $$NEWERR^%ZTER
NEW $ETRAP,$ESTACK
SET $ETRAP="D ERRA^MAGGTERR"
+4 IF '$TEST
SET X="ERR^MAGGTERR"
SET @^%ZOSF("TRAP")
+5 SET MAGRY(0)="-1^Error getting instrument list"
+6 SET HOSTNAME=$TRANSLATE(HOSTNAME,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
+7 DO LIST^DIC(2006.911,"","@;.01;2","PI","","","","","","","OUT")
+8 ; Error getting the list
IF $DATA(OUT("DIERR"))
QUIT
+9 SET I=0
+10 SET CNT=1
+11 FOR
SET I=$ORDER(OUT("DILIST",I))
if '+I
QUIT
Begin DoDot:1
+12 SET X=OUT("DILIST",I,0)
+13 SET MAGNIEN=$PIECE(X,"^",1)
+14 SET MAGNHOST=$PIECE(X,"^",2)
+15 SET MAGNDATE=$PIECE(X,"^",3)
+16 ; Check if HOSTNAME parameter
IF HOSTNAME'=""
if HOSTNAME'=MAGNHOST
QUIT
+17 DO GETINSTR(.MAGRY,.CNT,MAGNIEN,MAGNHOST,MAGNDATE)
+18 QUIT
End DoDot:1
+19 SET MAGRY(0)="0^"_(CNT-1)
+20 SET MAGRY(1)="HOSTNAME^DATETIME^NICKNAME^DESCRIPTION^SERVICE^PORT^SITE ID^SITE^MACHINE ID"
+21 QUIT
+22 ;
GETINSTR(MAGRY,CNT,MAGNIEN,MAGNHOST,MAGNDATE) ; Get list of instruments for a hostname
+1 ;
+2 NEW OUT,MSG,I,STATION,SITEIEN
+3 DO LIST^DIC(2006.9112,","_MAGNIEN_",","@;.01;2;3I;4;5I;5;6","P","","","","","","","OUT","MSG")
+4 ; Error getting the list
IF $DATA(MSG("DIERR"))
QUIT
+5 SET I=0
+6 FOR
SET I=$ORDER(OUT("DILIST",I))
if '+I
QUIT
Begin DoDot:1
+7 SET CNT=CNT+1
+8 ; Get site IEN
+9 SET SITEIEN=$PIECE(OUT("DILIST",I,0),"^",6)
+10 ; Get station based on site IEN
+11 ; IA #2171 Get Station Number
SET STATION=$$STA^XUAF4(SITEIEN)
+12 ; Set station into return array
+13 SET $PIECE(OUT("DILIST",I,0),"^",6)=STATION
+14 SET MAGRY(CNT)=MAGNHOST_"^"_MAGNDATE_"^"_$PIECE(OUT("DILIST",I,0),"^",2,8)
+15 QUIT
End DoDot:1
+16 QUIT
+17 ;
+18 ;***** Return list of Modalities in DGW from DICOM GATEWAY MODALITY DICTIONARY file (#2006.912)
+19 ; RPC: MAGV DGW MODALITY LIST
+20 ;
+21 ; Input Parameters
+22 ; ================
+23 ; HOSTNAME - Host name;
+24 ; If HOSTNAME is blank all setting will be returned
+25 ;
+26 ; Return Values
+27 ; =============
+28 ; if error found during execution
+29 ; MAGRY(0) = "-1^Error getting modality list"
+30 ; if success
+31 ; MAGRY(0) = "0^#CNT" - where #CNT is a number of records returned
+32 ; MAGRY(1) = "HOSTNAME^DATETIME^MANUFACTURER^MODEL^MODALITY^IMAGING SERVICE^ACTIVE"
+33 ; MAGRY(2..n) = "^" delimited string with values of fields listed in MAGRY(1)
+34 ;
MODALITY(MAGRY,HOSTNAME) ;RPC [MAGV DGW MODALITY LIST]
+1 NEW OUT,I,CNT,MAGNIEN,MAGNHOST,MAGNDATE
+2 NEW X
+3 IF $$NEWERR^%ZTER
NEW $ETRAP,$ESTACK
SET $ETRAP="D ERRA^MAGGTERR"
+4 IF '$TEST
SET X="ERR^MAGGTERR"
SET @^%ZOSF("TRAP")
+5 SET MAGRY(0)="-1^Error getting modality list"
+6 SET HOSTNAME=$TRANSLATE(HOSTNAME,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
+7 DO LIST^DIC(2006.912,"","@;.01;2","PI","","","","","","","OUT")
+8 ; Error getting the list
IF $DATA(OUT("DIERR"))
QUIT
+9 SET I=0
+10 SET CNT=1
+11 FOR
SET I=$ORDER(OUT("DILIST",I))
if '+I
QUIT
Begin DoDot:1
+12 SET X=OUT("DILIST",I,0)
+13 SET MAGNIEN=$PIECE(X,"^",1)
+14 SET MAGNHOST=$PIECE(X,"^",2)
+15 SET MAGNDATE=$PIECE(X,"^",3)
+16 ; Check if HOSTNAME parameter
IF HOSTNAME'=""
if HOSTNAME'=MAGNHOST
QUIT
+17 DO GETMODAL(.MAGRY,.CNT,MAGNIEN,MAGNHOST,MAGNDATE)
+18 QUIT
End DoDot:1
+19 SET MAGRY(0)="0^"_(CNT-1)
+20 SET MAGRY(1)="HOSTNAME^DATETIME^MANUFACTURER^MODEL^MODALITY^IMAGING SERVICE^ACTIVE"
+21 QUIT
+22 ;
GETMODAL(MAGRY,CNT,MAGNIEN,MAGNHOST,MAGNDATE) ; Get list of modalities for a hostname
+1 ;
+2 NEW OUT,MSG,I
+3 DO LIST^DIC(2006.9122,","_MAGNIEN_",","@;.01;2;3;8;9","PI","","","","","","","OUT","MSG")
+4 ; Error getting the list
IF $DATA(MSG("DIERR"))
QUIT
+5 SET I=0
+6 FOR
SET I=$ORDER(OUT("DILIST",I))
if '+I
QUIT
Begin DoDot:1
+7 SET CNT=CNT+1
+8 SET MAGRY(CNT)=MAGNHOST_"^"_MAGNDATE_"^"_$PIECE(OUT("DILIST",I,0),"^",2,7)
+9 QUIT
End DoDot:1
+10 QUIT
+11 ;
+12 ;***** Return list of UID
+13 ; from DICOM UID SPECIFIC ACTION file (#2006.539)
+14 ; RPC: MAGV DGW ACTION UID LIST
+15 ;
+16 ; Input Parameters
+17 ; ================
+18 ; MAGTYPE - Type (e.g. "SOP Class")
+19 ; MAGSUBT - Subtype (e.g. "Storage")
+20 ; MAGACT - Action Type (e.g. "Storage SCP")
+21 ;
+22 ; Return Values
+23 ; =============
+24 ; if error found during execution
+25 ; MAGRY(0) = "-1^Error getting actions list"
+26 ; if success
+27 ; MAGRY(0) = "0^#CNT" - where #CNT is a number of records returned
+28 ; MAGRY(1) = "UID^DESCRIPTION^ACTION CODE^ACTION COMMENT"
+29 ; MAGRY(2..n) = "^" delimited string with values of fields listed in MAGRY(1)
+30 ;
ACTUIDS(MAGRY,MAGTYPE,MAGSUBT,MAGACT) ;RPC [MAGV DGW ACTION UID LIST]
+1 IF $$NEWERR^%ZTER
NEW $ETRAP,$ESTACK
SET $ETRAP="D ERRA^MAGGTERR"
+2 IF '$TEST
SET X="ERR^MAGGTERR"
SET @^%ZOSF("TRAP")
+3 NEW OUT,OUT2,MAGA,IEN,MAGX,CNT
+4 IF (MAGTYPE="")!(MAGSUBT="")!(MAGACT="")
SET MAGRY(0)="-1^Blank parameters"
QUIT
+5 ;
+6 SET MAGRY(0)="-1^Error getting action UID list"
+7 ;
+8 ;"SOP Class"
SET MAGA(1)=MAGTYPE
+9 ;"Storage"
SET MAGA(2)=MAGSUBT
+10 DO FIND^DIC(2006.539,"","@;.01;2;","PQX",.MAGA,"*","D","","","OUT")
+11 ; Error getting the list
IF $DATA(OUT("DIERR"))
QUIT
+12 SET I=0
+13 SET CNT=1
+14 FOR
SET I=$ORDER(OUT("DILIST",I))
if '+I
QUIT
Begin DoDot:1
+15 SET MAGX=OUT("DILIST",I,0)
+16 SET IEN=$PIECE(MAGX,"^",1)
+17 DO FIND^DIC(2006.5391,","_IEN_",","@;2;3","PQX",MAGACT,"*","B","","","OUT2")
+18 IF '$DATA(OUT2("DILIST","1",0))
QUIT
+19 SET CNT=CNT+1
+20 SET MAGRY(CNT)=$PIECE(MAGX,"^",2,3)_"^"_$PIECE(OUT2("DILIST","1",0),"^",2,3)
+21 QUIT
End DoDot:1
+22 SET MAGRY(0)="0^"_(CNT-1)
+23 SET MAGRY(1)="UID^DESCRIPTION^ACTION CODE^ACTION COMMENT"
+24 QUIT
+25 ;
+26 ;***** Update DICOM GATEWAY INSTRUMENT DICTIONARY file (#2006.911)
+27 ; from DICOM Gateway file (#2006.581)
+28 ; RPC: MAGV DICOM SET INSTRUMENT LIST
+29 ;
+30 ; Input Parameters
+31 ; ================
+32 ; HOSTNAME - DICOM Gateway host name
+33 ; LOCATION - Identifies the institution where this DICOM Gateway computer resides
+34 ; MAGDATA - Data in DICOM Gateway file (#2006.581)
+35 ;
+36 ; Return Values
+37 ; =============
+38 ; if error found during execution
+39 ; MAGRY = "-1^Error updating list"
+40 ; if success
+41 ; MAGRY = 0
+42 ;
SETINSTR(MAGRY,HOSTNAME,LOCATION,MAGDATA) ; RPC [MAGV DICOM SET INSTRUMENT LIST]
+1 IF $$NEWERR^%ZTER
NEW $ETRAP,$ESTACK
SET $ETRAP="D ERR^MAGGTERR"
+2 IF '$TEST
SET X="ERR^MAGGTERR"
SET @^%ZOSF("TRAP")
+3 NEW NOW,DA,DIK,D0,IENS,X,MAGNFDA,MAGNIEN,MAGNXE,ERR
+4 SET MAGRY="-1^Error updating file (#2006.911)"
+5 IF $GET(HOSTNAME)=""
SET MAGRY="-1^No HostName provided."
QUIT
+6 IF '$GET(LOCATION)
SET MAGRY="-1^No location provided."
QUIT
+7 SET HOSTNAME=$TRANSLATE(HOSTNAME,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
+8 SET NOW=$$HTFM^XLFDT($HOROLOG)
+9 DO FIND^DIC(2006.911,"","@;IX","PQX",HOSTNAME,"1","","","","X")
+10 IF $DATA(X("DILIST","1",0))
Begin DoDot:1
+11 SET D0=$PIECE(X("DILIST","1",0),"^",1)
+12 SET DIK="^MAGDICOM(2006.911,"
+13 SET DA=D0
+14 DO ^DIK
+15 SET MAGNIEN(1)=D0
+16 QUIT
End DoDot:1
+17 SET IENS="?+1,"
+18 SET MAGNFDA(2006.911,IENS,.01)=HOSTNAME
+19 SET MAGNFDA(2006.911,IENS,1)=LOCATION
+20 SET MAGNFDA(2006.911,IENS,2)=NOW
+21 DO UPDATE^DIE("SK","MAGNFDA","MAGNIEN","MAGNXE")
+22 ; MAGRY is set at the beginning
IF $DATA(MAGNXE("DIERR","E"))
QUIT
+23 SET D0=MAGNIEN(1)
+24 SET IENS="+1,"_D0_","
+25 SET I=""
+26 SET ERR=0
+27 FOR
SET I=$ORDER(MAGDATA(I))
if (I="")!ERR
QUIT
Begin DoDot:1
+28 KILL MAGNFDA,MAGNIEN,MAGNXE
+29 SET X=MAGDATA(I)
+30 ; "CR1"
SET MAGNFDA("2006.9112",IENS,".01")=$PIECE(X,"^",1)
+31 ; "Test CR"
SET MAGNFDA("2006.9112",IENS,"2")=$PIECE(X,"^",2)
+32 ;"RAD"
SET MAGNFDA("2006.9112",IENS,"3")=$PIECE(X,"^",3)
+33 ;"60100"
SET MAGNFDA("2006.9112",IENS,"4")=$PIECE(X,"^",4)
+34 ;"660"
SET MAGNFDA("2006.9112",IENS,"5")=$PIECE(X,"^",5)
+35 ;""
SET MAGNFDA("2006.9112",IENS,"6")=$PIECE(X,"^",6)
+36 DO UPDATE^DIE("SK","MAGNFDA","MAGNIEN","MAGNXE")
+37 IF $DATA(MAGNXE("DIERR","E"))
SET ERR=1
+38 QUIT
End DoDot:1
+39 ; MAGRY is set at the beginning
IF ERR
QUIT
+40 ;
+41 SET MAGRY=0
+42 QUIT
+43 ;
+44 ;***** Update DICOM GATEWAY MODALITY DICTIONARY file (#2006.912)
+45 ; from DICOM Gateway file (#2006.582)
+46 ; RPC: MAGV DICOM SET MODALITY LIST
+47 ;
+48 ; Input Parameters
+49 ; ================
+50 ; HOSTNAME - DICOM Gateway host name
+51 ; LOCATION - Identifies the institution where this DICOM Gateway computer resides
+52 ; MAGDATA - Data in DICOM Gateway file (#2006.582)
+53 ;
+54 ; Return Values
+55 ; =============
+56 ; if error found during execution
+57 ; MAGRY = "-1^Error updating list"
+58 ; if success
+59 ; MAGRY = "0"
+60 ;
SETMODAL(MAGRY,HOSTNAME,LOCATION,MAGDATA) ; RPC [MAGV DICOM SET MODALITY LIST]
+1 IF $$NEWERR^%ZTER
NEW $ETRAP,$ESTACK
SET $ETRAP="D ERR^MAGGTERR"
+2 IF '$TEST
SET X="ERR^MAGGTERR"
SET @^%ZOSF("TRAP")
+3 NEW NOW,DA,DIK,D0,IENS,X,MAGNFDA,MAGNIEN,MAGNXE,ERR
+4 SET MAGRY="-1^Error updating file (#2006.912)"
+5 IF $GET(HOSTNAME)=""
SET MAGRY="-1^No HostName provided."
QUIT
+6 IF '$GET(LOCATION)
SET MAGRY="-1^No location provided."
QUIT
+7 SET HOSTNAME=$TRANSLATE(HOSTNAME,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
+8 SET NOW=$$HTFM^XLFDT($HOROLOG)
+9 DO FIND^DIC(2006.912,"","@;IX","PQX",HOSTNAME,"1","","","","X")
+10 IF $DATA(X("DILIST","1",0))
Begin DoDot:1
+11 SET D0=$PIECE(X("DILIST","1",0),"^",1)
+12 SET DIK="^MAGDICOM(2006.912,"
+13 SET DA=D0
+14 DO ^DIK
+15 SET MAGNIEN(1)=D0
+16 QUIT
End DoDot:1
+17 SET IENS="?+1,"
+18 SET MAGNFDA(2006.912,IENS,.01)=HOSTNAME
+19 SET MAGNFDA(2006.912,IENS,1)=LOCATION
+20 SET MAGNFDA(2006.912,IENS,2)=NOW
+21 DO UPDATE^DIE("SK","MAGNFDA","MAGNIEN","MAGNXE")
+22 ; MAGRY is set at the beginning
IF $DATA(MAGNXE("DIERR","E"))
QUIT
+23 SET D0=MAGNIEN(1)
+24 SET IENS="+1,"_D0_","
+25 SET I=""
+26 SET ERR=0
+27 FOR
SET I=$ORDER(MAGDATA(I))
if (I="")!ERR
QUIT
Begin DoDot:1
+28 KILL MAGNFDA,MAGNIEN,MAGNXE
+29 SET X=MAGDATA(I)
+30 SET MAGNFDA("2006.9122",IENS,".01")=$PIECE(X,"^",1)
+31 SET MAGNFDA("2006.9122",IENS,"2")=$PIECE(X,"^",2)
+32 SET MAGNFDA("2006.9122",IENS,"3")=$PIECE(X,"^",3)
+33 SET MAGNFDA("2006.9122",IENS,"4")=$PIECE(X,"^",4)
+34 SET MAGNFDA("2006.9122",IENS,"5")=$PIECE(X,"^",5)
+35 SET MAGNFDA("2006.9122",IENS,"6")=$PIECE(X,"^",6)
+36 SET MAGNFDA("2006.9122",IENS,"7")=$PIECE(X,"^",7)
+37 SET MAGNFDA("2006.9122",IENS,"8")=$PIECE(X,"^",8)
+38 SET MAGNFDA("2006.9122",IENS,"9")=$PIECE(X,"^",9)
+39 DO UPDATE^DIE("SK","MAGNFDA","MAGNIEN","MAGNXE")
+40 IF $DATA(MAGNXE("DIERR","E"))
SET ERR=1
+41 QUIT
End DoDot:1
+42 ; MAGRY is set at the beginning
IF ERR
QUIT
+43 ;
+44 SET MAGRY=0
+45 QUIT
+46 ;
+47 ;***** Return DGW email configuration entries from DICOM Gateway Mail (#2006.9191)
+48 ; RPC: MAGV GET DGW CONFIG
+49 ;
+50 ; Input Parameters
+51 ; ================
+52 ; HOSTNAME - Host name;
+53 ; If HOSTNAME error message will be returned
+54 ;
+55 ; Return Values
+56 ; =============
+57 ; if error found during execution
+58 ; MAGRY = "-1^Error message"
+59 ; if success
+60 ; MAGRY = HOSTNAME~MAILGROUP~POSTOFFICE~POSTPORT~IMPORTER~STATION NUMBER
+61 ;
GETGWCFG(MAGRY,HOSTNAME) ;RPC [MAGV GET DGW CONFIG]
+1 NEW OUT,I,CNT,MAGNIEN,MAGNHOST,MAILGROUP,POSTOFFICE,POSTPORT,IMPORTER,SITEIEN,STATION
+2 NEW X
+3 IF $$NEWERR^%ZTER
NEW $ETRAP,$ESTACK
SET $ETRAP="D ERRA^MAGGTERR"
+4 IF '$TEST
SET X="ERR^MAGGTERR"
SET @^%ZOSF("TRAP")
+5 SET MAGRY="-1~Error getting DGW Config info"
+6 IF $GET(HOSTNAME)=""
SET MAGRY="-1~No HostName provided"
QUIT
+7 SET HOSTNAME=$TRANSLATE(HOSTNAME,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
+8 DO LIST^DIC(2006.9191,"","@;.01;1;2;3;4;5","PI","","","","","","","OUT")
+9 ; Error getting the list
IF $DATA(OUT("DIERR"))
QUIT
+10 SET I=0
+11 FOR
SET I=$ORDER(OUT("DILIST",I))
if '+I
QUIT
Begin DoDot:1
+12 SET X=OUT("DILIST",I,0)
+13 SET MAGNIEN=$PIECE(X,"^",1)
+14 SET MAGNHOST=$PIECE(X,"^",2)
+15 SET MAILGROUP=$PIECE(X,"^",3)
+16 SET POSTOFFICE=$PIECE(X,"^",4)
+17 SET POSTPORT=$PIECE(X,"^",5)
+18 SET IMPORTER=$PIECE(X,"^",6)
+19 SET SITEIEN=$PIECE(X,"^",7)
+20 ; IA #2171 Get Station Number
SET STATION=$$STA^XUAF4(SITEIEN)
+21 QUIT
End DoDot:1
if HOSTNAME=MAGNHOST
QUIT
+22 ; Check if HOSTNAME parameter matches return
IF HOSTNAME'=MAGNHOST
Begin DoDot:1
+23 SET MAGRY="-1~HostName returned from DB,"_MAGNHOST_", doesn't match request."
+24 QUIT
End DoDot:1
QUIT
+25 ;
+26 SET MAGRY="0~"_HOSTNAME_"~"_MAILGROUP_"~"_POSTOFFICE_"~"_POSTPORT_"~"_IMPORTER_"~"_STATION
+27 QUIT
+28 ;
+29 ;
+30 ;***** Set DGW email configuration entries into DICOM Gateway Mail (#2006.9191)
+31 ; RPC: MAGV SET DGW CONFIG
+32 ;
+33 ; Input Parameters
+34 ; ================
+35 ; HOSTNAME
+36 ; MAILGROUP
+37 ; POSTOFFICE
+38 ; POSTPORT
+39 ; [IMPORTER]
+40 ; LOCATION
+41 ; If any of the input parameters are missing an error message will be returned.
+42 ;
+43 ; Return Values
+44 ; =============
+45 ; 0 - Success
+46 ; -1 - Error
+47 ;
SETGWCFG(MAGRY,HOSTNAME,MAILGROUP,POSTOFFICE,POSTPORT,IMPORTER,LOCATION) ; RPC [MAGV SET DGW CONFIG]
+1 IF $$NEWERR^%ZTER
NEW $ETRAP,$ESTACK
SET $ETRAP="D ERR^MAGGTERR"
+2 IF '$TEST
SET X="ERR^MAGGTERR"
SET @^%ZOSF("TRAP")
+3 NEW NOW,IENS,X,MAGNFDA,MAGNXE
+4 SET MAGRY="-1~Error updating file (#2006.9191)"
+5 IF $GET(HOSTNAME)=""
SET MAGRY="-1~No HostName provided."
QUIT
+6 IF $GET(MAILGROUP)=""
SET MAGRY="-1~No MailGroup provided."
QUIT
+7 IF $GET(POSTOFFICE)=""
SET MAGRY="-1~No PostOffice provided."
QUIT
+8 IF $GET(POSTPORT)=""
SET MAGRY="-1~No PostPort provided."
QUIT
+9 IF $GET(LOCATION)=""
SET MAGRY="-1~No Location provided."
QUIT
+10 SET HOSTNAME=$TRANSLATE(HOSTNAME,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
+11 SET NOW=$$HTFM^XLFDT($HOROLOG)
+12 SET IENS="?+1,"
+13 SET MAGNFDA(2006.9191,IENS,.01)=HOSTNAME
+14 SET MAGNFDA(2006.9191,IENS,1)=MAILGROUP
+15 SET MAGNFDA(2006.9191,IENS,2)=POSTOFFICE
+16 SET MAGNFDA(2006.9191,IENS,3)=POSTPORT
+17 SET MAGNFDA(2006.9191,IENS,4)=$GET(IMPORTER)
+18 SET MAGNFDA(2006.9191,IENS,5)=LOCATION
+19 DO UPDATE^DIE("SK","MAGNFDA","","MAGNXE")
+20 ; MAGRY set at the beginning
IF $DATA(MAGNXE("DIERR","E"))
QUIT
+21 SET MAGRY="0~DGW Config info update ok"
+22 QUIT