Produced by Araxis Merge on 6/9/2017 3:50:35 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:50:35 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-mock\src\main\java\gov\va\nvap\mock\dao | PatientProfileDAO.java | Fri Apr 21 20:03:28 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 130 |
| 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. mock.dao; | |||||
| 2 | ||||||
| 3 | /** | |||||
| 4 | * | |||||
| 5 | * @author Johann So nnenberg | |||||
| 6 | */ | |||||
| 7 | ||||||
| 8 | import gov .va.nvap.c ommon.file .FileUtil; | |||||
| 9 | import gov .va.nvap.m ock.endpoi nt.mvi.Pat ientProfil e; | |||||
| 10 | import jav a.text.Sim pleDateFor mat; | |||||
| 11 | import jav a.util.Col lection; | |||||
| 12 | import jav a.util.Dat e; | |||||
| 13 | import jav a.util.log ging.Level ; | |||||
| 14 | import jav a.util.log ging.Logge r; | |||||
| 15 | import jav ax.persist ence.Entit yManager; | |||||
| 16 | import jav ax.persist ence.Persi stenceCont ext; | |||||
| 17 | import jav ax.persist ence.Query ; | |||||
| 18 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |||||
| 19 | import org .springfra mework.con text.Appli cationCont ext; | |||||
| 20 | import org .springfra mework.cor e.io.Resou rce; | |||||
| 21 | ||||||
| 22 | public cla ss Patient ProfileDAO { | |||||
| 23 | ||||||
| 24 | /** | |||||
| 25 | * Ent ity Manage r instance . | |||||
| 26 | */ | |||||
| 27 | @Persi stenceCont ext | |||||
| 28 | privat e EntityMa nager em; | |||||
| 29 | ||||||
| 30 | @Autow ired | |||||
| 31 | Ap plicationC ontext app licationCo ntext; | |||||
| 32 | ||||||
| 33 | /** | |||||
| 34 | * Set the entit y manager (Injected by Spring) . | |||||
| 35 | * @pa ram em | |||||
| 36 | */ | |||||
| 37 | public void setE ntityManag er(final E ntityManag er em) { | |||||
| 38 | this.em = em; | |||||
| 39 | } | |||||
| 40 | ||||||
| 41 | @Suppr essWarning s("uncheck ed") | |||||
| 42 | public Collectio n<PatientP rofile> fi ndBySSNFir stNameLast Name( Stri ng ssn, St ring lastN ame, Strin g firstNam e ) { | |||||
| 43 | Query qu ery = em.c reateQuery ("SELECT p FROM Pati entProfile p WHERE p .ssn = :ss n AND lowe r(p.lastNa me) = lowe r(:lastNam e) AND low er(p.first Name) = lo wer(:first Name)"); | |||||
| 44 | query.se tParameter ("ssn", ss n); | |||||
| 45 | query.se tParameter ("lastName ", lastNam e); | |||||
| 46 | query.se tParameter ("firstNam e", firstN ame); | |||||
| 47 | ||||||
| 48 | re turn (Coll ection<Pat ientProfil e>) query. getResultL ist(); | |||||
| 49 | } | |||||
| 50 | ||||||
| 51 | @Suppr essWarning s("uncheck ed") | |||||
| 52 | public PatientPr ofile getB yIEN( Stri ng ien ) { | |||||
| 53 | Query qu ery = em.c reateQuery ("SELECT p FROM Pati entProfile p WHERE p .ien = :ie n"); | |||||
| 54 | query.se tParameter ("ien", ie n); | |||||
| 55 | re turn (Pati entProfile ) query.ge tResultLis t().get(0) ; | |||||
| 56 | } | |||||
| 57 | ||||||
| 58 | @Suppr essWarning s("uncheck ed") | |||||
| 59 | public String ge tPayload( String ssn , String l astName, S tring firs tName ) { | |||||
| 60 | St ringBuilde r sb = new StringBui lder(); | |||||
| 61 | in t count = 1; | |||||
| 62 | Co llection<P atientProf ile> patie nts = find BySSNFirst NameLastNa me(ssn, la stName, fi rstName); | |||||
| 63 | Si mpleDateFo rmat forma tter = new SimpleDat eFormat("y yyyMMdd"); | |||||
| 64 | ||||||
| 65 | tr y { | |||||
| 66 | //if we didn't fin e a match | |||||
| 67 | if( pati ents.isEmp ty() ) | |||||
| 68 | { | |||||
| 69 | fina l Resource resource = this.app licationCo ntext.getR esource("c lasspath:g ov/va/nvap /mock/endp oint/mvi/R SP_K22_NoM atches.er7 "); | |||||
| 70 | fina l String r spK22ER7 = FileUtil. getResourc e(resource ); | |||||
| 71 | retu rn rspK22E R7; | |||||
| 72 | } | |||||
| 73 | ||||||
| 74 | //one ma tch | |||||
| 75 | if( pati ents.size( ) == 1 ) | |||||
| 76 | { | |||||
| 77 | Reso urce resou rce = this .applicati onContext. getResourc e("classpa th:gov/va/ nvap/mock/ endpoint/m vi/RSP_K22 _SingleMat ch_macros. er7"); | |||||
| 78 | Stri ng primary Data = Fil eUtil.getR esource(re source); | |||||
| 79 | Pati entProfile p = patie nts.iterat or().next( ); | |||||
| 80 | Date date = fo rmatter.pa rse(p.getD ateOfBirth ()); | |||||
| 81 | ||||||
| 82 | //do the repla ces | |||||
| 83 | prim aryData = primaryDat a.replace( "[ien]", p .getIEN()) ; | |||||
| 84 | prim aryData = primaryDat a.replace( "[ssn]", p .getSSN()) ; | |||||
| 85 | prim aryData = primaryDat a.replace( "[lastname ]", p.getL astName()) ; | |||||
| 86 | prim aryData = primaryDat a.replace( "[firstnam e]", p.get FirstName( )); | |||||
| 87 | prim aryData = primaryDat a.replace( "[middlein itial]", p .getMiddle Initial()) ; | |||||
| 88 | prim aryData = primaryDat a.replace( "[gender]" , p.getGen der().toUp perCase(). substring( 0, 1)); | |||||
| 89 | prim aryData = primaryDat a.replace( "[dob]", f ormatter.f ormat(date )); | |||||
| 90 | ||||||
| 91 | retu rn primary Data; | |||||
| 92 | } | |||||
| 93 | ||||||
| 94 | //more t han one ma tch | |||||
| 95 | if( pati ents.size( ) > 1 ) | |||||
| 96 | { | |||||
| 97 | Reso urce resou rce = this .applicati onContext. getResourc e("classpa th:gov/va/ nvap/mock/ endpoint/m vi/RSP_K22 _MultipleM atches_mac ros.er7"); | |||||
| 98 | Stri ng moreDat a = FileUt il.getReso urce(resou rce); | |||||
| 99 | ||||||
| 100 | //on ly return two matche s as that will satis fy the tes ting requi rement for more than one | |||||
| 101 | for( PatientPr ofile pp : patients ) | |||||
| 102 | { | |||||
| 103 | if( count > 2 ) | |||||
| 104 | { | |||||
| 105 | break; | |||||
| 106 | } | |||||
| 107 | ||||||
| 108 | Date date = formatte r.parse(pp .getDateOf Birth()); | |||||
| 109 | ||||||
| 110 | //do the r eplaces | |||||
| 111 | moreData = moreData. replace("[ ien"+count +"]", pp.g etIEN()); | |||||
| 112 | moreData = moreData. replace("[ ssn"+count +"]", pp.g etSSN()); | |||||
| 113 | moreData = moreData. replace("[ lastname"+ count+"]", pp.getLas tName()); | |||||
| 114 | moreData = moreData. replace("[ firstname" +count+"]" , pp.getFi rstName()) ; | |||||
| 115 | moreData = moreData. replace("[ middleinit ial"+count +"]", pp.g etMiddleIn itial()); | |||||
| 116 | moreData = moreData. replace("[ gender"+co unt+"]", p p.getGende r().toUppe rCase().su bstring(0, 1)); | |||||
| 117 | moreData = moreData. replace("[ dob"+count +"]", form atter.form at(date)); | |||||
| 118 | ||||||
| 119 | count++; | |||||
| 120 | } | |||||
| 121 | ||||||
| 122 | retu rn moreDat a; | |||||
| 123 | } | |||||
| 124 | } catch (Exc eption ex) { | |||||
| 125 | Logger.g etLogger(P atientProf ileDAO.cla ss.getName ()).log(Le vel.SEVERE , null, ex ); | |||||
| 126 | } | |||||
| 127 | ||||||
| 128 | re turn sb.to String(); | |||||
| 129 | } | |||||
| 130 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.