- MAGGSIM ;WOIFO/GEK - Call to Modify Image File entry ; [ 12/27/2000 10:49 ]
- ;;3.0;IMAGING;**7,8**;Sep 15, 2004
- ;; +---------------------------------------------------------------+
- ;; | 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
- ;
- MOD(MAGRY,MAGARRAY) ; RPC Call to UPDATE^DIE to Add an Image File entry
- ; Parameters :
- ; MAGARRAY - array of field numbers and their entries
- ; i.e. MAGARRAY(1)=".5^38" field# .5 data is 38
- ; If Long Description is included in array (field 11), we create a new
- ; array to hold the text, and pass that to UPDATE^DIE
- ; If this entry is an Image Group
- ; i.e. MAGARRAY(n)="2005.04^344"
- ; (the field 2005.04 is the OBJECT GROUP MULTIPLE)
- ; ( 344 is the pointer to the Image File Entry that will be added
- ; ( as a member of this new/existing Group)
- ;
- ; Return Variable
- ; MAGRY is a string;
- ; "1^success"
- ; "0^Error message"
- ;
- N MAGGFDA,MAGGDRV,MAGGRP,MAGCHLD,GRPCT,MAGGDA,MAGGFNM
- N MAGGWP,WPCT,MAGGFLD,MAGGDAT,MAGERR
- N MAGREF,MAGDHASH,MAGTEMP
- N MAGVY,MAGACT
- N MAGTEMP,TEMPIEN
- N MAGGIEN,MAGGXE
- N I,J,X,Y,Z
- ;
- N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGGSERR"
- ;
- I ($D(MAGARRAY)<10) S MAGRY="0^No input data, Operation CANCELED" Q
- ;
- S MAGRY="0^Creating VistA Image Entry..."
- S MAGERR="",MAGGRP=0,GRPCT=1,WPCT=0
- ;
- ; Validate the Data, and Action codes in the Input Array
- D VAL^MAGGSIV(.MAGVY,.MAGARRAY) I 'MAGVY(0) S MAGRY=MAGVY(0) Q
- ;
- ;
- ; Make the FileMan FDA array and the Imaging Action array.
- D MAKEFDA^MAGGSIU2(.MAGGFDA,.MAGARRAY,.MAGACT,.MAGCHLD,.MAGGRP,.MAGGWP)
- ;
- I '$D(MAGACT("IEN")) S MAGRY="0^You Need to send the IEN" Q
- ;
- I '$D(MAGGFDA(2005,"+1,")) S MAGRY="0^No data to file. Operation CANCELED." Q
- ;
- S TEMPIEN=MAGACT("IEN")_","
- M MAGTEMP(2005,TEMPIEN)=MAGGFDA(2005,"+1,") K MAGGFDA
- M MAGGFDA=MAGTEMP K MAGTEMP
- ;
- D FILE^DIE("S","MAGGFDA","MAGGIEN","MAGGXE")
- ; We shouldn't have errors, because the data was validated before the call
- ; But we'll still check for errors.
- I $D(DIERR) D S MAGRY=MAGERR Q
- . D RTRNERR(.MAGERR)
- . D CLEAN^DILF
- ;
- ;S MAGRY="1^OK"
- D ACTION^MAGGTAU("MOD^"_MAGGFDA(2005,"+1,",5)_"^"_$G(MAGACT("IEN")))
- ;
- ;Q
- ; THE REST OF THIS IS FROM IMAGE ADD, DON'T KNOW YET WHAT
- ; WE NEED TO CHECK or are going to allow from the GUI.
- ;
- ; IF THE IEN is a group, Modify GROUP PARENT in each Group Object and QUIT
- ;
- I MAGGRP D UPDCHLD(.MAGCHLD,MAGACT("IEN")) S MAGRY="1^OK" Q
- ;
- I $G(MAGGFDA(2005,"+1,",14)) D I $L(MAGERR) S MAGRY=MAGERR Q
- . D UPDPAR(.MAGERR,MAGGFDA(2005,"+1,",14),.MAGACT,MAGACT("IEN"))
- Q
- UPDPAR(MAGERR,MAGRPDA,MAGACT,MAGGDA) ;
- ; We're here beceause this image is a member of a Group
- ; so we will modify the Group Parent, adding this to it's group
- ; HERE we will also send the 'Series Number' and 'Image Number' if
- ; they exist;
- N MAGFDA
- S Y="+2,"_MAGRPDA_","
- S MAGFDA(2005.04,Y,.01)=MAGGDA
- ; DICOM SERIES AND IMAGE NUMBER CAN BE ANYTHING, WE CAN'T CHECK FOR +X
- I $L($G(MAGACT("DICOMSN"))) S MAGFDA(2005.04,Y,1)=MAGACT("DICOMSN")
- I $L($G(MAGACT("DICOMIN"))) S MAGFDA(2005.04,Y,2)=MAGACT("DICOMIN")
- D UPDATE^DIE("S","MAGFDA","MAGGIEN","MAGGXE")
- ; in case of an error
- I $D(DIERR) D RTRNERR(.MAGERR)
- D CLEAN^DILF
- Q
- ;
- UPDCHLD(MAGCHLD,MAGGDA) ;
- S Z=""
- F S Z=$O(MAGCHLD(Z)) Q:Z="" D
- . S $P(^MAG(2005,Z,0),U,10)=MAGGDA
- . ; TODO; have to modify the parent global root, ( delete it if
- . ; this image was assigned as a single to the wrong parent )
- Q
- RTRNERR(ETXT) ; There was error from FILE^DIE quit with error text
- S ETXT="0^ERROR "_MAGGXE("DIERR",1,"TEXT",1)
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGSIM 4588 printed Jan 18, 2025@03:03:56 Page 2
- MAGGSIM ;WOIFO/GEK - Call to Modify Image File entry ; [ 12/27/2000 10:49 ]
- +1 ;;3.0;IMAGING;**7,8**;Sep 15, 2004
- +2 ;; +---------------------------------------------------------------+
- +3 ;; | Property of the US Government. |
- +4 ;; | No permission to copy or redistribute this software is given. |
- +5 ;; | Use of unreleased versions of this software requires the user |
- +6 ;; | to execute a written test agreement with the VistA Imaging |
- +7 ;; | Development Office of the Department of Veterans Affairs, |
- +8 ;; | telephone (301) 734-0100. |
- +9 ;; | |
- +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 ;
- MOD(MAGRY,MAGARRAY) ; RPC Call to UPDATE^DIE to Add an Image File entry
- +1 ; Parameters :
- +2 ; MAGARRAY - array of field numbers and their entries
- +3 ; i.e. MAGARRAY(1)=".5^38" field# .5 data is 38
- +4 ; If Long Description is included in array (field 11), we create a new
- +5 ; array to hold the text, and pass that to UPDATE^DIE
- +6 ; If this entry is an Image Group
- +7 ; i.e. MAGARRAY(n)="2005.04^344"
- +8 ; (the field 2005.04 is the OBJECT GROUP MULTIPLE)
- +9 ; ( 344 is the pointer to the Image File Entry that will be added
- +10 ; ( as a member of this new/existing Group)
- +11 ;
- +12 ; Return Variable
- +13 ; MAGRY is a string;
- +14 ; "1^success"
- +15 ; "0^Error message"
- +16 ;
- +17 NEW MAGGFDA,MAGGDRV,MAGGRP,MAGCHLD,GRPCT,MAGGDA,MAGGFNM
- +18 NEW MAGGWP,WPCT,MAGGFLD,MAGGDAT,MAGERR
- +19 NEW MAGREF,MAGDHASH,MAGTEMP
- +20 NEW MAGVY,MAGACT
- +21 NEW MAGTEMP,TEMPIEN
- +22 NEW MAGGIEN,MAGGXE
- +23 NEW I,J,X,Y,Z
- +24 ;
- +25 NEW $ETRAP,$ESTACK
- SET $ETRAP="D ERR^MAGGSERR"
- +26 ;
- +27 IF ($DATA(MAGARRAY)<10)
- SET MAGRY="0^No input data, Operation CANCELED"
- QUIT
- +28 ;
- +29 SET MAGRY="0^Creating VistA Image Entry..."
- +30 SET MAGERR=""
- SET MAGGRP=0
- SET GRPCT=1
- SET WPCT=0
- +31 ;
- +32 ; Validate the Data, and Action codes in the Input Array
- +33 DO VAL^MAGGSIV(.MAGVY,.MAGARRAY)
- IF 'MAGVY(0)
- SET MAGRY=MAGVY(0)
- QUIT
- +34 ;
- +35 ;
- +36 ; Make the FileMan FDA array and the Imaging Action array.
- +37 DO MAKEFDA^MAGGSIU2(.MAGGFDA,.MAGARRAY,.MAGACT,.MAGCHLD,.MAGGRP,.MAGGWP)
- +38 ;
- +39 IF '$DATA(MAGACT("IEN"))
- SET MAGRY="0^You Need to send the IEN"
- QUIT
- +40 ;
- +41 IF '$DATA(MAGGFDA(2005,"+1,"))
- SET MAGRY="0^No data to file. Operation CANCELED."
- QUIT
- +42 ;
- +43 SET TEMPIEN=MAGACT("IEN")_","
- +44 MERGE MAGTEMP(2005,TEMPIEN)=MAGGFDA(2005,"+1,")
- KILL MAGGFDA
- +45 MERGE MAGGFDA=MAGTEMP
- KILL MAGTEMP
- +46 ;
- +47 DO FILE^DIE("S","MAGGFDA","MAGGIEN","MAGGXE")
- +48 ; We shouldn't have errors, because the data was validated before the call
- +49 ; But we'll still check for errors.
- +50 IF $DATA(DIERR)
- Begin DoDot:1
- +51 DO RTRNERR(.MAGERR)
- +52 DO CLEAN^DILF
- End DoDot:1
- SET MAGRY=MAGERR
- QUIT
- +53 ;
- +54 ;S MAGRY="1^OK"
- +55 DO ACTION^MAGGTAU("MOD^"_MAGGFDA(2005,"+1,",5)_"^"_$GET(MAGACT("IEN")))
- +56 ;
- +57 ;Q
- +58 ; THE REST OF THIS IS FROM IMAGE ADD, DON'T KNOW YET WHAT
- +59 ; WE NEED TO CHECK or are going to allow from the GUI.
- +60 ;
- +61 ; IF THE IEN is a group, Modify GROUP PARENT in each Group Object and QUIT
- +62 ;
- +63 IF MAGGRP
- DO UPDCHLD(.MAGCHLD,MAGACT("IEN"))
- SET MAGRY="1^OK"
- QUIT
- +64 ;
- +65 IF $GET(MAGGFDA(2005,"+1,",14))
- Begin DoDot:1
- +66 DO UPDPAR(.MAGERR,MAGGFDA(2005,"+1,",14),.MAGACT,MAGACT("IEN"))
- End DoDot:1
- IF $LENGTH(MAGERR)
- SET MAGRY=MAGERR
- QUIT
- +67 QUIT
- UPDPAR(MAGERR,MAGRPDA,MAGACT,MAGGDA) ;
- +1 ; We're here beceause this image is a member of a Group
- +2 ; so we will modify the Group Parent, adding this to it's group
- +3 ; HERE we will also send the 'Series Number' and 'Image Number' if
- +4 ; they exist;
- +5 NEW MAGFDA
- +6 SET Y="+2,"_MAGRPDA_","
- +7 SET MAGFDA(2005.04,Y,.01)=MAGGDA
- +8 ; DICOM SERIES AND IMAGE NUMBER CAN BE ANYTHING, WE CAN'T CHECK FOR +X
- +9 IF $LENGTH($GET(MAGACT("DICOMSN")))
- SET MAGFDA(2005.04,Y,1)=MAGACT("DICOMSN")
- +10 IF $LENGTH($GET(MAGACT("DICOMIN")))
- SET MAGFDA(2005.04,Y,2)=MAGACT("DICOMIN")
- +11 DO UPDATE^DIE("S","MAGFDA","MAGGIEN","MAGGXE")
- +12 ; in case of an error
- +13 IF $DATA(DIERR)
- DO RTRNERR(.MAGERR)
- +14 DO CLEAN^DILF
- +15 QUIT
- +16 ;
- UPDCHLD(MAGCHLD,MAGGDA) ;
- +1 SET Z=""
- +2 FOR
- SET Z=$ORDER(MAGCHLD(Z))
- if Z=""
- QUIT
- Begin DoDot:1
- +3 SET $PIECE(^MAG(2005,Z,0),U,10)=MAGGDA
- +4 ; TODO; have to modify the parent global root, ( delete it if
- +5 ; this image was assigned as a single to the wrong parent )
- End DoDot:1
- +6 QUIT
- RTRNERR(ETXT) ; There was error from FILE^DIE quit with error text
- +1 SET ETXT="0^ERROR "_MAGGXE("DIERR",1,"TEXT",1)
- +2 QUIT