Produced by Araxis Merge on 6/5/2018 10:24:12 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\MIXDataSource\main\src\java\gov\va\med\imaging\mix\translator | MixVistaRadTranslator.java | Wed May 30 14:35:26 2018 UTC |
2 | patch_205_build_9.zip\Java\MIXDataSource\main\src\java\gov\va\med\imaging\mix\translator | MixVistaRadTranslator.java | Mon Jun 4 20:08:08 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 554 |
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 | * | |
3 | Package: MAG - Vis tA Imaging | |
4 | WARNING: Per VHA D irective 2 004-038, t his routin e should n ot be modi fied. | |
5 | Date Cre ated: Oct 12, 2010 | |
6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
7 | Developer: PII | |
8 | Descript ion: | |
9 | ||
10 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
11 | ;; Property of the US Government . | |
12 | ;; No permis sion to co py or redi stribute t his softwa re is give n. | |
13 | ;; Use of un released v ersions of this soft ware requi res the us er | |
14 | ;; to execu te a writt en test ag reement wi th the Vis tA Imaging | |
15 | ;; Developm ent Office of the De partment o f Veterans Affairs, | |
16 | ;; telephon e (301) 73 4-0100. | |
17 | ;; | |
18 | ;; The Food and Drug A dministrat ion classi fies this software a s | |
19 | ;; a Class I I medical device. A s such, it may not b e changed | |
20 | ;; in any wa y. Modifi cations to this soft ware may r esult in a n | |
21 | ;; adulterat ed medical device un der 21CFR8 20, the us e of which | |
22 | ;; is consid ered to be a violati on of US F ederal Sta tutes. | |
23 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
24 | ||
25 | */ | |
26 | package go v.va.med.i maging.mix .translato r; | |
27 | ||
28 | import gov .va.med.im aging.exce ptions.URN FormatExce ption; | |
29 | import gov .va.med.im aging.exch ange.busin ess.Image; | |
30 | import gov .va.med.im aging.exch ange.busin ess.Series ; | |
31 | import gov .va.med.im aging.exch ange.busin ess.Study; | |
32 | import gov .va.med.im aging.exch ange.busin ess.StudyS etResult; | |
33 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.Exam; | |
34 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.ExamIma ge; | |
35 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.ExamIma ges; | |
36 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.ExamLis tResult; | |
37 | import gov .va.med.im aging.exch ange.enums .vistarad. ExamStatus ; | |
38 | ||
39 | import jav a.text.Sim pleDateFor mat; | |
40 | import jav a.util.Arr ayList; | |
41 | import jav a.util.Lis t; | |
42 | import jav a.util.Sor tedSet; | |
43 | ||
44 | import org .apache.lo gging.log4 j.LogManag er; | |
45 | import org .apache.lo gging.log4 j.Logger; | |
46 | ||
47 | /** | |
48 | * This tr anslates V IX busines s Study ob jects into VIX Exam business o bjects | |
49 | * | |
50 | * @author PII | |
51 | * | |
52 | */ | |
53 | public cla ss MixVist aRadTransl ator | |
54 | { | |
55 | pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(MixV istaRadTra nslator.cl ass); | |
56 | ||
57 | pu blic stati c ExamList Result tra nslate(Stu dySetResul t studySet Result) | |
58 | th rows URNFo rmatExcept ion | |
59 | { | |
60 | if(s tudySetRes ult == nul l) | |
61 | return null; | |
62 | ||
63 | List <Exam> exa ms = trans late(study SetResult. getArtifac ts()); | |
64 | ||
65 | retu rn ExamLis tResult.cr eate(exams , studySet Result.get ArtifactRe sultStatus (), studyS etResult.g etArtifact ResultErro rs()); | |
66 | ||
67 | } | |
68 | ||
69 | ||
70 | pr ivate stat ic List<Ex am> transl ate(Sorted Set<Study> studies) | |
71 | th rows URNFo rmatExcept ion | |
72 | { | |
73 | if(s tudies == null) | |
74 | return null; | |
75 | List <Exam> exa ms = new A rrayList<E xam>(studi es.size()) ; | |
76 | Stri ng patient Name = ""; | |
77 | Stri ng patient Icn = ""; | |
78 | if(s tudies.siz e() > 0) | |
79 | { | |
80 | Study study = st udies.firs t(); | |
81 | patien tName = st udy.getPat ientName() ; | |
82 | patien tIcn = stu dy.getPati entId(); | |
83 | } | |
84 | Stri ng rawHead erLine1 = studies.si ze() + "^ 1~Radiolog y Exams fo r: " + pat ientName + " (" + pa tientIcn + ") -- ALL exams are listed.|0 "; | |
85 | Stri ng rawHead erLine2 = "^Day/Case ~S3~1^Lock ~~2^Proced ure~~6^Mod ifier~~25^ Image Date /Time~S1~7 ^Status~~8 ^# Img~S2~ 9^Onl~~10^ RC~~12^Sit e~~23^Mod~ ~15^Interp By~~20^Im aging Loc~ ~11^CPT~~2 7"; | |
86 | for( Study stud y : studie s) | |
87 | { | |
88 | Exam e xam = Exam .create(st udy.getSit eNumber(), study.get StudyIen() , study.ge tPatientId ()); | |
89 | exam.s etExamRepo rt(study.g etRadiolog yReport()) ; | |
90 | // nee d to set t he requisi ton report and prese ntation st ate data t o empty st ring to in dicate the y were "lo aded". | |
91 | // nev er get the se values from DoD s o use empt y string r ather than null. | |
92 | exam.s etExamRequ isitionRep ort(""); | |
93 | exam.s etPresenta tionStateD ata(""); | |
94 | exam.s etExamStat us(ExamSta tus.INTERP RETED); | |
95 | ||
96 | exam.s etPatientN ame(study. getPatient Name()); | |
97 | exam.s etSiteAbbr (study.get SiteAbbr() ); | |
98 | exam.s etSiteName (study.get SiteName() ); | |
99 | exam.s etModality (getStudyM odality(st udy)); | |
100 | // no cpt code f rom DoD ri ght now | |
101 | exam.s etCptCode( ""); | |
102 | ||
103 | String examImage sHeader = ""; | |
104 | if(stu dy.getImag eCount() > 0) | |
105 | { | |
106 | examImag esHeader = study.get ImageCount () + "^0~I mages for DoD Case"; | |
107 | } | |
108 | else | |
109 | { | |
110 | examImag esHeader = "0^2~No I mages avai lable for DoD Case"; | |
111 | } | |
112 | ||
113 | ExamIm ages examI mages = ne w ExamImag es(examIma gesHeader, true); | |
114 | for(Se ries serie s : study. getSeries( )) | |
115 | { | |
116 | for(Imag e image : series) | |
117 | { | |
118 | ExamImage examImage = translat e(image); | |
119 | examImages .add(examI mage); | |
120 | } | |
121 | } | |
122 | exam.s etImages(e xamImages) ; | |
123 | exams. add(exam); | |
124 | exam.s etRawHeade rLine1(raw HeaderLine 1); | |
125 | exam.s etRawHeade rLine2(raw HeaderLine 2); | |
126 | exam.s etRawOutpu t(createRa wExamOutpu t(study)); | |
127 | } | |
128 | retu rn exams; | |
129 | } | |
130 | ||
131 | pr ivate stat ic String getStudyMo dality(Stu dy study) | |
132 | { | |
133 | if(( study.getM odalities( ) != null) && (study .getModali ties().siz e() > 0)) | |
134 | { | |
135 | return study.get Modalities ().iterato r().next() ; | |
136 | } | |
137 | retu rn ""; | |
138 | } | |
139 | ||
140 | pr ivate stat ic String createRawE xamOutput( Study stud y) | |
141 | { | |
142 | //^D ay/Case~S3 ~1^Lock~~2 ^Procedure ~~6^Modifi er~~25^Ima ge Date/Ti me~S1~7^St atus~~8^# Img~S2~9^O nl~~10^RC~ ~12^Site~~ 23^Mod~~15 ^Interp By ~~20^Imagi ng Loc~~11 ^CPT~~27 | |
143 | //^0 40105-174^ ^CT ORBIT P FOS OR T EMP BON^^1 0/13/2004@ 13:31:27^W AITING FOR EXAM^25^Y ^^^CT^^TD- RAD^70482^ |1011^6949 598.9048^1 ^191||W^^^ CT^70482^0 ^191^0^^ | |
144 | ||
145 | Stri ng modalit y = getStu dyModality (study); | |
146 | ||
147 | Stri ngBuilder sb = new S tringBuild er(); | |
148 | sb.a ppend("^") ; | |
149 | // d ate/case | |
150 | sb.a ppend(crea teCaseId(s tudy)); | |
151 | sb.a ppend("^") ; | |
152 | // l ock | |
153 | sb.a ppend("^") ; | |
154 | // p rocedure | |
155 | //sb .append(st udy.getPro cedure()); | |
156 | // t his field is the "pr ocedure" f ield but t he value w e get from the descr iption is better | |
157 | sb.a ppend(extr actIllegal Characters (study.get Descriptio n())); | |
158 | sb.a ppend("^") ; | |
159 | // m odifier | |
160 | sb.a ppend("^") ; | |
161 | // i mage date/ time | |
162 | ||
163 | Stri ng dateTim eFormat = "MM/dd/yyy y@HH:mm:ss "; | |
164 | Simp leDateForm at formatt er = new S impleDateF ormat(date TimeFormat ); | |
165 | sb.a ppend(form atter.form at(study.g etProcedur eDate())); | |
166 | sb.a ppend("^") ; | |
167 | // s tatus | |
168 | sb.a ppend("INT ERPRETED") ; | |
169 | sb.a ppend("^") ; | |
170 | // # images | |
171 | sb.a ppend(stud y.getImage Count()); | |
172 | sb.a ppend("^") ; | |
173 | // o nl ? | |
174 | sb.a ppend("^") ; | |
175 | // R C? | |
176 | sb.a ppend("^") ; | |
177 | // s ite | |
178 | sb.a ppend(stud y.getSiteN ame()); | |
179 | sb.a ppend("^") ; | |
180 | // m odality | |
181 | sb.a ppend(moda lity); | |
182 | sb.a ppend("^") ; | |
183 | // i nterpreted by | |
184 | sb.a ppend("^") ; | |
185 | // i mage locat ion | |
186 | sb.a ppend("^") ; | |
187 | // c pt | |
188 | ||
189 | sb.a ppend("|") ; | |
190 | sb.a ppend(stud y.getStudy Ien()); | |
191 | sb.a ppend("|") ; | |
192 | sb.a ppend("|") ; | |
193 | sb.a ppend("I") ; // inter preted | |
194 | sb.a ppend("^") ; | |
195 | sb.a ppend("^") ; | |
196 | sb.a ppend("^") ; | |
197 | sb.a ppend(moda lity); | |
198 | sb.a ppend("^") ; | |
199 | // c pt code | |
200 | sb.a ppend("^") ; | |
201 | sb.a ppend("^") ; | |
202 | sb.a ppend("^") ; | |
203 | sb.a ppend("^") ; | |
204 | sb.a ppend("^") ; | |
205 | retu rn sb.toSt ring(); | |
206 | } | |
207 | ||
208 | pr ivate stat ic String extractIll egalCharac ters(Strin g input) | |
209 | { | |
210 | if(i nput == nu ll) | |
211 | return null; | |
212 | ||
213 | // a descripti on from th e DoD had a '^' char acter in t he descrip tion field | |
214 | // t his caused the colum n headers to line up incorrect ly in Vist ARad | |
215 | // r eplace the '^' chara cter with a space | |
216 | Char Sequence b adCharacte r = "^"; | |
217 | Char Sequence r eplacement Character = " "; | |
218 | inpu t = input. replace(ba dCharacter , replacem entCharact er); | |
219 | ||
220 | retu rn input; | |
221 | } | |
222 | ||
223 | /* * | |
224 | * Create a unique cas e ID for t he exam ba sed on val ues of the exam, the case ID c reated sho uld consis tently cre ate the sa me ID | |
225 | * given the same stud y | |
226 | * @param st udy | |
227 | * @return | |
228 | * / | |
229 | pr ivate stat ic String createCase Id(Study s tudy) | |
230 | { | |
231 | try | |
232 | { | |
233 | String dateTimeF ormat = "M Mddyy"; | |
234 | Simple DateFormat formatter = new Sim pleDateFor mat(dateTi meFormat); | |
235 | ||
236 | String Builder sb = new Str ingBuilder (); | |
237 | sb.app end("DOD") ; | |
238 | sb.app end("-"); | |
239 | sb.app end(format ter.format (study.get ProcedureD ate())); | |
240 | sb.app end("-"); | |
241 | sb.app end(""); | |
242 | int ha shCodeValu e = 9999; | |
243 | if(stu dy.getStud yIen() != null) | |
244 | { | |
245 | hashCode Value = st udy.getStu dyIen().ha shCode(); | |
246 | if(hashC odeValue < 0) | |
247 | hashCodeVa lue *= -1; | |
248 | } | |
249 | sb.app end(hashCo deValue); | |
250 | ||
251 | return sb.toStri ng(); | |
252 | } | |
253 | catc h(Exceptio n ex) | |
254 | { | |
255 | logger .error("Er ror creati ng case ID for study '" + stud y.getStudy Ien() + "' from the DoD, " + e x.getMessa ge(), ex); | |
256 | return "DOD-9999 "; | |
257 | } | |
258 | } | |
259 | ||
260 | pr ivate stat ic ExamIma ge transla te(Image i mage) | |
261 | th rows URNFo rmatExcept ion | |
262 | { | |
263 | Exam Image exam Image = Ex amImage.cr eate(image .getSiteNu mber(), | |
264 | image.ge tIen(), | |
265 | image.ge tStudyIen( ), | |
266 | image.ge tPatientId () | |
267 | ); | |
268 | exam Image.setP atientName (image.get PatientNam e()); | |
269 | exam Image.setA lienSiteNu mber(image .getAlienS iteNumber( )); | |
270 | // n o need to set path h ere - not going to h ave a valu e from the DoD | |
271 | /* | |
272 | if(( image.getB igFilename () != null ) && (imag e.getBigFi lename().l ength() > 0)) | |
273 | { | |
274 | examIm age.setDia gnosticFil ePath(imag e.getBigFi lename()); | |
275 | }*/ | |
276 | ||
277 | retu rn examIma ge; | |
278 | } | |
279 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.