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