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