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\dataservicehandler | MVIServiceHandler.java | Wed Mar 20 21:43:46 2019 UTC |
2 | JLV_JLV 2_7_2_0_0.zip\JLV_Src\jMeadows\src\main\java\gov\va\med\jmeadows\dataservicehandler | MVIServiceHandler.java | Tue Apr 2 13:27:32 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 2636 |
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 3 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 | * Ho norable Se nator Dani el K. Inou ye | |
7 | * VA Pacific I slands Hea lth Care S ystem | |
8 | * Tr ipler Army Medical C enter | |
9 | */ | |
10 | ||
11 | package go v.va.med.j meadows.da taserviceh andler; | |
12 | ||
13 | import gov .va.med.jm eadows.com mon.JMeado wsExceptio n; | |
14 | import gov .va.med.jm eadows.dao .beans.*; | |
15 | import gov .va.med.jm eadows.dao .hdd.VLERS iteCache; | |
16 | import gov .va.med.jm eadows.dao .patient.A uditDao; | |
17 | import gov .va.med.jm eadows.sit e.Sites; | |
18 | import gov .va.med.mv i.*; | |
19 | import gov .va.med.mv i.ObjectFa ctory; | |
20 | import gov .va.med.vd s.webservi ce.*; | |
21 | import gov .va.med.vh ahon.commo n.Utils; | |
22 | import org .apache.co mmons.coll ections4.C ollectionU tils; | |
23 | import org .apache.co mmons.lang 3.StringUt ils; | |
24 | import org .slf4j.Log ger; | |
25 | import org .slf4j.Log gerFactory ; | |
26 | ||
27 | import jav ax.xml.bin d.JAXBCont ext; | |
28 | import jav ax.xml.bin d.JAXBElem ent; | |
29 | import jav ax.xml.bin d.JAXBExce ption; | |
30 | import jav ax.xml.bin d.Marshall er; | |
31 | import jav ax.xml.nam espace.QNa me; | |
32 | import jav ax.xml.ws. BindingPro vider; | |
33 | import jav ax.xml.ws. WebService Exception; | |
34 | import jav ax.xml.ws. handler.Ha ndler; | |
35 | import jav a.io.Seria lizable; | |
36 | import jav a.io.Strin gWriter; | |
37 | import jav a.math.Big Integer; | |
38 | import jav a.text.Sim pleDateFor mat; | |
39 | import jav a.util.*; | |
40 | ||
41 | public cla ss MVIServ iceHandler extends D ataService Handler { | |
42 | privat e static f inal Logge r LOGGER = LoggerFac tory.getLo gger(MVISe rviceHandl er.class); | |
43 | privat e static f inal Strin g OID_EDIP I = "2.16. 840.1.1138 83.3.42.10 001.100001 .12"; | |
44 | ||
45 | privat e static i nt lastGoo dURLindex = 0; | |
46 | privat e VAIdM mv iService; | |
47 | privat e JAXBCont ext jaxbCo ntext = nu ll; | |
48 | ||
49 | privat e static f inal Strin g MVI_UNAV AILABLE_MS G = "VA Pa tient Iden tity Servi ce is unav ailable. V A data may not displ ay."; | |
50 | ||
51 | ||
52 | protec ted static final Sit es SITES = Sites.get Instance() ; | |
53 | ||
54 | public MVIServic eHandler(S tring url) { | |
55 | su per(); | |
56 | ||
57 | se rviceURL = url; | |
58 | se rviceName = "MVI_Ser vice"; | |
59 | serviceNam espace = " http:// DNS . URL "; | |
60 | qS erviceName = new QNa me(service Namespace, serviceNa me); | |
61 | ||
62 | mv iService = new VAIdM (); | |
63 | } | |
64 | ||
65 | privat e VAIdMPor t getMVIPo rt() { | |
66 | VA IdMPort po rt = mviSe rvice.getV AIdMPort() ; | |
67 | ||
68 | // serviceUR L can be a set of UR Ls to try like: URL; URL;URL | |
69 | St ring curre ntURL = se rviceURL; | |
70 | if (serviceU RL != null && servic eURL.index Of(';') > -1) { | |
71 | String[] urls = se rviceURL.s plit(";"); | |
72 | if (last GoodURLind ex < urls. length) { | |
73 | curr entURL = u rls[lastGo odURLindex ]; | |
74 | } else { | |
75 | curr entURL = u rls[0]; | |
76 | last GoodURLind ex = 0; | |
77 | } | |
78 | } | |
79 | Bi ndingProvi der prov = (BindingP rovider) p ort; | |
80 | pr ov.getRequ estContext ().put(Bin dingProvid er.ENDPOIN T_ADDRESS_ PROPERTY, currentURL ); | |
81 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.connect. timeout", serviceCon nectionTim eoutMS); | |
82 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.request. timeout", serviceReq uestTimeou tMS); | |
83 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.connect .timeout", serviceCo nnectionTi meoutMS); | |
84 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.request .timeout", serviceRe questTimeo utMS); | |
85 | ||
86 | // SOAP mess age loggin g - Enable to show l ogging in output win dow | |
87 | if ("test".e qualsIgnor eCase(APP_ CONFIG.get AppEnviron ment()) || "developm ent".equal sIgnoreCas e(APP_CONF IG.getAppE nvironment ())) { | |
88 | prov.get Binding(). getHandler Chain().ad d(new SOAP LoggingHan dler()); | |
89 | List<Han dler> hand lerList = prov.getBi nding().ge tHandlerCh ain(); | |
90 | handlerL ist.add(ne w SOAPLogg ingHandler ()); | |
91 | prov.get Binding(). setHandler Chain(hand lerList); | |
92 | } | |
93 | ||
94 | re turn port; | |
95 | } | |
96 | ||
97 | public ResponseP atientSele ct getPati entIds(JMe adowsQuery queryBean , Map<Stri ng, Site> siteMap) t hrows JMea dowsExcept ion { | |
98 | St ring error Message = ""; | |
99 | bo olean done = false; | |
100 | ||
101 | Re sponsePati entSelect responsePa tientSelec t = new Re sponsePati entSelect( ); | |
102 | Li st<Externa lID> exter nalIDs = n ew ArrayLi st<Externa lID>(); | |
103 | ||
104 | if (jaxbCont ext == nul l) { | |
105 | try { | |
106 | jaxb Context = JAXBContex t.newInsta nce(PRPAIN 201309UV02 .class); | |
107 | } catch (JAXBExcep tion e) { | |
108 | jaxb Context = null; | |
109 | incL astGoodURL index(); | |
110 | ||
111 | erro rMessage = MVI_UNAVA ILABLE_MSG ; | |
112 | ||
113 | resp onsePatien tSelect.se tSuccess(f alse); | |
114 | resp onsePatien tSelect.se tErrorMsg( errorMessa ge); | |
115 | ||
116 | logA ndAuditExc eption(e, errorMessa ge, queryB ean, false ); | |
117 | ||
118 | done = true; | |
119 | } | |
120 | } | |
121 | if (!done) { | |
122 | try { | |
123 | // G enerate PR PAIN201309 UV02 reque st message | |
124 | PRPA IN201309UV 02 request = generat eRequest(q ueryBean); | |
125 | ||
126 | PRPA IN201310UV 02 respons e = getMVI Port().prp aIN201309U V02(reques t); | |
127 | ||
128 | // P arse respo nse into p atient IDs map | |
129 | List <String> p atientIds = parseRes ponseToPat ientIds(re sponse); | |
130 | ||
131 | Pati ent patien t = new Pa tient(); | |
132 | ||
133 | Iter ator<Strin g> iterato r = patien tIds.itera tor(); | |
134 | whil e (iterato r.hasNext( )) { | |
135 | // Corresp onding IDs format: I D^TYPE^SOU RCE^ISSUER ^STATUS | |
136 | StringToke nizer toke nizer = ne w StringTo kenizer(it erator.nex t(), "^"); | |
137 | if (tokeni zer.countT okens() == 5) // Acc ording to format, th ere should only be 5 tokens | |
138 | { | |
139 | String id = toke nizer.next Token(); | |
140 | String type = to kenizer.ne xtToken(); | |
141 | String source = tokenizer. nextToken( ); | |
142 | String issuer = tokenizer. nextToken( ); | |
143 | String status = tokenizer. nextToken( ); | |
144 | ||
145 | // Mak es sure ea ch relevan t token is not null or blank a nd status is "A" for active | |
146 | if (St ringUtils. isNotBlank (id) && St ringUtils. isNotBlank (type) | |
147 | && Strin gUtils.isN otBlank(so urce) && S tringUtils .isNotBlan k(issuer) | |
148 | && Strin gUtils.isN otBlank(st atus)) { | |
149 | if ("NI".equ alsIgnoreC ase(type)) { | |
150 | // Natio nal patien t identifi er | |
151 | if ("200 DOD".equal sIgnoreCas e(source) && "USDOD" .equalsIgn oreCase(is suer) && " A".equalsI gnoreCase( status)) { | |
152 | // D oD EDIPI | |
153 | if ( "EDIPI".eq ualsIgnore Case(query Bean.getSt atus())) { | |
154 | id = query Bean.getIt emId(); | |
155 | } | |
156 | pati ent.setEDI PI(id); | |
157 | } else i f ("200M". equalsIgno reCase(sou rce) && "U SVHA".equa lsIgnoreCa se(issuer) && "P".eq ualsIgnore Case(statu s)) { | |
158 | // V A ICN | |
159 | pati ent.setICN (id); | |
160 | } else { | |
161 | exte rnalIDs.ad d(new Exte rnalID(id, type, sou rce, issue r)); | |
162 | } | |
163 | } else if (" PI".equals IgnoreCase (type)) { | |
164 | // Local facility patient id entifier | |
165 | if ("USV HA".equals IgnoreCase (issuer) & & "A".equa lsIgnoreCa se(status) ) { | |
166 | // V A DFN (IEN ) | |
167 | if ( siteMap != null) { | |
168 | Site site = siteMap. get(source ); | |
169 | if (site = = null) { | |
170 | LOGGER .debug("Si te with si te code " + source + " not fou nd in site s map"); | |
171 | } else { | |
172 | patien t.getVista Sites().ad d(site); | |
173 | ||
174 | // Add patient's VA IEN an d correspo nding site code to k ey-value p air list | |
175 | KeyVal uePair kvp = new Key ValuePair( ); | |
176 | kvp.se tKey(sourc e); | |
177 | kvp.se tValue(id) ; | |
178 | patien t.getPatie ntIens().a dd(kvp); | |
179 | } | |
180 | } | |
181 | } else { | |
182 | exte rnalIDs.ad d(new Exte rnalID(id, type, sou rce, issue r)); | |
183 | } | |
184 | } | |
185 | } | |
186 | } else { | |
187 | LOGGER .debug("In valid corr esponding ID string format"); | |
188 | } | |
189 | } | |
190 | ||
191 | // V A user res trict flag is set. C heck to se e if VA us er is sele cting a Do D-only pat ient | |
192 | if ( "TRUE".equ alsIgnoreC ase(APP_CO NFIG.getVa UserRestri ct()) | |
193 | && APP _CONFIG.ge tAgencyVA( ).equalsIg noreCase(q ueryBean.g etUser().g etHostSite ().getAgen cy()) && p atient.get ICN() == n ull | |
194 | && pat ient.getPa tientIens( ).isEmpty( )) { | |
195 | responsePa tientSelec t.setVARes tricted(tr ue); | |
196 | ||
197 | if ("TRUE" .equalsIgn oreCase(AP P_CONFIG.g etVaUserAl lowRestric tAccess()) ) { | |
198 | respon sePatientS elect.setA llowVAAcce ss(true); | |
199 | } | |
200 | } | |
201 | ||
202 | exte rnalIDs = getVLERSit eNames(ext ernalIDs); | |
203 | ||
204 | resp onsePatien tSelect.se tSuccess(t rue); | |
205 | resp onsePatien tSelect.se tPatient(p atient); | |
206 | resp onsePatien tSelect.se tExternalI Ds(externa lIDs); | |
207 | // } catc h (JAXBExc eption e) { | |
208 | // in cLastGoodU RLindex(); | |
209 | // er rorMessage = "VA Pat ient Ident ity Servic e is unava ilable. VA data may not displa y."; | |
210 | // | |
211 | // re sponsePati entSelect. setSuccess (false); | |
212 | // re sponsePati entSelect. setErrorMs g(errorMes sage); | |
213 | // | |
214 | // lo gAndAuditE xception(e , errorMes sage, quer yBean, fal se); | |
215 | } catch (JMeadowsE xception e ) { | |
216 | // I f VA user, they do n ot need to see the e rror messa ge. GUI ch ecks for e mpty strin g and skip s message. | |
217 | if ( APP_CONFIG .getAgency VA().equal sIgnoreCas e(queryBea n.getUser( ).getAgenc y())) { | |
218 | errorMessa ge = ""; | |
219 | } el se { | |
220 | errorMessa ge = "This patient i s currentl y not know n to the V A Master V eterans In dex, and t herefore n o VA" | |
221 | + " data wil l be displ ayed.<br/> <br/>If th is patient is a vete ran, pleas e notify t he help de sk of" | |
222 | + " this iss ue."; | |
223 | } | |
224 | ||
225 | resp onsePatien tSelect.se tSuccess(f alse); | |
226 | resp onsePatien tSelect.se tErrorMsg( errorMessa ge); | |
227 | ||
228 | logA ndAuditExc eption(e, errorMessa ge, queryB ean, false ); | |
229 | } catch (javax.xml .ws.WebSer viceExcept ion e) { | |
230 | incL astGoodURL index(); | |
231 | erro rMessage = MVI_UNAVA ILABLE_MSG ; | |
232 | ||
233 | resp onsePatien tSelect.se tSuccess(f alse); | |
234 | resp onsePatien tSelect.se tErrorMsg( errorMessa ge); | |
235 | ||
236 | logA ndAuditExc eption(e, errorMessa ge, queryB ean, true) ; | |
237 | // C ommenting out below line will not pass f ortify(?) scan, but leaving it in breaks functiona lity | |
238 | // t o continue showing D oD patient data when there is an issue w ith the MV I service. Revisit. -Jimi | |
239 | // throw new JMeadowsEx ception("M VI Applica tion Error : " + erro rMessage); | |
240 | } | |
241 | catch (E xception e ) { | |
242 | incL astGoodURL index(); | |
243 | erro rMessage = MVI_UNAVA ILABLE_MSG ; | |
244 | ||
245 | resp onsePatien tSelect.se tSuccess(f alse); | |
246 | resp onsePatien tSelect.se tErrorMsg( errorMessa ge); | |
247 | ||
248 | logA ndAuditExc eption(e, errorMessa ge, queryB ean, true) ; | |
249 | // C ommenting out below line will not pass f ortify(?) scan, but leaving it in breaks functiona lity | |
250 | // t o continue showing D oD patient data when there is an issue w ith the MV I service. Revisit. -Jimi | |
251 | // throw new JMeadowsEx ception("M VI Applica tion Error : " + erro rMessage); | |
252 | } | |
253 | ||
254 | // MVI w as unsucce ssful, at least keep original identifier | |
255 | if (!res ponsePatie ntSelect.i sSuccess() ) { | |
256 | ||
257 | Pati ent patien t = new Pa tient(); | |
258 | ||
259 | Stri ng type = queryBean. getStatus( ); | |
260 | Stri ng id = qu eryBean.ge tItemId(); | |
261 | Stri ng source = queryBea n.getRecor dSiteCode( ); | |
262 | ||
263 | if ( "EDIPI".eq ualsIgnore Case(type) ) { | |
264 | patient.se tEDIPI(id) ; | |
265 | } el se if ("IC N".equalsI gnoreCase( type)) { | |
266 | patient.se tICN(id); | |
267 | } el se if ("VA IEN".equal sIgnoreCas e(type) && siteMap ! = null) { | |
268 | Site site = siteMap. get(source ); | |
269 | if (site ! = null) { | |
270 | patien t.getVista Sites().ad d(site); | |
271 | ||
272 | // Add patient's VA IEN an d correspo nding site code to k ey-value p air list | |
273 | KeyVal uePair kvp = new Key ValuePair( ); | |
274 | kvp.se tKey(sourc e); | |
275 | kvp.se tValue(id) ; | |
276 | patien t.getPatie ntIens().a dd(kvp); | |
277 | } | |
278 | } | |
279 | ||
280 | // V A user res trict flag is set. C heck to se e if VA us er is sele cting DoD- only patie nt | |
281 | if ( "TRUE".equ alsIgnoreC ase(APP_CO NFIG.getVa UserRestri ct()) | |
282 | && APP _CONFIG.ge tAgencyVA( ).equalsIg noreCase(q ueryBean.g etUser().g etHostSite ().getAgen cy()) | |
283 | && pat ient.getIC N() == nul l && patie nt.getPati entIens(). isEmpty()) { | |
284 | responsePa tientSelec t.setVARes tricted(tr ue); | |
285 | responsePa tientSelec t.setAllow VAAccess(t rue); | |
286 | } | |
287 | ||
288 | resp onsePatien tSelect.se tErrorMsg( errorMessa ge); | |
289 | resp onsePatien tSelect.se tPatient(p atient); | |
290 | } | |
291 | } | |
292 | re turn respo nsePatient Select; | |
293 | } | |
294 | ||
295 | public ResponseP atientQuer y lookupPa tient(PDWS QueryBean queryBean, Map<Strin g, Site> s iteMap) { | |
296 | Re sponsePati entQuery r pq = new R esponsePat ientQuery( ); | |
297 | ||
298 | tr y { | |
299 | PRPAIN20 1305UV02 s earchReque st = gener ateSearchR equest(que ryBean); | |
300 | ||
301 | String a ppEnv = AP P_CONFIG.g etAppEnvir onment(); | |
302 | //print request xm l | |
303 | if ("tes t".equalsI gnoreCase( appEnv) || "developm ent".equal sIgnoreCas e(appEnv)) { | |
304 | jaxb Context = JAXBContex t.newInsta nce(PRPAIN 201305UV02 .class.get Package(). getName()) ; | |
305 | Mars haller jax bMarshalle r = jaxbCo ntext.crea teMarshall er(); | |
306 | jaxb Marshaller .setProper ty(Marshal ler.JAXB_F ORMATTED_O UTPUT, Boo lean.TRUE) ; | |
307 | Stri ngWriter s tringWrite r = new St ringWriter (); | |
308 | jaxb Marshaller .marshal(n ew JAXBEle ment<PRPAI N201305UV0 2>(new QNa me("uri", "PRPAIN201 305UV02"), PRPAIN201 305UV02.cl ass, searc hRequest), stringWri ter); | |
309 | LOGG ER.debug(s tringWrite r.toString ()); | |
310 | } | |
311 | //end pr intout; | |
312 | ||
313 | PRPAIN20 1306UV02 r esponse = getMVIPort ().prpaIN2 01305UV02( searchRequ est); | |
314 | ||
315 | //print response x ml | |
316 | if ("tes t".equalsI gnoreCase( appEnv) || "developm ent".equal sIgnoreCas e(appEnv)) { | |
317 | jaxb Context = JAXBContex t.newInsta nce(PRPAIN 201306UV02 .class.get Package(). getName()) ; | |
318 | Mars haller jax bMarshalle r2 = jaxbC ontext.cre ateMarshal ler(); | |
319 | jaxb Marshaller 2 = jaxbCo ntext.crea teMarshall er(); | |
320 | jaxb Marshaller 2.setPrope rty(Marsha ller.JAXB_ FORMATTED_ OUTPUT, Bo olean.TRUE ); | |
321 | jaxb Marshaller 2.marshal( new JAXBEl ement<PRPA IN201306UV 02>(new QN ame("uri", "PRPAIN20 1306UV02") , PRPAIN20 1306UV02.c lass, resp onse), Sys tem.out); | |
322 | } | |
323 | //end pr intout; | |
324 | ||
325 | ||
326 | List<Pat ient> pati ents = par seResponse ToPatientL ookup(resp onse, site Map, query Bean.getUs er().getRe strictedSi teCodesLis t()); | |
327 | if (pati ents.size( ) > 0) { | |
328 | Stri ng msg = p atients.ge t(0).getNa me(); | |
329 | if ( msg.contai ns("MVI Er ror:") || msg.contai ns("MVI Me ssage:")) { | |
330 | //remove p refix for dialog req uested in JLV-69 | |
331 | if (msg.st artsWith(" MVI Messag e: Patient not found with sear ch element s entered" )) | |
332 | msg = msg.substr ing("MVI M essage: ". length()); | |
333 | rpq.setErr orMsg(msg) ; | |
334 | rpq.setSuc cess(false ); | |
335 | return rpq ; | |
336 | } | |
337 | } | |
338 | rpq.setP atients(pa tients); | |
339 | rpq.setS uccess(tru e); | |
340 | ||
341 | } catch (Web ServiceExc eption e){ | |
342 | LOGGER.e rror("Erro r with MVI Lookup: " + e.getMe ssage()); | |
343 | rpq.setE rrorMsg("E rror with MVI Lookup : The MVI Search ca pability a ppears to be down at this time ."); | |
344 | } catch (JMe adowsExcep tion e) { | |
345 | LOGGER.e rror("Erro r with MVI Lookup: " + e.getMe ssage()); | |
346 | rpq.setE rrorMsg("T here was a n error wi th the MVI patient l ookup quer y in JMead ows."); | |
347 | } | |
348 | ca tch (JAXBE xception e ) { | |
349 | LOGGER.e rror("Erro r with MVI Lookup: " + e.getMe ssage()); | |
350 | rpq.setE rrorMsg("T here was a n error wi th the MVI patient l ookup quer y using Ma rshalling. "); | |
351 | } | |
352 | re turn rpq; | |
353 | } | |
354 | ||
355 | privat e static v oid incLas tGoodURLin dex() { | |
356 | ++ lastGoodUR Lindex; | |
357 | } | |
358 | ||
359 | ||
360 | privat e PRPAIN20 1309UV02 g enerateReq uest(JMead owsQuery q ueryBean) { | |
361 | Ob jectFactor y factory; | |
362 | PR PAIN201309 UV02 reque st; | |
363 | MC CIMT000100 UV01Receiv er receive r; | |
364 | MC CIMT000100 UV01Device device; | |
365 | MC CIMT000100 UV01Sender sender; | |
366 | PR PAIN201309 UV02QUQIMT 021001UV01 ControlAct Process co ntrolActPr ocess; | |
367 | PR PAMT201307 UV02QueryB yParameter queryByPa rameter; | |
368 | PR PAMT201307 UV02Parame terList pa rameterLis t; | |
369 | PR PAMT201307 UV02Patien tIdentifie r patientI dentifier; | |
370 | Si mpleDateFo rmat simpl eDateForma t; | |
371 | II ii; | |
372 | TS ts; | |
373 | CS cs; | |
374 | CD cd; | |
375 | Da te date; | |
376 | St ring statu s; | |
377 | St ring oid; | |
378 | St ring id; | |
379 | St ring type; | |
380 | St ring sourc e; | |
381 | St ring issue r; | |
382 | ||
383 | fa ctory = ne w ObjectFa ctory(); | |
384 | re quest = fa ctory.crea tePRPAIN20 1309UV02() ; | |
385 | da te = new D ate(); | |
386 | ||
387 | // id | |
388 | si mpleDateFo rmat = new SimpleDat eFormat("y yyyMMdd", Locale.get Default()) ; | |
389 | ii = factory .createII( ); | |
390 | ii .setRoot(" 2.16.840.1 .113883.3. 933"); | |
391 | ii .setExtens ion("MCID_ JANUS_DEV_ T1_" + sim pleDateFor mat.format (date)); | |
392 | re quest.setI d(ii); | |
393 | ||
394 | // creationTi me | |
395 | ts = factory .createTS( ); | |
396 | si mpleDateFo rmat = new SimpleDat eFormat("y yyyMMddhhm mss", Loca le.getDefa ult()); | |
397 | ts .setValue( simpleDate Format.for mat(date)) ; | |
398 | re quest.setC reationTim e(ts); | |
399 | ||
400 | // interactio nId | |
401 | ii = factory .createII( ); | |
402 | ii .setRoot(" 2.16.840.1 .113883.1. 6"); | |
403 | ii .setExtens ion("PRPA_ IN201309UV 02"); | |
404 | re quest.setI nteraction Id(ii); | |
405 | ||
406 | // processing Code | |
407 | cs = factory .createCS( ); | |
408 | if ("product ion".equal sIgnoreCas e(APP_CONF IG.getAppE nvironment ())) { | |
409 | cs.setCo de("P"); | |
410 | } else { | |
411 | cs.setCo de("T"); | |
412 | } | |
413 | re quest.setP rocessingC ode(cs); | |
414 | ||
415 | // processing ModeCode | |
416 | cs = factory .createCS( ); | |
417 | cs .setCode(" T"); | |
418 | re quest.setP rocessingM odeCode(cs ); | |
419 | ||
420 | // acceptAckC ode | |
421 | cs = factory .createCS( ); | |
422 | cs .setCode(" AL"); | |
423 | re quest.setA cceptAckCo de(cs); | |
424 | ||
425 | // receiver | |
426 | re ceiver = f actory.cre ateMCCIMT0 00100UV01R eceiver(); | |
427 | re quest.getR eceiver(). add(receiv er); | |
428 | ||
429 | // receiver/t ypeCode | |
430 | re ceiver.set TypeCode(C ommunicati onFunction Type.RCV); | |
431 | ||
432 | // receiver/d evice | |
433 | de vice = fac tory.creat eMCCIMT000 100UV01Dev ice(); | |
434 | re ceiver.set Device(dev ice); | |
435 | ||
436 | // receiver/d evice/clas sCode | |
437 | de vice.setCl assCode(En tityClassD evice.DEV) ; | |
438 | ||
439 | // receiver/d evice/dete rminerCode | |
440 | de vice.setDe terminerCo de("INSTAN CE"); | |
441 | ||
442 | // receiver/d evice/id | |
443 | ii = factory .createII( ); | |
444 | ii .setRoot(" 2.16.840.1 .113883.4. 349"); | |
445 | ii .setExtens ion("200M" ); | |
446 | de vice.getId ().add(ii) ; | |
447 | ||
448 | // sender | |
449 | se nder = fac tory.creat eMCCIMT000 100UV01Sen der(); | |
450 | re quest.setS ender(send er); | |
451 | ||
452 | // sender/typ eCode | |
453 | se nder.setTy peCode(Com munication FunctionTy pe.SND); | |
454 | ||
455 | // sender/dev ice | |
456 | de vice = fac tory.creat eMCCIMT000 100UV01Dev ice(); | |
457 | se nder.setDe vice(devic e); | |
458 | ||
459 | // sender/dev ice/classC ode | |
460 | de vice.setCl assCode(En tityClassD evice.DEV) ; | |
461 | ||
462 | // sender/dev ice/determ inerCode | |
463 | de vice.setDe terminerCo de("INSTAN CE"); | |
464 | ||
465 | // sender/dev ice/id | |
466 | ii = factory .createII( ); | |
467 | ii .setRoot(" 2.16.840.1 .113883.4. 349"); | |
468 | ii .setExtens ion(APP_CO NFIG.getMV ISndDevId( )); | |
469 | de vice.getId ().add(ii) ; | |
470 | ||
471 | // controlAct Process | |
472 | co ntrolActPr ocess = fa ctory.crea tePRPAIN20 1309UV02QU QIMT021001 UV01Contro lActProces s(); | |
473 | re quest.setC ontrolActP rocess(con trolActPro cess); | |
474 | ||
475 | // controlAct Process/cl assCode | |
476 | co ntrolActPr ocess.setC lassCode(A ctClassCon trolAct.CA CT); | |
477 | ||
478 | // controlAct Process/mo odCode | |
479 | co ntrolActPr ocess.setM oodCode(XA ctMoodInte ntEvent.EV N); | |
480 | ||
481 | // controlAct Process/co de | |
482 | cd = factory .createCD( ); | |
483 | cd .setCode(" PRPA_TE201 309UV02"); | |
484 | co ntrolActPr ocess.setC ode(cd); | |
485 | ||
486 | // controlAct Process/co deSystem | |
487 | cd .setCodeSy stem("2.16 .840.1.113 883.1.6"); | |
488 | ||
489 | // controlAct Process/qu eryByParam eter | |
490 | qu eryByParam eter = fac tory.creat ePRPAMT201 307UV02Que ryByParame ter(); | |
491 | co ntrolActPr ocess.setQ ueryByPara meter(fact ory.create PRPAIN2013 09UV02QUQI MT021001UV 01ControlA ctProcessQ ueryByPara meter(quer yByParamet er)); | |
492 | ||
493 | // controlAct Process/qu eryByParam eter/query Id | |
494 | ii = factory .createII( ); | |
495 | ii .setRoot(" 2.16.840.1 .113883.3. 933"); | |
496 | ii .setExtens ion("33452 "); | |
497 | qu eryByParam eter.setQu eryId(ii); | |
498 | ||
499 | // controlAct Process/qu eryByParam eter/statu sCode | |
500 | cs = factory .createCS( ); | |
501 | cs .setCode(" new"); | |
502 | qu eryByParam eter.setSt atusCode(c s); | |
503 | ||
504 | // controlAct Process/qu eryByParam eter/respo nsePriorit yCode | |
505 | cs = factory .createCS( ); | |
506 | cs .setCode(" I"); | |
507 | qu eryByParam eter.setRe sponsePrio rityCode(c s); | |
508 | ||
509 | // controlAct Process/qu eryByParam eter/param eterList | |
510 | pa rameterLis t = factor y.createPR PAMT201307 UV02Parame terList(); | |
511 | qu eryByParam eter.setPa rameterLis t(paramete rList); | |
512 | ||
513 | // controlAct Process/qu eryByParam eter/param eterList/p atientIden tifier | |
514 | pa tientIdent ifier = fa ctory.crea tePRPAMT20 1307UV02Pa tientIdent ifier(); | |
515 | pa rameterLis t.getPatie ntIdentifi er().add(p atientIden tifier); | |
516 | ||
517 | // controlAct Process/qu eryByParam eter/param eterList/p atientIden tifier/val ue | |
518 | ii = factory .createII( ); | |
519 | st atus = que ryBean.get Status(); | |
520 | if ("EDIPI". equalsIgno reCase(sta tus)) { | |
521 | // Get i dentifiers by DoD ED IPI | |
522 | oid = "2 .16.840.1. 113883.3.3 64"; | |
523 | id = que ryBean.get ItemId(); | |
524 | type = " NI"; | |
525 | source = "200DOD"; | |
526 | issuer = "USDOD"; | |
527 | ||
528 | ii.setRo ot(oid); | |
529 | ii.setEx tension(id + "^" + t ype + "^" + source + "^" + iss uer); | |
530 | ||
531 | LOGGER.d ebug("Gett ing corres ponding pa tient iden tifiers vi a EDIPI"); | |
532 | } else if (" ICN".equal sIgnoreCas e(status)) { | |
533 | // Get i dentifiers by VA ICN | |
534 | oid = "2 .16.840.1. 113883.4.3 49"; | |
535 | id = que ryBean.get ItemId(); | |
536 | type = " NI"; | |
537 | ||
538 | ii.setRo ot(oid); | |
539 | ii.setEx tension(id + "^" + t ype); | |
540 | ||
541 | LOGGER.d ebug("Gett ing corres ponding pa tient iden tifiers vi a ICN"); | |
542 | } else if (" VAIEN".equ alsIgnoreC ase(status )) { | |
543 | // Get i dentifiers by VA IEN | |
544 | oid = "2 .16.840.1. 113883.4.3 49"; | |
545 | id = que ryBean.get ItemId(); | |
546 | type = " PI"; | |
547 | source = queryBean .getRecord SiteCode() ; | |
548 | issuer = "USVHA"; | |
549 | ||
550 | ii.setRo ot(oid); | |
551 | ii.setEx tension(id + "^" + t ype + "^" + source + "^" + iss uer); | |
552 | ||
553 | LOGGER.d ebug("Gett ing corres ponding pa tient iden tifiers vi a VA IEN") ; | |
554 | } | |
555 | // else | |
556 | // { | |
557 | // logger .error("Co uld not qu ery with i dentifier number typ e: " + sta tus); | |
558 | // } | |
559 | pa tientIdent ifier.getV alue().add (ii); | |
560 | ||
561 | // controlAct Process/qu eryByParam eter/param eterList/p atientIden tifier/sem anticsText | |
562 | pa tientIdent ifier.setS emanticsTe xt("Patien t.id"); | |
563 | ||
564 | re turn reque st; | |
565 | } | |
566 | ||
567 | privat e PRPAIN20 1305UV02 g enerateSea rchRequest (PDWSQuery Bean query Bean) { | |
568 | Ob jectFactor y factory; | |
569 | PR PAIN201305 UV02 reque st; | |
570 | MC CIMT000100 UV01Receiv er receive r; | |
571 | MC CIMT000100 UV01Device device; | |
572 | MC CIMT000100 UV01Sender sender; | |
573 | PR PAIN201305 UV02QUQIMT 021001UV01 ControlAct Process co ntrolActPr ocess; | |
574 | PR PAMT201306 UV02QueryB yParameter queryByPa rameter; | |
575 | PR PAMT201306 UV02Parame terList pa rameterLis t; | |
576 | // PRPAMT2013 0UV02Patie ntIdentifi er patient Identifier ; | |
577 | Si mpleDateFo rmat simpl eDateForma t; | |
578 | II ii; | |
579 | TS ts; | |
580 | CS vc; | |
581 | TE L tel; | |
582 | CS cs; | |
583 | CD cd; | |
584 | Da te date; | |
585 | St ring query ID; | |
586 | St ring statu s; | |
587 | St ring oid; | |
588 | St ring id; | |
589 | St ring type; | |
590 | St ring sourc e; | |
591 | St ring issue r; | |
592 | ||
593 | fa ctory = ne w ObjectFa ctory(); | |
594 | re quest = fa ctory.crea tePRPAIN20 1305UV02() ; | |
595 | da te = new D ate(); | |
596 | ||
597 | // try { | |
598 | //id | |
599 | simpleDa teFormat = new Simpl eDateForma t("yyyyMMd dHHmmss", Locale.get Default()) ; | |
600 | ii = fac tory.creat eII(); | |
601 | ii.setRo ot("2.16.8 40.1.11388 3.3.933"); | |
602 | queryID = "MCID_JA NUS_DEV_T1 _" + simpl eDateForma t.format(d ate); | |
603 | ii.setEx tension(qu eryID); | |
604 | request. setId(ii); | |
605 | ||
606 | //creati onTime | |
607 | ts = fac tory.creat eTS(); | |
608 | simpleDa teFormat = new Simpl eDateForma t("yyyyMMd dhhmmss", Locale.get Default()) ; | |
609 | ts.setVa lue(simple DateFormat .format(da te)); | |
610 | request. setCreatio nTime(ts); | |
611 | ||
612 | //versio nCode | |
613 | vc = fac tory.creat eCS(); | |
614 | vc.setCo de("3.0"); | |
615 | request. setVersion Code(vc); | |
616 | ||
617 | //intera ctionId | |
618 | ii = fac tory.creat eII(); | |
619 | ii.setRo ot("2.16.8 40.1.11388 3.1.6"); | |
620 | ii.setEx tension("P RPA_IN2013 05UV02"); | |
621 | request. setInterac tionId(ii) ; | |
622 | ||
623 | //proces singCode | |
624 | cs = fac tory.creat eCS(); | |
625 | if ("pro duction".e qualsIgnor eCase(APP_ CONFIG.get AppEnviron ment())) { | |
626 | cs.s etCode("P" ); | |
627 | } else { | |
628 | cs.s etCode("T" ); | |
629 | } | |
630 | request. setProcess ingCode(cs ); | |
631 | ||
632 | //proces singModeCo de | |
633 | cs = fac tory.creat eCS(); | |
634 | cs.setCo de("T"); | |
635 | request. setProcess ingModeCod e(cs); | |
636 | ||
637 | //accept AckCode | |
638 | cs = fac tory.creat eCS(); | |
639 | cs.setCo de("AL"); | |
640 | request. setAcceptA ckCode(cs) ; | |
641 | ||
642 | //receiv er | |
643 | receiver = factory .createMCC IMT000100U V01Receive r(); | |
644 | request. getReceive r().add(re ceiver); | |
645 | ||
646 | //receiv er/typeCod e | |
647 | receiver .setTypeCo de(Communi cationFunc tionType.R CV); | |
648 | ||
649 | //receiv er/device | |
650 | device = factory.c reateMCCIM T000100UV0 1Device(); | |
651 | receiver .setDevice (device); | |
652 | ||
653 | //receiv er/device/ classCode | |
654 | device.s etClassCod e(EntityCl assDevice. DEV); | |
655 | ||
656 | //receiv er/device/ determiner Code | |
657 | device.s etDetermin erCode("IN STANCE"); | |
658 | ||
659 | //receiv er/device/ id | |
660 | ii = fac tory.creat eII(); | |
661 | ii.setRo ot("1.2.84 0.114350.1 .13.999.23 4"); | |
662 | device.g etId().add (ii); | |
663 | ||
664 | //receiv er/device/ telcom | |
665 | tel = fa ctory.crea teTEL(); | |
666 | tel.setV alue("http ://service location/P DQuery"); | |
667 | device.g etTelecom( ).add(tel) ; | |
668 | ||
669 | //sender | |
670 | sender = factory.c reateMCCIM T000100UV0 1Sender(); | |
671 | request. setSender( sender); | |
672 | ||
673 | //sender /typeCode | |
674 | sender.s etTypeCode (Communica tionFuncti onType.SND ); | |
675 | ||
676 | //sender /device | |
677 | device = factory.c reateMCCIM T000100UV0 1Device(); | |
678 | sender.s etDevice(d evice); | |
679 | ||
680 | //sender /device/cl assCode | |
681 | device.s etClassCod e(EntityCl assDevice. DEV); | |
682 | ||
683 | //sender /device/de terminerCo de | |
684 | device.s etDetermin erCode("IN STANCE"); | |
685 | ||
686 | //sender /device/id | |
687 | ii = fac tory.creat eII(); | |
688 | ii.setRo ot("2.16.8 40.1.11388 3.4.349"); | |
689 | ii.setEx tension(AP P_CONFIG.g etMVISndDe vId()); | |
690 | device.g etId().add (ii); | |
691 | ||
692 | //contro lActProces s | |
693 | controlA ctProcess = factory. createPRPA IN201305UV 02QUQIMT02 1001UV01Co ntrolActPr ocess(); | |
694 | request. setControl ActProcess (controlAc tProcess); | |
695 | ||
696 | //contro lActProces s/classCod e | |
697 | controlA ctProcess. setClassCo de(ActClas sControlAc t.CACT); | |
698 | ||
699 | //contro lActProces s/moodCode | |
700 | controlA ctProcess. setMoodCod e(XActMood IntentEven t.EVN); | |
701 | ||
702 | //contro lActProces s/dataEnte rer | |
703 | QUQIMT02 1001UV01Da taEnterer de = facto ry.createQ UQIMT02100 1UV01DataE nterer(); | |
704 | controlA ctProcess. getDataEnt erer().add (de); | |
705 | de.setCo ntextContr olCode("AP "); | |
706 | de.getTy peCode().a dd("ENT"); | |
707 | ||
708 | COCTMT09 0100UV01As signedPers on aPerson = factory .createCOC TMT090100U V01Assigne dPerson(); | |
709 | de.setAs signedPers on(aPerson ); | |
710 | ||
711 | //contro lActProces s/dataEnte rer/assign edPerson | |
712 | aPerson. setClassCo de("ASSIGN ED"); | |
713 | ||
714 | ||
715 | //contro lActProces s/dataEnte rer/assign edPerson/i d | |
716 | String p ersonID = ""; | |
717 | String u serNameLas t = ""; | |
718 | String u serNameFir st = ""; | |
719 | String i dRoot = "2 .16.840.1. 113883.4.3 49"; | |
720 | ||
721 | if (quer yBean.getU ser() != n ull) { | |
722 | User user = qu eryBean.ge tUser(); | |
723 | if ( user.getCa rdId() != null && "D OD".equals IgnoreCase (user.getA gency())) { | |
724 | personID = user.getC ardId() + "^NI^200DO D^USDOD"; | |
725 | idRoot = " 2.16.840.1 .113883.3. 42.10001.1 00001.12"; | |
726 | } el se if("VA" .equalsIgn oreCase(us er.getAgen cy())){ | |
727 | personID = user.getU serId() + "^PN^" + u ser.getHos tSite().ge tSiteCode( ) + "^USVH A"; | |
728 | } | |
729 | ||
730 | Stri ng userNam eFull = us er.getName (); | |
731 | if ( !StringUti ls.isEmpty (userNameF ull)) { | |
732 | userNameLa st = Utils .getFirstN ame(userNa meFull).to UpperCase( Locale.get Default()) ; | |
733 | userNameFi rst = Util s.getLastN ame(userNa meFull).to UpperCase( Locale.get Default()) ; | |
734 | } | |
735 | } | |
736 | ||
737 | II aPers onId = fac tory.creat eII(); | |
738 | aPersonI d.setExten sion(perso nID); | |
739 | aPersonI d.setRoot( idRoot); | |
740 | aPerson. getId().ad d(aPersonI d); | |
741 | ||
742 | //contro lActProces s/dataEnte rer/assign edPerson/ | |
743 | COCTMT09 0100UV01Pe rson aPers onPerson = factory.c reateCOCTM T090100UV0 1Person(); | |
744 | aPersonP erson.getC lassCode() .add("PSN" ); | |
745 | aPersonP erson.setD eterminerC ode("INSTA NCE"); | |
746 | ||
747 | //contro lActProces s/dataEnte rer/assign edPerson/n ame | |
748 | EN aPers onPersonNa me = facto ry.createE N(); | |
749 | aPersonP ersonName. getContent ().add(fac tory.creat eENFamily( userNameLa st)); | |
750 | aPersonP ersonName. getContent ().add(fac tory.creat eENGiven(u serNameFir st)); | |
751 | aPersonP erson.getN ame().add( aPersonPer sonName); | |
752 | aPerson. setAssigne dPerson(fa ctory.crea teCOCTMT09 0100UV01As signedPers onAssigned Person(aPe rsonPerson )); | |
753 | ||
754 | //contro lActProces s/code | |
755 | cd = fac tory.creat eCD(); | |
756 | cd.setCo de("PRPA_T E201305UV0 2"); | |
757 | controlA ctProcess. setCode(cd ); | |
758 | ||
759 | //contro lActProces s/codeSyst em | |
760 | cd.setCo deSystem(" 2.16.840.1 .113883.1. 6"); | |
761 | ||
762 | //contro lActProces s/queryByP arameter | |
763 | queryByP arameter = factory.c reatePRPAM T201306UV0 2QueryByPa rameter(); | |
764 | controlA ctProcess. setQueryBy Parameter( factory.cr eatePRPAIN 201305UV02 QUQIMT0210 01UV01Cont rolActProc essQueryBy Parameter( queryByPar ameter)); | |
765 | ||
766 | //contro lActProces s/queryByP arameter/q ueryId | |
767 | ii = fac tory.creat eII(); | |
768 | ii.setRo ot("1.2.84 0.114350.1 .13.28.1.1 8.5.999"); | |
769 | ii.setEx tension(qu eryID); | |
770 | queryByP arameter.s etQueryId( ii); | |
771 | ||
772 | //contro lActProces s/queryByP arameter/s tatusCode | |
773 | cs = fac tory.creat eCS(); | |
774 | cs.setCo de("new"); | |
775 | queryByP arameter.s etStatusCo de(cs); | |
776 | ||
777 | //contro lActProces s/queryByP arameter/m odifyCode | |
778 | CS csMod Code = fac tory.creat eCS(); | |
779 | csModCod e.setCode( "MVI.COMP1 "); | |
780 | queryByP arameter.s etModifyCo de(csModCo de); | |
781 | ||
782 | //contro lActProces s/queryByP arameter/p arameterLi st | |
783 | paramete rList = fa ctory.crea tePRPAMT20 1306UV02Pa rameterLis t(); | |
784 | queryByP arameter.s etParamete rList(para meterList) ; | |
785 | ||
786 | //the am ount of re sults to r eturn from a search query | |
787 | //contro lActProces s/queryByP arameter/i nitialQuan tity | |
788 | INT init Qty = fact ory.create INT(); | |
789 | initQty. setValue(B igInteger. valueOf(AP P_CONFIG.g etMVISearc hQty())); | |
790 | queryByP arameter.s etInitialQ uantity(in itQty); | |
791 | ||
792 | ||
793 | //patien t | |
794 | ||
795 | //parame ter: livin gSubjectAd ministrati veGender M/F | |
796 | //contro lActProces s/queryByP arameter/p arameterLi st/livingS ubjectAdmi nistrative Gender | |
797 | if (Stri ngUtils.is NotEmpty(q ueryBean.g etGender() )) { | |
798 | PRPA MT201306UV 02LivingSu bjectAdmin istrativeG ender saGe nder = fac tory.creat ePRPAMT201 306UV02Liv ingSubject Administra tiveGender (); | |
799 | CE g enderValue = factory .createCE( ); | |
800 | gend erValue.se tCode(quer yBean.getG ender()); | |
801 | saGe nder.getVa lue().add( genderValu e); | |
802 | saGe nder.setSe manticsTex t("Gender" ); | |
803 | para meterList. getLivingS ubjectAdmi nistrative Gender().a dd(saGende r); | |
804 | } | |
805 | ||
806 | //parame ter: livin gSubjectBi rthTime Y YYYMMDD | |
807 | //contro lActProces s/queryByP arameter/p arameterLi st/livingS ubjectBirt hTime | |
808 | String d obStr = qu eryBean.ge tDob(); | |
809 | if (Stri ngUtils.is NotEmpty(d obStr)) { | |
810 | dobS tr = Utils .shortDate (Utils.get Cal(dobStr )); | |
811 | PRPA MT201306UV 02LivingSu bjectBirth Time bt = factory.cr eatePRPAMT 201306UV02 LivingSubj ectBirthTi me(); | |
812 | IVLT S dob = fa ctory.crea teIVLTS(); | |
813 | dob. setValue(d obStr); | |
814 | bt.g etValue(). add(dob); | |
815 | bt.s etSemantic sText("Dat e of Birth "); | |
816 | para meterList. getLivingS ubjectBirt hTime().ad d(bt); | |
817 | } | |
818 | ||
819 | //parame ter: livin gSubjectId (SSN) | |
820 | //contro lActProces s/queryByP arameter/p arameterLi st/livingS ubjectId | |
821 | if (Stri ngUtils.is NotEmpty(q ueryBean.g etPatientI d())) { | |
822 | PRPA MT201306UV 02LivingSu bjectId ls Id = facto ry.createP RPAMT20130 6UV02Livin gSubjectId (); | |
823 | II l sIdValue = factory.c reateII(); | |
824 | lsId Value.setR oot("2.16. 840.1.1138 83.4.1"); | |
825 | lsId Value.setE xtension(q ueryBean.g etPatientI d()); | |
826 | lsId .getValue( ).add(lsId Value); | |
827 | lsId .setSemant icsText("S SN"); | |
828 | para meterList. getLivingS ubjectId() .add(lsId) ; | |
829 | } | |
830 | ||
831 | //parame ter: livin gSubjectNa me | |
832 | //contro lActProces s/queryByP arameter/p arameterLi st/livingS ubjectName | |
833 | PRPAMT20 1306UV02Li vingSubjec tName lsNa me = facto ry.createP RPAMT20130 6UV02Livin gSubjectNa me(); | |
834 | EN lsNam eEN = fact ory.create EN(); | |
835 | lsNameEN .getUse(). add("L"); | |
836 | lsNameEN .getConten t().add(fa ctory.crea teENFamily (queryBean .getLastNa me())); | |
837 | lsNameEN .getConten t().add(fa ctory.crea teENGiven( queryBean. getFirstNa me())); | |
838 | lsName.s etSemantic sText("Leg al Name"); | |
839 | lsName.g etValue(). add(lsName EN); | |
840 | paramete rList.getL ivingSubje ctName().a dd(lsName) ; | |
841 | ||
842 | //parame ter: patie ntTelecom | |
843 | //contro lActProces s/queryByP arameter/p arameterLi st/patient Telecom | |
844 | if (Stri ngUtils.is NotEmpty(q ueryBean.g etTel())) { | |
845 | PRPA MT201306UV 02PatientT elecom tel ecom = fac tory.creat ePRPAMT201 306UV02Pat ientTeleco m(); | |
846 | TEL pTel = fac tory.creat eTEL(); | |
847 | pTel .setValue( queryBean. getTel()); | |
848 | pTel .getUse(). add("HP"); | |
849 | tele com.getVal ue().add(p Tel); | |
850 | para meterList. getPatient Telecom(). add(teleco m); | |
851 | } | |
852 | ||
853 | //parame ter: patie ntAddress | |
854 | //contro lActProces s/queryByP arameter/p arameterLi st/patient Address | |
855 | if (Stri ngUtils.is NotEmpty(q ueryBean.g etAddress( )) || Stri ngUtils.is NotEmpty(q ueryBean.g etCity()) | |
856 | || StringU tils.isNot Empty(quer yBean.getS tate()) || StringUti ls.isNotEm pty(queryB ean.getZip ())) { | |
857 | PRPA MT201306UV 02PatientA ddress pat Address = factory.cr eatePRPAMT 201306UV02 PatientAdd ress(); | |
858 | AD p atAd = fac tory.creat eAD(); | |
859 | patA d.getUse() .add("HP") ; | |
860 | if ( !StringUti ls.isEmpty (queryBean .getAddres s())) | |
861 | patAd.getC ontent().a dd(factory .createADS treetAddre ssLine(que ryBean.get Address()) ); | |
862 | if ( !StringUti ls.isEmpty (queryBean .getCity() )) | |
863 | patAd.getC ontent().a dd(factory .createADC ity(queryB ean.getCit y())); | |
864 | if ( !StringUti ls.isEmpty (queryBean .getState( ))) | |
865 | patAd.getC ontent().a dd(factory .createADS tate(query Bean.getSt ate())); | |
866 | if ( !StringUti ls.isEmpty (queryBean .getZip()) ) | |
867 | patAd.getC ontent().a dd(factory .createADP ostalCode( queryBean. getZip())) ; | |
868 | patA ddress.get Value().ad d(patAd); | |
869 | para meterList. getPatient Address(). add(patAdd ress); | |
870 | } | |
871 | ||
872 | PRPAMT20 1306UV02Ot herIDsScop ingOrganiz ation othe rOrg = fac tory.creat ePRPAMT201 306UV02Oth erIDsScopi ngOrganiza tion(); | |
873 | II other OrgValue = factory.c reateII(); | |
874 | otherOrg Value.setE xtension(" VA_DOD"); | |
875 | otherOrg Value.setR oot("2.16. 840.1.1138 83.4.349") ; | |
876 | otherOrg .getValue( ).add(othe rOrgValue) ; | |
877 | otherOrg .setSemant icsText("M VI.REGISTR ATION"); | |
878 | paramete rList.getO therIDsSco pingOrgani zation().a dd(otherOr g); | |
879 | ||
880 | // } | |
881 | // catch (Exc eption e) { | |
882 | // e.prin tStackTrac e(System.o ut); | |
883 | // } | |
884 | ||
885 | re turn reque st; | |
886 | } | |
887 | ||
888 | privat e List<Str ing> parse ResponseTo PatientIds (PRPAIN201 310UV02 re sponse) th rows JMead owsExcepti on { | |
889 | It erator<MCC IMT000300U V01Acknowl edgement> acknowledg ementItera tor; | |
890 | MC CIMT000300 UV01Acknow ledgement acknowledg ement; | |
891 | It erator<MCC IMT000300U V01Acknowl edgementDe tail> ackn owledgemen tDetailIte rator; | |
892 | MC CIMT000300 UV01Acknow ledgementD etail ackn owledgemen tDetail; | |
893 | It erator<PRP AIN201310U V02MFMIMT7 00711UV01S ubject1> s ubjectIter ator; | |
894 | PR PAIN201310 UV02MFMIMT 700711UV01 Subject1 s ubject; | |
895 | PR PAMT201304 UV02Patien t patient; | |
896 | It erator<II> iiIterato r; | |
897 | II ii; | |
898 | ||
899 | Li st<String> patientId s = new Ar rayList<St ring>(); | |
900 | St ring error Message = "No Acknow ledgement detail was provided in MVI rep sonse."; | |
901 | ||
902 | // Check for errors | |
903 | ac knowledgem entIterato r = respon se.getAckn owledgemen t().iterat or(); | |
904 | wh ile (ackno wledgement Iterator.h asNext()) { | |
905 | acknowle dgement = acknowledg ementItera tor.next() ; | |
906 | if (!"AA ".equalsIg noreCase(a cknowledge ment.getTy peCode().g etCode())) { | |
907 | ackn owledgemen tDetailIte rator = ac knowledgem ent.getAck nowledgeme ntDetail() .iterator( ); | |
908 | whil e (acknowl edgementDe tailIterat or.hasNext ()) { | |
909 | acknowledg ementDetai l = acknow ledgementD etailItera tor.next() ; | |
910 | errorMessa ge = ackno wledgement Detail.get Text(); | |
911 | break; | |
912 | } | |
913 | //me lcolm todo : error lo gs are rep orting: "C orrelation Does Not Exist:IQI" filter t hese out f rom error log | |
914 | //re turn null? | |
915 | thro w new JMea dowsExcept ion("MVI A pplication Error: " + errorMes sage); | |
916 | } | |
917 | } | |
918 | ||
919 | // Parse out patient i dentifiers | |
920 | su bjectItera tor = resp onse.getCo ntrolActPr ocess().ge tSubject() .iterator( ); | |
921 | wh ile (subje ctIterator .hasNext() ) { | |
922 | subject = subjectI terator.ne xt(); | |
923 | patient = subject. getRegistr ationEvent ().getSubj ect1().get Patient(); | |
924 | ||
925 | iiIterat or = patie nt.getId() .iterator( ); | |
926 | while (i iIterator. hasNext()) { | |
927 | ii = iiIterato r.next(); | |
928 | pati entIds.add (ii.getExt ension()); | |
929 | } | |
930 | } | |
931 | ||
932 | re turn patie ntIds; | |
933 | } | |
934 | ||
935 | privat e List<Pat ient> pars eResponseT oPatientLo okup(PRPAI N201306UV0 2 response , Map<Stri ng, Site> siteMap, L ist<Object > restrict edSiteCode sList) thr ows JMeado wsExceptio n { | |
936 | Li st<Patient > patients = new Arr ayList<Pat ient>(); | |
937 | ||
938 | ||
939 | It erator<MCC IMT000300U V01Acknowl edgement> acknowledg ementItera tor; | |
940 | MC CIMT000300 UV01Acknow ledgement acknowledg ement; | |
941 | It erator<MCC IMT000300U V01Acknowl edgementDe tail> ackn owledgemen tDetailIte rator; | |
942 | MC CIMT000300 UV01Acknow ledgementD etail ackn owledgemen tDetail; | |
943 | It erator<PRP AIN201306U V02MFMIMT7 00711UV01S ubject1> s ubjectIter ator; | |
944 | PR PAIN201306 UV02MFMIMT 700711UV01 Subject1 s ubject; | |
945 | PR PAMT201310 UV02Patien t mviPatie nt; | |
946 | It erator<II> iiIterato r; | |
947 | II ii; | |
948 | ||
949 | // List<Strin g> patient Ids = new ArrayList< String>(); | |
950 | St ring error Message = "No Acknow ledgement detail was provided in MVI rep sonse."; | |
951 | // | |
952 | // // Check f or errors | |
953 | ac knowledgem entIterato r = respon se.getAckn owledgemen t().iterat or(); | |
954 | wh ile (ackno wledgement Iterator.h asNext()) { | |
955 | acknowle dgement = acknowledg ementItera tor.next() ; | |
956 | if (!"AA ".equalsIg noreCase(a cknowledge ment.getTy peCode().g etCode())) { | |
957 | ackn owledgemen tDetailIte rator = ac knowledgem ent.getAck nowledgeme ntDetail() .iterator( ); | |
958 | erro rMessage = ""; | |
959 | whil e (acknowl edgementDe tailIterat or.hasNext ()) { | |
960 | acknowledg ementDetai l = acknow ledgementD etailItera tor.next() ; | |
961 | errorMessa ge += ackn owledgemen tDetail.ge tText() + "; "; | |
962 | break; | |
963 | } | |
964 | if(" AR".equals IgnoreCase (acknowled gement.get TypeCode() .getCode() )){ | |
965 | Patient pa tient = ne w Patient( ); | |
966 | if(errorMe ssage.cont ains("DOD Error")){ | |
967 | errorM essage = " Please mod ify your s earch para meters and try again ."; | |
968 | } | |
969 | patient.se tName("MVI Error: Ap plication Reject. Th ere was an error att empting to process y our query. " + error Message); | |
970 | patients.a dd(patient ); | |
971 | return pat ients; | |
972 | } el se if("AE" .equalsIgn oreCase(ac knowledgem ent.getTyp eCode().ge tCode())){ | |
973 | Patient pa tient = ne w Patient( ); | |
974 | patient.se tName("MVI Error: Ap plication Error. The re was an error atte mpting to process yo ur query. " + errorM essage); | |
975 | patients.a dd(patient ); | |
976 | return pat ients; | |
977 | } | |
978 | //me lcolm todo : handle t his differ ently, so that user is informe d of prope r errors f rom MVI | |
979 | //re turn null? | |
980 | thro w new JMea dowsExcept ion("MVI A pplication Error: " + errorMes sage); | |
981 | } | |
982 | } | |
983 | ||
984 | // query resp onse code: QE - too many resul ts, AE - a pplication error, NF - no reco rds found | |
985 | St ring qrc = ""; | |
986 | if (response. getControl ActProcess () != null && | |
987 | resp onse.getCo ntrolActPr ocess().ge tQueryAck( ) != null && | |
988 | resp onse.getCo ntrolActPr ocess().ge tQueryAck( ).getQuery ResponseCo de() != nu ll){ | |
989 | qrc = re sponse.get ControlAct Process(). getQueryAc k().getQue ryResponse Code().get Code(); | |
990 | if("QE". equalsIgno reCase(qrc )) { | |
991 | Pati ent patien t = new Pa tient(); | |
992 | pati ent.setNam e("MVI Err or: Your q uery yield s too many results. Please mod ify your s earch para meters to narrow the search.") ; | |
993 | pati ents.add(p atient); | |
994 | retu rn patient s; | |
995 | } else i f("AE".equ alsIgnoreC ase(qrc)) { | |
996 | Pati ent patien t = new Pa tient(); | |
997 | pati ent.setNam e("MVI Err or: There was an err or attempt ing to pro cess your query."); | |
998 | pati ents.add(p atient); | |
999 | retu rn patient s; | |
1000 | } else i f("NF".equ alsIgnoreC ase(qrc)) { | |
1001 | Pati ent patien t = new Pa tient(); | |
1002 | pati ent.setNam e("MVI Mes sage: Pati ent not fo und with s earch elem ents enter ed, please provide a dditional " + | |
1003 | "patie nt identif ying infor mation and search ag ain"); | |
1004 | pati ents.add(p atient); | |
1005 | retu rn patient s; | |
1006 | } | |
1007 | } | |
1008 | ||
1009 | su bjectItera tor = resp onse.getCo ntrolActPr ocess().ge tSubject() .iterator( ); | |
1010 | wh ile (subje ctIterator .hasNext() ) { | |
1011 | Patient patient = new Patien t(); | |
1012 | subject = subjectI terator.ne xt(); | |
1013 | mviPatie nt = subje ct.getRegi strationEv ent().getS ubject1(). getPatient (); | |
1014 | ||
1015 | // Parse out patie nt identif iers | |
1016 | // List<S tring> pat ientIds = new ArrayL ist<String >(); | |
1017 | iiIterat or = mviPa tient.getI d().iterat or(); | |
1018 | while (i iIterator. hasNext()) { | |
1019 | ii = iiIterato r.next(); | |
1020 | if(S tringUtils .isNotEmpt y(ii.getRo ot()) && O ID_EDIPI.e quals(ii.g etRoot()) | |
1021 | && Str ingUtils.i sNotEmpty( ii.getExte nsion()) & & ii.getEx tension(). length() = = 10){ | |
1022 | patient.se tEDIPI(ii. getExtensi on()); | |
1023 | } el se { | |
1024 | patient = parsePatie ntId(ii.ge tExtension (), siteMa p, patient ); | |
1025 | } | |
1026 | } | |
1027 | ||
1028 | // Parse patientPe rson | |
1029 | PRPAMT20 1310UV02Pe rson patie ntPerson = mviPatien t.getPatie ntPerson() .getValue( ); | |
1030 | if (pati entPerson != null) { | |
1031 | CE c e; | |
1032 | TS t s; | |
1033 | CS c s; | |
1034 | ||
1035 | // P atient gen der | |
1036 | ce = patientPe rson.getAd ministrati veGenderCo de(); | |
1037 | if ( ce != null ) { | |
1038 | patient.se tGender(ce .getCode() ); | |
1039 | } | |
1040 | ||
1041 | // P atient dat e of birth | |
1042 | ts = patientPe rson.getBi rthTime(); | |
1043 | if ( ts != null ) { | |
1044 | patient.se tDob(ts.ge tValue()); | |
1045 | } | |
1046 | ||
1047 | // P atient nam e | |
1048 | if ( patientPer son.getNam e() != nul l) { | |
1049 | for (PN pn : patient Person.get Name()) { | |
1050 | if (pn .getUse() == null) { continue; } | |
1051 | for (S tring use : pn.getUs e()) { | |
1052 | if ("L".equa lsIgnoreCa se(use)) { | |
1053 | patient. setName(pa rseName(pn )); | |
1054 | } | |
1055 | } | |
1056 | } | |
1057 | } | |
1058 | ||
1059 | // P atient SSN | |
1060 | if ( patientPer son.getAsO therIDs() != null) { | |
1061 | for (PRPAM T201310UV0 2OtherIDs otherIDs : patientPe rson.getAs OtherIDs() ) { | |
1062 | if (ot herIDs.get Id() == nu ll) { cont inue; } | |
1063 | for (I I otherId : otherIDs .getId()) { | |
1064 | if ("2.16.84 0.1.113883 .4.1".equa lsIgnoreCa se(otherId .getRoot() )){ | |
1065 | patient. setSSN(oth erId.getEx tension()) ; | |
1066 | } | |
1067 | } | |
1068 | } | |
1069 | } | |
1070 | } | |
1071 | ||
1072 | boolean unrestrict edPatient = true; | |
1073 | // if th ere is a r estricted site list, only add patients w ith an id at at leas t one vist a site in the list | |
1074 | if (Coll ectionUtil s.isNotEmp ty(restric tedSiteCod esList)) { | |
1075 | // s ince there is a rest ricted lis t, at firs t assume t his patien t is not a llowed to be added t o lookup | |
1076 | unre strictedPa tient = fa lse; | |
1077 | for (Site vist aSite : pa tient.getV istaSites( )) { | |
1078 | // patient 's vistaSi tes added to patient .getVistaS ites() dur ing parsin g of ident ifiers; ch eck those sites agai nst restri cted list | |
1079 | if (restri ctedSiteCo desList.co ntains(vis taSite.get SiteCode() )) { | |
1080 | // thi s patient has an id at a vista site in t he site li st so set this patie nt back to unrestric ted | |
1081 | unrest rictedPati ent = true ; | |
1082 | break; | |
1083 | } | |
1084 | } | |
1085 | if ( !unrestric tedPatient && APP_CO NFIG.useEn hancedDebu g()) { | |
1086 | StringBuil der debugS tring = ne w StringBu ilder("!!! VBAUSER S ITERESTRIC TED: "); | |
1087 | // Log tha t a patien t was filt ered out. | |
1088 | debugStrin g.append(" Removing f rom search PATIENT: "); | |
1089 | debugStrin g.append(p atient.get Name()); | |
1090 | debugStrin g.append(" Restric ted SITES: "); | |
1091 | for (Objec t restrict edSiteCode : restric tedSiteCod esList) { | |
1092 | debugS tring.appe nd(restric tedSiteCod e); | |
1093 | debugS tring.appe nd(" "); | |
1094 | } | |
1095 | debugStrin g.append(" Patient SITES: "); | |
1096 | for (Site site : pat ient.getVi staSites() ) { | |
1097 | debugS tring.appe nd(site.ge tSiteCode( )); | |
1098 | debugS tring.appe nd(" "); | |
1099 | } | |
1100 | LOGGER.deb ug(debugSt ring.toStr ing()); | |
1101 | } | |
1102 | } | |
1103 | ||
1104 | // add o nly unrest ricted pat ients to l ookup list | |
1105 | if (unre strictedPa tient) { | |
1106 | pati ents.add(p atient); | |
1107 | } | |
1108 | } | |
1109 | ||
1110 | re turn patie nts; | |
1111 | } | |
1112 | ||
1113 | privat e Patient parsePatie ntId(Strin g idString , Map<Stri ng, Site> siteMap, P atient pat ient){ | |
1114 | ||
1115 | // Correspon ding IDs f ormat: ID^ TYPE^SOURC E^ISSUER^S TATUS | |
1116 | St ringTokeni zer tokeni zer = new StringToke nizer(idSt ring, "^") ; | |
1117 | ||
1118 | // List<Exter nalID> ext ernalIDs = new Array List<Exter nalID>(); | |
1119 | ||
1120 | if (tokenize r.countTok ens() >= 4 ) // Accor ding to fo rmat, ther e should o nly be 5 t okens | |
1121 | { | |
1122 | String i d = tokeni zer.nextTo ken(); | |
1123 | String t ype = toke nizer.next Token(); | |
1124 | String s ource = to kenizer.ne xtToken(); | |
1125 | String i ssuer = to kenizer.ne xtToken(); | |
1126 | String s tatus = "" ; | |
1127 | if(token izer.hasMo reTokens() ) { | |
1128 | statu s = tokeni zer.nextTo ken(); | |
1129 | } | |
1130 | ||
1131 | // Makes sure each relevant token is n ot null or blank and status is "A" for a ctive | |
1132 | if (Stri ngUtils.is NotBlank(i d) && Stri ngUtils.is NotBlank(t ype) | |
1133 | && StringU tils.isNot Blank(sour ce) && Str ingUtils.i sNotBlank( issuer)) { | |
1134 | if ( "NI".equal sIgnoreCas e(type)) { | |
1135 | // Nationa l patient identifier | |
1136 | if ("200DO D".equalsI gnoreCase( source) && "USDOD".e qualsIgnor eCase(issu er) | |
1137 | && ("A".equa lsIgnoreCa se(status) || String Utils.isBl ank(status ))) { | |
1138 | patien t.setEDIPI (id); | |
1139 | } else if ("200M".eq ualsIgnore Case(sourc e) && "USV HA".equals IgnoreCase (issuer) | |
1140 | && ("P".equa lsIgnoreCa se(status) || String Utils.isBl ank(status ))) { | |
1141 | // VA ICN | |
1142 | patien t.setICN(i d); | |
1143 | } else { | |
1144 | // exte rnalIDs.ad d(new Exte rnalID(id, type, sou rce, issue r)); | |
1145 | } | |
1146 | } el se if ("PI ".equalsIg noreCase(t ype)) { | |
1147 | // Local f acility pa tient iden tifier | |
1148 | if ("USVHA ".equalsIg noreCase(i ssuer) && ("A".equal sIgnoreCas e(status) || StringU tils.isBla nk(status) )) { | |
1149 | // VA DFN (IEN) | |
1150 | if (si teMap != n ull) { | |
1151 | Si te site = siteMap.ge t(source); | |
1152 | if (site == null) { | |
1153 | LOGGER.d ebug("Site with site code " + source + " not found in sites map"); | |
1154 | } else { | |
1155 | patient. getVistaSi tes().add( site); | |
1156 | ||
1157 | // Add p atient's V A IEN and correspond ing site c ode to key -value pai r list | |
1158 | KeyValue Pair kvp = new KeyVa luePair(); | |
1159 | kvp.setK ey(source) ; | |
1160 | kvp.setV alue(id); | |
1161 | patient. getPatient Iens().add (kvp); | |
1162 | } | |
1163 | } | |
1164 | } else { | |
1165 | // exte rnalIDs.ad d(new Exte rnalID(id, type, sou rce, issue r)); | |
1166 | } | |
1167 | } | |
1168 | } | |
1169 | } else { | |
1170 | LOGGER.d ebug("Inva lid corres ponding ID string fo rmat"); | |
1171 | } | |
1172 | re turn patie nt; | |
1173 | } | |
1174 | ||
1175 | privat e void log AndAuditEx ception(Th rowable e, String au ditMsg, JM eadowsQuer y qb, bool ean isAudi t) { | |
1176 | Au ditDao aud itDao = ne w AuditDao (); | |
1177 | // StringWrit er sw = ne w StringWr iter(); | |
1178 | // PrintWrite r pw = new PrintWrit er(sw); | |
1179 | ||
1180 | // Log error | |
1181 | if (e != nul l) { | |
1182 | // e.prin tStackTrac e(pw); | |
1183 | // logger .error(sw. toString() ); | |
1184 | LOGGER.e rror(e.get Message(), e); | |
1185 | } | |
1186 | ||
1187 | // Audit err or | |
1188 | if (isAudit) { | |
1189 | String r equestingA pp = qb.ge tRequestin gApp(); | |
1190 | String s iteCode = null; | |
1191 | String u serIen = n ull; | |
1192 | String u serNPI = n ull; | |
1193 | String u serName = null; | |
1194 | String p atId; | |
1195 | String s iteMoniker = qb.getS iteMoniker (); | |
1196 | String s iteAgency = qb.getSi teAgency() ; | |
1197 | String r ecordID = qb.getItem Id(); | |
1198 | String c omplexTran saction = qb.getComp lexTransac tion(); | |
1199 | User use r = qb.get User(); | |
1200 | ||
1201 | if (user != null) { | |
1202 | site Code = use r.getHostS ite().getS iteCode(); | |
1203 | user Ien = user .getUserIe n(); | |
1204 | ||
1205 | if ( StringUtil s.isNotBla nk(user.ge tProviderI en())) { | |
1206 | userIen += "^" + use r.getProvi derIen(); | |
1207 | } | |
1208 | ||
1209 | user NPI = user .getNPI(); | |
1210 | user Name = use r.getName( ); | |
1211 | } | |
1212 | ||
1213 | patId = qb.getItem Id(); | |
1214 | if (Stri ngUtils.is NotBlank(q b.getRecor dSiteCode( ))) { | |
1215 | patI d += "^" + qb.getRec ordSiteCod e(); | |
1216 | } | |
1217 | ||
1218 | try { | |
1219 | audi tDao.setAu dit(siteCo de, siteMo niker, sit eAgency, r ecordID, u serIen, us erNPI, use rName, pat Id, auditM sg, reques tingApp, n ull, null, complexTr ansaction) ; | |
1220 | } catch (JMeadowsE xception e xception) { | |
1221 | // ex ception.pr intStackTr ace(pw); | |
1222 | // lo gger.error (sw.toStri ng()); | |
1223 | if ( e != null) { | |
1224 | LOGGER.err or(e.getMe ssage(), e ); | |
1225 | } | |
1226 | } | |
1227 | } | |
1228 | } | |
1229 | ||
1230 | privat e List<Ext ernalID> g etVLERSite Names(List <ExternalI D> ids) { | |
1231 | fo r (Externa lID id : i ds) { | |
1232 | if (id.g etSource() != null) { | |
1233 | Code code = VL ERSiteCach e.getCode( "", id.get Source(), ""); | |
1234 | if ( code != nu ll && code .getDispla y() != nul l) { | |
1235 | id.setSour ceName(cod e.getDispl ay()); | |
1236 | } | |
1237 | } | |
1238 | } | |
1239 | re turn ids; | |
1240 | } | |
1241 | ||
1242 | privat e String p arseName(E N en) { | |
1243 | St ringBuilde r familyNa me = new S tringBuild er(); | |
1244 | St ringBuilde r givenNam e = new St ringBuilde r(); | |
1245 | St ringBuilde r prefixNa me = new S tringBuild er(); | |
1246 | St ringBuilde r suffixNa me = new S tringBuild er(); | |
1247 | Li st<Seriali zable> ser ializableL ist1; | |
1248 | Li st<Seriali zable> ser ializableL ist2; | |
1249 | St ring rtc; | |
1250 | Ob ject objec t; | |
1251 | ||
1252 | se rializable List1 = en .getConten t(); | |
1253 | if (serializ ableList1 == null) { | |
1254 | rtc = nu ll; | |
1255 | } else { | |
1256 | ||
1257 | for (Ser ializable serializab le1 : seri alizableLi st1) { | |
1258 | if ( !(serializ able1 inst anceof JAX BElement)) { continu e; } | |
1259 | ||
1260 | obje ct = ((JAX BElement) serializab le1).getVa lue(); | |
1261 | if ( object == null) { co ntinue; } | |
1262 | ||
1263 | if ( "family".e quals(( (J AXBElement ) serializ able1).get Name().get LocalPart( ))) { | |
1264 | if(familyN ame.length ()>0){ | |
1265 | family Name.appen d(" "); | |
1266 | } | |
1267 | f amilyName. append(obj ect); | |
1268 | } el se if ("gi ven".equal s(( (JAXBE lement) se rializable 1).getName ().getLoca lPart())) { | |
1269 | if(givenNa me.length( )>0){ | |
1270 | givenN ame.append (" "); | |
1271 | } | |
1272 | givenName. append(obj ect); | |
1273 | } el se if ("pr efix".equa ls(( (JAXB Element) s erializabl e1).getNam e().getLoc alPart())) { | |
1274 | if(prefixN ame.length ()>0){ | |
1275 | prefix Name.appen d(" "); | |
1276 | } | |
1277 | prefixName .append(ob ject); | |
1278 | } el se if ("su ffix".equa ls(( (JAXB Element) s erializabl e1).getNam e().getLoc alPart())) { | |
1279 | if(suffixN ame.length ()>0){ | |
1280 | suffix Name.appen d(" "); | |
1281 | } | |
1282 | suffixName .append(ob ject); | |
1283 | } | |
1284 | } | |
1285 | ||
1286 | // add p refix befo re given n ame | |
1287 | if (pref ixName.len gth() > 0) { | |
1288 | give nName = pr efixName.a ppend(give nName); | |
1289 | } | |
1290 | ||
1291 | // add s uffix afte r given na me | |
1292 | if (suff ixName.len gth() > 0) { | |
1293 | give nName = gi venName.ap pend(suffi xName); | |
1294 | } | |
1295 | ||
1296 | rtc = fa milyName.t oString(). trim() + " ," + given Name.toStr ing().trim (); | |
1297 | } | |
1298 | re turn rtc; | |
1299 | } | |
1300 | ||
1301 | // priv ate String parsePhon eNumber(St ring telec om) { | |
1302 | // StringBuil der phoneN umber = ne w StringBu ilder(); | |
1303 | // StringToke nizer toke nizer = ne w StringTo kenizer(te lecom, " " ); | |
1304 | // String tok en; | |
1305 | // char code; | |
1306 | // | |
1307 | // while (tok enizer.has MoreTokens ()) { | |
1308 | // token = tokenize r.nextToke n(); | |
1309 | // code = token.toL owerCase(L ocale.getD efault()). charAt(0); | |
1310 | // // Do not accept tokens th at begin w ith (p)rio rity, (y)e s text, (n )o text | |
1311 | // if ((c ode != 'p' ) && (code != 'y') & & (code != 'n')) { | |
1312 | // ph oneNumber. append(tok en); | |
1313 | // ph oneNumber. append(" " ); | |
1314 | // } | |
1315 | // } | |
1316 | // | |
1317 | // return pho neNumber.t oString(). trim(); | |
1318 | // } | |
1319 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.