Produced by Araxis Merge on 3/27/2019 4:11:44 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_CV_CV_2_9_1_0.zip\CVjMeadows-CCP\src\gov\va\med\jmeadows\dataservicehandler | PDWSServiceHandler.java | Wed Mar 20 21:43:06 2019 UTC |
2 | JLV_CV_CV_2_9_1_0.zip\CVjMeadows-CCP\src\gov\va\med\jmeadows\dataservicehandler | PDWSServiceHandler.java | Wed Mar 27 19:19:55 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 2208 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | /** | |
2 | * Janus 4 .0 (c) | |
3 | * Copyrig ht (c) 201 1 Hawaii R esource Gr oup LLC. A ll Rights Reserved. | |
4 | * Develop ed for the Pacific T elehealth & Technolo gy Hui and the Pacif ic Joint I nformation Technolog y Center | |
5 | * Contrib utors: | |
6 | * Hon orable Sen ator Danie l K. Inouy e | |
7 | * VA Pacific Is lands Heal th Care Sy stem | |
8 | * Tri pler Army Medical Ce nter | |
9 | */ | |
10 | ||
11 | package go v.va.med.j meadows.da taserviceh andler; | |
12 | ||
13 | import gov .va.med.jm eadows.com mon.AppCon fig; | |
14 | import gov .va.med.jm eadows.com mon.JMeado wsExceptio n; | |
15 | import gov .va.med.jm eadows.dao .beans.PDW SQueryBean ; | |
16 | import gov .va.med.jm eadows.dao .beans.Res ponsePatie ntQuery; | |
17 | import gov .va.med.jm eadows.dao .hdd.Codin gSystem; | |
18 | import gov .va.med.pd ws.*; | |
19 | import gov .va.med.vd s.webservi ce.Code; | |
20 | import gov .va.med.vd s.webservi ce.Patient ; | |
21 | import gov .va.med.vd s.webservi ce.Patient Demographi cs; | |
22 | import gov .va.med.vd s.webservi ce.Site; | |
23 | import gov .va.med.vd s.webservi ce.User; | |
24 | import gov .va.med.vh ahon.commo n.Utils; | |
25 | ||
26 | import jav a.io.Seria lizable; | |
27 | import jav a.math.Big Integer; | |
28 | import jav a.text.Sim pleDateFor mat; | |
29 | import jav a.util.Arr ayList; | |
30 | import jav a.util.Dat e; | |
31 | import jav a.util.Lis t; | |
32 | import jav a.util.Loc ale; | |
33 | import jav a.util.Str ingTokeniz er; | |
34 | ||
35 | import jav ax.xml.bin d.JAXBElem ent; | |
36 | import jav ax.xml.nam espace.QNa me; | |
37 | import jav ax.xml.ws. BindingPro vider; | |
38 | import jav ax.xml.ws. handler.Ha ndler; | |
39 | ||
40 | import org .apache.co mmons.lang 3.StringUt ils; | |
41 | import org .slf4j.Log ger; | |
42 | import org .slf4j.Log gerFactory ; | |
43 | ||
44 | public cla ss PDWSSer viceHandle r extends DataServic eHandler { | |
45 | privat e static f inal Logge r LOGGER = LoggerFac tory.getLo gger(PDWSS erviceHand ler.class) ; | |
46 | privat e final St ring AGENC Y_DOD = AP P_CONFIG.g etAgencyDO D(); | |
47 | privat e final St ring AGENC Y_VA = APP _CONFIG.ge tAgencyVA( ); | |
48 | privat e final St ring PERSO N_SEARCH_U RL = APP_C ONFIG.getP dwsPsUrl() ; | |
49 | privat e final St ring PERSO N_RETRIEVE _URL = APP _CONFIG.ge tPdwsPrUrl (); | |
50 | privat e final St ring FAMIL Y_SEARCH_U RL = APP_C ONFIG.getP dwsFsUrl() ; | |
51 | privat e final St ring FAMIL Y_RETRIEVE _URL = APP _CONFIG.ge tPdwsFrUrl (); | |
52 | privat e final Bo olean DEBU G_SOAP_OUT PUT; | |
53 | privat e final En tityPatien tInquiry e ntityPatie ntInquiry = new Enti tyPatientI nquiry(); | |
54 | ||
55 | public PDWSServi ceHandler( ) { | |
56 | su per(); | |
57 | se rviceName = "PDWSSer vice"; | |
58 | serviceNam espace = " http:// DNS . URL /"; | |
59 | qS erviceName = new QNa me(service Namespace, serviceNa me); | |
60 | St ring debug = AppConf ig.getInst ance().get Properties ().getProp erty("DEBU G_SOAP_OUT PUT", "fal se"); | |
61 | if ("true".e qualsIgnor eCase(debu g)) { | |
62 | DEBUG_SO AP_OUTPUT = true; | |
63 | } else { | |
64 | DEBUG_SO AP_OUTPUT = false; | |
65 | } | |
66 | } | |
67 | ||
68 | privat e EntityPa tientSearc hPortType getEntityP atientSear chPort() { | |
69 | En tityPatien tSearchPor tType port = entityP atientInqu iry.getEnt ityPatient SearchPort Soap11(); | |
70 | ||
71 | Bi ndingProvi der prov = (BindingP rovider) p ort; | |
72 | pr ov.getRequ estContext ().put(Bin dingProvid er.ENDPOIN T_ADDRESS_ PROPERTY, PERSON_SEA RCH_URL); | |
73 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.connect. timeout", serviceCon nectionTim eoutMS); | |
74 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.request. timeout", serviceReq uestTimeou tMS); | |
75 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.connect .timeout", serviceCo nnectionTi meoutMS); | |
76 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.request .timeout", serviceRe questTimeo utMS); | |
77 | ||
78 | if (DEBUG_SO AP_OUTPUT) { | |
79 | prov.get Binding(). getHandler Chain().ad d(new SOAP LoggingHan dler()); | |
80 | List<Han dler> hand lerList = prov.getBi nding().ge tHandlerCh ain(); | |
81 | handlerL ist.add(ne w SOAPLogg ingHandler ()); | |
82 | prov.get Binding(). setHandler Chain(hand lerList); | |
83 | } | |
84 | ||
85 | re turn port; | |
86 | } | |
87 | ||
88 | privat e EntityPa tientRetri evePortTyp e getEntit yPatientRe trievePort () { | |
89 | En tityPatien tRetrieveP ortType po rt = entit yPatientIn quiry.getE ntityPatie ntRetrieve PortSoap11 (); | |
90 | ||
91 | Bi ndingProvi der prov = (BindingP rovider) p ort; | |
92 | pr ov.getRequ estContext ().put(Bin dingProvid er.ENDPOIN T_ADDRESS_ PROPERTY, PERSON_RET RIEVE_URL) ; | |
93 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.connect. timeout", serviceCon nectionTim eoutMS); | |
94 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.request. timeout", serviceReq uestTimeou tMS); | |
95 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.connect .timeout", serviceCo nnectionTi meoutMS); | |
96 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.request .timeout", serviceRe questTimeo utMS); | |
97 | ||
98 | if (DEBUG_SO AP_OUTPUT) { | |
99 | prov.get Binding(). getHandler Chain().ad d(new SOAP LoggingHan dler()); | |
100 | List<Han dler> hand lerList = prov.getBi nding().ge tHandlerCh ain(); | |
101 | handlerL ist.add(ne w SOAPLogg ingHandler ()); | |
102 | prov.get Binding(). setHandler Chain(hand lerList); | |
103 | } | |
104 | ||
105 | re turn port; | |
106 | } | |
107 | ||
108 | privat e EntityPa tientFamil ySearchPor tType getE ntityFamil ySearchPor t() { | |
109 | En tityPatien tFamilySea rchPortTyp e port = e ntityPatie ntInquiry. getEntityP atientFami lySearchPo rtSoap11() ; | |
110 | ||
111 | Bi ndingProvi der prov = (BindingP rovider) p ort; | |
112 | pr ov.getRequ estContext ().put(Bin dingProvid er.ENDPOIN T_ADDRESS_ PROPERTY, FAMILY_SEA RCH_URL); | |
113 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.connect. timeout", serviceCon nectionTim eoutMS); | |
114 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.request. timeout", serviceReq uestTimeou tMS); | |
115 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.connect .timeout", serviceCo nnectionTi meoutMS); | |
116 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.request .timeout", serviceRe questTimeo utMS); | |
117 | ||
118 | if (DEBUG_SO AP_OUTPUT) { | |
119 | prov.get Binding(). getHandler Chain().ad d(new SOAP LoggingHan dler()); | |
120 | List<Han dler> hand lerList = prov.getBi nding().ge tHandlerCh ain(); | |
121 | handlerL ist.add(ne w SOAPLogg ingHandler ()); | |
122 | prov.get Binding(). setHandler Chain(hand lerList); | |
123 | } | |
124 | ||
125 | re turn port; | |
126 | } | |
127 | ||
128 | privat e EntityPa tientFamil yRetrieveP ortType ge tEntityFam ilyRetriev ePort() { | |
129 | En tityPatien tFamilyRet rievePortT ype port = entityPat ientInquir y.getEntit yPatientFa milyRetrie vePortSoap 11(); | |
130 | ||
131 | Bi ndingProvi der prov = (BindingP rovider) p ort; | |
132 | pr ov.getRequ estContext ().put(Bin dingProvid er.ENDPOIN T_ADDRESS_ PROPERTY, FAMILY_RET RIEVE_URL) ; | |
133 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.connect. timeout", serviceCon nectionTim eoutMS); | |
134 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.request. timeout", serviceReq uestTimeou tMS); | |
135 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.connect .timeout", serviceCo nnectionTi meoutMS); | |
136 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.request .timeout", serviceRe questTimeo utMS); | |
137 | ||
138 | if (DEBUG_SO AP_OUTPUT) { | |
139 | prov.get Binding(). getHandler Chain().ad d(new SOAP LoggingHan dler()); | |
140 | List<Han dler> hand lerList = prov.getBi nding().ge tHandlerCh ain(); | |
141 | handlerL ist.add(ne w SOAPLogg ingHandler ()); | |
142 | prov.get Binding(). setHandler Chain(hand lerList); | |
143 | } | |
144 | ||
145 | re turn port; | |
146 | } | |
147 | ||
148 | privat e PRPAIN20 1305UV02 g enerateReq uest(PDWSQ ueryBean q ueryBean) { | |
149 | MC CIMT000100 UV01Device device; | |
150 | En Given enGi ven; | |
151 | II ii; | |
152 | CS cs; | |
153 | EN en; | |
154 | ST st; | |
155 | AD ad; | |
156 | ||
157 | Us er user = queryBean. getUser(); | |
158 | Si te host = user.getHo stSite(); | |
159 | St ring agenc y = user.g etAgency() ; | |
160 | St ring dmisI d = ""; | |
161 | St ring siteI d = ""; | |
162 | ||
163 | if (host != null) { | |
164 | dmisId = host.getD misId(); | |
165 | siteId = host.getS iteCode(); | |
166 | } | |
167 | ||
168 | Ob jectFactor y factory = new Obje ctFactory( ); | |
169 | PR PAIN201305 UV02 reque st = facto ry.createP RPAIN20130 5UV02(); | |
170 | ||
171 | // id | |
172 | ii = factory .createII( ); | |
173 | ii .setRoot(" 2.16.840.1 .113883.3. 2017"); | |
174 | ii .setExtens ion("DMDC" ); | |
175 | re quest.setI d(ii); | |
176 | ||
177 | // creationTi me | |
178 | TS ts = fact ory.create TS(); | |
179 | Si mpleDateFo rmat simpl eDateForma t = new Si mpleDateFo rmat("yyyy MMddhhmmss ", Locale. getDefault ()); | |
180 | ts .setValue( simpleDate Format.for mat(new Da te())); | |
181 | re quest.setC reationTim e(ts); | |
182 | ||
183 | // interactio nId | |
184 | ii = factory .createII( ); | |
185 | ii .setRoot(" 2.16.840.1 .113883.1. 6"); | |
186 | ii .setExtens ion("PRPA_ IN201305UV 02"); | |
187 | re quest.setI nteraction Id(ii); | |
188 | ||
189 | // processing Code | |
190 | cs = factory .createCS( ); | |
191 | cs .setCode(A PP_CONFIG. getPDWSPro cCode()); | |
192 | re quest.setP rocessingC ode(cs); | |
193 | ||
194 | // processing ModeCode | |
195 | cs = factory .createCS( ); | |
196 | cs .setCode(" I"); | |
197 | re quest.setP rocessingM odeCode(cs ); | |
198 | ||
199 | // acceptAckC ode | |
200 | cs = factory .createCS( ); | |
201 | cs .setCode(" AL"); | |
202 | re quest.setA cceptAckCo de(cs); | |
203 | ||
204 | // receiver | |
205 | MC CIMT000100 UV01Receiv er receive r = factor y.createMC CIMT000100 UV01Receiv er(); | |
206 | re quest.getR eceiver(). add(receiv er); | |
207 | ||
208 | // receiver/t ypeCode | |
209 | re ceiver.set TypeCode(C ommunicati onFunction Type.RCV); | |
210 | ||
211 | // receiver/d evice | |
212 | de vice = fac tory.creat eMCCIMT000 100UV01Dev ice(); | |
213 | re ceiver.set Device(dev ice); | |
214 | ||
215 | // receiver/d evice/clas sCode | |
216 | de vice.setCl assCode(En tityClassD evice.DEV) ; | |
217 | ||
218 | // receiver/d evice/dete rminerCode | |
219 | de vice.setDe terminerCo de("INSTAN CE"); | |
220 | ||
221 | // receiver/d evice/id | |
222 | ii = factory .createII( ); | |
223 | ii .setRoot(" 1.3.6.1.4. 1.21367.20 09.1.3.1.1 45"); | |
224 | de vice.getId ().add(ii) ; | |
225 | ||
226 | // sender | |
227 | MC CIMT000100 UV01Sender sender = factory.cr eateMCCIMT 000100UV01 Sender(); | |
228 | re quest.setS ender(send er); | |
229 | ||
230 | // sender/typ eCode | |
231 | se nder.setTy peCode(Com munication FunctionTy pe.SND); | |
232 | ||
233 | // sender/dev ice | |
234 | de vice = fac tory.creat eMCCIMT000 100UV01Dev ice(); | |
235 | se nder.setDe vice(devic e); | |
236 | ||
237 | // sender/dev ice/classC ode | |
238 | de vice.setCl assCode(En tityClassD evice.DEV) ; | |
239 | ||
240 | // sender/dev ice/determ inerCode | |
241 | de vice.setDe terminerCo de("INSTAN CE"); | |
242 | ||
243 | // sender/dev ice/id | |
244 | ii = factory .createII( ); | |
245 | ii .setRoot(" 2.16.840.1 .113883.3. 2017.11.7" ); | |
246 | ii .setExtens ion(APP_CO NFIG.getPD WSSndDevId ()); | |
247 | de vice.getId ().add(ii) ; | |
248 | ||
249 | // sender/dev ice/asAgen t | |
250 | MC CIMT000100 UV01Agent agent = fa ctory.crea teMCCIMT00 0100UV01Ag ent(); | |
251 | de vice.setAs Agent(fact ory.create MCCIMT0001 00UV01Devi ceAsAgent( agent)); | |
252 | ||
253 | // sender/dev ice/asAgen t/classCod e | |
254 | ag ent.getCla ssCode().a dd("AGNT") ; | |
255 | ||
256 | // sender/dev ice/asAgen t/represen tedOrganiz ation | |
257 | MC CIMT000100 UV01Organi zation org anization = factory. createMCCI MT000100UV 01Organiza tion(); | |
258 | ag ent.setRep resentedOr ganization (factory.c reateMCCIM T000100UV0 1AgentRepr esentedOrg anization( organizati on)); | |
259 | ||
260 | // sender/dev ice/asAgen t/represen tedOrganiz ation/clas sCode | |
261 | or ganization .setClassC ode("ORG") ; | |
262 | ||
263 | // sender/dev ice/asAgen t/represen tedOrganiz ation/dete rminerCode | |
264 | or ganization .setDeterm inerCode(" INSTANCE") ; | |
265 | ||
266 | // sender/dev ice/asAgen t/represen tedOrganiz ation/id | |
267 | ii = factory .createII( ); | |
268 | if (AGENCY_D OD.equalsI gnoreCase( agency)) { | |
269 | ii.setRo ot("2.16.8 40.1.11388 3.3.42.100 02.100001. 8"); | |
270 | ii.setEx tension(dm isId); | |
271 | } else if (A GENCY_VA.e qualsIgnor eCase(agen cy)) { | |
272 | ii.setRo ot("2.16.8 40.1.11388 3.4.349"); | |
273 | ii.setEx tension(si teId); | |
274 | } | |
275 | or ganization .getId().a dd(ii); | |
276 | ||
277 | // controlAct Process | |
278 | PR PAIN201305 UV02QUQIMT 021001UV01 ControlAct Process co ntrolActPr ocess = fa ctory.crea tePRPAIN20 1305UV02QU QIMT021001 UV01Contro lActProces s(); | |
279 | re quest.setC ontrolActP rocess(con trolActPro cess); | |
280 | ||
281 | // controlAct Process/cl assCode | |
282 | co ntrolActPr ocess.setC lassCode(A ctClassCon trolAct.CA CT); | |
283 | ||
284 | // controlAct Process/mo odCode | |
285 | co ntrolActPr ocess.setM oodCode(XA ctMoodInte ntEvent.EV N); | |
286 | ||
287 | // controlAct Process/co de | |
288 | CD cd = fact ory.create CD(); | |
289 | cd .setCode(" PRPA_TE201 305UV02"); | |
290 | co ntrolActPr ocess.setC ode(cd); | |
291 | ||
292 | // controlAct Process/co deSystem | |
293 | cd .setCodeSy stem("2.16 .840.1.113 883.1.6"); | |
294 | ||
295 | // controlAct Process/da taEnterer | |
296 | QU QIMT021001 UV01DataEn terer data Enterer = factory.cr eateQUQIMT 021001UV01 DataEntere r(); | |
297 | co ntrolActPr ocess.getD ataEnterer ().add(dat aEnterer); | |
298 | ||
299 | // controlAct Process/da taEnterer/ typeCode | |
300 | da taEnterer. getTypeCod e().add("E NT"); | |
301 | ||
302 | // controlAct Process/da taEnterer/ contextCon trolCode | |
303 | da taEnterer. setContext ControlCod e("AP"); | |
304 | ||
305 | // controlAct Process/da taEnterer/ assignedPe rson | |
306 | CO CTMT090100 UV01Assign edPerson a ssignedPer son = fact ory.create COCTMT0901 00UV01Assi gnedPerson (); | |
307 | da taEnterer. setAssigne dPerson(as signedPers on); | |
308 | ||
309 | // controlAct Process/da taEnterer/ assignedPe rson/class Code | |
310 | as signedPers on.setClas sCode("ASS IGNED"); | |
311 | ||
312 | // controlAct Process/da taEnterer/ assignedPe rson/id | |
313 | ii = factory .createII( ); | |
314 | if (AGENCY_D OD.equalsI gnoreCase( agency)) { | |
315 | ii.setRo ot("2.16.8 40.1.11388 3.3.42.127 .100001.79 "); | |
316 | ii.setEx tension(us er.getUser Ien() + "^ " + dmisId ); | |
317 | } else if (A GENCY_VA.e qualsIgnor eCase(agen cy)) { | |
318 | ii.setRo ot("2.16.8 40.1.11388 3.4.349"); | |
319 | ii.setEx tension(us er.getUser Ien() + "^ " + siteId ); | |
320 | } | |
321 | as signedPers on.getId() .add(ii); | |
322 | ||
323 | // controlAct Process/da taEnterer/ assignedPe rson/Perso n | |
324 | CO CTMT090100 UV01Person person1 = factory.c reateCOCTM T090100UV0 1Person(); | |
325 | as signedPers on.setAssi gnedPerson (factory.c reateCOCTM T090100UV0 1AssignedP ersonAssig nedPerson( person1)); | |
326 | ||
327 | // controlAct Process/da taEnterer/ assignedPe rson/Perso n/name | |
328 | en = factory .createEN( ); | |
329 | en .getConten t().add(qu eryBean.ge tUser().ge tName()); | |
330 | pe rson1.getN ame().add( en); | |
331 | ||
332 | // controlAct Process/qu eryByParam eter | |
333 | PR PAMT201306 UV02QueryB yParameter queryByPa rameter = factory.cr eatePRPAMT 201306UV02 QueryByPar ameter(); | |
334 | co ntrolActPr ocess.setQ ueryByPara meter(fact ory.create PRPAIN2013 05UV02QUQI MT021001UV 01ControlA ctProcessQ ueryByPara meter(quer yByParamet er)); | |
335 | ||
336 | // controlAct Process/qu eryByParam eter/query Id | |
337 | ii = factory .createII( ); | |
338 | ii .setRoot(" 2.16.840.1 .113883.3. 2017"); | |
339 | ii .setExtens ion("33333 4433"); | |
340 | qu eryByParam eter.setQu eryId(ii); | |
341 | ||
342 | // controlAct Process/qu eryByParam eter/statu sCode | |
343 | cs = factory .createCS( ); | |
344 | cs .setCode(" new"); | |
345 | qu eryByParam eter.setSt atusCode(c s); | |
346 | ||
347 | // controlAct Process/qu eryByParam eter/initi alQuantity | |
348 | IN T i = fact ory.create INT(); | |
349 | i. setValue(B igInteger. valueOf(10 )); | |
350 | qu eryByParam eter.setIn itialQuant ity(i); | |
351 | ||
352 | // controlAct Process/qu eryByParam eter/param eterList | |
353 | PR PAMT201306 UV02Parame terList pa rameterLis t = factor y.createPR PAMT201306 UV02Parame terList(); | |
354 | qu eryByParam eter.setPa rameterLis t(paramete rList); | |
355 | ||
356 | // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctId | |
357 | if (!"".equa ls(queryBe an.getPati entId()) & & !"".equa ls(queryBe an.getPati entIdType( ))) { | |
358 | ii = fac tory.creat eII(); | |
359 | ii.setEx tension(qu eryBean.ge tPatientId ()); | |
360 | ||
361 | String t ype = quer yBean.getP atientIdTy pe(); | |
362 | if ("SSN ".equalsIg noreCase(t ype)) { | |
363 | ii.s etRoot("2. 16.840.1.1 13883.4.1" ); | |
364 | } else i f ("TIN".e qualsIgnor eCase(type )) { | |
365 | ii.s etRoot("2. 16.840.1.1 13883.3.42 .10001.100 001.225"); | |
366 | } else i f ("FIN".e qualsIgnor eCase(type )) { | |
367 | ii.s etRoot("2. 16.840.1.1 13883.3.42 .10001.100 001.224"); | |
368 | } else i f ("ITIN". equalsIgno reCase(typ e)) { | |
369 | ii.s etRoot("2. 16.840.1.1 13883.4.2" ); | |
370 | } else i f ("PIN".e qualsIgnor eCase(type )) { | |
371 | ii.s etRoot("2. 16.840.1.1 13883.3.42 .10001.100 001.226"); | |
372 | } else i f ("EDIPI" .equalsIgn oreCase(ty pe)) { | |
373 | ii.s etRoot("2. 16.840.1.1 13883.3.42 .10001.100 001.12"); | |
374 | } | |
375 | ||
376 | PRPAMT20 1306UV02Li vingSubjec tId living SubjectId = factory. createPRPA MT201306UV 02LivingSu bjectId(); | |
377 | livingSu bjectId.ge tValue().a dd(ii); | |
378 | paramete rList.getL ivingSubje ctId().add (livingSub jectId); | |
379 | ||
380 | //contro lActProces s/queryByP arameter/p arameterLi st/livingS ubjectId/s emanticsTe xt | |
381 | st = fac tory.creat eST(); | |
382 | st.getCo ntent().ad d("LivingS ubject.id" ); | |
383 | livingSu bjectId.se tSemantics Text(st); | |
384 | } | |
385 | ||
386 | // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctAdminist rativeGend er | |
387 | if (queryBea n.getGende r() != nul l) { | |
388 | PRPAMT20 1306UV02Li vingSubjec tAdministr ativeGende r adminGen der = fact ory.create PRPAMT2013 06UV02Livi ngSubjectA dministrat iveGender( ); | |
389 | CE ce = factory.cr eateCE(); | |
390 | ce.setCo de(queryBe an.getGend er()); | |
391 | adminGen der.getVal ue().add(c e); | |
392 | paramete rList.getL ivingSubje ctAdminist rativeGend er().add(a dminGender ); | |
393 | ||
394 | //contro lActProces s/queryByP arameter/p arameterLi st/livingS ubjectAdmi nistrative Gender/sem anticsText | |
395 | st = fac tory.creat eST(); | |
396 | st.getCo ntent().ad d("LivingS ubject.adm inistrativ eGender"); | |
397 | adminGen der.setSem anticsText (st); | |
398 | } | |
399 | ||
400 | // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctBirthTim e | |
401 | PR PAMT201306 UV02Living SubjectBir thTime bir thTime = f actory.cre atePRPAMT2 01306UV02L ivingSubje ctBirthTim e(); | |
402 | IV LTS ivlts = factory. createIVLT S(); | |
403 | iv lts.setVal ue(queryBe an.getDob( )); | |
404 | bi rthTime.ge tValue().a dd(ivlts); | |
405 | pa rameterLis t.getLivin gSubjectBi rthTime(). add(birthT ime); | |
406 | ||
407 | // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctBirthTim e/semantic sText | |
408 | st = factory .createST( ); | |
409 | st .getConten t().add("L ivingSubje ct.birthTi me"); | |
410 | bi rthTime.se tSemantics Text(st); | |
411 | ||
412 | // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctName | |
413 | PR PAMT201306 UV02Living SubjectNam e name = f actory.cre atePRPAMT2 01306UV02L ivingSubje ctName(); | |
414 | en = factory .createEN( ); | |
415 | en .getUse(). add("L"); | |
416 | ||
417 | if (StringUt ils.isNotB lank(query Bean.getFi rstName()) ) { | |
418 | enGiven = factory. createEnGi ven(); | |
419 | enGiven. getContent ().add(que ryBean.get FirstName( )); | |
420 | en.getCo ntent().ad d(factory. createENGi ven(enGive n)); | |
421 | } | |
422 | ||
423 | if (StringUt ils.isNotB lank(query Bean.getMi ddleName() )) { | |
424 | enGiven = factory. createEnGi ven(); | |
425 | enGiven. getContent ().add(que ryBean.get MiddleName ()); | |
426 | en.getCo ntent().ad d(factory. createENGi ven(enGive n)); | |
427 | } | |
428 | ||
429 | if (StringUt ils.isNotB lank(query Bean.getLa stName())) { | |
430 | EnFamily enFamily = factory. createEnFa mily(); | |
431 | enFamily .getConten t().add(qu eryBean.ge tLastName( )); | |
432 | en.getCo ntent().ad d(factory. createENFa mily(enFam ily)); | |
433 | } | |
434 | ||
435 | na me.getValu e().add(en ); | |
436 | pa rameterLis t.getLivin gSubjectNa me().add(n ame); | |
437 | ||
438 | // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctName/sem anticsText | |
439 | st = factory .createST( ); | |
440 | st .getConten t().add("L ivingSubje ct.name"); | |
441 | na me.setSema nticsText( st); | |
442 | ||
443 | // controlAct Process/qu eryByParam eter/param eterList/p atientAddr ess/value | |
444 | PR PAMT201306 UV02Patien tAddress a ddress = f actory.cre atePRPAMT2 01306UV02P atientAddr ess(); | |
445 | ad = factory .createAD( ); | |
446 | ad .getUse(). add("HP"); | |
447 | ||
448 | // controlAct Process/qu eryByParam eter/param eterList/p atientAddr ess/value/ [@use="HP" ]/streetAd dressLine | |
449 | if (StringUt ils.isNotB lank(query Bean.getAd dress())) { | |
450 | AdxpStre etAddressL ine addres sLine = fa ctory.crea teAdxpStre etAddressL ine(); | |
451 | addressL ine.getCon tent().add (queryBean .getAddres s()); | |
452 | ad.getCo ntent().ad d(factory. createADSt reetAddres sLine(addr essLine)); | |
453 | } | |
454 | ||
455 | // controlAct Process/qu eryByParam eter/param eterList/p atientAddr ess/value/ [@use="HP" ]/city | |
456 | if (StringUt ils.isNotB lank(query Bean.getCi ty())) { | |
457 | AdxpCity city = fa ctory.crea teAdxpCity (); | |
458 | city.get Content(). add(queryB ean.getCit y()); | |
459 | ad.getCo ntent().ad d(factory. createADCi ty(city)); | |
460 | } | |
461 | ||
462 | // controlAct Process/qu eryByParam eter/param eterList/p atientAddr ess/value/ [@use="HP" ]/state | |
463 | if (StringUt ils.isNotB lank(query Bean.getSt ate())) { | |
464 | AdxpStat e state = factory.cr eateAdxpSt ate(); | |
465 | state.ge tContent() .add(query Bean.getSt ate()); | |
466 | ad.getCo ntent().ad d(factory. createADSt ate(state) ); | |
467 | } | |
468 | ||
469 | // controlAct Process/qu eryByParam eter/param eterList/p atientAddr ess/value/ [@use="HP" ]/zip | |
470 | if (StringUt ils.isNotB lank(query Bean.getZi p())) { | |
471 | AdxpPost alCode zip = factory .createAdx pPostalCod e(); | |
472 | zip.getC ontent().a dd(queryBe an.getZip( )); | |
473 | ad.getCo ntent().ad d(factory. createADPo stalCode(z ip)); | |
474 | } | |
475 | ||
476 | ad dress.getV alue().add (ad); | |
477 | pa rameterLis t.getPatie ntAddress( ).add(addr ess); | |
478 | ||
479 | // controlAct Process/qu eryByParam eter/param eterList/o therIDsSco pingOrgani zation | |
480 | PR PAMT201306 UV02OtherI DsScopingO rganizatio n otherIDs ScopingOrg anization = factory. createPRPA MT201306UV 02OtherIDs ScopingOrg anization( ); | |
481 | pa rameterLis t.getOther IDsScoping Organizati on().add(o therIDsSco pingOrgani zation); | |
482 | ||
483 | // controlAct Process/qu eryByParam eter/param eterList/o therIDsSco pingOrgani zation/val ue/id | |
484 | ii = factory .createII( ); | |
485 | ii .setRoot(" 2.16.840.1 .113883.4. 1"); | |
486 | ot herIDsScop ingOrganiz ation.getV alue().add (ii); | |
487 | ||
488 | // controlAct Process/qu eryByParam eter/param eterList/o therIDsSco pingOrgani zation/sem anticsText | |
489 | st = factory .createST( ); | |
490 | st .getConten t().add("O therIDs.sc opingOrgan ization.id "); | |
491 | ot herIDsScop ingOrganiz ation.setS emanticsTe xt(st); | |
492 | ||
493 | // controlAct Process/qu eryByParam eter/param eterList/p atientTelc om | |
494 | if (StringUt ils.isNotB lank(query Bean.getTe l())) { | |
495 | PRPAMT20 1306UV02Pa tientTelec om telecom = factory .createPRP AMT201306U V02Patient Telecom(); | |
496 | TEL tel = factory. createTEL( ); | |
497 | tel.setV alue(query Bean.getTe l()); | |
498 | tel.getU se().add(" H"); | |
499 | telecom. getValue() .add(tel); | |
500 | paramete rList.getP atientTele com().add( telecom); | |
501 | } | |
502 | ||
503 | re turn reque st; | |
504 | } | |
505 | ||
506 | privat e Response PatientQue ry parseRe sponse(PRP AIN201306U V02 respon se, String inquiryTy pe) { | |
507 | Re sponsePati entQuery r espPatQuer y = new Re sponsePati entQuery() ; | |
508 | bo olean done = false; | |
509 | ||
510 | // Initially set to fa ilure with generic e rror messa ge. Will o nly be | |
511 | // set to su ccess if t here are n o acknowle dgement er rors and n o | |
512 | // errors re trieving p atient lis t, even if the list is empty | |
513 | re spPatQuery .setSucces s(false); | |
514 | re spPatQuery .setErrorM sg("Error retrieving patients. " | |
515 | + "< br><br>Ple ase try ag ain." | |
516 | + "< br><br>If the proble m persists , notify y our system administr ator or he lp desk.") ; | |
517 | ||
518 | // Create li st of resu lt patient s | |
519 | Li st<Patient > resultPa tientList = new Arra yList<Pati ent>(); | |
520 | ||
521 | if (response != null) { | |
522 | if (resp onse.getAc knowledgem ent() != n ull) { | |
523 | Ackn owledgemen tDetailTyp e ackDetai lTypeCode; | |
524 | Stri ng ackCode ; | |
525 | Stri ng ackDeta ilCode; | |
526 | Stri ng display Message; | |
527 | CS c s; | |
528 | CE c e; | |
529 | ||
530 | for (MCCIMT000 300UV01Ack nowledgeme nt acknowl edgement : response. getAcknowl edgement() ) { | |
531 | cs = ackno wledgement .getTypeCo de(); | |
532 | if (cs == null) { co ntinue; } | |
533 | ||
534 | ackCode = cs.getCode (); | |
535 | ||
536 | if (acknow ledgement. getAcknowl edgementDe tail() == null) { co ntinue; } | |
537 | for (MCCIM T000300UV0 1Acknowled gementDeta il ackDeta il : ackno wledgement .getAcknow ledgementD etail()) { | |
538 | ackDet ailTypeCod e = ackDet ail.getTyp eCode(); | |
539 | ||
540 | ce = a ckDetail.g etCode(); | |
541 | if (ce == null) { continue ; } | |
542 | ||
543 | ackDet ailCode = ce.getCode (); | |
544 | displa yMessage = ce.getDis playName() ; | |
545 | ||
546 | if ("A A".equalsI gnoreCase( ackCode)) { | |
547 | if (ackDetai lTypeCode == Acknowl edgementDe tailType.W | |
548 | && a ckDetailCo de.contain s("PN") || ackDetail Code.conta ins("FM")) { | |
549 | respPatQ uery.setEr rorMsg(dis playMessag e); | |
550 | } | |
551 | } else if ("AE". equalsIgno reCase(ack Code) | |
552 | && ackDe tailTypeCo de == Ackn owledgemen tDetailTyp e.E | |
553 | && !ackD etailCode. contains(" PN") && !a ckDetailCo de.contain s("FM")) { | |
554 | re spPatQuery .setErrorM sg(display Message); | |
555 | re spPatQuery .setSucces s(false); | |
556 | do ne = true; | |
557 | br eak; | |
558 | } | |
559 | } | |
560 | } | |
561 | } | |
562 | if (!don e) { | |
563 | PRPA IN201306UV 02MFMIMT70 0711UV01Co ntrolActPr ocess cont rolActProc ess = resp onse.getCo ntrolActPr ocess(); | |
564 | if ( (controlAc tProcess ! = null) && (controlA ctProcess. getSubject () != null )) { | |
565 | PRPAIN2013 06UV02MFMI MT700711UV 01Registra tionEvent registrati onEvent; | |
566 | PRPAIN2013 06UV02MFMI MT700711UV 01Subject2 subject1; | |
567 | PRPAMT2013 10UV02Pati ent patien t; | |
568 | PRPAMT2013 10UV02Pers on patient Person; | |
569 | CE ce; | |
570 | TS ts; | |
571 | CS cs; | |
572 | SC sc; | |
573 | Code code; | |
574 | List<Patie nt> person alRelation shipList; | |
575 | Patient re sultPatien t; | |
576 | PatientDem ographics resultDemo graphics; | |
577 | PatientDem ographics tempDemogr aphics; | |
578 | ||
579 | for (PRPAI N201306UV0 2MFMIMT700 711UV01Sub ject1 subj ect : cont rolActProc ess.getSub ject()) { | |
580 | regist rationEven t = subjec t.getRegis trationEve nt(); | |
581 | if (re gistration Event == n ull) { con tinue; } | |
582 | ||
583 | subjec t1 = regis trationEve nt.getSubj ect1(); | |
584 | if (su bject1 == null) { co ntinue; } | |
585 | ||
586 | patien t = subjec t1.getPati ent(); | |
587 | if (pa tient == n ull) { con tinue; } | |
588 | ||
589 | result Patient = new Patien t(); | |
590 | result Demographi cs = new P atientDemo graphics() ; | |
591 | tempDe mographics = new Pat ientDemogr aphics(); | |
592 | ||
593 | // Pat ient EDIPI | |
594 | if (pa tient.getI d() != nul l) { | |
595 | fo r (II ii : patient.g etId()) { | |
596 | resultPa tient.setE DIPI(ii.ge tExtension ()); | |
597 | } | |
598 | } | |
599 | ||
600 | if (pa tient.getP atientPers on() != nu ll) { | |
601 | pa tientPerso n = patien t.getPatie ntPerson() .getValue( ); | |
602 | if (patientP erson != n ull) { | |
603 | // Patie nt gender | |
604 | ce = pat ientPerson .getAdmini strativeGe nderCode() ; | |
605 | if (ce ! = null) { | |
606 | resu ltPatient. setGender( ce.getCode ()); | |
607 | } | |
608 | ||
609 | // Patie nt date of birth | |
610 | ts = pat ientPerson .getBirthT ime(); | |
611 | if (ts ! = null) { | |
612 | resu ltPatient. setDob(ts. getValue() ); | |
613 | } | |
614 | ||
615 | // Patie nt name | |
616 | if (pati entPerson. getName() != null) { | |
617 | for (PN pn : p atientPers on.getName ()) { | |
618 | if (pn.get Use() == n ull) { con tinue; } | |
619 | for (Strin g use : pn .getUse()) { | |
620 | if ("L ".equalsIg noreCase(u se)) { | |
621 | re sultPatien t.setName( parseName( pn)); | |
622 | } | |
623 | } | |
624 | } | |
625 | } | |
626 | // Patie nt SSN | |
627 | if (pati entPerson. getAsOther IDs() != n ull) { | |
628 | for (PRPAMT201 310UV02Oth erIDs othe rIDs : pat ientPerson .getAsOthe rIDs()) { | |
629 | if (otherI Ds.getId() == null) { continue ; } | |
630 | for (II ii : otherID s.getId()) { | |
631 | cs = o therIDs.ge tStatusCod e(); | |
632 | if (cs == null) { continue ; } | |
633 | if ("2 .16.840.1. 113883.4.1 ".equalsIg noreCase(i i.getRoot( )) | |
634 | && "acti ve".equals IgnoreCase (cs.getCod e())) { | |
635 | re sultPatien t.setSSN(i i.getExten sion()); | |
636 | } | |
637 | } | |
638 | } | |
639 | } | |
640 | if ("PR" .equalsIgn oreCase(in quiryType) ) { | |
641 | // P atient ran k | |
642 | if ( patientPer son.getAsE mployee() != null) { | |
643 | for (PRPAM T201310UV0 2Employee employee : patientPe rson.getAs Employee() ) { | |
644 | sc = e mployee.ge tJobTitleN ame(); | |
645 | if (sc == null) { continue ; } | |
646 | result Demographi cs.setRank (sc.getDis playName() ); | |
647 | } | |
648 | } | |
649 | ||
650 | // P atient rac e code | |
651 | if ( patientPer son.getRac eCode() != null) { | |
652 | code = new Code(); | |
653 | for (CE ce 1 : patien tPerson.ge tRaceCode( )) { | |
654 | code.s etCode(ce1 .getCode() ); | |
655 | code.s etSystem(C odingSyste m.CDC_RACE .getDispla yName()); | |
656 | result Demographi cs.getRace ().add(cod e); | |
657 | } | |
658 | } | |
659 | ||
660 | // P atient hom e & work t elephone n umbers | |
661 | if ( patientPer son.getTel ecom() != null) { | |
662 | for (TEL t el : patie ntPerson.g etTelecom( )) { | |
663 | if ((t el.getUse( ) == null) | |
664 | || (tel. getUse().s ize() > 1) | |
665 | || (tel. getValue() .contains( "mailto")) | |
666 | || (tel. getValue() .contains( "@"))) { | |
667 | co ntinue; | |
668 | } | |
669 | for (S tring use : tel.getU se()) { | |
670 | if ("HP".equ alsIgnoreC ase(use)) { | |
671 | resultDe mographics .setPhone1 (parsePhon eNumber(te l.getValue ())); | |
672 | } else if (" WP".equals IgnoreCase (use)) { | |
673 | resultDe mographics .setPhone2 (parsePhon eNumber(te l.getValue ())); | |
674 | } | |
675 | } | |
676 | } | |
677 | } | |
678 | ||
679 | // P atient's a ddress | |
680 | pars eAddress(p atientPers on, tempDe mographics ); | |
681 | ||
682 | // S ponsors | |
683 | pers onalRelati onshipList = parsePe rsonalRela tionship(p atientPers on); | |
684 | if ( (personalR elationshi pList != n ull) && (! personalRe lationship List.isEmp ty())) { | |
685 | resultPati ent.setSpo nsorSSN(pe rsonalRela tionshipLi st.get(0). getSSN()); | |
686 | resultDemo graphics.s etSponsorN ame(person alRelation shipList.g et(0).getN ame()); | |
687 | } | |
688 | } else i f ("FR".eq ualsIgnore Case(inqui ryType)) { | |
689 | // F amily memb ers (depen dents) | |
690 | pers onalRelati onshipList = parsePe rsonalRela tionship(p atientPers on); | |
691 | if ( personalRe lationship List != nu ll) { | |
692 | for (Patie nt patient 1 : person alRelation shipList) { | |
693 | // Set sponsor S SN for eac h family m ember | |
694 | patien t1.setSpon sorSSN(res ultPatient .getSSN()) ; | |
695 | } | |
696 | resultPati entList.ad dAll(perso nalRelatio nshipList) ; | |
697 | } | |
698 | } | |
699 | } | |
700 | } | |
701 | if (!" FR".equals IgnoreCase (inquiryTy pe)) { | |
702 | // Set patie nt data | |
703 | re sultPatien tList.add( resultPati ent); | |
704 | } | |
705 | if ("P R".equalsI gnoreCase( inquiryTyp e)) { | |
706 | // Patient's primary c are manage r (PCM) | |
707 | pa rsePrimary CareManage r(patient, tempDemog raphics); | |
708 | ||
709 | // Set demog raphics da ta | |
710 | re sultDemogr aphics.set EDIPI(resu ltPatient. getEDIPI() ); | |
711 | re sultDemogr aphics.set SSN(result Patient.ge tSSN()); | |
712 | re sultDemogr aphics.set Name(resul tPatient.g etName()); | |
713 | re sultDemogr aphics.set Gender(res ultPatient .getGender ()); | |
714 | re sultDemogr aphics.set Dob(result Patient.ge tDob()); | |
715 | re sultDemogr aphics.set Address1(t empDemogra phics.getA ddress1()) ; | |
716 | re sultDemogr aphics.set Address2(t empDemogra phics.getA ddress2()) ; | |
717 | re sultDemogr aphics.set City(tempD emographic s.getCity( )); | |
718 | re sultDemogr aphics.set State(temp Demographi cs.getStat e()); | |
719 | re sultDemogr aphics.set ZipCode(te mpDemograp hics.getZi pCode()); | |
720 | re sultDemogr aphics.set PrimaryPro vider(temp Demographi cs.getPrim aryProvide r()); | |
721 | re sultDemogr aphics.set PcmDates(t empDemogra phics.getP cmDates()) ; | |
722 | re sultDemogr aphics.set PcmClinic( tempDemogr aphics.get PcmClinic( )); | |
723 | re spPatQuery .setDemogr aphics(res ultDemogra phics); | |
724 | } | |
725 | } | |
726 | respPatQue ry.setSucc ess(true); | |
727 | respPatQue ry.setErro rMsg(null) ; | |
728 | respPatQue ry.setPati ents(resul tPatientLi st); | |
729 | } | |
730 | } | |
731 | } | |
732 | re turn respP atQuery; | |
733 | } | |
734 | ||
735 | privat e void par seAddress( PRPAMT2013 10UV02Pers on person, PatientDe mographics patientDe mographics ) { | |
736 | Li st<String> streetAdd ressList = new Array List<Strin g>(); | |
737 | Li st<Seriali zable> ser ializableL ist; | |
738 | Ob ject objec t; | |
739 | Bo olean isBa dAddress; | |
740 | Bo olean isHo mePrimary; | |
741 | Bo olean isTe mpAddress; | |
742 | ||
743 | // Check for home prim ary addres s and bad address | |
744 | fo r (AD ad : person.ge tAddr()) { | |
745 | isBadAdd ress = fal se; | |
746 | isHomePr imary = fa lse; | |
747 | isTempAd dress = fa lse; | |
748 | ||
749 | if (ad.g etUse() == null) { c ontinue; } | |
750 | ||
751 | for (Str ing use : ad.getUse( )) { | |
752 | if ( use.contai ns("HP")) { | |
753 | isHomePrim ary = true ; | |
754 | } el se if (use .contains( "BAD")) { | |
755 | isBadAddre ss = true; | |
756 | } el se if (use .contains( "TMP")) { | |
757 | isTempAddr ess = true ; | |
758 | } | |
759 | } | |
760 | ||
761 | // If no t home pri mary addre ss or addr ess is bad or addres s content is null, t hen skip t o next | |
762 | if ((!is HomePrimar y && !isTe mpAddress) || isBadA ddress || (ad.getCon tent() == null)) { c ontinue; } | |
763 | ||
764 | streetAd dressList. clear(); | |
765 | ||
766 | patientD emographic s.setAddre ss1(""); | |
767 | patientD emographic s.setAddre ss2(""); | |
768 | patientD emographic s.setCity( ""); | |
769 | patientD emographic s.setState (""); | |
770 | patientD emographic s.setZipCo de(""); | |
771 | ||
772 | for (Ser ializable serializab le : ad.ge tContent() ) { | |
773 | if ( serializab le instanc eof JAXBEl ement) { | |
774 | object = ( (JAXBEleme nt) serial izable).ge tValue(); | |
775 | if (object == null) { continue ; } | |
776 | ||
777 | // Street address | |
778 | if (object instanceo f AdxpStre etAddressL ine) { | |
779 | serial izableList = ((AdxpS treetAddre ssLine) ob ject).getC ontent(); | |
780 | if ((s erializabl eList != n ull) && !s erializabl eList.isEm pty()) { | |
781 | st reetAddres sList.add( serializab leList.get (0).toStri ng()); | |
782 | } | |
783 | } else if (object in stanceof A dxpCity) { // City | |
784 | serial izableList = ((AdxpC ity) objec t).getCont ent(); | |
785 | if ((s erializabl eList != n ull) && !s erializabl eList.isEm pty()) { | |
786 | pa tientDemog raphics.se tCity(seri alizableLi st.get(0). toString() ); | |
787 | } | |
788 | } else if (object in stanceof A dxpState) { // State | |
789 | serial izableList = ((AdxpS tate) obje ct).getCon tent(); | |
790 | if ((s erializabl eList != n ull) && !s erializabl eList.isEm pty()) { | |
791 | pa tientDemog raphics.se tState(ser ializableL ist.get(0) .toString( )); | |
792 | } | |
793 | } | |
794 | // Zip cod e | |
795 | if (object instanceo f AdxpPost alCode) { | |
796 | serial izableList = ((AdxpP ostalCode) object).g etContent( ); | |
797 | if ((s erializabl eList != n ull) && !s erializabl eList.isEm pty()) { | |
798 | pa tientDemog raphics.se tZipCode(s erializabl eList.get( 0).toStrin g()); | |
799 | } | |
800 | } | |
801 | } | |
802 | } | |
803 | ||
804 | // Set s treet addr ess from l ist | |
805 | if (!str eetAddress List.isEmp ty()) { | |
806 | pati entDemogra phics.setA ddress1(st reetAddres sList.get( 0)); | |
807 | ||
808 | if ( streetAddr essList.si ze() > 1) { | |
809 | patientDem ographics. setAddress 2(streetAd dressList. get(1)); | |
810 | } | |
811 | } | |
812 | } | |
813 | } | |
814 | ||
815 | privat e void par sePrimaryC areManager (PRPAMT201 310UV02Pat ient patie nt, Patien tDemograph ics patien tDemograph ics) { | |
816 | if (patient. getCovered PartyOf() == null) { return; } | |
817 | ||
818 | CO CTMT510000 UV06Covera geRecord c overageRec ord; | |
819 | CO CTMT510000 UV06Policy OrProgram policyOrPr ogram; | |
820 | CO CTMT510000 UV06Benefi t benefit; | |
821 | CO CTMT530000 UVObservat ion observ ation; | |
822 | CO CTMT090000 UV01Assign edEntity a ssignedEnt ity; | |
823 | CO CTMT090000 UV01Person person; | |
824 | IV LTS ivlts; | |
825 | IV XBTS ivxbt s; | |
826 | ||
827 | fo r (PRPAMT2 01310UV02C overedPart y coveredP arty : pat ient.getCo veredParty Of()) { | |
828 | coverage Record = c overedPart y.getCover ageRecord( ); | |
829 | if (cove rageRecord == null) { continue ; } | |
830 | ||
831 | if (cove rageRecord .getCompon ent() == n ull) { con tinue; } | |
832 | ||
833 | for (COC TMT510000U V06Compone nt compone nt : cover ageRecord. getCompone nt()) { | |
834 | if ( component. getPolicyO rProgram() == null) { continue ; } | |
835 | ||
836 | poli cyOrProgra m = compon ent.getPol icyOrProgr am(); | |
837 | for (COCTMT510 000UV06Cov erage2 cov erage2 : p olicyOrPro gram.getCo verageOf() ) { | |
838 | if (covera ge2.getBen efit() == null) { co ntinue; } | |
839 | ||
840 | benefit = coverage2. getBenefit (); | |
841 | for (COCTM T510000UV0 6Definitio n definiti on : benef it.getDefi nition()) { | |
842 | if (de finition.g etObservat ion() == n ull) { con tinue; } | |
843 | ||
844 | observ ation = de finition.g etObservat ion().getV alue(); | |
845 | if (ob servation == null) { continue; } | |
846 | ||
847 | if (ob servation. getPerform er() == nu ll) { cont inue; } | |
848 | for (C OCTMT53000 0UVPerform er perform er : obser vation.get Performer( )) { | |
849 | if (performe r.getAssig nedEntity( ) == null) { continu e; } | |
850 | ||
851 | as signedEnti ty = perfo rmer.getAs signedEnti ty().getVa lue(); | |
852 | if (assigned Entity == null) { co ntinue; } | |
853 | ||
854 | if (patientDe mographics .getPrimar yProvider( ) == null) { | |
855 | patientD emographic s.setPrima ryProvider (""); | |
856 | } | |
857 | // patientDem ographics. setPcmDate s(null); | |
858 | if (patientDe mographics .getPcmCli nic() == n ull){ | |
859 | patientD emographic s.setPcmCl inic(""); | |
860 | } | |
861 | ||
862 | // PCM name | |
863 | if (assigned Entity.get AssignedPe rson() != null) { | |
864 | person = assignedE ntity.getA ssignedPer son().getV alue(); | |
865 | if ((per son != nul l) && (per son.getNam e() != nul l)) { | |
866 | for (EN en : p erson.getN ame()) { | |
867 | if (en.get Content() == null) { continue; } | |
868 | for (Seria lizable co ntent : en .getConten t()) { | |
869 | patien tDemograph ics.setPri maryProvid er(content .toString( )); | |
870 | } | |
871 | } | |
872 | } | |
873 | } | |
874 | ||
875 | // PCM date | |
876 | if (assigned Entity.get EffectiveT ime() != n ull) { | |
877 | ivlts = assignedEn tity.getEf fectiveTim e(); | |
878 | if (ivlt s.getRest( ) != null) { | |
879 | for (JAXBEleme nt element : ivlts.g etRest()) { | |
880 | if (!"low" .equalsIgn oreCase(el ement.getN ame().getL ocalPart() )) { conti nue; } | |
881 | ||
882 | ivxbts = ( IVXBTS) el ement.getV alue(); | |
883 | if (ivxbts == null) { continue ; } | |
884 | ||
885 | // YYYYMMD D format ( 8 characte rs) | |
886 | if (ivxbts .getValue( ).length() != 8) { c ontinue; } | |
887 | patientDem ographics. setPcmDate s(Utils.to XMLGregori anCalendar (ivxbts.ge tValue())) ; | |
888 | } | |
889 | } | |
890 | } | |
891 | ||
892 | // PCM clini c | |
893 | // Note: Cur rently PDW S does not return th e PCM clin ic. Set to empty str ing until | |
894 | // PDWS retu rns the cl inic name. | |
895 | } | |
896 | } | |
897 | } | |
898 | } | |
899 | } | |
900 | } | |
901 | ||
902 | privat e String p arseName(E N en) { | |
903 | St ringBuilde r familyNa me = new S tringBuild er(); | |
904 | St ringBuilde r givenNam e = new St ringBuilde r(); | |
905 | St ringBuilde r prefixNa me = new S tringBuild er(); | |
906 | St ringBuilde r suffixNa me = new S tringBuild er(); | |
907 | Li st<Seriali zable> ser ializableL ist1; | |
908 | Li st<Seriali zable> ser ializableL ist2; | |
909 | St ring rtc; | |
910 | Ob ject objec t; | |
911 | ||
912 | se rializable List1 = en .getConten t(); | |
913 | if (serializ ableList1 == null) { | |
914 | rtc = nu ll; | |
915 | } else { | |
916 | ||
917 | for (Ser ializable serializab le1 : seri alizableLi st1) { | |
918 | if ( !(serializ able1 inst anceof JAX BElement)) { continu e; } | |
919 | ||
920 | obje ct = ((JAX BElement) serializab le1).getVa lue(); | |
921 | if ( object == null) { co ntinue; } | |
922 | ||
923 | if ( object ins tanceof En Family) { | |
924 | serializab leList2 = ((EnFamily ) object). getContent (); | |
925 | if (serial izableList 2 == null) { continu e; } | |
926 | ||
927 | for (Seria lizable se rializable 2 : serial izableList 2) { | |
928 | family Name.appen d(serializ able2.toSt ring()); | |
929 | family Name.appen d(" "); | |
930 | } | |
931 | } el se if (obj ect instan ceof EnGiv en) { | |
932 | serializab leList2 = ((EnGiven) object).g etContent( ); | |
933 | if (serial izableList 2 == null) { continu e; } | |
934 | ||
935 | for (Seria lizable se rializable 2 : serial izableList 2) { | |
936 | givenN ame.append (serializa ble2.toStr ing()); | |
937 | givenN ame.append (" "); | |
938 | } | |
939 | } el se if (obj ect instan ceof EnPre fix) { | |
940 | serializab leList2 = ((EnPrefix ) object). getContent (); | |
941 | if (serial izableList 2 == null) { continu e; } | |
942 | ||
943 | for (Seria lizable se rializable 2 : serial izableList 2) { | |
944 | prefix Name.appen d(serializ able2.toSt ring()); | |
945 | prefix Name.appen d(" "); | |
946 | } | |
947 | } el se if (obj ect instan ceof EnSuf fix) { | |
948 | serializab leList2 = ((EnSuffix ) object). getContent (); | |
949 | if (serial izableList 2 == null) { continu e; } | |
950 | ||
951 | for (Seria lizable se rializable 2 : serial izableList 2) { | |
952 | suffix Name.appen d(serializ able2.toSt ring()); | |
953 | suffix Name.appen d(" "); | |
954 | } | |
955 | } | |
956 | } | |
957 | ||
958 | // add p refix befo re given n ame | |
959 | if (pref ixName.len gth() > 0) { | |
960 | give nName = pr efixName.a ppend(give nName); | |
961 | } | |
962 | ||
963 | // add s uffix afte r family n ame | |
964 | if (suff ixName.len gth() > 0) { | |
965 | fami lyName.app end(suffix Name); | |
966 | } | |
967 | ||
968 | rtc = fa milyName.t oString(). trim() + " ," + given Name.toStr ing().trim (); | |
969 | } | |
970 | re turn rtc; | |
971 | } | |
972 | ||
973 | privat e String p arsePhoneN umber(Stri ng telecom ) { | |
974 | St ringBuilde r phoneNum ber = new StringBuil der(); | |
975 | St ringTokeni zer tokeni zer = new StringToke nizer(tele com, " "); | |
976 | St ring token ; | |
977 | ch ar code; | |
978 | ||
979 | wh ile (token izer.hasMo reTokens() ) { | |
980 | token = tokenizer. nextToken( ); | |
981 | code = t oken.toLow erCase(Loc ale.getDef ault()).ch arAt(0); | |
982 | // Do no t accept t okens that begin wit h (p)riori ty, (y)es text, (n)o text | |
983 | if ((cod e != 'p') && (code ! = 'y') && (code != ' n')) { | |
984 | phon eNumber.ap pend(token ); | |
985 | phon eNumber.ap pend(" "); | |
986 | } | |
987 | } | |
988 | ||
989 | re turn phone Number.toS tring().tr im(); | |
990 | } | |
991 | ||
992 | privat e List<Pat ient> pars ePersonalR elationshi p(PRPAMT20 1310UV02Pe rson perso n) { | |
993 | Li st<Patient > patientL ist = new ArrayList< Patient>() ; | |
994 | ||
995 | if (person.g etPersonal Relationsh ip() != nu ll) { | |
996 | COCTMT03 0007UVPers on person1 ; | |
997 | Patient patient; | |
998 | ||
999 | for (PRP AMT201310U V02Persona lRelations hip person alRelation ship : per son.getPer sonalRelat ionship()) { | |
1000 | if ( personalRe lationship .getRelati onshipHold er1() == n ull) { con tinue; } | |
1001 | ||
1002 | pers on1 = pers onalRelati onship.get Relationsh ipHolder1( ).getValue (); | |
1003 | if ( person1 == null) { c ontinue; } | |
1004 | ||
1005 | pati ent = new Patient(); | |
1006 | ||
1007 | // E DIPI | |
1008 | if ( person1.ge tId() != n ull) { | |
1009 | for (II ii : person1 .getId()) { | |
1010 | if ("2 .16.840.1. 113883.3.4 2.10001.10 0001.12".e qualsIgnor eCase(ii.g etRoot())) { | |
1011 | pa tient.setE DIPI(ii.ge tExtension ()); | |
1012 | } | |
1013 | } | |
1014 | } | |
1015 | ||
1016 | // N ame | |
1017 | if ( person1.ge tName() != null) { | |
1018 | for (EN en : person1 .getName() ) { | |
1019 | if (en .getUse() == null) { continue; } | |
1020 | for (S tring use : en.getUs e()) { | |
1021 | if ("L".equa lsIgnoreCa se(use)) { | |
1022 | patient. setName(pa rseName(en )); | |
1023 | } | |
1024 | } | |
1025 | } | |
1026 | } | |
1027 | ||
1028 | // G ender | |
1029 | if ( person1.ge tAdministr ativeGende rCode() != null) { | |
1030 | patient.se tGender(pe rson1.getA dministrat iveGenderC ode().getC ode()); | |
1031 | } | |
1032 | ||
1033 | // D ate of bir th | |
1034 | if ( person1.ge tBirthTime () != null ) { | |
1035 | patient.se tDob(perso n1.getBirt hTime().ge tValue()); | |
1036 | } | |
1037 | ||
1038 | // S SN | |
1039 | if ( person1.ge tAsOtherID s() != nul l) { | |
1040 | for (COCTM T030007UVO therIDs ot herIDs : p erson1.get AsOtherIDs ()) { | |
1041 | if (ot herIDs.get Id() == nu ll) { cont inue; } | |
1042 | for (I I ii : oth erIDs.getI d()) { | |
1043 | if ("2.16.84 0.1.113883 .4.1".equa lsIgnoreCa se(ii.getR oot())) { | |
1044 | patient. setSSN(ii. getExtensi on()); | |
1045 | } | |
1046 | } | |
1047 | } | |
1048 | } | |
1049 | ||
1050 | pati entList.ad d(patient) ; | |
1051 | } | |
1052 | } | |
1053 | ||
1054 | re turn patie ntList; | |
1055 | } | |
1056 | ||
1057 | public ResponseP atientQuer y lookupPa tient(PDWS QueryBean queryBean) throws JM eadowsExce ption { | |
1058 | PR PAIN201305 UV02 reque st = gener ateRequest (queryBean ); | |
1059 | PR PAIN201306 UV02 respo nse; | |
1060 | Re sponsePati entQuery r tc = null; | |
1061 | ||
1062 | St ring inqui ryType = q ueryBean.g etInquiryT ype(); | |
1063 | if ("PS".equ alsIgnoreC ase(inquir yType)) { | |
1064 | // Perso n Search | |
1065 | response = getEnti tyPatientS earchPort( ).entityPa tientSearc h(request) ; | |
1066 | } else if (" PR".equals IgnoreCase (inquiryTy pe)) { | |
1067 | // Patie nt Retriev e | |
1068 | response = getEnti tyPatientR etrievePor t().entity PatientRet rieve(requ est); | |
1069 | } else if (" FS".equals IgnoreCase (inquiryTy pe)) { | |
1070 | // Famil y Search | |
1071 | response = getEnti tyFamilySe archPort() .entityPat ientFamily Search(req uest); | |
1072 | } else if (" FR".equals IgnoreCase (inquiryTy pe)) { | |
1073 | // Famil y Retrieve | |
1074 | response = getEnti tyFamilyRe trievePort ().entityP atientFami lyRetrieve (request); | |
1075 | } else { | |
1076 | // Inval id Inquiry Type | |
1077 | throw ne w JMeadows Exception( "Invalid I nquiryType :" + inqui ryType); | |
1078 | } | |
1079 | ||
1080 | if (response != null) { | |
1081 | rtc = pa rseRespons e(response , inquiryT ype); | |
1082 | if (rtc != null && !rtc.getP atients(). isEmpty()) { | |
1083 | bool ean found = true; | |
1084 | whil e (found) { | |
1085 | found = fa lse; | |
1086 | List<Patie nt> patien ts = rtc.g etPatients (); | |
1087 | Patient bl acklisted = null; | |
1088 | for (Patie nt patient : patient s) { | |
1089 | if (PD WSBlackLis t.getInsta nce().isBl ackListed( patient.ge tEDIPI())) { | |
1090 | fo und = true ; | |
1091 | bl acklisted = patient; | |
1092 | br eak; | |
1093 | } | |
1094 | } | |
1095 | if (blackl isted != n ull) { | |
1096 | LOGGER .error("re moving bla cklisted p atient"); | |
1097 | patien ts.remove( blackliste d); | |
1098 | rtc.se tPatients( patients); | |
1099 | } | |
1100 | } | |
1101 | } | |
1102 | } | |
1103 | re turn rtc; | |
1104 | } | |
1105 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.