Produced by Araxis Merge on 4/2/2019 9:49:00 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_JLV 2_7_2_0_0.zip\JLV_Src\jMeadows\src\main\java\gov\va\med\jmeadows\smartbeans\patient | SmartDemographics.java | Wed Mar 20 21:43:44 2019 UTC |
2 | JLV_JLV 2_7_2_0_0.zip\JLV_Src\jMeadows\src\main\java\gov\va\med\jmeadows\smartbeans\patient | SmartDemographics.java | Tue Apr 2 13:30:30 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 1488 |
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 && edi.lengt h() > 1 && edi.charA t(0) == 'D ') { | |
332 | edi = edi.subs tring(1); | |
333 | } | |
334 | if (edi != null && edi.lengt h() > 0 && PDWSBlack List.getIn stance().i sBlackList ed(edi)) { | |
335 | pat. setSensiti ve(true); | |
336 | } | |
337 | pat.setE DIPI(edi); | |
338 | } | |
339 | } | |
340 | } | |
341 | pat.setSSN (ssn); | |
342 | pat.setCod eGreen("0" ); | |
343 | ||
344 | // Set pat ient demog raphics ra nk | |
345 | String ran k = ""; | |
346 | if (bhiePa t.getRank( ) != null) { | |
347 | for (S pdcBeanV4 rankEl : b hiePat.get Rank()) { | |
348 | if (rankEl.i sPrimary() ) { | |
349 | rank = r ankEl.getD isplay(); | |
350 | break; | |
351 | } | |
352 | } | |
353 | } | |
354 | pat.setRan k(rank); | |
355 | ||
356 | String rep ositoryId = ""; | |
357 | String rep ositoryNam e = ""; | |
358 | String fac ilityName = ""; | |
359 | String eve ntId = ""; | |
360 | ||
361 | if (bhiePa t.getRepos itory() != null && b hiePat.get Repository ().getName () != null ) { | |
362 | if (bh iePat.getR epository( ).getIds() != null & & !bhiePat .getReposi tory().get Ids().isEm pty() && b hiePat.get Repository ().getIds( ).get(0) ! = null) { | |
363 | if (!StringUt ils.isEmpt y(bhiePat. getReposit ory().getI ds().get(0 ).getId()) ){ | |
364 | reposito ryId = bhi ePat.getRe pository() .getIds(). get(0).get Id(); | |
365 | } else { | |
366 | reposito ryId = bhi ePat.getRe pository() .getIds(). get(0).get AssigningA uthority() ; | |
367 | } | |
368 | } | |
369 | } | |
370 | ||
371 | if (bhiePa t.getRepos itory() != null) { | |
372 | reposi toryName = bhiePat.g etReposito ry().getNa me(); | |
373 | } | |
374 | if (bhiePa t.getFacil ity() != n ull) { | |
375 | facili tyName = b hiePat.get Facility() .getName() ; | |
376 | } | |
377 | if (bhiePa t.getRecor dId() != n ull) { | |
378 | eventI d = bhiePa t.getRecor dId().getI d(); | |
379 | } | |
380 | if (reposi toryId == null || re positoryId .length() == 0) { | |
381 | reposi toryId = R EP_OID; | |
382 | } | |
383 | if (reposi toryName = = null || repository Name.lengt h() == 0) { | |
384 | reposi toryName = "ahlta"; | |
385 | } | |
386 | ||
387 | if (bhiePa t.getNextO fKin() != null && !b hiePat.get NextOfKin( ).isEmpty( )) { | |
388 | for (P ersonV4 bh iePerson : bhiePat.g etNextOfKi n()) { | |
389 | Pe rson nextO fKin = new Person(); | |
390 | ne xtOfKin.se tName(getN ameFromPer son(bhiePe rson)); | |
391 | if (bhiePers on.getRela tionship() != null & & getPrima rySpdcV4(b hiePerson. getRelatio nship()) ! = null) { | |
392 | nextOfKi n.setRelat ionship(ge tPrimarySp dcV4(bhieP erson.getR elationshi p()).getDi splay()); | |
393 | } | |
394 | if (bhiePers on.getAddr ess() != n ull && bhi ePerson.ge tAddress() .size() > 0) { | |
395 | Address kinAddress = new Add ress(); | |
396 | kinAddre ss.setCity (bhiePerso n.getAddre ss().get(0 ).getCity( )); | |
397 | kinAddre ss.setStat eProvince( bhiePerson .getAddres s().get(0) .getState( )); | |
398 | kinAddre ss.setPost alCode(bhi ePerson.ge tAddress() .get(0).ge tPostalCod e()); | |
399 | kinAddre ss.setType (bhiePerso n.getAddre ss().get(0 ).getType( )); | |
400 | if (bhie Person.get Address(). get(0).get Street() ! = null && bhiePerson .getAddres s().get(0) .getStreet ().size() > 0) { | |
401 | if ( bhiePerson .getAddres s().get(0) .getStreet ().get(0) != null) { | |
402 | kinAddress .setStreet 1(bhiePers on.getAddr ess().get( 0).getStre et().get(0 )); | |
403 | } | |
404 | if ( bhiePerson .getAddres s().get(0) .getStreet ().size() > 1 && bhi ePerson.ge tAddress() .get(0).ge tStreet(). get(1) != null) { | |
405 | kinAddress .setStreet 2(bhiePers on.getAddr ess().get( 0).getStre et().get(1 )); | |
406 | } | |
407 | if ( bhiePerson .getAddres s().get(0) .getStreet ().size() > 2 && bhi ePerson.ge tAddress() .get(0).ge tStreet(). get(2) != null) { | |
408 | kinAddress .setStreet 3(bhiePers on.getAddr ess().get( 0).getStre et().get(2 )); | |
409 | } | |
410 | } | |
411 | nextOfKi n.getAddre ss().add(k inAddress) ; | |
412 | } | |
413 | if (bhiePers on.getPhon e() != nul l) { | |
414 | for (Tel ecomV4 tel com : bhie Person.get Phone()) { | |
415 | Tele com phone = new Tele com(); | |
416 | phon e.setUsage Type(telco m.getUseTy pe()); | |
417 | phon e.setValue (telcom.ge tValue()); | |
418 | next OfKin.getT elcoms().a dd(phone); | |
419 | } | |
420 | } | |
421 | pa t.getNextO fKin().add (nextOfKin ); | |
422 | } | |
423 | } | |
424 | ||
425 | ||
426 | if (bhiePa t.getEmerg encyContac ts() != nu ll && !bhi ePat.getEm ergencyCon tacts().is Empty()) { | |
427 | for (P ersonV4 bh iePerson : bhiePat.g etEmergenc yContacts( )) { | |
428 | Pe rson conta ct = new P erson(); | |
429 | co ntact.setN ame(getNam eFromPerso n(bhiePers on)); | |
430 | if (bhiePers on.getRela tionship() != null & & getPrima rySpdcV4(b hiePerson. getRelatio nship()) ! = null) { | |
431 | contact. setRelatio nship(getP rimarySpdc V4(bhiePer son.getRel ationship( )).getDisp lay()); | |
432 | } | |
433 | if (bhiePers on.getAddr ess() != n ull && bhi ePerson.ge tAddress() .size() > 0) { | |
434 | Address contactAdd ress = new Address() ; | |
435 | contactA ddress.set City(bhieP erson.getA ddress().g et(0).getC ity()); | |
436 | contactA ddress.set StateProvi nce(bhiePe rson.getAd dress().ge t(0).getSt ate()); | |
437 | contactA ddress.set PostalCode (bhiePerso n.getAddre ss().get(0 ).getPosta lCode()); | |
438 | contactA ddress.set Type(bhieP erson.getA ddress().g et(0).getT ype()); | |
439 | if (bhie Person.get Address(). get(0).get Street() ! = null && bhiePerson .getAddres s().get(0) .getStreet ().size() > 0) { | |
440 | if ( bhiePerson .getAddres s().get(0) .getStreet ().get(0) != null) { | |
441 | contactAdd ress.setSt reet1(bhie Person.get Address(). get(0).get Street().g et(0)); | |
442 | } | |
443 | if ( bhiePerson .getAddres s().get(0) .getStreet ().size() > 1 && bhi ePerson.ge tAddress() .get(0).ge tStreet(). get(1) != null) { | |
444 | contactAdd ress.setSt reet2(bhie Person.get Address(). get(0).get Street().g et(1)); | |
445 | } | |
446 | if ( bhiePerson .getAddres s().get(0) .getStreet ().size() > 2 && bhi ePerson.ge tAddress() .get(0).ge tStreet(). get(2) != null) { | |
447 | contactAdd ress.setSt reet3(bhie Person.get Address(). get(0).get Street().g et(2)); | |
448 | } | |
449 | } | |
450 | contact. getAddress ().add(con tactAddres s); | |
451 | } | |
452 | if (bhiePers on.getPhon e() != nul l) { | |
453 | for (Tel ecomV4 tel com : bhie Person.get Phone()) { | |
454 | //if (telcom ! = null && telcom.get UseType() != null && telcom.ge tValue() ! = null) { | |
455 | Telecom ph one = new Telecom(); | |
456 | phone.setU sageType(t elcom.getU seType()); | |
457 | phone.setV alue(telco m.getValue ()); | |
458 | contact.ge tTelcoms() .add(phone ); | |
459 | // } | |
460 | } | |
461 | } | |
462 | pa t.getEmerg encyContac t().add(co ntact); | |
463 | } | |
464 | } | |
465 | ||
466 | if (bhiePa t.getMarit alStatus() != null & & getPrima rySpdcV4(b hiePat.get MaritalSta tus()) != null) { | |
467 | pat.se tMaritalSt atus(getPr imarySpdcV 4(bhiePat. getMarital Status()). getDisplay ()); | |
468 | } | |
469 | ||
470 | if(bhiePat .getEthnic Group() != null){ | |
471 | if(bhi ePat.getEt hnicGroup( ).size() > 0) | |
472 | pat.ge tEthnicGro up().addAl l(Arrays.a sList(getC odesV4(bhi ePat.getEt hnicGroup( )))); | |
473 | } | |
474 | ||
475 | if (bhiePa t.getLangu ages() != null) { | |
476 | for (L anguagesV4 languages : bhiePat .getLangua ges()) { | |
477 | fo r (SpdcBea nV4 langua ge : langu ages.getLa nguageList ()) { | |
478 | if (lang uage != nu ll && lang uage.getDi splay() != null && ! language.g etDisplay( ).isEmpty( )) { | |
479 | Stri ng langDis play = lan guage.getD isplay(); | |
480 | pat. getLanguag es().add(L anguageCac he.getLabe l(langDisp lay)); | |
481 | } | |
482 | } | |
483 | ||
484 | } | |
485 | } | |
486 | ||
487 | if (bhiePa t.getRelig ion() != n ull) { | |
488 | for (S pdcBeanV4 religion : bhiePat.g etReligion ()) { | |
489 | if (religion != null & & religion .getDispla y() != nul l && !reli gion.getDi splay().is Empty()) { | |
490 | pat.getR eligion(). add(religi on.getDisp lay()); | |
491 | } | |
492 | } | |
493 | } | |
494 | ||
495 | if (patDem oResultCol lection.is Vler()) { | |
496 | if(bhi ePat.getRe pository() != null & & StringUt ils.isNotB lank(bhieP at.getRepo sitory().g etAbbrevia tion())){ | |
497 | fa cilityName = bhiePat .getReposi tory().get Abbreviati on(); | |
498 | } | |
499 | ||
500 | addBHI ESiteDataT oVistaBean (repositor yId, | |
501 | reposito ryName, fa cilityName , eventId, pat); | |
502 | pat.ge tSite().se tAgency(AG ENCY_DOD_V LER); | |
503 | ||
504 | } else { | |
505 | addBHI ESiteDataT oVistaBean (repositor yId, repos itoryName, | |
506 | facility Name, even tId, pat); | |
507 | } | |
508 | ||
509 | vistaBeans .add(pat); | |
510 | } | |
511 | } catch (Exception ex) { | |
512 | LOGG ER.error(" EXCEPTION: " + ex.ge tLocalized Message(), ex); | |
513 | thro w new JMea dowsExcept ion(ex); | |
514 | } | |
515 | } | |
516 | ||
517 | // //include site statu s report | |
518 | // String sit eStatusRep ort = gene rateBhieSt atusReport V4(patDemo ResultColl ection.get StatusList v4(), | |
519 | // pa tDemoResul tCollectio n.getError Listv4(), patDemoRes ultCollect ion.isVler ()); | |
520 | ||
521 | // vistaBeans .addAll(Ar rays.asLis t( | |
522 | // (P atientDemo graphics[] ) generate Connection Unavailabl eBean( | |
523 | // BHIE _STATUS_RE PORT_LOCAT ION, | |
524 | // site StatusRepo rt) | |
525 | // )); | |
526 | ||
527 | 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)); | |
528 | ||
529 | jl vResultCol lection.ge tDemograph ics().addA ll(vistaBe ans); | |
530 | jl vResultCol lection.ge tInterface StatusList ().addAll( interfaceS tatusList) ; | |
531 | jl vResultCol lection.ge tErrorList ().addAll( patDemoRes ultCollect ion.getErr orListv4() ); | |
532 | ||
533 | re turn jlvRe sultCollec tion; | |
534 | ||
535 | // return vis taBeans.to Array(new PatientDem ographics[ vistaBeans .size()]); | |
536 | } | |
537 | ||
538 | public JMedResul tCollectio n mapPatie ntDemograp hicsFromPD WS(Object resultColl ection) th rows JMead owsExcepti on { | |
539 | JM edResultCo llection j lvResultCo llection = new JMedR esultColle ction(); | |
540 | Re sponsePati entQuery r esponse = (ResponseP atientQuer y) resultC ollection; | |
541 | Li st<Patient Demographi cs> vistaB eans = new ArrayList <PatientDe mographics >(); | |
542 | Li st<Interfa ceStatus> interfaceS tatusList = new Arra yList<>(); | |
543 | ||
544 | if (response == null | | response .getDemogr aphics() = = null) { | |
545 | PatientL ocation bh ieLoc = ne w PatientL ocation(); | |
546 | bhieLoc. setSystemT ype(SYSTEM _TYPE_DOD_ ADAPTER); | |
547 | ||
548 | // vistaB eans.addAl l(Arrays.a sList( | |
549 | // (Patient Demographi cs[]) gene rateBHIEPa tRegErrorB ean(bhieLo c))); | |
550 | ||
551 | PartnerV 4 partner = new Part nerV4(); | |
552 | partner. setPartner Name("PDWS "); | |
553 | ||
554 | SiteStat usV4 siteS tatus = ne w SiteStat usV4(); | |
555 | siteStat us.setPart ner(partne r); | |
556 | siteStat us.setPart nerStatus( "Connectio n Unavaila ble"); | |
557 | List<Sit eStatusV4> statusLis t = new Ar rayList<>( ); | |
558 | statusLi st.add(sit eStatus); | |
559 | ||
560 | interfac eStatusLis t.addAll(g enerateInt erfaceStat usList(sta tusList, f alse, JMea dowsConsta nts.DOMAIN _DEMOGRAPH ICS)); | |
561 | } else { | |
562 | try { | |
563 | Pati entDemogra phics demo = respons e.getDemog raphics(); | |
564 | // if (demo.get SponsorSSN () == null || demo.g etSponsorS SN().lengt h() == 0) { | |
565 | // demo.set SponsorSSN (demo.getS SN()); | |
566 | // } | |
567 | // if (demo.get SponsorNam e() == nul l || demo. getSponsor Name().len gth() == 0 ) { | |
568 | // demo.set SponsorNam e(demo.get Name()); | |
569 | // } | |
570 | demo .setCodeGr een("0"); | |
571 | ||
572 | addB HIESiteDat aToVistaBe an("", "PD WS", "PDWS ", "", dem o); | |
573 | ||
574 | vist aBeans.add (demo); | |
575 | ||
576 | Part nerV4 part ner = new PartnerV4( ); | |
577 | Site StatusV4 s iteStatus = new Site StatusV4() ; | |
578 | part ner.setPar tnerName(" PDWS"); | |
579 | site Status.set Partner(pa rtner); | |
580 | site Status.set PartnerSta tus("SUCCE SS"); | |
581 | List <SiteStatu sV4> statu sList = ne w ArrayLis t<>(); | |
582 | stat usList.add (siteStatu s); | |
583 | inte rfaceStatu sList.addA ll(generat eInterface StatusList (statusLis t, false, JMeadowsCo nstants.DO MAIN_DEMOG RAPHICS)); | |
584 | ||
585 | } catch (Exception e) { | |
586 | LOGG ER.error(" EXCEPTION: " + e.get LocalizedM essage(), e); | |
587 | thro w new JMea dowsExcept ion(e); | |
588 | } | |
589 | } | |
590 | ||
591 | jl vResultCol lection.ge tDemograph ics().addA ll(vistaBe ans); | |
592 | jl vResultCol lection.ge tInterface StatusList ().addAll( interfaceS tatusList) ; | |
593 | ||
594 | re turn jlvRe sultCollec tion; | |
595 | // return vis taBeans.to Array(new PatientDem ographics[ vistaBeans .size()]); | |
596 | } | |
597 | ||
598 | public JMedResul tCollectio n mapDASVL ERDemograp hics(Objec t resultCo llection) throws JMe adowsExcep tion { | |
599 | JM edResultCo llection v lerResultC ollection = (JMedRes ultCollect ion) resul tCollectio n; | |
600 | Li st<Patient Demographi cs> vistaB eans; | |
601 | ||
602 | tr y { | |
603 | ||
604 | if (vler ResultColl ection.get Allergies( ) != null) { | |
605 | //Sm artAllergy smartAlle rgy = new SmartAller gy(); | |
606 | vist aBeans = v lerResultC ollection. getDemogra phics(); | |
607 | ||
608 | for( PatientDem ographics vistaBean : vistaBea ns){ | |
609 | if(StringU tils.isNot Empty(vist aBean.getS ite().getS iteCode()) ){ | |
610 | String vlerSiteN ame = getV LERSiteNam e(vistaBea n.getSite( ).getSiteC ode()); | |
611 | if(Str ingUtils.i sNotEmpty( vlerSiteNa me)) { | |
612 | vi staBean.ge tSite().se tName(vler SiteName); | |
613 | } | |
614 | } | |
615 | } | |
616 | } | |
617 | ||
618 | populate StatusVLER SiteNames( vlerResult Collection ); | |
619 | ||
620 | } catch (Exc eption ex) { | |
621 | ||
622 | LOGGER.e rror("EXCE PTION: " + ex.getLoc alizedMess age(), ex) ; | |
623 | throw ne w JMeadows Exception( ex); | |
624 | } | |
625 | ||
626 | // return vis taBeans.to Array(new PatientDem ographics[ vistaBeans .size()]); | |
627 | re turn vlerR esultColle ction; | |
628 | } | |
629 | ||
630 | public Object[] generateBH IEPatRegEr rorBean(Lo cation loc ation) { | |
631 | ||
632 | Pa tientDemog raphics pa t = new Pa tientDemog raphics(); | |
633 | Ad dress patA ddress = n ew Address (); | |
634 | pa t.setName( Messages.g et("demogr aphics.dod .results.e mpty").toU pperCase() ); | |
635 | pa tAddress.s etStreet1( Messages.g et("demogr aphics.dod .results.h elpdesk"). toUpperCas e()); | |
636 | pa tAddress.s etStreet2( ""); | |
637 | pa t.setAge(" "); | |
638 | pa tAddress.s etCity("") ; | |
639 | pa t.setClini c(""); | |
640 | pa t.setDob(" "); | |
641 | pa t.setGende r(""); | |
642 | pa t.setPrima ryProvider (""); | |
643 | pa t.setPhone 1(""); | |
644 | pa t.setPhone 2(""); | |
645 | pa t.setSSN(" "); | |
646 | pa tAddress.s etStatePro vince(""); | |
647 | pa tAddress.s etPostalCo de(""); | |
648 | pa t.setCodeG reen("0"); | |
649 | pa t.setSite( getConnect ionUnavail ableSite(l ocation)); | |
650 | pa t.getAddre ss().add(p atAddress) ; | |
651 | re turn new P atientDemo graphics[] {pat}; | |
652 | } | |
653 | ||
654 | @Overr ide | |
655 | public Object[] generateCo nnectionUn availableB ean(Locati on locatio n, String inerrorMsg ) { | |
656 | St ring error Msg = iner rorMsg; | |
657 | if (errorMsg == null) { | |
658 | errorMsg = ERROR_M SG_CONNECT ION_UNAVAI LABLE; | |
659 | } | |
660 | ||
661 | Si te site = getConnect ionUnavail ableSite(l ocation); | |
662 | ||
663 | In terfaceSta tus status = new Int erfaceStat us(); | |
664 | st atus.setEr rorMessage (errorMsg) ; | |
665 | st atus.setNa me(site.ge tName()); | |
666 | st atus.setSo urce(site. getAgency( )); | |
667 | st atus.setSt atus(error Msg); | |
668 | st atus.setDo main(JMead owsConstan ts.DOMAIN_ DEMOGRAPHI CS); | |
669 | re turn new I nterfaceSt atus[]{sta tus}; | |
670 | } | |
671 | ||
672 | public static St ring getNa meFromPers on(PersonV 4 person) { | |
673 | St ring rtc; | |
674 | if (person.g etName() = = null) { | |
675 | rtc = "" ; | |
676 | } else { | |
677 | rtc = ge tNameStrin g(person.g etName()); | |
678 | } | |
679 | re turn rtc; | |
680 | } | |
681 | ||
682 | public static St ring getNa meString(N ameV4 name v4) { | |
683 | St ring rtc; | |
684 | ||
685 | if (name v4.getRaw( ) == null) { | |
686 | Stri ngBuilder nameSb = n ew StringB uilder(); | |
687 | if ( namev4.get Last() != null) { | |
688 | nameSb.app end(namev4 .getLast() ); | |
689 | } | |
690 | name Sb.append( ','); | |
691 | if ( namev4.get Prefix() ! = null) { | |
692 | nameSb.app end(' '); | |
693 | nameSb.app end(namev4 .getPrefix ()); | |
694 | } | |
695 | if ( namev4.get First() != null) { | |
696 | nameSb.app end(' '); | |
697 | nameSb.app end(namev4 .getFirst( )); | |
698 | } | |
699 | if ( namev4.get Middle() ! = null) { | |
700 | nameSb.app end(' '); | |
701 | nameSb.app end(namev4 .getMiddle ()); | |
702 | } | |
703 | if ( namev4.get Suffix() ! = null) { | |
704 | nameSb.app end(' '); | |
705 | nameSb.app end(namev4 .getSuffix ()); | |
706 | } | |
707 | rtc = nameSb.t oString(); | |
708 | } else { | |
709 | rtc = namev4.g etRaw(); | |
710 | } | |
711 | re turn rtc; | |
712 | } | |
713 | ||
714 | public int compa reTo(Objec t obj) { | |
715 | Sm artDemogra phics tmp = (SmartDe mographics ) obj; | |
716 | in t retVal = 0; | |
717 | if (this.m_s ortBy == S ITE && thi s.m_demogr aphic.getS ite() != n ull && tmp .m_demogra phic.getSi te() != nu ll) { | |
718 | retVal = compareSt ring(this. m_demograp hic.getSit e().getSit eCode(), t mp.m_demog raphic.get Site().get SiteCode() ); | |
719 | } | |
720 | ||
721 | if (!this.m_ bAscending ) { | |
722 | retVal = -retVal; | |
723 | } | |
724 | ||
725 | re turn retVa l; | |
726 | } | |
727 | ||
728 | //TODO : Why is s ort by alw ays SITE? | |
729 | privat e void get SortValue( String ins ort) { | |
730 | St ring sort = insort; | |
731 | m_ sortBy = S ITE; | |
732 | m_ bAscending = false; | |
733 | if (sort != null) { | |
734 | sort = s etAscendin g(sort); | |
735 | if ("sit eCode".equ alsIgnoreC ase(sort)) { | |
736 | m_so rtBy = SIT E; | |
737 | } | |
738 | } | |
739 | } | |
740 | ||
741 | @Overr ide | |
742 | public JMedResul tCollectio n generate Connection Unavailabl eStatus(Lo cation loc ation, Str ing errorM sg, String domain) { | |
743 | re turn super .generateC onnectionU navailable Status(loc ation, err orMsg, dom ain); | |
744 | } | |
745 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.