Produced by Araxis Merge on 12/5/2017 12:06:50 PM Central Standard 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 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource | VistaImagingStudyGraphDataSourceService.java | Mon Dec 4 21:34:50 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\vistaimagingdatasource | VistaImagingStudyGraphDataSourceService.java | Mon Dec 4 22:06:53 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1748 |
| Changed | 1 | 2 |
| 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: Jan 7, 2008 | |
| 6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
| 7 | Develope r: | |
| 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 gov .va.med.Gl obalArtifa ctIdentifi er; | |
| 29 | import gov .va.med.Pa tientIdent ifier; | |
| 30 | import gov .va.med.Ro utingToken ; | |
| 31 | import gov .va.med.UR NFactory; | |
| 32 | import gov .va.med.im aging.Stud yURN; | |
| 33 | import gov .va.med.im aging.arti factsource .ResolvedA rtifactSou rce; | |
| 34 | import gov .va.med.im aging.core .interface s.exceptio ns.Connect ionExcepti on; | |
| 35 | import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception; | |
| 36 | import gov .va.med.im aging.exce ptions.URN FormatExce ption; | |
| 37 | import gov .va.med.im aging.exch ange.busin ess.Site; | |
| 38 | import gov .va.med.im aging.exch ange.busin ess.Study; | |
| 39 | import gov .va.med.im aging.exch ange.busin ess.StudyF ilter; | |
| 40 | import gov .va.med.im aging.exch ange.busin ess.StudyS etResult; | |
| 41 | import gov .va.med.im aging.exch ange.enums .StudyDele tedImageSt ate; | |
| 42 | import gov .va.med.im aging.exch ange.enums .StudyLoad Level; | |
| 43 | import gov .va.med.im aging.prot ocol.vista .VistaImag ingTransla tor; | |
| 44 | import gov .va.med.im aging.core .interface s.exceptio ns.Patient NotFoundEx ception; | |
| 45 | import gov .va.med.im aging.tran sactioncon text.Trans actionCont extFactory ; | |
| 46 | import gov .va.med.im aging.url. vista.Stri ngUtils; | |
| 47 | import gov .va.med.im aging.url. vista.Vist aQuery; | |
| 48 | import gov .va.med.im aging.url. vista.exce ptions.Inv alidVistaC redentials Exception; | |
| 49 | import gov .va.med.im aging.url. vista.exce ptions.Vis taMethodEx ception; | |
| 50 | import gov .va.med.im aging.vist adatasourc e.common.V istaCommon Utilities; | |
| 51 | import gov .va.med.im aging.vist adatasourc e.session. VistaSessi on; | |
| 52 | import gov .va.med.im aging.vist aimagingda tasource.c ommon.Vist aImagingCo mmonUtilit ies; | |
| 53 | import gov .va.med.im aging.vist aobjects.V istaGroup; | |
| 54 | ||
| 55 | import jav a.io.IOExc eption; | |
| 56 | import jav a.util.Has hMap; | |
| 57 | import jav a.util.Map ; | |
| 58 | import jav a.util.Sor tedSet; | |
| 59 | import jav a.util.Tre eSet; | |
| 60 | ||
| 61 | import org .apache.lo gging.log4 j.LogManag er; | |
| 62 | import org .apache.lo gging.log4 j.Logger; | |
| 63 | ||
| 64 | /** | |
| 65 | * An impl ementation of a Stud yGraphData SourceSpi that talks to VistA. | |
| 66 | * | |
| 67 | * NOTE: | |
| 68 | * 1.) pub lic method s that do Vista acce ss (partic ularly any thing defi ned | |
| 69 | * in the StudyGraph DataSource Spi interf ace) must acquire a VistaSessi on instanc e using | |
| 70 | * getVist aSession() . | |
| 71 | * 2.) pri vate metho ds which a re only ca lled from public met hods that do Vista a ccess | |
| 72 | * must in clude a Vi staSession parameter , they sho uld not ac quire thei r own Vist aSession | |
| 73 | * 3.) Whe re a metho d is both public and called fr om within this class , there sh ould be a | |
| 74 | * public version fo llowing ru le 1, call ing a priv ate versio n followin g rule 2. | |
| 75 | * | |
| 76 | * @author
|
|
| 77 | * | |
| 78 | */ | |
| 79 | public cla ss VistaIm agingStudy GraphDataS ourceServi ce | |
| 80 | extends Ab stractBase VistaImagi ngStudyGra phService | |
| 81 | { | |
| 82 | pu blic final static St ring SUPPO RTED_PROTO COL = "vis taimaging" ; | |
| 83 | ||
| 84 | /* ========= ========== ========== ========== ========== ========== ========== | |
| 85 | * Instance fields and methods | |
| 86 | * ========= ========== ========== ========== ========== ========== ========== */ | |
| 87 | pr ivate Logg er logger = LogManag er.getLogg er(this.ge tClass()); | |
| 88 | // private in t maximumP atientSens itivityLev el = DEFAU LT_PATIENT _SENSITIVI TY_LEVEL; | |
| 89 | ||
| 90 | // The requi red versio n of VistA Imaging n eeded to e xecute the RPC calls for this operation | |
| 91 | pu blic final static St ring MAG_R EQUIRED_VE RSION = "3 .0P83"; | |
| 92 | ||
| 93 | /** | |
| 94 | * @param re solvedArti factSource | |
| 95 | * @param pr otocol | |
| 96 | * / | |
| 97 | pu blic Vista ImagingStu dyGraphDat aSourceSer vice(Resol vedArtifac tSource re solvedArti factSource , String p rotocol) | |
| 98 | { | |
| 99 | supe r(resolved ArtifactSo urce, prot ocol); | |
| 100 | } | |
| 101 | ||
| 102 | /* (non-Java doc) | |
| 103 | * @see gov. va.med.ima ging.vista datasource .AbstractB aseVistaSt udyGraphSe rvice#getR equiredVis taImagingV ersion() | |
| 104 | * / | |
| 105 | @O verride | |
| 106 | pr otected St ring getRe quiredVist aImagingVe rsion() | |
| 107 | { | |
| 108 | retu rn VistaIm agingCommo nUtilities .getVistaD ataSourceI magingVers ion( | |
| 109 | VistaI magingData SourceProv ider.getVi staConfigu ration(), | |
| 110 | this.g etClass(), | |
| 111 | MAG_RE QUIRED_VER SION); | |
| 112 | } | |
| 113 | ||
| 114 | /* * | |
| 115 | * Return th e maximum permissibl e patient sensitivit y level | |
| 116 | * that will be includ ed in resu lts. Sens itivity le vels | |
| 117 | * range fro m: | |
| 118 | * 0 - least sensitive | |
| 119 | * - to - | |
| 120 | * 3 - most sensitive | |
| 121 | * | |
| 122 | * @return | |
| 123 | * / | |
| 124 | pu blic int g etMaximumP atientSens itivityLev el(StudyFi lter filte r) | |
| 125 | { | |
| 126 | retu rn filter. getMaximum AllowedLev el().getCo de(); | |
| 127 | } | |
| 128 | ||
| 129 | /** | |
| 130 | * Get ting Studi es from Vi sta is a t wo step-pr ocess beca use: | |
| 131 | * a.) the Vista data stru cture is n ot organiz ed around a study-se ries-insta nce hierar chy but | |
| 132 | * aro und a stud y-group-in stance, wh ere group and study are not sy nonymous. A Study h as | |
| 133 | * 1.. n Groups a nd a Group can have 1..n Serie s. | |
| 134 | * b.) the filte ring provi ded by Vis ta does no t implemen t all of t he filteri ng that ou r | |
| 135 | * Fil ter object requires | |
| 136 | * | |
| 137 | * @pa ram patien tIcn | |
| 138 | * @pa ram filter | |
| 139 | * @re turn | |
| 140 | * @th rows | |
| 141 | * @se e gov.va.m ed.imaging .datasourc e.StudyGra phDataSour ceSpi#getS tudies(Str ing, Filte r) | |
| 142 | */ | |
| 143 | @Overr ide | |
| 144 | public StudySetR esult getP atientStud ies(Routin gToken glo balRouting Token, Pat ientIdenti fier patie ntIdentifi er, | |
| 145 | Stud yFilter fi lter, Stud yLoadLevel studyLoad Level) | |
| 146 | throws Unsupport edOperatio nException , MethodEx ception, C onnectionE xception | |
| 147 | { | |
| 148 | Vi staCommonU tilities.s etDataSour ceMethodAn dVersion(" getPatient Studies", getDataSou rceVersion ()); | |
| 149 | lo gger.info( "getPatien tStudies(" + patient Identifier + | |
| 150 | ", " + ( filter == null ? "<n ull>" : fi lter.toStr ing()) + | |
| 151 | ", Study load leve l " + stud yLoadLevel .toString( ) + | |
| 152 | ") Trans actionCont ext (" + T ransaction ContextFac tory.get() .getDispla yIdentity( ) + ")."); | |
| 153 | ||
| 154 | Vist aSession l ocalVistaS ession = n ull; | |
| 155 | ||
| 156 | try | |
| 157 | { | |
| 158 | localV istaSessio n = getVis taSession( ); | |
| 159 | ||
| 160 | String patientDf n = null; | |
| 161 | try | |
| 162 | { | |
| 163 | patientD fn = getPa tientDfn(l ocalVistaS ession, pa tientIdent ifier); | |
| 164 | } | |
| 165 | catch( PatientNot FoundExcep tion pnfX) | |
| 166 | { | |
| 167 | // JMW 3 /12/08 The patient w as not fou nd in the database, return an empty set of studies instead o f | |
| 168 | logger .warn("Pat ient [" + patientIde ntifier + "] was not found in the VistA database, returning empty stud y set", pn fX); | |
| 169 | return StudySetR esult.crea teFullResu lt(new Tre eSet<Study >()); | |
| 170 | } | |
| 171 | ||
| 172 | // if we are get ting a sin gle study | |
| 173 | if((fi lter != nu ll) && (fi lter.isStu dyIenSpeci fied())) | |
| 174 | { | |
| 175 | // we ar e getting a single s tudy | |
| 176 | logger.i nfo("Getti ng study ' " + filter .getStudyI d() + "' f or patient '" + pati entIdentif ier + "'") ; | |
| 177 | Study si ngleStudy = null; | |
| 178 | if(filte r.isInclud eAllObject s()){ | |
| 179 | logger.deb ug("Gettin g single s tudy metad ata from b oth old an d new data structure s."); | |
| 180 | singleStud y = getSin gleStudyFr omBothData Structures MatchingFi lter(local VistaSessi on, patien tIdentifie r, | |
| 181 | patientD fn, filter , studyLoa dLevel); | |
| 182 | } | |
| 183 | else{ | |
| 184 | logger.deb ug("Gettin g single s tudy metad ata from o ld data st ructure on ly."); | |
| 185 | singleStud y = getSin gleStudyMa tchingFilt er(localVi staSession , patientI dentifier, | |
| 186 | pa tientDfn, filter, st udyLoadLev el); | |
| 187 | } | |
| 188 | SortedSe t<Study> s tudies = n ew TreeSet <Study>(); | |
| 189 | studies. add(single Study); | |
| 190 | return S tudySetRes ult.create FullResult (studies); | |
| 191 | } | |
| 192 | // we are gettin g multiple studies | |
| 193 | else | |
| 194 | { | |
| 195 | // we ar e getting all the st udies for a patient (that matc h the filt er) | |
| 196 | logger.i nfo("Getti ng all stu dies that match filt er for pat ient '" + patientIde ntifier + "'"); | |
| 197 | ||
| 198 | // che ck the pat ient sensi tivity fir st, if it fails an e xception w ill be thr own | |
| 199 | checkP atientSens itive(loca lVistaSess ion, patie ntDfn, pat ientIdenti fier, filt er); | |
| 200 | if(fil ter.isIncl udeAllObje cts()){ | |
| 201 | logger.deb ug("Gettin g all stud ies metada ta from bo th old and new data structures ."); | |
| 202 | return S tudySetRes ult.create FullResult (getAllStu diesFromBo thDataStru cturesMatc hingFilter (localVist aSession, patientIde ntifier, p atientDfn, filter, s tudyLoadLe vel)); | |
| 203 | } | |
| 204 | else{ | |
| 205 | logger.deb ug("Gettin g all stud ies metada ta from ol d data str ucture onl y."); | |
| 206 | return S tudySetRes ult.create FullResult (getAllStu diesMatchi ngFilter(l ocalVistaS ession, pa tientIdent ifier, pat ientDfn, f ilter, stu dyLoadLeve l)); | |
| 207 | } | |
| 208 | } | |
| 209 | } | |
| 210 | catc h (IOExcep tion e) | |
| 211 | { | |
| 212 | throw new Connec tionExcept ion(e); | |
| 213 | } | |
| 214 | fina lly | |
| 215 | { | |
| 216 | try{lo calVistaSe ssion.clos e();} | |
| 217 | catch( Throwable t){} | |
| 218 | } | |
| 219 | } | |
| 220 | ||
| 221 | /** | |
| 222 | * Thi s method i s implemen ted here f or complet eness. | |
| 223 | * As of this da te it is n ot used in productio n deployme nt. | |
| 224 | */ | |
| 225 | @Overr ide | |
| 226 | pu blic Study getStudy( PatientIde ntifier pa tientIdent ifier, Glo balArtifac tIdentifie r studyId) | |
| 227 | throws MethodExc eption, Co nnectionEx ception | |
| 228 | { | |
| 229 | Vi staCommonU tilities.s etDataSour ceMethodAn dVersion(" getStudy", getDataSo urceVersio n()); | |
| 230 | if ( !(studyI d instance of StudyUR N) ) | |
| 231 | thro w new Conn ectionExce ption(this .getClass( ).getSimpl eName() + " does not recognize GAI of ty pe " + stu dyId.getCl ass().getN ame() + ". "); | |
| 232 | ||
| 233 | St udyFilter filter = n ew StudyFi lter(study Id); | |
| 234 | Stud yLoadLevel studyLoad Level = St udyLoadLev el.FULL; | |
| 235 | Stud ySetResult result = getPatient Studies(st udyId, pat ientIdenti fier, filt er, studyL oadLevel); | |
| 236 | if(r esult == n ull) | |
| 237 | { | |
| 238 | logger .error("Go t null Stu dySetResul t - this s hould NEVE R happen!" ); | |
| 239 | return null; | |
| 240 | } | |
| 241 | Sort edSet<Stud y> studies = result. getArtifac ts(); | |
| 242 | if(s tudies != null && st udies.size () > 0) | |
| 243 | return studies.f irst(); | |
| 244 | ||
| 245 | retu rn null; | |
| 246 | } | |
| 247 | ||
| 248 | /** | |
| 249 | * Thi s method i s implemen ted here f or complet eness. | |
| 250 | * As of this da te it is n ot used in productio n deployme nt. | |
| 251 | */ | |
| 252 | @O verride | |
| 253 | pu blic Strin g getStudy Report(Pat ientIdenti fier patie ntIdentifi er, Global ArtifactId entifier s tudyId) | |
| 254 | th rows Metho dException , Connecti onExceptio n | |
| 255 | { | |
| 256 | Vist aCommonUti lities.set DataSource MethodAndV ersion("ge tStudyRepo rt", getDa taSourceVe rsion()); | |
| 257 | Stud y study = getStudy(p atientIden tifier, st udyId); | |
| 258 | retu rn study.g etRadiolog yReport(); | |
| 259 | } | |
| 260 | ||
| 261 | /* * | |
| 262 | * | |
| 263 | * @pa ram localV istaSessio n | |
| 264 | * @pa ram patien tIcn | |
| 265 | * @pa ram patien tDfn | |
| 266 | * @pa ram filter | |
| 267 | * @pa ram studyL oadLevel | |
| 268 | * @re turn | |
| 269 | * @th rows Conne ctionExcep tion | |
| 270 | * @th rows Metho dException | |
| 271 | * @th rows IOExc eption | |
| 272 | */ | |
| 273 | privat e SortedSe t<Study> g etAllStudi esMatching Filter( | |
| 274 | Vi staSession localVist aSession, | |
| 275 | Pa tientIdent ifier pati entIdentif ier, | |
| 276 | St ring patie ntDfn, | |
| 277 | St udyFilter filter, | |
| 278 | St udyLoadLev el studyLo adLevel) | |
| 279 | th rows Conne ctionExcep tion, Meth odExceptio n, IOExcep tion | |
| 280 | { | |
| 281 | // N ote: a Stu dy has 1.. Groups an d a Group can have 1 .. Series! | |
| 282 | Sort edSet<Vist aGroup> gr oups = nul l; | |
| 283 | logg er.info("G etting gro ups for pa tient '" + patientId entifier + "'."); | |
| 284 | grou ps = getPa tientGroup s(localVis taSession, getSite() , patientD fn, patien tIdentifie r, filter) ; // 23Nov C TB = group s study ie n is null | |
| 285 | logg er.info("F ound '" + groups.siz e() + "' g roups for patient '" + patient Identifier + "'"); | |
| 286 | // n o groups i s not an e xception s cenario bu t it does mean we do n't need t o bother g etting mor e | |
| 287 | // i nformation about eac h study | |
| 288 | if(g roups.size () == 0) | |
| 289 | return new TreeS et<Study>( ); // ret urn a zero -length se t | |
| 290 | ||
| 291 | // W arning: if this filt er (and st udyIen) is not null, reducedGr oup might truncate m ultiple gr oup studie s!!! | |
| 292 | Map< String, St ring> stud yMap = new HashMap<S tring, Str ing>(); | |
| 293 | ||
| 294 | // J MW 12/17/2 008, call the filter to remove studies f rom the gr oups, this way | |
| 295 | // t he datasou rce doesn' t need to have knowl edge of th e filter d etails | |
| 296 | if(f ilter != n ull) | |
| 297 | filter .preFilter (groups); | |
| 298 | ||
| 299 | // i f we filte red everyt hing out r eturn now, and don't bother ma king the c all | |
| 300 | // t o populate the entir e Studies tree | |
| 301 | if(g roups.size () == 0) | |
| 302 | return new TreeS et<Study>( ); // ret urn a zero -length se t | |
| 303 | ||
| 304 | logg er.info("L oading stu dy graph d ata for fi ltered gro ups"); | |
| 305 | ||
| 306 | // B uild a lis t of Study IEN | |
| 307 | // T he use of a Map is a n artifact of VistA, which nee ds an inde x of the l ist elemen ts. | |
| 308 | // T he Map end s up as so mething li ke {"0", " 662576753" },{"1", "7 61576512"} ... | |
| 309 | Stri ngBuilder groupMessa ge = new S tringBuild er(); | |
| 310 | grou pMessage.a ppend('{') ; | |
| 311 | for( VistaGroup group : g roups) | |
| 312 | { | |
| 313 | // CTB 29Nov2009 | |
| 314 | //stud yMap.put(" " + studyM ap.size(), Base32Con versionUti lity.base3 2Decode(gr oup.getIen ())); | |
| 315 | studyM ap.put( In teger.toSt ring(study Map.size() ), group.g etIen() ); | |
| 316 | if(gro upMessage. length() > 1) | |
| 317 | groupMes sage.appen d(','); | |
| 318 | groupM essage.app end(group. getIen()); | |
| 319 | } | |
| 320 | grou pMessage.a ppend('}') ; | |
| 321 | ||
| 322 | // | |
| 323 | bool ean includ esDeletedI mages = (f ilter == n ull ? fals e : filter .isInclude Deleted()) ; | |
| 324 | bool ean canInc ludeDelete dImages = canRetriev eDeletedIm ages(); // if this d ata source cannot su pport gett ing delete d images, then it is not an op tion | |
| 325 | Stud yDeletedIm ageState s tudyDelete dImageStat e = StudyD eletedImag eState.can notInclude DeletedIma ges; | |
| 326 | if(c anIncludeD eletedImag es) // if the DS sup ports gett ing delete d images, set approp riately ba sed on use r request | |
| 327 | studyD eletedImag eState = ( includesDe letedImage s ? StudyD eletedImag eState.inc ludesDelet edImages : StudyDele tedImageSt ate.doesNo tIncludeDe letedImage s); | |
| 328 | Sort edSet<Stud y> studies = getPati entStudyGr aph(localV istaSessio n, studyMa p, patient Dfn, | |
| 329 | studyLoa dLevel, st udyDeleted ImageState ); | |
| 330 | logg er.info("g etPatientS tudyGraph for studie s " + grou pMessage.t oString() + " return ed " + stu dies.size( ) + " stud ies."); | |
| 331 | Sort edSet<Stud y> result = | |
| 332 | VistaI magingComm onUtilitie s.mergeStu dyLists(lo calVistaSe ssion, stu dies, grou ps, studyL oadLevel); | |
| 333 | logg er.info("M erging stu dies and g roups resu lts in " + result.si ze() + " s tudies."); | |
| 334 | ||
| 335 | // J MW 12/17/2 008, call the filter to remove studies f rom the gr oups, this way | |
| 336 | // t he datasou rce doesn' t need to have knowl edge of th e filter d etails | |
| 337 | if(f ilter != n ull) | |
| 338 | { | |
| 339 | filter .postFilte r(result); | |
| 340 | } | |
| 341 | logg er.info("C ompleted g etPatientS tudies(), returning '" + resul t.size() + "' studie s."); | |
| 342 | retu rn result; | |
| 343 | } | |
| 344 | ||
| 345 | /* * | |
| 346 | * | |
| 347 | * @pa ram localV istaSessio n | |
| 348 | * @pa ram patien tIcn | |
| 349 | * @pa ram patien tDfn | |
| 350 | * @pa ram filter | |
| 351 | * @pa ram studyL oadLevel | |
| 352 | * @re turn | |
| 353 | * @th rows Conne ctionExcep tion | |
| 354 | * @th rows Metho dException | |
| 355 | * @th rows IOExc eption | |
| 356 | */ | |
| 357 | privat e SortedSe t<Study> g etAllStudi esFromBoth DataStruct uresMatchi ngFilter( | |
| 358 | Vi staSession localVist aSession, | |
| 359 | Pa tientIdent ifier pati entIdentif ier, | |
| 360 | St ring patie ntDfn, | |
| 361 | St udyFilter filter, | |
| 362 | St udyLoadLev el studyLo adLevel) | |
| 363 | th rows Conne ctionExcep tion, Meth odExceptio n, IOExcep tion | |
| 364 | { | |
| 365 | // N ote: a Stu dy has 1.. Groups an d a Group can have 1 .. Series! | |
| 366 | //So rtedSet<Vi staGroup> groups = n ull; | |
| 367 | //lo gger.info( "Getting g roups for patient '" + patient Identifier + "'."); | |
| 368 | //gr oups = get PatientGro ups(localV istaSessio n, getSite (), patien tDfn, pati entIdentif ier, filte r); // 23Nov CTB = groups study ien is null | |
| 369 | //lo gger.info( "Found '" + groups.s ize() + "' groups fo r patient '" + patie ntIdentifi er + "'"); | |
| 370 | // n o groups i s not an e xception s cenario bu t it does mean we do n't need t o bother g etting mor e | |
| 371 | // i nformation about eac h study | |
| 372 | //if (groups.si ze() == 0) | |
| 373 | //re turn new T reeSet<Stu dy>(); // r eturn a ze ro-length set | |
| 374 | ||
| 375 | // W arning: if this filt er (and st udyIen) is not null, reducedGr oup might truncate m ultiple gr oup studie s!!! | |
| 376 | Map< String, St ring> stud yMap = new HashMap<S tring, Str ing>(); | |
| 377 | ||
| 378 | // J MW 12/17/2 008, call the filter to remove studies f rom the gr oups, this way | |
| 379 | // t he datasou rce doesn' t need to have knowl edge of th e filter d etails | |
| 380 | //if (filter != null) | |
| 381 | // filter .preFilter (groups); | |
| 382 | ||
| 383 | // i f we filte red everyt hing out r eturn now, and don't bother ma king the c all | |
| 384 | // t o populate the entir e Studies tree | |
| 385 | //if (groups.si ze() == 0) | |
| 386 | // return new TreeS et<Study>( ); // ret urn a zero -length se t | |
| 387 | ||
| 388 | //lo gger.info( "Loading s tudy graph data for filtered g roups"); | |
| 389 | ||
| 390 | // B uild a lis t of Study IEN | |
| 391 | // T he use of a Map is a n artifact of VistA, which nee ds an inde x of the l ist elemen ts. | |
| 392 | // T he Map end s up as so mething li ke {"0", " 662576753" },{"1", "7 61576512"} ... | |
| 393 | //St ringBuilde r groupMes sage = new StringBui lder(); | |
| 394 | //gr oupMessage .append('{ '); | |
| 395 | //fo r(VistaGro up group : groups) | |
| 396 | //{ | |
| 397 | // CTB 29Nov2009 | |
| 398 | //stud yMap.put(" " + studyM ap.size(), Base32Con versionUti lity.base3 2Decode(gr oup.getIen ())); | |
| 399 | // studyM ap.put( In teger.toSt ring(study Map.size() ), group.g etIen() ); | |
| 400 | // if(gro upMessage. length() > 1) | |
| 401 | // groupMes sage.appen d(','); | |
| 402 | // groupM essage.app end(group. getIen()); | |
| 403 | //} | |
| 404 | //gr oupMessage .append('} '); | |
| 405 | ||
| 406 | // | |
| 407 | bool ean includ esDeletedI mages = (f ilter == n ull ? fals e : filter .isInclude Deleted()) ; | |
| 408 | bool ean canInc ludeDelete dImages = canRetriev eDeletedIm ages(); // if this d ata source cannot su pport gett ing delete d images, then it is not an op tion | |
| 409 | Stud yDeletedIm ageState s tudyDelete dImageStat e = StudyD eletedImag eState.can notInclude DeletedIma ges; | |
| 410 | if(c anIncludeD eletedImag es) // if the DS sup ports gett ing delete d images, set approp riately ba sed on use r request | |
| 411 | studyD eletedImag eState = ( includesDe letedImage s ? StudyD eletedImag eState.inc ludesDelet edImages : StudyDele tedImageSt ate.doesNo tIncludeDe letedImage s); | |
| 412 | Sort edSet<Stud y> studies = getPati entStudyGr aphFromBot hDataStruc tures(loca lVistaSess ion, study Map, patie ntDfn, fil ter, | |
| 413 | studyLoa dLevel, st udyDeleted ImageState ); | |
| 414 | //lo gger.info( "getPatien tStudyGrap h for stud ies " + gr oupMessage .toString( ) + " retu rned " + s tudies.siz e() + " st udies."); | |
| 415 | //So rtedSet<St udy> resul t = | |
| 416 | // VistaI magingComm onUtilitie s.mergeStu dyLists(lo calVistaSe ssion, stu dies, grou ps, studyL oadLevel); | |
| 417 | //lo gger.info( "Merging s tudies and groups re sults in " + result. size() + " studies." ); | |
| 418 | ||
| 419 | // J MW 12/17/2 008, call the filter to remove studies f rom the gr oups, this way | |
| 420 | // t he datasou rce doesn' t need to have knowl edge of th e filter d etails | |
| 421 | //if (filter != null) | |
| 422 | //{ | |
| 423 | // filter .postFilte r(result); | |
| 424 | //} | |
| 425 | //lo gger.info( "Completed getPatien tStudies() , returnin g '" + res ult.size() + "' stud ies."); | |
| 426 | //re turn resul t; | |
| 427 | //re turn null; | |
| 428 | logg er.debug(" Number of studies: " + studies .size()); | |
| 429 | logg er.debug(s tudies.toS tring()); | |
| 430 | retu rn studies ; | |
| 431 | } | |
| 432 | ||
| 433 | /* * | |
| 434 | * | |
| 435 | * @pa ram localV istaSessio n | |
| 436 | * @pa ram patien tIcn | |
| 437 | * @pa ram patien tDfn | |
| 438 | * @pa ram filter | |
| 439 | * @pa ram studyL oadLevel | |
| 440 | * @re turn | |
| 441 | * @th rows Conne ctionExcep tion | |
| 442 | * @th rows Metho dException | |
| 443 | * @th rows IOExc eption | |
| 444 | */ | |
| 445 | privat e Study ge tSingleStu dyMatching Filter(Vis taSession localVista Session, | |
| 446 | Pati entIdentif ier patien tIdentifie r, String patientDfn , StudyFil ter filter , StudyLoa dLevel stu dyLoadLeve l) | |
| 447 | th rows Conne ctionExcep tion, Meth odExceptio n, IOExcep tion | |
| 448 | { | |
| 449 | St udyURN stu dyUrn = nu ll; | |
| 450 | if (filter.ge tStudyId() instanceo f StudyURN ) | |
| 451 | { | |
| 452 | try | |
| 453 | { | |
| 454 | studyU rn = URNFa ctory.crea te(filter. getStudyId ().toStrin g()); | |
| 455 | } | |
| 456 | catc h(URNForma tException urnfX) | |
| 457 | { | |
| 458 | throw new Method Exception( "Error con verting fi lter study Id to Stu dyURN", ur nfX); | |
| 459 | } | |
| 460 | } | |
| 461 | el se | |
| 462 | { | |
| 463 | thro w new Meth odExceptio n("Cannot cast filte r study Id '" + filt er.getStud yId() + "' to StudyU RN, must b e study UR N to get s tudy type. "); | |
| 464 | } | |
| 465 | ||
| 466 | St ring study Ien = stud yUrn.getSt udyId(); | |
| 467 | Ma p<String, String> st udyMap = n ew HashMap <String, S tring>(); | |
| 468 | // C TB 29Nov20 09 | |
| 469 | // studyMap.p ut("" + st udyMap.siz e(), Base3 2Conversio nUtility.b ase32Decod e(studyIen )); | |
| 470 | st udyMap.put ("" + stud yMap.size( ), studyIe n); | |
| 471 | ||
| 472 | bo olean incl udesDelete dImages = (filter == null ? fa lse : filt er.isInclu deDeleted( )); | |
| 473 | bo olean canI ncludeDele tedImages = canRetri eveDeleted Images(); // if this data sour ce cannot support ge tting dele ted images , then it is not an option | |
| 474 | Stud yDeletedIm ageState s tudyDelete dImageStat e = StudyD eletedImag eState.can notInclude DeletedIma ges; | |
| 475 | if(c anIncludeD eletedImag es) // if the DS sup ports gett ing delete d images, set approp riately ba sed on use r request | |
| 476 | studyD eletedImag eState = ( includesDe letedImage s ? StudyD eletedImag eState.inc ludesDelet edImages : StudyDele tedImageSt ate.doesNo tIncludeDe letedImage s); | |
| 477 | ||
| 478 | So rtedSet<St udy> studi es = getPa tientStudy Graph(loca lVistaSess ion, study Map, patie ntDfn, | |
| 479 | studyL oadLevel, studyDelet edImageSta te); | |
| 480 | if ((studies == null) | | (studies .size() <= 0)) | |
| 481 | { | |
| 482 | thro w new Meth odExceptio n("Study [ " + studyI en + "] no t found"); | |
| 483 | } | |
| 484 | if (studies.s ize() > 1) | |
| 485 | { | |
| 486 | thro w new Meth odExceptio n("Found ' " + studie s.size() + "' matchi ng studies , this sho uld never happen!"); | |
| 487 | } | |
| 488 | St udy study = studies. first(); | |
| 489 | logg er.info("G etting gro ups for pa tient '" + patientId entifier + "'."); | |
| 490 | Sort edSet<Vist aGroup> gr oups = get PatientGro ups(localV istaSessio n, getSite (), patien tDfn, pati entIdentif ier, filte r); | |
| 491 | if(( groups == null) || ( groups.siz e() <= 0)) | |
| 492 | { | |
| 493 | thro w new Meth odExceptio n("Study [ " + studyI en + "] no t found"); | |
| 494 | } | |
| 495 | logg er.info("F ound '" + groups.siz e() + "' g roups for patient '" + patient Identifier + "'"); | |
| 496 | Stud y result = VistaImag ingCommonU tilities.m ergeStudyW ithMatchin gGroup(loc alVistaSes sion, stud y, groups, studyLoad Level); | |
| 497 | if(r esult == n ull) | |
| 498 | { | |
| 499 | throw new Method Exception( "Cannot fi nd study ' " + studyI en + "', c ould not m atch group to study. "); | |
| 500 | } | |
| 501 | retu rn result; | |
| 502 | } | |
| 503 | ||
| 504 | /* * | |
| 505 | * | |
| 506 | * @pa ram localV istaSessio n | |
| 507 | * @pa ram patien tIcn | |
| 508 | * @pa ram patien tDfn | |
| 509 | * @pa ram filter | |
| 510 | * @pa ram studyL oadLevel | |
| 511 | * @re turn | |
| 512 | * @th rows Conne ctionExcep tion | |
| 513 | * @th rows Metho dException | |
| 514 | * @th rows IOExc eption | |
| 515 | */ | |
| 516 | privat e Study ge tSingleStu dyFromBoth DataStruct uresMatchi ngFilter(V istaSessio n localVis taSession, | |
| 517 | Pati entIdentif ier patien tIdentifie r, String patientDfn , StudyFil ter filter , StudyLoa dLevel stu dyLoadLeve l) | |
| 518 | th rows Conne ctionExcep tion, Meth odExceptio n, IOExcep tion | |
| 519 | { | |
| 520 | St udyURN stu dyUrn = nu ll; | |
| 521 | if (filter.ge tStudyId() instanceo f StudyURN ) | |
| 522 | { | |
| 523 | try | |
| 524 | { | |
| 525 | studyU rn = URNFa ctory.crea te(filter. getStudyId ().toStrin g()); | |
| 526 | } | |
| 527 | catc h(URNForma tException urnfX) | |
| 528 | { | |
| 529 | throw new Method Exception( "Error con verting fi lter study Id to Stu dyURN", ur nfX); | |
| 530 | } | |
| 531 | } | |
| 532 | el se | |
| 533 | { | |
| 534 | thro w new Meth odExceptio n("Cannot cast filte r study Id '" + filt er.getStud yId() + "' to StudyU RN, must b e study UR N to get s tudy type. "); | |
| 535 | } | |
| 536 | ||
| 537 | St ring study Ien = stud yUrn.getSt udyId(); | |
| 538 | Ma p<String, String> st udyMap = n ew HashMap <String, S tring>(); | |
| 539 | st udyMap.put ("" + stud yMap.size( ), studyIe n); | |
| 540 | ||
| 541 | bo olean incl udesDelete dImages = (filter == null ? fa lse : filt er.isInclu deDeleted( )); | |
| 542 | bo olean canI ncludeDele tedImages = canRetri eveDeleted Images(); // if this data sour ce cannot support ge tting dele ted images , then it is not an option | |
| 543 | Stud yDeletedIm ageState s tudyDelete dImageStat e = StudyD eletedImag eState.can notInclude DeletedIma ges; | |
| 544 | if(c anIncludeD eletedImag es) // if the DS sup ports gett ing delete d images, set approp riately ba sed on use r request | |
| 545 | studyD eletedImag eState = ( includesDe letedImage s ? StudyD eletedImag eState.inc ludesDelet edImages : StudyDele tedImageSt ate.doesNo tIncludeDe letedImage s); | |
| 546 | ||
| 547 | So rtedSet<St udy> studi es = getSi ngleStudyG raphFromBo thDataStru ctures(loc alVistaSes sion, stud yMap, pati entDfn, fi lter, | |
| 548 | studyL oadLevel, studyDelet edImageSta te); | |
| 549 | if ((studies == null) | | (studies .size() <= 0)) | |
| 550 | { | |
| 551 | thro w new Meth odExceptio n("Study [ " + studyI en + "] no t found"); | |
| 552 | } | |
| 553 | if (studies.s ize() > 1) | |
| 554 | { | |
| 555 | thro w new Meth odExceptio n("Found ' " + studie s.size() + "' matchi ng studies , this sho uld never happen!"); | |
| 556 | } | |
| 557 | St udy study = studies. first(); | |
| 558 | //lo gger.info( "Getting g roups for patient '" + patient Identifier + "'."); | |
| 559 | //So rtedSet<Vi staGroup> groups = g etPatientG roups(loca lVistaSess ion, getSi te(), pati entDfn, pa tientIdent ifier, fil ter); | |
| 560 | //if ((groups = = null) || (groups.s ize() <= 0 )) | |
| 561 | // { | |
| 562 | // thro w new Meth odExceptio n("Study [ " + studyI en + "] no t found"); | |
| 563 | // } | |
| 564 | //lo gger.info( "Found '" + groups.s ize() + "' groups fo r patient '" + patie ntIdentifi er + "'"); | |
| 565 | //St udy result = VistaIm agingCommo nUtilities .mergeStud yWithMatch ingGroup(l ocalVistaS ession, st udy, group s, studyLo adLevel); | |
| 566 | //if (result == null) | |
| 567 | //{ | |
| 568 | // throw new Method Exception( "Cannot fi nd study ' " + studyI en + "', c ould not m atch group to study. "); | |
| 569 | //} | |
| 570 | retu rn study; | |
| 571 | // return nul l; | |
| 572 | } | |
| 573 | ||
| 574 | /** | |
| 575 | * | |
| 576 | * @pa ram localV istaSessio n | |
| 577 | * @pa ram studyM ap | |
| 578 | * @pa ram patien tDfn | |
| 579 | * @pa ram studyL oadLevel | |
| 580 | * @re turn | |
| 581 | * @th rows Metho dException | |
| 582 | * @th rows Conne ctionExcep tion | |
| 583 | */ | |
| 584 | privat e SortedSe t<Study> g etPatientS tudyGraph( | |
| 585 | Vi staSession localVist aSession, | |
| 586 | Ma p<String, String> st udyMap, | |
| 587 | St ring patie ntDfn, | |
| 588 | St udyLoadLev el studyLo adLevel, | |
| 589 | St udyDeleted ImageState studyDele tedImageSt ate) | |
| 590 | th rows Metho dException , Connecti onExceptio n | |
| 591 | { | |
| 592 | tr y | |
| 593 | { | |
| 594 | Vist aQuery que ry = getPa tientStudy GraphVista Query(stud yMap, pati entDfn, st udyLoadLev el, | |
| 595 | studyDel etedImageS tate); | |
| 596 | logger .info("Ret rieving st udy graph for patien t containi ng '" + st udyMap.siz e() + "' g roups"); | |
| 597 | String vistaResp onse = loc alVistaSes sion.call( query); | |
| 598 | logger .info(quer y.getRpcNa me()+" RPC Results:" +StringUti ls.display EncodedCha rs(vistaRe sponse)); | |
| 599 | logger .info("Com pleted stu dy graph R PC call, p arsing res ponse...") ; | |
| 600 | ||
| 601 | Sorted Set<Study> studies = VistaImag ingTransla tor.create StudiesFro mGraph(get Site(), | |
| 602 | vistaRespo nse, study LoadLevel, studyDele tedImageSt ate); | |
| 603 | logger .info("Con verted res ponse into '" + ((st udies == n ull) ? 0 : studies.s ize()) + " ' studies" ); | |
| 604 | return studies; | |
| 605 | } | |
| 606 | catc h (Excepti on ex) | |
| 607 | { | |
| 608 | logger .error(ex) ; | |
| 609 | ex.pri ntStackTra ce(); | |
| 610 | throw new Method Exception( ex); | |
| 611 | } | |
| 612 | } | |
| 613 | ||
| 614 | /** | |
| 615 | * | |
| 616 | * @pa ram localV istaSessio n | |
| 617 | * @pa ram studyM ap | |
| 618 | * @pa ram patien tDfn | |
| 619 | * @pa ram studyL oadLevel | |
| 620 | * @re turn | |
| 621 | * @th rows Metho dException | |
| 622 | * @th rows Conne ctionExcep tion | |
| 623 | */ | |
| 624 | privat e SortedSe t<Study> g etPatientS tudyGraphF romBothDat aStructure s( | |
| 625 | Vi staSession localVist aSession, | |
| 626 | Ma p<String, String> st udyMap, | |
| 627 | St ring patie ntDfn, | |
| 628 | St udyFilter filter, | |
| 629 | St udyLoadLev el studyLo adLevel, | |
| 630 | St udyDeleted ImageState studyDele tedImageSt ate) | |
| 631 | th rows Metho dException , Connecti onExceptio n | |
| 632 | { | |
| 633 | tr y | |
| 634 | { | |
| 635 | Vist aQuery que ry = getPa tientStudy GraphFromB othDataStr ucturesVis taQuery(st udyMap, pa tientDfn, filter, st udyLoadLev el, | |
| 636 | studyDe letedImage State); | |
| 637 | logger .info("Ret rieving st udy graph for patien t containi ng '" + st udyMap.siz e() + "' g roups"); | |
| 638 | String vistaResp onse = loc alVistaSes sion.call( query); | |
| 639 | logger .info(quer y.getRpcNa me()+" RPC Results:" +StringUti ls.display EncodedCha rs(vistaRe sponse)); | |
| 640 | logger .info("Com pleted stu dy graph R PC call, p arsing res ponse...") ; | |
| 641 | ||
| 642 | Sorted Set<Study> studies = VistaImag ingTransla tor.create StudiesFro mGraph(get Site(), | |
| 643 | vistaRespo nse, study LoadLevel, studyDele tedImageSt ate); | |
| 644 | logger .info("Con verted res ponse into '" + ((st udies == n ull) ? 0 : studies.s ize()) + " ' studies" ); | |
| 645 | ||
| 646 | return studies; | |
| 647 | } | |
| 648 | catc h (Excepti on ex) | |
| 649 | { | |
| 650 | logger .error(ex) ; | |
| 651 | ex.pri ntStackTra ce(); | |
| 652 | throw new Method Exception( ex); | |
| 653 | } | |
| 654 | } | |
| 655 | ||
| 656 | ||
| 657 | /** | |
| 658 | * | |
| 659 | * @pa ram localV istaSessio n | |
| 660 | * @pa ram studyM ap | |
| 661 | * @pa ram patien tDfn | |
| 662 | * @pa ram studyL oadLevel | |
| 663 | * @re turn | |
| 664 | * @th rows Metho dException | |
| 665 | * @th rows Conne ctionExcep tion | |
| 666 | */ | |
| 667 | privat e SortedSe t<Study> g etSingleSt udyGraphFr omBothData Structures ( | |
| 668 | Vi staSession localVist aSession, | |
| 669 | Ma p<String, String> st udyMap, | |
| 670 | St ring patie ntDfn, | |
| 671 | St udyFilter filter, | |
| 672 | St udyLoadLev el studyLo adLevel, | |
| 673 | St udyDeleted ImageState studyDele tedImageSt ate) | |
| 674 | th rows Metho dException , Connecti onExceptio n | |
| 675 | { | |
| 676 | tr y | |
| 677 | { | |
| 678 | Vist aQuery que ry = getSi ngleStudyG raphFromBo thDataStru cturesVist aQuery(stu dyMap, pat ientDfn, f ilter, stu dyLoadLeve l, | |
| 679 | studyDel etedImageS tate); | |
| 680 | String vistaResp onse = loc alVistaSes sion.call( query); | |
| 681 | logger .info(quer y.getRpcNa me()+" RPC Results:" +StringUti ls.display EncodedCha rs(vistaRe sponse)); | |
| 682 | logger .info("Com pleted stu dy graph R PC call, p arsing res ponse...") ; | |
| 683 | ||
| 684 | Sorted Set<Study> studies = VistaImag ingTransla tor.create StudiesFro mGraph(get Site(), | |
| 685 | vistaRespo nse, study LoadLevel, studyDele tedImageSt ate); | |
| 686 | logger .info("Con verted res ponse into '" + ((st udies == n ull) ? 0 : studies.s ize()) + " ' studies" ); | |
| 687 | return studies; | |
| 688 | //retu rn null; | |
| 689 | } | |
| 690 | catc h (Excepti on ex) | |
| 691 | { | |
| 692 | logger .error(ex) ; | |
| 693 | ex.pri ntStackTra ce(); | |
| 694 | throw new Method Exception( ex); | |
| 695 | } | |
| 696 | } | |
| 697 | ||
| 698 | ||
| 699 | protec ted VistaQ uery getPa tientGroup sVistaQuer y(String p atientDfn, StudyFilt er studyFi lter) | |
| 700 | { | |
| 701 | re turn Vista ImagingQue ryFactory. createGetG roupsVista Query(pati entDfn, st udyFilter) ; | |
| 702 | } | |
| 703 | ||
| 704 | /** | |
| 705 | * Met hod to get the Vista Query to c all to get the study graph | |
| 706 | * @pa ram studyM ap | |
| 707 | * @pa ram patien tDfn | |
| 708 | * @pa ram studyL oadLevel | |
| 709 | * @pa ram studyD eletedImag eState | |
| 710 | * @re turn | |
| 711 | */ | |
| 712 | protec ted VistaQ uery getPa tientStudy GraphVista Query(Map< String, St ring> stud yMap, | |
| 713 | Stri ng patient Dfn, | |
| 714 | Stud yLoadLevel studyLoad Level, | |
| 715 | Stud yDeletedIm ageState s tudyDelete dImageStat e) | |
| 716 | { | |
| 717 | // this vers ion does n ot use the studyDele tedImageSt ate | |
| 718 | re turn Vista ImagingQue ryFactory. createGetS tudiesByIe nVistaQuer y(studyMap , | |
| 719 | patien tDfn, stud yLoadLevel ); | |
| 720 | } | |
| 721 | ||
| 722 | /** | |
| 723 | * Met hod to get the Vista Query to c all to get the study graph | |
| 724 | * @pa ram studyM ap | |
| 725 | * @pa ram patien tDfn | |
| 726 | * @pa ram studyL oadLevel | |
| 727 | * @pa ram studyD eletedImag eState | |
| 728 | * @re turn | |
| 729 | */ | |
| 730 | protec ted VistaQ uery getPa tientStudy GraphFromB othDataStr ucturesVis taQuery(Ma p<String, String> st udyMap, | |
| 731 | Stri ng patient Dfn, | |
| 732 | Stud yFilter fi lter, | |
| 733 | Stud yLoadLevel studyLoad Level, | |
| 734 | Stud yDeletedIm ageState s tudyDelete dImageStat e) | |
| 735 | { | |
| 736 | // this vers ion does n ot use the studyDele tedImageSt ate | |
| 737 | re turn Vista ImagingQue ryFactory. createGetS tudiesFrom BothDataSt ructuresBy PatientVis taQuery(st udyMap, | |
| 738 | patien tDfn, filt er, studyL oadLevel); | |
| 739 | } | |
| 740 | ||
| 741 | /** | |
| 742 | * Met hod to get the Vista Query to c all to get the study graph | |
| 743 | * @pa ram studyM ap | |
| 744 | * @pa ram patien tDfn | |
| 745 | * @pa ram studyL oadLevel | |
| 746 | * @pa ram studyD eletedImag eState | |
| 747 | * @re turn | |
| 748 | */ | |
| 749 | protec ted VistaQ uery getSi ngleStudyG raphFromBo thDataStru cturesVist aQuery(Map <String, S tring> stu dyMap, | |
| 750 | Stri ng patient Dfn, | |
| 751 | Stud yFilter fi lter, | |
| 752 | Stud yLoadLevel studyLoad Level, | |
| 753 | Stud yDeletedIm ageState s tudyDelete dImageStat e) | |
| 754 | { | |
| 755 | // this vers ion does n ot use the studyDele tedImageSt ate | |
| 756 | re turn Vista ImagingQue ryFactory. createGetS ingleStudy FromBothDa taStructur esByCprsId entifierVi staQuery(s tudyMap, | |
| 757 | patien tDfn, filt er, studyL oadLevel); | |
| 758 | } | |
| 759 | ||
| 760 | /* * | |
| 761 | * @throws I OException | |
| 762 | * @throws M ethodExcep tion | |
| 763 | * @throws C onnectionE xception | |
| 764 | * @throws I nvalidVist aCredentia lsExceptio n | |
| 765 | * | |
| 766 | * / | |
| 767 | pr ivate Sort edSet<Vist aGroup> ge tPatientGr oups( | |
| 768 | Vist aSession s ession, | |
| 769 | Site site, | |
| 770 | Stri ng patient Dfn, | |
| 771 | Pati entIdentif ier patien tIdentifie r, | |
| 772 | Stud yFilter fi lter) | |
| 773 | th rows Metho dException , IOExcept ion, Conne ctionExcep tion | |
| 774 | { | |
| 775 | logg er.info("g etPatientG roups(" + patientIde ntifier + ") Transac tionContex t (" + Tra nsactionCo ntextFacto ry.get().g etDisplayI dentity() + ")."); | |
| 776 | ||
| 777 | // c reates cal l to RPC M AG4_PAT_GE T_IMAGES | |
| 778 | Vist aQuery vm = getPatie ntGroupsVi staQuery(p atientDfn, filter); | |
| 779 | logg er.info("g etPatientG roups with RPC '" + vm.getRpcN ame() + "' ."); | |
| 780 | ||
| 781 | Stri ng rtn = n ull; | |
| 782 | try | |
| 783 | { | |
| 784 | logger .info("Mak ing call t o get grou ps for pat ient '" + patientIde ntifier + "'"); | |
| 785 | rtn = session.ca ll(vm); | |
| 786 | logger .info(vm.g etRpcName( )+" RPC Re sults:"+St ringUtils. displayEnc odedChars( rtn)); | |
| 787 | ||
| 788 | // che ck to be s ure first character is a 1 (me ans result is ok) | |
| 789 | ||
| 790 | // if no images for patien t, respons e is [0^No images fo r filter: All Images ] | |
| 791 | ||
| 792 | if(rtn .charAt(0) == '1') | |
| 793 | { | |
| 794 | boolean includesDe letedImage s = (filte r == null ? false : filter.isI ncludeDele ted()); | |
| 795 | boolean canInclude DeletedIma ges = canR etrieveDel etedImages (); // if this data source can not suppor t getting deleted im ages, then it is not an option | |
| 796 | StudyDel etedImageS tate study DeletedIma geState = StudyDelet edImageSta te.cannotI ncludeDele tedImages; | |
| 797 | if(canIn cludeDelet edImages) // if the DS support s getting deleted im ages, set appropriat ely based on user re quest | |
| 798 | studyDelet edImageSta te = (incl udesDelete dImages ? StudyDelet edImageSta te.include sDeletedIm ages : Stu dyDeletedI mageState. doesNotInc ludeDelete dImages); | |
| 799 | return V istaImagin gTranslato r.createGr oupsFromGr oupLines(s ite, rtn, patientIde ntifier, | |
| 800 | st udyDeleted ImageState ); | |
| 801 | } | |
| 802 | else i f(rtn.star tsWith("0^ No images for filter ")) | |
| 803 | { | |
| 804 | logger.i nfo("0 res ponse from getPatien tGroupsVis taQuery() rpc, no im ages found , [" + rtn + "]"); | |
| 805 | return n ew TreeSet <VistaGrou p>(); | |
| 806 | } | |
| 807 | else i f(rtn.star tsWith("0^ No Such Pa tient:")) | |
| 808 | { | |
| 809 | logger.i nfo("0 res ponse from getPatien tGroupsVis taQuery() rpc, [" + rtn + "]") ; | |
| 810 | throw ne w VistaMet hodExcepti on("No pat ient [ "+ patientIde ntifier + "] found i n database "); | |
| 811 | } | |
| 812 | else | |
| 813 | { | |
| 814 | logger.i nfo("0 res ponse from getPatien tGroupsVis taQuery() rpc, [" + rtn + "]") ; | |
| 815 | throw ne w VistaMet hodExcepti on(rtn); | |
| 816 | } | |
| 817 | } | |
| 818 | catc h (Excepti on ex) | |
| 819 | { | |
| 820 | logger .error(ex) ; | |
| 821 | throw new Method Exception( ex); | |
| 822 | } | |
| 823 | } | |
| 824 | ||
| 825 | /* * | |
| 826 | * | |
| 827 | * @param pr ocedure | |
| 828 | * @param fi lter | |
| 829 | * @return | |
| 830 | * / | |
| 831 | /* | |
| 832 | pr ivate bool ean proced ureUsed(St ring proce dure, Stud yFilter fi lter) | |
| 833 | { | |
| 834 | if(p rocedure = = null) | |
| 835 | return false; | |
| 836 | ||
| 837 | if( filter.get AllowableS tudyTypes( ) == null || filter. getAllowab leStudyTyp es().size( ) == 0 ) | |
| 838 | return true; | |
| 839 | ||
| 840 | for( int i = 0 ; i < filt er.getAllo wableStudy Types().si ze(); i++ ) | |
| 841 | if( pr ocedure.eq ualsIgnore Case(filte r.getAllow ableStudyT ypes().get (i)) ) | |
| 842 | return t rue; | |
| 843 | ||
| 844 | retu rn false; | |
| 845 | } | |
| 846 | */ | |
| 847 | ||
| 848 | /** | |
| 849 | * | |
| 850 | * @re turn | |
| 851 | * @th rows IOExc eption | |
| 852 | * @th rows Vista Exception | |
| 853 | */ | |
| 854 | pu blic boole an disconn ect() | |
| 855 | th rows IOExc eption | |
| 856 | { | |
| 857 | // d on;t do an ything, le t the conn ection tim eout | |
| 858 | retu rn true; | |
| 859 | } | |
| 860 | ||
| 861 | /* * | |
| 862 | * Determine s if this data sourc e can hand le retriev ing delete d images i f the user requests them | |
| 863 | * @return | |
| 864 | * / | |
| 865 | pr otected bo olean canR etrieveDel etedImages () | |
| 866 | { | |
| 867 | retu rn false; | |
| 868 | } | |
| 869 | ||
| 870 | @O verride | |
| 871 | pr otected St ring getDa taSourceVe rsion() | |
| 872 | { | |
| 873 | retu rn "1"; | |
| 874 | } | |
| 875 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.