Produced by Araxis Merge on 5/1/2018 12:02:03 PM 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 | C:\AraxisMergeCompare\Pri_un\ZIP\JLV_2.6.2.0.3_src\jMeadows\src\main\java\gov\va\med\jmeadows\dataservicehandler | PDWSServiceHandler.java | Thu Mar 29 22:08:33 2018 UTC |
2 | C:\AraxisMergeCompare\Pri_re\ZIP\JLV_2.6.2.0.3_src\jMeadows\src\main\java\gov\va\med\jmeadows\dataservicehandler | PDWSServiceHandler.java | Tue May 1 13:46:46 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 2856 |
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.com mon.Langua geCache; | |
16 | import gov .va.med.jm eadows.dao .beans.PDW SQueryBean ; | |
17 | import gov .va.med.jm eadows.dao .beans.Res ponsePatie ntQuery; | |
18 | import gov .va.med.jm eadows.dao .hdd.Codin gSystem; | |
19 | import gov .va.med.pd ws.*; | |
20 | import gov .va.med.pd ws.ObjectF actory; | |
21 | import gov .va.med.vd s.webservi ce.*; | |
22 | import gov .va.med.vh ahon.commo n.Utils; | |
23 | import org .apache.co mmons.lang 3.StringUt ils; | |
24 | import org .apache.co mmons.lang 3.time.Fas tDateForma t; | |
25 | import org .slf4j.Log ger; | |
26 | import org .slf4j.Log gerFactory ; | |
27 | ||
28 | import jav ax.xml.bin d.JAXBElem ent; | |
29 | import jav ax.xml.dat atype.Data typeConfig urationExc eption; | |
30 | import jav ax.xml.dat atype.Data typeFactor y; | |
31 | import jav ax.xml.dat atype.XMLG regorianCa lendar; | |
32 | import jav ax.xml.nam espace.QNa me; | |
33 | import jav ax.xml.ws. BindingPro vider; | |
34 | import jav ax.xml.ws. handler.Ha ndler; | |
35 | import jav a.io.Seria lizable; | |
36 | import jav a.math.Big Integer; | |
37 | import jav a.text.Par seExceptio n; | |
38 | import jav a.text.Sim pleDateFor mat; | |
39 | import jav a.util.*; | |
40 | ||
41 | public cla ss PDWSSer viceHandle r extends DataServic eHandler { | |
42 | privat e static f inal Logge r LOGGER = LoggerFac tory.getLo gger(PDWSS erviceHand ler.class) ; | |
43 | privat e final St ring AGENC Y_DOD = AP P_CONFIG.g etAgencyDO D(); | |
44 | privat e final St ring AGENC Y_VA = APP _CONFIG.ge tAgencyVA( ); | |
45 | privat e final St ring PERSO N_SEARCH_U RL = APP_C ONFIG.getP dwsPsUrl() ; | |
46 | privat e final St ring PERSO N_RETRIEVE _URL = APP _CONFIG.ge tPdwsPrUrl (); | |
47 | privat e final St ring FAMIL Y_SEARCH_U RL = APP_C ONFIG.getP dwsFsUrl() ; | |
48 | privat e final St ring FAMIL Y_RETRIEVE _URL = APP _CONFIG.ge tPdwsFrUrl (); | |
49 | privat e final Bo olean DEBU G_SOAP_OUT PUT; | |
50 | privat e final En tityPatien tInquiry e ntityPatie ntInquiry = new Enti tyPatientI nquiry(); | |
51 | privat e static f inal FastD ateFormat simpleDate Format = F astDateFor mat.getIns tance("yyy yMMdd"); | |
52 | ||
53 | public PDWSServi ceHandler( ) { | |
54 | su per(); | |
55 | se rviceName = "PDWSSer vice"; | |
56 | serviceNam espace = " http://web service.pd ws. URL /"; | |
57 | qS erviceName = new QNa me(service Namespace, serviceNa me); | |
58 | St ring debug = AppConf ig.getInst ance().get Properties ().getProp erty("DEBU G_SOAP_OUT PUT", "fal se"); | |
59 | if ("true".e qualsIgnor eCase(debu g)) { | |
60 | DEBUG_SO AP_OUTPUT = true; | |
61 | } else { | |
62 | DEBUG_SO AP_OUTPUT = false; | |
63 | } | |
64 | } | |
65 | ||
66 | privat e EntityPa tientSearc hPortType getEntityP atientSear chPort() { | |
67 | En tityPatien tSearchPor tType port = entityP atientInqu iry.getEnt ityPatient SearchPort Soap11(); | |
68 | ||
69 | Bi ndingProvi der prov = (BindingP rovider) p ort; | |
70 | pr ov.getRequ estContext ().put(Bin dingProvid er.ENDPOIN T_ADDRESS_ PROPERTY, PERSON_SEA RCH_URL); | |
71 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.connect. timeout", serviceCon nectionTim eoutMS); | |
72 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.request. timeout", serviceReq uestTimeou tMS); | |
73 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.connect .timeout", serviceCo nnectionTi meoutMS); | |
74 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.request .timeout", serviceRe questTimeo utMS); | |
75 | ||
76 | if (DEBUG_SO AP_OUTPUT) { | |
77 | prov.get Binding(). getHandler Chain().ad d(new SOAP LoggingHan dler()); | |
78 | List<Han dler> hand lerList = prov.getBi nding().ge tHandlerCh ain(); | |
79 | handlerL ist.add(ne w SOAPLogg ingHandler ()); | |
80 | prov.get Binding(). setHandler Chain(hand lerList); | |
81 | } | |
82 | ||
83 | re turn port; | |
84 | } | |
85 | ||
86 | privat e EntityPa tientRetri evePortTyp e getEntit yPatientRe trievePort () { | |
87 | En tityPatien tRetrieveP ortType po rt = entit yPatientIn quiry.getE ntityPatie ntRetrieve PortSoap11 (); | |
88 | ||
89 | Bi ndingProvi der prov = (BindingP rovider) p ort; | |
90 | pr ov.getRequ estContext ().put(Bin dingProvid er.ENDPOIN T_ADDRESS_ PROPERTY, PERSON_RET RIEVE_URL) ; | |
91 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.connect. timeout", serviceCon nectionTim eoutMS); | |
92 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.request. timeout", serviceReq uestTimeou tMS); | |
93 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.connect .timeout", serviceCo nnectionTi meoutMS); | |
94 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.request .timeout", serviceRe questTimeo utMS); | |
95 | ||
96 | if (DEBUG_SO AP_OUTPUT) { | |
97 | prov.get Binding(). getHandler Chain().ad d(new SOAP LoggingHan dler()); | |
98 | List<Han dler> hand lerList = prov.getBi nding().ge tHandlerCh ain(); | |
99 | handlerL ist.add(ne w SOAPLogg ingHandler ()); | |
100 | prov.get Binding(). setHandler Chain(hand lerList); | |
101 | } | |
102 | ||
103 | re turn port; | |
104 | } | |
105 | ||
106 | privat e EntityPa tientFamil ySearchPor tType getE ntityFamil ySearchPor t() { | |
107 | En tityPatien tFamilySea rchPortTyp e port = e ntityPatie ntInquiry. getEntityP atientFami lySearchPo rtSoap11() ; | |
108 | ||
109 | Bi ndingProvi der prov = (BindingP rovider) p ort; | |
110 | pr ov.getRequ estContext ().put(Bin dingProvid er.ENDPOIN T_ADDRESS_ PROPERTY, FAMILY_SEA RCH_URL); | |
111 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.connect. timeout", serviceCon nectionTim eoutMS); | |
112 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.request. timeout", serviceReq uestTimeou tMS); | |
113 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.connect .timeout", serviceCo nnectionTi meoutMS); | |
114 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.request .timeout", serviceRe questTimeo utMS); | |
115 | ||
116 | if (DEBUG_SO AP_OUTPUT) { | |
117 | prov.get Binding(). getHandler Chain().ad d(new SOAP LoggingHan dler()); | |
118 | List<Han dler> hand lerList = prov.getBi nding().ge tHandlerCh ain(); | |
119 | handlerL ist.add(ne w SOAPLogg ingHandler ()); | |
120 | prov.get Binding(). setHandler Chain(hand lerList); | |
121 | } | |
122 | ||
123 | re turn port; | |
124 | } | |
125 | ||
126 | privat e EntityPa tientFamil yRetrieveP ortType ge tEntityFam ilyRetriev ePort() { | |
127 | En tityPatien tFamilyRet rievePortT ype port = entityPat ientInquir y.getEntit yPatientFa milyRetrie vePortSoap 11(); | |
128 | ||
129 | Bi ndingProvi der prov = (BindingP rovider) p ort; | |
130 | pr ov.getRequ estContext ().put(Bin dingProvid er.ENDPOIN T_ADDRESS_ PROPERTY, FAMILY_RET RIEVE_URL) ; | |
131 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.connect. timeout", serviceCon nectionTim eoutMS); | |
132 | pr ov.getRequ estContext ().put("co m.sun.xml. internal.w s.request. timeout", serviceReq uestTimeou tMS); | |
133 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.connect .timeout", serviceCo nnectionTi meoutMS); | |
134 | pr ov.getRequ estContext ().put("co m.sun.xml. ws.request .timeout", serviceRe questTimeo utMS); | |
135 | ||
136 | if (DEBUG_SO AP_OUTPUT) { | |
137 | prov.get Binding(). getHandler Chain().ad d(new SOAP LoggingHan dler()); | |
138 | List<Han dler> hand lerList = prov.getBi nding().ge tHandlerCh ain(); | |
139 | handlerL ist.add(ne w SOAPLogg ingHandler ()); | |
140 | prov.get Binding(). setHandler Chain(hand lerList); | |
141 | } | |
142 | ||
143 | re turn port; | |
144 | } | |
145 | ||
146 | privat e PRPAIN20 1305UV02 g enerateReq uest(PDWSQ ueryBean q ueryBean) { | |
147 | MC CIMT000100 UV01Device device; | |
148 | En Given enGi ven; | |
149 | II ii; | |
150 | CS cs; | |
151 | EN en; | |
152 | ST st; | |
153 | AD ad; | |
154 | ||
155 | Us er user = queryBean. getUser(); | |
156 | Si te host = user.getHo stSite(); | |
157 | St ring agenc y = user.g etAgency() ; | |
158 | St ring dmisI d = ""; | |
159 | St ring siteI d = ""; | |
160 | ||
161 | if (host != null) { | |
162 | dmisId = host.getD misId(); | |
163 | siteId = host.getS iteCode(); | |
164 | } | |
165 | ||
166 | Ob jectFactor y factory = new Obje ctFactory( ); | |
167 | PR PAIN201305 UV02 reque st = facto ry.createP RPAIN20130 5UV02(); | |
168 | ||
169 | // id | |
170 | ii = factory .createII( ); | |
171 | ii .setRoot(" 2.16.840.1 .113883.3. 2017"); | |
172 | ii .setExtens ion("DMDC" ); | |
173 | re quest.setI d(ii); | |
174 | ||
175 | // creationTi me | |
176 | TS ts = fact ory.create TS(); | |
177 | Si mpleDateFo rmat simpl eDateForma t = new Si mpleDateFo rmat("yyyy MMddhhmmss ", Locale. getDefault ()); | |
178 | ts .setValue( simpleDate Format.for mat(new Da te())); | |
179 | re quest.setC reationTim e(ts); | |
180 | ||
181 | // interactio nId | |
182 | ii = factory .createII( ); | |
183 | ii .setRoot(" 2.16.840.1 .113883.1. 6"); | |
184 | ii .setExtens ion("PRPA_ IN201305UV 02"); | |
185 | re quest.setI nteraction Id(ii); | |
186 | ||
187 | // processing Code | |
188 | cs = factory .createCS( ); | |
189 | cs .setCode(A PP_CONFIG. getPDWSPro cCode()); | |
190 | re quest.setP rocessingC ode(cs); | |
191 | ||
192 | // processing ModeCode | |
193 | cs = factory .createCS( ); | |
194 | cs .setCode(" I"); | |
195 | re quest.setP rocessingM odeCode(cs ); | |
196 | ||
197 | // acceptAckC ode | |
198 | cs = factory .createCS( ); | |
199 | cs .setCode(" AL"); | |
200 | re quest.setA cceptAckCo de(cs); | |
201 | ||
202 | // receiver | |
203 | MC CIMT000100 UV01Receiv er receive r = factor y.createMC CIMT000100 UV01Receiv er(); | |
204 | re quest.getR eceiver(). add(receiv er); | |
205 | ||
206 | // receiver/t ypeCode | |
207 | re ceiver.set TypeCode(C ommunicati onFunction Type.RCV); | |
208 | ||
209 | // receiver/d evice | |
210 | de vice = fac tory.creat eMCCIMT000 100UV01Dev ice(); | |
211 | re ceiver.set Device(dev ice); | |
212 | ||
213 | // receiver/d evice/clas sCode | |
214 | de vice.setCl assCode(En tityClassD evice.DEV) ; | |
215 | ||
216 | // receiver/d evice/dete rminerCode | |
217 | de vice.setDe terminerCo de("INSTAN CE"); | |
218 | ||
219 | // receiver/d evice/id | |
220 | ii = factory .createII( ); | |
221 | ii .setRoot(" 1.3.6.1.4. 1.21367.20 09.1.3.1.1 45"); | |
222 | de vice.getId ().add(ii) ; | |
223 | ||
224 | // sender | |
225 | MC CIMT000100 UV01Sender sender = factory.cr eateMCCIMT 000100UV01 Sender(); | |
226 | re quest.setS ender(send er); | |
227 | ||
228 | // sender/typ eCode | |
229 | se nder.setTy peCode(Com munication FunctionTy pe.SND); | |
230 | ||
231 | // sender/dev ice | |
232 | de vice = fac tory.creat eMCCIMT000 100UV01Dev ice(); | |
233 | se nder.setDe vice(devic e); | |
234 | ||
235 | // sender/dev ice/classC ode | |
236 | de vice.setCl assCode(En tityClassD evice.DEV) ; | |
237 | ||
238 | // sender/dev ice/determ inerCode | |
239 | de vice.setDe terminerCo de("INSTAN CE"); | |
240 | ||
241 | // sender/dev ice/id | |
242 | ii = factory .createII( ); | |
243 | ii .setRoot(" 2.16.840.1 .113883.3. 2017.11.7" ); | |
244 | ii .setExtens ion(APP_CO NFIG.getPD WSSndDevId ()); | |
245 | de vice.getId ().add(ii) ; | |
246 | ||
247 | // sender/dev ice/asAgen t | |
248 | MC CIMT000100 UV01Agent agent = fa ctory.crea teMCCIMT00 0100UV01Ag ent(); | |
249 | de vice.setAs Agent(fact ory.create MCCIMT0001 00UV01Devi ceAsAgent( agent)); | |
250 | ||
251 | // sender/dev ice/asAgen t/classCod e | |
252 | ag ent.getCla ssCode().a dd("AGNT") ; | |
253 | ||
254 | // sender/dev ice/asAgen t/represen tedOrganiz ation | |
255 | MC CIMT000100 UV01Organi zation org anization = factory. createMCCI MT000100UV 01Organiza tion(); | |
256 | ag ent.setRep resentedOr ganization (factory.c reateMCCIM T000100UV0 1AgentRepr esentedOrg anization( organizati on)); | |
257 | ||
258 | // sender/dev ice/asAgen t/represen tedOrganiz ation/clas sCode | |
259 | or ganization .setClassC ode("ORG") ; | |
260 | ||
261 | // sender/dev ice/asAgen t/represen tedOrganiz ation/dete rminerCode | |
262 | or ganization .setDeterm inerCode(" INSTANCE") ; | |
263 | ||
264 | // sender/dev ice/asAgen t/represen tedOrganiz ation/id | |
265 | ii = factory .createII( ); | |
266 | if (AGENCY_D OD.equalsI gnoreCase( agency)) { | |
267 | ii.setRo ot("2.16.8 40.1.11388 3.3.42.100 02.100001. 8"); | |
268 | ii.setEx tension(dm isId); | |
269 | } else if (A GENCY_VA.e qualsIgnor eCase(agen cy)) { | |
270 | ii.setRo ot("2.16.8 40.1.11388 3.4.349"); | |
271 | ii.setEx tension(si teId); | |
272 | } | |
273 | or ganization .getId().a dd(ii); | |
274 | ||
275 | // controlAct Process | |
276 | PR PAIN201305 UV02QUQIMT 021001UV01 ControlAct Process co ntrolActPr ocess = fa ctory.crea tePRPAIN20 1305UV02QU QIMT021001 UV01Contro lActProces s(); | |
277 | re quest.setC ontrolActP rocess(con trolActPro cess); | |
278 | ||
279 | // controlAct Process/cl assCode | |
280 | co ntrolActPr ocess.setC lassCode(A ctClassCon trolAct.CA CT); | |
281 | ||
282 | // controlAct Process/mo odCode | |
283 | co ntrolActPr ocess.setM oodCode(XA ctMoodInte ntEvent.EV N); | |
284 | ||
285 | // controlAct Process/co de | |
286 | CD cd = fact ory.create CD(); | |
287 | cd .setCode(" PRPA_TE201 305UV02"); | |
288 | co ntrolActPr ocess.setC ode(cd); | |
289 | ||
290 | // controlAct Process/co deSystem | |
291 | cd .setCodeSy stem("2.16 .840.1.113 883.1.6"); | |
292 | ||
293 | // controlAct Process/da taEnterer | |
294 | QU QIMT021001 UV01DataEn terer data Enterer = factory.cr eateQUQIMT 021001UV01 DataEntere r(); | |
295 | co ntrolActPr ocess.getD ataEnterer ().add(dat aEnterer); | |
296 | ||
297 | // controlAct Process/da taEnterer/ typeCode | |
298 | da taEnterer. getTypeCod e().add("E NT"); | |
299 | ||
300 | // controlAct Process/da taEnterer/ contextCon trolCode | |
301 | da taEnterer. setContext ControlCod e("AP"); | |
302 | ||
303 | // controlAct Process/da taEnterer/ assignedPe rson | |
304 | CO CTMT090100 UV01Assign edPerson a ssignedPer son = fact ory.create COCTMT0901 00UV01Assi gnedPerson (); | |
305 | da taEnterer. setAssigne dPerson(as signedPers on); | |
306 | ||
307 | // controlAct Process/da taEnterer/ assignedPe rson/class Code | |
308 | as signedPers on.setClas sCode("ASS IGNED"); | |
309 | ||
310 | // controlAct Process/da taEnterer/ assignedPe rson/id | |
311 | ii = factory .createII( ); | |
312 | if (AGENCY_D OD.equalsI gnoreCase( agency)) { | |
313 | ii.setRo ot("2.16.8 40.1.11388 3.3.42.127 .100001.79 "); | |
314 | ii.setEx tension(us er.getUser Ien() + "^ " + dmisId ); | |
315 | } else if (A GENCY_VA.e qualsIgnor eCase(agen cy)) { | |
316 | ii.setRo ot("2.16.8 40.1.11388 3.4.349"); | |
317 | ii.setEx tension(us er.getUser Ien() + "^ " + siteId ); | |
318 | } | |
319 | as signedPers on.getId() .add(ii); | |
320 | ||
321 | // controlAct Process/da taEnterer/ assignedPe rson/Perso n | |
322 | CO CTMT090100 UV01Person person1 = factory.c reateCOCTM T090100UV0 1Person(); | |
323 | as signedPers on.setAssi gnedPerson (factory.c reateCOCTM T090100UV0 1AssignedP ersonAssig nedPerson( person1)); | |
324 | ||
325 | // controlAct Process/da taEnterer/ assignedPe rson/Perso n/name | |
326 | en = factory .createEN( ); | |
327 | en .getConten t().add(qu eryBean.ge tUser().ge tName()); | |
328 | pe rson1.getN ame().add( en); | |
329 | ||
330 | // controlAct Process/qu eryByParam eter | |
331 | PR PAMT201306 UV02QueryB yParameter queryByPa rameter = factory.cr eatePRPAMT 201306UV02 QueryByPar ameter(); | |
332 | co ntrolActPr ocess.setQ ueryByPara meter(fact ory.create PRPAIN2013 05UV02QUQI MT021001UV 01ControlA ctProcessQ ueryByPara meter(quer yByParamet er)); | |
333 | ||
334 | // controlAct Process/qu eryByParam eter/query Id | |
335 | ii = factory .createII( ); | |
336 | ii .setRoot(" 2.16.840.1 .113883.3. 2017"); | |
337 | ii .setExtens ion("33333 4433"); | |
338 | qu eryByParam eter.setQu eryId(ii); | |
339 | ||
340 | // controlAct Process/qu eryByParam eter/statu sCode | |
341 | cs = factory .createCS( ); | |
342 | cs .setCode(" new"); | |
343 | qu eryByParam eter.setSt atusCode(c s); | |
344 | ||
345 | // controlAct Process/qu eryByParam eter/initi alQuantity | |
346 | IN T i = fact ory.create INT(); | |
347 | i. setValue(B igInteger. valueOf(10 )); | |
348 | qu eryByParam eter.setIn itialQuant ity(i); | |
349 | ||
350 | // controlAct Process/qu eryByParam eter/param eterList | |
351 | PR PAMT201306 UV02Parame terList pa rameterLis t = factor y.createPR PAMT201306 UV02Parame terList(); | |
352 | qu eryByParam eter.setPa rameterLis t(paramete rList); | |
353 | ||
354 | // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctId | |
355 | if (!"".equa ls(queryBe an.getPati entId()) & & !"".equa ls(queryBe an.getPati entIdType( ))) { | |
356 | ii = fac tory.creat eII(); | |
357 | ii.setEx tension(qu eryBean.ge tPatientId ()); | |
358 | ||
359 | String t ype = quer yBean.getP atientIdTy pe(); | |
360 | if ("SSN ".equalsIg noreCase(t ype)) { | |
361 | ii.s etRoot("2. 16.840.1.1 13883.4.1" ); | |
362 | } else i f ("TIN".e qualsIgnor eCase(type )) { | |
363 | ii.s etRoot("2. 16.840.1.1 13883.3.42 .10001.100 001.225"); | |
364 | } else i f ("FIN".e qualsIgnor eCase(type )) { | |
365 | ii.s etRoot("2. 16.840.1.1 13883.3.42 .10001.100 001.224"); | |
366 | } else i f ("ITIN". equalsIgno reCase(typ e)) { | |
367 | ii.s etRoot("2. 16.840.1.1 13883.4.2" ); | |
368 | } else i f ("PIN".e qualsIgnor eCase(type )) { | |
369 | ii.s etRoot("2. 16.840.1.1 13883.3.42 .10001.100 001.226"); | |
370 | } else i f ("EDIPI" .equalsIgn oreCase(ty pe)) { | |
371 | ii.s etRoot("2. 16.840.1.1 13883.3.42 .10001.100 001.12"); | |
372 | } | |
373 | ||
374 | PRPAMT20 1306UV02Li vingSubjec tId living SubjectId = factory. createPRPA MT201306UV 02LivingSu bjectId(); | |
375 | livingSu bjectId.ge tValue().a dd(ii); | |
376 | paramete rList.getL ivingSubje ctId().add (livingSub jectId); | |
377 | ||
378 | //contro lActProces s/queryByP arameter/p arameterLi st/livingS ubjectId/s emanticsTe xt | |
379 | st = fac tory.creat eST(); | |
380 | st.getCo ntent().ad d("LivingS ubject.id" ); | |
381 | livingSu bjectId.se tSemantics Text(st); | |
382 | } | |
383 | ||
384 | // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctAdminist rativeGend er | |
385 | if (queryBea n.getGende r() != nul l) { | |
386 | PRPAMT20 1306UV02Li vingSubjec tAdministr ativeGende r adminGen der = fact ory.create PRPAMT2013 06UV02Livi ngSubjectA dministrat iveGender( ); | |
387 | CE ce = factory.cr eateCE(); | |
388 | ce.setCo de(queryBe an.getGend er()); | |
389 | adminGen der.getVal ue().add(c e); | |
390 | paramete rList.getL ivingSubje ctAdminist rativeGend er().add(a dminGender ); | |
391 | ||
392 | //contro lActProces s/queryByP arameter/p arameterLi st/livingS ubjectAdmi nistrative Gender/sem anticsText | |
393 | st = fac tory.creat eST(); | |
394 | st.getCo ntent().ad d("LivingS ubject.adm inistrativ eGender"); | |
395 | adminGen der.setSem anticsText (st); | |
396 | } | |
397 | ||
398 | // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctBirthTim e | |
399 | PR PAMT201306 UV02Living SubjectBir thTime bir thTime = f actory.cre atePRPAMT2 01306UV02L ivingSubje ctBirthTim e(); | |
400 | IV LTS ivlts = factory. createIVLT S(); | |
401 | iv lts.setVal ue(queryBe an.getDob( )); | |
402 | bi rthTime.ge tValue().a dd(ivlts); | |
403 | pa rameterLis t.getLivin gSubjectBi rthTime(). add(birthT ime); | |
404 | ||
405 | // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctBirthTim e/semantic sText | |
406 | st = factory .createST( ); | |
407 | st .getConten t().add("L ivingSubje ct.birthTi me"); | |
408 | bi rthTime.se tSemantics Text(st); | |
409 | ||
410 | // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctName | |
411 | PR PAMT201306 UV02Living SubjectNam e name = f actory.cre atePRPAMT2 01306UV02L ivingSubje ctName(); | |
412 | en = factory .createEN( ); | |
413 | en .getUse(). add("L"); | |
414 | ||
415 | if (StringUt ils.isNotB lank(query Bean.getFi rstName()) ) { | |
416 | enGiven = factory. createEnGi ven(); | |
417 | enGiven. getContent ().add(que ryBean.get FirstName( )); | |
418 | en.getCo ntent().ad d(factory. createENGi ven(enGive n)); | |
419 | } | |
420 | ||
421 | if (StringUt ils.isNotB lank(query Bean.getMi ddleName() )) { | |
422 | enGiven = factory. createEnGi ven(); | |
423 | enGiven. getContent ().add(que ryBean.get MiddleName ()); | |
424 | en.getCo ntent().ad d(factory. createENGi ven(enGive n)); | |
425 | } | |
426 | ||
427 | if (StringUt ils.isNotB lank(query Bean.getLa stName())) { | |
428 | EnFamily enFamily = factory. createEnFa mily(); | |
429 | enFamily .getConten t().add(qu eryBean.ge tLastName( )); | |
430 | en.getCo ntent().ad d(factory. createENFa mily(enFam ily)); | |
431 | } | |
432 | ||
433 | na me.getValu e().add(en ); | |
434 | pa rameterLis t.getLivin gSubjectNa me().add(n ame); | |
435 | ||
436 | // controlAct Process/qu eryByParam eter/param eterList/l ivingSubje ctName/sem anticsText | |
437 | st = factory .createST( ); | |
438 | st .getConten t().add("L ivingSubje ct.name"); | |
439 | na me.setSema nticsText( st); | |
440 | ||
441 | // controlAct Process/qu eryByParam eter/param eterList/p atientAddr ess/value | |
442 | PR PAMT201306 UV02Patien tAddress a ddress = f actory.cre atePRPAMT2 01306UV02P atientAddr ess(); | |
443 | ad = factory .createAD( ); | |
444 | ad .getUse(). add("HP"); | |
445 | ||
446 | // controlAct Process/qu eryByParam eter/param eterList/p atientAddr ess/value/ [@use="HP" ]/streetAd dressLine | |
447 | if (StringUt ils.isNotB lank(query Bean.getAd dress())) { | |
448 | AdxpStre etAddressL ine addres sLine = fa ctory.crea teAdxpStre etAddressL ine(); | |
449 | addressL ine.getCon tent().add (queryBean .getAddres s()); | |
450 | ad.getCo ntent().ad d(factory. createADSt reetAddres sLine(addr essLine)); | |
451 | } | |
452 | ||
453 | // controlAct Process/qu eryByParam eter/param eterList/p atientAddr ess/value/ [@use="HP" ]/city | |
454 | if (StringUt ils.isNotB lank(query Bean.getCi ty())) { | |
455 | AdxpCity city = fa ctory.crea teAdxpCity (); | |
456 | city.get Content(). add(queryB ean.getCit y()); | |
457 | ad.getCo ntent().ad d(factory. createADCi ty(city)); | |
458 | } | |
459 | ||
460 | // controlAct Process/qu eryByParam eter/param eterList/p atientAddr ess/value/ [@use="HP" ]/state | |
461 | if (StringUt ils.isNotB lank(query Bean.getSt ate())) { | |
462 | AdxpStat e state = factory.cr eateAdxpSt ate(); | |
463 | state.ge tContent() .add(query Bean.getSt ate()); | |
464 | ad.getCo ntent().ad d(factory. createADSt ate(state) ); | |
465 | } | |
466 | ||
467 | // controlAct Process/qu eryByParam eter/param eterList/p atientAddr ess/value/ [@use="HP" ]/zip | |
468 | if (StringUt ils.isNotB lank(query Bean.getZi p())) { | |
469 | AdxpPost alCode zip = factory .createAdx pPostalCod e(); | |
470 | zip.getC ontent().a dd(queryBe an.getZip( )); | |
471 | ad.getCo ntent().ad d(factory. createADPo stalCode(z ip)); | |
472 | } | |
473 | ||
474 | ad dress.getV alue().add (ad); | |
475 | pa rameterLis t.getPatie ntAddress( ).add(addr ess); | |
476 | ||
477 | // controlAct Process/qu eryByParam eter/param eterList/o therIDsSco pingOrgani zation | |
478 | PR PAMT201306 UV02OtherI DsScopingO rganizatio n otherIDs ScopingOrg anization = factory. createPRPA MT201306UV 02OtherIDs ScopingOrg anization( ); | |
479 | pa rameterLis t.getOther IDsScoping Organizati on().add(o therIDsSco pingOrgani zation); | |
480 | ||
481 | // controlAct Process/qu eryByParam eter/param eterList/o therIDsSco pingOrgani zation/val ue/id | |
482 | ii = factory .createII( ); | |
483 | ii .setRoot(" 2.16.840.1 .113883.4. 1"); | |
484 | ot herIDsScop ingOrganiz ation.getV alue().add (ii); | |
485 | ||
486 | // controlAct Process/qu eryByParam eter/param eterList/o therIDsSco pingOrgani zation/sem anticsText | |
487 | st = factory .createST( ); | |
488 | st .getConten t().add("O therIDs.sc opingOrgan ization.id "); | |
489 | ot herIDsScop ingOrganiz ation.setS emanticsTe xt(st); | |
490 | ||
491 | // controlAct Process/qu eryByParam eter/param eterList/p atientTelc om | |
492 | if (StringUt ils.isNotB lank(query Bean.getTe l())) { | |
493 | PRPAMT20 1306UV02Pa tientTelec om telecom = factory .createPRP AMT201306U V02Patient Telecom(); | |
494 | TEL tel = factory. createTEL( ); | |
495 | tel.setV alue(query Bean.getTe l()); | |
496 | tel.getU se().add(" H"); | |
497 | telecom. getValue() .add(tel); | |
498 | paramete rList.getP atientTele com().add( telecom); | |
499 | } | |
500 | ||
501 | re turn reque st; | |
502 | } | |
503 | ||
504 | privat e Response PatientQue ry parseRe sponse(PRP AIN201306U V02 respon se, String inquiryTy pe) { | |
505 | Re sponsePati entQuery r espPatQuer y = new Re sponsePati entQuery() ; | |
506 | bo olean done = false; | |
507 | ||
508 | // Initially set to fa ilure with generic e rror messa ge. Will o nly be | |
509 | // set to su ccess if t here are n o acknowle dgement er rors and n o | |
510 | // errors re trieving p atient lis t, even if the list is empty | |
511 | re spPatQuery .setSucces s(false); | |
512 | re spPatQuery .setErrorM sg("Error retrieving patients. " | |
513 | + "< br><br>Ple ase try ag ain." | |
514 | + "< br><br>If the proble m persists , notify y our system administr ator or he lp desk.") ; | |
515 | ||
516 | // Create li st of resu lt patient s | |
517 | Li st<Patient > resultPa tientList = new Arra yList<Pati ent>(); | |
518 | ||
519 | if (response != null) { | |
520 | if (resp onse.getAc knowledgem ent() != n ull) { | |
521 | Ackn owledgemen tDetailTyp e ackDetai lTypeCode; | |
522 | Stri ng ackCode ; | |
523 | Stri ng ackDeta ilCode; | |
524 | Stri ng display Message; | |
525 | CS c s; | |
526 | CE c e; | |
527 | ||
528 | for (MCCIMT000 300UV01Ack nowledgeme nt acknowl edgement : response. getAcknowl edgement() ) { | |
529 | cs = ackno wledgement .getTypeCo de(); | |
530 | if (cs == null) { co ntinue; } | |
531 | ||
532 | ackCode = cs.getCode (); | |
533 | ||
534 | if (acknow ledgement. getAcknowl edgementDe tail() == null) { co ntinue; } | |
535 | for (MCCIM T000300UV0 1Acknowled gementDeta il ackDeta il : ackno wledgement .getAcknow ledgementD etail()) { | |
536 | ackDet ailTypeCod e = ackDet ail.getTyp eCode(); | |
537 | ||
538 | ce = a ckDetail.g etCode(); | |
539 | if (ce == null) { continue ; } | |
540 | ||
541 | ackDet ailCode = ce.getCode (); | |
542 | displa yMessage = ce.getDis playName() ; | |
543 | ||
544 | if ("A A".equalsI gnoreCase( ackCode)) { | |
545 | if (ackDetai lTypeCode == Acknowl edgementDe tailType.W | |
546 | && a ckDetailCo de.contain s("PN") || ackDetail Code.conta ins("FM")) { | |
547 | respPatQ uery.setEr rorMsg(dis playMessag e); | |
548 | } | |
549 | } else if ("AE". equalsIgno reCase(ack Code) | |
550 | && ackDe tailTypeCo de == Ackn owledgemen tDetailTyp e.E | |
551 | && !ackD etailCode. contains(" PN") && !a ckDetailCo de.contain s("FM")) { | |
552 | re spPatQuery .setErrorM sg(display Message); | |
553 | re spPatQuery .setSucces s(false); | |
554 | do ne = true; | |
555 | br eak; | |
556 | } | |
557 | } | |
558 | } | |
559 | } | |
560 | if (!don e) { | |
561 | PRPA IN201306UV 02MFMIMT70 0711UV01Co ntrolActPr ocess cont rolActProc ess = resp onse.getCo ntrolActPr ocess(); | |
562 | if ( (controlAc tProcess ! = null) && (controlA ctProcess. getSubject () != null )) { | |
563 | PRPAIN2013 06UV02MFMI MT700711UV 01Registra tionEvent registrati onEvent; | |
564 | PRPAIN2013 06UV02MFMI MT700711UV 01Subject2 subject1; | |
565 | PRPAMT2013 10UV02Pati ent patien t; | |
566 | PRPAMT2013 10UV02Pers on patient Person; | |
567 | CE ce; | |
568 | TS ts; | |
569 | CS cs; | |
570 | SC sc; | |
571 | Code code; | |
572 | List<Patie nt> person alRelation shipList; | |
573 | List<Perso n> sponsor List; | |
574 | List<PRPAM T201310UV0 2ContactPa rty> conta ctPartyLis t; | |
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 Lan guage (cur rently is a string b ut can be a code) | |
661 | if ( patientPer son.getLan guageCommu nication() != null) { | |
662 | for (PRPAM T201310UV0 2LanguageC ommunicati on lc1 : p atientPers on.getLang uageCommun ication()) { | |
663 | String langDispl ay = lc1.g etLanguage Code().get Code(); | |
664 | result Demographi cs.getLang uages().ad d(Language Cache.getL abel(langD isplay)); | |
665 | } | |
666 | } | |
667 | ||
668 | // P atient hom e & work t elephone n umbers | |
669 | if ( patientPer son.getTel ecom() != null) { | |
670 | for (TEL t el : patie ntPerson.g etTelecom( )) { | |
671 | if ((t el.getUse( ) == null) | |
672 | || (tel. getUse().s ize() > 1) | |
673 | || (tel. getValue() .contains( "mailto")) | |
674 | || (tel. getValue() .contains( "@"))) { | |
675 | co ntinue; | |
676 | } | |
677 | for (S tring use : tel.getU se()) { | |
678 | if ("HP".equ alsIgnoreC ase(use)) { | |
679 | resultDe mographics .setPhone1 (parsePhon eNumber(te l.getValue ())); | |
680 | } else if (" WP".equals IgnoreCase (use)) { | |
681 | resultDe mographics .setPhone2 (parsePhon eNumber(te l.getValue ())); | |
682 | } | |
683 | } | |
684 | } | |
685 | } | |
686 | ||
687 | // P atient's a ddress | |
688 | pars eAddress(p atientPers on, tempDe mographics ); | |
689 | ||
690 | // S ponsors | |
691 | spon sorList = parseSpons ors(patien tPerson); | |
692 | if(s ponsorList != null & & sponsorL ist.size() > 0) { | |
693 | resultDemo graphics.g etSponsors ().addAll( sponsorLis t); | |
694 | } | |
695 | ||
696 | BL o rganDonorI nd = patie ntPerson.g etOrganDon orInd(); | |
697 | if ( organDonor Ind != nul l && organ DonorInd.i sValue() ! = null) { | |
698 | resultDemo graphics.s etOrganDon orInd(Stri ng.valueOf (organDono rInd.isVal ue())); | |
699 | } | |
700 | ||
701 | List <PRPAMT201 310UV02Sub ject4> sub jectOf2 = patient.ge tSubjectOf 2(); | |
702 | if ( subjectOf2 != null) { | |
703 | for (int i = 0; i < subjectOf2 .size(); i ++) { | |
704 | PRPAMT 201310UV02 Subject4 p rpamt20131 0UV02Subje ct4 = subj ectOf2.get (i); | |
705 | PRPAMT 201310UV02 Administra tiveObserv ation admi nistrative Observatio n = prpamt 201310UV02 Subject4.g etAdminist rativeObse rvation(); | |
706 | if (ad ministrati veObservat ion != nul l) { | |
707 | CD code1 = a dministrat iveObserva tion.getCo de(); | |
708 | if (code1 != null && c ode1.getCo de() != nu ll) { | |
709 | String c odeString = code1.ge tCode().tr im(); | |
710 | //blood donor indi cation dat e | |
711 | if ("2.1 6.840.1.11 3883.3.201 7.11.6.2.2 ".equals(c odeString) | |
712 | && adminis trativeObs ervation.g etEffectiv eTime() != null | |
713 | && adminis trativeObs ervation.g etEffectiv eTime().si ze() > 0 | |
714 | //note thi s assumes the date i s the firs t entry | |
715 | && adminis trativeObs ervation.g etEffectiv eTime().ge t(0) != nu ll) { | |
716 | IVLT S sxcmts = (IVLTS) a dministrat iveObserva tion.getEf fectiveTim e().get(0) ; | |
717 | if ( sxcmts != null) { | |
718 | List<JAXBE lement<? e xtends QTY >> rest = sxcmts.get Rest(); | |
719 | if (rest ! = null && rest.size( ) > 0) { | |
720 | JAXBEl ement jaxb Element = rest.get(0 ); | |
721 | IVXBTS ixIvxbts = (IVXBTS) jaxbEleme nt.getValu e(); | |
722 | if (ix Ivxbts != null) { | |
723 | St ring value = ixIvxbt s.getValue (); | |
724 | if (value != null) { | |
725 | Date d = null; | |
726 | ||
727 | Gregoria nCalendar orgIndDate GregorianC alendar = new Gregor ianCalenda r(); | |
728 | ||
729 | try { | |
730 | d = simpleDate Format.par se(value); | |
731 | orgI ndDateGreg orianCalen dar.setTim e(d); | |
732 | } catch (ParseExce ption e) { | |
733 | LOGG ER.error(" Error pars ing organ donor ind date: ", e ); | |
734 | } | |
735 | ||
736 | Datatype Factory da tatypeFact ory = null ; | |
737 | try { | |
738 | data typeFactor y = Dataty peFactory. newInstanc e(); | |
739 | } catch (DatatypeC onfigurati onExceptio n e) { | |
740 | LOGG ER.error(" Error crea ting Datat ypeFactory : ", e); | |
741 | } | |
742 | ||
743 | if(datat ypeFactory != null) { | |
744 | XMLG regorianCa lendar xd = datatype Factory.ne wXMLGregor ianCalenda r(orgIndDa teGregoria nCalendar) ; | |
745 | resu ltDemograp hics.setOr ganDonorIn dDate(xd); | |
746 | } | |
747 | ||
748 | } | |
749 | } | |
750 | } | |
751 | } | |
752 | } | |
753 | //blood type | |
754 | else if ("2.16.840 .1.113883. 3.2017.11. 6.2.3".equ als(codeSt ring) | |
755 | && adminis trativeObs ervation.g etValue() != null) { | |
756 | CD v alue1 = (C D) adminis trativeObs ervation.g etValue(); | |
757 | if ( value1 != null) { | |
758 | resultDemo graphics.s etBloodTyp e(value1.g etDisplayN ame()); | |
759 | } | |
760 | } | |
761 | } | |
762 | } | |
763 | } | |
764 | } | |
765 | ||
766 | ||
767 | // E mergency C ontact/Nex t of Kin | |
768 | cont actPartyLi st = patie ntPerson.g etContactP arty(); | |
769 | if ( (contactPa rtyList != null) && (!contactP artyList.i sEmpty())) { | |
770 | for (PRPAM T201310UV0 2ContactPa rty contac tParty : c ontactPart yList) | |
771 | { | |
772 | if ("E CON".equal sIgnoreCas e(contactP arty.getCl assCode(). name())) | |
773 | { | |
774 | Pe rson perso n = parseP erson(cont actParty); | |
775 | re sultDemogr aphics.get EmergencyC ontact().a dd(person) ; | |
776 | } | |
777 | else i f ("NOK".e qualsIgnor eCase(cont actParty.g etClassCod e().name() )) | |
778 | { | |
779 | Pe rson perso n = parseP erson(cont actParty); | |
780 | re sultDemogr aphics.get NextOfKin( ).add(pers on); | |
781 | } | |
782 | } | |
783 | } | |
784 | ||
785 | } else i f ("FR".eq ualsIgnore Case(inqui ryType)) { | |
786 | // F amily memb ers (depen dents) | |
787 | pers onalRelati onshipList = parsePe rsonalRela tionship(p atientPers on); | |
788 | if ( personalRe lationship List != nu ll) { | |
789 | for (Patie nt patient 1 : person alRelation shipList) { | |
790 | // Set sponsor S SN for eac h family m ember | |
791 | patien t1.setSpon sorSSN(res ultPatient .getSSN()) ; | |
792 | } | |
793 | resultPati entList.ad dAll(perso nalRelatio nshipList) ; | |
794 | } | |
795 | } | |
796 | } | |
797 | } | |
798 | if (!" FR".equals IgnoreCase (inquiryTy pe)) { | |
799 | // Set patie nt data | |
800 | re sultPatien tList.add( resultPati ent); | |
801 | } | |
802 | if ("P R".equalsI gnoreCase( inquiryTyp e)) { | |
803 | // Patient's primary c are manage r (PCM) | |
804 | pa rsePrimary CareManage r(patient, tempDemog raphics); | |
805 | ||
806 | // Set demog raphics da ta | |
807 | // Address ad dress = ne w Address( ); | |
808 | re sultDemogr aphics.set EDIPI(resu ltPatient. getEDIPI() ); | |
809 | re sultDemogr aphics.set SSN(result Patient.ge tSSN()); | |
810 | re sultDemogr aphics.set Name(resul tPatient.g etName()); | |
811 | re sultDemogr aphics.set Gender(res ultPatient .getGender ()); | |
812 | re sultDemogr aphics.set Dob(result Patient.ge tDob()); | |
813 | if (tempDemog raphics.ge tAddress() != null & & tempDemo graphics.g etAddress( ).size() > 0) { | |
814 | // addres s.setStree t1(tempDem ographics. getAddress ().get(0). getStreet1 ()); | |
815 | // addres s.setStree t2(tempDem ographics. getAddress ().get(0). getStreet2 ()); | |
816 | // addres s.setCity( tempDemogr aphics.get Address(). get(0).get City()); | |
817 | // addres s.setState Province(t empDemogra phics.getA ddress().g et(0).getS tateProvin ce()); | |
818 | // addres s.setPosta lCode(temp Demographi cs.getAddr ess().get( 0).getPost alCode()); | |
819 | resultDe mographics .getAddres s().addAll (tempDemog raphics.ge tAddress() ); | |
820 | } | |
821 | re sultDemogr aphics.set PrimaryPro vider(temp Demographi cs.getPrim aryProvide r()); | |
822 | re sultDemogr aphics.set PcmDates(t empDemogra phics.getP cmDates()) ; | |
823 | re sultDemogr aphics.set PcmClinic( tempDemogr aphics.get PcmClinic( )); | |
824 | re spPatQuery .setDemogr aphics(res ultDemogra phics); | |
825 | } | |
826 | } | |
827 | respPatQue ry.setSucc ess(true); | |
828 | respPatQue ry.setErro rMsg(null) ; | |
829 | respPatQue ry.setPati ents(resul tPatientLi st); | |
830 | } | |
831 | } | |
832 | } | |
833 | re turn respP atQuery; | |
834 | } | |
835 | ||
836 | privat e void par seAddress( PRPAMT2013 10UV02Pers on person, PatientDe mographics patientDe mographics ) { | |
837 | Li st<String> streetAdd ressList = new Array List<Strin g>(); | |
838 | Li st<Seriali zable> ser ializableL ist; | |
839 | Ob ject objec t; | |
840 | Bo olean isBa dAddress; | |
841 | Bo olean isCo nfidential ; | |
842 | ||
843 | Li st<Address > homeList = new Arr ayList<Add ress>(); | |
844 | Li st<Address > tempList = new Arr ayList<Add ress>(); | |
845 | Li st<Address > workList = new Arr ayList<Add ress>(); | |
846 | Li st<Address > postalLi st = new A rrayList<A ddress>(); | |
847 | Li st<Address > pharmLis t = new Ar rayList<Ad dress>(); | |
848 | ||
849 | // Check for home prim ary addres s and bad address | |
850 | fo r (AD ad : person.ge tAddr()) { | |
851 | ||
852 | Address address = new Addres s(); | |
853 | ||
854 | isBadAdd ress = fal se; | |
855 | isConfid ential = f alse; | |
856 | ||
857 | if (ad.g etUse() == null) { | |
858 | cont inue; | |
859 | } | |
860 | ||
861 | for (Str ing use : ad.getUse( )) { | |
862 | if ( use.contai ns("BAD")) { | |
863 | isBadAddre ss = true; | |
864 | address.se tType("BAD "); | |
865 | } el se if (use .contains( "DIR")) { | |
866 | isConfiden tial = tru e; | |
867 | address.se tType("CON FIDENTIAL" ); | |
868 | } el se if (use .contains( "HP")) { | |
869 | address.se tType("Hom e"); | |
870 | } el se if (use .contains( "TMP")) { | |
871 | address.se tType("Tem porary"); | |
872 | } el se if (use .contains( "PST")) { | |
873 | address.se tType("Pos tal"); | |
874 | } el se if (use .contains( "WP")) { | |
875 | address.se tType("Wor k"); | |
876 | } el se if (use .contains( "PHYS")) { | |
877 | address.se tType("Pha rmacy"); | |
878 | } | |
879 | } | |
880 | ||
881 | // 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 | |
882 | if (isCo nfidential || isBadA ddress || (ad.getCon tent() == null)) { | |
883 | cont inue; | |
884 | } | |
885 | ||
886 | streetAd dressList. clear(); | |
887 | ||
888 | for (Ser ializable serializab le : ad.ge tContent() ) { | |
889 | if ( serializab le instanc eof JAXBEl ement) { | |
890 | object = ( (JAXBEleme nt) serial izable).ge tValue(); | |
891 | if (object == null) { | |
892 | contin ue; | |
893 | } | |
894 | ||
895 | // Street address | |
896 | if (object instanceo f AdxpStre etAddressL ine) { | |
897 | serial izableList = ((AdxpS treetAddre ssLine) ob ject).getC ontent(); | |
898 | if ((s erializabl eList != n ull) && !s erializabl eList.isEm pty()) { | |
899 | st reetAddres sList.add( serializab leList.get (0).toStri ng()); | |
900 | } | |
901 | } else if (object in stanceof A dxpCity) { // City | |
902 | serial izableList = ((AdxpC ity) objec t).getCont ent(); | |
903 | if ((s erializabl eList != n ull) && !s erializabl eList.isEm pty()) { | |
904 | ad dress.setC ity(serial izableList .get(0).to String()); | |
905 | } | |
906 | } else if (object in stanceof A dxpState) { // State | |
907 | serial izableList = ((AdxpS tate) obje ct).getCon tent(); | |
908 | if ((s erializabl eList != n ull) && !s erializabl eList.isEm pty()) { | |
909 | ad dress.setS tateProvin ce(seriali zableList. get(0).toS tring()); | |
910 | } | |
911 | } | |
912 | // Zip cod e | |
913 | if (object instanceo f AdxpPost alCode) { | |
914 | serial izableList = ((AdxpP ostalCode) object).g etContent( ); | |
915 | if ((s erializabl eList != n ull) && !s erializabl eList.isEm pty()) { | |
916 | ad dress.setP ostalCode( serializab leList.get (0).toStri ng()); | |
917 | } | |
918 | } | |
919 | } | |
920 | } | |
921 | ||
922 | // Set s treet addr ess from l ist | |
923 | if (!str eetAddress List.isEmp ty()) { | |
924 | addr ess.setStr eet1(stree tAddressLi st.get(0)) ; | |
925 | if ( streetAddr essList.si ze() > 1) { | |
926 | address.se tStreet2(s treetAddre ssList.get (1)); | |
927 | } | |
928 | } | |
929 | ||
930 | //patien tDemograph ics.getAdd ress().add (address); | |
931 | if (addr ess.getTyp e().equals IgnoreCase ("Home")) { | |
932 | home List.add(a ddress); | |
933 | } else i f (address .getType() .equalsIgn oreCase("T emporary") ) { | |
934 | temp List.add(a ddress); | |
935 | } else i f (address .getType() .equalsIgn oreCase("P ostal")) { | |
936 | post alList.add (address); | |
937 | } else i f (address .getType() .equalsIgn oreCase("W ork")) { | |
938 | work List.add(a ddress); | |
939 | } else i f (address .getType() .equalsIgn oreCase("P harmacy")) { | |
940 | phar mList.add( address); | |
941 | } | |
942 | } | |
943 | ||
944 | if (homeList. size()>0) patientDem ographics. getAddress ().addAll( homeList); | |
945 | if (tempList. size()>0) patientDem ographics. getAddress ().addAll( tempList); | |
946 | if (postalLis t.size()>0 ) patientD emographic s.getAddre ss().addAl l(postalLi st); | |
947 | if (workList. size()>0) patientDem ographics. getAddress ().addAll( workList); | |
948 | if (pharmList .size()>0) patientDe mographics .getAddres s().addAll (pharmList ); | |
949 | } | |
950 | ||
951 | privat e Person p arsePerson (PRPAMT201 310UV02Con tactParty contactPar ty) { | |
952 | Pe rson perso n = new Pe rson(); | |
953 | if (contactP arty.getTe lecom() != null) { | |
954 | for (TEL tel : con tactParty. getTelecom ()) { | |
955 | if ( (tel.getUs e() == nul l) | |
956 | // || ( tel.getUse ().size() > 1) //? | |
957 | || (te l.getValue ().contain s("mailto" )) | |
958 | || (te l.getValue ().contain s("@"))) { | |
959 | continue; | |
960 | } | |
961 | Stri ng telStr= ""; | |
962 | for (int i = 0 ; i < tel. getUse().s ize(); i++ ) { | |
963 | // String u se = tel.g etUse().ge t(i); | |
964 | if (i>0) | |
965 | telStr = telStr. concat(", "); | |
966 | telStr = t elStr.conc at(parsePh oneNumber( tel.getVal ue())); | |
967 | } | |
968 | ||
969 | Tele com teleco m = new Te lecom(); | |
970 | tele com.setVal ue(telStr) ; | |
971 | pers on.getTelc oms().add( telecom); | |
972 | } | |
973 | } | |
974 | ||
975 | // Name | |
976 | if (contactP arty.getCo ntactPerso n().getVal ue().getNa me() != nu ll) { | |
977 | for (EN en : conta ctParty.ge tContactPe rson().get Value().ge tName() ) { | |
978 | if ( en.getUse( ) == null) { continu e; } | |
979 | for (String us e : en.get Use()) { | |
980 | if ("L".eq ualsIgnore Case(use)) { //? PD WS_Ext_Ser v_Desc_R17 .docx p86 | |
981 | person .setName(p arseName(e n)); | |
982 | } | |
983 | } | |
984 | } | |
985 | } | |
986 | ||
987 | Pa tientDemog raphics te mpDemograp hics = new PatientDe mographics (); | |
988 | pa rseAddress ContactPar ty(contact Party, tem pDemograph ics); | |
989 | ||
990 | if (tempDemog raphics.ge tAddress() != null & & tempDemo graphics.g etAddress( ).size() > 0) { | |
991 | Address address = new Addres s(); | |
992 | address. setStreet1 (tempDemog raphics.ge tAddress() .get(0).ge tStreet1() ); | |
993 | address. setStreet2 (tempDemog raphics.ge tAddress() .get(0).ge tStreet2() ); | |
994 | address. setCity(te mpDemograp hics.getAd dress().ge t(0).getCi ty()); | |
995 | address. setStatePr ovince(tem pDemograph ics.getAdd ress().get (0).getSta teProvince ()); | |
996 | address. setPostalC ode(tempDe mographics .getAddres s().get(0) .getPostal Code()); | |
997 | ||
998 | person.g etAddress( ).add(addr ess); | |
999 | } | |
1000 | ||
1001 | if (contactP arty.getCo de()!=null && contac tParty.get Code().get DisplayNam e()!=null) | |
1002 | person.s etRelation ship(conta ctParty.ge tCode().ge tDisplayNa me()); | |
1003 | ||
1004 | re turn perso n; | |
1005 | } | |
1006 | ||
1007 | ||
1008 | privat e void par seAddressC ontactPart y(PRPAMT20 1310UV02Co ntactParty person, P atientDemo graphics p atientDemo graphics) { | |
1009 | Li st<String> streetAdd ressList = new Array List<Strin g>(); | |
1010 | Li st<Seriali zable> ser ializableL ist; | |
1011 | Ob ject objec t; | |
1012 | Bo olean isBa dAddress; | |
1013 | Bo olean isHo mePrimary; | |
1014 | Bo olean isTe mpAddress; | |
1015 | ||
1016 | // Check for home prim ary addres s and bad address | |
1017 | fo r (AD ad : person.ge tAddr()) { | |
1018 | isBadAdd ress = fal se; | |
1019 | isHomePr imary = fa lse; | |
1020 | isTempAd dress = fa lse; | |
1021 | ||
1022 | if (ad.g etUse() == null) { c ontinue; } | |
1023 | ||
1024 | for (Str ing use : ad.getUse( )) { | |
1025 | if ( use.contai ns("H")) { //? PDWS _Ext_Serv_ Desc_R17.d ocx p84 | |
1026 | isHomePrim ary = true ; | |
1027 | } el se if (use .contains( "BAD")) { | |
1028 | isBadAddre ss = true; | |
1029 | } el se if (use .contains( "TMP")) { | |
1030 | isTempAddr ess = true ; | |
1031 | } | |
1032 | } | |
1033 | ||
1034 | // 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 | |
1035 | if ((!is HomePrimar y && !isTe mpAddress) || isBadA ddress || (ad.getCon tent() == null)) { c ontinue; } | |
1036 | ||
1037 | streetAd dressList. clear(); | |
1038 | ||
1039 | Address address = new Addres s(); | |
1040 | ||
1041 | for (Ser ializable serializab le : ad.ge tContent() ) { | |
1042 | if ( serializab le instanc eof JAXBEl ement) { | |
1043 | object = ( (JAXBEleme nt) serial izable).ge tValue(); | |
1044 | if (object == null) { continue ; } | |
1045 | ||
1046 | // Street address | |
1047 | if (object instanceo f AdxpStre etAddressL ine) { | |
1048 | serial izableList = ((AdxpS treetAddre ssLine) ob ject).getC ontent(); | |
1049 | if ((s erializabl eList != n ull) && !s erializabl eList.isEm pty()) { | |
1050 | st reetAddres sList.add( serializab leList.get (0).toStri ng()); | |
1051 | } | |
1052 | } else if (object in stanceof A dxpCity) { // City | |
1053 | serial izableList = ((AdxpC ity) objec t).getCont ent(); | |
1054 | if ((s erializabl eList != n ull) && !s erializabl eList.isEm pty()) { | |
1055 | ad dress.setC ity(serial izableList .get(0).to String()); | |
1056 | } | |
1057 | } else if (object in stanceof A dxpState) { // State | |
1058 | serial izableList = ((AdxpS tate) obje ct).getCon tent(); | |
1059 | if ((s erializabl eList != n ull) && !s erializabl eList.isEm pty()) { | |
1060 | ad dress.setS tateProvin ce(seriali zableList. get(0).toS tring()); | |
1061 | } | |
1062 | } | |
1063 | // Zip cod e | |
1064 | if (object instanceo f AdxpPost alCode) { | |
1065 | serial izableList = ((AdxpP ostalCode) object).g etContent( ); | |
1066 | if ((s erializabl eList != n ull) && !s erializabl eList.isEm pty()) { | |
1067 | ad dress.setP ostalCode( serializab leList.get (0).toStri ng()); | |
1068 | } | |
1069 | } | |
1070 | } | |
1071 | } | |
1072 | ||
1073 | // Set s treet addr ess from l ist | |
1074 | if (!str eetAddress List.isEmp ty()) { | |
1075 | addr ess.setStr eet1(stree tAddressLi st.get(0)) ; | |
1076 | ||
1077 | if ( streetAddr essList.si ze() > 1) { | |
1078 | address.se tStreet2(s treetAddre ssList.get (1)); | |
1079 | } | |
1080 | } | |
1081 | patientD emographic s.getAddre ss().add(a ddress); | |
1082 | } | |
1083 | } | |
1084 | ||
1085 | privat e void par sePrimaryC areManager (PRPAMT201 310UV02Pat ient patie nt, Patien tDemograph ics patien tDemograph ics) { | |
1086 | if (patient. getCovered PartyOf() == null) { return; } | |
1087 | ||
1088 | CO CTMT510000 UV06Covera geRecord c overageRec ord; | |
1089 | CO CTMT510000 UV06Policy OrProgram policyOrPr ogram; | |
1090 | CO CTMT510000 UV06Benefi t benefit; | |
1091 | CO CTMT530000 UVObservat ion observ ation; | |
1092 | CO CTMT090000 UV01Assign edEntity a ssignedEnt ity; | |
1093 | CO CTMT090000 UV01Person person; | |
1094 | IV LTS ivlts; | |
1095 | IV XBTS ivxbt s; | |
1096 | ||
1097 | fo r (PRPAMT2 01310UV02C overedPart y coveredP arty : pat ient.getCo veredParty Of()) { | |
1098 | coverage Record = c overedPart y.getCover ageRecord( ); | |
1099 | if (cove rageRecord == null) { continue ; } | |
1100 | ||
1101 | if (cove rageRecord .getCompon ent() == n ull) { con tinue; } | |
1102 | ||
1103 | for (COC TMT510000U V06Compone nt compone nt : cover ageRecord. getCompone nt()) { | |
1104 | if ( component. getPolicyO rProgram() == null) { continue ; } | |
1105 | ||
1106 | poli cyOrProgra m = compon ent.getPol icyOrProgr am(); | |
1107 | for (COCTMT510 000UV06Cov erage2 cov erage2 : p olicyOrPro gram.getCo verageOf() ) { | |
1108 | if (covera ge2.getBen efit() == null) { co ntinue; } | |
1109 | ||
1110 | benefit = coverage2. getBenefit (); | |
1111 | for (COCTM T510000UV0 6Definitio n definiti on : benef it.getDefi nition()) { | |
1112 | if (de finition.g etObservat ion() == n ull) { con tinue; } | |
1113 | ||
1114 | observ ation = de finition.g etObservat ion().getV alue(); | |
1115 | if (ob servation == null) { continue; } | |
1116 | ||
1117 | if (ob servation. getPerform er() == nu ll) { cont inue; } | |
1118 | for (C OCTMT53000 0UVPerform er perform er : obser vation.get Performer( )) { | |
1119 | if (performe r.getAssig nedEntity( ) == null) { continu e; } | |
1120 | ||
1121 | as signedEnti ty = perfo rmer.getAs signedEnti ty().getVa lue(); | |
1122 | if (assigned Entity == null) { co ntinue; } | |
1123 | ||
1124 | if (patientDe mographics .getPrimar yProvider( ) == null) { | |
1125 | patientD emographic s.setPrima ryProvider (""); | |
1126 | } | |
1127 | // patientDem ographics. setPcmDate s(null); | |
1128 | if (patientDe mographics .getPcmCli nic() == n ull){ | |
1129 | patientD emographic s.setPcmCl inic(""); | |
1130 | } | |
1131 | ||
1132 | // PCM name | |
1133 | if (assigned Entity.get AssignedPe rson() != null) { | |
1134 | person = assignedE ntity.getA ssignedPer son().getV alue(); | |
1135 | if ((per son != nul l) && (per son.getNam e() != nul l)) { | |
1136 | for (EN en : p erson.getN ame()) { | |
1137 | if (en.get Content() == null) { continue; } | |
1138 | for (Seria lizable co ntent : en .getConten t()) { | |
1139 | patien tDemograph ics.setPri maryProvid er(content .toString( )); | |
1140 | } | |
1141 | } | |
1142 | } | |
1143 | } | |
1144 | ||
1145 | // PCM date | |
1146 | if (assigned Entity.get EffectiveT ime() != n ull) { | |
1147 | ivlts = assignedEn tity.getEf fectiveTim e(); | |
1148 | if (ivlt s.getRest( ) != null) { | |
1149 | for (JAXBEleme nt element : ivlts.g etRest()) { | |
1150 | if (!"low" .equalsIgn oreCase(el ement.getN ame().getL ocalPart() )) { conti nue; } | |
1151 | ||
1152 | ivxbts = ( IVXBTS) el ement.getV alue(); | |
1153 | if (ivxbts == null) { continue ; } | |
1154 | ||
1155 | // YYYYMMD D format ( 8 characte rs) | |
1156 | if (ivxbts .getValue( ).length() != 8) { c ontinue; } | |
1157 | patientDem ographics. setPcmDate s(Utils.to XMLGregori anCalendar (ivxbts.ge tValue())) ; | |
1158 | } | |
1159 | } | |
1160 | } | |
1161 | ||
1162 | // PCM clini c | |
1163 | // Note: Cur rently PDW S does not return th e PCM clin ic. Set to empty str ing until | |
1164 | // PDWS retu rns the cl inic name. | |
1165 | } | |
1166 | } | |
1167 | } | |
1168 | } | |
1169 | } | |
1170 | } | |
1171 | ||
1172 | privat e String p arseName(E N en) { | |
1173 | St ringBuilde r familyNa me = new S tringBuild er(); | |
1174 | St ringBuilde r givenNam e = new St ringBuilde r(); | |
1175 | St ringBuilde r prefixNa me = new S tringBuild er(); | |
1176 | St ringBuilde r suffixNa me = new S tringBuild er(); | |
1177 | Li st<Seriali zable> ser ializableL ist1; | |
1178 | Li st<Seriali zable> ser ializableL ist2; | |
1179 | St ring rtc; | |
1180 | Ob ject objec t; | |
1181 | ||
1182 | se rializable List1 = en .getConten t(); | |
1183 | if (serializ ableList1 == null) { | |
1184 | rtc = nu ll; | |
1185 | } else { | |
1186 | ||
1187 | for (Ser ializable serializab le1 : seri alizableLi st1) { | |
1188 | if ( !(serializ able1 inst anceof JAX BElement)) { continu e; } | |
1189 | ||
1190 | obje ct = ((JAX BElement) serializab le1).getVa lue(); | |
1191 | if ( object == null) { co ntinue; } | |
1192 | ||
1193 | if ( object ins tanceof En Family) { | |
1194 | serializab leList2 = ((EnFamily ) object). getContent (); | |
1195 | if (serial izableList 2 == null) { continu e; } | |
1196 | ||
1197 | for (Seria lizable se rializable 2 : serial izableList 2) { | |
1198 | family Name.appen d(serializ able2.toSt ring()); | |
1199 | family Name.appen d(" "); | |
1200 | } | |
1201 | } el se if (obj ect instan ceof EnGiv en) { | |
1202 | serializab leList2 = ((EnGiven) object).g etContent( ); | |
1203 | if (serial izableList 2 == null) { continu e; } | |
1204 | ||
1205 | for (Seria lizable se rializable 2 : serial izableList 2) { | |
1206 | givenN ame.append (serializa ble2.toStr ing()); | |
1207 | givenN ame.append (" "); | |
1208 | } | |
1209 | } el se if (obj ect instan ceof EnPre fix) { | |
1210 | serializab leList2 = ((EnPrefix ) object). getContent (); | |
1211 | if (serial izableList 2 == null) { continu e; } | |
1212 | ||
1213 | for (Seria lizable se rializable 2 : serial izableList 2) { | |
1214 | prefix Name.appen d(serializ able2.toSt ring()); | |
1215 | prefix Name.appen d(" "); | |
1216 | } | |
1217 | } el se if (obj ect instan ceof EnSuf fix) { | |
1218 | serializab leList2 = ((EnSuffix ) object). getContent (); | |
1219 | if (serial izableList 2 == null) { continu e; } | |
1220 | ||
1221 | for (Seria lizable se rializable 2 : serial izableList 2) { | |
1222 | suffix Name.appen d(serializ able2.toSt ring()); | |
1223 | suffix Name.appen d(" "); | |
1224 | } | |
1225 | } | |
1226 | } | |
1227 | ||
1228 | // add p refix befo re given n ame | |
1229 | if (pref ixName.len gth() > 0) { | |
1230 | give nName = pr efixName.a ppend(give nName); | |
1231 | } | |
1232 | ||
1233 | // // add suffix af ter family name | |
1234 | // if (su ffixName.l ength() > 0) { | |
1235 | // fa milyName.a ppend(suff ixName); | |
1236 | // } | |
1237 | ||
1238 | // add s uffix afte r given na me | |
1239 | if (suff ixName.len gth() > 0) { | |
1240 | give nName = gi venName.ap pend(suffi xName); | |
1241 | } | |
1242 | ||
1243 | rtc = fa milyName.t oString(). trim() + " ," + given Name.toStr ing().trim (); | |
1244 | } | |
1245 | re turn rtc; | |
1246 | } | |
1247 | ||
1248 | privat e String p arsePhoneN umber(Stri ng telecom ) { | |
1249 | St ringBuilde r phoneNum ber = new StringBuil der(); | |
1250 | St ringTokeni zer tokeni zer = new StringToke nizer(tele com, " "); | |
1251 | St ring token ; | |
1252 | ch ar code; | |
1253 | ||
1254 | wh ile (token izer.hasMo reTokens() ) { | |
1255 | token = tokenizer. nextToken( ); | |
1256 | code = t oken.toLow erCase(Loc ale.getDef ault()).ch arAt(0); | |
1257 | // Do no t accept t okens that begin wit h (p)riori ty, (y)es text, (n)o text | |
1258 | if ((cod e != 'p') && (code ! = 'y') && (code != ' n')) { | |
1259 | phon eNumber.ap pend(token ); | |
1260 | phon eNumber.ap pend(" "); | |
1261 | } | |
1262 | } | |
1263 | ||
1264 | re turn phone Number.toS tring().tr im(); | |
1265 | } | |
1266 | ||
1267 | privat e List<Per son> parse Sponsors(P RPAMT20131 0UV02Perso n person) { | |
1268 | Li st<Person> sponsorLi st = new A rrayList<P erson>(); | |
1269 | ||
1270 | if (person.g etPersonal Relationsh ip() != nu ll) { | |
1271 | COCTMT03 0007UVPers on person1 ; | |
1272 | ||
1273 | for (PRP AMT201310U V02Persona lRelations hip person alRelation ship : per son.getPer sonalRelat ionship()) { | |
1274 | Pers on sponsor = new Per son(); | |
1275 | if ( personalRe lationship .getRelati onshipHold er1() == n ull) { con tinue; } | |
1276 | ||
1277 | pers on1 = pers onalRelati onship.get Relationsh ipHolder1( ).getValue (); | |
1278 | if ( person1 == null) { c ontinue; } | |
1279 | ||
1280 | // N ame | |
1281 | if ( person1.ge tName() != null) { | |
1282 | for (EN en : person1 .getName() ) { | |
1283 | if (en .getUse() == null) { continue; } | |
1284 | for (S tring use : en.getUs e()) { | |
1285 | if ("L".equa lsIgnoreCa se(use)) { | |
1286 | sponsor. setName(pa rseName(en )); | |
1287 | } | |
1288 | } | |
1289 | } | |
1290 | } | |
1291 | ||
1292 | // R elation | |
1293 | if ( personalRe lationship .getCode() != null) { | |
1294 | sponsor.se tRelations hip(person alRelation ship.getCo de().getDi splayName( )); | |
1295 | } | |
1296 | ||
1297 | // S SN | |
1298 | if ( person1.ge tAsOtherID s() != nul l) { | |
1299 | for (COCTM T030007UVO therIDs ot herIDs : p erson1.get AsOtherIDs ()) { | |
1300 | if (ot herIDs.get Id() == nu ll) { cont inue; } | |
1301 | for (I I ii : oth erIDs.getI d()) { | |
1302 | if ("2.16.84 0.1.113883 .4.1".equa lsIgnoreCa se(ii.getR oot())) { | |
1303 | sponsor. setIdentif ier(ii.get Extension( )); | |
1304 | } | |
1305 | } | |
1306 | } | |
1307 | } | |
1308 | ||
1309 | spon sorList.ad d(sponsor) ; | |
1310 | } | |
1311 | } | |
1312 | ||
1313 | re turn spons orList; | |
1314 | } | |
1315 | ||
1316 | privat e List<Pat ient> pars ePersonalR elationshi p(PRPAMT20 1310UV02Pe rson perso n) { | |
1317 | Li st<Patient > patientL ist = new ArrayList< Patient>() ; | |
1318 | ||
1319 | if (person.g etPersonal Relationsh ip() != nu ll) { | |
1320 | COCTMT03 0007UVPers on person1 ; | |
1321 | Patient patient; | |
1322 | ||
1323 | for (PRP AMT201310U V02Persona lRelations hip person alRelation ship : per son.getPer sonalRelat ionship()) { | |
1324 | if ( personalRe lationship .getRelati onshipHold er1() == n ull) { con tinue; } | |
1325 | ||
1326 | pers on1 = pers onalRelati onship.get Relationsh ipHolder1( ).getValue (); | |
1327 | if ( person1 == null) { c ontinue; } | |
1328 | ||
1329 | pati ent = new Patient(); | |
1330 | ||
1331 | // E DIPI | |
1332 | if ( person1.ge tId() != n ull) { | |
1333 | for (II ii : person1 .getId()) { | |
1334 | if ("2 .16.840.1. 113883.3.4 2.10001.10 0001.12".e qualsIgnor eCase(ii.g etRoot())) { | |
1335 | pa tient.setE DIPI(ii.ge tExtension ()); | |
1336 | } | |
1337 | } | |
1338 | } | |
1339 | ||
1340 | // N ame | |
1341 | if ( person1.ge tName() != null) { | |
1342 | for (EN en : person1 .getName() ) { | |
1343 | if (en .getUse() == null) { continue; } | |
1344 | for (S tring use : en.getUs e()) { | |
1345 | if ("L".equa lsIgnoreCa se(use)) { | |
1346 | patient. setName(pa rseName(en )); | |
1347 | } | |
1348 | } | |
1349 | } | |
1350 | } | |
1351 | ||
1352 | // G ender | |
1353 | if ( person1.ge tAdministr ativeGende rCode() != null) { | |
1354 | patient.se tGender(pe rson1.getA dministrat iveGenderC ode().getC ode()); | |
1355 | } | |
1356 | ||
1357 | // D ate of bir th | |
1358 | if ( person1.ge tBirthTime () != null ) { | |
1359 | patient.se tDob(perso n1.getBirt hTime().ge tValue()); | |
1360 | } | |
1361 | ||
1362 | // S SN | |
1363 | if ( person1.ge tAsOtherID s() != nul l) { | |
1364 | for (COCTM T030007UVO therIDs ot herIDs : p erson1.get AsOtherIDs ()) { | |
1365 | if (ot herIDs.get Id() == nu ll) { cont inue; } | |
1366 | for (I I ii : oth erIDs.getI d()) { | |
1367 | if ("2.16.84 0.1.113883 .4.1".equa lsIgnoreCa se(ii.getR oot())) { | |
1368 | patient. setSSN(ii. getExtensi on()); | |
1369 | } | |
1370 | } | |
1371 | } | |
1372 | } | |
1373 | ||
1374 | pati entList.ad d(patient) ; | |
1375 | } | |
1376 | } | |
1377 | ||
1378 | re turn patie ntList; | |
1379 | } | |
1380 | ||
1381 | public ResponseP atientQuer y lookupPa tient(PDWS QueryBean queryBean) throws JM eadowsExce ption { | |
1382 | PR PAIN201305 UV02 reque st = gener ateRequest (queryBean ); | |
1383 | PR PAIN201306 UV02 respo nse; | |
1384 | Re sponsePati entQuery r tc = null; | |
1385 | ||
1386 | St ring inqui ryType = q ueryBean.g etInquiryT ype(); | |
1387 | if ("PS".equ alsIgnoreC ase(inquir yType)) { | |
1388 | // Perso n Search | |
1389 | response = getEnti tyPatientS earchPort( ).entityPa tientSearc h(request) ; | |
1390 | } else if (" PR".equals IgnoreCase (inquiryTy pe)) { | |
1391 | // Patie nt Retriev e | |
1392 | response = getEnti tyPatientR etrievePor t().entity PatientRet rieve(requ est); | |
1393 | } else if (" FS".equals IgnoreCase (inquiryTy pe)) { | |
1394 | // Famil y Search | |
1395 | response = getEnti tyFamilySe archPort() .entityPat ientFamily Search(req uest); | |
1396 | } else if (" FR".equals IgnoreCase (inquiryTy pe)) { | |
1397 | // Famil y Retrieve | |
1398 | response = getEnti tyFamilyRe trievePort ().entityP atientFami lyRetrieve (request); | |
1399 | } else { | |
1400 | // Inval id Inquiry Type | |
1401 | throw ne w JMeadows Exception( "Invalid I nquiryType :" + inqui ryType); | |
1402 | } | |
1403 | ||
1404 | if (response != null) { | |
1405 | rtc = pa rseRespons e(response , inquiryT ype); | |
1406 | if (rtc != null && !rtc.getP atients(). isEmpty()) { | |
1407 | bool ean found = true; | |
1408 | whil e (found) { | |
1409 | found = fa lse; | |
1410 | List<Patie nt> patien ts = rtc.g etPatients (); | |
1411 | Patient bl acklisted = null; | |
1412 | for (Patie nt patient : patient s) { | |
1413 | if (PD WSBlackLis t.getInsta nce().isBl ackListed( patient.ge tEDIPI())) { | |
1414 | fo und = true ; | |
1415 | bl acklisted = patient; | |
1416 | br eak; | |
1417 | } | |
1418 | } | |
1419 | if (blackl isted != n ull) { | |
1420 | LOGGER .error("re moving bla cklisted p atient"); | |
1421 | patien ts.remove( blackliste d); | |
1422 | rtc.se tPatients( patients); | |
1423 | } | |
1424 | } | |
1425 | } | |
1426 | } | |
1427 | re turn rtc; | |
1428 | } | |
1429 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.