source: FOIAVistA/tag/r/IMAGING-MAG-ZMAG/MAGGSIM.m@ 1582

Last change on this file since 1582 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.4 KB
Line 
1MAGGSIM ;WOIFO/GEK - Call to Modify Image File entry ; [ 12/27/2000 10:49 ]
2 ;;3.0;IMAGING;**7,8**;Sep 15, 2004
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 Q
19 ;
20MOD(MAGRY,MAGARRAY) ; RPC Call to UPDATE^DIE to Add an Image File entry
21 ; Parameters :
22 ; MAGARRAY - array of field numbers and their entries
23 ; i.e. MAGARRAY(1)=".5^38" field# .5 data is 38
24 ; If Long Description is included in array (field 11), we create a new
25 ; array to hold the text, and pass that to UPDATE^DIE
26 ; If this entry is an Image Group
27 ; i.e. MAGARRAY(n)="2005.04^344"
28 ; (the field 2005.04 is the OBJECT GROUP MULTIPLE)
29 ; ( 344 is the pointer to the Image File Entry that will be added
30 ; ( as a member of this new/existing Group)
31 ;
32 ; Return Variable
33 ; MAGRY is a string;
34 ; "1^success"
35 ; "0^Error message"
36 ;
37 N MAGGFDA,MAGGDRV,MAGGRP,MAGCHLD,GRPCT,MAGGDA,MAGGFNM
38 N MAGGWP,WPCT,MAGGFLD,MAGGDAT,MAGERR
39 N MAGREF,MAGDHASH,MAGTEMP
40 N MAGVY,MAGACT
41 N MAGTEMP,TEMPIEN
42 N MAGGIEN,MAGGXE
43 N I,J,X,Y,Z
44 ;
45 N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGGSERR"
46 ;
47 I ($D(MAGARRAY)<10) S MAGRY="0^No input data, Operation CANCELED" Q
48 ;
49 S MAGRY="0^Creating VistA Image Entry..."
50 S MAGERR="",MAGGRP=0,GRPCT=1,WPCT=0
51 ;
52 ; Validate the Data, and Action codes in the Input Array
53 D VAL^MAGGSIV(.MAGVY,.MAGARRAY) I 'MAGVY(0) S MAGRY=MAGVY(0) Q
54 ;
55 ;
56 ; Make the FileMan FDA array and the Imaging Action array.
57 D MAKEFDA^MAGGSIU2(.MAGGFDA,.MAGARRAY,.MAGACT,.MAGCHLD,.MAGGRP,.MAGGWP)
58 ;
59 I '$D(MAGACT("IEN")) S MAGRY="0^You Need to send the IEN" Q
60 ;
61 I '$D(MAGGFDA(2005,"+1,")) S MAGRY="0^No data to file. Operation CANCELED." Q
62 ;
63 S TEMPIEN=MAGACT("IEN")_","
64 M MAGTEMP(2005,TEMPIEN)=MAGGFDA(2005,"+1,") K MAGGFDA
65 M MAGGFDA=MAGTEMP K MAGTEMP
66 ;
67 D FILE^DIE("S","MAGGFDA","MAGGIEN","MAGGXE")
68 ; We shouldn't have errors, because the data was validated before the call
69 ; But we'll still check for errors.
70 I $D(DIERR) D S MAGRY=MAGERR Q
71 . D RTRNERR(.MAGERR)
72 . D CLEAN^DILF
73 ;
74 ;S MAGRY="1^OK"
75 D ACTION^MAGGTAU("MOD^"_MAGGFDA(2005,"+1,",5)_"^"_$G(MAGACT("IEN")))
76 ;
77 ;Q
78 ; THE REST OF THIS IS FROM IMAGE ADD, DON'T KNOW YET WHAT
79 ; WE NEED TO CHECK or are going to allow from the GUI.
80 ;
81 ; IF THE IEN is a group, Modify GROUP PARENT in each Group Object and QUIT
82 ;
83 I MAGGRP D UPDCHLD(.MAGCHLD,MAGACT("IEN")) S MAGRY="1^OK" Q
84 ;
85 I $G(MAGGFDA(2005,"+1,",14)) D I $L(MAGERR) S MAGRY=MAGERR Q
86 . D UPDPAR(.MAGERR,MAGGFDA(2005,"+1,",14),.MAGACT,MAGACT("IEN"))
87 Q
88UPDPAR(MAGERR,MAGRPDA,MAGACT,MAGGDA) ;
89 ; We're here beceause this image is a member of a Group
90 ; so we will modify the Group Parent, adding this to it's group
91 ; HERE we will also send the 'Series Number' and 'Image Number' if
92 ; they exist;
93 N MAGFDA
94 S Y="+2,"_MAGRPDA_","
95 S MAGFDA(2005.04,Y,.01)=MAGGDA
96 ; DICOM SERIES AND IMAGE NUMBER CAN BE ANYTHING, WE CAN'T CHECK FOR +X
97 I $L($G(MAGACT("DICOMSN"))) S MAGFDA(2005.04,Y,1)=MAGACT("DICOMSN")
98 I $L($G(MAGACT("DICOMIN"))) S MAGFDA(2005.04,Y,2)=MAGACT("DICOMIN")
99 D UPDATE^DIE("S","MAGFDA","MAGGIEN","MAGGXE")
100 ; in case of an error
101 I $D(DIERR) D RTRNERR(.MAGERR)
102 D CLEAN^DILF
103 Q
104 ;
105UPDCHLD(MAGCHLD,MAGGDA) ;
106 S Z=""
107 F S Z=$O(MAGCHLD(Z)) Q:Z="" D
108 . S $P(^MAG(2005,Z,0),U,10)=MAGGDA
109 . ; TODO; have to modify the parent global root, ( delete it if
110 . ; this image was assigned as a single to the wrong parent )
111 Q
112RTRNERR(ETXT) ; There was error from FILE^DIE quit with error text
113 S ETXT="0^ERROR "_MAGGXE("DIERR",1,"TEXT",1)
114 Q
Note: See TracBrowser for help on using the repository browser.