Produced by Araxis Merge on 8/31/2017 11:16:52 AM Central 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.6.zip\JLV_2.6\JLV_2.6\Joint Legacy Viewer\JLVQoS\src\main\java\gov\va\med\jmeadows\dataservicehandler | MVIServiceHandler.java | Thu Aug 31 12:13:58 2017 UTC |
2 | JLV_2.6.zip\JLV_2.6\JLV_2.6\Joint Legacy Viewer\JLVQoS\src\main\java\gov\va\med\jmeadows\dataservicehandler | MVIServiceHandler.java | Thu Aug 31 13:26:07 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 834 |
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.ent erprise.be ans.Respon sePatientS elect; | |
15 | import gov .va.med.jm eadows.web service.be ans.JMeado wsQuery; | |
16 | import gov .va.med.mv i.*; | |
17 | import gov .va.med.vd s.webservi ce.KeyValu ePair; | |
18 | import gov .va.med.vd s.webservi ce.Patient ; | |
19 | import org .apache.co mmons.lang 3.StringUt ils; | |
20 | import org .slf4j.Log ger; | |
21 | import org .slf4j.Log gerFactory ; | |
22 | import org .w3c.dom.E lement; | |
23 | ||
24 | import jav ax.xml.bin d.JAXBCont ext; | |
25 | import jav ax.xml.bin d.JAXBExce ption; | |
26 | import jav ax.xml.nam espace.QNa me; | |
27 | import jav ax.xml.ws. BindingPro vider; | |
28 | import jav ax.xml.ws. handler.Ha ndler; | |
29 | import jav a.io.Strin gWriter; | |
30 | import jav a.text.Sim pleDateFor mat; | |
31 | import jav a.util.*; | |
32 | ||
33 | public cla ss MVIServ iceHandler extends D ataService Handler | |
34 | { | |
35 | privat e static f inal Logge r logger = LoggerFac tory.getLo gger(MVISe rviceHandl er.class); | |
36 | privat e VAIdM mv iService; | |
37 | ||
38 | public MVIServic eHandler(S tring url) | |
39 | { | |
40 | su per(); | |
41 | ||
42 | se rviceURL = url; | |
43 | se rviceName = "MVI_Ser vice"; | |
44 | serviceNam espace = " http://web service.mv iws. URL "; | |
45 | qS erviceName = new QNa me(service Namespace, serviceNa me); | |
46 | ||
47 | mv iService = new VAIdM (); | |
48 | } | |
49 | ||
50 | privat e VAIdMPor t getMVIPo rt() | |
51 | { | |
52 | VA IdMPort po rt = mviSe rvice.getV AIdMPort() ; | |
53 | ||
54 | Bi ndingProvi der bp = ( BindingPro vider) por t; | |
55 | bp .getReques tContext() .put(Bindi ngProvider .ENDPOINT_ ADDRESS_PR OPERTY, se rviceURL); | |
56 | bp .getReques tContext() .put("com. sun.xml.in ternal.ws. connect.ti meout", se rviceConne ctionTimeo utMS); | |
57 | bp .getReques tContext() .put("com. sun.xml.in ternal.ws. request.ti meout", se rviceReque stTimeoutM S); | |
58 | bp .getReques tContext() .put("com. sun.xml.ws .connect.t imeout", s erviceConn ectionTime outMS); | |
59 | bp .getReques tContext() .put("com. sun.xml.ws .request.t imeout", s erviceRequ estTimeout MS); | |
60 | ||
61 | // SOAP mess age loggin g - Enable to show l ogging in output win dow | |
62 | if ("test".e qualsIgnor eCase(APP_ CONFIG.get AppEnviron ment()) || "developm ent".equal sIgnoreCas e(APP_CONF IG.getAppE nvironment ())) | |
63 | { | |
64 | bp.getBi nding().ge tHandlerCh ain().add( new SOAPLo ggingHandl er()); | |
65 | List<Han dler> hand lerList = bp.getBind ing().getH andlerChai n(); | |
66 | handlerL ist.add(ne w SOAPLogg ingHandler ()); | |
67 | bp.getBi nding().se tHandlerCh ain(handle rList); | |
68 | } | |
69 | ||
70 | re turn port; | |
71 | } | |
72 | ||
73 | public ResponseP atientSele ct getPati entIds(JMe adowsQuery queryBean ) | |
74 | { | |
75 | St ring error Message = ""; | |
76 | ||
77 | Re sponsePati entSelect responsePa tientSelec t = new Re sponsePati entSelect( ); | |
78 | ||
79 | tr y | |
80 | { | |
81 | // Gener ate PRPAIN 201309UV02 request m essage | |
82 | PRPAIN20 1309UV02 r equest = g enerateReq uest(query Bean); | |
83 | ||
84 | PRPAIN20 1310UV02 r esponse = getMVIPort ().prpaIN2 01309UV02( request); | |
85 | ||
86 | // Parse response into patie nt IDs map | |
87 | List<Str ing> patie ntIds = pa rseRespons eToPatient Ids(respon se); | |
88 | ||
89 | Patient patient = new Patien t(); | |
90 | ||
91 | Iterator <String> i terator = patientIds .iterator( ); | |
92 | while (i terator.ha sNext()) | |
93 | { | |
94 | // C orrespondi ng IDs for mat: ID^TY PE^SOURCE^ ISSUER^STA TUS | |
95 | Stri ngTokenize r tokenize r = new St ringTokeni zer(iterat or.next(), "^"); | |
96 | if ( tokenizer. countToken s() == 5) // Accordi ng to form at, there should onl y be 5 tok ens | |
97 | { | |
98 | String id = tokenize r.nextToke n(); | |
99 | String typ e = tokeni zer.nextTo ken(); | |
100 | String sou rce = toke nizer.next Token(); | |
101 | String iss uer = toke nizer.next Token(); | |
102 | ||
103 | // Makes s ure each r elevant to ken is not null or b lank | |
104 | if (String Utils.isNo tBlank(id) && String Utils.isNo tBlank(typ e) | |
105 | && StringUti ls.isNotBl ank(source ) && Strin gUtils.isN otBlank(is suer)) | |
106 | { | |
107 | if ("N I".equalsI gnoreCase( type)) | |
108 | { | |
109 | // National patient id entifier | |
110 | if ("200DOD" .equalsIgn oreCase(so urce) && " USDOD".equ alsIgnoreC ase(issuer )) | |
111 | { | |
112 | // DoD E DIPI | |
113 | patient. setEDIPI(i d); | |
114 | } | |
115 | el se if ("20 0M".equals IgnoreCase (source) & & "USVHA". equalsIgno reCase(iss uer)) | |
116 | { | |
117 | // VA IC N | |
118 | patient. setICN(id) ; | |
119 | } | |
120 | } | |
121 | else i f ("PI".eq ualsIgnore Case(type) ) | |
122 | { | |
123 | // Local fac ility pati ent identi fier | |
124 | if ("USVHA". equalsIgno reCase(iss uer)) | |
125 | { | |
126 | // Add p atient's V A IEN and correspond ing site c ode to key -value pai r list | |
127 | KeyValue Pair kvp = new KeyVa luePair(); | |
128 | kvp.setK ey(source) ; | |
129 | kvp.setV alue(id); | |
130 | patient. getPatient Iens().add (kvp); | |
131 | } | |
132 | } | |
133 | } | |
134 | } | |
135 | else | |
136 | { | |
137 | logger.deb ug("Invali d correspo nding ID s tring form at"); | |
138 | } | |
139 | } | |
140 | ||
141 | response PatientSel ect.setSuc cess(true) ; | |
142 | response PatientSel ect.setPat ient(patie nt); | |
143 | } | |
144 | ca tch (JMead owsExcepti on e) | |
145 | { | |
146 | response PatientSel ect.setSuc cess(false ); | |
147 | response PatientSel ect.setErr orMsg(e.ge tMessage() ); | |
148 | } | |
149 | ca tch (Excep tion e) | |
150 | { | |
151 | response PatientSel ect.setSuc cess(false ); | |
152 | response PatientSel ect.setErr orMsg(e.ge tMessage() ); | |
153 | } | |
154 | ||
155 | re turn respo nsePatient Select; | |
156 | } | |
157 | ||
158 | privat e PRPAIN20 1309UV02 g enerateReq uest(JMead owsQuery q ueryBean) | |
159 | { | |
160 | Ob jectFactor y factory; | |
161 | PR PAIN201309 UV02 reque st; | |
162 | MC CIMT000100 UV01Receiv er receive r; | |
163 | MC CIMT000100 UV01Device device; | |
164 | MC CIMT000100 UV01Sender sender; | |
165 | PR PAIN201309 UV02QUQIMT 021001UV01 ControlAct Process co ntrolActPr ocess; | |
166 | PR PAMT201307 UV02QueryB yParameter queryByPa rameter; | |
167 | PR PAMT201307 UV02Parame terList pa rameterLis t; | |
168 | PR PAMT201307 UV02Patien tIdentifie r patientI dentifier; | |
169 | Si mpleDateFo rmat simpl eDateForma t; | |
170 | II ii; | |
171 | TS ts; | |
172 | CS cs; | |
173 | CD cd; | |
174 | Da te date; | |
175 | St ring statu s; | |
176 | St ring oid; | |
177 | St ring id; | |
178 | St ring type; | |
179 | St ring sourc e; | |
180 | St ring issue r; | |
181 | ||
182 | fa ctory = ne w ObjectFa ctory(); | |
183 | re quest = fa ctory.crea tePRPAIN20 1309UV02() ; | |
184 | da te = new D ate(); | |
185 | ||
186 | // id | |
187 | si mpleDateFo rmat = new SimpleDat eFormat("y yyyMMdd"); | |
188 | ii = factory .createII( ); | |
189 | ii .setRoot(" 2.16.840.1 .113883.3. 933"); | |
190 | ii .setExtens ion("MCID_ JANUS_DEV_ T1_" + sim pleDateFor mat.format (date)); | |
191 | re quest.setI d(ii); | |
192 | ||
193 | // creationTi me | |
194 | ts = factory .createTS( ); | |
195 | si mpleDateFo rmat = new SimpleDat eFormat("y yyyMMddhhm ms"); | |
196 | ts .setValue( simpleDate Format.for mat(date)) ; | |
197 | re quest.setC reationTim e(ts); | |
198 | ||
199 | // interactio nId | |
200 | ii = factory .createII( ); | |
201 | ii .setRoot(" 2.16.840.1 .113883.1. 6"); | |
202 | ii .setExtens ion("PRPA_ IN201309UV 02"); | |
203 | re quest.setI nteraction Id(ii); | |
204 | ||
205 | // processing Code | |
206 | cs = factory .createCS( ); | |
207 | if ("product ion".equal sIgnoreCas e(APP_CONF IG.getAppE nvironment ())) | |
208 | { | |
209 | cs.setCo de("P"); | |
210 | } | |
211 | el se | |
212 | { | |
213 | cs.setCo de("T"); | |
214 | } | |
215 | re quest.setP rocessingC ode(cs); | |
216 | ||
217 | // processing ModeCode | |
218 | cs = factory .createCS( ); | |
219 | cs .setCode(" T"); | |
220 | re quest.setP rocessingM odeCode(cs ); | |
221 | ||
222 | // acceptAckC ode | |
223 | cs = factory .createCS( ); | |
224 | cs .setCode(" AL"); | |
225 | re quest.setA cceptAckCo de(cs); | |
226 | ||
227 | // receiver | |
228 | re ceiver = f actory.cre ateMCCIMT0 00100UV01R eceiver(); | |
229 | re quest.getR eceiver(). add(receiv er); | |
230 | ||
231 | // receiver/t ypeCode | |
232 | re ceiver.set TypeCode(C ommunicati onFunction Type.RCV); | |
233 | ||
234 | // receiver/d evice | |
235 | de vice = fac tory.creat eMCCIMT000 100UV01Dev ice(); | |
236 | re ceiver.set Device(dev ice); | |
237 | ||
238 | // receiver/d evice/clas sCode | |
239 | de vice.setCl assCode(En tityClassD evice.DEV) ; | |
240 | ||
241 | // receiver/d evice/dete rminerCode | |
242 | de vice.setDe terminerCo de("INSTAN CE"); | |
243 | ||
244 | // receiver/d evice/id | |
245 | ii = factory .createII( ); | |
246 | ii .setRoot(" 2.16.840.1 .113883.4. 349"); | |
247 | ii .setExtens ion("200M" ); | |
248 | de vice.getId ().add(ii) ; | |
249 | ||
250 | // sender | |
251 | se nder = fac tory.creat eMCCIMT000 100UV01Sen der(); | |
252 | re quest.setS ender(send er); | |
253 | ||
254 | // sender/typ eCode | |
255 | se nder.setTy peCode(Com munication FunctionTy pe.SND); | |
256 | ||
257 | // sender/dev ice | |
258 | de vice = fac tory.creat eMCCIMT000 100UV01Dev ice(); | |
259 | se nder.setDe vice(devic e); | |
260 | ||
261 | // sender/dev ice/classC ode | |
262 | de vice.setCl assCode(En tityClassD evice.DEV) ; | |
263 | ||
264 | // sender/dev ice/determ inerCode | |
265 | de vice.setDe terminerCo de("INSTAN CE"); | |
266 | ||
267 | // sender/dev ice/id | |
268 | ii = factory .createII( ); | |
269 | ii .setRoot(" 2.16.840.1 .113883.4. 349"); | |
270 | ii .setExtens ion("200JN US"); | |
271 | de vice.getId ().add(ii) ; | |
272 | ||
273 | // controlAct Process | |
274 | co ntrolActPr ocess = fa ctory.crea tePRPAIN20 1309UV02QU QIMT021001 UV01Contro lActProces s(); | |
275 | re quest.setC ontrolActP rocess(con trolActPro cess); | |
276 | ||
277 | // controlAct Process/cl assCode | |
278 | co ntrolActPr ocess.setC lassCode(A ctClassCon trolAct.CA CT); | |
279 | ||
280 | // controlAct Process/mo odCode | |
281 | co ntrolActPr ocess.setM oodCode(XA ctMoodInte ntEvent.EV N); | |
282 | ||
283 | // controlAct Process/co de | |
284 | cd = factory .createCD( ); | |
285 | cd .setCode(" PRPA_TE201 309UV02"); | |
286 | co ntrolActPr ocess.setC ode(cd); | |
287 | ||
288 | // controlAct Process/co deSystem | |
289 | cd .setCodeSy stem("2.16 .840.1.113 883.1.6"); | |
290 | ||
291 | // controlAct Process/qu eryByParam eter | |
292 | qu eryByParam eter = fac tory.creat ePRPAMT201 307UV02Que ryByParame ter(); | |
293 | co ntrolActPr ocess.setQ ueryByPara meter(fact ory.create PRPAIN2013 09UV02QUQI MT021001UV 01ControlA ctProcessQ ueryByPara meter(quer yByParamet er)); | |
294 | ||
295 | // controlAct Process/qu eryByParam eter/query Id | |
296 | ii = factory .createII( ); | |
297 | ii .setRoot(" 2.16.840.1 .113883.3. 933"); | |
298 | ii .setExtens ion("33452 "); | |
299 | qu eryByParam eter.setQu eryId(ii); | |
300 | ||
301 | // controlAct Process/qu eryByParam eter/statu sCode | |
302 | cs = factory .createCS( ); | |
303 | cs .setCode(" new"); | |
304 | qu eryByParam eter.setSt atusCode(c s); | |
305 | ||
306 | // controlAct Process/qu eryByParam eter/respo nsePriorit yCode | |
307 | cs = factory .createCS( ); | |
308 | cs .setCode(" I"); | |
309 | qu eryByParam eter.setRe sponsePrio rityCode(c s); | |
310 | ||
311 | // controlAct Process/qu eryByParam eter/param eterList | |
312 | pa rameterLis t = factor y.createPR PAMT201307 UV02Parame terList(); | |
313 | qu eryByParam eter.setPa rameterLis t(paramete rList); | |
314 | ||
315 | // controlAct Process/qu eryByParam eter/param eterList/p atientIden tifier | |
316 | pa tientIdent ifier = fa ctory.crea tePRPAMT20 1307UV02Pa tientIdent ifier(); | |
317 | pa rameterLis t.getPatie ntIdentifi er().add(p atientIden tifier); | |
318 | ||
319 | // controlAct Process/qu eryByParam eter/param eterList/p atientIden tifier/val ue | |
320 | ii = factory .createII( ); | |
321 | st atus = que ryBean.get Status(); | |
322 | if ("EDIPI". equalsIgno reCase(sta tus)) | |
323 | { | |
324 | // Get i dentifiers by DoD ED IPI | |
325 | oid = "2 .16.840.1. 113883.3.3 64"; | |
326 | id = que ryBean.get ItemId(); | |
327 | type = " NI"; | |
328 | source = "200DOD"; | |
329 | issuer = "USDOD"; | |
330 | ||
331 | ii.setRo ot(oid); | |
332 | ii.setEx tension(id + "^" + t ype + "^" + source + "^" + iss uer); | |
333 | ||
334 | logger.d ebug("Gett ing corres ponding pa tient iden tifiers vi a EDIPI"); | |
335 | } | |
336 | el se if ("IC N".equalsI gnoreCase( status)) | |
337 | { | |
338 | // Get i dentifiers by VA ICN | |
339 | oid = "2 .16.840.1. 113883.4.3 49"; | |
340 | id = que ryBean.get ItemId(); | |
341 | type = " NI"; | |
342 | ||
343 | ii.setRo ot(oid); | |
344 | ii.setEx tension(id + "^" + t ype); | |
345 | ||
346 | logger.d ebug("Gett ing corres ponding pa tient iden tifiers vi a ICN"); | |
347 | } | |
348 | el se if ("VA IEN".equal sIgnoreCas e(status)) | |
349 | { | |
350 | // Get i dentifiers by VA IEN | |
351 | oid = "2 .16.840.1. 113883.4.3 49"; | |
352 | id = que ryBean.get ItemId(); | |
353 | type = " PI"; | |
354 | source = queryBean .getRecord SiteCode() ; | |
355 | issuer = "USVHA"; | |
356 | ||
357 | ii.setRo ot(oid); | |
358 | ii.setEx tension(id + "^" + t ype + "^" + source + "^" + iss uer); | |
359 | ||
360 | logger.d ebug("Gett ing corres ponding pa tient iden tifiers vi a VA IEN") ; | |
361 | } | |
362 | ||
363 | pa tientIdent ifier.getV alue().add (ii); | |
364 | ||
365 | // controlAct Process/qu eryByParam eter/param eterList/p atientIden tifier/sem anticsText | |
366 | pa tientIdent ifier.setS emanticsTe xt("Patien t.id"); | |
367 | ||
368 | re turn reque st; | |
369 | } | |
370 | ||
371 | privat e List<Str ing> parse ResponseTo PatientIds (PRPAIN201 310UV02 re sponse) th rows JMead owsExcepti on | |
372 | { | |
373 | It erator<MCC IMT000300U V01Acknowl edgement> acknowledg ementItera tor; | |
374 | MC CIMT000300 UV01Acknow ledgement acknowledg ement; | |
375 | It erator<MCC IMT000300U V01Acknowl edgementDe tail> ackn owledgemen tDetailIte rator; | |
376 | MC CIMT000300 UV01Acknow ledgementD etail ackn owledgemen tDetail; | |
377 | It erator<PRP AIN201310U V02MFMIMT7 00711UV01S ubject1> s ubjectIter ator; | |
378 | PR PAIN201310 UV02MFMIMT 700711UV01 Subject1 s ubject; | |
379 | PR PAMT201304 UV02Patien t patient; | |
380 | It erator<II> iiIterato r; | |
381 | II ii; | |
382 | ||
383 | Li st<String> patientId s = new Ar rayList<St ring>(); | |
384 | ||
385 | // Check for errors | |
386 | ac knowledgem entIterato r = respon se.getAckn owledgemen t().iterat or(); | |
387 | wh ile (ackno wledgement Iterator.h asNext()) | |
388 | { | |
389 | acknowle dgement = acknowledg ementItera tor.next() ; | |
390 | if (!"AA ".equalsIg noreCase(a cknowledge ment.getTy peCode().g etCode())) | |
391 | { | |
392 | ackn owledgemen tDetailIte rator = ac knowledgem ent.getAck nowledgeme ntDetail() .iterator( ); | |
393 | whil e (acknowl edgementDe tailIterat or.hasNext ()) | |
394 | { | |
395 | acknowledg ementDetai l = acknow ledgementD etailItera tor.next() ; | |
396 | throw new JMeadowsEx ception(ac knowledgem entDetail. getText()) ; | |
397 | } | |
398 | } | |
399 | } | |
400 | ||
401 | // Parse out patient i dentifiers | |
402 | su bjectItera tor = resp onse.getCo ntrolActPr ocess().ge tSubject() .iterator( ); | |
403 | wh ile (subje ctIterator .hasNext() ) | |
404 | { | |
405 | subject = subjectI terator.ne xt(); | |
406 | patient = subject. getRegistr ationEvent ().getSubj ect1().get Patient(); | |
407 | ||
408 | iiIterat or = patie nt.getId() .iterator( ); | |
409 | while (i iIterator. hasNext()) | |
410 | { | |
411 | ii = iiIterato r.next(); | |
412 | pati entIds.add (ii.getExt ension()); | |
413 | } | |
414 | } | |
415 | ||
416 | re turn patie ntIds; | |
417 | } | |
418 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.