예제 #1
0
        public static CodableValue ToCodableValue(this CodeableConcept codeableConcept)
        {
            if (codeableConcept == null)
            {
                return(null);
            }


            var codableValue = new CodableValue();

            if (!string.IsNullOrEmpty(codeableConcept.Text))
            {
                codableValue.Text = codeableConcept.Text;
            }
            else
            {
                var firstCodingWithDisplayValue = codeableConcept.Coding
                                                  .FirstOrDefault(coding => !string.IsNullOrWhiteSpace(coding.Display));
                if (firstCodingWithDisplayValue != null)
                {
                    codableValue.Text = firstCodingWithDisplayValue.Display;
                }
            }

            foreach (var coding in codeableConcept.Coding)
            {
                codableValue.Add(coding.ToCodedValue());
            }

            return(codableValue);
        }
예제 #2
0
        public static CodableValue ToCodableValue(this CodeableConcept codeableConcept)
        {
            if (codeableConcept == null)
            {
                return(null);
            }

            var codableValue = new CodableValue
            {
                Text = codeableConcept.Text,
            };

            foreach (var coding in codeableConcept.Coding)
            {
                codableValue.Add(coding.ToCodedValue());
            }

            return(codableValue);
        }