Produced by Araxis Merge on 6/5/2018 10:24:15 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 | patch_205_build_9.zip\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\protocol\vista | VistaImagingVistaRadTranslator.java | Wed May 30 14:35:27 2018 UTC |
2 | patch_205_build_9.zip\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\protocol\vista | VistaImagingVistaRadTranslator.java | Mon Jun 4 20:37:22 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 546 |
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 | package go v.va.med.i maging.pro tocol.vist a; | |
2 | ||
3 | import jav a.util.Arr ayList; | |
4 | import jav a.util.Lis t; | |
5 | ||
6 | import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception; | |
7 | import gov .va.med.im aging.exce ptions.URN FormatExce ption; | |
8 | import gov .va.med.im aging.exch ange.busin ess.Site; | |
9 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.Exam; | |
10 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.ExamIma ge; | |
11 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.ExamIma ges; | |
12 | import gov .va.med.im aging.url. vista.Encr yptionUtil s; | |
13 | import gov .va.med.im aging.url. vista.Stri ngUtils; | |
14 | import gov .va.med.im aging.url. vista.imag e.VistaRad SiteCreden tials; | |
15 | ||
16 | import org .apache.lo gging.log4 j.LogManag er; | |
17 | import org .apache.lo gging.log4 j.Logger; | |
18 | ||
19 | /** | |
20 | * | |
21 | * @author PII | |
22 | * | |
23 | */ | |
24 | ||
25 | public cla ss VistaIm agingVista RadTransla tor | |
26 | { | |
27 | pr ivate stat ic Logger logger = L ogManager. getLogger( VistaImagi ngVistaRad Translator .class); | |
28 | ||
29 | /* * | |
30 | * Convert o utput from VistA fro m the MAGJ RADCASEIM AGES rpc i nto a map of ExamIma ge objects | |
31 | * | |
32 | 47^0~Image s for Case #020602-9 8|1011^697 9793.8675^ 1^86|IMAGP ATIENT1011 ,1011^0206 02-98^CT A BDOMEN W&W /O CONT^FE B 6,2002^ 13:24^CT^0 00-00-1011 ^3^0^^I^|1 ^-1^660^20 021127 | |
33 | B2^3528^\\ isw-werfel j-lt\image 1$\DM00\00 \00\00\35\ DM00000000 3528.TGA^^ | |
34 | B2^3529^\\ isw-werfel j-lt\image 1$\DM00\00 \00\00\35\ DM00000000 3529.TGA^^ | |
35 | * | |
36 | * @param re sponse | |
37 | * @param st udyUrn | |
38 | * @param si te | |
39 | * @return | |
40 | * @throws U RNFormatEx ception | |
41 | * / | |
42 | pu blic stati c ExamImag es transla teExamImag esIntoExam sMap(Strin g response , | |
43 | Stri ng examId, String pa tientIcn, Site site) | |
44 | th rows URNFo rmatExcept ion | |
45 | { | |
46 | ||
47 | Stri ng [] line s = String Utils.Spli t(response , StringUt ils.NEW_LI NE); | |
48 | if(( lines == n ull) && (l ines.lengt h == 0)) | |
49 | { | |
50 | return new ExamI mages("", false); | |
51 | } | |
52 | Exam Images ima ges = new ExamImages (lines[0], false); | |
53 | if(l ines[0].st artsWith(" 0")) | |
54 | { | |
55 | logger .info("No images ava ilable for examId '" + examId + "', resp onse [" + lines[0] + "]"); | |
56 | return images; | |
57 | } | |
58 | Stri ng [] grou pPieces = StringUtil s.Split(li nes[0], St ringUtils. STICK); | |
59 | Stri ng patient Name = Str ingUtils.M agPiece(gr oupPieces[ 2], String Utils.CARE T, 1); | |
60 | if(l ines.lengt h > 1) | |
61 | { | |
62 | for(in t i = 1; i < lines.l ength; i++ ) | |
63 | { | |
64 | ExamImag e image = translateE xamImageLi neIntoExam Image(line s[i], exam Id, | |
65 | patientIcn , site, pa tientName) ; | |
66 | images.a dd(image); | |
67 | } | |
68 | } | |
69 | retu rn images; | |
70 | } | |
71 | ||
72 | /* * | |
73 | * | |
74 | B2^3529^\\ isw-werfel j-lt\image 1$\DM00\00 \00\00\35\ DM00000000 3529.TGA^^ | |
75 | * | |
76 | * | |
77 | * @param li ne | |
78 | * @param st udyUrn | |
79 | * @param si te | |
80 | * @return | |
81 | * / | |
82 | pr ivate stat ic ExamIma ge transla teExamImag eLineIntoE xamImage(S tring line , String e xamId, Str ing patien tIcn, | |
83 | Site s ite, Strin g patientN ame) | |
84 | th rows URNFo rmatExcept ion | |
85 | { | |
86 | // CTB 27Nov 2009 | |
87 | //St ring image Id = Base3 2Conversio nUtility.b ase32Encod e(StringUt ils.MagPie ce(line, S tringUtils .CARET, 2) ); | |
88 | Stri ng imageId = StringU tils.MagPi ece(line, StringUtil s.CARET, 2 ); | |
89 | Stri ng imagePa th = Strin gUtils.Mag Piece(line , StringUt ils.CARET, 3); | |
90 | Exam Image imag e = ExamIm age.create (site.getS iteNumber( ), | |
91 | imageId, examId, p atientIcn) ; | |
92 | imag e.setDiagn osticFileP ath(imageP ath); | |
93 | imag e.setPatie ntName(pat ientName); | |
94 | retu rn image; | |
95 | } | |
96 | ||
97 | /* * | |
98 | * Convert o utput from VistA fro m the MAGJ PT ALL EX AMS rpc in to a map o f ExamImag e objects | |
99 | * | |
100 | 26^1~Radio logy Exams for: IMAG PATIENT101 1,1011 (00 0-00-1011) -- ALL ex ams are li sted.|0 | |
101 | ^Day/Case~ S3~1^Lock~ ~2^Procedu re~~6^Modi fier~~25^I mage Date/ Time~S1~7^ Status~~8^ # Img~S2~9 ^Onl~~10^R C~~12^Site ~~23^Mod~~ 15^Interp By~~20^Ima ging Loc~~ 11^CPT~~27 | |
102 | ^040105-17 4^^CT ORBI T P FOS OR TEMP BON^ ^10/13/200 4@13:31:27 ^WAITING F OR EXAM^25 ^Y^^^CT^^T D-RAD^7048 2^|1011^69 49598.9048 ^1^191||W^ ^^CT^70482 ^0^191^0^^ | |
103 | ^040105-26 8^^CT CERV ICAL SPINE W/O CONT^ ^02/11/200 4@15:12:28 ^WAITING F OR EXAM^88 8^Y^^^CT^^ TD-RAD^721 25^|1011^6 949598.904 8^2^202||W ^^^CT^7212 5^0^202^0^ ^ | |
104 | ^040105-23 1^^MAGNETI C IMAGE,LU MBAR SPIN^ ^08/11/200 6@14:15:12 ^EXAMINED^ 172^Y^^^MR ^^TD-RAD^7 2148^|1011 ^6949598.9 048^3^206| |E^^^MR^72 148^1^206^ 0^^ | |
105 | ||
106 | * | |
107 | * @param re sponse | |
108 | * @return | |
109 | * / | |
110 | pu blic stati c List<Exa m> transla teExamsRes ponse(Stri ng respons e, Site si te, String patientIc n) | |
111 | th rows Metho dException | |
112 | { | |
113 | List <Exam> exa ms = new A rrayList<E xam>(); | |
114 | Stri ng [] line s = String Utils.Spli t(response , StringUt ils.NEW_LI NE); | |
115 | // i f only 1 l ine then d idn't get any exams for patien t | |
116 | if(l ines.lengt h > 1) | |
117 | { | |
118 | String headerLin e1 = lines [0]; | |
119 | String headerLin e2 = lines [1]; | |
120 | for(in t i = 2; i < lines.l ength; i++ ) | |
121 | { | |
122 | Exam exa m = transl ateExamLin eIntoExam( lines[i], site, pati entIcn); | |
123 | exam.set RawHeaderL ine1(heade rLine1); | |
124 | exam.set RawHeaderL ine2(heade rLine2); | |
125 | exams.ad d(exam); | |
126 | } | |
127 | } | |
128 | retu rn exams; | |
129 | } | |
130 | ||
131 | pr ivate stat ic Exam tr anslateExa mLineIntoE xam(String examLine, Site site , String p atientIcn) | |
132 | th rows Metho dException | |
133 | { | |
134 | Stri ng [] exam Pieces = S tringUtils .Split(exa mLine, Str ingUtils.S TICK); | |
135 | // CTB 27Nov 2009 | |
136 | //St ring examI d = Base32 Conversion Utility.ba se32Encode (examPiece s[1]); | |
137 | Stri ng examId = examPiec es[1]; | |
138 | Exam exam = nu ll; | |
139 | try | |
140 | { | |
141 | exam = Exam.crea te(site.ge tSiteNumbe r(), examI d, patient Icn); | |
142 | } | |
143 | catc h(URNForma tException urnfX) | |
144 | { | |
145 | throw new Method Exception( "URNFormat Exception creating U RN for exa m from (" + site.get SiteNumber () + ", " + examId + ", " + pa tientIcn + "), " + u rnfX.getMe ssage(), u rnfX); | |
146 | } | |
147 | //ex am.setRawO utput(exam Pieces[0]) ; | |
148 | // J MW 8/26/20 09 - Sunda r said the y want the full line of inform ation to p arse in VR ad | |
149 | exam .setRawOut put(examLi ne); | |
150 | //W^ ^^CT^72125 ^0^202^0^^ | |
151 | Stri ng fieldPi ece = exam Pieces[3]; | |
152 | Stri ng modalit y = String Utils.MagP iece(field Piece, Str ingUtils.C ARET, 4); | |
153 | Stri ng cptCode = StringU tils.MagPi ece(fieldP iece, Stri ngUtils.CA RET, 5); | |
154 | exam .setCptCod e(cptCode) ; | |
155 | exam .setModali ty(modalit y); | |
156 | exam .setSiteAb br(site.ge tSiteAbbr( )); | |
157 | exam .setSiteNa me(site.ge tSiteName( )); | |
158 | ||
159 | //TO DO: don't really hav e the pati ent name.. . is it ac tually nee ded? | |
160 | exam .setPatien tName(""); | |
161 | //TO DO: set ex am status, what does W mean? | |
162 | //ex am.setExam Status(Exa mStatus.) | |
163 | retu rn exam; | |
164 | } | |
165 | ||
166 | /* * | |
167 | * Convert o utput from VistA fro m the MAGJ RADACTIVE EXAMS rpc into a map of ExamIm age object s | |
168 | * @param re sponse | |
169 | * @return | |
170 | * / | |
171 | /* | |
172 | pu blic stati c ActiveEx ams transl ateActiveE xamsRespon se(String response, String sit eNumber) | |
173 | { | |
174 | Stri ng [] line s = String Utils.Spli t(response , StringUt ils.NEW_LI NE); | |
175 | ||
176 | Stri ng headerL ine1 = ""; | |
177 | Stri ng headerL ine2 = ""; | |
178 | if(l ines.lengt h > 1) | |
179 | { | |
180 | header Line1 = li nes[0]; | |
181 | } | |
182 | if(l ines.lengt h > 2) | |
183 | { | |
184 | header Line1 = li nes[1]; | |
185 | } | |
186 | Acti veExams re sult = new ActiveExa ms(siteNum ber, heade rLine1, he aderLine2) ; | |
187 | for( int i = 2; i < lines .length; i ++) | |
188 | { | |
189 | Active Exam activ eExam | |
190 | } | |
191 | retu rn result; | |
192 | }* / | |
193 | /* | |
194 | pu blic stati c String[] translate ActiveExam ListRespon se(String response) | |
195 | { | |
196 | Stri ng [] line s = String Utils.Spli t(response , StringUt ils.NEW_LI NE); | |
197 | retu rn lines; | |
198 | } | |
199 | */ | |
200 | ||
201 | ||
202 | /* * | |
203 | * Convert o utput from VistA fro m the MAGJ CPTMATCH rpc into a map of Ex amImage ob jects | |
204 | * @param re sponse | |
205 | * @return | |
206 | * / | |
207 | pu blic stati c String[] translate RelevantCp tCodeRespo nse(String response) | |
208 | { | |
209 | Stri ng [] line s = String Utils.Spli t(response , StringUt ils.NEW_LI NE); | |
210 | Stri ng stringC ount = Str ingUtils.M agPiece(li nes[0], St ringUtils. CARET, 1); | |
211 | int resultCoun t = Intege r.parseInt (stringCou nt); | |
212 | Stri ng [] cptC odes = new String[re sultCount] ; | |
213 | if(r esultCount == 0) | |
214 | { | |
215 | logger .info("0 C PT Codes f ound that match, res ponse from server: " + lines[0 ]); | |
216 | } | |
217 | else | |
218 | { | |
219 | logger .info("Fou nd [" + re sultCount + "] CPT C odes that match"); | |
220 | for(in t i = 1; i < lines.l ength; i++ ) | |
221 | { | |
222 | String c ptCode = S tringUtils .MagPiece( lines[i], StringUtil s.CARET, 1 ); | |
223 | cptCodes [i - 1] = cptCode; | |
224 | } | |
225 | } | |
226 | retu rn cptCode s; | |
227 | } | |
228 | ||
229 | /* * | |
230 | * | |
231 | * | |
232 | 1^1~Versio n Check OK . Server: 3.0.76.14 Client: 3. 0.76.14|12 6^IMAGPROV IDERONETWO SIX,ONETWO SIX^SAF^1^ 3.0.76.14 | |
233 | PII \ PI I
|
|
234 | *KEYS | |
235 | *END | |
236 | * | |
237 | * | |
238 | * @param li nes | |
239 | * @return | |
240 | * / | |
241 | pu blic stati c VistaRad SiteCreden tials crea teSiteCred entialsFro mResponse( String res ult, Strin g siteNumb er) | |
242 | { | |
243 | Stri ng [] line s = String Utils.Spli t(result, StringUtil s.NEW_LINE ); | |
244 | if(l ines.lengt h >= 2) | |
245 | { | |
246 | String username = StringUt ils.MagPie ce(lines[1 ], StringU tils.CARET , 1); | |
247 | String password = StringUt ils.MagPie ce(lines[1 ], StringU tils.CARET , 2); | |
248 | ||
249 | if((pa ssword != null) && ( password.l ength() > 0)) | |
250 | { | |
251 | try | |
252 | { | |
253 | password = Encryptio nUtils.dec rypt(passw ord); | |
254 | } | |
255 | catch(Ex ception ex ) | |
256 | { | |
257 | password = ""; | |
258 | System.out .println(" Exception decrypting password for site [ " + siteNu mber + "]. "); | |
259 | ex.printSt ackTrace() ; | |
260 | } | |
261 | } | |
262 | else | |
263 | { | |
264 | password = ""; | |
265 | } | |
266 | return new Vista RadSiteCre dentials(s iteNumber, username, password) ; | |
267 | } | |
268 | else | |
269 | { | |
270 | logger .warn("MAG J USER2 rp c does not contain e nough line s for site credentia ls"); | |
271 | return null; | |
272 | } | |
273 | } | |
274 | ||
275 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.