MAGVRD02 ;WOIFO/DAC - Radiation Dosage - Attach Instance ; 05 March 2015 2:01 PM
;;3.0;IMAGING;**138,157**;Mar 19, 2002;Build 16;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
INPUTSEP() ; Name value separator for input data ie. NAME`TESTPATIENT
Q "`"
OUTSEP() ; Name value separator for output data ie. NAME|TESTPATIENT
Q "|"
STATSEP() ; Status and Result separator ie. -3``No record IEN
Q "`"
;
; Input Variables:
; ATTNAMS - Array of name value pairs separated by an input separator
; SERUID - Series UID
; IIUID - Irradiation Instance
; Output Variable:
; OUT - Returns success and new record IEN or error and error message
;
CT(OUT,ATTNAMS,SERUID,IIUID) ; Create CT dosage instance
N IENS,ERR,ID,FDA,SSEP
S IENS="+1,"
L +^MAGV(2005.632,0):1E9
S ID=$P($G(^MAGV(2005.632,0)),U,4)+1
S SSEP=$$STATSEP
S FDA(2005.632,IENS,.01)=ID
S FDA(2005.632,IENS,1)=$G(ATTNAMS("IRRADIATION INSTANCE UID"))
S FDA(2005.632,IENS,2)=$G(ATTNAMS("TARGET REGION"))
S FDA(2005.632,IENS,4)=$$FORMAT($G(ATTNAMS("CTDIVOL"))) ; P157 DAC - format functions added
S FDA(2005.632,IENS,7)=$$FORMAT($G(ATTNAMS("DLP")))
S FDA(2005.632,IENS,11)=$G(SERUID)
D UPDATE^DIE("E","FDA","","ERR")
L -^MAGV(2005.632,0)
I $D(ERR("DIERR")) S OUT="-99"_SSEP_$G(ERR("DIERR",1,"TEXT",1)) Q
S OUT=0_SSEP_SSEP_ID
Q
;
; Input Variables:
; ATTNAMS - Array of name value pairs separated by an input separator
; SERUID - Series Instance UID
; IIUID - Irradiation Instance
; Output Variable:
; OUT - Returns success and new record IEN or error and error message
;
FLUORO(OUT,ATTNAMS,SERIUD,IIUID) ; Create fluoroscopy dosage instance
N IENS,ERR,FDA,SSEP
S IENS="+1,"
L +^MAGV(2005.633,0):1E9
S ID=$P($G(^MAGV(2005.633,0)),U,4)+1
S SSEP=$$STATSEP
S FDA(2005.633,IENS,.01)=ID
S FDA(2005.633,IENS,1)=$G(ATTNAMS("ESTIMATE"))
S FDA(2005.633,IENS,2)=$G(ATTNAMS("TOTAL TIME IN FLUOROSCOPY"))
S FDA(2005.633,IENS,6)=$$FORMAT($G(ATTNAMS("DOSE AREA PRODUCTS")))
S FDA(2005.633,IENS,8)=$G(SERUID)
S FDA(2005.633,IENS,9)=$$FORMAT($G(ATTNAMS("DOSE (RP) TOTAL (AKE)")),6) ; P157 DAC - format functions added
S FDA(2005.633,IENS,10)=$$FORMAT($G(ATTNAMS("FLUORO DOSE (RP) TOTAL")))
S FDA(2005.633,IENS,11)=$$FORMAT($G(ATTNAMS("FLUORO DOSE AREA PRODUCT TOTAL")))
S FDA(2005.633,IENS,12)=$$FORMAT($G(ATTNAMS("CINE DOSE (RP) TOTAL")))
S FDA(2005.633,IENS,13)=$$FORMAT($G(ATTNAMS("CINE DOSE AREA PRODUCT TOTAL")))
S FDA(2005.633,IENS,14)=$G(ATTNAMS("CINE TIME"))
D UPDATE^DIE("E","FDA","","ERR")
L -^MAGV(2005.633,0)
I $D(ERR("DIERR")) S OUT="-99"_SSEP_$G(ERR("DIERR",1,"TEXT",1)) Q
S OUT=0_SSEP_SSEP_ID
Q
;
; Input Variables:
; NUMBER - The numeric input value
; MAXINT - The maximum number of integers allowed - 5 if no value supplied.
; Output Variable:
; OUT - Returns the numeric value that will be filed
;
FORMAT(NUMBER,MAXINT) ; Function to format numeric inputs - P157 DAC
N SIGDEC,MODNUM
I $G(NUMBER)="" Q "" ; Quit if no number input
I $L($P(NUMBER,".",2))<=9 Q NUMBER ; Quit if 9 or or less decimal places
I $G(MAXINT)="" S MAXINT=5 ; Assume maximum of five allowable integer places unless MAXINT is defined
S MODNUM=$J(NUMBER,0,9) ; Rounding function
; If integer portion of formatted number exceeds FileMan maximum, revert to original input and cut decimals
I MAXINT<$L($P(MODNUM,".",1)) S MODNUM=($P(NUMBER,".",1))_"."_$E($P(NUMBER,".",2),1,9)
Q MODNUM
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGVRD02 4633 printed Dec 13, 2024@02:10:03 Page 2
MAGVRD02 ;WOIFO/DAC - Radiation Dosage - Attach Instance ; 05 March 2015 2:01 PM
+1 ;;3.0;IMAGING;**138,157**;Mar 19, 2002;Build 16;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
INPUTSEP() ; Name value separator for input data ie. NAME`TESTPATIENT
+1 QUIT "`"
OUTSEP() ; Name value separator for output data ie. NAME|TESTPATIENT
+1 QUIT "|"
STATSEP() ; Status and Result separator ie. -3``No record IEN
+1 QUIT "`"
+2 ;
+3 ; Input Variables:
+4 ; ATTNAMS - Array of name value pairs separated by an input separator
+5 ; SERUID - Series UID
+6 ; IIUID - Irradiation Instance
+7 ; Output Variable:
+8 ; OUT - Returns success and new record IEN or error and error message
+9 ;
CT(OUT,ATTNAMS,SERUID,IIUID) ; Create CT dosage instance
+1 NEW IENS,ERR,ID,FDA,SSEP
+2 SET IENS="+1,"
+3 LOCK +^MAGV(2005.632,0):1E9
+4 SET ID=$PIECE($GET(^MAGV(2005.632,0)),U,4)+1
+5 SET SSEP=$$STATSEP
+6 SET FDA(2005.632,IENS,.01)=ID
+7 SET FDA(2005.632,IENS,1)=$GET(ATTNAMS("IRRADIATION INSTANCE UID"))
+8 SET FDA(2005.632,IENS,2)=$GET(ATTNAMS("TARGET REGION"))
+9 ; P157 DAC - format functions added
SET FDA(2005.632,IENS,4)=$$FORMAT($GET(ATTNAMS("CTDIVOL")))
+10 SET FDA(2005.632,IENS,7)=$$FORMAT($GET(ATTNAMS("DLP")))
+11 SET FDA(2005.632,IENS,11)=$GET(SERUID)
+12 DO UPDATE^DIE("E","FDA","","ERR")
+13 LOCK -^MAGV(2005.632,0)
+14 IF $DATA(ERR("DIERR"))
SET OUT="-99"_SSEP_$GET(ERR("DIERR",1,"TEXT",1))
QUIT
+15 SET OUT=0_SSEP_SSEP_ID
+16 QUIT
+17 ;
+18 ; Input Variables:
+19 ; ATTNAMS - Array of name value pairs separated by an input separator
+20 ; SERUID - Series Instance UID
+21 ; IIUID - Irradiation Instance
+22 ; Output Variable:
+23 ; OUT - Returns success and new record IEN or error and error message
+24 ;
FLUORO(OUT,ATTNAMS,SERIUD,IIUID) ; Create fluoroscopy dosage instance
+1 NEW IENS,ERR,FDA,SSEP
+2 SET IENS="+1,"
+3 LOCK +^MAGV(2005.633,0):1E9
+4 SET ID=$PIECE($GET(^MAGV(2005.633,0)),U,4)+1
+5 SET SSEP=$$STATSEP
+6 SET FDA(2005.633,IENS,.01)=ID
+7 SET FDA(2005.633,IENS,1)=$GET(ATTNAMS("ESTIMATE"))
+8 SET FDA(2005.633,IENS,2)=$GET(ATTNAMS("TOTAL TIME IN FLUOROSCOPY"))
+9 SET FDA(2005.633,IENS,6)=$$FORMAT($GET(ATTNAMS("DOSE AREA PRODUCTS")))
+10 SET FDA(2005.633,IENS,8)=$GET(SERUID)
+11 ; P157 DAC - format functions added
SET FDA(2005.633,IENS,9)=$$FORMAT($GET(ATTNAMS("DOSE (RP) TOTAL (AKE)")),6)
+12 SET FDA(2005.633,IENS,10)=$$FORMAT($GET(ATTNAMS("FLUORO DOSE (RP) TOTAL")))
+13 SET FDA(2005.633,IENS,11)=$$FORMAT($GET(ATTNAMS("FLUORO DOSE AREA PRODUCT TOTAL")))
+14 SET FDA(2005.633,IENS,12)=$$FORMAT($GET(ATTNAMS("CINE DOSE (RP) TOTAL")))
+15 SET FDA(2005.633,IENS,13)=$$FORMAT($GET(ATTNAMS("CINE DOSE AREA PRODUCT TOTAL")))
+16 SET FDA(2005.633,IENS,14)=$GET(ATTNAMS("CINE TIME"))
+17 DO UPDATE^DIE("E","FDA","","ERR")
+18 LOCK -^MAGV(2005.633,0)
+19 IF $DATA(ERR("DIERR"))
SET OUT="-99"_SSEP_$GET(ERR("DIERR",1,"TEXT",1))
QUIT
+20 SET OUT=0_SSEP_SSEP_ID
+21 QUIT
+22 ;
+23 ; Input Variables:
+24 ; NUMBER - The numeric input value
+25 ; MAXINT - The maximum number of integers allowed - 5 if no value supplied.
+26 ; Output Variable:
+27 ; OUT - Returns the numeric value that will be filed
+28 ;
FORMAT(NUMBER,MAXINT) ; Function to format numeric inputs - P157 DAC
+1 NEW SIGDEC,MODNUM
+2 ; Quit if no number input
IF $GET(NUMBER)=""
QUIT ""
+3 ; Quit if 9 or or less decimal places
IF $LENGTH($PIECE(NUMBER,".",2))<=9
QUIT NUMBER
+4 ; Assume maximum of five allowable integer places unless MAXINT is defined
IF $GET(MAXINT)=""
SET MAXINT=5
+5 ; Rounding function
SET MODNUM=$JUSTIFY(NUMBER,0,9)
+6 ; If integer portion of formatted number exceeds FileMan maximum, revert to original input and cut decimals
+7 IF MAXINT<$LENGTH($PIECE(MODNUM,".",1))
SET MODNUM=($PIECE(NUMBER,".",1))_"."_$EXTRACT($PIECE(NUMBER,".",2),1,9)
+8 QUIT MODNUM
+9 ;