Produced by Araxis Merge on 6/9/2017 3:51:27 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:27 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 | DelayedConsentReport.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 | 424 |
| 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.vali dation.Nul lChecker; | |||||
| 4 | import gov .va.nvap.s vc.consent mgmt.stub. dao.DelayR easonDAO; | |||||
| 5 | import gov .va.nvap.s vc.consent mgmt.stub. dao.Delaye dConsentRe portDAO; | |||||
| 6 | import gov .va.nvap.s vc.consent mgmt.stub. dao.MailNo tification DAO; | |||||
| 7 | import gov .va.nvap.s vc.consent mgmt.stub. data.Delay Reason; | |||||
| 8 | import gov .va.nvap.s vc.consent mgmt.stub. data.Delay edConsentR pt; | |||||
| 9 | import gov .va.nvap.s vc.consent mgmt.stub. data.MailN otificatio n; | |||||
| 10 | import gov .va.nvap.w eb.admin.r eports.Ser viceAuditR eport; | |||||
| 11 | import gov .va.nvap.w eb.dao.Fac ilityDAO; | |||||
| 12 | import gov .va.nvap.w eb.dao.Use rDocumentD AO; | |||||
| 13 | import gov .va.nvap.w eb.helper. report.Rep ortHelper; | |||||
| 14 | import gov .va.nvap.w eb.patient .ExcelGene ratorThrea d; | |||||
| 15 | import gov .va.nvap.w eb.user.Us erHelper; | |||||
| 16 | import gov .va.nvap.w eb.util.xl s.CsvExpor ter; | |||||
| 17 | import gov .va.nvap.w eb.util.xl s.ExcelExp orter; | |||||
| 18 | import jav a.io.IOExc eption; | |||||
| 19 | import jav a.io.Strin gWriter; | |||||
| 20 | import jav a.text.Par seExceptio n; | |||||
| 21 | import jav a.util.Arr ayList; | |||||
| 22 | import jav a.util.Arr ays; | |||||
| 23 | import jav a.util.Col lection; | |||||
| 24 | import jav a.util.Has hMap; | |||||
| 25 | import jav a.util.Lin kedHashMap ; | |||||
| 26 | import jav a.util.Lis t; | |||||
| 27 | import jav a.util.Map ; | |||||
| 28 | import jav a.util.log ging.Level ; | |||||
| 29 | import jav a.util.log ging.Logge r; | |||||
| 30 | import jav ax.servlet .ServletEx ception; | |||||
| 31 | import jav ax.servlet .http.Http ServletReq uest; | |||||
| 32 | import jav ax.servlet .http.Http ServletRes ponse; | |||||
| 33 | import jav ax.servlet .http.Http Session; | |||||
| 34 | import org .apache.po i.ss.userm odel.Workb ook; | |||||
| 35 | import org .json.JSON Exception; | |||||
| 36 | import org .json.JSON Object; | |||||
| 37 | ||||||
| 38 | /** | |||||
| 39 | * | |||||
| 40 | * @since 04/05/2016 | |||||
| 41 | * @author Irakli Ka kushadze | |||||
| 42 | */ | |||||
| 43 | public cla ss Delayed ConsentRep ort extend s gov.va.n vap.web.ap p.Response Dispatcher HttpServle t { | |||||
| 44 | ||||||
| 45 | privat e DelayedC onsentRepo rtDAO getD elayedCons entReportD AO() { | |||||
| 46 | re turn this. getBean("D elayedCons entReportD AO", Delay edConsentR eportDAO.c lass); | |||||
| 47 | } | |||||
| 48 | ||||||
| 49 | privat e DelayRea sonDAO get DelayReaso nDAO() { | |||||
| 50 | re turn this. getBean("D elayReason DAO", Dela yReasonDAO .class); | |||||
| 51 | } | |||||
| 52 | ||||||
| 53 | privat e Facility DAO getFac ilityDAO() { | |||||
| 54 | re turn this. getBean("F acilityDAO ", Facilit yDAO.class ); | |||||
| 55 | } | |||||
| 56 | ||||||
| 57 | privat e ReportHe lper getRe portHelper () { | |||||
| 58 | re turn this. getBean("r eportHelpe r", Report Helper.cla ss); | |||||
| 59 | } | |||||
| 60 | ||||||
| 61 | privat e MailNoti ficationDA O getMailN otificatio nDAO() { | |||||
| 62 | re turn this. getBean("M ailNotific ationDAO", MailNotif icationDAO .class); | |||||
| 63 | } | |||||
| 64 | ||||||
| 65 | public void doSe arch(HttpS ervletRequ est reques t, HttpSer vletRespon se respons e) | |||||
| 66 | th rows Servl etExceptio n, IOExcep tion, Pars eException { | |||||
| 67 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 68 | ||||||
| 69 | // Perform t he search. | |||||
| 70 | De layedConse ntReportDA O.SearchAl lResponse searchResp onse = thi s.getResul ts(request , response ); | |||||
| 71 | ||||||
| 72 | // Generate JSON resul ts. | |||||
| 73 | se ssion.setA ttribute(" results", encodeServ iceAuditIn toJSON(sea rchRespons e, request .getParame ter("draw" ), request .getParame ter("reaso nsForDelay "))); | |||||
| 74 | ||||||
| 75 | // Forward t he respons e. | |||||
| 76 | th is.forward (request, response, "searchRes ultsJSON") ; | |||||
| 77 | } | |||||
| 78 | ||||||
| 79 | @Overr ide | |||||
| 80 | protec ted void u nspecified (HttpServl etRequest request, H ttpServlet Response r esponse) | |||||
| 81 | th rows Servl etExceptio n, IOExcep tion { | |||||
| 82 | fi nal HttpSe ssion sess ion = requ est.getSes sion(false ); | |||||
| 83 | ||||||
| 84 | Li st<DelayRe ason> reas ons = this .getDelayR easonDAO() .findAll() ; | |||||
| 85 | ||||||
| 86 | se ssion.setA ttribute(" reasons", reasons); | |||||
| 87 | ||||||
| 88 | th is.forward (request, response, "searchFor m"); | |||||
| 89 | } | |||||
| 90 | ||||||
| 91 | public void expo rtToCsv(Ht tpServletR equest req uest, Http ServletRes ponse resp onse) thro ws Servlet Exception, IOExcepti on { | |||||
| 92 | ||||||
| 93 | Ma p<String, String> co lumnHeader s = new Li nkedHashMa p<String, String>(); | |||||
| 94 | ||||||
| 95 | co lumnHeader s.put("Dat e Entered (CT)", "da teAdded"); | |||||
| 96 | co lumnHeader s.put("ICN ", "icn"); | |||||
| 97 | co lumnHeader s.put("SSN ", "ssn"); | |||||
| 98 | co lumnHeader s.put("Las t Name", " lastName") ; | |||||
| 99 | co lumnHeader s.put("Fir st Name", "firstName "); | |||||
| 100 | co lumnHeader s.put("Mid dle Name", "middleNa me"); | |||||
| 101 | co lumnHeader s.put("Con sent Type" , "consent Type"); | |||||
| 102 | co lumnHeader s.put("Rea son(s) for Delay", " reasonsFor Delay"); | |||||
| 103 | co lumnHeader s.put("Ent ered By", "enteredBy "); | |||||
| 104 | co lumnHeader s.put("Aut henticatin g Facility ", "authen ticatingFa cility"); | |||||
| 105 | co lumnHeader s.put("Mai led Dates" , "mailNot ifications "); | |||||
| 106 | ||||||
| 107 | in t minimumT hreshold = Integer.p arseInt((S tring) thi s.getServl etContext( ).getAttri bute("sche duledExpor tMin")); | |||||
| 108 | in t total = Integer.pa rseInt(req uest.getPa rameter("t otalRows") ); | |||||
| 109 | ||||||
| 110 | // Start a sc heduled ex port with its own th read if gr eater than the minim um thresho ld | |||||
| 111 | if (total >= minimumTh reshold) { | |||||
| 112 | ExcelGen eratorThre ad csvGenT hread = ne w ExcelGen eratorThre ad("csvGen Thread"); | |||||
| 113 | csvGenTh read.setDo cumentType ("csv"); | |||||
| 114 | ||||||
| 115 | csvGenTh read.setRe portMap(co lumnHeader s); | |||||
| 116 | ||||||
| 117 | // Set n ames for E xcel gener ator threa d | |||||
| 118 | csvGenTh read.setTi tle("Delay ed Consent Detail Re port"); | |||||
| 119 | ||||||
| 120 | csvGenTh read.setEx celExporte r(this.get ExcelExpor ter()); | |||||
| 121 | csvGenTh read.setRe portHelper (getReport Helper()); | |||||
| 122 | csvGenTh read.setUs erId(UserH elper.getU serName(re quest)); | |||||
| 123 | csvGenTh read.setDe layedConse ntReportDA O(getDelay edConsentR eportDAO() ); | |||||
| 124 | csvGenTh read.setMa ilNotifica tionDAO(ge tMailNotif icationDAO ()); | |||||
| 125 | csvGenTh read.setUs erDocument Dao(getUse rDocumentD AO()); | |||||
| 126 | ||||||
| 127 | // Set s earch attr ibutes for getting a udit resul ts | |||||
| 128 | csvGenTh read.setAt tributes(m apSessionA ttributes( request)); | |||||
| 129 | ||||||
| 130 | csvGenTh read.start (); | |||||
| 131 | } | |||||
| 132 | // Otherwise generate a nd downloa d the expo rt directl y | |||||
| 133 | el se { | |||||
| 134 | List<Map <String, O bject>> re sults; | |||||
| 135 | ||||||
| 136 | ExcelGen eratorThre ad doNow = new Excel GeneratorT hread("doN ow"); | |||||
| 137 | doNow.se tAttribute s(mapSessi onAttribut es(request )); | |||||
| 138 | doNow.se tDelayedCo nsentRepor tDAO(this. getDelayed ConsentRep ortDAO()); | |||||
| 139 | doNow.se tReportHel per(this.g etReportHe lper()); | |||||
| 140 | doNow.se tMailNotif icationDAO (this.getM ailNotific ationDAO() ); | |||||
| 141 | results = doNow.ge tDelayedCo nsentResul ts(); | |||||
| 142 | ||||||
| 143 | CsvExpor ter csvExp orter = ne w CsvExpor ter(); | |||||
| 144 | csvExpor ter.export ToCSV(resp onse, "Del ayed_Conse nt_Detail_ Report", r esults, (L inkedHashM ap<String, String>) columnHead ers); | |||||
| 145 | } | |||||
| 146 | } | |||||
| 147 | ||||||
| 148 | public void expo rtToExcel( HttpServle tRequest r equest, Ht tpServletR esponse re sponse) th rows Servl etExceptio n, IOExcep tion { | |||||
| 149 | ||||||
| 150 | // Generate column hea ders. | |||||
| 151 | fi nal Map<St ring, Stri ng> column Headers = new Linked HashMap<St ring, Stri ng>(); | |||||
| 152 | co lumnHeader s.put("dat eAdded", " Date Enter ed (CT)"); | |||||
| 153 | co lumnHeader s.put("icn ", "ICN"); | |||||
| 154 | co lumnHeader s.put("ssn ", "SSN"); | |||||
| 155 | co lumnHeader s.put("las tName", "L ast Name") ; | |||||
| 156 | co lumnHeader s.put("fir stName", " First Name "); | |||||
| 157 | co lumnHeader s.put("mid dleName", "Middle Na me"); | |||||
| 158 | co lumnHeader s.put("con sentType", "Consent Type"); | |||||
| 159 | co lumnHeader s.put("rea sonsForDel ay", "Reas on(s) for Delay"); | |||||
| 160 | co lumnHeader s.put("ent eredBy", " Entered By "); | |||||
| 161 | co lumnHeader s.put("aut henticatin gFacility" , "Authent icating Fa cility"); | |||||
| 162 | co lumnHeader s.put("mai lNotificat ions", "Ma iled Dates "); | |||||
| 163 | ||||||
| 164 | // Generate filters. | |||||
| 165 | fi nal Map<St ring, List <Object>> filterMap = new Link edHashMap< String, Li st<Object> >(); | |||||
| 166 | fi nal Linked HashMap<St ring, Obje ct> filter s = new Li nkedHashMa p<String, Object>(); | |||||
| 167 | ||||||
| 168 | St ring daysS inceDelaye d = reques t.getParam eter("days SinceDelay ed"); | |||||
| 169 | if (!NullChe cker.isNul lOrEmpty(d aysSinceDe layed) && !"ALL".equ als(daysSi nceDelayed )) { | |||||
| 170 | if (days SinceDelay ed.equals( "0")) { | |||||
| 171 | days SinceDelay ed = "0-5" ; | |||||
| 172 | } | |||||
| 173 | else { | |||||
| 174 | days SinceDelay ed = ">" + daysSince Delayed; | |||||
| 175 | } | |||||
| 176 | } | |||||
| 177 | ||||||
| 178 | fi lters.put( "SSN", req uest.getPa rameter("s sn")); | |||||
| 179 | fi lters.put( "Last Name ", request .getParame ter("lastN ame")); | |||||
| 180 | fi lters.put( "First Nam e", reques t.getParam eter("firs tName")); | |||||
| 181 | fi lters.put( "Authentic ating Faci lity", Exc elExporter .getFacili tiesFilter (this.getF acilityDAO (), reques t.getParam eter("stat ionNumbers "))); | |||||
| 182 | fi lters.put( "Reason(s) for Delay ", ExcelEx porter.get ReasonsFor DelayFilte r(getDelay ReasonDAO( ), request .getParame ter("reaso nsForDelay "))); | |||||
| 183 | fi lters.put( "Days Sinc e Delayed" , daysSinc eDelayed); | |||||
| 184 | fi lters.put( "Consent T ype", Exce lExporter. getConsent TypeFilter (request.g etParamete r("consent Type"))); | |||||
| 185 | fi lters.put( "Entered B y", ExcelE xporter.ge tConsentTy peFilter(r equest.get Parameter( "enteredBy "))); | |||||
| 186 | Ex celExporte r.populate FilterMapF orExport(r equest, fi lters, fil terMap, re quest.getP arameter(" patientTyp es")); | |||||
| 187 | ||||||
| 188 | in t minimumT hreshold = Integer.p arseInt((S tring) thi s.getServl etContext( ).getAttri bute("sche duledExpor tMin")); | |||||
| 189 | in t total = Integer.pa rseInt(req uest.getPa rameter("t otalRows") ); | |||||
| 190 | ||||||
| 191 | // Start a sc heduled ex port with its own th read if gr eater than the minim um thresho ld | |||||
| 192 | if (total >= minimumTh reshold) { | |||||
| 193 | ExcelGen eratorThre ad exGenTh read = new ExcelGene ratorThrea d("exGenTh read"); | |||||
| 194 | exGenThr ead.setRep ortMap(col umnHeaders ); | |||||
| 195 | exGenThr ead.setFil terMap(fil terMap); | |||||
| 196 | ||||||
| 197 | // Set n ames for E xcel gener ator threa d | |||||
| 198 | exGenThr ead.setTit le("Delaye d Consent Detail Rep ort"); | |||||
| 199 | ||||||
| 200 | exGenThr ead.setExc elExporter (this.getE xcelExport er()); | |||||
| 201 | exGenThr ead.setRep ortHelper( getReportH elper()); | |||||
| 202 | exGenThr ead.setUse rId(UserHe lper.getUs erName(req uest)); | |||||
| 203 | exGenThr ead.setDel ayedConsen tReportDAO (getDelaye dConsentRe portDAO()) ; | |||||
| 204 | exGenThr ead.setMai lNotificat ionDAO(get MailNotifi cationDAO( )); | |||||
| 205 | exGenThr ead.setUse rDocumentD ao(getUser DocumentDA O()); | |||||
| 206 | ||||||
| 207 | // Set s earch attr ibutes for getting a udit resul ts | |||||
| 208 | exGenThr ead.setAtt ributes(ma pSessionAt tributes(r equest)); | |||||
| 209 | ||||||
| 210 | exGenThr ead.start( ); | |||||
| 211 | } | |||||
| 212 | // Otherwise generate a nd downloa d the expo rt directl y | |||||
| 213 | el se { | |||||
| 214 | List<Map <String, O bject>> re sults; | |||||
| 215 | String t itle = "De layed Cons ent Detail Report"; | |||||
| 216 | ||||||
| 217 | ExcelGen eratorThre ad doNow = new Excel GeneratorT hread("doN ow"); | |||||
| 218 | doNow.se tAttribute s(mapSessi onAttribut es(request )); | |||||
| 219 | doNow.se tDelayedCo nsentRepor tDAO(this. getDelayed ConsentRep ortDAO()); | |||||
| 220 | doNow.se tReportHel per(this.g etReportHe lper()); | |||||
| 221 | doNow.se tMailNotif icationDAO (this.getM ailNotific ationDAO() ); | |||||
| 222 | results = doNow.ge tDelayedCo nsentResul ts(); | |||||
| 223 | ||||||
| 224 | final Wo rkbook wb = this.get ExcelExpor ter().expo rtToExcel( title, tit le, column Headers, r esults, fi lterMap, n ull); | |||||
| 225 | ||||||
| 226 | // Write Excel wor kbook to S tream | |||||
| 227 | this.get ExcelExpor ter().writ eExcelToSt ream("Dela yed_Detail _Report", wb, respon se); | |||||
| 228 | } | |||||
| 229 | } | |||||
| 230 | ||||||
| 231 | privat e Map<Stri ng, Object > mapSessi onAttribut es(HttpSer vletReques t request) { | |||||
| 232 | Ma p<String, Object> at tributes = new HashM ap<String, Object>() ; | |||||
| 233 | ||||||
| 234 | in t patientT ype = Null Checker.is NullOrEmpt y(request. getParamet er("patien tTypes")) ? 1 : Inte ger.parseI nt(request .getParame ter("patie ntTypes")) ; | |||||
| 235 | ||||||
| 236 | // Get param eters for the search from the request. | |||||
| 237 | St ring sortB y = reques t.getParam eter("orde r[0][colum n]"); | |||||
| 238 | St ring sortO rder = req uest.getPa rameter("o rder[0][di r]"); | |||||
| 239 | ||||||
| 240 | // When expo rting, we' ll receive sort fiel d and sort order exp licitly in the corre sponding p arams. | |||||
| 241 | if (sortBy = = null) { | |||||
| 242 | sortBy = request.g etParamete r("sortBy" ); | |||||
| 243 | } | |||||
| 244 | if (sortOrde r == null) { | |||||
| 245 | sortOrde r = reques t.getParam eter("sort Order"); | |||||
| 246 | } | |||||
| 247 | ||||||
| 248 | // Get param eters for the search from the request. | |||||
| 249 | at tributes.p ut("ssn", request.ge tParameter ("ssn")); | |||||
| 250 | at tributes.p ut("lastNa me", reque st.getPara meter("las tName")); | |||||
| 251 | at tributes.p ut("firstN ame", requ est.getPar ameter("fi rstName")) ; | |||||
| 252 | at tributes.p ut("userId ", request .getParame ter("enter edBy")); | |||||
| 253 | ||||||
| 254 | at tributes.p ut("statio nNumbers", ReportHel per.getSta tionNumber sFromReque st(request )); | |||||
| 255 | at tributes.p ut("patien tTypes", p atientType ); | |||||
| 256 | at tributes.p ut("consen tType", re quest.getP arameter(" consentTyp e")); | |||||
| 257 | at tributes.p ut("reason sForDelay" , request. getParamet er("reason sForDelay" )); | |||||
| 258 | at tributes.p ut("daysSi nceDelayed ", request .getParame ter("daysS inceDelaye d")); | |||||
| 259 | at tributes.p ut("includ eUnknownVi sn", "true ".equals(r equest.get Parameter( "includeUn knownVisn" ))); | |||||
| 260 | // sort | |||||
| 261 | at tributes.p ut("sortVa lue", sort By); | |||||
| 262 | at tributes.p ut("sortDi rection", sortOrder) ; | |||||
| 263 | ||||||
| 264 | re turn attri butes; | |||||
| 265 | } | |||||
| 266 | ||||||
| 267 | /** | |||||
| 268 | * Get the excel exporter class from Spring. | |||||
| 269 | */ | |||||
| 270 | privat e ExcelExp orter getE xcelExport er() { | |||||
| 271 | fi nal ExcelE xporter ex celExporte r = this.g etBean("ex celExporte r", ExcelE xporter.cl ass); | |||||
| 272 | re turn excel Exporter; | |||||
| 273 | } | |||||
| 274 | ||||||
| 275 | privat e DelayedC onsentRepo rtDAO.Sear chAllRespo nse getRes ults(HttpS ervletRequ est reques t, HttpSer vletRespon se respons e) { | |||||
| 276 | De layedConse ntReportDA O.SearchAl lRequest s earchReque st = this. getDelayed ConsentRep ortDAO().n ew SearchA llRequest( ); | |||||
| 277 | ||||||
| 278 | in t patientT ype = Null Checker.is NullOrEmpt y(request. getParamet er("patien tTypes")) ? 1 : Inte ger.parseI nt(request .getParame ter("patie ntTypes")) ; | |||||
| 279 | in t start = NullChecke r.isNullOr Empty(requ est.getPar ameter("st art")) ? 0 : Integer .parseInt( request.ge tParameter ("start")) ; | |||||
| 280 | in t length = NullCheck er.isNullO rEmpty(req uest.getPa rameter("l ength")) ? -1 : Inte ger.parseI nt(request .getParame ter("lengt h")); | |||||
| 281 | ||||||
| 282 | // Get param eters for the search from the request. | |||||
| 283 | se archReques t.patientS sn = reque st.getPara meter("ssn "); | |||||
| 284 | se archReques t.patientL astName = request.ge tParameter ("lastName "); | |||||
| 285 | se archReques t.patientF irstName = request.g etParamete r("firstNa me"); | |||||
| 286 | se archReques t.stationN umbers = R eportHelpe r.getStati onNumbersF romRequest (request); | |||||
| 287 | se archReques t.aggregat eAtFacilit yLevel = f alse; | |||||
| 288 | se archReques t.includeU nknownVisn = "true". equals(req uest.getPa rameter("i ncludeUnkn ownVisn")) ; | |||||
| 289 | se archReques t.reasonsF orDelay = request.ge tParameter ("reasonsF orDelay"); | |||||
| 290 | se archReques t.daysSinc eDelayed = request.g etParamete r("daysSin ceDelayed" ); | |||||
| 291 | se archReques t.consentT ype = requ est.getPar ameter("co nsentType" ); | |||||
| 292 | se archReques t.start = start; | |||||
| 293 | se archReques t.length = length; | |||||
| 294 | se archReques t.sortBy = request.g etParamete r("order[0 ][column]" ); | |||||
| 295 | se archReques t.sortOrde r = reques t.getParam eter("orde r[0][dir]" ); | |||||
| 296 | se archReques t.patientT ypes = pat ientType; | |||||
| 297 | se archReques t.enteredB y = reques t.getParam eter("ente redBy"); | |||||
| 298 | ||||||
| 299 | // When expo rting, we' ll receive sort fiel d and sort order exp licitly in the corre sponding p arams. | |||||
| 300 | if (searchRe quest.sort By == null ) { | |||||
| 301 | searchRe quest.sort By = reque st.getPara meter("sor tBy"); | |||||
| 302 | } | |||||
| 303 | if (searchRe quest.sort Order == n ull) { | |||||
| 304 | searchRe quest.sort Order = re quest.getP arameter(" sortOrder" ); | |||||
| 305 | } | |||||
| 306 | ||||||
| 307 | // Perform t he search. | |||||
| 308 | De layedConse ntReportDA O.SearchAl lResponse searchResp onse = thi s.getDelay edConsentR eportDAO() .searchAll (searchReq uest); | |||||
| 309 | ||||||
| 310 | // return una vailable i f the ssn is null or empty or mask the s sn if we h ave one | |||||
| 311 | fo r(DelayedC onsentRpt dc : searc hResponse. delayedCon sents){ | |||||
| 312 | String s sn = dc.ge tPatientSs n(); | |||||
| 313 | ||||||
| 314 | if (Null Checker.is NullOrEmpt y(ssn)) { | |||||
| 315 | dc.s etPatientS sn("Unavai lable"); | |||||
| 316 | } else { | |||||
| 317 | dc.s etPatientS sn(ReportD ataProcess or.maskSsn (ssn)); | |||||
| 318 | } | |||||
| 319 | } | |||||
| 320 | ||||||
| 321 | re turn searc hResponse; | |||||
| 322 | } | |||||
| 323 | ||||||
| 324 | privat e Collecti on<MailNot ification> getMailNo tification sByDelayed Consent(Lo ng delayed ConsentId) { | |||||
| 325 | Co llection<M ailNotific ation> not ifications = this.ge tMailNotif icationDAO ().findByD elayedCons entId(dela yedConsent Id.toStrin g()); | |||||
| 326 | ||||||
| 327 | re turn notif ications; | |||||
| 328 | } | |||||
| 329 | ||||||
| 330 | privat e String h andleDelay Reasons(Co llection<D elayReason > delayedR easons, St ring searc hedForReas ons) { | |||||
| 331 | if (!NullChe cker.isNul lOrEmpty(d elayedReas ons)) { | |||||
| 332 | StringBu ilder sb = new Strin gBuilder() ; | |||||
| 333 | ||||||
| 334 | if (Null Checker.is NullOrEmpt y(searched ForReasons ) || "ALL" .equals(se archedForR easons)) { | |||||
| 335 | //ge t em all | |||||
| 336 | for (DelayReas on dr : de layedReaso ns) { | |||||
| 337 | sb.append( dr.getName ()); | |||||
| 338 | sb.append( ", "); | |||||
| 339 | } | |||||
| 340 | } else { | |||||
| 341 | //co ncatenate applicable reasons o nly | |||||
| 342 | List <String> r easons = A rrays.asLi st(searche dForReason s.split("\ \s*,\\s*") ); | |||||
| 343 | ||||||
| 344 | for (DelayReas on dr : de layedReaso ns) { | |||||
| 345 | if (reason s.contains (dr.getDel ayReasonId ().toStrin g())) { | |||||
| 346 | sb.app end(dr.get Name()); | |||||
| 347 | sb.app end(", "); | |||||
| 348 | } | |||||
| 349 | } | |||||
| 350 | } | |||||
| 351 | ||||||
| 352 | return s b.length() > 0 ? sb. substring( 0, sb.leng th() - 2) : ""; //ge t rid of t he last co mma and sp ace (yeah its clunky and I don 't particu larly like it) | |||||
| 353 | } else { | |||||
| 354 | return " "; | |||||
| 355 | } | |||||
| 356 | } | |||||
| 357 | ||||||
| 358 | privat e String h andleMailN otificatio ns(Collect ion<MailNo tification > notifica tions, Str ing delimi ter) { | |||||
| 359 | St ringBuilde r result = new Strin gBuilder() ; | |||||
| 360 | bo olean isFi rstItem = true; | |||||
| 361 | ||||||
| 362 | fo r (MailNot ification mn : notif ications) { | |||||
| 363 | result.a ppend(isFi rstItem ? "" : delim iter); | |||||
| 364 | result.a ppend(this .getReport Helper().g etFormatte dDate(mn.g etSentDate ())); | |||||
| 365 | isFirstI tem = fals e; | |||||
| 366 | } | |||||
| 367 | ||||||
| 368 | re turn resul t.toString (); | |||||
| 369 | } | |||||
| 370 | ||||||
| 371 | privat e String h andleConse ntType(Del ayedConsen tRpt delay edConsent) { | |||||
| 372 | St ring conse ntType = " "; | |||||
| 373 | if (!NullChe cker.isNul lOrEmpty(d elayedCons ent.getCon sentTypeId ())) { | |||||
| 374 | consentT ype = dela yedConsent .getConsen tTypeId(). getName(); | |||||
| 375 | consentT ype = Repo rtHelper.n ormalizeCo nsnentType Name(conse ntType); | |||||
| 376 | } | |||||
| 377 | re turn conse ntType; | |||||
| 378 | } | |||||
| 379 | ||||||
| 380 | privat e String e ncodeServi ceAuditInt oJSON(Dela yedConsent ReportDAO. SearchAllR esponse se archRespon se, String draw, Str ing reason sForDelay) | |||||
| 381 | th rows Parse Exception { | |||||
| 382 | St ring retur nValue = " "; | |||||
| 383 | ||||||
| 384 | tr y { | |||||
| 385 | StringWr iter json = new Stri ngWriter() ; | |||||
| 386 | JSONObje ct obj = n ew JSONObj ect(); | |||||
| 387 | List<Lis t> data = new ArrayL ist<List>( ); | |||||
| 388 | ||||||
| 389 | for (Del ayedConsen tRpt delay edConsent : searchRe sponse.del ayedConsen ts) { | |||||
| 390 | List <String> d ataItem = new ArrayL ist<String >(); | |||||
| 391 | data Item.add(t his.getRep ortHelper( ).getForma ttedDateTi me(delayed Consent.ge tDateAdded ())); | |||||
| 392 | data Item.add(d elayedCons ent.getPat ientIen()) ; | |||||
| 393 | data Item.add(R eportDataP rocessor.g eneratePat ientLink(d elayedCons ent.getPat ientSsn(), delayedCo nsent.getP atientFirs tName(), d elayedCons ent.getPat ientLastNa me())); | |||||
| 394 | data Item.add(d elayedCons ent.getPat ientLastNa me()); | |||||
| 395 | data Item.add(d elayedCons ent.getPat ientFirstN ame()); | |||||
| 396 | data Item.add(d elayedCons ent.getPat ientMiddle Name()); | |||||
| 397 | data Item.add(h andleConse ntType(del ayedConsen t)); | |||||
| 398 | data Item.add(h andleDelay Reasons(de layedConse nt.getDela yReasonCol lection(), reasonsFo rDelay)); | |||||
| 399 | data Item.add(d elayedCons ent.getUse rId()); | |||||
| 400 | data Item.add(d elayedCons ent.getFac ilityName( )); | |||||
| 401 | data Item.add(h andleMailN otificatio ns(this.ge tMailNotif icationsBy DelayedCon sent(delay edConsent. getDelayed ConsentId( )),"<br /> ")); | |||||
| 402 | ||||||
| 403 | data .add(dataI tem); | |||||
| 404 | } | |||||
| 405 | ||||||
| 406 | obj.put( "data", da ta); | |||||
| 407 | obj.put( "draw", In teger.pars eInt(draw) ); | |||||
| 408 | obj.put( "recordsTo tal", sear chResponse .count); | |||||
| 409 | obj.put( "recordsFi ltered", s earchRespo nse.count) ; | |||||
| 410 | ||||||
| 411 | obj.writ e(json); | |||||
| 412 | ||||||
| 413 | returnVa lue = json .toString( ); | |||||
| 414 | } catch (JSO NException ex) { | |||||
| 415 | Logger.g etLogger(S erviceAudi tReport.cl ass.getNam e()).log(L evel.SEVER E, null, e x); | |||||
| 416 | } | |||||
| 417 | ||||||
| 418 | re turn retur nValue; | |||||
| 419 | } | |||||
| 420 | ||||||
| 421 | privat e UserDocu mentDAO ge tUserDocum entDAO() { | |||||
| 422 | re turn this. getBean("U serDocumen tDAO", Use rDocumentD AO.class); | |||||
| 423 | } | |||||
| 424 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.