Produced by Araxis Merge on 5/1/2018 12:02:00 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\BHIERelayService\src\main\java\gov\va\med\bhie\webservice | BHIERelay.java | Thu Mar 29 22:08:32 2018 UTC |
2 | C:\AraxisMergeCompare\Pri_re\ZIP\JLV_2.6.2.0.3_src\BHIERelayService\src\main\java\gov\va\med\bhie\webservice | BHIERelay.java | Tue May 1 14:38:28 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 3042 |
Changed | 2 | 4 |
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 | * Honorab le Senator Daniel K. Inouye | |
7 | * VA Paci fic Island s Health C are System | |
8 | * Tripler Army Medi cal Center | |
9 | */ | |
10 | package go v.va.med.b hie.webser vice; | |
11 | ||
12 | import com .fasterxml .jackson.c ore.JsonPr ocessingEx ception; | |
13 | import com .fasterxml .jackson.d atabind.De serializat ionFeature ; | |
14 | import com .fasterxml .jackson.d atabind.Ob jectMapper ; | |
15 | import com .sun.jerse y.core.uti l.Base64; | |
16 | import gov .va.med.bh ie.beans.* ; | |
17 | import gov .va.med.bh ie.common. AppConfig; | |
18 | import gov .va.med.bh ie.common. ClinicalDo mainLoincC ode; | |
19 | import gov .va.med.bh ie.dao.Dao Exception; | |
20 | import gov .va.med.bh ie.dao.pat ient.NoteD ao; | |
21 | import gov .va.med.bh ie.dao.pat ient.V4Dao ; | |
22 | import gov .va.med.bh ie.dao.pat ient.VLERD ao; | |
23 | import gov .va.med.bh ie.dataser vice.Snare worksHandl er; | |
24 | import gov .va.med.bh ie.resultc ollection. ResultColl ection; | |
25 | import gov .va.med.bh ie.resultc ollection. V4ResultCo llection; | |
26 | import gov .va.med.bh ie.util.DB Logger; | |
27 | import org .apache.co mmons.coll ections4.C ollectionU tils; | |
28 | import org .slf4j.Log ger; | |
29 | import org .slf4j.Log gerFactory ; | |
30 | import org .w3c.dom.D ocument; | |
31 | import org .xml.sax.I nputSource ; | |
32 | import org .xml.sax.S AXExceptio n; | |
33 | ||
34 | import jav ax.annotat ion.Resour ce; | |
35 | import jav ax.jws.Han dlerChain; | |
36 | import jav ax.jws.Web Method; | |
37 | import jav ax.jws.Web Param; | |
38 | import jav ax.jws.Web Service; | |
39 | import jav ax.mail.Me ssagingExc eption; | |
40 | import jav ax.mail.in ternet.Mim eUtility; | |
41 | import jav ax.xml.par sers.Docum entBuilder ; | |
42 | import jav ax.xml.par sers.Docum entBuilder Factory; | |
43 | import jav ax.xml.par sers.Parse rConfigura tionExcept ion; | |
44 | import jav ax.xml.ws. WebService Context; | |
45 | import jav ax.xml.ws. handler.Me ssageConte xt; | |
46 | import jav a.io.ByteA rrayOutput Stream; | |
47 | import jav a.io.IOExc eption; | |
48 | import jav a.io.Outpu tStream; | |
49 | import jav a.io.Strin gReader; | |
50 | import jav a.text.Sim pleDateFor mat; | |
51 | import jav a.util.Arr ayList; | |
52 | import jav a.util.Lis t; | |
53 | import jav a.util.Loc ale; | |
54 | ||
55 | import sta tic gov.va .med.bhie. common.Cli nicalDomai nLoincCode .VLERCCDA; | |
56 | ||
57 | //import g ov.va.med. foundation s.utilitie s.ARMLog; | |
58 | ||
59 | /** | |
60 | * BHIE Re lay web se rvice. | |
61 | * | |
62 | * @author brunos | |
63 | * @author <a href=" mailto:kwe ller@hawai irg.com">k weller</a> | |
64 | * @versio n 1.0 | |
65 | * | |
66 | */ | |
67 | @WebServic e | |
68 | @HandlerCh ain(file = "SoapHand lerChain.x ml") | |
69 | public cla ss BHIERel ay { | |
70 | ||
71 | /** | |
72 | * Log ger. | |
73 | */ | |
74 | privat e static f inal Logge r LOGGER = LoggerFac tory.getLo gger(BHIER elay.class ); | |
75 | ||
76 | /** | |
77 | * Web context. | |
78 | */ | |
79 | @Resou rce | |
80 | privat e WebServi ceContext wsContext; | |
81 | ||
82 | ||
83 | /** | |
84 | * Get deploymen t forms. | |
85 | * | |
86 | * @pa ram queryB ean query bean | |
87 | * @re turn deplo yment list collectio n | |
88 | */ | |
89 | @WebMe thod(opera tionName = "getDeplo ymentForms ") | |
90 | public V4ResultC ollection getDeploym entForms(@ WebParam(n ame = "que ryBean") Q ueryBean q ueryBean) { | |
91 | re turn getV4 (ClinicalD omainLoinc Code.DEPLO YMENT_FORM S, queryBe an); | |
92 | } | |
93 | ||
94 | /** | |
95 | * Get patient e ncounter n otes. | |
96 | * | |
97 | * @pa ram queryB ean query bean | |
98 | * @re turn note collection | |
99 | */ | |
100 | @WebMe thod(opera tionName = "getEncou nterNotes" ) | |
101 | public V4ResultC ollection getEncount erNotes(@W ebParam(na me = "quer yBean") Qu eryBean qu eryBean) { | |
102 | re turn getV4 (ClinicalD omainLoinc Code.ENCOU NTER_NOTES , queryBea n); | |
103 | } | |
104 | ||
105 | /** | |
106 | * Get HAIMS doc uments. | |
107 | * | |
108 | * @pa ram queryB ean query bean | |
109 | * @re turn note collection | |
110 | */ | |
111 | @WebMe thod(opera tionName = "getHAIMS Documents" ) | |
112 | public V4ResultC ollection getHAIMSDo cuments(@W ebParam(na me = "quer yBean") Qu eryBean qu eryBean) { | |
113 | St ring oid = AppConfig .getInstan ce().getPr operties() .getProper ty( | |
114 | "inc ludedsourc es." + Cli nicalDomai nLoincCode .DOCUMENTS .getLoincC ode() + ". haims"); | |
115 | Li st<String> includedS ources = n ew ArrayLi st<String> (); | |
116 | in cludedSour ces.add(oi d); | |
117 | qu eryBean.se tIncludedS ources(inc ludedSourc es); | |
118 | re turn getV4 (ClinicalD omainLoinc Code.DOCUM ENTS, quer yBean); | |
119 | } | |
120 | ||
121 | /** | |
122 | * Get HAIMS doc uments. | |
123 | * | |
124 | * @pa ram queryB ean query bean | |
125 | * @re turn note collection | |
126 | */ | |
127 | @WebMe thod(opera tionName = "getHAIMS DASDocumen ts") | |
128 | public V4ResultC ollection getHAIMSDA SDocuments (@WebParam (name = "q ueryBean") QueryBean queryBean ) { | |
129 | St ring oid = AppConfig .getInstan ce().getPr operties() .getProper ty( | |
130 | "inc ludedsourc es." + Cli nicalDomai nLoincCode .DOCUMENTS .getLoincC ode() + ". haimsdas") ; | |
131 | Li st<String> includedS ources = n ew ArrayLi st<String> (); | |
132 | in cludedSour ces.add(oi d); | |
133 | qu eryBean.se tIncludedS ources(inc ludedSourc es); | |
134 | re turn getV4 (ClinicalD omainLoinc Code.DOCUM ENTS, quer yBean); | |
135 | } | |
136 | ||
137 | /** | |
138 | * Get MHS Genes is documen ts. | |
139 | * | |
140 | * @pa ram queryB ean query bean | |
141 | * @re turn note collection | |
142 | */ | |
143 | @WebMe thod(opera tionName = "getMhsGe nesisDocum ents") | |
144 | public V4ResultC ollection getMhsGene sisDocumen ts(@WebPar am(name = "queryBean ") QueryBe an queryBe an) { | |
145 | St ring oid = AppConfig .getInstan ce().getPr operties() .getProper ty( | |
146 | "inc ludedsourc es." + Cli nicalDomai nLoincCode .DOCUMENTS .getLoincC ode() + ". genesis"); | |
147 | // String cla ssCodes = AppConfig. getInstanc e().getPro perties(). getPropert y("CLASS_C ODE.DOCUME NTS", ""); | |
148 | // String typ eCodes = A ppConfig.g etInstance ().getProp erties().g etProperty ("TYPE_COD E.DOCUMENT S", "");; | |
149 | ||
150 | Li st<String> includedS ources = n ew ArrayLi st<String> (); | |
151 | in cludedSour ces.add(oi d); | |
152 | qu eryBean.se tIncludedS ources(inc ludedSourc es); | |
153 | // queryBean. setClassCo des(classC odes); | |
154 | // queryBean. setTypeCod es(typeCod es); | |
155 | re turn getV4 (ClinicalD omainLoinc Code.DOCUM ENTS, quer yBean); | |
156 | } | |
157 | ||
158 | /** | |
159 | * Get MHS Genes is Encount er documen ts. | |
160 | * | |
161 | * @pa ram queryB ean query bean | |
162 | * @re turn note collection | |
163 | */ | |
164 | @WebMe thod(opera tionName = "getGenes isEncounte rs") | |
165 | public V4ResultC ollection getGenesis Encounters (@WebParam (name = "q ueryBean") QueryBean queryBean ) { | |
166 | St ring oid = AppConfig .getInstan ce().getPr operties() .getProper ty( | |
167 | "inc ludedsourc es." + Cli nicalDomai nLoincCode .DOCUMENTS .getLoincC ode() + ". genesis"); | |
168 | St ring class Codes = Ap pConfig.ge tInstance( ).getPrope rties().ge tProperty( "CLASS_COD E.OUTPATIE NT_ENCOUNT ERS", ""); | |
169 | St ring typeC odes = App Config.get Instance() .getProper ties().get Property(" TYPE_CODE. OUTPATIENT _ENCOUNTER S", "");; | |
170 | ||
171 | Li st<String> includedS ources = n ew ArrayLi st<String> (); | |
172 | in cludedSour ces.add(oi d); | |
173 | ||
174 | qu eryBean.se tIncludedS ources(inc ludedSourc es); | |
175 | qu eryBean.se tClassCode s(classCod es); | |
176 | qu eryBean.se tTypeCodes (typeCodes ); | |
177 | re turn getV4 (ClinicalD omainLoinc Code.DOCUM ENTS, quer yBean); | |
178 | } | |
179 | ||
180 | /** | |
181 | * Get MHS Genes is Consult Encounter s. | |
182 | * | |
183 | * @pa ram queryB ean query bean | |
184 | * @re turn note collection | |
185 | */ | |
186 | @WebMe thod(opera tionName = "getGenes isConsults ") | |
187 | public V4ResultC ollection getGenesis Consults(@ WebParam(n ame = "que ryBean") Q ueryBean q ueryBean) { | |
188 | St ring oid = AppConfig .getInstan ce().getPr operties() .getProper ty( | |
189 | "inc ludedsourc es." + Cli nicalDomai nLoincCode .DOCUMENTS .getLoincC ode() + ". genesis"); | |
190 | St ring class Codes = Ap pConfig.ge tInstance( ).getPrope rties().ge tProperty( "CLASS_COD E.CONSULT_ ENCOUNTERS ", ""); | |
191 | St ring typeC odes = App Config.get Instance() .getProper ties().get Property(" TYPE_CODE. CONSULT_EN COUNTERS", "");; | |
192 | ||
193 | Li st<String> includedS ources = n ew ArrayLi st<String> (); | |
194 | in cludedSour ces.add(oi d); | |
195 | ||
196 | qu eryBean.se tIncludedS ources(inc ludedSourc es); | |
197 | qu eryBean.se tClassCode s(classCod es); | |
198 | qu eryBean.se tTypeCodes (typeCodes ); | |
199 | re turn getV4 (ClinicalD omainLoinc Code.DOCUM ENTS, quer yBean); | |
200 | } | |
201 | ||
202 | /** | |
203 | * Get MHS Genes is Inpatie nt Summari es. | |
204 | * | |
205 | * @pa ram queryB ean query bean | |
206 | * @re turn note collection | |
207 | */ | |
208 | @WebMe thod(opera tionName = "getGenes isInpatien tSummaries ") | |
209 | public V4ResultC ollection getGenesis InpatientS ummaries(@ WebParam(n ame = "que ryBean") Q ueryBean q ueryBean) { | |
210 | St ring oid = AppConfig .getInstan ce().getPr operties() .getProper ty( | |
211 | "inc ludedsourc es." + Cli nicalDomai nLoincCode .DOCUMENTS .getLoincC ode() + ". genesis"); | |
212 | St ring class Codes = Ap pConfig.ge tInstance( ).getPrope rties().ge tProperty( "CLASS_COD E.INPATIEN T_SUMMARIE S", ""); | |
213 | St ring typeC odes = App Config.get Instance() .getProper ties().get Property(" TYPE_CODE. INPATIENT_ SUMMARIES" , "");; | |
214 | ||
215 | Li st<String> includedS ources = n ew ArrayLi st<String> (); | |
216 | in cludedSour ces.add(oi d); | |
217 | ||
218 | qu eryBean.se tIncludedS ources(inc ludedSourc es); | |
219 | qu eryBean.se tClassCode s(classCod es); | |
220 | qu eryBean.se tTypeCodes (typeCodes ); | |
221 | re turn getV4 (ClinicalD omainLoinc Code.DOCUM ENTS, quer yBean); | |
222 | } | |
223 | ||
224 | /** | |
225 | * Get MHS Genes is Procedu res. | |
226 | * | |
227 | * @pa ram queryB ean query bean | |
228 | * @re turn note collection | |
229 | */ | |
230 | @WebMe thod(opera tionName = "getGenes isProcedur es") | |
231 | public V4ResultC ollection getGenesis Procedures (@WebParam (name = "q ueryBean") QueryBean queryBean ) { | |
232 | St ring oid = AppConfig .getInstan ce().getPr operties() .getProper ty( | |
233 | "inc ludedsourc es." + Cli nicalDomai nLoincCode .DOCUMENTS .getLoincC ode() + ". genesis"); | |
234 | St ring class Codes = Ap pConfig.ge tInstance( ).getPrope rties().ge tProperty( "CLASS_COD E.PROCEDUR ES", ""); | |
235 | St ring typeC odes = App Config.get Instance() .getProper ties().get Property(" TYPE_CODE. PROCEDURES ", "");; | |
236 | ||
237 | Li st<String> includedS ources = n ew ArrayLi st<String> (); | |
238 | in cludedSour ces.add(oi d); | |
239 | ||
240 | qu eryBean.se tIncludedS ources(inc ludedSourc es); | |
241 | qu eryBean.se tClassCode s(classCod es); | |
242 | qu eryBean.se tTypeCodes (typeCodes ); | |
243 | re turn getV4 (ClinicalD omainLoinc Code.DOCUM ENTS, quer yBean); | |
244 | } | |
245 | ||
246 | /** | |
247 | * Get MHS Genes is Procedu res. | |
248 | * | |
249 | * @pa ram queryB ean query bean | |
250 | * @re turn note collection | |
251 | */ | |
252 | @WebMe thod(opera tionName = "getGenes isDocument s") | |
253 | public V4ResultC ollection getGenesis Documents( @WebParam( name = "qu eryBean") QueryBean queryBean) { | |
254 | St ring oid = AppConfig .getInstan ce().getPr operties() .getProper ty( | |
255 | "inc ludedsourc es." + Cli nicalDomai nLoincCode .DOCUMENTS .getLoincC ode() + ". genesis"); | |
256 | St ring class Codes = Ap pConfig.ge tInstance( ).getPrope rties().ge tProperty( "CLASS_COD E.DOCUMENT S", ""); | |
257 | St ring typeC odes = App Config.get Instance() .getProper ties().get Property(" TYPE_CODE. DOCUMENTS" , "");; | |
258 | ||
259 | Li st<String> includedS ources = n ew ArrayLi st<String> (); | |
260 | in cludedSour ces.add(oi d); | |
261 | ||
262 | qu eryBean.se tIncludedS ources(inc ludedSourc es); | |
263 | qu eryBean.se tClassCode s(classCod es); | |
264 | qu eryBean.se tTypeCodes (typeCodes ); | |
265 | re turn getV4 (ClinicalD omainLoinc Code.DOCUM ENTS, quer yBean); | |
266 | } | |
267 | ||
268 | // /** | |
269 | // * G et inpatie nt notes ( Essentris notes). | |
270 | // * | |
271 | // * @ param quer yBean quer y bean | |
272 | // * @ return not e collecti on | |
273 | // */ | |
274 | // @Web Method(ope rationName = "getInp atientNote s") | |
275 | // publ ic V4Resul tCollectio n getInpat ientNotes( @WebParam( name = "qu eryBean") QueryBean queryBean) { | |
276 | // return get V4(Clinica lDomainLoi ncCode.INP ATIENT_NOT ES, queryB ean); | |
277 | // } | |
278 | ||
279 | /** | |
280 | * Get note imag e. | |
281 | * | |
282 | * @pa ram eventI d event ID | |
283 | * @re turn note image | |
284 | */ | |
285 | @WebMe thod(opera tionName = "getNoteI mage") | |
286 | public NoteImage getNoteIm age(@WebPa ram(name = "eventId" ) String e ventId) { | |
287 | No teDao note Dao = new NoteDao(); | |
288 | tr y { | |
289 | NoteImag e rtc; | |
290 | rtc = no teDao.getN oteImage(e ventId); | |
291 | if (!"fa lse".equal sIgnoreCas e((String) AppConfig .getInstan ce().getPr operties() .get("fixr tf"))) { | |
292 | rtc = NoteFixe r.fixNoteI mage(rtc, "pdf".equa lsIgnoreCa se(AppConf ig.getInst ance().get NoteConver tFormat()) ); | |
293 | } | |
294 | ||
295 | if (rtc != null) { | |
296 | Stri ng content Type = rtc .getConten tType(); | |
297 | /* f latten pdf note type s to remov e fillable pdf */ | |
298 | if ( "applicati on/octet-s tream".equ alsIgnoreC ase(conten tType) | |
299 | || "ap plication/ pdf".equal sIgnoreCas e(contentT ype)) { | |
300 | rtc = Note Fixer.flat tenNoteFor m(rtc); | |
301 | } | |
302 | } | |
303 | ||
304 | ||
305 | return r tc; | |
306 | } catch (Dao Exception e) { | |
307 | logError (e); | |
308 | throw ne w RuntimeE xception(e ); | |
309 | } | |
310 | } | |
311 | ||
312 | /** | |
313 | * Get note imag e encoded. | |
314 | * | |
315 | * @pa ram url No te image u rl. | |
316 | * @re turn note image | |
317 | */ | |
318 | @WebMe thod(opera tionName = "getNoteI mageEncode dFromUrl") | |
319 | public NoteImage Encoded ge tNoteImage EncodedFro mUrl(@WebP aram(name = "url") S tring url) { | |
320 | No teDao note Dao = new NoteDao(); | |
321 | tr y { | |
322 | NoteImag e rtc; | |
323 | rtc = no teDao.getN oteImageFr omUrl(url) ; | |
324 | if (!"fa lse".equal sIgnoreCas e((String) AppConfig .getInstan ce().getPr operties() .get("fixr tf"))) { | |
325 | rtc = NoteFixe r.fixNoteI mage(rtc, "pdf".equa lsIgnoreCa se(AppConf ig.getInst ance().get NoteConver tFormat()) ); | |
326 | } | |
327 | ||
328 | String c ontentType = rtc.get ContentTyp e(); | |
329 | /* flatt en pdf not e types to remove fi llable pdf */ | |
330 | if ("app lication/o ctet-strea m".equalsI gnoreCase( contentTyp e) | |
331 | || "applic ation/pdf" .equalsIgn oreCase(co ntentType) ) { | |
332 | rtc = NoteFixe r.flattenN oteForm(rt c); | |
333 | } | |
334 | ||
335 | NoteImag eEncoded r tc2 = new NoteImageE ncoded(); | |
336 | rtc2.set ContentDis position(r tc.getCont entDisposi tion()); | |
337 | rtc2.set ContentTyp e(rtc.getC ontentType ()); | |
338 | ||
339 | ByteArra yOutputStr eam baos = null; | |
340 | OutputSt ream b64os = null; | |
341 | try { | |
342 | baos = new Byt eArrayOutp utStream() ; | |
343 | b64o s = MimeUt ility.enco de(baos, " base64"); | |
344 | b64o s.write(rt c.getNoteB ytes()); | |
345 | b64o s.close(); | |
346 | rtc2 .setNoteBy tesEncoded (new Strin g(baos.toB yteArray() , "UTF-8") ); | |
347 | } finall y { | |
348 | if ( b64os != n ull) { | |
349 | b64os.clos e(); | |
350 | } | |
351 | if ( baos != nu ll) { | |
352 | baos.close (); | |
353 | } | |
354 | } | |
355 | return r tc2; | |
356 | } catch (IOE xception e ) { | |
357 | logError (e); | |
358 | throw ne w RuntimeE xception(e ); | |
359 | } catch (Mes sagingExce ption e) { | |
360 | logError (e); | |
361 | throw ne w RuntimeE xception(e ); | |
362 | } catch (Dao Exception e) { | |
363 | logError (e); | |
364 | throw ne w RuntimeE xception(e ); | |
365 | } | |
366 | } | |
367 | ||
368 | /** | |
369 | * Get note imag e encoded. | |
370 | * | |
371 | * @pa ram eventI d event ID | |
372 | * @re turn note image | |
373 | */ | |
374 | @WebMe thod(opera tionName = "getNoteI mageEncode d") | |
375 | public NoteImage Encoded ge tNoteImage Encoded(@W ebParam(na me = "even tId") Stri ng eventId ) { | |
376 | No teDao note Dao = new NoteDao(); | |
377 | tr y { | |
378 | NoteImag e rtc; | |
379 | rtc = no teDao.getN oteImage(e ventId); | |
380 | if (!"fa lse".equal sIgnoreCas e((String) AppConfig .getInstan ce().getPr operties() .get("fixr tf"))) { | |
381 | rtc = NoteFixe r.fixNoteI mage(rtc, "pdf".equa lsIgnoreCa se(AppConf ig.getInst ance().get NoteConver tFormat()) ); | |
382 | } | |
383 | ||
384 | if (rtc != null) { | |
385 | Stri ng content Type = rtc .getConten tType(); | |
386 | /* f latten pdf note type s to remov e fillable pdf */ | |
387 | if ( "applicati on/octet-s tream".equ alsIgnoreC ase(conten tType) | |
388 | || "ap plication/ pdf".equal sIgnoreCas e(contentT ype)) { | |
389 | rtc = Note Fixer.flat tenNoteFor m(rtc); | |
390 | } | |
391 | } | |
392 | ||
393 | NoteImag eEncoded r tc2 = new NoteImageE ncoded(); | |
394 | if(rtc ! = null) { | |
395 | rtc2 .setConten tDispositi on(rtc.get ContentDis position() ); | |
396 | rtc2 .setConten tType(rtc. getContent Type()); | |
397 | } | |
398 | ||
399 | ByteArra yOutputStr eam baos = null; | |
400 | OutputSt ream b64os = null; | |
401 | try { | |
402 | baos = new Byt eArrayOutp utStream() ; | |
403 | b64o s = MimeUt ility.enco de(baos, " base64"); | |
404 | if(r tc != null ) { | |
405 | b64os.writ e(rtc.getN oteBytes() ); | |
406 | } | |
407 | b64o s.close(); | |
408 | rtc2 .setNoteBy tesEncoded (new Strin g(baos.toB yteArray() , "UTF-8") ); | |
409 | } finall y { | |
410 | if ( b64os != n ull) { | |
411 | b64os.clos e(); | |
412 | } | |
413 | if ( baos != nu ll) { | |
414 | baos.close (); | |
415 | } | |
416 | } | |
417 | return r tc2; | |
418 | } catch (IOE xception e ) { | |
419 | logError (e); | |
420 | throw ne w RuntimeE xception(e ); | |
421 | } catch (Mes sagingExce ption e) { | |
422 | logError (e); | |
423 | throw ne w RuntimeE xception(e ); | |
424 | } catch (Dao Exception e) { | |
425 | logError (e); | |
426 | throw ne w RuntimeE xception(e ); | |
427 | } | |
428 | } | |
429 | ||
430 | /** | |
431 | * Get note imag e. | |
432 | * | |
433 | * @pa ram url No te image u rl. | |
434 | * @re turn note image | |
435 | */ | |
436 | @WebMe thod(opera tionName = "getNoteI mageFromUr l") | |
437 | public NoteImage getNoteIm ageFromUrl (@WebParam (name = "u rl") Strin g url) { | |
438 | No teDao note Dao = new NoteDao(); | |
439 | tr y { | |
440 | NoteImag e rtc; | |
441 | rtc = no teDao.getN oteImageFr omUrl(url) ; | |
442 | if (!"fa lse".equal sIgnoreCas e((String) AppConfig .getInstan ce().getPr operties() .get("fixr tf"))) { | |
443 | rtc = NoteFixe r.fixNoteI mage(rtc, "pdf".equa lsIgnoreCa se(AppConf ig.getInst ance().get NoteConver tFormat()) ); | |
444 | } | |
445 | ||
446 | if (rtc != null) { | |
447 | Stri ng content Type = rtc .getConten tType(); | |
448 | /* f latten pdf note type s to remov e fillable pdf */ | |
449 | if ( "applicati on/octet-s tream".equ alsIgnoreC ase(conten tType) | |
450 | || "ap plication/ pdf".equal sIgnoreCas e(contentT ype)) { | |
451 | rtc = Note Fixer.flat tenNoteFor m(rtc); | |
452 | } | |
453 | } | |
454 | ||
455 | return r tc; | |
456 | } catch (Dao Exception e) { | |
457 | logError (e); | |
458 | throw ne w RuntimeE xception(e ); | |
459 | } | |
460 | } | |
461 | ||
462 | /** | |
463 | * Get note atta chment fro m URL. | |
464 | * | |
465 | * @pa ram url No te image u rl. | |
466 | * @re turn note image | |
467 | */ | |
468 | @WebMe thod(opera tionName = "getNoteA ttachmentF romUrl") | |
469 | public NoteImage getNoteAt tachmentFr omUrl(@Web Param(name = "url") String url ) { | |
470 | No teDao note Dao = new NoteDao(); | |
471 | tr y { | |
472 | NoteImag e rtc; | |
473 | rtc = no teDao.getN oteImageFr omUrl(url) ; | |
474 | ||
475 | if (rtc != null && rtc.getNo teBytes() != null) { | |
476 | try { | |
477 | ||
478 | String dat aXML = new String(rt c.getNoteB ytes(), "U TF-8"); | |
479 | ||
480 | DocumentBu ilderFacto ry dbFacto ry = Docum entBuilder Factory.ne wInstance( ); | |
481 | ||
482 | dbFactory. setFeature ("http://x ml.org/sax /features/ external-g eneral-ent ities", fa lse); | |
483 | dbFactory. setFeature ("http://x ml.org/sax /features/ external-p arameter-e ntities", false); | |
484 | dbFactory. setFeature ("http://j avax.xml.X MLConstant s/feature/ secure-pro cessing", true); | |
485 | ||
486 | DocumentBu ilder dBui lder = dbF actory.new DocumentBu ilder(); | |
487 | InputSourc e is = new InputSour ce(new Str ingReader( dataXML)); | |
488 | Document d oc = dBuil der.parse( is); | |
489 | ||
490 | // StringBu ffer attac hmentOutpu t = new St ringBuffer (""); | |
491 | String enc odedText = ""; | |
492 | String med iaType = " text/html" ; | |
493 | ||
494 | if (doc != null && d oc.getElem entsByTagN ame("text" ) != null | |
495 | && doc.getEl ementsByTa gName("tex t").item(0 ) != null | |
496 | && !doc.getE lementsByT agName("te xt").item( 0).getText Content(). isEmpty()) { | |
497 | encode dText = do c.getEleme ntsByTagNa me("text") .item(0).g etTextCont ent(); | |
498 | ||
499 | if (do c.getEleme ntsByTagNa me("text") .item(0).g etAttribut es().getNa medItem("m ediaType") != null) { | |
500 | me diaType = doc.getEle mentsByTag Name("text ").item(0) .getAttrib utes().get NamedItem( "mediaType ").getNode Value(); | |
501 | } | |
502 | } | |
503 | ||
504 | rtc.setCon tentType(m ediaType); | |
505 | ||
506 | if (mediaT ype.contai ns("plain" ) || media Type.conta ins("html" ) || media Type.conta ins("image ")) { | |
507 | // do nothing, l et web-fro nt end ren der the at tachment i n-line | |
508 | } else if (mediaType .contains( "applicati on") || me diaType.co ntains("rt f")) { | |
509 | rtc.se tNoteBytes (Base64.de code(encod edText)); | |
510 | } | |
511 | ||
512 | } ca tch (Parse rConfigura tionExcept ion e) { | |
513 | logError(e ); | |
514 | } ca tch (SAXEx ception e) { | |
515 | logError(e ); | |
516 | } ca tch (IOExc eption e) { | |
517 | logError(e ); | |
518 | } | |
519 | } | |
520 | ||
521 | if (!"fa lse".equal sIgnoreCas e((String) AppConfig .getInstan ce().getPr operties() .get("fixr tf"))) { | |
522 | rtc = NoteFixe r.fixNoteI mage(rtc, "pdf".equa lsIgnoreCa se(AppConf ig.getInst ance().get NoteConver tFormat()) ); | |
523 | } | |
524 | ||
525 | if (rtc != null) { | |
526 | Stri ng content Type = rtc .getConten tType(); | |
527 | /* f latten pdf note type s to remov e fillable pdf */ | |
528 | if ( "applicati on/octet-s tream".equ alsIgnoreC ase(conten tType) | |
529 | || "ap plication/ pdf".equal sIgnoreCas e(contentT ype)) { | |
530 | rtc = Note Fixer.flat tenNoteFor m(rtc); | |
531 | } | |
532 | } | |
533 | ||
534 | return r tc; | |
535 | } catch (Dao Exception e) { | |
536 | logError (e); | |
537 | throw ne w RuntimeE xception(e ); | |
538 | } | |
539 | } | |
540 | ||
541 | /** | |
542 | * Get outpatien t procedur es. | |
543 | * | |
544 | * @pa ram queryB ean query bean | |
545 | * @re turn colle ction | |
546 | */ | |
547 | @WebMe thod(opera tionName = "getOutpa tientProce dures") | |
548 | public V4ResultC ollection getOutpati entProcedu res(@WebPa ram(name = "queryBea n") QueryB ean queryB ean) { | |
549 | re turn getV4 (ClinicalD omainLoinc Code.PROCE DURES, que ryBean); | |
550 | } | |
551 | ||
552 | /** | |
553 | * Get patient a dmissions. | |
554 | * | |
555 | * @pa ram queryB ean query bean | |
556 | * @re turn admis sions coll ection | |
557 | */ | |
558 | @WebMe thod(opera tionName = "getPatie ntAdmissio ns") | |
559 | public V4ResultC ollection getPatient Admissions (@WebParam (name = "q ueryBean") QueryBean queryBean ) { | |
560 | re turn getV4 (ClinicalD omainLoinc Code.ADMIS SIONSV4, q ueryBean); | |
561 | } | |
562 | ||
563 | /** | |
564 | * Get patient a llergies. | |
565 | * | |
566 | * @pa ram queryB ean query bean | |
567 | * @re turn aller gy collect ion | |
568 | */ | |
569 | @WebMe thod(opera tionName = "getPatie ntAllergie s") | |
570 | public V4ResultC ollection getPatient Allergies( @WebParam( name = "qu eryBean") QueryBean queryBean) { | |
571 | re turn getV4 (ClinicalD omainLoinc Code.ALLER GIESV4, qu eryBean); | |
572 | } | |
573 | ||
574 | /** | |
575 | * Get patient a ppointment s. | |
576 | * | |
577 | * @pa ram queryB ean query bean | |
578 | * @re turn appoi ntment col lection | |
579 | */ | |
580 | @WebMe thod(opera tionName = "getPatie ntAppointm ents") | |
581 | public V4ResultC ollection getPatient Appointmen ts(@WebPar am(name = "queryBean ") QueryBe an queryBe an) { | |
582 | re turn getV4 (ClinicalD omainLoinc Code.APPOI NTMENTS, q ueryBean); | |
583 | } | |
584 | // | |
585 | // /** | |
586 | // * G et consult orders. | |
587 | // * | |
588 | // * @ param quer yBean quer y bean | |
589 | // * @ return lab order col lection | |
590 | // */ | |
591 | // @Web Method(ope rationName = "getPat ientConsul tOrders") | |
592 | // publ ic V4Resul tCollectio n getPatie ntConsultO rders(@Web Param(name = "queryB ean") Quer yBean quer yBean) { | |
593 | // return get V4(Clinica lDomainLoi ncCode.CON SULT_ORDER S, queryBe an); | |
594 | // } | |
595 | ||
596 | /** | |
597 | * Get patient c onsults. | |
598 | * | |
599 | * @pa ram queryB ean query bean | |
600 | * @re turn consu lt collect ion | |
601 | */ | |
602 | @WebMe thod(opera tionName = "getPatie ntConsults ") | |
603 | public V4ResultC ollection getPatient Consults(@ WebParam(n ame = "que ryBean") Q ueryBean q ueryBean) { | |
604 | // call notes , and filt er out in jMeadows | |
605 | re turn getV4 (ClinicalD omainLoinc Code.NOTES , queryBea n); | |
606 | } | |
607 | ||
608 | /** | |
609 | * Get patient d emographic s. | |
610 | * | |
611 | * @pa ram queryB ean query bean | |
612 | * @re turn demog raphic col lection | |
613 | */ | |
614 | @WebMe thod(opera tionName = "getPatie ntDemograp hics") | |
615 | public V4ResultC ollection getPatient Demographi cs(@WebPar am(name = "queryBean ") QueryBe an queryBe an) { | |
616 | re turn getV4 (ClinicalD omainLoinc Code.PATIE NT_DEMOGRA PHICSV4, q ueryBean); | |
617 | } | |
618 | ||
619 | /** | |
620 | * Get discharge summaries . | |
621 | * | |
622 | * @pa ram queryB ean query bean | |
623 | * @re turn summa ry collect ion | |
624 | */ | |
625 | @WebMe thod(opera tionName = "getPatie ntDischarg eSummaries ") | |
626 | public V4ResultC ollection getPatient DischargeS ummaries(@ WebParam(n ame = "que ryBean") Q ueryBean q ueryBean) { | |
627 | re turn getV4 (ClinicalD omainLoinc Code.INPAT IENT_NOTES , queryBea n); | |
628 | } | |
629 | ||
630 | /** | |
631 | * Get patient e ncounters. | |
632 | * | |
633 | * @pa ram queryB ean query bean | |
634 | * @re turn encou nter colle ction | |
635 | */ | |
636 | @WebMe thod(opera tionName = "getPatie ntEncounte rs") | |
637 | public V4ResultC ollection getPatient Encounters (@WebParam (name = "q ueryBean") QueryBean queryBean ) { | |
638 | re turn getV4 (ClinicalD omainLoinc Code.ENCOU NTERS, que ryBean); | |
639 | } | |
640 | ||
641 | /** | |
642 | * Get patient f amily hist ory list. | |
643 | * | |
644 | * @pa ram queryB ean query bean | |
645 | * @re turn famil y history list colle ction | |
646 | */ | |
647 | @WebMe thod(opera tionName = "getPatie ntFamilyHi story") | |
648 | public V4ResultC ollection getPatient FamilyHist ory(@WebPa ram(name = "queryBea n") QueryB ean queryB ean) { | |
649 | re turn getV4 (ClinicalD omainLoinc Code.FAMIL Y_HISTORIE S, queryBe an); | |
650 | } | |
651 | ||
652 | /** | |
653 | * Get patient i mmunizatio ns. | |
654 | * | |
655 | * @pa ram queryB ean query bean | |
656 | * @re turn immun ization co llection | |
657 | */ | |
658 | @WebMe thod(opera tionName = "getPatie ntImmuniza tions") | |
659 | public V4ResultC ollection getPatient Immunizati ons(@WebPa ram(name = "queryBea n") QueryB ean queryB ean) { | |
660 | re turn getV4 (ClinicalD omainLoinc Code.IMMUN IZATIONS, queryBean) ; | |
661 | } | |
662 | ||
663 | /** | |
664 | * Get patient i nsurance. | |
665 | * | |
666 | * @pa ram queryB ean query bean | |
667 | * @re turn colle ction | |
668 | */ | |
669 | @WebMe thod(opera tionName = "getPatie ntInsuranc es") | |
670 | public V4ResultC ollection getPatient Insurances (@WebParam (name = "q ueryBean") QueryBean queryBean ) { | |
671 | re turn getV4 (ClinicalD omainLoinc Code.INSUR ANCES, que ryBean); | |
672 | } | |
673 | ||
674 | /** | |
675 | * Get chemistry labs. | |
676 | * | |
677 | * @pa ram queryB ean query bean | |
678 | * @re turn chemi stry colle ction | |
679 | */ | |
680 | @WebMe thod(opera tionName = "getPatie ntLabChemi stries") | |
681 | public V4ResultC ollection getPatient LabChemist ries(@WebP aram(name = "queryBe an") Query Bean query Bean) { | |
682 | re turn getV4 (ClinicalD omainLoinc Code.LAB_C HEMISTRIES , queryBea n); | |
683 | ||
684 | } | |
685 | ||
686 | ||
687 | /** | |
688 | * Get patient A P tests. | |
689 | * | |
690 | * @pa ram queryB ean query bean | |
691 | * @re turn AP te st collect ion | |
692 | */ | |
693 | @WebMe thod(opera tionName = "getPatie ntLabAnato micPatholo gies") | |
694 | public V4ResultC ollection getPatient LabAnatomi cPathologi es(@WebPar am(name = "queryBean ") QueryBe an queryBe an) { | |
695 | re turn getV4 (ClinicalD omainLoinc Code.LAB_A NATOMIC_PA THOLOGIES, queryBean ); | |
696 | ||
697 | } | |
698 | ||
699 | /** | |
700 | * Get patient m icros. | |
701 | * | |
702 | * @pa ram queryB ean query bean | |
703 | * @re turn micro collectio n | |
704 | */ | |
705 | @WebMe thod(opera tionName = "getPatie ntLabMicro biologies" ) | |
706 | public V4ResultC ollection getPatient LabMicrobi ologies(@W ebParam(na me = "quer yBean") Qu eryBean qu eryBean) { | |
707 | re turn getV4 (ClinicalD omainLoinc Code.LAB_M ICROBIOLOG IES, query Bean); | |
708 | ||
709 | } | |
710 | ||
711 | ||
712 | // /** | |
713 | // * G et lab ord ers. | |
714 | // * | |
715 | // * @ param quer yBean quer y bean | |
716 | // * @ return lab order col lection | |
717 | // */ | |
718 | // @Web Method(ope rationName = "getPat ientLabOrd ers") | |
719 | // publ ic V4Resul tCollectio n getPatie ntLabOrder s(@WebPara m(name = " queryBean" ) QueryBea n queryBea n) { | |
720 | // return get V4(Clinica lDomainLoi ncCode.LAB _ORDERS, q ueryBean); | |
721 | // } | |
722 | ||
723 | // /** | |
724 | // * G et medicat ion orders . | |
725 | // * | |
726 | // * @ param quer yBean quer y bean | |
727 | // * @ return med ication or der collec tion | |
728 | // */ | |
729 | // @Web Method(ope rationName = "getPat ientMedica tionOrders ") | |
730 | // publ ic V4Resul tCollectio n getPatie ntMedicati onOrders(@ WebParam(n ame = "que ryBean") Q ueryBean q ueryBean) { | |
731 | // return get V4(Clinica lDomainLoi ncCode.MED ICATION_OR DERS, quer yBean); | |
732 | // } | |
733 | // | |
734 | ||
735 | /** | |
736 | * Get patient m anagement. (patient flags) | |
737 | * | |
738 | * @pa ram queryB ean query bean | |
739 | * @re turn patie ntManageme nt list co llection | |
740 | */ | |
741 | @WebMe thod(opera tionName = "getPatie ntManageme nt") | |
742 | public V4ResultC ollection getPatient Management (@WebParam (name = "q ueryBean") QueryBean queryBean ) { | |
743 | re turn getV4 (ClinicalD omainLoinc Code.PATIE NT_MANAGEM ENT, query Bean); | |
744 | } | |
745 | ||
746 | /** | |
747 | * Get patient m edications . | |
748 | * | |
749 | * @pa ram queryB ean query bean | |
750 | * @re turn medic ation coll ection | |
751 | */ | |
752 | @WebMe thod(opera tionName = "getPatie ntMedicati ons") | |
753 | public V4ResultC ollection getPatient Medication s(@WebPara m(name = " queryBean" ) QueryBea n queryBea n) { | |
754 | re turn getV4 (ClinicalD omainLoinc Code.MEDIC ATIONS, qu eryBean); | |
755 | } | |
756 | ||
757 | /** | |
758 | * Get patient n otes. | |
759 | * | |
760 | * @pa ram queryB ean query bean | |
761 | * @re turn note collection | |
762 | */ | |
763 | @WebMe thod(opera tionName = "getPatie ntNotes") | |
764 | public V4ResultC ollection getPatient Notes(@Web Param(name = "queryB ean") Quer yBean quer yBean) { | |
765 | re turn getV4 (ClinicalD omainLoinc Code.NOTES , queryBea n); | |
766 | } | |
767 | ||
768 | /** | |
769 | * Get patient o rders. | |
770 | * | |
771 | * @pa ram queryB ean query bean | |
772 | * @re turn radio logy order collectio n | |
773 | */ | |
774 | @WebMe thod(opera tionName = "getPatie ntOrders") | |
775 | public V4ResultC ollection getPatient Orders(@We bParam(nam e = "query Bean") Que ryBean que ryBean) { | |
776 | re turn getV4 (ClinicalD omainLoinc Code.ALL_O RDERS, que ryBean); | |
777 | } | |
778 | ||
779 | /** | |
780 | * Get patient o ther histo ry list. | |
781 | * | |
782 | * @pa ram queryB ean query bean | |
783 | * @re turn other history l ist collec tion | |
784 | */ | |
785 | @WebMe thod(opera tionName = "getPatie ntOtherHis tory") | |
786 | public V4ResultC ollection getPatient OtherHisto ry(@WebPar am(name = "queryBean ") QueryBe an queryBe an) { | |
787 | re turn getV4 (ClinicalD omainLoinc Code.OTHER _PAST_MEDI CAL_HISTOR IES, query Bean); | |
788 | } | |
789 | ||
790 | /** | |
791 | * Get patient p roblem lis t. | |
792 | * | |
793 | * @pa ram queryB ean query bean | |
794 | * @re turn probl em list co llection | |
795 | */ | |
796 | @WebMe thod(opera tionName = "getPatie ntProblemL ist") | |
797 | public V4ResultC ollection getPatient ProblemLis t(@WebPara m(name = " queryBean" ) QueryBea n queryBea n) { | |
798 | re turn getV4 (ClinicalD omainLoinc Code.PROBL EMS, query Bean); | |
799 | } | |
800 | ||
801 | /** | |
802 | * Get Questionn aire. | |
803 | * | |
804 | * @pa ram queryB ean query bean | |
805 | * @re turn quest ionnaire l ist collec tion | |
806 | */ | |
807 | @WebMe thod(opera tionName = "getPatie ntQuestion naires") | |
808 | public V4ResultC ollection getPatient Questionna ires(@WebP aram(name = "queryBe an") Query Bean query Bean) { | |
809 | re turn getV4 (ClinicalD omainLoinc Code.QUEST IONNAIRES, queryBean ); | |
810 | } | |
811 | ||
812 | // /** | |
813 | // * G et radiolo gy orders. | |
814 | // * | |
815 | // * @ param quer yBean quer y bean | |
816 | // * @ return rad iology ord er collect ion | |
817 | // */ | |
818 | // @Web Method(ope rationName = "getPat ientRadiol ogyOrders" ) | |
819 | // publ ic V4Resul tCollectio n getPatie ntRadiolog yOrders(@W ebParam(na me = "quer yBean") Qu eryBean qu eryBean) { | |
820 | // return get V4(Clinica lDomainLoi ncCode.RAD IOLOGY_ORD ERS, query Bean); | |
821 | // } | |
822 | ||
823 | /** | |
824 | * Get patient r adiology r eports. | |
825 | * | |
826 | * @pa ram queryB ean query bean | |
827 | * @re turn repor t collecti on | |
828 | */ | |
829 | @WebMe thod(opera tionName = "getPatie ntRadiolog yReports") | |
830 | public V4ResultC ollection getPatient RadiologyR eports(@We bParam(nam e = "query Bean") Que ryBean que ryBean) { | |
831 | qu eryBean.se tIncludedS ources(nul l); | |
832 | re turn getV4 (ClinicalD omainLoinc Code.RADIO LOGY_REPOR TSV4, quer yBean); | |
833 | } | |
834 | ||
835 | /** | |
836 | * Get patient s ocial hist ory list. | |
837 | * | |
838 | * @pa ram queryB ean query bean | |
839 | * @re turn socia l history list colle ction | |
840 | */ | |
841 | @WebMe thod(opera tionName = "getPatie ntSocialHi story") | |
842 | public V4ResultC ollection getPatient SocialHist ory(@WebPa ram(name = "queryBea n") QueryB ean queryB ean) { | |
843 | re turn getV4 (ClinicalD omainLoinc Code.SOCIA L_HISTORIE S, queryBe an); | |
844 | } | |
845 | ||
846 | /** | |
847 | * Get patient v itals. | |
848 | * | |
849 | * @pa ram queryB ean query bean | |
850 | * @re turn vital collectio n | |
851 | */ | |
852 | @WebMe thod(opera tionName = "getPatie ntVitals") | |
853 | public V4ResultC ollection getPatient Vitals(@We bParam(nam e = "query Bean") Que ryBean que ryBean) { | |
854 | re turn getV4 (ClinicalD omainLoinc Code.VITAL S, queryBe an); | |
855 | } | |
856 | ||
857 | /** | |
858 | * Get VLER pati ent admiss ions. | |
859 | * | |
860 | * @pa ram queryB ean query bean | |
861 | * @re turn colle ction | |
862 | */ | |
863 | @WebMe thod(opera tionName = "getVLERP atientAdmi ssions") | |
864 | public V4ResultC ollection getVLERPat ientAdmiss ions(@WebP aram(name = "queryBe an") Query Bean query Bean) { | |
865 | re turn getVL ER(Clinica lDomainLoi ncCode.VLE RADMISSION S, queryBe an); | |
866 | } | |
867 | ||
868 | /** | |
869 | * Get VLER pati ent allerg ies. | |
870 | * | |
871 | * @pa ram queryB ean query bean | |
872 | * @re turn aller gy collect ion | |
873 | */ | |
874 | @WebMe thod(opera tionName = "getVLERP atientAlle rgies") | |
875 | public V4ResultC ollection getVLERPat ientAllerg ies(@WebPa ram(name = "queryBea n") QueryB ean queryB ean) { | |
876 | re turn getVL ER(Clinica lDomainLoi ncCode.VLE RALLERGIES , queryBea n); | |
877 | } | |
878 | ||
879 | /** | |
880 | * Get VLER pati ent appoin tments. | |
881 | * | |
882 | * @pa ram queryB ean query bean | |
883 | * @re turn appoi ntment col lection | |
884 | */ | |
885 | @WebMe thod(opera tionName = "getVLERP atientAppo intments") | |
886 | public V4ResultC ollection getVLERPat ientAppoin tments(@We bParam(nam e = "query Bean") Que ryBean que ryBean) { | |
887 | re turn getVL ER(Clinica lDomainLoi ncCode.VLE RAPPOINTME NTS, query Bean); | |
888 | } | |
889 | ||
890 | /** | |
891 | * Get VLER CCDA document. | |
892 | * | |
893 | * @pa ram queryB ean query bean. | |
894 | * @re turn colle ction | |
895 | */ | |
896 | @WebMe thod(opera tionName = "getVLERP atientCCDA ") | |
897 | public V4ResultC ollection getVLERPat ientCCDA(@ WebParam(n ame = "que ryBean") Q ueryBean q ueryBean) { | |
898 | re turn getVL ER(Clinica lDomainLoi ncCode.VLE RCCDA, que ryBean); | |
899 | } | |
900 | ||
901 | /** | |
902 | * Get VLER CCDA document as JSON st ring. | |
903 | * | |
904 | * @pa ram queryB ean query bean | |
905 | * @re turn JSON CCDA | |
906 | */ | |
907 | @WebMe thod(opera tionName = "getVLERP atientCCDA Raw") | |
908 | public String ge tVLERPatie ntCCDARaw( @WebParam( name = "qu eryBean") QueryBean queryBean) { | |
909 | St ring rtc = ""; | |
910 | V4 ResultColl ection rco ll = getVL ER(VLERCCD A, queryBe an); | |
911 | Ob jectMapper objectMap per = new ObjectMapp er(); | |
912 | tr y { | |
913 | rtc = ob jectMapper .writeValu eAsString( rcoll); | |
914 | } catch (Jso nProcessin gException e) { | |
915 | rtc = "" ; | |
916 | } | |
917 | re turn rtc; | |
918 | } | |
919 | ||
920 | /** | |
921 | * Get VLER pati ent demogr aphics. | |
922 | * | |
923 | * @pa ram queryB ean query bean. | |
924 | * @re turn colle ction | |
925 | */ | |
926 | @WebMe thod(opera tionName = "getVLERP atientDemo graphics") | |
927 | public V4ResultC ollection getVLERPat ientDemogr aphics(@We bParam(nam e = "query Bean") Que ryBean que ryBean) { | |
928 | re turn getVL ER(Clinica lDomainLoi ncCode.VLE RPATIENT_D EMOGRAPHIC S, queryBe an); | |
929 | } | |
930 | ||
931 | /** | |
932 | * Get VLER pati ent Immuni zations. | |
933 | * | |
934 | * @pa ram queryB ean query bean | |
935 | * @re turn immun ization co llection | |
936 | */ | |
937 | @WebMe thod(opera tionName = "getVLERP atientImmu nizations" ) | |
938 | public V4ResultC ollection getVLERPat ientImmuni zations(@W ebParam(na me = "quer yBean") Qu eryBean qu eryBean) { | |
939 | re turn getVL ER(Clinica lDomainLoi ncCode.VLE RIMMUNIZAT IONS, quer yBean); | |
940 | } | |
941 | ||
942 | /** | |
943 | * Get VLER pati ent insura nce. | |
944 | * | |
945 | * @pa ram queryB ean query bean | |
946 | * @re turn colle ction | |
947 | */ | |
948 | @WebMe thod(opera tionName = "getVLERP atientInsu rances") | |
949 | public V4ResultC ollection getVLERPat ientInsura nces(@WebP aram(name = "queryBe an") Query Bean query Bean) { | |
950 | re turn getVL ER(Clinica lDomainLoi ncCode.VLE RINSURANCE , queryBea n); | |
951 | } | |
952 | ||
953 | /** | |
954 | * Get VLER pati ent Medica tions. | |
955 | * | |
956 | * @pa ram queryB ean query bean | |
957 | * @re turn medic ation coll ection | |
958 | */ | |
959 | @WebMe thod(opera tionName = "getVLERP atientMedi cations") | |
960 | public V4ResultC ollection getVLERPat ientMedica tions(@Web Param(name = "queryB ean") Quer yBean quer yBean) { | |
961 | re turn getVL ER(Clinica lDomainLoi ncCode.VLE RMEDICATIO NS, queryB ean); | |
962 | } | |
963 | ||
964 | /** | |
965 | * Get VLER pati ent proble m list. | |
966 | * | |
967 | * @pa ram queryB ean query bean | |
968 | * @re turn probl em list co llection | |
969 | */ | |
970 | @WebMe thod(opera tionName = "getVLERP atientProb lemList") | |
971 | public V4ResultC ollection getVLERPat ientProble mList(@Web Param(name = "queryB ean") Quer yBean quer yBean) { | |
972 | re turn getVL ER(Clinica lDomainLoi ncCode.VLE RPROBLEMS, queryBean ); | |
973 | } | |
974 | ||
975 | /** | |
976 | * Get VLER resu lts. | |
977 | * | |
978 | * @pa ram queryB ean query bean | |
979 | * @re turn resul ts collect ion | |
980 | */ | |
981 | @WebMe thod(opera tionName = "getVLERP atientResu lts") | |
982 | public V4ResultC ollection getVLERPat ientResult s(@WebPara m(name = " queryBean" ) QueryBea n queryBea n) { | |
983 | re turn getVL ER(Clinica lDomainLoi ncCode.VLE RRESULTS, queryBean) ; | |
984 | } | |
985 | ||
986 | /** | |
987 | * Get VLER pati ent vitals . | |
988 | * | |
989 | * @pa ram queryB ean query bean | |
990 | * @re turn vital s collecti on | |
991 | */ | |
992 | @WebMe thod(opera tionName = "getVLERP atientVita ls") | |
993 | public V4ResultC ollection getVLERPat ientVitals (@WebParam (name = "q ueryBean") QueryBean queryBean ) { | |
994 | re turn getVL ER(Clinica lDomainLoi ncCode.VLE RVITALS, q ueryBean); | |
995 | } | |
996 | ||
997 | /** | |
998 | * Get VLER pati ent proced ures. | |
999 | * | |
1000 | * @pa ram queryB ean query bean | |
1001 | * @re turn proce dures coll ection | |
1002 | */ | |
1003 | @WebMe thod(opera tionName = "getVLERP atientProc edures") | |
1004 | public V4ResultC ollection getVLERPat ientProced ures(@WebP aram(name = "queryBe an") Query Bean query Bean) { | |
1005 | re turn getVL ER(Clinica lDomainLoi ncCode.VLE RPROCEDURE S, queryBe an); | |
1006 | } | |
1007 | ||
1008 | /** | |
1009 | * Log request. | |
1010 | * | |
1011 | * @pa ram queryB ean query bean | |
1012 | * @re turn start time | |
1013 | */ | |
1014 | privat e long log Request(Qu eryBean qu eryBean) { | |
1015 | if (wsContex t != null) { | |
1016 | MessageC ontext msg ctx = wsCo ntext.getM essageCont ext(); | |
1017 | SimpleDa teFormat s df = new S impleDateF ormat("yyy yMMddHHmms s", Locale .getDefaul t()); | |
1018 | ||
1019 | if (quer yBean == n ull) { | |
1020 | LOGG ER.error(" begin {} ( queryBean is null) " , msgctx.g et(Message Context.WS DL_OPERATI ON)); | |
1021 | } else { | |
1022 | LOGG ER.info("b egin " + m sgctx.get( MessageCon text.WSDL_ OPERATION) + " (" + DBLogger.c leanString (queryBean .getPatien tId()) + " ) "); | |
1023 | if ( LOGGER.isD ebugEnable d()) { | |
1024 | if (queryB ean.getSta rtDate() ! = null) { | |
1025 | LOGGER .debug("in fo " + msg ctx.get(Me ssageConte xt.WSDL_OP ERATION) + " (" + DB Logger.cle anString(q ueryBean.g etPatientI d()) + ") startDate = " + sdf. format(que ryBean.get StartDate( ).getTime( ))); | |
1026 | } | |
1027 | if (queryB ean.getEnd Date() != null) { | |
1028 | LOGGER .debug("in fo " + msg ctx.get(Me ssageConte xt.WSDL_OP ERATION) + " (" + DB Logger.cle anString(q ueryBean.g etPatientI d()) + ") endDate = " + sdf.fo rmat(query Bean.getEn dDate().ge tTime())); | |
1029 | } | |
1030 | if (queryB ean.getInc ludedSourc es() != nu ll) { | |
1031 | List<S tring> src = queryBe an.getIncl udedSource s(); | |
1032 | if (Co llectionUt ils.isNotE mpty(src)) { | |
1033 | in t srcSize = src.size (); | |
1034 | fo r (int i = 0; i < sr cSize; ++i ) { | |
1035 | LOGGER.d ebug("info " + msgct x.get(Mess ageContext .WSDL_OPER ATION) + " (" + DBLo gger.clean String(que ryBean.get PatientId( )) + ") in clude src = " + DBLo gger.clean String(src .get(i))); | |
1036 | } | |
1037 | } | |
1038 | } | |
1039 | if (queryB ean.getExc ludedSourc es() != nu ll) { | |
1040 | List<S tring> src = queryBe an.getExcl udedSource s(); | |
1041 | if (Co llectionUt ils.isNotE mpty(src)) { | |
1042 | in t srcSize = src.size (); | |
1043 | fo r (int i = 0; i < sr cSize; ++i ) { | |
1044 | LOGGER.d ebug("info " + msgct x.get(Mess ageContext .WSDL_OPER ATION) + " (" + DBLo gger.clean String(que ryBean.get PatientId( )) + ") ex clude src = " + DBLo gger.clean String(src .get(i))); | |
1045 | } | |
1046 | } | |
1047 | } | |
1048 | } | |
1049 | } | |
1050 | } | |
1051 | re turn Syste m.currentT imeMillis( ); | |
1052 | } | |
1053 | ||
1054 | /** | |
1055 | * Log response. | |
1056 | * | |
1057 | * @pa ram queryB ean query bean | |
1058 | * @pa ram except ion except ion | |
1059 | * @pa ram rtc co llection | |
1060 | * @pa ram count count in r eturn coll ection | |
1061 | * @pa ram stime start time | |
1062 | * @pa ram cached cached | |
1063 | */ | |
1064 | privat e void log Response(S tring oper ation, Que ryBean que ryBean, St ring excep tion, Resu ltCollecti on rtc, in t count, l ong stime, String ca ched) { | |
1065 | lo ng etime = System.cu rrentTimeM illis(); | |
1066 | St ring patie ntId = "Pa tient ID w as not set "; | |
1067 | St ring query Info = ""; | |
1068 | // int scount = 0; | |
1069 | // int ecount = 0; | |
1070 | ||
1071 | if (wsContex t != null) { | |
1072 | if (quer yBean != n ull) { | |
1073 | pati entId = qu eryBean.ge tPatientId (); | |
1074 | BHIE Limit limi t = BHIELi mit.getIns tance(); | |
1075 | quer yInfo = li mit.getKey (queryBean , ""); | |
1076 | } | |
1077 | ||
1078 | // if (rt c == null) { | |
1079 | BHIE Status.upd ateStatist ics(operat ion, "fals e", true, etime - st ime); | |
1080 | LOGG ER.info("e nd {} mill iseconds { } ({}) rtc =null exce ption={}", (etime - stime), op eration, D BLogger.cl eanString( patientId) , exceptio n); | |
1081 | Stri ng dsource = AppConf ig.getInst ance().get DataSource (); | |
1082 | DBLo gger dbl = new DBLog ger(dsourc e); | |
1083 | dbl. logEvent(p atientId, "BHIERelay ." + opera tion, exce ption, eti me - stime , 0, "fals e", queryI nfo); | |
1084 | dbl. close(); | |
1085 | // } else { | |
1086 | // BH IEStatus.u pdateStati stics(oper ation, cac hed, false , etime - stime); | |
1087 | // St ring error msg = ""; //rtc.getE rror(); | |
1088 | // if (rtc.getS tatusList( ) != null) { | |
1089 | // scount = rtc.getSt atusList() .size(); | |
1090 | // } | |
1091 | // if (rtc.getE rrorList() != null) { | |
1092 | // ecount = rtc.getEr rorList(). size(); | |
1093 | // | |
1094 | // List<gov .va.med.bh ie.beans.E rror> src = rtc.getE rrorList() ; | |
1095 | // if (Coll ectionUtil s.isNotEmp ty(src)) { | |
1096 | // int srcSize = src.size() ; | |
1097 | // for (int i = 0 ; i < srcS ize; ++i) { | |
1098 | // if (src.ge t(i).getEr rorCode() != null && src.get(i ).getError Code().len gth() > 0) { | |
1099 | // errorm sg = src.g et(i).getE rrorCode() ; | |
1100 | // break; | |
1101 | // } | |
1102 | // } | |
1103 | // } | |
1104 | // if (ecou nt > 0 && (errormsg == null || errormsg. isEmpty()) ) { | |
1105 | // erro rmsg = Int eger.toStr ing(ecount ) + " erro rs returne d"; | |
1106 | // } | |
1107 | // } | |
1108 | // if (errormsg == null) { | |
1109 | // errormsg = ""; | |
1110 | // } | |
1111 | // LO GGER.info( "end {} mi lliseconds {} ({}) C omplete rt c.size()={ } errorsiz e={} statu ssize={}", (etime - stime), op eration, D BLogger.cl eanString( patientId) , count, e count, sco unt); | |
1112 | // St ring dsour ce = AppCo nfig.getIn stance().g etDataSour ce(); | |
1113 | // DB Logger dbl = new DBL ogger(dsou rce); | |
1114 | // db l.logEvent (patientId , "BHIERel ay." + ope ration, er rormsg, et ime - stim e, count, cached, qu eryInfo); | |
1115 | // db l.close(); | |
1116 | // if (LOGGER.i sDebugEnab led()) { | |
1117 | // if (rtc. getQueryCo mplete() ! = null && rtc.getQue ryComplete ().length( ) > 0) { | |
1118 | // LOGG ER.debug(" rtc info " + operati on + " (" + DBLogger .cleanStri ng(patient Id) + ") q ueryComple te = " + D BLogger.cl eanString( rtc.getQue ryComplete ())); | |
1119 | // } | |
1120 | // if (rtc. getQueryCo mplete() ! = null && rtc.getErr orList().s ize() > 0) { | |
1121 | // LOGG ER.debug(" rtc info " + operati on + " (" + DBLogger .cleanStri ng(patient Id) + ") E rror = " + DBLogger. cleanStrin g(errormsg )); | |
1122 | // } | |
1123 | // if (rtc. getStatusL ist() != n ull) { | |
1124 | // LOGG ER.debug(" complete i nfo " + op eration + " (" + DBL ogger.clea nString(pa tientId) + ") Status List.size( ) = " + rt c.getStatu sList().si ze()); | |
1125 | // List <SiteStatu s> src = r tc.getStat usList(); | |
1126 | // if ( Collection Utils.isNo tEmpty(src )) { | |
1127 | // int srcSiz e = src.si ze(); | |
1128 | // for (int i = 0; i < srcSize; + +i) { | |
1129 | // if (sr c.get(i).g etExpected Count() != null && s rc.get(i). getExpecte dCount().l ength() > 0) { | |
1130 | // LO GGER.debug ("rtc info " + opera tion + " ( " + DBLogg er.cleanSt ring(patie ntId) + ") Status[" + i + "] e xpected co unt=" + DB Logger.cle anString(s rc.get(i). getExpecte dCount())) ; | |
1131 | // } | |
1132 | // if (sr c.get(i).g etRetrieve dCount() ! = null && src.get(i) .getRetrie vedCount() .length() > 0) { | |
1133 | // LO GGER.debug ("rtc info " + opera tion + " ( " + DBLogg er.cleanSt ring(patie ntId) + ") Status[" + i + "] r etrieved c ount=" + D BLogger.cl eanString( src.get(i) .getRetrie vedCount() )); | |
1134 | // } | |
1135 | // if (sr c.get(i).g etSiteId() != null & & src.get( i).getSite Id().lengt h() > 0) { | |
1136 | // LO GGER.debug ("rtc info " + opera tion + " ( " + DBLogg er.cleanSt ring(patie ntId) + ") Status[" + i + "] s ite id=" + DBLogger. cleanStrin g(src.get( i).getSite Id())); | |
1137 | // } | |
1138 | // if (sr c.get(i).g etSiteName () != null && src.ge t(i).getSi teName().l ength() > 0) { | |
1139 | // LO GGER.debug ("rtc info " + opera tion + " ( " + DBLogg er.cleanSt ring(patie ntId) + ") Status[" + i + "] s ite name=" + DBLogge r.cleanStr ing(src.ge t(i).getSi teName())) ; | |
1140 | // } | |
1141 | // if (sr c.get(i).g etSiteStat us() != nu ll && src. get(i).get SiteStatus ().length( ) > 0) { | |
1142 | // LO GGER.debug ("rtc info " + opera tion + " ( " + DBLogg er.cleanSt ring(patie ntId) + ") Status[" + i + "] s ite status =" + DBLog ger.cleanS tring(src. get(i).get SiteStatus ())); | |
1143 | // } | |
1144 | // } | |
1145 | // } | |
1146 | // } | |
1147 | // if (rtc. getErrorLi st() != nu ll) { | |
1148 | // LOGG ER.debug(" complete i nfo " + op eration + " (" + DBL ogger.clea nString(pa tientId) + ") ErrorL ist.size() = " + rtc .getErrorL ist().size ()); | |
1149 | // List <gov.va.me d.bhie.bea ns.Error> src = rtc. getErrorLi st(); | |
1150 | // | |
1151 | // if ( Collection Utils.isNo tEmpty(src )) { | |
1152 | // int srcSiz e = src.si ze(); | |
1153 | // for (int i = 0; i < srcSize; + +i) { | |
1154 | // if (sr c.get(i).g etErrorCod e() != nul l && src.g et(i).getE rrorCode() .length() > 0) { | |
1155 | // LO GGER.debug ("rtc info " + opera tion + " ( " + DBLogg er.cleanSt ring(patie ntId) + ") Error[" + i + "] Er ror code=" + DBLogge r.cleanStr ing(src.ge t(i).getEr rorCode()) ); | |
1156 | // } | |
1157 | // if (sr c.get(i).g etErrorVal ue() != nu ll && src. get(i).get ErrorValue ().length( ) > 0) { | |
1158 | // LO GGER.debug ("rtc info " + opera tion + " ( " + DBLogg er.cleanSt ring(patie ntId) + ") Error[" + i + "] Er ror value= " + DBLogg er.cleanSt ring(src.g et(i).getE rrorValue( ))); | |
1159 | // } | |
1160 | // if (sr c.get(i).g etErrorLoc ation() != null && s rc.get(i). getErrorLo cation().l ength() > 0) { | |
1161 | // LO GGER.debug ("rtc info " + opera tion + " ( " + DBLogg er.cleanSt ring(patie ntId) + ") Error[" + i + "] Er ror loc=" + DBLogger .cleanStri ng(src.get (i).getErr orLocation ())); | |
1162 | // } | |
1163 | // if (sr c.get(i).g etErrorSev erity() != null && s rc.get(i). getErrorSe verity().l ength() > 0) { | |
1164 | // LO GGER.debug ("rtc info " + opera tion + " ( " + DBLogg er.cleanSt ring(patie ntId) + ") Error[" + i + "] Er ror sev=" + DBLogger .cleanStri ng(src.get (i).getErr orSeverity ())); | |
1165 | // } | |
1166 | // } | |
1167 | // } | |
1168 | // } | |
1169 | // } | |
1170 | // } | |
1171 | } | |
1172 | } | |
1173 | ||
1174 | /** | |
1175 | * Log response. | |
1176 | * | |
1177 | * @pa ram queryB ean query bean | |
1178 | * @pa ram except ion except ion | |
1179 | * @pa ram rtc co llection | |
1180 | * @pa ram count count in r eturn coll ection | |
1181 | * @pa ram stime start time | |
1182 | * @pa ram cached cached | |
1183 | */ | |
1184 | privat e void log VLERRespon se(String operation, QueryBean queryBean , String e xception, V4ResultCo llection r tc, int co unt, long stime, Str ing cached ) { | |
1185 | // TODO: Refa ctor both logRespons e methods into one. | |
1186 | lo ng etime = System.cu rrentTimeM illis(); | |
1187 | St ring patie ntId = "Pa tient ID w as not set "; | |
1188 | St ring query Info = ""; | |
1189 | in t scount = 0; | |
1190 | in t ecount = 0; | |
1191 | ||
1192 | if (wsContex t != null) { | |
1193 | if (quer yBean != n ull) { | |
1194 | pati entId = qu eryBean.ge tPatientId (); | |
1195 | BHIE Limit limi t = BHIELi mit.getIns tance(); | |
1196 | quer yInfo = li mit.getKey (queryBean , ""); | |
1197 | } | |
1198 | ||
1199 | if (rtc == null) { | |
1200 | BHIE Status.upd ateStatist ics(operat ion, "fals e", true, etime - st ime); | |
1201 | LOGG ER.info("e nd {} mill iseconds { } ({}) rtc =null exce ption={} " , (etime - stime), o peration, DBLogger.c leanString (patientId ), DBLogge r.cleanStr ing(except ion)); | |
1202 | Stri ng dsource = AppConf ig.getInst ance().get DataSource (); | |
1203 | DBLo gger dbl = new DBLog ger(dsourc e); | |
1204 | dbl. logEvent(p atientId, "BHIERelay ." + opera tion, exce ption, eti me - stime , 0, "fals e", queryI nfo); | |
1205 | dbl. close(); | |
1206 | } else { | |
1207 | Stri ng errorms g = ""; | |
1208 | if ( rtc.getErr orList() ! = null && !rtc.getEr rorList(). isEmpty()) { | |
1209 | errormsg = rtc.getEr rorListv4( ).get(0); | |
1210 | } | |
1211 | BHIE Status.upd ateStatist ics(operat ion, cache d, false, etime - st ime); | |
1212 | if ( rtc.getSta tusList() != null) { | |
1213 | scount = r tc.getStat usList().s ize(); | |
1214 | } | |
1215 | LOGG ER.info("e nd {} mill iseconds { } ({}) Com plete rtc. size()={} errorsize= {} statuss ize={}", ( etime - st ime), oper ation, DBL ogger.clea nString(pa tientId), count, eco unt, scoun t); | |
1216 | Stri ng dsource = AppConf ig.getInst ance().get DataSource (); | |
1217 | DBLo gger dbl = new DBLog ger(dsourc e); | |
1218 | dbl. logEvent(p atientId, "BHIERelay ." + opera tion, erro rmsg, etim e - stime, count, ca ched, quer yInfo); | |
1219 | dbl. close(); | |
1220 | if ( LOGGER.isD ebugEnable d()) { | |
1221 | if (rtc.ge tQueryComp lete() != null && rt c.getQuery Complete() .length() > 0) { | |
1222 | LOGGER .debug("rt c info " + operation + " (" + DBLogger.c leanString (patientId ) + ") que ryComplete = " + DBL ogger.clea nString(rt c.getQuery Complete() )); | |
1223 | } | |
1224 | if (rtc.ge tQueryComp lete() != null && er rormsg.len gth() > 0) { | |
1225 | LOGGER .debug("rt c info " + operation + " (" + DBLogger.c leanString (patientId ) + ") Err or = " + D BLogger.cl eanString( errormsg)) ; | |
1226 | } | |
1227 | } | |
1228 | } | |
1229 | } | |
1230 | } | |
1231 | ||
1232 | /** | |
1233 | * Get VLER data . | |
1234 | * | |
1235 | * @pa ram LOINC LOINC code | |
1236 | * @pa ram queryB ean query bean | |
1237 | * @re turn colle ction | |
1238 | */ | |
1239 | privat e V4Result Collection getVLER(C linicalDom ainLoincCo de LOINC, QueryBean queryBean) { | |
1240 | V4 ResultColl ection rtc = null; | |
1241 | lo ng stime = logReques t(queryBea n); | |
1242 | ||
1243 | tr y { | |
1244 | VLERDao dao = new VLERDao(); | |
1245 | int coun t = 0; | |
1246 | if (quer yBean.getE xcludedSou rces() != null) | |
1247 | quer yBean.getE xcludedSou rces().cle ar(); | |
1248 | if (quer yBean.getI ncludedSou rces() != null) | |
1249 | quer yBean.getI ncludedSou rces().cle ar(); | |
1250 | if (quer yBean.getS tartDate() != null) | |
1251 | quer yBean.setS tartDate(n ull); | |
1252 | if (quer yBean.getE ndDate() ! = null) | |
1253 | quer yBean.setE ndDate(nul l); | |
1254 | ||
1255 | rtc = V4 Limit.getI nstance(). getV4Cache ("VLER" + VLERCCDA.g etLoincCod e(), query Bean); | |
1256 | if (rtc == null) { | |
1257 | rtc = dao.getV LERData(qu eryBean); | |
1258 | if ( rtc != nul l) { | |
1259 | count = ge tSize(LOIN C, rtc); | |
1260 | // if (AppC onfig.getI nstance(). getRelayEn dpointCoun t() > 1) { | |
1261 | // Stri ng key = V 4Limit.get Instance() .getKey("V LER" + VLE RCCDA.getL oincCode() , queryBea n); | |
1262 | // Stri ng rcoll = ""; | |
1263 | // Obje ctMapper o bjectMappe r = new Ob jectMapper (); | |
1264 | // try { | |
1265 | // rcoll = ob jectMapper .writeValu eAsString( rtc); | |
1266 | // } ca tch (JsonP rocessingE xception e ) { | |
1267 | // rcoll = "" ; | |
1268 | // } | |
1269 | // dist ributeCach e("V4Resul tCollectio n", key, r coll); | |
1270 | // } else { | |
1271 | V4Limi t.getInsta nce().putV 4Cache("VL ER" + VLER CCDA.getLo incCode(), queryBean , rtc); | |
1272 | // } | |
1273 | } | |
1274 | logV LERRespons e(VLERCCDA .getLoincC ode(), que ryBean, "" , rtc, cou nt, stime, "false"); | |
1275 | } else { | |
1276 | logV LERRespons e(VLERCCDA .getLoincC ode(), que ryBean, "" , rtc, get Size(LOINC , rtc), st ime, "true "); | |
1277 | } | |
1278 | } catch (Dao Exception e) { | |
1279 | logRespo nse(LOINC. getLoincCo de(), quer yBean, e.g etLocalize dMessage() , null, 0, stime, "f alse"); | |
1280 | logError (e, queryB ean.getQue ryID()); | |
1281 | throw ne w RuntimeE xception(e ); | |
1282 | } | |
1283 | if (rtc != n ull) { | |
1284 | rtc.setV ler(true); | |
1285 | } | |
1286 | re turn rtc; | |
1287 | } | |
1288 | ||
1289 | /** | |
1290 | * Get BDA V4 da ta. | |
1291 | * | |
1292 | * @pa ram loinc loinc | |
1293 | * @pa ram queryB ean query bean | |
1294 | * @re turn colle ction | |
1295 | */ | |
1296 | privat e V4Result Collection getV4(Cli nicalDomai nLoincCode loinc, Qu eryBean qu eryBean) { | |
1297 | V4 ResultColl ection rtc = null; | |
1298 | lo ng stime = logReques t(queryBea n); | |
1299 | ||
1300 | tr y { | |
1301 | V4Dao da o = new V4 Dao(); | |
1302 | int coun t = 0; | |
1303 | rtc = da o.getV4Dat a(loinc, q ueryBean); | |
1304 | if (rtc != null) { | |
1305 | coun t = getSiz e(loinc, r tc); | |
1306 | } | |
1307 | logVLERR esponse(lo inc.getLoi ncCode(), queryBean, "", rtc, count, sti me, "false "); | |
1308 | } catch (Dao Exception e) { | |
1309 | logRespo nse(loinc. getLoincCo de(), quer yBean, e.g etLocalize dMessage() , null, 0, stime, "f alse"); | |
1310 | logError (e, queryB ean.getQue ryID()); | |
1311 | throw ne w RuntimeE xception(e ); | |
1312 | } | |
1313 | re turn rtc; | |
1314 | } | |
1315 | ||
1316 | /** | |
1317 | * Get size of d ata list. | |
1318 | * | |
1319 | * @pa ram LOINC LOINC | |
1320 | * @pa ram rtc da ta | |
1321 | * @re turn size | |
1322 | */ | |
1323 | privat e int getS ize(Clinic alDomainLo incCode LO INC, V4Res ultCollect ion rtc) { | |
1324 | in t count = 0; | |
1325 | if (rtc != n ull && rtc .getDataRe cordList() != null) { | |
1326 | if (LOIN C == Clini calDomainL oincCode.A DMISSIONSV 4 && rtc.g etDataReco rdList().g etAdmissio ns() != nu ll) { | |
1327 | coun t = rtc.ge tDataRecor dList().ge tAdmission s().size() ; | |
1328 | } else i f (LOINC = = Clinical DomainLoin cCode.VLER ADMISSIONS && rtc.ge tDataRecor dList().ge tAdmission s() != nul l) { | |
1329 | coun t = rtc.ge tDataRecor dList().ge tAdmission s().size() ; | |
1330 | } else i f (LOINC = = Clinical DomainLoin cCode.ALLE RGIESV4 && rtc.getDa taRecordLi st().getAl lergy() != null) { | |
1331 | coun t = rtc.ge tDataRecor dList().ge tAllergy() .size(); | |
1332 | } else i f (LOINC = = Clinical DomainLoin cCode.VLER ALLERGIES && rtc.get DataRecord List().get Allergy() != null) { | |
1333 | coun t = rtc.ge tDataRecor dList().ge tAllergy() .size(); | |
1334 | } else i f (LOINC = = Clinical DomainLoin cCode.APPO INTMENTS & & rtc.getD ataRecordL ist().getA ppointment s() != nul l) { | |
1335 | coun t = rtc.ge tDataRecor dList().ge tAppointme nts().size (); | |
1336 | } else i f (LOINC = = Clinical DomainLoin cCode.VLER APPOINTMEN TS && rtc. getDataRec ordList(). getAppoint ments() != null) { | |
1337 | coun t = rtc.ge tDataRecor dList().ge tAppointme nts().size (); | |
1338 | // } else if (LOINC == Clinic alDomainLo incCode.CO NSULT_ORDE RS && rtc. getDataRec ordList(). getConsult Orders() ! = null) { | |
1339 | // co unt = rtc. getDataRec ordList(). getConsult Orders().s ize(); | |
1340 | } else i f (LOINC = = Clinical DomainLoin cCode.PATI ENT_DEMOGR APHICSV4 & & rtc.getD ataRecordL ist().getD emographic s() != nul l) { | |
1341 | coun t = rtc.ge tDataRecor dList().ge tDemograph ics().size (); | |
1342 | } else i f (LOINC = = Clinical DomainLoin cCode.VLER PATIENT_DE MOGRAPHICS && rtc.ge tDataRecor dList().ge tDemograph ics() != n ull) { | |
1343 | coun t = rtc.ge tDataRecor dList().ge tDemograph ics().size (); | |
1344 | } else i f (LOINC = = Clinical DomainLoin cCode.PATI ENT_MANAGE MENT && rt c.getDataR ecordList( ).getPatie ntManageme nt() != nu ll) { | |
1345 | coun t = rtc.ge tDataRecor dList().ge tPatientMa nagement() .size(); | |
1346 | } else i f (LOINC = = Clinical DomainLoin cCode.DEPL OYMENT_FOR MS && rtc. getDataRec ordList(). getDeploym entForms() != null) { | |
1347 | coun t = rtc.ge tDataRecor dList().ge tDeploymen tForms().s ize(); | |
1348 | } else i f (LOINC = = Clinical DomainLoin cCode.ENCO UNTER_NOTE S && rtc.g etDataReco rdList().g etEncounte rNotes() ! = null) { | |
1349 | coun t = rtc.ge tDataRecor dList().ge tEncounter Notes().si ze(); | |
1350 | } else i f (LOINC = = Clinical DomainLoin cCode.ENCO UNTERS && rtc.getDat aRecordLis t().getEnc ounters() != null) { | |
1351 | coun t = rtc.ge tDataRecor dList().ge tEncounter s().size() ; | |
1352 | } else i f (LOINC = = Clinical DomainLoin cCode.IMMU NIZATIONS && rtc.get DataRecord List().get Immunizati ons() != n ull) { | |
1353 | coun t = rtc.ge tDataRecor dList().ge tImmunizat ions().siz e(); | |
1354 | } else i f (LOINC = = Clinical DomainLoin cCode.VLER IMMUNIZATI ONS && rtc .getDataRe cordList() .getImmuni zations() != null) { | |
1355 | coun t = rtc.ge tDataRecor dList().ge tImmunizat ions().siz e(); | |
1356 | } else i f (LOINC = = Clinical DomainLoin cCode.LAB_ ANATOMIC_P ATHOLOGIES && rtc.ge tDataRecor dList().ge tLabApResu lts() != n ull) { | |
1357 | coun t = rtc.ge tDataRecor dList().ge tLabApResu lts().size (); | |
1358 | } else i f (LOINC = = Clinical DomainLoin cCode.LAB_ CHEMISTRIE S && rtc.g etDataReco rdList().g etLabChemR esults() ! = null) { | |
1359 | coun t = rtc.ge tDataRecor dList().ge tLabChemRe sults().si ze(); | |
1360 | } else i f (LOINC = = Clinical DomainLoin cCode.LAB_ MICROBIOLO GIES && rt c.getDataR ecordList( ).getLabMi croResults () != null ) { | |
1361 | coun t = rtc.ge tDataRecor dList().ge tLabMicroR esults().s ize(); | |
1362 | // } else if (LOINC == Clinic alDomainLo incCode.LA B_ORDERS & & rtc.getD ataRecordL ist().getL abOrders() != null) { | |
1363 | // co unt = rtc. getDataRec ordList(). getLabOrde rs().size( ); | |
1364 | // } else if (LOINC == Clinic alDomainLo incCode.ME DICATION_O RDERS && r tc.getData RecordList ().getMedi cationOrde rs() != nu ll) { | |
1365 | // co unt = rtc. getDataRec ordList(). getMedicat ionOrders( ).size(); | |
1366 | } else i f (LOINC = = Clinical DomainLoin cCode.MEDI CATIONS && rtc.getDa taRecordLi st().getMe dications( ) != null) { | |
1367 | coun t = rtc.ge tDataRecor dList().ge tMedicatio ns().size( ); | |
1368 | } else i f (LOINC = = Clinical DomainLoin cCode.VLER MEDICATION S && rtc.g etDataReco rdList().g etMedicati ons() != n ull) { | |
1369 | coun t = rtc.ge tDataRecor dList().ge tMedicatio ns().size( ); | |
1370 | } else i f (LOINC = = Clinical DomainLoin cCode.NOTE S && rtc.g etDataReco rdList().g etNotes() != null) { | |
1371 | coun t = rtc.ge tDataRecor dList().ge tNotes().s ize(); | |
1372 | } else i f (LOINC = = Clinical DomainLoin cCode.INSU RANCES && rtc.getDat aRecordLis t().getPay ers() != n ull) { | |
1373 | coun t = rtc.ge tDataRecor dList().ge tPayers(). size(); | |
1374 | } else i f (LOINC = = Clinical DomainLoin cCode.VLER INSURANCE && rtc.get DataRecord List().get Payers() ! = null) { | |
1375 | coun t = rtc.ge tDataRecor dList().ge tPayers(). size(); | |
1376 | } else i f (LOINC = = Clinical DomainLoin cCode.PROB LEMS && rt c.getDataR ecordList( ).getProbl ems() != n ull) { | |
1377 | coun t = rtc.ge tDataRecor dList().ge tProblems( ).size(); | |
1378 | } else i f (LOINC = = Clinical DomainLoin cCode.VLER PROBLEMS & & rtc.getD ataRecordL ist().getP roblems() != null) { | |
1379 | coun t = rtc.ge tDataRecor dList().ge tProblems( ).size(); | |
1380 | } else i f (LOINC = = Clinical DomainLoin cCode.PROC EDURES && rtc.getDat aRecordLis t().getPro cedures() != null) { | |
1381 | coun t = rtc.ge tDataRecor dList().ge tProcedure s().size() ; | |
1382 | } else i f (LOINC = = Clinical DomainLoin cCode.VLER PROCEDURES && rtc.ge tDataRecor dList().ge tProcedure s() != nul l) { | |
1383 | coun t = rtc.ge tDataRecor dList().ge tProcedure s().size() ; | |
1384 | } else i f (LOINC = = Clinical DomainLoin cCode.QUES TIONNAIRES && rtc.ge tDataRecor dList().ge tQuestionn aires() != null) { | |
1385 | coun t = rtc.ge tDataRecor dList().ge tQuestionn aires().si ze(); | |
1386 | // } else if (LOINC == Clinic alDomainLo incCode.RA DIOLOGY_OR DERS && rt c.getDataR ecordList( ).getRadio logyOrders () != null ) { | |
1387 | // co unt = rtc. getDataRec ordList(). getRadiolo gyOrders() .size(); | |
1388 | } else i f (LOINC = = Clinical DomainLoin cCode.RADI OLOGY_REPO RTSV4 && r tc.getData RecordList ().getRadi ologyRepor ts() != nu ll) { | |
1389 | coun t = rtc.ge tDataRecor dList().ge tRadiology Reports(). size(); | |
1390 | // } else if (LOINC == Clinic alDomainLo incCode.VL ERRESULTS && rtc.get DataRecord List().get Results() != null) { | |
1391 | // co unt = rtc. getDataRec ordList(). getResults ().size(); | |
1392 | } else i f (LOINC = = Clinical DomainLoin cCode.VITA LS && rtc. getDataRec ordList(). getVitals( ) != null) { | |
1393 | coun t = rtc.ge tDataRecor dList().ge tVitals(). size(); | |
1394 | } | |
1395 | } | |
1396 | re turn count ; | |
1397 | } | |
1398 | ||
1399 | /** | |
1400 | * Get user reco rd from sn areworks. | |
1401 | * | |
1402 | * @pa ram certif icate user s certific ate | |
1403 | * @pa ram user u ser | |
1404 | * @pa ram creden tial crede ntial | |
1405 | * @re turn user | |
1406 | */ | |
1407 | @WebMe thod(opera tionName = "getSnare worksUser" ) | |
1408 | public SnareUser getSnarew orksUser(@ WebParam(n ame = "cer tificate") String ce rtificate, @WebParam (name = "u ser") Stri ng user, @ WebParam(n ame = "cre dential") String cre dential) { | |
1409 | Sn areUser rt c = null; | |
1410 | St ring host = AppConfi g.getInsta nce().getP roperties( ).getPrope rty("SNARE WORKS_HOST ", "172.18 .53.16"); | |
1411 | St ring port = AppConfi g.getInsta nce().getP roperties( ).getPrope rty("SNARE WORKS_PORT ", "510"); | |
1412 | LO GGER.debug ("getSnare worksUser Cert=" + D BLogger.cl eanString( certificat e)); | |
1413 | LO GGER.debug ("getSnare worksUser User=" + D BLogger.cl eanString( user)); | |
1414 | LO GGER.debug ("getSnare worksUser Credential =" + DBLog ger.cleanS tring(cred ential)); | |
1415 | int iport = PORT ; | |
1416 | tr y { | |
1417 | iport = Integer.pa rseInt(por t); | |
1418 | } catch (Num berFormatE xception e ) { | |
1419 | iport = PORT ; | |
1420 | } | |
1421 | Sn areworksHa ndler snar e = new Sn areworksHa ndler(); | |
1422 | if (user != null && us er.length( ) > 0) { | |
1423 | rtc = sn are.checkC redentials (user, cre dential, h ost, iport ); | |
1424 | } | |
1425 | if (rtc == n ull && cer tificate ! = null && certificat e.length() > 0) { | |
1426 | rtc = sn are.checkC ert(certif icate, hos t, iport); | |
1427 | } | |
1428 | re turn rtc; | |
1429 | } | |
1430 | ||
1431 | /** | |
1432 | * Res et status info. | |
1433 | * | |
1434 | */ | |
1435 | @WebMe thod(opera tionName = "resetSta tus") | |
1436 | public void rese tStatus() { | |
1437 | BH IEStatus.r esetStatus (); | |
1438 | } | |
1439 | ||
1440 | /** | |
1441 | * Get status in fo. | |
1442 | * | |
1443 | * @re turn statu s | |
1444 | */ | |
1445 | @WebMe thod(opera tionName = "getStatu s") | |
1446 | public String ge tStatus() { | |
1447 | re turn BHIES tatus.getS tatus(); | |
1448 | } | |
1449 | ||
1450 | /** | |
1451 | * Add cache rec ord. | |
1452 | * | |
1453 | * @pa ram type d ocument ty pe | |
1454 | * @pa ram key ke y | |
1455 | * @pa ram value cached rec ord | |
1456 | * @pa ram timest amp time s tamp | |
1457 | */ | |
1458 | @WebMe thod(opera tionName = "addCache ") | |
1459 | public void addC ache(@WebP aram(name = "type") String typ e, @WebPar am(name = "key") Str ing key, @ WebParam(n ame = "val ue") Strin g value, @ WebParam(n ame = "tim estamp") S tring time stamp) { | |
1460 | LO GGER.debug ("addCache " + DBLog ger.cleanS tring(type ) + ", " + DBLogger. cleanStrin g(key) + " , " + DBLo gger.clean String(val ue) + ", " + DBLogge r.cleanStr ing(timest amp)); | |
1461 | if ("V4Resul tCollectio n".equals( type)) { | |
1462 | V4Limit. getInstanc e().putV4C ache(key, value); | |
1463 | } else { | |
1464 | ObjectMa pper objec tMapper = new Object Mapper(); | |
1465 | objectMa pper.confi gure(Deser ialization Feature.FA IL_ON_UNKN OWN_PROPER TIES, fals e); | |
1466 | ||
1467 | LOGGER.e rror("addC ache - unk nown type: {}", DBLo gger.clean String(typ e)); | |
1468 | } | |
1469 | } | |
1470 | ||
1471 | // /** | |
1472 | // * C all addCac he on all relay serv ices. | |
1473 | // * | |
1474 | // * @ param type type of c ache entry | |
1475 | // * @ param quer yBean quer y bean | |
1476 | // * @ param resu ltCollecti on value t o cache | |
1477 | // */ | |
1478 | // priv ate void d istributeC ache(Strin g type, Qu eryBean qu eryBean, S tring resu ltCollecti on) { | |
1479 | // String key = BHIELim it.getInst ance().get Key(queryB ean, type) ; | |
1480 | // distribute Cache(type , key, res ultCollect ion); | |
1481 | // } | |
1482 | ||
1483 | // /** | |
1484 | // * C all addCac he on all relay serv ices. | |
1485 | // * | |
1486 | // * @ param type type of c ache entry | |
1487 | // * @ param key key of cac he entry | |
1488 | // * @ param resu ltCollecti on value t o cache | |
1489 | // */ | |
1490 | // priv ate void d istributeC ache(Strin g type, St ring key, String res ultCollect ion) { | |
1491 | // String end points = A ppConfig.g etInstance ().getRela yEndpoints (); | |
1492 | // String aut hs = AppCo nfig.getIn stance().g etRelayEnd pointAuths (); | |
1493 | // SimpleDate Format sdf = new Sim pleDateFor mat("yyyyM MddHHmmss" , Locale.g etDefault( )); | |
1494 | // Date now = new Date( ); | |
1495 | // String tst amp = sdf. format(now ); | |
1496 | // if (endpoi nts != nul l && endpo ints.lengt h() > 0) { | |
1497 | // String [] endpoin t = endpoi nts.split( "\\|"); | |
1498 | // String [] auth = null; | |
1499 | // if (au ths != nul l && auths .length() > 0) { | |
1500 | // au th = auths .split("\\ |"); | |
1501 | // } | |
1502 | // for (i nt i = 0; i < endpoi nt.length; ++i) { | |
1503 | // if (auth != null && au th.length > i && aut h[i] != nu ll && auth [i].length () > 0) { | |
1504 | // (new BHI ECacheClie nt(endpoin t[i], auth [i], type, key, resu ltCollecti on, tstamp )).start() ; | |
1505 | // } else { | |
1506 | // (new BHI ECacheClie nt(endpoin t[i], "", type, key, resultCol lection, t stamp)).st art(); | |
1507 | // } | |
1508 | // } | |
1509 | // } | |
1510 | // } | |
1511 | ||
1512 | privat e void log Error(Exce ption e) { | |
1513 | lo gError(e, null); | |
1514 | } | |
1515 | ||
1516 | privat e void log Error(Exce ption e, S tring quer yID) { | |
1517 | if (queryID == null) { | |
1518 | LOGGER.e rror("BHIE RelayServi ce ERROR: " + e.getM essage(), e); | |
1519 | } else { | |
1520 | LOGGER.e rror("BHIE RelayServi ce ERROR: " + e.getM essage() + " Query I D: " + DBL ogger.clea nString(qu eryID), e) ; | |
1521 | } | |
1522 | } | |
1523 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.