Produced by Araxis Merge on 3/25/2019 8:58:07 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | C:\AraxisMergeCompare\Pri_un\IMAG_Source\VISA\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource | AbstractBaseVistaImagingExternalPackageDataSourceService.java | Mon Mar 18 20:39:07 2019 UTC |
2 | C:\AraxisMergeCompare\Pri_re\IMAG_Source\VISA\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource | AbstractBaseVistaImagingExternalPackageDataSourceService.java | Tue Mar 19 12:04:22 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 1194 |
Changed | 2 | 4 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | /** | |
2 | * | |
3 | Package: MAG - Vis tA Imaging | |
4 | WARNING: Per VHA D irective 2 004-038, t his routin e should n ot be modi fied. | |
5 | Date Cre ated: May 27, 2009 | |
6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
7 | Developer: DNS werfej | |
8 | Descript ion: | |
9 | ||
10 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
11 | ;; Property of the US Government . | |
12 | ;; No permis sion to co py or redi stribute t his softwa re is give n. | |
13 | ;; Use of un released v ersions of this soft ware requi res the us er | |
14 | ;; to execu te a writt en test ag reement wi th the Vis tA Imaging | |
15 | ;; Developm ent Office of the De partment o f Veterans Affairs, | |
16 | ;; telephon e (301) 73 4-0100. | |
17 | ;; | |
18 | ;; The Food and Drug A dministrat ion classi fies this software a s | |
19 | ;; a Class I I medical device. A s such, it may not b e changed | |
20 | ;; in any wa y. Modifi cations to this soft ware may r esult in a n | |
21 | ;; adulterat ed medical device un der 21CFR8 20, the us e of which | |
22 | ;; is consid ered to be a violati on of US F ederal Sta tutes. | |
23 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
24 | ||
25 | */ | |
26 | package go v.va.med.i maging.vis taimagingd atasource; | |
27 | ||
28 | import jav a.io.IOExc eption; | |
29 | import jav a.util.Arr ayList; | |
30 | import jav a.util.Ite rator; | |
31 | import jav a.util.Lis t; | |
32 | import jav a.util.Sor tedSet; | |
33 | import jav a.util.Tre eSet; | |
34 | ||
35 | import org .apache.lo gging.log4 j.LogManag er; | |
36 | import org .apache.lo gging.log4 j.Logger; | |
37 | ||
38 | import gov .va.med.Pa tientIdent ifier; | |
39 | import gov .va.med.Ro utingToken ; | |
40 | import gov .va.med.im aging.Cprs Identifier ; | |
41 | import gov .va.med.im aging.Cprs Identifier .CprsIdent ifierType; | |
42 | import gov .va.med.im aging.Stri ngUtil; | |
43 | import gov .va.med.im aging.arti factsource .ResolvedA rtifactSou rce; | |
44 | import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on; | |
45 | import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception; | |
46 | import gov .va.med.im aging.core .interface s.exceptio ns.Patient NotFoundEx ception; | |
47 | import gov .va.med.im aging.core .interface s.exceptio ns.Securit yCredentia lsExpiredE xception; | |
48 | import gov .va.med.im aging.data source.Ext ernalPacka geDataSour ceSpi; | |
49 | import gov .va.med.im aging.data source.exc eptions.In validCrede ntialsExce ption; | |
50 | import gov .va.med.im aging.data source.exc eptions.Un supportedS erviceMeth odExceptio n; | |
51 | import gov .va.med.im aging.exch ange.busin ess.Image; | |
52 | import gov .va.med.im aging.exch ange.busin ess.Resolv edSite; | |
53 | import gov .va.med.im aging.exch ange.busin ess.Series ; | |
54 | import gov .va.med.im aging.exch ange.busin ess.Site; | |
55 | import gov .va.med.im aging.exch ange.busin ess.Study; | |
56 | import gov .va.med.im aging.exch ange.busin ess.StudyF ilter; | |
57 | import gov .va.med.im aging.exch ange.enums .ObjectOri gin; | |
58 | import gov .va.med.im aging.exch ange.enums .StudyDele tedImageSt ate; | |
59 | import gov .va.med.im aging.exch ange.enums .StudyLoad Level; | |
60 | import gov .va.med.im aging.prot ocol.vista .VistaImag ingTransla tor; | |
61 | import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ; | |
62 | import gov .va.med.im aging.url. vista.Vist aQuery; | |
63 | import gov .va.med.im aging.url. vista.exce ptions.Inv alidVistaC redentials Exception; | |
64 | import gov .va.med.im aging.url. vista.exce ptions.Vis taMethodEx ception; | |
65 | import gov .va.med.im aging.vist adatasourc e.common.V istaCommon Utilities; | |
66 | import gov .va.med.im aging.vist adatasourc e.session. VistaSessi on; | |
67 | import gov .va.med.im aging.vist aimagingda tasource.c ommon.Vist aImagingCo mmonUtilit ies; | |
68 | import gov .va.med.im aging.vist aimagingda tasource.c ommon.Vist aSessionFa ctory; | |
69 | import gov .va.med.im aging.vist aobjects.V istaGroup; | |
70 | import gov .va.med.im aging.vist aobjects.V istaImage; | |
71 | ||
72 | ||
73 | /** | |
74 | * @author DNS werfej | |
75 | * | |
76 | */ | |
77 | public abs tract clas s Abstract BaseVistaI magingExte rnalPackag eDataSourc eService | |
78 | extends Ab stractVist aImagingDa taSourceSe rvice | |
79 | implements ExternalP ackageData SourceSpi, VistaSess ionFactory | |
80 | { | |
81 | ||
82 | pr ivate fina l static L ogger logg er = | |
83 | LogM anager.get Logger(Abs tractBaseV istaImagin gExternalP ackageData SourceServ ice.class) ; | |
84 | pu blic final static St ring SUPPO RTED_PROTO COL = "vis taimaging" ; | |
85 | ||
86 | /* * | |
87 | * @param re solvedArti factSource | |
88 | * @param pr otocol | |
89 | * / | |
90 | pu blic Abstr actBaseVis taImagingE xternalPac kageDataSo urceServic e(Resolved ArtifactSo urce resol vedArtifac tSource, | |
91 | Stri ng protoco l) | |
92 | { | |
93 | supe r(resolved ArtifactSo urce, prot ocol); | |
94 | if(! (resolved ArtifactSo urce insta nceof Reso lvedSite) ) | |
95 | throw new Unsupp ortedOpera tionExcept ion("The a rtifact so urce must be an inst ance of Re solvedSite and it is a '" + re solvedArti factSource .getClass( ).getSimpl eName() + "'."); | |
96 | } | |
97 | ||
98 | pr otected ab stract Str ing getDat aSourceVer sion(); | |
99 | ||
100 | /* * | |
101 | * The artif act source must be c hecked in the constr uctor to a ssure that it is an instance | |
102 | * of Resolv edSite. | |
103 | * | |
104 | * @return | |
105 | * / | |
106 | pr otected Re solvedSite getResolv edSite() | |
107 | { | |
108 | retu rn (Resolv edSite)get ResolvedAr tifactSour ce(); | |
109 | } | |
110 | ||
111 | pr otected Si te getSite () | |
112 | { | |
113 | retu rn getReso lvedSite() .getSite() ; | |
114 | } | |
115 | ||
116 | pr otected Lo gger getLo gger() | |
117 | { | |
118 | retu rn logger; | |
119 | } | |
120 | ||
121 | /* * | |
122 | * Return th e required version o f VistA Im aging nece ssary to u se this se rvice | |
123 | * @return | |
124 | * / | |
125 | pr otected ab stract Str ing getReq uiredVista ImagingVer sion(); | |
126 | ||
127 | /* * | |
128 | * Fully pop ulate a st udy with t he images in the stu dy. Differ ent implem entations will do th is | |
129 | * different ly | |
130 | * | |
131 | * @param vi staSession | |
132 | * @param gr oup | |
133 | * @param pa tientDfn | |
134 | * @return | |
135 | * @throws I nvalidVist aCredentia lsExceptio n | |
136 | * @throws V istaMethod Exception | |
137 | * @throws I OException | |
138 | * / | |
139 | pr otected ab stract Stu dy fullyPo pulateGrou pIntoStudy ( | |
140 | Vist aSession v istaSessio n, | |
141 | Stud y study, | |
142 | Stri ng patient Dfn) | |
143 | th rows Inval idVistaCre dentialsEx ception, V istaMethod Exception, IOExcepti on; | |
144 | ||
145 | /* (non-Java doc) | |
146 | * @see gov. va.med.ima ging.datas ource.Exte rnalPackag eDataSourc e#isVersio nCompatibl e() | |
147 | * / | |
148 | @O verride | |
149 | pu blic boole an isVersi onCompatib le() | |
150 | th rows Secur ityCredent ialsExpire dException | |
151 | { | |
152 | Vist aSession l ocalVistaS ession = n ull; | |
153 | logg er.info("i sVersionCo mpatible s earching f or version [" + getR equiredVis taImagingV ersion() + "], Trans actionCont ext (" + T ransaction ContextFac tory.get() .getDispla yIdentity( ) + ")."); | |
154 | try | |
155 | { | |
156 | localV istaSessio n = getVis taSession( ); | |
157 | return VistaImag ingCommonU tilities.i sVersionCo mpatible(g etRequired VistaImagi ngVersion( ), | |
158 | localVista Session); | |
159 | } | |
160 | catc h(Security Credential sExpiredEx ception sc eX) | |
161 | { | |
162 | // cau ght here t o be sure it gets th rown as Se curityCred entialsExp iredExcept ion, not C onnectionE xception | |
163 | throw sceX; | |
164 | } | |
165 | catc h(MethodEx ception mX ) | |
166 | { | |
167 | logger .error("Th ere was an error fin ding the i nstalled I maging ver sion from VistA", mX ); | |
168 | Transa ctionConte xtFactory. get().addD ebugInform ation("isV ersionComp atible() f ailed, " + (mX == nu ll ? "<nul l error>" : mX.getMe ssage())); | |
169 | } | |
170 | catc h(Connecti onExceptio n cX) | |
171 | { | |
172 | logger .error("Th ere was an error fin ding the i nstalled I maging ver sion from VistA", cX ); | |
173 | Transa ctionConte xtFactory. get().addD ebugInform ation("isV ersionComp atible() f ailed, " + (cX == nu ll ? "<nul l error>" : cX.getMe ssage())); | |
174 | } | |
175 | catc h(IOExcept ion ioX) | |
176 | { | |
177 | logger .error("Th ere was an error fin ding the i nstalled I maging ver sion from VistA", io X); | |
178 | Transa ctionConte xtFactory. get().addD ebugInform ation("isV ersionComp atible() f ailed, " + (ioX == n ull ? "<nu ll error>" : ioX.get Message()) ); | |
179 | } | |
180 | fina lly | |
181 | { | |
182 | try{lo calVistaSe ssion.clos e();} | |
183 | catch( Throwable t){} | |
184 | } | |
185 | retu rn false; | |
186 | } | |
187 | ||
188 | /* * | |
189 | * | |
190 | * @see gov. va.med.ima ging.datas ource.Exte rnalPackag eDataSourc e#getStudy FromCprsId entifier(j ava.lang.S tring, gov .va.med.im aging.Cprs Identifier ) | |
191 | * / | |
192 | @O verride | |
193 | pu blic List< Study> get StudiesFro mCprsIdent ifier( | |
194 | Routin gToken glo balRouting Token, | |
195 | String patientIc n, | |
196 | CprsId entifier c prsIdentif ier) | |
197 | th rows Metho dException , Connecti onExceptio n | |
198 | { | |
199 | Vist aCommonUti lities.set DataSource MethodAndV ersion("ge tStudiesFr omCprsIden tifier", g etDataSour ceVersion( )); | |
200 | Vist aSession v istaSessio n = null; | |
201 | getL ogger().in fo("getStu dyFromCprs Identifier (" + patie ntIcn + | |
202 | ", " + c prsIdentif ier + | |
203 | ") Trans actionCont ext (" + T ransaction ContextFac tory.get() .getTransa ctionId() + ")."); | |
204 | try | |
205 | { | |
206 | vistaS ession = g etVistaSes sion(); | |
207 | ||
208 | List<V istaImage> vistaImag es = null; | |
209 | if(cpr sIdentifie r.getCprsI dentifierT ype() == C prsIdentif ierType.TI U) | |
210 | { | |
211 | vistaIma ges = getV istaImageL istFromTiu Note(vista Session, c prsIdentif ier); | |
212 | } | |
213 | else i f(cprsIden tifier.get CprsIdenti fierType() == CprsId entifierTy pe.RAD_EXA M) | |
214 | { | |
215 | vistaIma ges = getV istaImageL istFromRad Exam(vista Session, c prsIdentif ier); | |
216 | } | |
217 | else | |
218 | { | |
219 | throw ne w MethodEx ception("U nknown Cpr sIdentifie r Type for CprsIdent ifier '" + cprsIdent ifier.getC prsIdentif ier() + "' "); | |
220 | } | |
221 | ||
222 | getLog ger().info ("Found '" + vistaIm ages.size( ) + "' ima ges from c prs identi fier"); | |
223 | if(vis taImages.s ize() <= 0 ) | |
224 | // retur n null? | |
225 | return n ull; | |
226 | Patien tIdentifie r patientI dentifier = PatientI dentifier. icnPatient Identifier (patientIc n); | |
227 | ||
228 | List<S tudy> stud ies = find StudiesFor Images(vis taSession, patientId entifier, vistaImage s, cprsIde ntifier); | |
229 | getLog ger().info ("Found '" + studies .size() + "' studies from the images ass ociated wi th the cpr s identifi er."); | |
230 | ||
231 | //Fill contextID and Alter nateExamNu mber | |
232 | for(St udy study: studies) | |
233 | { | |
234 | study.se tContextId (cprsIdent ifier.getC prsIdentif ier()); | |
235 | String a lternateEx amNumber = StringUti l.Piece(cp rsIdentifi er.getCprs Identifier (),StringU til.CARET, 5); | |
236 | if(cprsI dentifier. getCprsIde ntifierTyp e() == Cpr sIdentifie rType.TIU) | |
237 | { | |
238 | study.setA lternateEx amNumber(" TIU-" + al ternateExa mNumber); | |
239 | } | |
240 | else if( cprsIdenti fier.getCp rsIdentifi erType() = = CprsIden tifierType .RAD_EXAM) | |
241 | { | |
242 | study.setA lternateEx amNumber(" RA DT-" + alternateE xamNumber) ; | |
243 | } | |
244 | } | |
245 | ||
246 | ||
247 | // tem p until me thod signa ture is ch anged | |
248 | return studies; | |
249 | } | |
250 | catc h(VistaMet hodExcepti on vmX) | |
251 | { | |
252 | throw new Method Exception( vmX); | |
253 | } | |
254 | catc h(InvalidV istaCreden tialsExcep tion icX) | |
255 | { | |
256 | throw new Invali dCredentia lsExceptio n(icX); | |
257 | } | |
258 | catc h(IOExcept ion ioX) | |
259 | { | |
260 | throw new Connec tionExcept ion(ioX); | |
261 | } | |
262 | fina lly | |
263 | { | |
264 | try{vi staSession .close();} | |
265 | catch( Throwable t){} | |
266 | } | |
267 | } | |
268 | ||
269 | @O verride | |
270 | pu blic List< Study> get StudiesFro mCprsIdent ifierAndFi lter( | |
271 | Routin gToken glo balRouting Token, | |
272 | String patientIc n, | |
273 | CprsId entifier c prsIdentif ier, | |
274 | StudyF ilter filt er) | |
275 | throws MethodExc eption, Co nnectionEx ception { | |
276 | thro w new Unsu pportedSer viceMethod Exception( ExternalPa ckageDataS ourceSpi.c lass, "get StudiesFro mCprsIdent ifierAndFi lter"); | |
277 | } | |
278 | ||
279 | ||
280 | /* * | |
281 | * | |
282 | * @see gov. va.med.ima ging.datas ource.Exte rnalPackag eDataSourc e#postStud iesFromCpr sIdentifie rs(java.la ng.String, gov.va.me d.imaging. CprsIdenti fier) | |
283 | * / | |
284 | @O verride | |
285 | pu blic List< Study> pos tStudiesFr omCprsIden tifiers( | |
286 | Routin gToken glo balRouting Token, | |
287 | Patien tIdentifie r patientI dentifier, | |
288 | List<C prsIdentif ier> cprsI dentifiers ) | |
289 | th rows Metho dException , Connecti onExceptio n | |
290 | { | |
291 | thro w new Unsu pportedSer viceMethod Exception( ExternalPa ckageDataS ourceSpi.c lass, "pos tStudiesFr omCprsIden tifiers"); | |
292 | } | |
293 | ||
294 | @O verride | |
295 | pu blic List< Study> pos tStudiesFr omCprsIden tifiersAnd Filter( | |
296 | Routin gToken glo balRouting Token, | |
297 | Patien tIdentifie r patientI dentifier, | |
298 | List<C prsIdentif ier> cprsI dentifiers , StudyFil ter filter ) | |
299 | th rows Metho dException , Connecti onExceptio n | |
300 | { | |
301 | thro w new Unsu pportedSer viceMethod Exception( ExternalPa ckageDataS ourceSpi.c lass, "pos tStudiesFr omCprsIden tifiersAnd Filter"); | |
302 | } | |
303 | ||
304 | @O verride | |
305 | pu blic List< Study> pos tViewerStu diesForQaR eview( | |
306 | Routin gToken glo balRouting Token, | |
307 | StudyF ilter filt er) | |
308 | th rows Metho dException , Connecti onExceptio n | |
309 | { | |
310 | thro w new Unsu pportedSer viceMethod Exception( ExternalPa ckageDataS ourceSpi.c lass, "pos tViewerStu diesForQaR eview"); | |
311 | } | |
312 | ||
313 | pr ivate List <Study> fi ndStudiesF orImages(V istaSessio n vistaSes sion, Pati entIdentif ier patien tIdentifie r, | |
314 | List<V istaImage> vistaImag es, CprsId entifier c prsIdentif ier) | |
315 | th rows Inval idVistaCre dentialsEx ception, I OException , VistaMet hodExcepti on, Connec tionExcept ion, Metho dException | |
316 | { | |
317 | List <Study> re sult = new ArrayList <Study>(); | |
318 | Sort edSet<Stud y> groups = null; | |
319 | Stri ng patient Dfn = null ; | |
320 | whil e(vistaIma ges.size() > 0) | |
321 | { | |
322 | int im ageCount = vistaImag es.size(); | |
323 | getLog ger().info ("Currentl y '" + vis taImages.s ize() + "' images fr om CPRS id entifier, finding st udies cont aining ima ges."); | |
324 | VistaI mage vista Image = vi staImages. get(0); | |
325 | String groupIen = findGrou pIen(vista Session, v istaImage) ; | |
326 | // onl y need to get the DF N once for the patie nt | |
327 | if(pat ientDfn == null) | |
328 | { | |
329 | patientD fn = getPa tientDfn(v istaSessio n, patient Identifier ); | |
330 | } | |
331 | ||
332 | // onl y need to get the gr oups once for the pa tient | |
333 | if(gro ups == nul l) | |
334 | { | |
335 | groups = findPatie ntGroups(v istaSessio n, patient Identifier , patientD fn); | |
336 | } | |
337 | Study study = fi ndStudy(vi staSession , groups, groupIen, vistaImage , patientD fn, cprsId entifier); | |
338 | result .add(study ); | |
339 | getLog ger().info ("Added st udy '" + s tudy.getSt udyUrn().t oString() + "' with '" + study .getImageC ount() + " ' images t o result." ); | |
340 | Iterat or<VistaIm age> image Iterator = vistaImag es.iterato r(); | |
341 | while( imageItera tor.hasNex t()) | |
342 | { | |
343 | VistaIma ge image = imageIter ator.next( ); | |
344 | if(isIma geInStudy( image, stu dy)) | |
345 | { | |
346 | imageItera tor.remove (); | |
347 | } | |
348 | } | |
349 | if(vis taImages.s ize() >= i mageCount) | |
350 | { | |
351 | // if th e image co unt has no t been red uced, this means the image was not found | |
352 | // so it will neve r be found so throw an excepti on to brea k out of t his loop | |
353 | // hopef ully this will never happen! | |
354 | throw ne w MethodEx ception("A ttempted t o process image '" + vistaImag e.getIen() + "' from site '" + getSite() .getSiteNu mber() + " ' but did not find a study con taining th is image. This will cause an i nfinite lo op, breaki ng now!"); | |
355 | } | |
356 | } | |
357 | ||
358 | retu rn result; | |
359 | } | |
360 | ||
361 | ||
362 | pr ivate bool ean isImag eInStudy(V istaImage vistaImage , Study st udy) | |
363 | { | |
364 | for( Series ser ies : stud y.getSerie s()) | |
365 | { | |
366 | for(Im age image : series) | |
367 | { | |
368 | if(image .getIen(). equals(vis taImage.ge tIen())) | |
369 | { | |
370 | return tru e; | |
371 | } | |
372 | } | |
373 | } | |
374 | retu rn false; | |
375 | } | |
376 | ||
377 | pr ivate Stud y findStud y(VistaSes sion vista Session, S ortedSet<S tudy> grou ps, String groupIen, | |
378 | VistaI mage image , String p atientDfn, CprsIdent ifier cprs Identifier ) | |
379 | th rows Metho dException , InvalidV istaCreden tialsExcep tion, Vist aMethodExc eption, IO Exception | |
380 | { | |
381 | Stud y group = null; | |
382 | try | |
383 | { | |
384 | for( Study stud y : groups ) | |
385 | { | |
386 | if(gro upIen.equa ls(study.g etStudyIen ())) | |
387 | { | |
388 | getLogge r().info(" Found grou p that mat ches group Ien from image list "); | |
389 | group = study; | |
390 | break; | |
391 | } | |
392 | if(ima ge.getIen( ).equals(s tudy.getSt udyIen())) | |
393 | { | |
394 | getLogge r().info(" Found grou p that mat ches first image in the CPRS i mage list response, implies th is is a si ngle image group wit h an image node"); | |
395 | group = study; | |
396 | break; | |
397 | } | |
398 | } | |
399 | getLog ger().info ("Fully po pulating g roup '" + group.getS tudyIen() + "' with images and returning study."); | |
400 | return fullyPopu lateGroupI ntoStudy(v istaSessio n, group, patientDfn ); | |
401 | } | |
402 | catc h (Excepti on e) | |
403 | { | |
404 | getLog ger().erro r(e); | |
405 | throw new Method Exception( e); | |
406 | } | |
407 | } | |
408 | ||
409 | pr ivate Stri ng findGro upIen(Vist aSession v istaSessio n, VistaIm age vistaI mage) | |
410 | th rows Inval idVistaCre dentialsEx ception, I OException , VistaMet hodExcepti on | |
411 | { | |
412 | Stri ng imageIe n = vistaI mage.getIe n(); | |
413 | getL ogger().in fo("Findin g group fo r image IE N '" + ima geIen + "' "); | |
414 | Vist aQuery get GroupIenQu ery = Vist aImagingQu eryFactory .createGet ImageGroup IENVistaQu ery(imageI en); | |
415 | Stri ng groupIe nResult = vistaSessi on.call(ge tGroupIenQ uery); | |
416 | Stri ng groupIe n = VistaI magingTran slator.ext ractGroupI enFromNode 0Response( groupIenRe sult); | |
417 | if(g roupIen == null) | |
418 | { | |
419 | getLog ger().info ("Group IE N is null, indicatin g image fo und is gro up IEN alr eady, usin g imageIen '" + imag eIen + "' as group I EN"); | |
420 | groupI en = image Ien; | |
421 | } | |
422 | else | |
423 | { | |
424 | getLog ger().info ("Found gr oup IEN '" + groupIe n + "' for image '" + vistaIma ge.getIen( ) + "'."); | |
425 | } | |
426 | retu rn groupIe n; | |
427 | } | |
428 | ||
429 | pr ivate Sort edSet<Stud y> findPat ientGroups (VistaSess ion vistaS ession, | |
430 | Patien tIdentifie r patientI dentifier, String pa tientDfn) | |
431 | th rows IOExc eption, Me thodExcept ion, Conne ctionExcep tion | |
432 | { | |
433 | ||
434 | Sort edSet<Stud y> groups = getPatie ntGroups( | |
435 | vistaS ession, | |
436 | getSit e(), | |
437 | null, | |
438 | patien tIdentifie r, | |
439 | patien tDfn); | |
440 | retu rn groups; | |
441 | } | |
442 | ||
443 | ||
444 | /* * | |
445 | * Retrieve the list o f images f rom a TIU note ident ifier | |
446 | * | |
447 | * @param vi staSession | |
448 | * @param pa tientIcn | |
449 | * @param cp rsIdentifi er | |
450 | * @return | |
451 | * @throws M ethodExcep tion | |
452 | * @throws I OException | |
453 | * @throws C onnectionE xception | |
454 | * / | |
455 | pr ivate List <VistaImag e> getVist aImageList FromTiuNot e( | |
456 | Vist aSession v istaSessio n, | |
457 | Cprs Identifier cprsIdent ifier) | |
458 | th rows Metho dException , IOExcept ion, Conne ctionExcep tion | |
459 | { | |
460 | getL ogger().in fo("getIma geListFrom TiuNote(" + cprsIden tifier + " ) executin g."); | |
461 | try | |
462 | { | |
463 | VistaQ uery query = VistaIm agingQuery Factory.cr eateGetIma gesForCprs TiuNote(cp rsIdentifi er); | |
464 | String imageList Rtn = vist aSession.c all(query) ; | |
465 | List<V istaImage> vistaImag es = Vista ImagingTra nslator.ex tractVista ImageListF romVistaRe sult(image ListRtn); | |
466 | ||
467 | return vistaImag es; | |
468 | } | |
469 | catc h(VistaMet hodExcepti on vmX) | |
470 | { | |
471 | throw new Method Exception( vmX); | |
472 | } | |
473 | catc h(InvalidV istaCreden tialsExcep tion icX) | |
474 | { | |
475 | throw new Invali dCredentia lsExceptio n(icX); | |
476 | } | |
477 | } | |
478 | ||
479 | /* * | |
480 | * Retrieve the list o f images f rom a Rad exam ident ifier | |
481 | * | |
482 | * @param vi staSession | |
483 | * @param pa tientIcn | |
484 | * @param cp rsIdentifi er | |
485 | * @return | |
486 | * @throws M ethodExcep tion | |
487 | * @throws I OException | |
488 | * @throws C onnectionE xception | |
489 | * / | |
490 | pr ivate List <VistaImag e> getVist aImageList FromRadExa m( | |
491 | Vist aSession v istaSessio n, | |
492 | Cprs Identifier cprsIdent ifier) | |
493 | th rows Metho dException , IOExcept ion, Conne ctionExcep tion | |
494 | { | |
495 | getL ogger().in fo("getIma geListFrom RadExam(" + cprsIden tifier + " ) executin g."); | |
496 | try | |
497 | { | |
498 | VistaQ uery query = VistaIm agingQuery Factory.cr eateGetIma gesForCprs RadExam(cp rsIdentifi er); | |
499 | String imageList Rtn = vist aSession.c all(query) ; | |
500 | List<V istaImage> vistaImag es = Vista ImagingTra nslator.ex tractVista ImageListF romVistaRe sult(image ListRtn); | |
501 | ||
502 | return vistaImag es; | |
503 | } | |
504 | catc h(VistaMet hodExcepti on vmX) | |
505 | { | |
506 | throw new Method Exception( vmX); | |
507 | } | |
508 | catc h(InvalidV istaCreden tialsExcep tion icX) | |
509 | { | |
510 | throw new Invali dCredentia lsExceptio n(icX); | |
511 | } | |
512 | } | |
513 | ||
514 | ||
515 | pu blic Vista Session ge tVistaSess ion() | |
516 | throws IOExcepti on, Connec tionExcept ion, Metho dException , Security Credential sExpiredEx ception | |
517 | { | |
518 | return V istaSessio n.getOrCre ate(getMet adataUrl() , getSite( )); | |
519 | } | |
520 | ||
521 | ||
522 | pr otected So rtedSet<St udy> getPa tientGroup s(VistaSes sion sessi on, Site s ite, | |
523 | StudyF ilter filt er, Patien tIdentifie r patientI dentifier) | |
524 | th rows Metho dException , IOExcept ion, Conne ctionExcep tion | |
525 | { | |
526 | retu rn getPati entGroups( session, s ite, filte r, patient Identifier , null); | |
527 | } | |
528 | ||
529 | /* * | |
530 | * | |
531 | * @param se ssion | |
532 | * @param si te - the V istaImagin g site tha t we are g etting the data from (the site that the session is connected to) | |
533 | * @param fi lter - the criteria to filter the result set on | |
534 | * @param pa tientIcn | |
535 | * @param pa tientDfn | |
536 | * @return | |
537 | * @throws M ethodExcep tion | |
538 | * @throws I OException | |
539 | * @throws C onnectionE xception | |
540 | * / | |
541 | pr otected So rtedSet<St udy> getPa tientGroup s( | |
542 | Vist aSession s ession, | |
543 | Site site, | |
544 | Stud yFilter fi lter, | |
545 | Pati entIdentif ier patien tIdentifie r, | |
546 | Stri ng patient Dfn) | |
547 | th rows Metho dException , IOExcept ion, Conne ctionExcep tion | |
548 | { | |
549 | logg er.info("g etPatientG roups(" + patientIde ntifier + ") Transac tionContex t (" + Tra nsactionCo ntextFacto ry.get().g etDisplayI dentity() + ")."); | |
550 | ||
551 | // f ilter resu lts based on the pat ient sensi tivity | |
552 | tr y | |
553 | { | |
554 | if(( patientDfn == null) || (patien tDfn.lengt h() <= 0)) | |
555 | patien tDfn = get PatientDfn (session, patientIde ntifier); | |
556 | } | |
557 | ca tch(Patien tNotFoundE xception p nfX) | |
558 | { | |
559 | thro w new Meth odExceptio n(pnfX); | |
560 | } | |
561 | Vist aQuery vm = VistaIma gingQueryF actory.cre ateGetGrou psVistaQue ry(patient Dfn, filte r); | |
562 | ||
563 | Stri ng rtn = n ull; | |
564 | try | |
565 | { | |
566 | rtn = session.ca ll(vm); | |
567 | // che ck to be s ure first character is a 1 (me ans result is ok) | |
568 | ||
569 | // if no images for patien t, respons e is [0^No images fo r filter: All Images ] | |
570 | ||
571 | if(rtn .charAt(0) == '1') | |
572 | { | |
573 | SortedSe t<VistaGro up> groups = VistaIm agingTrans lator.crea teGroupsFr omGroupLin esHandleSi ngleImageG roup( | |
574 | site, rtn, patientId entifier, StudyLoadL evel.FULL, StudyDele tedImageSt ate.cannot IncludeDel etedImages ); | |
575 | return V istaImagin gTranslato r.transfor m(ObjectOr igin.VA, s ite, group s); | |
576 | } | |
577 | else i f(rtn.star tsWith("0^ No images for filter ")) | |
578 | { | |
579 | logger.i nfo("0 res ponse from MAG4 PAT GET IMAGES rpc, no i mages foun d, [" + rt n + "]"); | |
580 | return n ew TreeSet <Study>(); | |
581 | } | |
582 | else i f(rtn.star tsWith("0^ No Such Pa tient:")) | |
583 | { | |
584 | logger.i nfo("0 res ponse from MAG4 PAT GET IMAGES rpc, [" + rtn + "]" ); | |
585 | throw ne w VistaMet hodExcepti on("No pat ient [ "+ patientIde ntifier + "] found i n database "); | |
586 | } | |
587 | else | |
588 | { | |
589 | logger.i nfo("0 res ponse from MAG4 PAT GET IMAGES rpc, [" + rtn + "]" ); | |
590 | throw ne w VistaMet hodExcepti on(rtn); | |
591 | } | |
592 | } | |
593 | catc h (Excepti on ex) | |
594 | { | |
595 | logger .error(ex) ; | |
596 | throw new Method Exception( ex); | |
597 | } | |
598 | } | |
599 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.