Produced by Araxis Merge on 8/1/2019 1:42:44 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 | JLV_2_8_0_0_0_July_2019.zip\JLV_2_8_0_0_0_July_2019\jMeadows\src\main\java\gov\va\med\jmeadows\smartbeans\patient | SmartDemographics.java | Mon Jul 8 19:18:56 2019 UTC |
2 | JLV_2_8_0_0_0_July_2019.zip\JLV_2_8_0_0_0_July_2019\jMeadows\src\main\java\gov\va\med\jmeadows\smartbeans\patient | SmartDemographics.java | Wed Jul 31 18:41:36 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 1500 |
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 | * Janus 4 .0 (c) | |
3 | * Copyrig ht (c) 201 1 Hawaii R esource Gr oup LLC. A ll Rights Reserved. | |
4 | * Develop ed for the Pacific T elehealth & Technolo gy Hui and the Pacif ic Joint I nformation Technolog y Center | |
5 | * Contrib utors: | |
6 | * Honorab le Senator Daniel K. Inouye | |
7 | * VA Paci fic Island s Health C are System | |
8 | * Tripler Army Medi cal Center | |
9 | */ | |
10 | ||
11 | ||
12 | package go v.va.med.j meadows.sm artbeans.p atient; | |
13 | ||
14 | //import g ov.va.medo ra.HuiSvc. ArrayOfTag gedText; | |
15 | //import g ov.va.medo ra.HuiSvc. PatientTO; | |
16 | //import g ov.va.medo ra.HuiSvc. TaggedPati entArray; | |
17 | //import g ov.va.medo ra.HuiSvc. TaggedText ; | |
18 | ||
19 | //import g ov.va.med. bhie.Patie ntDemograp hicsDataRe cordV3; | |
20 | //import g ov.va.med. bhie.Patie ntDemograp hicsResult Collection V3; | |
21 | ||
22 | import gov .va.med.bh ie.*; | |
23 | import gov .va.med.fo undations. utilities. HashCodeUt il; | |
24 | import gov .va.med.fo undations. utilities. Messages; | |
25 | import gov .va.med.jm eadows.com mon.JMeado wsConstant s; | |
26 | import gov .va.med.jm eadows.com mon.JMeado wsExceptio n; | |
27 | import gov .va.med.jm eadows.com mon.Langua geCache; | |
28 | import gov .va.med.jm eadows.dao .beans.JMe dResultCol lection; | |
29 | import gov .va.med.jm eadows.dao .beans.Res ponsePatie ntQuery; | |
30 | import gov .va.med.jm eadows.dao .util.Loca tion; | |
31 | import gov .va.med.jm eadows.dao .util.Pati entLocatio n; | |
32 | import gov .va.med.jm eadows.dat aserviceha ndler.PDWS BlackList; | |
33 | import gov .va.med.vd s.webservi ce.*; | |
34 | import org .apache.co mmons.lang 3.StringUt ils; | |
35 | import org .slf4j.Log ger; | |
36 | import org .slf4j.Log gerFactory ; | |
37 | ||
38 | import jav a.text.Sim pleDateFor mat; | |
39 | import jav a.util.*; | |
40 | ||
41 | import sta tic gov.va .med.jmead ows.dao.hd d.VLERSite Cache.getV LERSiteNam e; | |
42 | ||
43 | //import o rg.hui.chc s.Demograp hicsBean; | |
44 | ||
45 | /** | |
46 | * @author DNS | |
47 | */ | |
48 | public cla ss SmartDe mographics extends S martBean i mplements Comparable { | |
49 | ||
50 | public static fi nal int SI TE = 1; | |
51 | ||
52 | /** | |
53 | * SSN OID. | |
54 | */ | |
55 | public static fi nal String SSN_OID = "2.16.840 .1.113883. 3.42.126.1 00001.2"; | |
56 | ||
57 | /** | |
58 | * EDI PN OID. | |
59 | */ | |
60 | public static fi nal String EDI_OID = "2.16.840 .1.113883. 3.42.10001 .100001.12 "; | |
61 | ||
62 | /** | |
63 | * Rep ository OI D. | |
64 | */ | |
65 | privat e static f inal Strin g REP_OID = "2.16.84 0.1.113883 .3.42.126. 100001.13" ; | |
66 | ||
67 | privat e static f inal Logge r LOGGER = LoggerFac tory.getLo gger(Smart Demographi cs.class); | |
68 | ||
69 | public PatientDe mographics m_demogra phic; | |
70 | ||
71 | ||
72 | public SmartDemo graphics() { | |
73 | su per(); | |
74 | m_ demographi c = null; | |
75 | m_ sortBy = 1 ; | |
76 | m_ bAscending = false; | |
77 | } | |
78 | ||
79 | public SmartDemo graphics(P atientDemo graphics d emographic , String s ort) { | |
80 | su per(); | |
81 | m_ demographi c = demogr aphic; | |
82 | ge tSortValue (sort); | |
83 | } | |
84 | ||
85 | @Overr ide | |
86 | public boolean e quals(Obje ct obj) { | |
87 | bo olean rtc; | |
88 | if (this == obj) { | |
89 | rtc = tr ue; | |
90 | } else if (o bj instanc eof SmartD emographic s) { | |
91 | rtc = co mpareTo(ob j) == 0; | |
92 | } else { | |
93 | rtc = fa lse; | |
94 | } | |
95 | re turn rtc; | |
96 | } | |
97 | ||
98 | @Overr ide | |
99 | public int hashC ode() { | |
100 | in t result = HashCodeU til.SEED; | |
101 | re sult = Has hCodeUtil. hash(resul t, m_demog raphic); | |
102 | re sult = Has hCodeUtil. hash(resul t, m_bAsce nding); | |
103 | re sult = Has hCodeUtil. hash(resul t, m_sortB y); | |
104 | ||
105 | re turn resul t; | |
106 | } | |
107 | ||
108 | ||
109 | @Overr ide | |
110 | public Object[] combineDat a(Object[] array1, O bject[] ar ray2, Stri ng sort) { | |
111 | Ob ject[] rtc ; | |
112 | if (array2 = = null) { | |
113 | rtc = so rt(array1, sort); | |
114 | } else if (a rray1 == n ull) { | |
115 | rtc = so rt(array2, sort); | |
116 | } else { | |
117 | int size = array1. length + a rray2.leng th; | |
118 | SmartDem ographics[ ] temp = n ew SmartDe mographics [size]; | |
119 | int cnt = 0; | |
120 | for (int i = 0; i < array1.l ength; i++ ) { | |
121 | Smar tDemograph ics newAll = new Sma rtDemograp hics((Pati entDemogra phics) arr ay1[i], so rt); | |
122 | temp [cnt] = ne wAll; | |
123 | cnt+ +; | |
124 | } | |
125 | for (int i = 0; i < array2.l ength; i++ ) { | |
126 | Smar tDemograph ics newAll = new Sma rtDemograp hics((Pati entDemogra phics) arr ay2[i], so rt); | |
127 | temp [cnt] = ne wAll; | |
128 | cnt+ +; | |
129 | } | |
130 | Arrays.s ort(temp); | |
131 | PatientD emographic s[] ret = new Patien tDemograph ics[temp.l ength]; | |
132 | for (int i = 0; i < temp.len gth; i++) { | |
133 | ret[ i] = temp[ i].m_demog raphic; | |
134 | } | |
135 | ||
136 | rtc = re t; | |
137 | } | |
138 | re turn rtc; | |
139 | } | |
140 | ||
141 | @Overr ide | |
142 | public JMedResul tCollectio n combineD ata(JMedRe sultCollec tion colle ction1, JM edResultCo llection c ollection2 , String s ort) { | |
143 | ||
144 | Ob ject[] arr ay1 = coll ection1.ge tDemograph ics().toAr ray(); | |
145 | Ob ject[] arr ay2 = coll ection2.ge tDemograph ics().toAr ray(); | |
146 | ||
147 | co llection1. getDemogra phics().cl ear(); | |
148 | co llection1. getDemogra phics().ad dAll(Array s.asList(( PatientDem ographics[ ])combineD ata(array1 , array2, sort))); | |
149 | ||
150 | co llection1. getInterfa ceStatusLi st().addAl l(collecti on2.getInt erfaceStat usList()); | |
151 | co llection1. getNarrati ves().addA ll(collect ion2.getNa rratives() ); | |
152 | co llection1. getErrorLi st().addAl l(collecti on2.getErr orList()); | |
153 | ||
154 | re turn colle ction1; | |
155 | } | |
156 | ||
157 | public Object[] sort(Objec t[] array1 , String s ort) { | |
158 | Ob ject[] rtc ; | |
159 | if (array1 = = null) { | |
160 | rtc = nu ll; | |
161 | } else { | |
162 | int size = array1. length; | |
163 | SmartDem ographics[ ] temp = n ew SmartDe mographics [size]; | |
164 | int cnt = 0; | |
165 | for (int i = 0; i < array1.l ength; i++ ) { | |
166 | Smar tDemograph ics newAll = new Sma rtDemograp hics((Pati entDemogra phics) arr ay1[i], so rt); | |
167 | temp [cnt] = ne wAll; | |
168 | cnt+ +; | |
169 | } | |
170 | Arrays.s ort(temp); | |
171 | PatientD emographic s[] ret = new Patien tDemograph ics[temp.l ength]; | |
172 | for (int i = 0; i < temp.len gth; i++) { | |
173 | ret[ i] = temp[ i].m_demog raphic; | |
174 | } | |
175 | rtc = re t; | |
176 | } | |
177 | re turn rtc; | |
178 | } | |
179 | ||
180 | // publ ic Patient Demographi cs[] mapPa tientDemog raphicsFro mCHCS(Obje ct[] dodBe an) { | |
181 | // PatientDem ographics[ ] pats = n ew Patient Demographi cs[dodBean .length]; | |
182 | // | |
183 | // for (int i = 0; i < dodBean.le ngth; i++) { | |
184 | // Demogr aphicsBean chcsPat = (Demograp hicsBean) dodBean[i] ; | |
185 | // if (ch csPat != n ull) { | |
186 | // Pa tientDemog raphics pa t = new Pa tientDemog raphics(); | |
187 | // pa t.setAddre ss1(chcsPa t.getAddre ss1()); | |
188 | // pa t.setAddre ss2(chcsPa t.getAddre ss2()); | |
189 | // pa t.setAge(c hcsPat.get Age()); | |
190 | // pa t.setCity( chcsPat.ge tCity()); | |
191 | // pa t.setClini c(chcsPat. getClinic( )); | |
192 | // pa t.setDob(c hcsPat.get Dob()); | |
193 | // pa t.setGende r(chcsPat. getSex()); | |
194 | // pa t.setName( chcsPat.ge tName()); | |
195 | // pa t.setPrima ryProvider (chcsPat.g etPcm()); | |
196 | // pa t.setPhone 1(chcsPat. getPhone1( )); | |
197 | // pa t.setPhone 2(chcsPat. getPhone2( )); | |
198 | // pa t.setSSN(c hcsPat.get SSN()); | |
199 | // pa t.setState (chcsPat.g etState()) ; | |
200 | // pa t.setZipCo de(chcsPat .getZipCod e()); | |
201 | // pa t.setCodeG reen("0"); | |
202 | // ad dCHCSSiteD ataToVista Bean(pat); | |
203 | // pa ts[i] = pa t; | |
204 | // } | |
205 | // } | |
206 | // | |
207 | // return pat s; | |
208 | // } | |
209 | ||
210 | ||
211 | public JMedResul tCollectio n mapPatie ntDemograp hicsFromBH IE(Object resultColl ection) th rows JMead owsExcepti on { | |
212 | JM edResultCo llection j lvResultCo llection = new JMedR esultColle ction(); | |
213 | V4 ResultColl ection pat DemoResult Collection = (V4Resu ltCollecti on) result Collection ; | |
214 | Li st<Patient Demographi cs> vistaB eans = new ArrayList <PatientDe mographics >(); | |
215 | Li st<Interfa ceStatus> interfaceS tatusList = new Arra yList<>(); | |
216 | ||
217 | // If data re cord is em pty, infor m user. | |
218 | if (patDemoR esultColle ction.getD ataRecordL ist() == n ull || pat DemoResult Collection .getDataRe cordList() .getDemogr aphics() = = null) { | |
219 | PatientL ocation bh ieLoc = ne w PatientL ocation(); | |
220 | bhieLoc. setSystemT ype(SYSTEM _TYPE_DOD_ ADAPTER); | |
221 | ||
222 | vistaBea ns.addAll( Arrays.asL ist( | |
223 | (PatientDe mographics []) genera teBHIEPatR egErrorBea n(bhieLoc) )); | |
224 | } else { | |
225 | try { | |
226 | Simp leDateForm at sdf = n ew SimpleD ateFormat( "dd MMM yy yy", Local e.getDefau lt()); | |
227 | for (Demograph icV4 bhieP at : patDe moResultCo llection.g etDataReco rdList().g etDemograp hics()) { | |
228 | ||
229 | //if (data Record == null || da taRecord.g etPatientD emographic s() == nul l) continu e; | |
230 | ||
231 | //gov.va.m ed.bhie.Pa tientDemog raphics bh iePat = da taRecord.g etPatientD emographic s(); | |
232 | PatientDem ographics pat = new PatientDem ographics( ); | |
233 | Address pa tAddress = new Addre ss(); | |
234 | if (bhiePa t.getAddre sses() != null && !b hiePat.get Addresses( ).isEmpty( )) { | |
235 | if (bh iePat.getA ddresses() .get(0).ge tStreet() != null && !bhiePat. getAddress es().get(0 ).getStree t().isEmpt y()) { | |
236 | pa tAddress.s etStreet1( bhiePat.ge tAddresses ().get(0). getStreet( ).get(0)); | |
237 | if (bhiePat. getAddress es().get(0 ).getStree t().size() > 1) { | |
238 | patAddre ss.setStre et2(bhiePa t.getAddre sses().get (0).getStr eet().get( 1)); | |
239 | } | |
240 | } | |
241 | ||
242 | patAdd ress.setCi ty(bhiePat .getAddres ses().get( 0).getCity ()); | |
243 | patAdd ress.setSt ateProvinc e(bhiePat. getAddress es().get(0 ).getState ()); | |
244 | patAdd ress.setPo stalCode(b hiePat.get Addresses( ).get(0).g etPostalCo de()); | |
245 | patAdd ress.setTy pe(bhiePat .getAddres ses().get( 0).getType ()); | |
246 | pat.ge tAddress() .add(patAd dress); | |
247 | } | |
248 | //pat.setA ge(chcsPat .getAge()) ; | |
249 | //pat.setC linic(bhie Pat.get); | |
250 | if (bhiePa t.getBirth Date() != null) { | |
251 | //if(b hieToCal(b hiePat.get BirthDate( ).getStart ()) != nul l) | |
252 | pat.se tDob(sdf.f ormat(bhie ToXMLCalV4 (bhiePat.g etBirthDat e()).toGre gorianCale ndar().get Time())); | |
253 | } | |
254 | if (bhiePa t.getSex() != null & & !bhiePat .getSex(). isEmpty() && bhiePat .getSex(). get(0) != null) { | |
255 | pat.se tGender(bh iePat.getS ex().get(0 ).getCode( )); | |
256 | } | |
257 | if (bhiePa t.getSpons or() != nu ll && bhie Pat.getSpo nsor().get Ssn() != n ull && bhi ePat.getSp onsor().ge tSsn().len gth() > 0) { | |
258 | pat.se tFMP(bhieP at.getFmp( ) + "/" + bhiePat.ge tSponsor() .getSsn()) ; | |
259 | } else { | |
260 | pat.se tFMP(bhieP at.getFmp( )); | |
261 | } | |
262 | // pa t.getRace( ).addAll(g etCodes(bh iePat.getR ace())); | |
263 | ||
264 | pat.getRac e().clear( ); | |
265 | // if (bhie Pat.getRac e() != nul l && !bhie Pat.getRac e().isEmpt y()) { | |
266 | // pat. getRace(). addAll(Arr ays.asList (getCodesV 4(bhiePat. getRace()) )); | |
267 | // } | |
268 | if (bhiePa t.getRace( ) != null && bhiePat .getRace() .size() > 0) { | |
269 | List<S pdcBeanV4> raceCodeL ist = new ArrayList< SpdcBeanV4 >(); | |
270 | for (S pdcWrapper V4 races : bhiePat.g etRace()) { | |
271 | if (getPrima rySpdcV4(r aces.getSp dcList()) != null) { | |
272 | SpdcBean V4 primary Race = get PrimarySpd cV4(races. getSpdcLis t()); | |
273 | if (prim aryRace != null && p rimaryRace .getDispla y() != nul l) { | |
274 | race CodeList.a dd(primary Race); | |
275 | } | |
276 | } | |
277 | ||
278 | } | |
279 | if (ra ceCodeList .size() > 0 && !race CodeList.i sEmpty()) { | |
280 | pa t.getRace( ).addAll(A rrays.asLi st(getCode sV4(raceCo deList))); | |
281 | } | |
282 | } | |
283 | ||
284 | ||
285 | //pat.setP atientId(c hcsPat.get PatientId( )); | |
286 | if (bhiePa t.getName( ) != null) { | |
287 | String first = " "; | |
288 | String last = "" ; | |
289 | String middle = ""; | |
290 | if (bh iePat.getN ame().getL ast() != n ull) { | |
291 | la st = bhieP at.getName ().getLast (); | |
292 | } | |
293 | if (bh iePat.getN ame().getF irst() != null) { | |
294 | fi rst = bhie Pat.getNam e().getFir st(); | |
295 | } | |
296 | if (bh iePat.getN ame().getM iddle() != null) { | |
297 | mi ddle = bhi ePat.getNa me().getMi ddle(); | |
298 | } | |
299 | pat.se tName(last + ", " + first + " " + middle ); | |
300 | } | |
301 | //pat.setP rimaryProv ider(chcsP at.getPcm( )); | |
302 | if (bhiePa t.getTelec oms() != n ull && !bh iePat.getT elecoms(). isEmpty()) { | |
303 | for (T elecomV4 t el : bhieP at.getTele coms()) { | |
304 | if (tel != nu ll){ | |
305 | if ((tel .getUriPre fix() == n ull) | |
306 | | | (tel.get UriPrefix( ).contains ("mailto") ) | |
307 | || (tel.ge tValue().c ontains("@ "))) { | |
308 | cont inue; | |
309 | } else { | |
310 | if ( "WP".equal sIgnoreCas e(tel.getU seType())) { | |
311 | pat.setPho ne2(tel.ge tValue()); | |
312 | } el se { | |
313 | pat.setPho ne1(tel.ge tValue()); | |
314 | } | |
315 | } | |
316 | } | |
317 | } | |
318 | } | |
319 | //pat.setP hone2(chcs Pat.getPho ne2()); | |
320 | // pa t.setSSN(b hiePat.get SocialSecu rityNumber ()); | |
321 | String ssn = ""; | |
322 | if (bhiePa t.getPatie ntId() != null) { | |
323 | Iterat or<RecordI dentifierV 4> iter = bhiePat.ge tPatientId ().iterato r(); | |
324 | while (iter.hasN ext()) { | |
325 | Re cordIdenti fierV4 rec ordid = it er.next(); | |
326 | if (SSN_OID. equals(rec ordid.getA ssigningAu thority()) ) { | |
327 | ssn = re cordid.get Id(); | |
328 | } | |
329 | if (EDI_OID. equals(rec ordid.getA ssigningAu thority()) ) { | |
330 | String e di = recor did.getId( ); | |
331 | if (edi != null) { | |
332 | if ( edi.length () > 1 && edi.charAt (0) == 'D' ) { | |
333 | edi = edi. substring( 1); | |
334 | } | |
335 | } | |
336 | if (edi != null && edi.lengt h() > 0 && PDWSBlack List.getIn stance().i sBlackList ed(edi)) { | |
337 | pat. setSensiti ve(true); | |
338 | } | |
339 | pat.setE DIPI(edi); | |
340 | } | |
341 | } | |
342 | } | |
343 | pat.setSSN (ssn); | |
344 | pat.setCod eGreen("0" ); | |
345 | ||
346 | // Set pat ient demog raphics ra nk | |
347 | String ran k = ""; | |
348 | if (bhiePa t.getRank( ) != null) { | |
349 | for (S pdcBeanV4 rankEl : b hiePat.get Rank()) { | |
350 | if (rankEl.i sPrimary() ) { | |
351 | rank = r ankEl.getD isplay(); | |
352 | break; | |
353 | } | |
354 | } | |
355 | } | |
356 | pat.setRan k(rank); | |
357 | ||
358 | String rep ositoryId = ""; | |
359 | String rep ositoryNam e = ""; | |
360 | String fac ilityName = ""; | |
361 | String eve ntId = ""; | |
362 | ||
363 | if (bhiePa t.getRepos itory() != null && b hiePat.get Repository ().getName () != null ) { | |
364 | if (bh iePat.getR epository( ).getIds() != null & & !bhiePat .getReposi tory().get Ids().isEm pty() && b hiePat.get Repository ().getIds( ).get(0) ! = null) { | |
365 | if (!StringUt ils.isEmpt y(bhiePat. getReposit ory().getI ds().get(0 ).getId()) ){ | |
366 | reposito ryId = bhi ePat.getRe pository() .getIds(). get(0).get Id(); | |
367 | } else { | |
368 | reposito ryId = bhi ePat.getRe pository() .getIds(). get(0).get AssigningA uthority() ; | |
369 | } | |
370 | } | |
371 | } | |
372 | ||
373 | if (bhiePa t.getRepos itory() != null) { | |
374 | reposi toryName = bhiePat.g etReposito ry().getNa me(); | |
375 | } | |
376 | if (bhiePa t.getFacil ity() != n ull) { | |
377 | facili tyName = b hiePat.get Facility() .getName() ; | |
378 | } | |
379 | if (bhiePa t.getRecor dId() != n ull) { | |
380 | eventI d = bhiePa t.getRecor dId().getI d(); | |
381 | } | |
382 | if (reposi toryId == null || re positoryId .length() == 0) { | |
383 | reposi toryId = R EP_OID; | |
384 | } | |
385 | if (reposi toryName = = null || repository Name.lengt h() == 0) { | |
386 | reposi toryName = "ahlta"; | |
387 | } | |
388 | ||
389 | if (bhiePa t.getNextO fKin() != null && !b hiePat.get NextOfKin( ).isEmpty( )) { | |
390 | for (P ersonV4 bh iePerson : bhiePat.g etNextOfKi n()) { | |
391 | Pe rson nextO fKin = new Person(); | |
392 | ne xtOfKin.se tName(getN ameFromPer son(bhiePe rson)); | |
393 | if (bhiePers on.getRela tionship() != null & & getPrima rySpdcV4(b hiePerson. getRelatio nship()) ! = null) { | |
394 | nextOfKi n.setRelat ionship(ge tPrimarySp dcV4(bhieP erson.getR elationshi p()).getDi splay()); | |
395 | } | |
396 | if (bhiePers on.getAddr ess() != n ull && bhi ePerson.ge tAddress() .size() > 0) { | |
397 | Address kinAddress = new Add ress(); | |
398 | kinAddre ss.setCity (bhiePerso n.getAddre ss().get(0 ).getCity( )); | |
399 | kinAddre ss.setStat eProvince( bhiePerson .getAddres s().get(0) .getState( )); | |
400 | kinAddre ss.setPost alCode(bhi ePerson.ge tAddress() .get(0).ge tPostalCod e()); | |
401 | kinAddre ss.setType (bhiePerso n.getAddre ss().get(0 ).getType( )); | |
402 | if (bhie Person.get Address(). get(0).get Street() ! = null && bhiePerson .getAddres s().get(0) .getStreet ().size() > 0) { | |
403 | if ( bhiePerson .getAddres s().get(0) .getStreet ().get(0) != null) { | |
404 | kinAddress .setStreet 1(bhiePers on.getAddr ess().get( 0).getStre et().get(0 )); | |
405 | } | |
406 | if ( bhiePerson .getAddres s().get(0) .getStreet ().size() > 1 && bhi ePerson.ge tAddress() .get(0).ge tStreet(). get(1) != null) { | |
407 | kinAddress .setStreet 2(bhiePers on.getAddr ess().get( 0).getStre et().get(1 )); | |
408 | } | |
409 | if ( bhiePerson .getAddres s().get(0) .getStreet ().size() > 2 && bhi ePerson.ge tAddress() .get(0).ge tStreet(). get(2) != null) { | |
410 | kinAddress .setStreet 3(bhiePers on.getAddr ess().get( 0).getStre et().get(2 )); | |
411 | } | |
412 | } | |
413 | nextOfKi n.getAddre ss().add(k inAddress) ; | |
414 | } | |
415 | if (bhiePers on.getPhon e() != nul l) { | |
416 | for (Tel ecomV4 tel com : bhie Person.get Phone()) { | |
417 | Tele com phone = new Tele com(); | |
418 | phon e.setUsage Type(telco m.getUseTy pe()); | |
419 | phon e.setValue (telcom.ge tValue()); | |
420 | next OfKin.getT elcoms().a dd(phone); | |
421 | } | |
422 | } | |
423 | pa t.getNextO fKin().add (nextOfKin ); | |
424 | } | |
425 | } | |
426 | ||
427 | ||
428 | if (bhiePa t.getEmerg encyContac ts() != nu ll && !bhi ePat.getEm ergencyCon tacts().is Empty()) { | |
429 | for (P ersonV4 bh iePerson : bhiePat.g etEmergenc yContacts( )) { | |
430 | Pe rson conta ct = new P erson(); | |
431 | co ntact.setN ame(getNam eFromPerso n(bhiePers on)); | |
432 | if (bhiePers on.getRela tionship() != null & & getPrima rySpdcV4(b hiePerson. getRelatio nship()) ! = null) { | |
433 | contact. setRelatio nship(getP rimarySpdc V4(bhiePer son.getRel ationship( )).getDisp lay()); | |
434 | } | |
435 | if (bhiePers on.getAddr ess() != n ull && bhi ePerson.ge tAddress() .size() > 0) { | |
436 | Address contactAdd ress = new Address() ; | |
437 | contactA ddress.set City(bhieP erson.getA ddress().g et(0).getC ity()); | |
438 | contactA ddress.set StateProvi nce(bhiePe rson.getAd dress().ge t(0).getSt ate()); | |
439 | contactA ddress.set PostalCode (bhiePerso n.getAddre ss().get(0 ).getPosta lCode()); | |
440 | contactA ddress.set Type(bhieP erson.getA ddress().g et(0).getT ype()); | |
441 | if (bhie Person.get Address(). get(0).get Street() ! = null && bhiePerson .getAddres s().get(0) .getStreet ().size() > 0) { | |
442 | if ( bhiePerson .getAddres s().get(0) .getStreet ().get(0) != null) { | |
443 | contactAdd ress.setSt reet1(bhie Person.get Address(). get(0).get Street().g et(0)); | |
444 | } | |
445 | if ( bhiePerson .getAddres s().get(0) .getStreet ().size() > 1 && bhi ePerson.ge tAddress() .get(0).ge tStreet(). get(1) != null) { | |
446 | contactAdd ress.setSt reet2(bhie Person.get Address(). get(0).get Street().g et(1)); | |
447 | } | |
448 | if ( bhiePerson .getAddres s().get(0) .getStreet ().size() > 2 && bhi ePerson.ge tAddress() .get(0).ge tStreet(). get(2) != null) { | |
449 | contactAdd ress.setSt reet3(bhie Person.get Address(). get(0).get Street().g et(2)); | |
450 | } | |
451 | } | |
452 | contact. getAddress ().add(con tactAddres s); | |
453 | } | |
454 | if (bhiePers on.getPhon e() != nul l) { | |
455 | for (Tel ecomV4 tel com : bhie Person.get Phone()) { | |
456 | //if (telcom ! = null && telcom.get UseType() != null && telcom.ge tValue() ! = null) { | |
457 | Telecom ph one = new Telecom(); | |
458 | phone.setU sageType(t elcom.getU seType()); | |
459 | phone.setV alue(telco m.getValue ()); | |
460 | contact.ge tTelcoms() .add(phone ); | |
461 | // } | |
462 | } | |
463 | } | |
464 | pa t.getEmerg encyContac t().add(co ntact); | |
465 | } | |
466 | } | |
467 | ||
468 | if (bhiePa t.getMarit alStatus() != null & & getPrima rySpdcV4(b hiePat.get MaritalSta tus()) != null) { | |
469 | pat.se tMaritalSt atus(getPr imarySpdcV 4(bhiePat. getMarital Status()). getDisplay ()); | |
470 | } | |
471 | ||
472 | if(bhiePat .getEthnic Group() != null){ | |
473 | if(bhi ePat.getEt hnicGroup( ).size() > 0) | |
474 | pat.ge tEthnicGro up().addAl l(Arrays.a sList(getC odesV4(bhi ePat.getEt hnicGroup( )))); | |
475 | } | |
476 | ||
477 | if (bhiePa t.getLangu ages() != null) { | |
478 | for (L anguagesV4 languages : bhiePat .getLangua ges()) { | |
479 | fo r (SpdcBea nV4 langua ge : langu ages.getLa nguageList ()) { | |
480 | if (lang uage != nu ll) { | |
481 | if ( language.g etDisplay( ) != null && !langua ge.getDisp lay().isEm pty()) { | |
482 | String lan gDisplay = language. getDisplay (); | |
483 | pat.getLan guages().a dd(Languag eCache.get Label(lang Display)); | |
484 | } | |
485 | } | |
486 | } | |
487 | ||
488 | } | |
489 | } | |
490 | ||
491 | if (bhiePa t.getRelig ion() != n ull) { | |
492 | for (S pdcBeanV4 religion : bhiePat.g etReligion ()) { | |
493 | if (religion != null) { | |
494 | if (reli gion.getDi splay() != null && ! religion.g etDisplay( ).isEmpty( )) { | |
495 | pat. getReligio n().add(re ligion.get Display()) ; | |
496 | } | |
497 | } | |
498 | } | |
499 | } | |
500 | ||
501 | if (patDem oResultCol lection.is Vler()) { | |
502 | if(bhi ePat.getRe pository() != null & & StringUt ils.isNotB lank(bhieP at.getRepo sitory().g etAbbrevia tion())){ | |
503 | fa cilityName = bhiePat .getReposi tory().get Abbreviati on(); | |
504 | } | |
505 | ||
506 | addBHI ESiteDataT oVistaBean (repositor yId, | |
507 | reposito ryName, fa cilityName , eventId, pat); | |
508 | pat.ge tSite().se tAgency(AG ENCY_DOD_V LER); | |
509 | ||
510 | } else { | |
511 | addBHI ESiteDataT oVistaBean (repositor yId, repos itoryName, | |
512 | facility Name, even tId, pat); | |
513 | } | |
514 | ||
515 | vistaBeans .add(pat); | |
516 | } | |
517 | } catch (Exception ex) { | |
518 | LOGG ER.error(" EXCEPTION: " + ex.ge tLocalized Message(), ex); | |
519 | thro w new JMea dowsExcept ion(ex); | |
520 | } | |
521 | } | |
522 | ||
523 | // //include site statu s report | |
524 | // String sit eStatusRep ort = gene rateBhieSt atusReport V4(patDemo ResultColl ection.get StatusList v4(), | |
525 | // pa tDemoResul tCollectio n.getError Listv4(), patDemoRes ultCollect ion.isVler ()); | |
526 | ||
527 | // vistaBeans .addAll(Ar rays.asLis t( | |
528 | // (P atientDemo graphics[] ) generate Connection Unavailabl eBean( | |
529 | // BHIE _STATUS_RE PORT_LOCAT ION, | |
530 | // site StatusRepo rt) | |
531 | // )); | |
532 | ||
533 | in terfaceSta tusList.ad dAll(gener ateInterfa ceStatusLi st(patDemo ResultColl ection.get StatusList v4(), patD emoResultC ollection. isVler(), JMeadowsCo nstants.DO MAIN_DEMOG RAPHICS)); | |
534 | ||
535 | jl vResultCol lection.ge tDemograph ics().addA ll(vistaBe ans); | |
536 | jl vResultCol lection.ge tInterface StatusList ().addAll( interfaceS tatusList) ; | |
537 | jl vResultCol lection.ge tErrorList ().addAll( patDemoRes ultCollect ion.getErr orListv4() ); | |
538 | ||
539 | re turn jlvRe sultCollec tion; | |
540 | ||
541 | // return vis taBeans.to Array(new PatientDem ographics[ vistaBeans .size()]); | |
542 | } | |
543 | ||
544 | public JMedResul tCollectio n mapPatie ntDemograp hicsFromPD WS(Object resultColl ection) th rows JMead owsExcepti on { | |
545 | JM edResultCo llection j lvResultCo llection = new JMedR esultColle ction(); | |
546 | Re sponsePati entQuery r esponse = (ResponseP atientQuer y) resultC ollection; | |
547 | Li st<Patient Demographi cs> vistaB eans = new ArrayList <PatientDe mographics >(); | |
548 | Li st<Interfa ceStatus> interfaceS tatusList = new Arra yList<>(); | |
549 | ||
550 | if (response == null | | response .getDemogr aphics() = = null) { | |
551 | PatientL ocation bh ieLoc = ne w PatientL ocation(); | |
552 | bhieLoc. setSystemT ype(SYSTEM _TYPE_DOD_ ADAPTER); | |
553 | ||
554 | // vistaB eans.addAl l(Arrays.a sList( | |
555 | // (Patient Demographi cs[]) gene rateBHIEPa tRegErrorB ean(bhieLo c))); | |
556 | ||
557 | PartnerV 4 partner = new Part nerV4(); | |
558 | partner. setPartner Name("PDWS "); | |
559 | ||
560 | SiteStat usV4 siteS tatus = ne w SiteStat usV4(); | |
561 | siteStat us.setPart ner(partne r); | |
562 | siteStat us.setPart nerStatus( "Connectio n Unavaila ble"); | |
563 | List<Sit eStatusV4> statusLis t = new Ar rayList<>( ); | |
564 | statusLi st.add(sit eStatus); | |
565 | ||
566 | interfac eStatusLis t.addAll(g enerateInt erfaceStat usList(sta tusList, f alse, JMea dowsConsta nts.DOMAIN _DEMOGRAPH ICS)); | |
567 | } else { | |
568 | try { | |
569 | Pati entDemogra phics demo = respons e.getDemog raphics(); | |
570 | // if (demo.get SponsorSSN () == null || demo.g etSponsorS SN().lengt h() == 0) { | |
571 | // demo.set SponsorSSN (demo.getS SN()); | |
572 | // } | |
573 | // if (demo.get SponsorNam e() == nul l || demo. getSponsor Name().len gth() == 0 ) { | |
574 | // demo.set SponsorNam e(demo.get Name()); | |
575 | // } | |
576 | demo .setCodeGr een("0"); | |
577 | ||
578 | addB HIESiteDat aToVistaBe an("", "PD WS", "PDWS ", "", dem o); | |
579 | ||
580 | vist aBeans.add (demo); | |
581 | ||
582 | Part nerV4 part ner = new PartnerV4( ); | |
583 | Site StatusV4 s iteStatus = new Site StatusV4() ; | |
584 | part ner.setPar tnerName(" PDWS"); | |
585 | site Status.set Partner(pa rtner); | |
586 | site Status.set PartnerSta tus("SUCCE SS"); | |
587 | List <SiteStatu sV4> statu sList = ne w ArrayLis t<>(); | |
588 | stat usList.add (siteStatu s); | |
589 | inte rfaceStatu sList.addA ll(generat eInterface StatusList (statusLis t, false, JMeadowsCo nstants.DO MAIN_DEMOG RAPHICS)); | |
590 | ||
591 | } catch (Exception e) { | |
592 | LOGG ER.error(" EXCEPTION: " + e.get LocalizedM essage(), e); | |
593 | thro w new JMea dowsExcept ion(e); | |
594 | } | |
595 | } | |
596 | ||
597 | jl vResultCol lection.ge tDemograph ics().addA ll(vistaBe ans); | |
598 | jl vResultCol lection.ge tInterface StatusList ().addAll( interfaceS tatusList) ; | |
599 | ||
600 | re turn jlvRe sultCollec tion; | |
601 | // return vis taBeans.to Array(new PatientDem ographics[ vistaBeans .size()]); | |
602 | } | |
603 | ||
604 | public JMedResul tCollectio n mapDASVL ERDemograp hics(Objec t resultCo llection) throws JMe adowsExcep tion { | |
605 | JM edResultCo llection v lerResultC ollection = (JMedRes ultCollect ion) resul tCollectio n; | |
606 | Li st<Patient Demographi cs> vistaB eans; | |
607 | ||
608 | tr y { | |
609 | ||
610 | if (vler ResultColl ection.get Allergies( ) != null) { | |
611 | //Sm artAllergy smartAlle rgy = new SmartAller gy(); | |
612 | vist aBeans = v lerResultC ollection. getDemogra phics(); | |
613 | ||
614 | for( PatientDem ographics vistaBean : vistaBea ns){ | |
615 | if(StringU tils.isNot Empty(vist aBean.getS ite().getS iteCode()) ){ | |
616 | String vlerSiteN ame = getV LERSiteNam e(vistaBea n.getSite( ).getSiteC ode()); | |
617 | if(Str ingUtils.i sNotEmpty( vlerSiteNa me)) { | |
618 | vi staBean.ge tSite().se tName(vler SiteName); | |
619 | } | |
620 | } | |
621 | } | |
622 | } | |
623 | ||
624 | populate StatusVLER SiteNames( vlerResult Collection ); | |
625 | ||
626 | } catch (Exc eption ex) { | |
627 | ||
628 | LOGGER.e rror("EXCE PTION: " + ex.getLoc alizedMess age(), ex) ; | |
629 | throw ne w JMeadows Exception( ex); | |
630 | } | |
631 | ||
632 | // return vis taBeans.to Array(new PatientDem ographics[ vistaBeans .size()]); | |
633 | re turn vlerR esultColle ction; | |
634 | } | |
635 | ||
636 | public Object[] generateBH IEPatRegEr rorBean(Lo cation loc ation) { | |
637 | ||
638 | Pa tientDemog raphics pa t = new Pa tientDemog raphics(); | |
639 | Ad dress patA ddress = n ew Address (); | |
640 | pa t.setName( Messages.g et("demogr aphics.dod .results.e mpty").toU pperCase() ); | |
641 | pa tAddress.s etStreet1( Messages.g et("demogr aphics.dod .results.h elpdesk"). toUpperCas e()); | |
642 | pa tAddress.s etStreet2( ""); | |
643 | pa t.setAge(" "); | |
644 | pa tAddress.s etCity("") ; | |
645 | pa t.setClini c(""); | |
646 | pa t.setDob(" "); | |
647 | pa t.setGende r(""); | |
648 | pa t.setPrima ryProvider (""); | |
649 | pa t.setPhone 1(""); | |
650 | pa t.setPhone 2(""); | |
651 | pa t.setSSN(" "); | |
652 | pa tAddress.s etStatePro vince(""); | |
653 | pa tAddress.s etPostalCo de(""); | |
654 | pa t.setCodeG reen("0"); | |
655 | pa t.setSite( getConnect ionUnavail ableSite(l ocation)); | |
656 | pa t.getAddre ss().add(p atAddress) ; | |
657 | re turn new P atientDemo graphics[] {pat}; | |
658 | } | |
659 | ||
660 | @Overr ide | |
661 | public Object[] generateCo nnectionUn availableB ean(Locati on locatio n, String inerrorMsg ) { | |
662 | St ring error Msg = iner rorMsg; | |
663 | if (errorMsg == null) { | |
664 | errorMsg = ERROR_M SG_CONNECT ION_UNAVAI LABLE; | |
665 | } | |
666 | ||
667 | Si te site = getConnect ionUnavail ableSite(l ocation); | |
668 | ||
669 | In terfaceSta tus status = new Int erfaceStat us(); | |
670 | st atus.setEr rorMessage (errorMsg) ; | |
671 | st atus.setNa me(site.ge tName()); | |
672 | st atus.setSo urce(site. getAgency( )); | |
673 | st atus.setSt atus(error Msg); | |
674 | st atus.setDo main(JMead owsConstan ts.DOMAIN_ DEMOGRAPHI CS); | |
675 | re turn new I nterfaceSt atus[]{sta tus}; | |
676 | } | |
677 | ||
678 | public static St ring getNa meFromPers on(PersonV 4 person) { | |
679 | St ring rtc; | |
680 | if (person.g etName() = = null) { | |
681 | rtc = "" ; | |
682 | } else { | |
683 | rtc = ge tNameStrin g(person.g etName()); | |
684 | } | |
685 | re turn rtc; | |
686 | } | |
687 | ||
688 | public static St ring getNa meString(N ameV4 name v4) { | |
689 | St ring rtc; | |
690 | ||
691 | if (name v4.getRaw( ) == null) { | |
692 | Stri ngBuilder nameSb = n ew StringB uilder(); | |
693 | if ( namev4.get Last() != null) { | |
694 | nameSb.app end(namev4 .getLast() ); | |
695 | } | |
696 | name Sb.append( ','); | |
697 | if ( namev4.get Prefix() ! = null) { | |
698 | nameSb.app end(' '); | |
699 | nameSb.app end(namev4 .getPrefix ()); | |
700 | } | |
701 | if ( namev4.get First() != null) { | |
702 | nameSb.app end(' '); | |
703 | nameSb.app end(namev4 .getFirst( )); | |
704 | } | |
705 | if ( namev4.get Middle() ! = null) { | |
706 | nameSb.app end(' '); | |
707 | nameSb.app end(namev4 .getMiddle ()); | |
708 | } | |
709 | if ( namev4.get Suffix() ! = null) { | |
710 | nameSb.app end(' '); | |
711 | nameSb.app end(namev4 .getSuffix ()); | |
712 | } | |
713 | rtc = nameSb.t oString(); | |
714 | } else { | |
715 | rtc = namev4.g etRaw(); | |
716 | } | |
717 | re turn rtc; | |
718 | } | |
719 | ||
720 | public int compa reTo(Objec t obj) { | |
721 | Sm artDemogra phics tmp = (SmartDe mographics ) obj; | |
722 | in t retVal = 0; | |
723 | if (this.m_s ortBy == S ITE && thi s.m_demogr aphic.getS ite() != n ull && tmp .m_demogra phic.getSi te() != nu ll) { | |
724 | retVal = compareSt ring(this. m_demograp hic.getSit e().getSit eCode(), t mp.m_demog raphic.get Site().get SiteCode() ); | |
725 | } | |
726 | ||
727 | if (!this.m_ bAscending ) { | |
728 | retVal = -retVal; | |
729 | } | |
730 | ||
731 | re turn retVa l; | |
732 | } | |
733 | ||
734 | //TODO : Why is s ort by alw ays SITE? | |
735 | privat e void get SortValue( String ins ort) { | |
736 | St ring sort = insort; | |
737 | m_ sortBy = S ITE; | |
738 | m_ bAscending = false; | |
739 | if (sort != null) { | |
740 | sort = s etAscendin g(sort); | |
741 | if ("sit eCode".equ alsIgnoreC ase(sort)) { | |
742 | m_so rtBy = SIT E; | |
743 | } | |
744 | } | |
745 | } | |
746 | ||
747 | @Overr ide | |
748 | public JMedResul tCollectio n generate Connection Unavailabl eStatus(Lo cation loc ation, Str ing errorM sg, String domain) { | |
749 | re turn super .generateC onnectionU navailable Status(loc ation, err orMsg, dom ain); | |
750 | } | |
751 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.