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