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