Esempio n. 1
0
        void parse(RdfSegment rdfSeg, string rawSeg)
        {
            string[] flds = StringUtils.split(rawSeg, EncodingChars.FieldSeparator);

            if (flds.Length != rdfSeg.Columns.Length + 1)
            {
                throw new Exception("Invalid RDT segment: incorrect number of columns");
            }

            if (flds[0] != "RDT")
            {
                throw new Exception("Invalid RDT segment: incorrect header");
            }

            columns = new RdtColumn[rdfSeg.Columns.Length];
            for (int i = 0; i < rdfSeg.Columns.Length; i++)
            {
                string[] columnValues = getColumnValues(flds[i + 1]);
                if (columnValues == null || columnValues.Length == 0)
                {
                    columns[i] = new RdtColumn(rdfSeg.Columns[i].Description);
                }
                else if (columnValues.Length == 1)
                {
                    columns[i] = new RdtColumn(rdfSeg.Columns[i].Description, columnValues[0]);
                }
                else
                {
                    columns[i] = new RdtColumn(rdfSeg.Columns[i].Description, columnValues);
                }
            }
        }
Esempio n. 2
0
        void parse(RdfSegment rdfSeg, string rawSeg)
        {
            string[] flds = StringUtils.split(rawSeg, EncodingChars.FieldSeparator);

            if (flds.Length != rdfSeg.Columns.Length + 1)
            {
                throw new Exception("Invalid RDT segment: incorrect number of columns");
            }

            if (flds[0] != "RDT")
            {
                throw new Exception("Invalid RDT segment: incorrect header");
            }

            columns = new RdtColumn[rdfSeg.Columns.Length];
            for (int i = 0; i < rdfSeg.Columns.Length; i++)
            {
                string[] columnValues = getColumnValues(flds[i+1]);
                if (columnValues == null || columnValues.Length == 0)
                {
                    columns[i] = new RdtColumn(rdfSeg.Columns[i].Description);
                }
                else if (columnValues.Length == 1)
                {
                    columns[i] = new RdtColumn(rdfSeg.Columns[i].Description, columnValues[0]);
                }
                else
                {
                    columns[i] = new RdtColumn(rdfSeg.Columns[i].Description, columnValues);
                }
            }
        }
Esempio n. 3
0
 public RdtSegment(RdfSegment rdfSeg, string rawSeg)
 {
     parse(rdfSeg, rawSeg);
 }
Esempio n. 4
0
 public PatientMatchesRequest()
 {
     MSH = new MshSegment();
     VTQ = new VtqSegment();
     RDF = new RdfSegment();
 }
Esempio n. 5
0
 public RdtSegment(RdfSegment rdfSeg, string rawSeg)
 {
     parse(rdfSeg, rawSeg);
 }
Esempio n. 6
0
 internal void parse(string rawMessage)
 {
     string[] segments = StringUtils.split(rawMessage, '\r');
     if (segments.Length < 4)
     {
         throw new Exception("Invalid message: needs 5 segments");
     }
     MSH = new MshSegment(segments[0]);
     MSA = new MsaSegment(segments[1]);
     QAK = new QakSegment(segments[2]);
     RDF = new RdfSegment(segments[3]);
     if (segments.Length > 4)
     {
         RDT = new RdtSegment[segments.Length - 4];
         for (int rdtIdx = 0, segIdx = 4; segIdx < segments.Length; rdtIdx++, segIdx++)
         {
             RDT[rdtIdx] = new RdtSegment(RDF, segments[segIdx]);
         }
     }
 }