toUtcFromRdv() public static method

public static toUtcFromRdv ( string rdvTS ) : string
rdvTS string
return string
        internal VitalSignSet[] toVitalSignsFromRdv(string response)
        {
            if (response == "")
            {
                return(null);
            }
            string[] lines = StringUtils.split(response, StringUtils.CRLF);
            lines = StringUtils.trimArray(lines);
            ArrayList    lst = new ArrayList();
            VitalSignSet rec = null;
            VitalSign    s   = null;

            for (int i = 0; i < lines.Length; i++)
            {
                string[] flds   = StringUtils.split(lines[i], StringUtils.CARET);
                int      fldnum = Convert.ToInt16(flds[0]);
                switch (fldnum)
                {
                case 1:
                    if (rec != null)
                    {
                        lst.Add(rec);
                    }
                    rec = new VitalSignSet();
                    string[] subflds = StringUtils.split(flds[1], StringUtils.SEMICOLON);
                    if (subflds.Length == 1)
                    {
                        rec.Facility = new SiteId("200", subflds[0]);
                    }
                    else
                    {
                        rec.Facility = new SiteId(subflds[1], subflds[0]);
                    }
                    break;

                case 2:
                    if (flds.Length == 2)
                    {
                        rec.Timestamp = VistaTimestamp.toUtcFromRdv(flds[1]);
                    }
                    break;

                case 3:
                    s      = new VitalSign();
                    s.Type = new ObservationType("", VitalSign.VITAL_SIGN, VitalSign.TEMPERATURE);
                    if (flds.Length == 2)
                    {
                        s.Value1 = flds[1];
                    }
                    rec.addVitalSign(VitalSign.TEMPERATURE, s);
                    break;

                case 4:
                    s      = new VitalSign();
                    s.Type = new ObservationType("", VitalSign.VITAL_SIGN, VitalSign.PULSE);
                    if (flds.Length == 2)
                    {
                        s.Value1 = flds[1];
                    }
                    rec.addVitalSign(VitalSign.PULSE, s);
                    break;

                case 5:
                    s      = new VitalSign();
                    s.Type = new ObservationType("", VitalSign.VITAL_SIGN, VitalSign.RESPIRATION);
                    if (flds.Length == 2)
                    {
                        s.Value1 = flds[1];
                    }
                    rec.addVitalSign(VitalSign.RESPIRATION, s);
                    break;

                case 6:
                    s      = new VitalSign();
                    s.Type = new ObservationType("", VitalSign.VITAL_SIGN, VitalSign.BLOOD_PRESSURE);
                    if (flds.Length == 2)
                    {
                        s.Value1 = flds[1];
                    }
                    rec.addVitalSign(VitalSign.BLOOD_PRESSURE, s);
                    break;

                case 7:
                    s      = new VitalSign();
                    s.Type = new ObservationType("", VitalSign.VITAL_SIGN, VitalSign.HEIGHT);
                    if (flds.Length == 2)
                    {
                        s.Value1 = flds[1];
                    }
                    rec.addVitalSign(VitalSign.HEIGHT, s);
                    break;

                case 8:
                    s      = new VitalSign();
                    s.Type = new ObservationType("", VitalSign.VITAL_SIGN, VitalSign.WEIGHT);
                    if (flds.Length == 2)
                    {
                        s.Value1 = flds[1];
                    }
                    rec.addVitalSign(VitalSign.WEIGHT, s);
                    break;

                case 9:
                    s      = new VitalSign();
                    s.Type = new ObservationType("", VitalSign.VITAL_SIGN, VitalSign.PAIN);
                    if (flds.Length == 2)
                    {
                        s.Value1 = flds[1];
                    }
                    rec.addVitalSign(VitalSign.PAIN, s);
                    break;

                case 10:
                    s      = new VitalSign();
                    s.Type = new ObservationType("", VitalSign.VITAL_SIGN, VitalSign.PULSE_OXYMETRY);
                    if (flds.Length == 2)
                    {
                        s.Value1 = flds[1];
                    }
                    rec.addVitalSign(VitalSign.PULSE_OXYMETRY, s);
                    break;

                case 11:
                    s      = new VitalSign();
                    s.Type = new ObservationType("", VitalSign.VITAL_SIGN, VitalSign.CENTRAL_VENOUS_PRESSURE);
                    if (flds.Length == 2)
                    {
                        s.Value1 = flds[1];
                    }
                    rec.addVitalSign(VitalSign.CENTRAL_VENOUS_PRESSURE, s);
                    break;

                case 12:
                    s      = new VitalSign();
                    s.Type = new ObservationType("", VitalSign.VITAL_SIGN, VitalSign.CIRCUMFERENCE_GIRTH);
                    if (flds.Length == 2)
                    {
                        s.Value1 = flds[1];
                    }
                    rec.addVitalSign(VitalSign.CIRCUMFERENCE_GIRTH, s);
                    break;

                case 15:
                    if (flds.Length == 2)
                    {
                        setVitalSignQualifierStrings(rec, flds[1], "Qualifiers");
                        rec.Qualifiers = flds[1];
                    }
                    break;

                case 16:
                    s      = new VitalSign();
                    s.Type = new ObservationType("", VitalSign.VITAL_SIGN, VitalSign.BODY_MASS_INDEX);
                    if (flds.Length == 2)
                    {
                        s.Value1 = flds[1];
                    }
                    rec.addVitalSign(VitalSign.BODY_MASS_INDEX, s);
                    break;

                case 17:
                    if (flds.Length == 2)
                    {
                        setVitalSignQualifierStrings(rec, flds[1], "Units");
                        rec.Units = flds[1];
                    }
                    break;

                default:
                    break;
                }
            }
            lst.Add(rec);
            return((VitalSignSet[])lst.ToArray(typeof(VitalSignSet)));
        }
Beispiel #2
0
        internal RadiologyReport[] toRadiologyReports(string response)
        {
            if (response == "")
            {
                return(null);
            }
            string[]        lines = StringUtils.split(response, StringUtils.CRLF);
            ArrayList       lst   = new ArrayList();
            RadiologyReport rec   = null;

            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i] == "")
                {
                    continue;
                }
                string[] flds = StringUtils.split(lines[i], StringUtils.CARET);
                if (flds[1] == "[+]")
                {
                    lst.Add(rec);
                    continue;
                }
                int fldnum = Convert.ToInt32(flds[0]);
                switch (fldnum)
                {
                // TODO
                // need to consider the following case:
                //1^NH CAMP PENDLETON;NH CAMP PENDLETON <--- not a recognized site code, should add to site 200
                //2^05/24/2010 12:26
                //3^L-SPINE, SERIES (3)
                // lots more stuff in between
                //10^[+]
                case 1:
                    //if (rec != null)
                    //{
                    //    lst.Add(rec);
                    //}
                    rec = new RadiologyReport();
                    string[] parts = StringUtils.split(flds[1], StringUtils.SEMICOLON);
                    if (parts.Length == 2)
                    {
                        rec.Facility = new SiteId(parts[1], parts[0]);
                    }
                    else if (flds[1] != "")
                    {
                        rec.Facility = new SiteId(cxn.DataSource.SiteId.Id, flds[1]);
                    }
                    else
                    {
                        rec.Facility = cxn.DataSource.SiteId;
                    }
                    break;

                case 2:
                    if (flds.Length == 2)
                    {
                        rec.Timestamp = VistaTimestamp.toUtcFromRdv(flds[1]);
                    }
                    break;

                case 3:
                    if (flds.Length == 2)
                    {
                        rec.Title = flds[1];
                    }
                    break;

                case 4:
                    if (flds.Length == 2)
                    {
                        rec.Status = flds[1];
                    }
                    break;

                case 5:
                    if (flds.Length == 2)
                    {
                        rec.CaseNumber      = flds[1];
                        rec.AccessionNumber = rec.getAccessionNumber(rec.Timestamp, rec.CaseNumber, DateFormat.ISO);
                    }
                    break;

                case 6:
                    if (flds.Length == 2)
                    {
                        rec.Text += flds[1] + '\n';
                    }
                    break;
                    //case 7:
                    //    if (flds.Length == 2)
                    //    {
                    //        rec.Impression += flds[1] + '\n';
                    //    }
                    //    break;
                    //case 8:
                    //    if (flds.Length == 2)
                    //    {
                    //        rec.Text += flds[1] + '\n';
                    //    }
                    //    break;
                }
            }
            //if (rec != null)
            //{
            //    lst.Add(rec);
            //}

            return((RadiologyReport[])lst.ToArray(typeof(RadiologyReport)));
        }
        internal CytologyReport[] toCytologyReports(string response)
        {
            if (response == "")
            {
                return(null);
            }
            ArrayList lst = new ArrayList();

            string[] lines = StringUtils.split(response, StringUtils.CRLF);
            lines = StringUtils.trimArray(lines);
            CytologyReport rpt            = null;
            string         collectionDate = "";
            string         specimenDesc   = "";
            string         accessionNum   = "";

            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)
                    {
                        rpt.Specimen = new LabSpecimen("", specimenDesc.Substring(0, specimenDesc.Length - 1), collectionDate, "");
                        rpt.Specimen.AccessionNumber = accessionNum;
                        lst.Add(rpt);
                    }
                    rpt          = new CytologyReport();
                    rpt.Title    = "Cytopathology Report";
                    specimenDesc = "";
                    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)
                    {
                        collectionDate = VistaTimestamp.toUtcFromRdv(flds[1]);
                    }
                    break;

                case 3:
                    if (flds.Length == 2)
                    {
                        specimenDesc += flds[1] + '\n';
                    }
                    break;

                case 4:
                    if (flds.Length == 2)
                    {
                        accessionNum = flds[1];
                    }
                    break;

                case 5:
                    if (flds.Length == 2)
                    {
                        rpt.Exam += flds[1] + '\n';
                    }
                    break;
                }
            }

            if (rpt != null)
            {
                rpt.Specimen = new LabSpecimen("", specimenDesc.Substring(0, specimenDesc.Length - 1), collectionDate, "");
                rpt.Specimen.AccessionNumber = accessionNum;
                lst.Add(rpt);
            }
            return((CytologyReport[])lst.ToArray(typeof(CytologyReport)));
        }
        internal ChemHemReport[] toChemHemReports(string response)
        {
            if (response == "")
            {
                return(null);
            }
            DictionaryHashList lst = new DictionaryHashList();

            string[] lines = StringUtils.split(response, StringUtils.CRLF);
            lines = StringUtils.trimArray(lines);

            ChemHemReport rpt          = null;
            LabResult     rslt         = null;
            string        ts           = "";
            string        facilityTag  = "";
            string        facilityName = "";

            for (int i = 0; i < lines.Length; i++)
            {
                string[] flds = StringUtils.split(lines[i], StringUtils.CARET);
                if (!StringUtils.isNumeric(flds[0]))
                {
                    throw new DataMisalignedException("Invalid fldnum: " + flds[0] + " in lines[" + i + "]");
                }
                int fldnum = Convert.ToInt32(flds[0]);
                switch (fldnum)
                {
                case 1:
                    string[] parts = StringUtils.split(flds[1], StringUtils.SEMICOLON);
                    if (parts.Length == 2)
                    {
                        facilityTag  = parts[1];
                        facilityName = parts[0];
                    }
                    else if (flds[1] != "")
                    {
                        facilityTag  = cxn.DataSource.SiteId.Id;
                        facilityName = flds[1];
                    }
                    else
                    {
                        facilityTag  = cxn.DataSource.SiteId.Id;
                        facilityName = cxn.DataSource.SiteId.Name;
                    }
                    break;

                case 2:
                    if (rpt != null)
                    {
                        if (StringUtils.isEmpty(rslt.Test.RefRange))
                        {
                            if (!StringUtils.isEmpty(rslt.Test.LowRef) &&
                                !StringUtils.isEmpty(rslt.Test.HiRef))
                            {
                                rslt.Test.RefRange = rslt.Test.LowRef + " - " + rslt.Test.HiRef;
                            }
                        }
                        rpt.AddResult(rslt);
                    }
                    rslt      = new LabResult();
                    rslt.Test = new LabTest();
                    ts        = VistaTimestamp.toUtcFromRdv(flds[1]);
                    if (lst[ts] == null)
                    {
                        rpt           = new ChemHemReport();
                        rpt.Facility  = new SiteId(facilityTag, facilityName);
                        rpt.Timestamp = ts;
                        lst.Add(ts, rpt);
                    }
                    break;

                case 3:
                    if (flds.Length == 2)
                    {
                        rslt.Test.Name = flds[1];
                    }
                    break;

                case 4:
                    if (flds.Length == 2)
                    {
                        if (null != rslt)
                        {
                            rslt.SpecimenType = flds[1];
                        }
                    }
                    break;

                case 5:
                    if (flds.Length == 2)
                    {
                        rslt.Value = flds[1];
                    }
                    break;

                case 6:
                    if (flds.Length == 2)
                    {
                        rslt.BoundaryStatus = flds[1];
                    }
                    break;

                case 7:
                    if (flds.Length == 2)
                    {
                        rslt.Test.Units = flds[1];
                    }
                    break;

                case 8:
                    if (flds.Length == 2)
                    {
                        rslt.Test.LowRef = flds[1];
                    }
                    break;

                case 9:
                    if (flds.Length == 2)
                    {
                        rslt.Test.HiRef = flds[1];
                    }
                    break;

                case 10:
                    if (flds.Length == 2)
                    {
                        rslt.Comment += flds[1] + '\n';
                    }
                    break;
                }
            }

            if (rpt != null)
            {
                if (StringUtils.isEmpty(rslt.Test.RefRange))
                {
                    if (!StringUtils.isEmpty(rslt.Test.LowRef) &&
                        !StringUtils.isEmpty(rslt.Test.HiRef))
                    {
                        rslt.Test.RefRange = rslt.Test.LowRef + " - " + rslt.Test.HiRef;
                    }
                }
                rpt.AddResult(rslt);
            }

            ChemHemReport[] result = new ChemHemReport[lst.Count];
            for (int i = 0; i < lst.Count; i++)
            {
                DictionaryEntry de = lst[i];
                result[i] = (ChemHemReport)de.Value;
            }
            return(result);
        }
        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 ElectronMicroscopyReport[] toElectronMicroscopyReports(string response)
        {
            if (response == "")
            {
                return(null);
            }
            ArrayList lst = new ArrayList();

            string[] lines = StringUtils.split(response, StringUtils.CRLF);
            lines = StringUtils.trimArray(lines);
            ElectronMicroscopyReport rpt = null;
            string specimenName          = "";
            string exam         = "";
            string accessionNum = "";

            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)
                    {
                        if (!String.IsNullOrEmpty(specimenName))
                        {
                            specimenName = specimenName.Substring(0, specimenName.Length - 1);
                            rpt.Specimen = new LabSpecimen("", specimenName, "", accessionNum);
                        }
                        if (!String.IsNullOrEmpty(exam))
                        {
                            exam     = exam.Substring(0, exam.Length - 1);
                            rpt.Exam = exam;
                        }
                        lst.Add(rpt);
                    }
                    rpt       = new ElectronMicroscopyReport();
                    rpt.Title = "Electron Microscopy 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)
                    {
                        specimenName += flds[1] + '\n';
                    }
                    break;

                case 4:
                    if (flds.Length == 2)
                    {
                        accessionNum = flds[1];
                    }
                    break;

                case 5:
                    if (flds.Length == 2)
                    {
                        if (!String.IsNullOrEmpty(flds[1].TrimEnd()))
                        {
                            exam += flds[1] + '\n';
                        }
                    }
                    break;
                }
            }

            if (rpt != null)
            {
                if (!String.IsNullOrEmpty(specimenName))
                {
                    specimenName = specimenName.Substring(0, specimenName.Length - 1);
                    rpt.Specimen = new LabSpecimen("", specimenName, "", accessionNum);
                }
                if (!String.IsNullOrEmpty(exam))
                {
                    exam     = exam.Substring(0, exam.Length - 1);
                    rpt.Exam = exam;
                }
                lst.Add(rpt);
            }
            return((ElectronMicroscopyReport[])lst.ToArray(typeof(ElectronMicroscopyReport)));
        }
        internal MicrobiologyReport[] toMicrobiologyReports(string response)
        {
            if (response == "")
            {
                return(null);
            }
            ArrayList lst = new ArrayList();

            string[] lines = StringUtils.split(response, StringUtils.CRLF);
            lines = StringUtils.trimArray(lines);
            MicrobiologyReport 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)
                    {
                        if (!String.IsNullOrEmpty(rpt.Sample))
                        {
                            rpt.Sample = rpt.Sample.Substring(0, rpt.Sample.Length - 1);
                        }
                        lst.Add(rpt);
                    }
                    rpt       = new MicrobiologyReport();
                    rpt.Title = "Microbiology Report";
                    if (flds.Length == 2)
                    {
                        string[] parts = StringUtils.split(flds[1], StringUtils.SEMICOLON);
                        if (parts.Length == 2)
                        {
                            rpt.Facility = new SiteId(parts[1], parts[0]);
                        }
                        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.Title = flds[1];
                    }
                    break;

                case 4:
                    if (flds.Length == 2)
                    {
                        rpt.Sample += flds[1] + '\n';
                    }
                    break;

                case 5:
                    if (flds.Length == 2)
                    {
                        rpt.Specimen = new LabSpecimen("", flds[1], "", "");
                    }
                    break;

                case 6:
                    if (flds.Length == 2)
                    {
                        rpt.Specimen.AccessionNumber = flds[1];
                    }
                    break;

                case 7:
                    if (flds.Length == 2)
                    {
                        rpt.Text += flds[1] + '\n';
                    }
                    break;
                }
            }

            if (rpt != null)
            {
                lst.Add(rpt);
            }
            return((MicrobiologyReport[])lst.ToArray(typeof(MicrobiologyReport)));
        }
Beispiel #8
0
        internal SurgicalPathologyReport[] toSurgicalPathologyReports(string response)
        {
            if (response == "")
            {
                return(null);
            }
            ArrayList lst = new ArrayList();

            string[] lines = StringUtils.split(response, StringUtils.CRLF);
            lines = StringUtils.trimArray(lines);
            SurgicalPathologyReport rpt = null;
            string specimenName         = "";
            string exam         = "";
            string accessionNum = "";

            IList <SurgicalPathologyReport> rpts   = new List <SurgicalPathologyReport>();
            SurgicalPathologyReport         newRpt = new SurgicalPathologyReport();

            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:
                    newRpt.Title = "Surgical Pathology Report";
                    if (rpt != null)
                    {
                        if (!String.IsNullOrEmpty(specimenName))
                        {
                            specimenName = specimenName.Substring(0, specimenName.Length - 1);
                            rpt.Specimen = new LabSpecimen("", specimenName, "", accessionNum);
                        }
                        if (!String.IsNullOrEmpty(exam))
                        {
                            exam     = exam.Substring(0, exam.Length - 1);
                            rpt.Exam = exam;
                        }
                        lst.Add(rpt);
                    }
                    rpt       = new SurgicalPathologyReport();
                    rpt.Title = "Surgical Pathology Report";
                    if (flds.Length == 2)
                    {
                        string[] parts = StringUtils.split(flds[1], StringUtils.SEMICOLON);
                        if (parts.Length == 2)
                        {
                            newRpt.Facility = new SiteId(parts[0], parts[1]);
                            rpt.Facility    = new SiteId(parts[0], parts[1]);
                        }
                        else if (flds[1] != "")
                        {
                            newRpt.Facility = new SiteId(cxn.DataSource.SiteId.Id, parts[1]);
                            rpt.Facility    = new SiteId(cxn.DataSource.SiteId.Id, flds[1]);
                        }
                        else
                        {
                            newRpt.Facility = cxn.DataSource.SiteId;
                            rpt.Facility    = cxn.DataSource.SiteId;
                        }
                    }
                    break;

                case 2:
                    if (flds.Length == 2)
                    {
                        newRpt.Timestamp = VistaTimestamp.toUtcFromRdv(flds[1]);
                        rpt.Timestamp    = VistaTimestamp.toUtcFromRdv(flds[1]);
                    }
                    break;

                case 3:
                    if (flds.Length == 2)
                    {
                        if (newRpt.Specimen == null)
                        {
                            newRpt.Specimen = new LabSpecimen("", "", "", "");
                        }
                        newRpt.Specimen.Name += flds[1] + '\n';
                        specimenName         += flds[1] + '\n';
                    }
                    break;

                case 4:
                    if (flds.Length == 2)
                    {
                        if (newRpt.Specimen == null)
                        {
                            newRpt.Specimen = new LabSpecimen("", "", "", "");
                        }
                        newRpt.Specimen.AccessionNumber = flds[1];
                        accessionNum = flds[1];
                    }
                    break;

                case 5:
                    if (flds.Length == 2)
                    {
                        if (!String.IsNullOrEmpty(flds[1].TrimEnd()))
                        {
                            newRpt.Exam += flds[1] + '\n';
                            exam        += flds[1] + '\n';
                        }
                    }
                    break;

                case 6:
                    if (newRpt.Specimen != null && !String.IsNullOrEmpty(newRpt.Specimen.Name))
                    {
                        newRpt.Specimen.Name = newRpt.Specimen.Name.TrimEnd(new char[] { '\n' });
                    }
                    if (!String.IsNullOrEmpty(newRpt.Exam))
                    {
                        newRpt.Exam = newRpt.Exam.TrimEnd(new char[] { '\n' });
                    }
                    rpts.Add(newRpt);
                    newRpt = new SurgicalPathologyReport();
                    break;
                }
            }

            if (rpt != null)
            {
                lst.Add(rpt);
            }

            SurgicalPathologyReport[] result = new SurgicalPathologyReport[rpts.Count];
            rpts.CopyTo(result, 0);
            return(result);
            //return (SurgicalPathologyReport[])lst.ToArray(typeof(SurgicalPathologyReport));
        }