示例#1
0
文件: HL7Helper.cs 项目: OSEHRA/mdo
        internal static string getString(AbstractSegment segment, int column, int rep)
        {
            NHapi.Base.Model.IType t = segment.GetField(column, rep);

            if (t is Varies)
            {
                return ((Varies)t).Data.ToString();
            }
            else if (t is NHapi.Model.V24.Datatype.TS)
            {
                return ((NHapi.Model.V24.Datatype.TS)t).ToString();
            }
            else if (t is NM)
            {
                return ((NM)t).Value;
            }
            else
            {
                throw new Exception("Unsupported HL7 type: " + t.TypeName);
            }
        }
示例#2
0
        /// <summary>
        /// Processes the segment.
        /// Loops through all of the fields within the segment, and parsing them individually.
        /// </summary>
        /// <param name="segment">The segment.</param>
        /// <param name="parentNode">The parent node.</param>
        private void ProcessSegment(AbstractSegment segment, FieldGroup parentNode)
        {
            FieldGroup segmentNode = new FieldGroup() { Name = segment.GetStructureName() };
            int dataItemCount = 0;

            for (int i = 1; i <= segment.NumFields(); i++)
            {
                dataItemCount++;
                IType[] dataItems = segment.GetField(i);
                foreach (IType item in dataItems)
                {
                    this.ProcessField(item, segment.GetFieldDescription(i), dataItemCount.ToString(), segmentNode);
                }
            }

            this.AddChildGroup(parentNode, segmentNode);
        }