Produced by Araxis Merge on 6/9/2017 3:51:26 PM Eastern 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 | Fri Jun 9 19:51:26 2017 UTC | ||
| 2 | eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-web\src\main\java\gov\va\nvap\web\helper\report | ReportHelper.java | Fri Apr 21 20:03:30 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 362 |
| 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 | package go v.va.nvap. web.helper .report; | |||||
| 2 | ||||||
| 3 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |||||
| 4 | import gov .va.nvap.s ervice.pdq .PatientMa tchQuery; | |||||
| 5 | import gov .va.nvap.s ervice.pdq .PatientMa tchRespons e; | |||||
| 6 | import gov .va.nvap.s ervice.pdq .PatientPr ofile; | |||||
| 7 | import gov .va.nvap.s ervice.pdq .PdqExcept ion; | |||||
| 8 | import gov .va.nvap.s ervice.pdq .PdqServic e; | |||||
| 9 | import gov .va.nvap.s vc.consent mgmt.stub. data.Organ ization; | |||||
| 10 | import gov .va.nvap.s vc.facilit y.data.Fac ility; | |||||
| 11 | import gov .va.nvap.w eb.helper. privacy.Co nsentManag ementHelpe r; | |||||
| 12 | import gov .va.nvap.w eb.util.Co nstants; | |||||
| 13 | import gov .va.nvap.w eb.util.da te.DateUti l; | |||||
| 14 | import jav a.text.Dat eFormat; | |||||
| 15 | import jav a.text.Sim pleDateFor mat; | |||||
| 16 | import jav a.util.Arr ayList; | |||||
| 17 | import jav a.util.Cal endar; | |||||
| 18 | import jav a.util.Dat e; | |||||
| 19 | import jav a.util.Lis t; | |||||
| 20 | import jav ax.persist ence.Entit yManager; | |||||
| 21 | import jav ax.persist ence.Persi stenceCont ext; | |||||
| 22 | import jav ax.persist ence.Query ; | |||||
| 23 | import jav ax.servlet .http.Http ServletReq uest; | |||||
| 24 | import jav ax.servlet .http.Http Session; | |||||
| 25 | import org .springfra mework.bea ns.factory .annotatio n.Required ; | |||||
| 26 | ||||||
| 27 | public cla ss ReportH elper { | |||||
| 28 | ||||||
| 29 | @Persi stenceCont ext | |||||
| 30 | privat e EntityMa nager em; | |||||
| 31 | ||||||
| 32 | pr ivate PdqS ervice pdq Service; | |||||
| 33 | pr ivate Stri ng disclos uresDetail edReportCa p; | |||||
| 34 | pr ivate Stri ng recvdDo csDetailed ReportCap; | |||||
| 35 | pr ivate Stri ng consent Directives ReportCap; | |||||
| 36 | pr ivate Stri ng pdDetai ledReportC ap; | |||||
| 37 | ||||||
| 38 | pu blic Strin g resolveI CN(final S tring firs tName, fin al String lastName, | |||||
| 39 | final String ssn ) { | |||||
| 40 | ||||||
| 41 | if ( NullChecke r.isNotEmp ty(ssn) | |||||
| 42 | && NullC hecker.isN otEmpty(fi rstName) | |||||
| 43 | && NullC hecker.isN otEmpty(la stName)) { | |||||
| 44 | ||||||
| 45 | final List<Patie ntProfile> patients = getMatch edPatients (ssn, firs tName, las tName); | |||||
| 46 | if(pat ients != n ull) { | |||||
| 47 | if (pati ents.isEmp ty()) { | |||||
| 48 | return "Un known"; | |||||
| 49 | } else i f (patient s.size() > = 2) { | |||||
| 50 | return "Mu ltiple ICN s"; | |||||
| 51 | } else { | |||||
| 52 | final Stri ng icn = p atients.ge t(0).getIc n(); | |||||
| 53 | return icn ; | |||||
| 54 | } | |||||
| 55 | } | |||||
| 56 | } el se { | |||||
| 57 | return "Unknown" ; | |||||
| 58 | } | |||||
| 59 | ||||||
| 60 | retu rn "Unknow n"; | |||||
| 61 | } | |||||
| 62 | ||||||
| 63 | /* * | |||||
| 64 | * This meth od returns list of M atched Pat ients. | |||||
| 65 | * | |||||
| 66 | * @param ss n | |||||
| 67 | * @param fi rstName | |||||
| 68 | * @param la stName | |||||
| 69 | * @return L ist of Mat ched Patie nts | |||||
| 70 | * / | |||||
| 71 | pu blic List< PatientPro file> getM atchedPati ents(Strin g ssn, Str ing firstN ame, Strin g lastName ) { | |||||
| 72 | ||||||
| 73 | List <PatientPr ofile> pat ients = nu ll; | |||||
| 74 | try { | |||||
| 75 | ||||||
| 76 | // Cre ate a pati ent profil e and sear ch for pat ient | |||||
| 77 | final PatientPro file patie nt = new P atientProf ile(); | |||||
| 78 | patien t.setFirst Name(first Name); | |||||
| 79 | patien t.setLastN ame(lastNa me); | |||||
| 80 | patien t.setSsn(s sn); | |||||
| 81 | final PatientMat chQuery pa tientSearc hRequest = new Patie ntMatchQue ry(); | |||||
| 82 | patien tSearchReq uest.setPa tientProfi le(patient ); | |||||
| 83 | // Cal l PDQ serv ice to get the match ing patien t | |||||
| 84 | final PatientMat chResponse patientSe archRespon se = this. pdqService | |||||
| 85 | .searchPat ient(patie ntSearchRe quest); | |||||
| 86 | patien ts = patie ntSearchRe sponse | |||||
| 87 | .getPatien ts().getPa tientProfi le(); | |||||
| 88 | ||||||
| 89 | } ca tch (final PdqExcept ion ex) { | |||||
| 90 | // TOD O: Maybe e nter a mes sage that MPI is not available to resolv e | |||||
| 91 | // the ICN?? | |||||
| 92 | // thr ow new Ser vletExcept ion(ex); | |||||
| 93 | return patients; | |||||
| 94 | } | |||||
| 95 | ||||||
| 96 | retu rn patient s; | |||||
| 97 | } | |||||
| 98 | ||||||
| 99 | /* * | |||||
| 100 | * Checks wh ether the given SSN is for a t est patien t. | |||||
| 101 | * | |||||
| 102 | * @param ss n SSN to c heck | |||||
| 103 | * @return t rue or fal se | |||||
| 104 | * / | |||||
| 105 | pu blic boole an isTestP atient(Str ing ssn) { | |||||
| 106 | re turn NullC hecker.isN otEmpty(ss n) && // Igno re null en tries | |||||
| 107 | ssn. length() = = 9 && ( // Igno re entries that aren 't exactly 9 digits | |||||
| 108 | ssn. startsWith ("000") || // Area number 00 0 denotes a test pat ient | |||||
| 109 | ssn. startsWith ("666") || // Area number 66 6 denotes a test pat ient | |||||
| 110 | ssn. startsWith ("9") || // Area number in 900-999 r ange denot es a test patient | |||||
| 111 | ssn. substring( 3, 5).equa ls("00") | | // Grou p number 0 0 denotes a test pat ient | |||||
| 112 | ssn. substring( 5, 9).equa ls("0000") ); // Seri al number 0000 denot es a test patient | |||||
| 113 | } | |||||
| 114 | ||||||
| 115 | pu blic Strin g getForma ttedDateTi me(Date da te) { | |||||
| 116 | retu rn getForm attedDateS tring(date , | |||||
| 117 | "MM/dd/y yyy hh:mm a"); | |||||
| 118 | } | |||||
| 119 | ||||||
| 120 | pu blic Strin g getForma ttedDate(D ate date) { | |||||
| 121 | retu rn getForm attedDateS tring(date , | |||||
| 122 | "MM/dd/y yyy"); | |||||
| 123 | } | |||||
| 124 | ||||||
| 125 | pu blic Strin g getForma ttedDate(S tring para mDate) { | |||||
| 126 | if (NullChec ker.isNull OrEmpty(pa ramDate)) { | |||||
| 127 | return " "; | |||||
| 128 | } else { | |||||
| 129 | Date dat e = DateUt il.parseDa teMMddyyyy (paramDate ); | |||||
| 130 | return g etFormatte dDate(date ); | |||||
| 131 | } | |||||
| 132 | } | |||||
| 133 | ||||||
| 134 | pu blic int g etDisclosu resDetaile dReportCap AsInt() { | |||||
| 135 | retu rn Integer .parseInt( this.discl osuresDeta iledReport Cap); | |||||
| 136 | } | |||||
| 137 | ||||||
| 138 | pu blic int g etRecvdDoc sDetailedR eportCapAs Int() { | |||||
| 139 | retu rn Integer .parseInt( this.recvd DocsDetail edReportCa p); | |||||
| 140 | } | |||||
| 141 | ||||||
| 142 | pu blic int g etConsentD irectivesR eportCapAs Int() { | |||||
| 143 | retu rn Integer .parseInt( this.conse ntDirectiv esReportCa p); | |||||
| 144 | } | |||||
| 145 | ||||||
| 146 | pu blic int g etPdDetail edReportCa pAsInt() { | |||||
| 147 | retu rn Integer .parseInt( this.pdDet ailedRepor tCap); | |||||
| 148 | } | |||||
| 149 | ||||||
| 150 | @R equired | |||||
| 151 | pu blic void setPdqServ ice(final PdqService pdqServic e) { | |||||
| 152 | this .pdqServic e = pdqSer vice; | |||||
| 153 | } | |||||
| 154 | ||||||
| 155 | @R equired | |||||
| 156 | pu blic void setDisclos uresDetail edReportCa p(final St ring discl osuresDeta iledReport Cap) { | |||||
| 157 | this .disclosur esDetailed ReportCap = disclosu resDetaile dReportCap ; | |||||
| 158 | } | |||||
| 159 | ||||||
| 160 | @R equired | |||||
| 161 | pu blic void setRecvdDo csDetailed ReportCap( final Stri ng recvdDo csDetailed ReportCap) { | |||||
| 162 | this .recvdDocs DetailedRe portCap = recvdDocsD etailedRep ortCap; | |||||
| 163 | } | |||||
| 164 | ||||||
| 165 | @R equired | |||||
| 166 | pu blic void setConsent Directives ReportCap( final Stri ng consent Directives ReportCap) { | |||||
| 167 | this .consentDi rectivesRe portCap = consentDir ectivesRep ortCap; | |||||
| 168 | } | |||||
| 169 | ||||||
| 170 | @R equired | |||||
| 171 | pu blic void setPdDetai ledReportC ap(final S tring pdDe tailedRepo rtCap) { | |||||
| 172 | this .pdDetaile dReportCap = pdDetai ledReportC ap; | |||||
| 173 | } | |||||
| 174 | ||||||
| 175 | pr ivate Stri ng getForm attedDateS tring(fina l Date dat e, final S tring date Pattern) { | |||||
| 176 | if ( date == nu ll) { | |||||
| 177 | return "n/a"; | |||||
| 178 | } | |||||
| 179 | ||||||
| 180 | fina l SimpleDa teFormat f ormatter = new Simpl eDateForma t( | |||||
| 181 | datePatt ern); | |||||
| 182 | ||||||
| 183 | retu rn formatt er.format( date); | |||||
| 184 | ||||||
| 185 | } | |||||
| 186 | ||||||
| 187 | /** | |||||
| 188 | * Ext racts valu e of key=v alue pair from detai ls propert y | |||||
| 189 | * @pa ram detail s Details property o f AuditTyp e | |||||
| 190 | * @pa ram key Ke y of the k ey/value p air | |||||
| 191 | * @re turn Value of the ke y/value pa ir | |||||
| 192 | */ | |||||
| 193 | pu blic Strin g extractF romDetails (String de tails, Str ing key) { | |||||
| 194 | in t pos1 = d etails.ind exOf(key + "="); | |||||
| 195 | in t pos2; | |||||
| 196 | ||||||
| 197 | if (pos1 != -1) { | |||||
| 198 | pos2 = d etails.ind exOf(",", pos1); | |||||
| 199 | if (pos2 != -1) { | |||||
| 200 | retu rn details .substring (pos1 + ke y.length() + 1, pos2 ); | |||||
| 201 | } | |||||
| 202 | } | |||||
| 203 | re turn ""; | |||||
| 204 | } | |||||
| 205 | ||||||
| 206 | public String fi ndOrganiza tionByOid( String org OId, Strin g orgName) { | |||||
| 207 | St ring retVa lue = "Unk nown"; | |||||
| 208 | ||||||
| 209 | if (!NullChe cker.isNul lOrEmpty(o rgName)) { | |||||
| 210 | retValue = orgName ; | |||||
| 211 | } | |||||
| 212 | ||||||
| 213 | if (!NullChe cker.isNul lOrEmpty(o rgOId)) { | |||||
| 214 | final Qu ery q = th is.em.crea teNamedQue ry("Organi zation.fin dByOrgOid" ); | |||||
| 215 | if (orgO Id.startsW ith("urn:o id:")) { | |||||
| 216 | orgO Id = orgOI d.substrin g("urn:oid :".length( )); | |||||
| 217 | } | |||||
| 218 | q.setPar ameter("or gOid", org OId.trim() ); | |||||
| 219 | List res ults = q.g etResultLi st(); | |||||
| 220 | if (!res ults.isEmp ty()) { | |||||
| 221 | Orga nization o = (Organi zation) re sults.get( 0); | |||||
| 222 | retV alue = o.g etOrgName( ); | |||||
| 223 | } | |||||
| 224 | } | |||||
| 225 | ||||||
| 226 | re turn retVa lue; | |||||
| 227 | } | |||||
| 228 | ||||||
| 229 | /** | |||||
| 230 | * Cre ates the a ctive and inactive o rganizatio n lists | |||||
| 231 | * @pa ram reques t | |||||
| 232 | */ | |||||
| 233 | public void getO rgLists(Ht tpServletR equest req uest, Cons entManagem entHelper cmsHelper) { | |||||
| 234 | fi nal Query getActive = this.em. createName dQuery("Or ganization .findByAct ive"); | |||||
| 235 | fi nal Query getInactiv e = this.e m.createNa medQuery(" Organizati on.findByA ctive"); | |||||
| 236 | ||||||
| 237 | ge tActive.se tParameter ("active", 'Y'); | |||||
| 238 | ge tInactive. setParamet er("active ", 'N'); | |||||
| 239 | ||||||
| 240 | Ar rayList<Or ganization > activeOr gs = (Arra yList<Orga nization>) getActive. getResultL ist(); | |||||
| 241 | Ar rayList<Or ganization > inactive Orgs = (Ar rayList<Or ganization >)getInact ive.getRes ultList(); | |||||
| 242 | ||||||
| 243 | Or ganization va = new Organizati on(); | |||||
| 244 | va .setOrgNam e(cmsHelpe r.getHomeC ommunity() .getOrgNam e()); | |||||
| 245 | va .setOrgOid (cmsHelper .getHomeCo mmunity(). getOrgOid( )); | |||||
| 246 | ac tiveOrgs.a dd(va); | |||||
| 247 | ||||||
| 248 | re quest.setA ttribute(" activeOrgs ", activeO rgs); | |||||
| 249 | re quest.setA ttribute(" inactiveOr gs", inact iveOrgs); | |||||
| 250 | } | |||||
| 251 | ||||||
| 252 | /** | |||||
| 253 | * Cre ates the a ctive and inactive o rganizatio n lists fo r the Rece ived Docum ents repor ts | |||||
| 254 | * @pa ram reques t | |||||
| 255 | */ | |||||
| 256 | public void getR eceivedDoc sOrgLists( HttpServle tRequest r equest) { | |||||
| 257 | fi nal Query getActive = this.em. createName dQuery("Or ganization .findByAct iveOrgCons umerOnly") ; | |||||
| 258 | fi nal Query getInactiv e = this.e m.createNa medQuery(" Organizati on.findByA ctiveOrgCo nsumerOnly "); | |||||
| 259 | ||||||
| 260 | ge tActive.se tParameter ("active", 'Y'); | |||||
| 261 | ge tInactive. setParamet er("active ", 'N'); | |||||
| 262 | ||||||
| 263 | ge tActive.se tParameter ("orgConsu merOnly", 'N'); | |||||
| 264 | ge tInactive. setParamet er("orgCon sumerOnly" , 'N'); | |||||
| 265 | ||||||
| 266 | Ar rayList<Or ganization > activeOr gs = (Arra yList<Orga nization>) getActive. getResultL ist(); | |||||
| 267 | Ar rayList<Or ganization > inactive Orgs = (Ar rayList<Or ganization >)getInact ive.getRes ultList(); | |||||
| 268 | ||||||
| 269 | re quest.setA ttribute(" activeOrgs ", activeO rgs); | |||||
| 270 | re quest.setA ttribute(" inactiveOr gs", inact iveOrgs); | |||||
| 271 | } | |||||
| 272 | ||||||
| 273 | public static St ring getSt ationNumbe rsFromRequ est(HttpSe rvletReque st request ) { | |||||
| 274 | St ring stati onNumbers = request. getParamet er("statio nNumbers") ; | |||||
| 275 | if (stationN umbers == null) { | |||||
| 276 | // This is the ini tial repor t request, user hasn 't picked anything i n the Faci lities dia log yet. | |||||
| 277 | stationN umbers = " "; | |||||
| 278 | try { | |||||
| 279 | Faci lity facil ity = (Fac ility) req uest.getSe ssion().ge tAttribute ("defaultU serFacilit y"); | |||||
| 280 | if ( facility ! = null) { | |||||
| 281 | stationNum bers = fac ility.getF acilitySta tion(); | |||||
| 282 | } | |||||
| 283 | } catch (Exception e) { | |||||
| 284 | // T ODO log er ror | |||||
| 285 | } | |||||
| 286 | } | |||||
| 287 | re turn stati onNumbers; | |||||
| 288 | } | |||||
| 289 | ||||||
| 290 | public static St ring norma lizeConsne ntTypeName (String co nsentType) { | |||||
| 291 | if (consentT ype.contai ns("NwHIN" )) { | |||||
| 292 | consentT ype = cons entType.re place("NwH IN", Const ants.getOr ganization Name()); | |||||
| 293 | } | |||||
| 294 | re turn conse ntType; | |||||
| 295 | } | |||||
| 296 | ||||||
| 297 | /** | |||||
| 298 | * Acc epts an OI D and trim s the urn prefix | |||||
| 299 | * @pa ram oid | |||||
| 300 | * @re turn oid w ithout urn prefix | |||||
| 301 | */ | |||||
| 302 | public static St ring trimO rgOid(Stri ng oid) { | |||||
| 303 | if (oid.cont ains("urn: oid:")) { | |||||
| 304 | oid = oi d.replace( "urn:oid:" , ""); | |||||
| 305 | } | |||||
| 306 | re turn oid; | |||||
| 307 | } | |||||
| 308 | ||||||
| 309 | /** | |||||
| 310 | * Cha nges strin g paramete r start da te to Date object. | |||||
| 311 | * | |||||
| 312 | * @pa ram paramS tart Start date para meter | |||||
| 313 | * @re turn Date object | |||||
| 314 | */ | |||||
| 315 | public static Da te getStar tDate(Stri ng paramSt artDate) { | |||||
| 316 | Da te startDa te = null; | |||||
| 317 | ||||||
| 318 | if (!NullChe cker.isNul lOrEmpty(p aramStartD ate)) { | |||||
| 319 | startDat e = DateUt il.parseDa teMMddyyyy (paramStar tDate); | |||||
| 320 | } | |||||
| 321 | ||||||
| 322 | re turn start Date; | |||||
| 323 | } | |||||
| 324 | ||||||
| 325 | /** | |||||
| 326 | * Cha nges strin g paramete r end date to Date o bject with 23:59:59 timestamp. | |||||
| 327 | * | |||||
| 328 | * @pa ram paramE ndDate End date para meter | |||||
| 329 | * @re turn Date object | |||||
| 330 | */ | |||||
| 331 | public static Da te getEndD ate(String paramEndD ate) { | |||||
| 332 | Da te endDate = null; | |||||
| 333 | ||||||
| 334 | if (!NullChe cker.isNul lOrEmpty(p aramEndDat e)) { | |||||
| 335 | endDate = DateUtil .parseDate MMddyyyy(p aramEndDat e); | |||||
| 336 | endDate = DateUtil .voidTime( endDate); | |||||
| 337 | endDate = DateUtil .addTime(e ndDate, Ca lendar.HOU R_OF_DAY, 23); | |||||
| 338 | endDate = DateUtil .addTime(e ndDate, Ca lendar.MIN UTE, 59); | |||||
| 339 | endDate = DateUtil .addTime(e ndDate, Ca lendar.SEC OND, 59); | |||||
| 340 | } | |||||
| 341 | ||||||
| 342 | re turn endDa te; | |||||
| 343 | } | |||||
| 344 | ||||||
| 345 | /** | |||||
| 346 | * set s the defa ult start date and e nd date to the sessi on as stri ngs to be used in th e search f ilters. | |||||
| 347 | * the end date is current day with the start date 30 da ys prior | |||||
| 348 | * sta rtDateStri ng and end DateString | |||||
| 349 | * @pa ram sessio n | |||||
| 350 | */ | |||||
| 351 | public static vo id setDefa ultSearchD ates(HttpS ession ses sion){ | |||||
| 352 | ||||||
| 353 | Da teFormat d ateFormat = new Simp leDateForm at("MM/dd/ yyyy"); | |||||
| 354 | Ca lendar cal endar = Ca lendar.get Instance() ; | |||||
| 355 | St ring endDa teString = dateForma t.format(c alendar.ge tTime()); | |||||
| 356 | ca lendar.add (Calendar. MONTH, -1) ; | |||||
| 357 | St ring start DateString = dateFor mat.format (calendar. getTime()) ; | |||||
| 358 | se ssion.setA ttribute(" startDateD efault", s tartDateSt ring); | |||||
| 359 | se ssion.setA ttribute(" endDateDef ault", end DateString ); | |||||
| 360 | } | |||||
| 361 | ||||||
| 362 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.