internal DdrLister buildGetExamDetailsRequest(String patientId, ImagingExam exam) { return(new DdrLister(this.cxn) { File = "70.03", //Fields = ".01;2;3;3.5;4;6;7;8;10;11;12;13;14;16;16.5;17;21;27;31", Fields = ".01", Flags = "IP", Iens = "," + exam.Id + "," + patientId + ",", Xref = "#" }); }
public RadiologyReportTO getImagingReport(string ssn, string accessionNumber) { RadiologyReportTO result = new RadiologyReportTO(); if (!mySession.ConnectionSet.IsAuthorized) { result.fault = new FaultTO("Connections not ready for operation", "Need to login?"); } else if (String.IsNullOrEmpty(ssn)) { result.fault = new FaultTO("Missing SSN"); } else if (String.IsNullOrEmpty(accessionNumber)) { result.fault = new FaultTO("Missing Accession Number"); } if (result.fault != null) { return(result); } try { PatientApi patientApi = new PatientApi(); Patient[] matches = patientApi.match(mySession.ConnectionSet.BaseConnection, ssn); if (matches == null || matches.Length != 1) { result.fault = new FaultTO("More than one patient has that SSN in this site (" + mySession.ConnectionSet.BaseConnection.DataSource.SiteId.Id + ")"); return(result); } RadiologyReport report = ImagingExam.getReportText(mySession.ConnectionSet.BaseConnection, matches[0].LocalPid, accessionNumber); result = new RadiologyReportTO(report); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }
internal void supplementExamDetailsWithDdrResult(String patientId, ImagingExam exam, String[] imagingExams) { // TBD - should each entry in subfile 70.03 be an ImagingExam object? Should the ImagingExam from 70.02 be cloned // and then the properties from each record in 70.03 copied over? Quick spelunking shows mostly 1:1 relationship 70.02 : 70.03 // a DdrGetsEntry call was required because CLINICAL HISTORY (field #400) is a WP field. So, we're going to fetch // the whole record instead so we can use the external values where available foreach (String exam70x03 in imagingExams) { String[] pieces = StringUtils.split(exam70x03, StringUtils.CARET); // DDR LISTER fields: IEN^.01^2^3^3.5^4^6^7^8^10^11^12^13^14^16^16.5^17^21^27^31 // Index: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 String[] ddrGetsEntryResult = buildGetExamDdrGetsEntryQuery(patientId, exam.Id, pieces[0]).execute(); DdrGetsEntryDictionary rec = DdrGetsEntryDictionary.parse(ddrGetsEntryResult); exam.CaseNumber = rec.safeGetValue(".01"); // pieces[1]; exam.Status = rec.safeGetValue("3"); // pieces[3]; exam.AccessionNumber = rec.safeGetValue("31"); // pieces[19]; exam.ClinicalHistory = rec.safeGetValue("400"); // TODO - change object model as needed to accomodate other properties } //if (details.ContainsKey(".01")) { exam.CaseNumber = details[".01"]; } //if (details.ContainsKey("2")) { /* TBD - map PROCEDURE (pointer to RAD/NUC MED PROCEDURES - #71) field? */ } //if (details.ContainsKey("3")) { exam.Status = details["3"]; } // pointer to EXAMINATION STATUS file #72 - DDR GETS ENTRY request should've brought external value though! //if (details.ContainsKey("3.5")) { /* TBD - map CANCELLATION REASON (pointer to RAD/NUC MED REASON - 75.2) field? */ } //if (details.ContainsKey("4")) { /* TBD - map CATEGORY OF EXAM field? */ } //if (details.ContainsKey("10")) { /* CONTRAST MEDIA USED */ } //if (details.ContainsKey("11")) { if (exam.Order == null) { exam.Order = new Order() { Id = details["10"] }; } } // pointer to RAD/NUC MED ORDERS #75.1 //if (details.ContainsKey("12")) { /* PRIMARY INTERPRETING RESIDENT */ } //if (details.ContainsKey("13")) { /* PRIMARY DIAGNOSTIC CODE */ } //if (details.ContainsKey("14")) { /* REQUESTING PHYSICIAN */ } //if (details.ContainsKey("16")) { /* COMPLICATION - pointer to file #78.1 */ } //if (details.ContainsKey("16")) { /* COMPLICATION TEXT */ } //if (details.ContainsKey("17")) { /* REPORT TEXT - pointer to file #74 */ } //if (details.ContainsKey("21")) { /* REQUESTED DATE */ } //if (details.ContainsKey("27")) { /* VISIT - pointer to file #9000010 */ } //if (details.ContainsKey("31")) { exam.AccessionNumber = details["31"]; } //if (details.ContainsKey("400")) { exam.ClinicalHistory = details["400"]; } }