internal AnatomicPathologyReport[] toAnatomicPathologyReports(string response) { if (response == "") { return(null); } ArrayList lst = new ArrayList(); string[] lines = StringUtils.split(response, StringUtils.CRLF); lines = StringUtils.trimArray(lines); AnatomicPathologyReport rpt = null; for (int i = 0; i < lines.Length; i++) { string[] flds = StringUtils.split(lines[i], StringUtils.CARET); int fldnum = Convert.ToInt32(flds[0]); switch (fldnum) { case 1: if (rpt != null) { lst.Add(rpt); } rpt = new AnatomicPathologyReport(); rpt.Title = "Anatomic Pathology Report"; if (flds.Length == 2) { string[] parts = StringUtils.split(flds[1], StringUtils.SEMICOLON); if (parts.Length == 2) { rpt.Facility = new SiteId(parts[0], parts[1]); } else if (flds[1] != "") { rpt.Facility = new SiteId(cxn.DataSource.SiteId.Id, flds[1]); } else { rpt.Facility = cxn.DataSource.SiteId; } } break; case 2: if (flds.Length == 2) { rpt.Timestamp = VistaTimestamp.toUtcFromRdv(flds[1]); } break; case 3: if (flds.Length == 2) { rpt.Specimen = new LabSpecimen("", flds[1], "", ""); } break; case 4: //[DP] 6/20/2011 Allow for the case with a null specimen. if (flds.Length == 2 && rpt.Specimen != null) { rpt.Specimen.AccessionNumber = flds[1]; } break; case 5: if (flds.Length == 2) { if (!String.IsNullOrEmpty(flds[1].TrimEnd())) { rpt.Exam += flds[1] + '\n'; } } break; } } if (rpt != null) { lst.Add(rpt); } return((AnatomicPathologyReport[])lst.ToArray(typeof(AnatomicPathologyReport))); }
internal AnatomicPathologyReport[] toAnatomicPathologyReports(string response) { if (response == "") { return null; } ArrayList lst = new ArrayList(); string[] lines = StringUtils.split(response, StringUtils.CRLF); lines = StringUtils.trimArray(lines); AnatomicPathologyReport rpt = null; for (int i = 0; i < lines.Length; i++) { string[] flds = StringUtils.split(lines[i], StringUtils.CARET); int fldnum = Convert.ToInt32(flds[0]); switch (fldnum) { case 1: if (rpt != null) { lst.Add(rpt); } rpt = new AnatomicPathologyReport(); rpt.Title = "Anatomic Pathology Report"; if (flds.Length == 2) { string[] parts = StringUtils.split(flds[1], StringUtils.SEMICOLON); if (parts.Length == 2) { rpt.Facility = new SiteId(parts[0], parts[1]); } else if (flds[1] != "") { rpt.Facility = new SiteId(cxn.DataSource.SiteId.Id, flds[1]); } else { rpt.Facility = cxn.DataSource.SiteId; } } break; case 2: if (flds.Length == 2) { rpt.Timestamp = VistaTimestamp.toUtcFromRdv(flds[1]); } break; case 3: if (flds.Length == 2) { rpt.Specimen = new LabSpecimen("", flds[1], "", ""); } break; case 4: //[DP] 6/20/2011 Allow for the case with a null specimen. if (flds.Length == 2 && rpt.Specimen != null) { rpt.Specimen.AccessionNumber = flds[1]; } break; case 5: if (flds.Length == 2) { if (!String.IsNullOrEmpty(flds[1].TrimEnd())) { rpt.Exam += flds[1] + '\n'; } } break; } } if (rpt != null) { lst.Add(rpt); } return (AnatomicPathologyReport[])lst.ToArray(typeof(AnatomicPathologyReport)); }