コード例 #1
0
 private static void SetAbatement(this Condition fhirCondition, ItemTypes.ApproximateDateTime approximateDateTime)
 {
     if (approximateDateTime.ApproximateDate != null)
     {
         fhirCondition.Abatement = approximateDateTime.ToFhir();
     }
     else
     {
         fhirCondition.Abatement = new FhirString(approximateDateTime.Description.ToString());
     }
 }
コード例 #2
0
        public static ApproximateDateTime ToAproximateDateTime(this Element fhirElement)
        {
            switch (fhirElement)
            {
            case FhirString fhirString:
                ItemTypes.ApproximateDateTime approximateDateTime = new ItemTypes.ApproximateDateTime();
                approximateDateTime.Description = fhirString.ToString();
                return(approximateDateTime);

            case FhirDateTime fhirDateTime:
                return(processDate(fhirDateTime));

            case Period fhirPeriod:
                return(processDate(fhirPeriod.StartElement ?? fhirPeriod.EndElement));

            case Date fhirDate:
                return(processDate(new FhirDateTime(fhirDate.Value)));

            default:
                throw new NotSupportedException($"Conversion from {fhirElement.GetType()} to {typeof(ApproximateDateTime)} is not supported");
            }
        }