source: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGGTII.m@ 1582

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

revised back to 6/30/08 version

File size: 8.7 KB
RevLine 
[623]1MAGGTII ;WOIFO/GEK - RETURN IMAGE INFO ; [ 11/08/2001 17:18 ]
2 ;;3.0;IMAGING;**8,48,63**;Apr 11, 2005
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 ; CALL WITH MAGXX=IEN of IMAGE FILE (2005)
19 ; RETURNS MAGFILE='^' delimited string of Image information.
20 ;
21 ;
22INFO ;Get info for an Image File entry
23 ; We assume that MAGXX exists and is the Image File entry
24 ; We return a '^' delimited string for the Image entry.
25 ; $P(1^2^3) IEN^Image FullPath and name^Abstract FullPath and Name
26 ; $P(4) SHORT DESCRIPTION field and desc of offline JukeBox
27 ; $P(5) PROCEDURE/ EXAM DATE/TIME field
28 ; $P(6) OBJECT TYPE
29 ; $P(7) PROCEDURE field
30 ; $P(8) display date
31 ; $P(9) to return the PARENT DATA FILE image pointer
32 ; $p(10) return the ABSTYPE 'M' magnetic 'W' worm 'O' offline
33 ; $p(11) is 'A' accessible 'O' offline
34 ; $p(12^13) Dicom Series Number $p(12) and Image Number $p(13)
35 ; $p(14) is count of images in group, 1 if single image.
36 ; VISN15
37 ; $p(15^16) SiteParameter IEN ^ SiteParameter CODE
38 ; $P(17) is err description of Integrity Check
39 ; $P(18) Image BIGPath and name //Patch 5
40 ; $P(19^20) Patient DFN ^ Patient Name; // Patch 3.8
41 ; $P(21) Image Class: Clin,Admin,Clin/Admin,Admin/Clin
42 ;
43 N FILETYPE,MAGPREF,MAGJBCP,GRPTYPE,GRPIEN,ABSTYPE,MAGTYPE,MAGJBOL
44 N MAGOFFLN,FULLTYPE,MAGOBJT,MAGQI,X
45 N ABSFILE,FULLFILE,BIGFILE,PATCH,MDFN,FNL,PLC,PLCODE
46 N MAGN0,MAGN2,MAGN40
47 ; set the Variables for the Global Nodes of the Image Entry
48 S MAGN0=$G(^MAG(2005,MAGXX,0)),MDFN=$P(MAGN0,"^",7) ; P48T1 MDFN
49 S MAGN2=$G(^MAG(2005,MAGXX,2))
50 S MAGN40=$G(^MAG(2005,MAGXX,40))
51 ; P48T1 Set Name in Variable, Call $$GET 1 time not 2000
52 I '$D(MAGJOB("PTNM",MDFN)) S MAGJOB("PTNM",MDFN)=$$GET1^DIQ(2,MDFN_",",.01)
53 I '$D(MAGJOB("NETPLC")) D NETPLCS^MAGGTU6
54 ; Object Type
55 S MAGOBJT=$P(MAGN0,"^",6)
56 ; if this is a group, change MAGXX to first image in group to get
57 ; that abstract to use for the group abstract
58 I MAGOBJT=11!(MAGOBJT=16) S GRPTYPE=MAGOBJT D
59 . S X=$O(^MAG(2005,MAGXX,1,0))
60 . ; next line to account for group of NO images for whatever reason.
61 . ; we change Object Type to XRAY (3) or STILL IMAGE (1)
62 . I 'X S MAGOBJT=$S(MAGOBJT=11:3,MAGOBJT=16:1,1:1) K GRPTYPE Q
63 . S X=^MAG(2005,MAGXX,1,X,0)
64 . ; keep the Real IEN, so we can change back later
65 . S GRPIEN=MAGXX,MAGXX=+X
66 . Q
67 S MAGJBCP=0 ; Don't Queue a copy from JukeBox.
68 ; The call to FINDFILE returns:
69 ; MAGFILE1=LA100066.ABS filename
70 ; if no Network Location pointer or INVALID Pointer
71 ; then MAGFILE1=-1~NO NETWORK LOCATION POINTER
72 ; or -1~INVALID NETWORK LOCATION POINTER
73 ; MAGFILE1(.01)=ONE,PATIENT 111223333 image desc
74 ; MAGJBOL= desc of Offline server
75 ; MAGOFFLN= if JB is offline
76 ; MAGPREF=C:\TEMP\LA\10\00\ path
77 ; MAGTYPE=MAG MAG or WORM
78 ;
79 ; first get Full Path and File Name of the Abstract
80 S FILETYPE="ABSTRACT" K MAGFILE1("ERROR")
81 S MAGPREF="" D FINDFILE^MAGFILEB
82 S MAGFILE1=$TR(MAGFILE1,"^","~") ; MAGFILE1 has '^' in it if errors
83 I $D(MAGFILE1("ERROR")) S MAGFILE1=MAGFILE1("ERROR")
84 S ABSTYPE=$E(MAGTYPE,1) I MAGOFFLN S ABSTYPE="O"
85 ; Here we must test for +MAGFILE1 = -1 which means we don't have
86 ; any entry in the Image File for the Abstract Network Location
87 ; pointer.
88 S MAGPREF=$G(MAGPREF)
89 S ABSFILE=MAGPREF_MAGFILE1
90 ;
91 ; now lets get the Full Path and file name FULL RES image.
92 S FULLTYPE="A" ; Accessible
93 S FILETYPE="FULL" K MAGFILE1("ERROR")
94 S MAGPREF="" D FINDFILE^MAGFILEB
95 S MAGFILE1=$TR(MAGFILE1,"^","~") ; MAGFILE1 has '^' in it if errors
96 I $D(MAGFILE1("ERROR")) S MAGFILE1=MAGFILE1("ERROR")
97 I MAGOFFLN S FULLTYPE="O" ; Offline
98 ; here we have to do the same test as above. for bad data.
99 S MAGPREF=$G(MAGPREF)
100 S FULLFILE=MAGPREF_MAGFILE1
101 ;
102 ; now lets get the Full Path and file name for BIG image.
103 S FILETYPE="BIG" K MAGFILE1("ERROR")
104 S MAGPREF="" D FINDFILE^MAGFILEB
105 S MAGFILE1=$TR(MAGFILE1,"^","~") ; MAGFILE1 has '^' in it if errors
106 I $D(MAGFILE1("ERROR")) S MAGFILE1=MAGFILE1("ERROR")
107 S MAGPREF=$G(MAGPREF)
108 S BIGFILE=$S($E(MAGFILE1,1,2)="-1":"",1:MAGPREF_MAGFILE1)
109 ;
110 K MAGFILE1 ; Cleanup
111 ; Site and Site Code are in Entry of first Image in Group
112 ; so we need to set here, before MAGXX is changed back.
113 S X=$G(^MAG(2005,MAGXX,0))
114 S FNL=$S(+$P(X,"^",3):$P(X,"^",3),1:+$P(X,"^",5))
115 S PLC=$P($G(MAGJOB("NETPLC",FNL)),"^",1)
116 S PLCODE=$P($G(MAGJOB("NETPLC",FNL)),"^",2)
117 ; if we were using first image of a group, reset the Real IEN
118 I $G(GRPIEN) S MAGXX=GRPIEN
119 ;
120 ; we have to change the OBJECT TYPE variable back to real value
121 ; MAGOBJT might have been changed if we had Group of no images.
122 ; but we need to keep it changed, because Delphi window checks this
123 ; entry to determine which window to open.
124 ; i.e. Group window, Single image window,
125 S MAGOBJT=$P(MAGN0,U,6)
126 ;
127 ; now start building the return string
128 ;
129 S PATCH=$P($G(MAGJOB("VERSION")),".",3) ; //'="3.0.8")
130 K MAGFILE
131 S $P(MAGFILE,U,25)="" ; We put extra '^^^' on end of String to stop error in Delphi.
132 ;
133 ; $P(1^2^3) IEN^Image FullPath and name^Abstract FullPath and Name
134 S $P(MAGFILE,U,1,3)=MAGXX_U_FULLFILE_U_ABSFILE
135 S $P(MAGFILE,U,18)=BIGFILE
136 ;
137 ; now set $P(4) SHORT DESCRIPTION field and desc of offline JukeBox
138 S $P(MAGFILE,U,4)=$P(MAGN2,U,4)_$G(MAGJBOL)
139 ;
140 ; now set $P(5)PROCEDURE/ EXAM DATE/TIME field
141 S $P(MAGFILE,U,5)=$P(MAGN2,U,5)
142 ;
143 ; now set $P(6) OBJECT TYPE
144 S $P(MAGFILE,U,6)=MAGOBJT
145 ;
146 ; now set $P(7) PROCEDURE field
147 S $P(MAGFILE,U,7)=$P(MAGN0,U,8)
148 ;
149 ; now we're making a DATE to display and will use it for a sort in
150 ; the delphi TStringGrid so we display mm/dd/yyyy
151 ; now set $P(8) display date
152 S X=$P($P(MAGN2,"^",5),".",1)
153 I X'="" S X=$E(X,4,5)_"/"_$E(X,6,7)_"/"_($E(X,1,3)+1700)
154 S $P(MAGFILE,U,8)=X
155 ;
156 ; now return the PARENT DATA FILE image pointer
157 S $P(MAGFILE,U,9)=$P(MAGN2,U,8)
158 ;
159 ; now return the ABSTYPE ( this is 'M' or 'W' or 'O' )
160 ; 'M' magnetic 'W' worm 'O' offline
161 S $P(MAGFILE,U,10)=ABSTYPE
162 ;
163 ; now return the code to show if full res image is offline 'A' or 'O'
164 ; 'A' accessible 'O' offline
165 S $P(MAGFILE,U,11)=FULLTYPE
166 ;
167 ; 2/1/99 Dicom Series number and Dicom Image Number
168 ; $p(12) and $p(13)
169 ;
170 ; lets add the count of images , if this is a group
171 S X=+$P($G(^MAG(2005,MAGXX,1,0)),U,4),$P(MAGFILE,U,14)=$S(X:X,1:1)
172 ;
173 ; $p(15^16 ) are SiteIEN and SiteCode Consolidation - DBI
174 ; We use SiteIEN and SiteCODE from above
175 S $P(MAGFILE,"^",15)=PLC
176 S $P(MAGFILE,"^",16)=PLCODE
177 ;
178 ; $p(17) 8/22/01 GEK Mod for integrity check.
179 I '$G(MAGNOCHK) D CHK^MAGGSQI(.MAGQI,MAGXX) I 'MAGQI(0) D
180 . ; remove the Abstract and Image File Names ; 2/14/03 remove c:\program files... with .\bmp\
181 . S $P(MAGFILE,U,2,3)="-1~Questionable Data Integrity^.\bmp\imageQA.bmp"
182 . ;this stops Delphi App from changing Abstract BMP to OFFLINE IMAGE
183 . S $P(MAGFILE,U,6)=$S(($P(MAGFILE,U,6)'=11):"99",1:11)
184 . S $P(MAGFILE,U,10)="M"
185 . ;Send the error message
186 . S $P(MAGFILE,U,17)=$P(MAGQI(0),U,2)
187 ; $p(18) is BIGFile Full name and path. ( set above)
188 ; Patches prior to 8, only had 17 pieces of data. this will speed up their listings.
189 ; Patch 8 had New M rtn MAGSIXG1, if it doesn't exist, this is PRE - 8.
190 I '$L($T(PGI^MAGSIXG1)) Q
191 S $P(MAGFILE,U,19)=$P(MAGN0,U,7) ; DFN
192 ; P48T1 The change to speed up access to large groups left out patient name.
193 ;S $P(MAGFILE,U,20)=$$GET1^DIQ(2,$P(MAGN0,U,7)_",",.01) ; Patient Name
194 S $P(MAGFILE,U,20)=MAGJOB("PTNM",MDFN)
195 S $P(MAGFILE,U,21)=$S(+$P(MAGN40,U,2):$P(^MAG(2005.82,$P(MAGN40,U,2),0),U),1:"")
196 ; Stop displaying a Group of 1 as a Group, so here we'll change Object type
197 ; to that of the '1ST' image in the group of 1.
198 I $P($G(^MAG(2005,MAGXX,1,0)),U,4)=1 D
199 . S X=$O(^MAG(2005,MAGXX,1,0))
200 . S X=+^MAG(2005,MAGXX,1,X,0)
201 . S $P(MAGFILE,U,6)=$P(^MAG(2005,X,0),U,6) ; OBJECT TYPE OF 1ST IMAGE IN GROUP
202 . S $P(MAGFILE,U,1)=X
203 . ; Need Site and Site code of
204 Q
Note: See TracBrowser for help on using the repository browser.