MAGGTMC1 ;WOIFO/GEK - RPC Calls for Imaging/Medicine procedures ; [ 06/20/2001 08:57 ]
;;3.0;IMAGING;**59**;Nov 27, 2007;Build 20
;;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
FILE(MAGRY,DATA,MAGARR) ;RPC Call to File the Image pointer into
; the Procedure/Subspecialty and Proc/Subspec into Image file.
;
; DATA = DATETIME^PSIEN^DFN^MCIEN^PROCSTUB ; 6/19/97
; If MCIEN isn't sent, this will be added as new procedure
; MAGARR is array of image pointers
; IF PROCSTUB is 1 we JUST want New Medicine procedure stub IEN 6/19/97
; as the success i.e. MAGRY="IEN^Procdure Stub created" 6/19/97
IF $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGGTERR"
E S X="ERR^MAGGTERR",@^%ZOSF("TRAP")
N I,J,K,X,Y,Z,TIME,PSIEN,DFN,MAGPTR,MAGMCIEN,MCFILE,MAGOK,MAGERR,PROCSTUB
;
S X=$P(DATA,U,1),%DT="TS" D ^%DT S TIME=Y
S PSIEN=+$P(DATA,U,2)
S DFN=+$P(DATA,U,3)
S MAGMCIEN=+$P(DATA,U,4)
S PROCSTUB=+$P(DATA,U,5) ; NEW 6/19/97 GEK
S MCFILE=$P($P(^MCAR(697.2,PSIEN,0),U,2),"(",2)
I '$D(^MAG(2005.03,MCFILE)) S MAGRY="0^Procedure file is Invalid in Imaging Parent Data File " Q
S MAGOK=""
S I="" F S I=$O(MAGARR(I)) Q:I="" D
. S MAGPTR(I)=""
. I '$D(^MAG(2005,I)) S MAGERR="0^INVALID Image entry "_I
I $D(MAGERR) S MAGRY=MAGERR Q
; 6/19/97 New Note .MAGMCIEN
D UPDATE^MCUIMAG0(TIME,PSIEN,DFN,.MAGPTR,.MAGMCIEN,.MAGOK)
;
I 'MAGOK S MAGRY=MAGOK Q
; Next if we're getting a stub, Quit with the stub if it was created
I MAGOK,PROCSTUB D Q
. I MAGMCIEN<1 S MAGRY="0^FAILED Creating New Procedure stub"_MAGOK Q
. S MAGRY=$P(MAGMCIEN,U,1)_"^Procedure Stub created"
;
; now enter the pointers to procedures, in the image file.
; we get back MAGPTR(I)= MCFILE^PSIEN^MULTIPLE ENTRY IEN
S I="" F S I=$O(MAGPTR(I)) Q:I="" D
. S $P(^MAG(2005,I,2),U,6,8)=MAGPTR(I)
. D LINKDT^MAGGTU6(.X,I)
S MAGRY=MAGOK
Q
;/GEK/ 4/29/98 put in modification to return DICOM ID for MED proc.
DICOMID(MAGRY,DATA) ;RPC Call to return a Dicom ID for medicine procedure.
; This is displayed on workstation, and used to link Dicom images
; to a medicine procedure.
; DATA is null ^ PSIEN ^ DFN ^ MCIEN ^ null
;
N TMCFILE,TPSIEN,TDFN,TMCIEN,RETX
S TPSIEN=+$P(DATA,U,2)
S TDFN=+$P(DATA,U,3)
S TMCIEN=+$P(DATA,U,4)
S TMCFILE=$P($P($G(^MCAR(697.2,TPSIEN,0)),U,2),"(",2)
I 'TMCFILE S MAGRY="0^InValid data input PSIEN="_TPSIEN Q
D DICOMID^MAGDMEDI(.RETX,TMCFILE,TMCIEN,TPSIEN,TDFN)
S MAGRY=RETX
Q
NEW(MAGRY,DATA) ;RPC call to Create NEW Procedure stub
; for a medicine procedure
;
; DATA = DATETIME^PSIEN^DFN ; same as old call
S $P(DATA,"^",4)="^1" ; the 1 means we want a new procedure stub
K MAGARR ; we are not passing any images.
D FILE(.MAGRY,DATA,.MAGARR)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGTMC1 3789 printed Dec 13, 2024@02:03:07 Page 2
MAGGTMC1 ;WOIFO/GEK - RPC Calls for Imaging/Medicine procedures ; [ 06/20/2001 08:57 ]
+1 ;;3.0;IMAGING;**59**;Nov 27, 2007;Build 20
+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 ;; | |
+11 ;; | The Food and Drug Administration classifies this software as |
+12 ;; | a medical device. As such, it may not be changed in any way. |
+13 ;; | Modifications to this software may result in an adulterated |
+14 ;; | medical device under 21CFR820, the use of which is considered |
+15 ;; | to be a violation of US Federal Statutes. |
+16 ;; +---------------------------------------------------------------+
+17 ;;
+18 QUIT
FILE(MAGRY,DATA,MAGARR) ;RPC Call to File the Image pointer into
+1 ; the Procedure/Subspecialty and Proc/Subspec into Image file.
+2 ;
+3 ; DATA = DATETIME^PSIEN^DFN^MCIEN^PROCSTUB ; 6/19/97
+4 ; If MCIEN isn't sent, this will be added as new procedure
+5 ; MAGARR is array of image pointers
+6 ; IF PROCSTUB is 1 we JUST want New Medicine procedure stub IEN 6/19/97
+7 ; as the success i.e. MAGRY="IEN^Procdure Stub created" 6/19/97
+8 IF $$NEWERR^%ZTER
NEW $ETRAP,$ESTACK
SET $ETRAP="D ERR^MAGGTERR"
+9 IF '$TEST
SET X="ERR^MAGGTERR"
SET @^%ZOSF("TRAP")
+10 NEW I,J,K,X,Y,Z,TIME,PSIEN,DFN,MAGPTR,MAGMCIEN,MCFILE,MAGOK,MAGERR,PROCSTUB
+11 ;
+12 SET X=$PIECE(DATA,U,1)
SET %DT="TS"
DO ^%DT
SET TIME=Y
+13 SET PSIEN=+$PIECE(DATA,U,2)
+14 SET DFN=+$PIECE(DATA,U,3)
+15 SET MAGMCIEN=+$PIECE(DATA,U,4)
+16 ; NEW 6/19/97 GEK
SET PROCSTUB=+$PIECE(DATA,U,5)
+17 SET MCFILE=$PIECE($PIECE(^MCAR(697.2,PSIEN,0),U,2),"(",2)
+18 IF '$DATA(^MAG(2005.03,MCFILE))
SET MAGRY="0^Procedure file is Invalid in Imaging Parent Data File "
QUIT
+19 SET MAGOK=""
+20 SET I=""
FOR
SET I=$ORDER(MAGARR(I))
if I=""
QUIT
Begin DoDot:1
+21 SET MAGPTR(I)=""
+22 IF '$DATA(^MAG(2005,I))
SET MAGERR="0^INVALID Image entry "_I
End DoDot:1
+23 IF $DATA(MAGERR)
SET MAGRY=MAGERR
QUIT
+24 ; 6/19/97 New Note .MAGMCIEN
+25 DO UPDATE^MCUIMAG0(TIME,PSIEN,DFN,.MAGPTR,.MAGMCIEN,.MAGOK)
+26 ;
+27 IF 'MAGOK
SET MAGRY=MAGOK
QUIT
+28 ; Next if we're getting a stub, Quit with the stub if it was created
+29 IF MAGOK
IF PROCSTUB
Begin DoDot:1
+30 IF MAGMCIEN<1
SET MAGRY="0^FAILED Creating New Procedure stub"_MAGOK
QUIT
+31 SET MAGRY=$PIECE(MAGMCIEN,U,1)_"^Procedure Stub created"
End DoDot:1
QUIT
+32 ;
+33 ; now enter the pointers to procedures, in the image file.
+34 ; we get back MAGPTR(I)= MCFILE^PSIEN^MULTIPLE ENTRY IEN
+35 SET I=""
FOR
SET I=$ORDER(MAGPTR(I))
if I=""
QUIT
Begin DoDot:1
+36 SET $PIECE(^MAG(2005,I,2),U,6,8)=MAGPTR(I)
+37 DO LINKDT^MAGGTU6(.X,I)
End DoDot:1
+38 SET MAGRY=MAGOK
+39 QUIT
+40 ;/GEK/ 4/29/98 put in modification to return DICOM ID for MED proc.
DICOMID(MAGRY,DATA) ;RPC Call to return a Dicom ID for medicine procedure.
+1 ; This is displayed on workstation, and used to link Dicom images
+2 ; to a medicine procedure.
+3 ; DATA is null ^ PSIEN ^ DFN ^ MCIEN ^ null
+4 ;
+5 NEW TMCFILE,TPSIEN,TDFN,TMCIEN,RETX
+6 SET TPSIEN=+$PIECE(DATA,U,2)
+7 SET TDFN=+$PIECE(DATA,U,3)
+8 SET TMCIEN=+$PIECE(DATA,U,4)
+9 SET TMCFILE=$PIECE($PIECE($GET(^MCAR(697.2,TPSIEN,0)),U,2),"(",2)
+10 IF 'TMCFILE
SET MAGRY="0^InValid data input PSIEN="_TPSIEN
QUIT
+11 DO DICOMID^MAGDMEDI(.RETX,TMCFILE,TMCIEN,TPSIEN,TDFN)
+12 SET MAGRY=RETX
+13 QUIT
NEW(MAGRY,DATA) ;RPC call to Create NEW Procedure stub
+1 ; for a medicine procedure
+2 ;
+3 ; DATA = DATETIME^PSIEN^DFN ; same as old call
+4 ; the 1 means we want a new procedure stub
SET $PIECE(DATA,"^",4)="^1"
+5 ; we are not passing any images.
KILL MAGARR
+6 DO FILE(.MAGRY,DATA,.MAGARR)
+7 QUIT