Produced by Araxis Merge on 6/9/2017 3:51:28 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:28 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\report | OptInOptOutReportResults.java | Fri Apr 21 20:15:58 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 488 |
| 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.report ; | |||||
| 2 | ||||||
| 3 | import gov .va.nvap.c ommon.tran sformer.Tr ansformerE xception; | |||||
| 4 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |||||
| 5 | import gov .va.nvap.c ommon.xpat h.XPathExc eption; | |||||
| 6 | import gov .va.nvap.s ervice.aud it.Consent AuditType; | |||||
| 7 | import gov .va.nvap.w eb.app.Res ponseDispa tcherHttpS ervlet; | |||||
| 8 | import gov .va.nvap.w eb.consent .audit.Aud itedConsen tEx; | |||||
| 9 | import gov .va.nvap.w eb.consent .audit.dao .AuditedCo nsentDAO; | |||||
| 10 | import gov .va.nvap.w eb.dao.Fac ilityDAO; | |||||
| 11 | import gov .va.nvap.w eb.dao.Use rDocumentD AO; | |||||
| 12 | import gov .va.nvap.w eb.helper. document.D ocumentHel per; | |||||
| 13 | import gov .va.nvap.w eb.helper. document.M ediaType; | |||||
| 14 | import gov .va.nvap.w eb.helper. document.R epresentat ionType; | |||||
| 15 | import gov .va.nvap.w eb.helper. facility.F acilityHel per; | |||||
| 16 | import gov .va.nvap.w eb.helper. report.Rep ortHelper; | |||||
| 17 | import gov .va.nvap.w eb.patient .ExcelGene ratorThrea d; | |||||
| 18 | import gov .va.nvap.w eb.user.Us erHelper; | |||||
| 19 | import gov .va.nvap.w eb.util.Co nstants; | |||||
| 20 | import gov .va.nvap.w eb.util.Fi eldChecks; | |||||
| 21 | import gov .va.nvap.w eb.util.Pa ginator; | |||||
| 22 | import gov .va.nvap.w eb.util.xl s.CsvExpor ter; | |||||
| 23 | import gov .va.nvap.w eb.util.xl s.ExcelExp orter; | |||||
| 24 | ||||||
| 25 | import jav a.io.IOExc eption; | |||||
| 26 | import jav a.util.Arr ayList; | |||||
| 27 | import jav a.util.Dat e; | |||||
| 28 | import jav a.util.Has hMap; | |||||
| 29 | import jav a.util.Lis t; | |||||
| 30 | import jav a.util.Map ; | |||||
| 31 | import jav a.util.Lin kedHashMap ; | |||||
| 32 | ||||||
| 33 | import jav ax.servlet .ServletEx ception; | |||||
| 34 | import jav ax.servlet .http.Http ServletReq uest; | |||||
| 35 | import jav ax.servlet .http.Http ServletRes ponse; | |||||
| 36 | import jav ax.servlet .http.Http Session; | |||||
| 37 | ||||||
| 38 | /** | |||||
| 39 | * Consent Directive Detail Re port resul ts servlet | |||||
| 40 | * | |||||
| 41 | * @author Asha Amri traj edite d by Steph en Miller | |||||
| 42 | */ | |||||
| 43 | public cla ss OptInOp tOutReport Results ex tends Resp onseDispat cherHttpSe rvlet { | |||||
| 44 | ||||||
| 45 | /** | |||||
| 46 | * Ser ial UID. | |||||
| 47 | */ | |||||
| 48 | privat e static f inal long serialVers ionUID = - 1131510956 121479062L ; | |||||
| 49 | ||||||
| 50 | public void expo rtToCsv(fi nal HttpSe rvletReque st request , | |||||
| 51 | fi nal HttpSe rvletRespo nse respon se) throws ServletEx ception, I OException { | |||||
| 52 | ||||||
| 53 | fi nal List<M ap<String, Object>> results = this.getRe sults( | |||||
| 54 | request. getSession (), new Pa ginator(th is.getRepo rtHelper() .getConsen tDirective sReportCap AsInt())); | |||||
| 55 | ||||||
| 56 | Cs vExporter csvExporte r = new Cs vExporter( ); | |||||
| 57 | ||||||
| 58 | Ma p<String, String> cs vReportMap = new Lin kedHashMap <String, S tring>(); | |||||
| 59 | ||||||
| 60 | cs vReportMap .put("SSN" , "ssn"); | |||||
| 61 | cs vReportMap .put("Pati ent Last N ame", "las tName"); | |||||
| 62 | cs vReportMap .put("Pati ent First Name", "fi rstName"); | |||||
| 63 | cs vReportMap .put("Time of Event (CT)", "au ditTimeFor matted"); | |||||
| 64 | cs vReportMap .put("Pati ent Signat ure/Patien t Deceased Date", "p atientDate Formatted" ); | |||||
| 65 | cs vReportMap .put("Purp ose of Use ", "purpos eOfUse"); | |||||
| 66 | cs vReportMap .put("Cons ent Type", "consentT ype"); | |||||
| 67 | cs vReportMap .put("Inac tivation R eason", "i nactivatio nReason"); | |||||
| 68 | cs vReportMap .put("Ente red By", " userId"); | |||||
| 69 | cs vReportMap .put("Auth enticating Facility" , "facilit yName"); | |||||
| 70 | cs vReportMap .put("Auth enticating Facility Station ID ", "facili tyId"); | |||||
| 71 | cs vReportMap .put("VISN ", "visnNa me"); | |||||
| 72 | ||||||
| 73 | cs vExporter. exportToCS V(response , "Consent _Directive _Detail_Re port", res ults, (Lin kedHashMap <String, S tring>) cs vReportMap ); | |||||
| 74 | } | |||||
| 75 | ||||||
| 76 | /** | |||||
| 77 | * Exp ort to exc el - This method is called whe n the user clicks on the excel icon in t he JSP. Re flection i s used in the | |||||
| 78 | * Res ponseDispa tcherHttpS ervlet to call this method bas ed on the http param eters. | |||||
| 79 | * | |||||
| 80 | * @pa ram reques t HTTP Req uest | |||||
| 81 | * @pa ram respon se HTTP Re sponse | |||||
| 82 | * @th rows Servl etExceptio n | |||||
| 83 | * @th rows IOExc eption | |||||
| 84 | */ | |||||
| 85 | public void expo rtToExcel( final Http ServletReq uest reque st, | |||||
| 86 | fi nal HttpSe rvletRespo nse respon se) throws ServletEx ception, I OException { | |||||
| 87 | Ex celGenerat orThread e xGenThread = new Exc elGenerato rThread("e xGenThread "); | |||||
| 88 | // Get the se ssion | |||||
| 89 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 90 | ||||||
| 91 | // Create a map of key which is based on t he result data key a nd the hea ding value | |||||
| 92 | // The headin g is used to create the column headers a nd the | |||||
| 93 | // key is use d to pull the data f rom the re sults | |||||
| 94 | fi nal Map<St ring, Stri ng> report Map = new LinkedHash Map<String , String>( ); | |||||
| 95 | ||||||
| 96 | // Generate filters. | |||||
| 97 | fi nal Map<St ring, List <Object>> filterMap = new Link edHashMap< String, Li st<Object> >(); | |||||
| 98 | fi nal Linked HashMap<St ring, Obje ct> filter s = new Li nkedHashMa p<String, Object>(); | |||||
| 99 | ||||||
| 100 | fi nal Object startDate Str = sess ion.getAtt ribute("op tInOptOutQ ueryStartD ate"); | |||||
| 101 | fi nal Object endDateSt r = sessio n.getAttri bute("optI nOptOutQue ryEndDate" ); | |||||
| 102 | ||||||
| 103 | fi lters.put( "SSN", ses sion.getAt tribute("o ptInOptOut QuerySsn") ); | |||||
| 104 | fi lters.put( "Last Name ", session .getAttrib ute("optIn OptOutQuer yLastName" )); | |||||
| 105 | fi lters.put( "First Nam e", sessio n.getAttri bute("optI nOptOutQue ryFirstNam e")); | |||||
| 106 | fi lters.put( "Start Dat e", startD ateStr == null ? "" : this.get ReportHelp er().getFo rmattedDat e((Date) s tartDateSt r)); | |||||
| 107 | fi lters.put( "End Date" , endDateS tr == null ? "" : th is.getRepo rtHelper() .getFormat tedDate((D ate) endDa teStr)); | |||||
| 108 | fi lters.put( "Authentic ating Faci lity", Exc elExporter .getFacili tiesFilter (getFacili tyDAO(), ( String)ses sion.getAt tribute("o ptInOptOut QueryStati onNumbers" ))); | |||||
| 109 | fi lters.put( "Consent T ype", Exce lExporter. getFilterV alue(sessi on.getAttr ibute("opt InOptOutQu eryConsent TypeName") )); | |||||
| 110 | fi lters.put( "Inactivat ion Reason ", ExcelEx porter.get FilterValu e(session. getAttribu te("inacti vationReas on"))); | |||||
| 111 | fi lters.put( "Entered B y", sessio n.getAttri bute("ente redBy")); | |||||
| 112 | Ex celExporte r.populate FilterMapF orExport(r equest, fi lters, fil terMap, se ssion.getA ttribute(" patientTyp es").toStr ing()); | |||||
| 113 | ex GenThread. setFilterM ap(filterM ap); | |||||
| 114 | ||||||
| 115 | re portMap.pu t("ssn", " SSN"); | |||||
| 116 | re portMap.pu t("lastNam e", "Patie nt Last Na me"); | |||||
| 117 | re portMap.pu t("firstNa me", "Pati ent First Name"); | |||||
| 118 | re portMap.pu t("auditTi meFormatte d", "Time of Event ( CT)"); | |||||
| 119 | re portMap.pu t("patient DateFormat ted", "Pat ient Signa ture/Patie nt Decease d Date"); | |||||
| 120 | re portMap.pu t("purpose OfUse", "P urpose of Use"); | |||||
| 121 | re portMap.pu t("consent Type", "Co nsent Type "); | |||||
| 122 | re portMap.pu t("inactiv ationReaso n", "Inact ivation Re ason"); | |||||
| 123 | re portMap.pu t("userId" , "Entered By"); | |||||
| 124 | re portMap.pu t("facilit yName", "A uthenticat ing Facili ty"); | |||||
| 125 | re portMap.pu t("facilit yId", "Aut henticatin g Facility Station I D"); | |||||
| 126 | re portMap.pu t("visnNam e", "VISN" ); | |||||
| 127 | ex GenThread. setReportM ap(reportM ap); | |||||
| 128 | ||||||
| 129 | // Set names for Excel generator thread | |||||
| 130 | ex GenThread. setTitle(" Consent Di rective De tailed Rep ort"); | |||||
| 131 | ||||||
| 132 | ex GenThread. setExcelEx porter(thi s.getExcel Exporter() ); | |||||
| 133 | ex GenThread. setReportH elper(getR eportHelpe r()); | |||||
| 134 | ex GenThread. setUserId( UserHelper .getUserNa me(request )); | |||||
| 135 | ex GenThread. setAudited ConsentDAO (this.getB ean("audit edConsentD AO", Audit edConsentD AO.class)) ; | |||||
| 136 | ex GenThread. setDocumen tHelper(ge tDocumentH elper()); | |||||
| 137 | ex GenThread. setUserDoc umentDao(g etUserDocu mentDAO()) ; | |||||
| 138 | ||||||
| 139 | // Set searc h attribut es for get ting audit results | |||||
| 140 | ex GenThread. setAttribu tes(mapSes sionAttrib utes(sessi on)); | |||||
| 141 | ||||||
| 142 | ex GenThread. start(); | |||||
| 143 | ||||||
| 144 | th is.forward (request, response, "show"); | |||||
| 145 | } | |||||
| 146 | ||||||
| 147 | privat e Map<Stri ng, Object > mapSessi onAttribut es(HttpSes sion sessi on) { | |||||
| 148 | Ma p<String, Object> at tributes = new HashM ap<String, Object>() ; | |||||
| 149 | ||||||
| 150 | at tributes.p ut("ssn", (String) s ession | |||||
| 151 | .get Attribute( "optInOptO utQuerySsn ")); | |||||
| 152 | at tributes.p ut("lastNa me", (Stri ng) sessio n | |||||
| 153 | .get Attribute( "optInOptO utQueryLas tName")); | |||||
| 154 | at tributes.p ut("firstN ame", (Str ing) sessi on | |||||
| 155 | .get Attribute( "optInOptO utQueryFir stName")); | |||||
| 156 | at tributes.p ut("userId ", (String ) session | |||||
| 157 | .get Attribute( "enteredBy ")); | |||||
| 158 | ||||||
| 159 | Da te startDa te = (Date ) session. getAttribu te("optInO ptOutQuery StartDate" ); | |||||
| 160 | Da te endDate = (Date) session.ge tAttribute ("optInOpt OutQueryEn dDate"); | |||||
| 161 | at tributes.p ut("startD ate", star tDate); | |||||
| 162 | at tributes.p ut("endDat e", endDat e); | |||||
| 163 | ||||||
| 164 | at tributes.p ut("organi zation", ( String) se ssion | |||||
| 165 | .get Attribute( "documentD isclosureQ ueryOrgani zation")); | |||||
| 166 | at tributes.p ut("statio nNumbers", (String) session.ge tAttribute ("optInOpt OutQuerySt ationNumbe rs")); | |||||
| 167 | at tributes.p ut("patien tTypes", ( Integer) s ession.get Attribute( "patientTy pes")); | |||||
| 168 | at tributes.p ut("consen tType", (S tring) ses sion.getAt tribute("o ptInOptOut QueryConse ntType")); | |||||
| 169 | at tributes.p ut("inacti vationReas on", (Stri ng) sessio n.getAttri bute("inac tivationRe ason")); | |||||
| 170 | at tributes.p ut("includ eUnknownVi sn", Boole an.TRUE.eq uals(sessi on.getAttr ibute("inc ludeUnknow nVisn"))); | |||||
| 171 | // sort | |||||
| 172 | at tributes.p ut("sortVa lue", (Str ing) sessi on | |||||
| 173 | .get Attribute( "optInOptO utSortValu e")); | |||||
| 174 | at tributes.p ut("sortDi rection", (String) s ession | |||||
| 175 | .get Attribute( "optInOptO utSortDire ction")); | |||||
| 176 | ||||||
| 177 | // Set Actio n Types | |||||
| 178 | Li st<String> actionTyp es = new A rrayList<S tring>(); | |||||
| 179 | ac tionTypes. add(Consen tAuditType .OPTIN_AUD IT_TYPE.va lue()); | |||||
| 180 | ac tionTypes. add(Consen tAuditType .OPTOUT_AU DIT_TYPE.v alue()); | |||||
| 181 | at tributes.p ut("action Types", ac tionTypes) ; | |||||
| 182 | ||||||
| 183 | re turn attri butes; | |||||
| 184 | } | |||||
| 185 | ||||||
| 186 | public DocumentH elper getD ocumentHel per() { | |||||
| 187 | re turn this. getBean("a dapterDocu mentHelper ", Documen tHelper.cl ass); | |||||
| 188 | } | |||||
| 189 | ||||||
| 190 | /** | |||||
| 191 | * Get the excel exporter class from Spring. | |||||
| 192 | * | |||||
| 193 | * @re turn the e xcel expor ter object | |||||
| 194 | */ | |||||
| 195 | public ExcelExpo rter getEx celExporte r() { | |||||
| 196 | fi nal ExcelE xporter ex celExporte r = this.g etBean("ex celExporte r", | |||||
| 197 | ExcelExp orter.clas s); | |||||
| 198 | re turn excel Exporter; | |||||
| 199 | } | |||||
| 200 | ||||||
| 201 | /** | |||||
| 202 | * Get the facil ity helper from Spri ng. | |||||
| 203 | * @re turn Facil ityHelper | |||||
| 204 | */ | |||||
| 205 | public FacilityH elper getF acilityHel per() { | |||||
| 206 | re turn this. getBean("f acilityHel per", Faci lityHelper .class); | |||||
| 207 | } | |||||
| 208 | ||||||
| 209 | public ReportHel per getRep ortHelper( ) { | |||||
| 210 | fi nal Report Helper rep ortHelper = this.get Bean("repo rtHelper", | |||||
| 211 | ReportHe lper.class ); | |||||
| 212 | re turn repor tHelper; | |||||
| 213 | } | |||||
| 214 | ||||||
| 215 | privat e List<Map <String, O bject>> ge tResults(f inal HttpS ession ses sion, | |||||
| 216 | fi nal Pagina tor pagina tor) throw s ServletE xception { | |||||
| 217 | fi nal Audite dConsentDA O auditedC onsentDAO = this.get Bean("audi tedConsent DAO", Audi tedConsent DAO.class) ; | |||||
| 218 | fi nal Audite dConsentDA O.DetailRe quest req = auditedC onsentDAO. new Detail Request(); | |||||
| 219 | ||||||
| 220 | re q.patientF irstName = (String) session.ge tAttribute ("optInOpt OutQueryFi rstName"); | |||||
| 221 | re q.patientL astName = (String) s ession.get Attribute( "optInOptO utQueryLas tName"); | |||||
| 222 | re q.patientS sn = (Stri ng) sessio n.getAttri bute("optI nOptOutQue rySsn"); | |||||
| 223 | re q.stationN umbers = ( String) se ssion.getA ttribute(" optInOptOu tQueryStat ionNumbers "); | |||||
| 224 | re q.consentT ype = (Str ing) sessi on.getAttr ibute("opt InOptOutQu eryConsent Type"); | |||||
| 225 | re q.inactiva tionReason = (String ) session. getAttribu te("inacti vationReas on"); | |||||
| 226 | re q.startDat e = (Date) session.g etAttribut e("optInOp tOutQueryS tartDate") ; | |||||
| 227 | re q.endDate = (Date) s ession.get Attribute( "optInOptO utQueryEnd Date"); | |||||
| 228 | re q.patientT ypes = (In teger) ses sion.getAt tribute("p atientType s"); | |||||
| 229 | re q.userId = (String) session.ge tAttribute ("enteredB y"); | |||||
| 230 | re q.includeU nknownVisn = Boolean .TRUE.equa ls(session .getAttrib ute("inclu deUnknownV isn")); | |||||
| 231 | re q.sortFiel d = (Strin g) session .getAttrib ute("optIn OptOutSort Value"); | |||||
| 232 | re q.sortDire ction = (S tring) ses sion.getAt tribute("o ptInOptOut SortDirect ion"); | |||||
| 233 | re q.currentP age = pagi nator.getC urrentPage (); | |||||
| 234 | re q.pageSize = paginat or.getReco rdsPerPage (); | |||||
| 235 | ||||||
| 236 | // The resul t of the q uery is a list of ar rays. | |||||
| 237 | // Each arra y is a [Au ditedConse nt, Facili ty, Visn] | |||||
| 238 | Li st<Object> auditedCo nsentExLis t = audite dConsentDA O.getEvent s(req); | |||||
| 239 | ||||||
| 240 | fi nal List<M ap<String, Object>> results = new ArrayL ist<Map<St ring, Obje ct>>(); | |||||
| 241 | if (NullChec ker.isNotE mpty(audit edConsentE xList)) { | |||||
| 242 | for (fin al Object o : audite dConsentEx List) { | |||||
| 243 | Audi tedConsent Ex auditTy pe = (Audi tedConsent Ex) o; | |||||
| 244 | ||||||
| 245 | fina l Map<Stri ng, Object > resultMa p = new Ha shMap<Stri ng, Object >(); | |||||
| 246 | ||||||
| 247 | // R eplace SSN with Mask | |||||
| 248 | Repo rtDataProc essor.addS snToResult Map(result Map, audit Type.getPa tientSsn() ); | |||||
| 249 | ||||||
| 250 | resu ltMap.put( "icn", aud itType.get PatientId( )); | |||||
| 251 | resu ltMap.put( "auditTime ", auditTy pe.getTime OfEvent()) ; | |||||
| 252 | resu ltMap.put( "auditTime Formatted" , this.get ReportHelp er() | |||||
| 253 | .getFormat tedDateTim e(auditTyp e.getTimeO fEvent())) ; | |||||
| 254 | resu ltMap.put( "userId", auditType. getUserId( )); | |||||
| 255 | resu ltMap.put( "actionTyp e", auditT ype.getAct ionType()) ; | |||||
| 256 | ||||||
| 257 | Stri ng consent TypeRow = auditType. getConsent Type(); | |||||
| 258 | if ( consentTyp eRow.conta ins("NwHIN ")) { | |||||
| 259 | consentTyp eRow = con sentTypeRo w.replace( "NwHIN", C onstants.g etOrganiza tionName() ); | |||||
| 260 | } | |||||
| 261 | resu ltMap.put( "consentTy pe", conse ntTypeRow) ; | |||||
| 262 | resu ltMap.put( "firstName ", auditTy pe.getPati entGivenNa me()); | |||||
| 263 | resu ltMap.put( "lastName" , auditTyp e.getPatie ntLastName ()); | |||||
| 264 | resu ltMap.put( "purposeOf Use", audi tType.getP ouValue()) ; | |||||
| 265 | ||||||
| 266 | Stri ng inactiv ationReaso nRow = aud itType.get OptoutReas on(); | |||||
| 267 | resu ltMap.put( "inactivat ionReason" , inactiva tionReason Row); | |||||
| 268 | resu ltMap.put( "patientDa te", audit Type.getCr eatedDate( )); | |||||
| 269 | resu ltMap.put( "patientDa teFormatte d", this.g etReportHe lper() | |||||
| 270 | .getFormat tedDate(au ditType.ge tCreatedDa te())); | |||||
| 271 | ||||||
| 272 | // final String va Facility = this.getF acilityHel per() | |||||
| 273 | // . getFacilit yNameBySta tionId(aud itType.get Facility() ); | |||||
| 274 | // r esultMap.p ut("facili ty", | |||||
| 275 | // R eportDataP rocessor.f ixStation( vaFacility )); | |||||
| 276 | resu ltMap.put( "facilityN ame", Repo rtDataProc essor | |||||
| 277 | .fixStatio n(auditTyp e.getFacil ityName()) ); | |||||
| 278 | resu ltMap.put( "facilityI d", auditT ype.getFac ility()); | |||||
| 279 | resu ltMap.put( "visnName" , NullChec ker.isNull OrEmpty(au ditType.ge tVisnName( )) ? "Unkn own" : aud itType.get VisnName() ); | |||||
| 280 | ||||||
| 281 | if ( ConsentAud itType.OPT IN_AUDIT_T YPE.value( ).equals( | |||||
| 282 | auditType. getActionT ype()) | |||||
| 283 | || Consent AuditType. OPTOUT_AUD IT_TYPE.va lue().equa ls( | |||||
| 284 | auditT ype.getAct ionType()) ) { | |||||
| 285 | resultMap. put("audit Id", audit Type.getCo nsentAudit Id()); | |||||
| 286 | // Get the CDA R2 Co ntent from Audit | |||||
| 287 | final Stri ng content = audited ConsentDAO | |||||
| 288 | .getMe ssageConte nt(auditTy pe.getCons entAuditId ()); | |||||
| 289 | if (NullCh ecker.isNo tEmpty(con tent)) { | |||||
| 290 | try { | |||||
| 291 | // Get the a ttachment inside the audit | |||||
| 292 | fi nal String attachmen t = this.g etDocument Helper() | |||||
| 293 | .getPriv acyConsent DirectiveA ttachment( | |||||
| 294 | cont ent); | |||||
| 295 | // Set the f lag | |||||
| 296 | if (NullChec ker.isNotE mpty(attac hment)) { | |||||
| 297 | resultMa p.put("has Attachment ", true); | |||||
| 298 | } else { | |||||
| 299 | resultMa p.put("has Attachment ", false); | |||||
| 300 | } | |||||
| 301 | } catc h (final T ransformer Exception ex) { | |||||
| 302 | th row new Se rvletExcep tion(ex); | |||||
| 303 | } catc h (final X PathExcept ion ex) { | |||||
| 304 | th row new Se rvletExcep tion(ex); | |||||
| 305 | } | |||||
| 306 | } | |||||
| 307 | } | |||||
| 308 | resu lts.add(Fi eldChecks. replaceEmp tyOrNullWi thSpace(re sultMap)); | |||||
| 309 | } | |||||
| 310 | } | |||||
| 311 | ||||||
| 312 | // Check if any of the patient m atch crite ria exists | |||||
| 313 | if (NullChec ker.isNotE mpty(req.p atientSsn) || NullCh ecker.isNo tEmpty(req .patientLa stName) | |||||
| 314 | || NullC hecker.isN otEmpty(re q.patientF irstName)) { | |||||
| 315 | // Defau lt to unkn own | |||||
| 316 | String r esultIcn = ""; | |||||
| 317 | if (Null Checker.is NotEmpty(a uditedCons entExList) ) { | |||||
| 318 | fina l AuditedC onsentEx r esult = (A uditedCons entEx) aud itedConsen tExList.ge t(0); | |||||
| 319 | resu ltIcn = re sult.getPa tientId(); | |||||
| 320 | ||||||
| 321 | if ( NullChecke r.isNotEmp ty(resultI cn)) { | |||||
| 322 | for (final Object o : auditedC onsentExLi st) { | |||||
| 323 | Audite dConsentEx consent = (AuditedC onsentEx) o; | |||||
| 324 | if (!r esultIcn.e quals(cons ent.getPat ientId())) { | |||||
| 325 | re sultIcn = "Multiple ICNs"; | |||||
| 326 | br eak; | |||||
| 327 | } | |||||
| 328 | } | |||||
| 329 | } el se if (Nul lChecker.i sNotEmpty( result.get PatientGiv enName()) | |||||
| 330 | && NullChe cker.isNot Empty(resu lt.getPati entLastNam e()) | |||||
| 331 | && NullChe cker.isNot Empty(resu lt.getPati entSsn())) { | |||||
| 332 | final Stri ng patient GivenName = result | |||||
| 333 | .getPa tientGiven Name(); | |||||
| 334 | final Stri ng patient LastName = result.ge tPatientLa stName(); | |||||
| 335 | final Stri ng patient Ssn = resu lt.getPati entSsn(); | |||||
| 336 | boolean mu ltipleIcns = false; | |||||
| 337 | for (final Object o : auditedC onsentExLi st) { | |||||
| 338 | Audite dConsentEx consent = (AuditedC onsentEx) o; | |||||
| 339 | if (!p atientGive nName.equa ls(consent | |||||
| 340 | .g etPatientG ivenName() ) | |||||
| 341 | || !patientL astName.eq uals(conse nt | |||||
| 342 | .getPati entLastNam e()) | |||||
| 343 | || !patientS sn.equals( consent.ge tPatientSs n())) { | |||||
| 344 | mu ltipleIcns = true; | |||||
| 345 | br eak; | |||||
| 346 | } | |||||
| 347 | } | |||||
| 348 | if (multip leIcns) { | |||||
| 349 | result Icn = "Mul tiple ICNs "; | |||||
| 350 | } else { | |||||
| 351 | result Icn = this .getReport Helper().r esolveICN( | |||||
| 352 | re sult.getPa tientGiven Name(), | |||||
| 353 | re sult.getPa tientLastN ame(), | |||||
| 354 | re sult.getPa tientSsn() ); | |||||
| 355 | } | |||||
| 356 | } | |||||
| 357 | } else i f (NullChe cker.isNot Empty(req. patientSsn ) | |||||
| 358 | && N ullChecker .isNotEmpt y(req.pati entLastNam e) | |||||
| 359 | && N ullChecker .isNotEmpt y(req.pati entFirstNa me)) { | |||||
| 360 | // T ry to get from what was typed | |||||
| 361 | resu ltIcn = th is.getRepo rtHelper() .resolveIC N(req.pati entFirstNa me, | |||||
| 362 | req.patien tLastName, req.patie ntSsn); | |||||
| 363 | } | |||||
| 364 | // Set i n Session | |||||
| 365 | if (Null Checker.is Empty(resu ltIcn)) { | |||||
| 366 | resu ltIcn = "U nknown"; | |||||
| 367 | } | |||||
| 368 | session. setAttribu te("optInO ptOutQuery ICN", resu ltIcn); | |||||
| 369 | } | |||||
| 370 | ||||||
| 371 | re turn resul ts; | |||||
| 372 | } | |||||
| 373 | ||||||
| 374 | privat e boolean isPaginato rPresent(f inal HttpS ession ses sion) { | |||||
| 375 | re turn !Null Checker.is NullOrEmpt y(session. getAttribu te("pagina tor")); | |||||
| 376 | } | |||||
| 377 | ||||||
| 378 | public void next (final Htt pServletRe quest requ est, | |||||
| 379 | fi nal HttpSe rvletRespo nse respon se) throws ServletEx ception, | |||||
| 380 | IO Exception { | |||||
| 381 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 382 | if (this.isP aginatorPr esent(sess ion)) { | |||||
| 383 | final Pa ginator pa ginator = (Paginator ) session | |||||
| 384 | .get Attribute( "paginator "); | |||||
| 385 | paginato r.next(req uest); | |||||
| 386 | session. setAttribu te("pagina tor", pagi nator); | |||||
| 387 | session. setAttribu te("optInO ptOutResul ts", | |||||
| 388 | this .getResult s(session, paginator )); | |||||
| 389 | this.for ward(reque st, respon se, "show" ); | |||||
| 390 | } else { | |||||
| 391 | this.for ward(reque st, respon se, "nosho w"); | |||||
| 392 | } | |||||
| 393 | } | |||||
| 394 | ||||||
| 395 | public void prev (final Htt pServletRe quest requ est, | |||||
| 396 | fi nal HttpSe rvletRespo nse respon se) throws ServletEx ception, | |||||
| 397 | IO Exception { | |||||
| 398 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 399 | if (this.isP aginatorPr esent(sess ion)) { | |||||
| 400 | final Pa ginator pa ginator = (Paginator ) session | |||||
| 401 | .get Attribute( "paginator "); | |||||
| 402 | paginato r.previous (request); | |||||
| 403 | session. setAttribu te("pagina tor", pagi nator); | |||||
| 404 | session. setAttribu te("optInO ptOutResul ts", | |||||
| 405 | this .getResult s(session, paginator )); | |||||
| 406 | this.for ward(reque st, respon se, "show" ); | |||||
| 407 | } else { | |||||
| 408 | this.for ward(reque st, respon se, "nosho w"); | |||||
| 409 | } | |||||
| 410 | } | |||||
| 411 | ||||||
| 412 | @Overr ide | |||||
| 413 | public void unsp ecified(fi nal HttpSe rvletReque st request , | |||||
| 414 | fi nal HttpSe rvletRespo nse respon se) throws ServletEx ception, | |||||
| 415 | IO Exception { | |||||
| 416 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 417 | ||||||
| 418 | // sort | |||||
| 419 | fi nal String optInOptO utSortValu e = reques t | |||||
| 420 | .getPara meter("opt InOptOutSo rtValue"); | |||||
| 421 | fi nal String optInOptO utSortDire ction = re quest | |||||
| 422 | .getPara meter("opt InOptOutSo rtDirectio n"); | |||||
| 423 | se ssion.setA ttribute(" optInOptOu tSortValue ", optInOp tOutSortVa lue); | |||||
| 424 | se ssion.setA ttribute(" optInOptOu tSortDirec tion", | |||||
| 425 | optInOpt OutSortDir ection); | |||||
| 426 | ||||||
| 427 | if (this.isP aginatorPr esent(sess ion)) { | |||||
| 428 | Paginato r paginato r = (Pagin ator) sess ion.getAtt ribute("pa ginator"); | |||||
| 429 | if (Null Checker.is Empty(pagi nator)) { | |||||
| 430 | pagi nator = ne w Paginato r(0); | |||||
| 431 | sess ion.setAtt ribute("pa ginator", paginator) ; | |||||
| 432 | } | |||||
| 433 | paginato r.reset(); | |||||
| 434 | session. setAttribu te("optInO ptOutResul ts", | |||||
| 435 | this .getResult s(session, paginator )); | |||||
| 436 | this.for ward(reque st, respon se, "show" ); | |||||
| 437 | } else { | |||||
| 438 | this.for ward(reque st, respon se, "nosho w"); | |||||
| 439 | } | |||||
| 440 | } | |||||
| 441 | ||||||
| 442 | public void view (final Htt pServletRe quest requ est, | |||||
| 443 | fi nal HttpSe rvletRespo nse respon se) throws ServletEx ception, | |||||
| 444 | IO Exception { | |||||
| 445 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 446 | fi nal String documentU niqueId = request | |||||
| 447 | .getPara meter("doc umentUniqu eId"); | |||||
| 448 | ||||||
| 449 | fi nal Audite dConsentDA O auditedC onsentDAO = this.get Bean( | |||||
| 450 | "audited ConsentDAO ", Audited ConsentDAO .class); | |||||
| 451 | fi nal String document = auditedC onsentDAO. getMessage Content(Lo ng | |||||
| 452 | .parseLo ng(documen tUniqueId) ); | |||||
| 453 | ||||||
| 454 | se ssion.setA ttribute(" document", document) ; | |||||
| 455 | se ssion.setA ttribute(" documentUn iqueId", d ocumentUni queId); | |||||
| 456 | ||||||
| 457 | tr y { | |||||
| 458 | final St ring attac hment = th is.getDocu mentHelper () | |||||
| 459 | .get PrivacyCon sentDirect iveAttachm ent(docume nt); | |||||
| 460 | if (Null Checker.is NotEmpty(a ttachment) ) { | |||||
| 461 | this .getDocume ntHelper() | |||||
| 462 | .writeAtta chmentToSt ream( | |||||
| 463 | respon se, | |||||
| 464 | attach ment, | |||||
| 465 | MediaT ype.fromVa lue(this.g etDocument Helper() | |||||
| 466 | .g etPrivacyC onsentDire ctiveMedia Type( | |||||
| 467 | document )), | |||||
| 468 | Repres entationTy pe.B64); | |||||
| 469 | } else { | |||||
| 470 | sess ion.setAtt ribute("in formationM essage", | |||||
| 471 | "There are no attach ments asso ciated wit h this con sent direc tive."); | |||||
| 472 | this .forward(r equest, re sponse, "n oattachmen t"); | |||||
| 473 | } | |||||
| 474 | } catch (fin al Transfo rmerExcept ion ex) { | |||||
| 475 | throw ne w ServletE xception(e x); | |||||
| 476 | } catch (fin al XPathEx ception ex ) { | |||||
| 477 | throw ne w ServletE xception(e x); | |||||
| 478 | } | |||||
| 479 | } | |||||
| 480 | ||||||
| 481 | privat e Facility DAO getFac ilityDAO() { | |||||
| 482 | re turn this. getBean("F acilityDAO ", Facilit yDAO.class ); | |||||
| 483 | } | |||||
| 484 | ||||||
| 485 | privat e UserDocu mentDAO ge tUserDocum entDAO() { | |||||
| 486 | re turn this. getBean("U serDocumen tDAO", Use rDocumentD AO.class); | |||||
| 487 | } | |||||
| 488 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.