本文整理汇总了C#中Hl7类的典型用法代码示例。如果您正苦于以下问题:C# Hl7类的具体用法?C# Hl7怎么用?C# Hl7使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Hl7类属于命名空间,在下文中一共展示了Hl7类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeNarrative
public static void SerializeNarrative(Hl7.Fhir.Model.Narrative value, IFhirWriter writer, bool summary)
{
writer.WriteStartComplexContent();
// Serialize element _id
if(value.LocalIdElement != null)
writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
// Serialize element extension
if(value.Extension != null && !summary && value.Extension.Count > 0)
{
writer.WriteStartArrayElement("extension");
foreach(var item in value.Extension)
{
writer.WriteStartArrayMember("extension");
ExtensionSerializer.SerializeExtension(item, writer, summary);
writer.WriteEndArrayMember();
}
writer.WriteEndArrayElement();
}
// Serialize element status
if(value.StatusElement != null)
{
writer.WriteStartElement("status");
CodeSerializer.SerializeCode<Hl7.Fhir.Model.Narrative.NarrativeStatus>(value.StatusElement, writer, summary);
writer.WriteEndElement();
}
// Serialize element div
if(value.DivElement != null)
writer.WritePrimitiveContents("div", value.DivElement, XmlSerializationHint.XhtmlElement);
writer.WriteEndComplexContent();
}
示例2: ParseIdentifier
/// <summary>
/// Parse Identifier
/// </summary>
public static Hl7.Fhir.Model.Identifier ParseIdentifier(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Identifier existingInstance = null )
{
Hl7.Fhir.Model.Identifier result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Identifier();
string currentElementName = reader.CurrentElementName;
reader.EnterElement();
while (reader.HasMoreElements())
{
var atName = reader.CurrentElementName;
// Parse element extension
if( atName == "extension" )
{
result.Extension = new List<Hl7.Fhir.Model.Extension>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "extension") )
result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
reader.LeaveArray();
}
// Parse element _id
else if( atName == "_id" )
result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
// Parse element use
else if( atName == "use" )
result.UseElement = CodeParser.ParseCode<Hl7.Fhir.Model.Identifier.IdentifierUse>(reader, errors);
// Parse element label
else if( atName == "label" )
result.LabelElement = FhirStringParser.ParseFhirString(reader, errors);
// Parse element system
else if( atName == "system" )
result.SystemElement = FhirUriParser.ParseFhirUri(reader, errors);
// Parse element key
else if( atName == "key" )
result.KeyElement = FhirStringParser.ParseFhirString(reader, errors);
// Parse element period
else if( atName == "period" )
result.Period = PeriodParser.ParsePeriod(reader, errors);
// Parse element assigner
else if( atName == "assigner" )
result.Assigner = ResourceReferenceParser.ParseResourceReference(reader, errors);
else
{
errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
reader.SkipSubElementsFor(currentElementName);
result = null;
}
}
reader.LeaveElement();
return result;
}
示例3: SerializeFhirDecimal
public static void SerializeFhirDecimal(Hl7.Fhir.Model.FhirDecimal value, IFhirWriter writer, bool summary)
{
writer.WriteStartComplexContent();
// Serialize element value
if(value.Value != null)
writer.WritePrimitiveContents("value", value, XmlSerializationHint.Attribute);
// Serialize element _id
if(value.LocalIdElement != null)
writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
// Serialize element extension
if(value.Extension != null && !summary && value.Extension.Count > 0)
{
writer.WriteStartArrayElement("extension");
foreach(var item in value.Extension)
{
writer.WriteStartArrayMember("extension");
ExtensionSerializer.SerializeExtension(item, writer, summary);
writer.WriteEndArrayMember();
}
writer.WriteEndArrayElement();
}
writer.WriteEndComplexContent();
}
示例4: ComposeContains
private bool ComposeContains(Hl7.Fhir.Model.ValueSet.ValueSetComposeComponent compose, string value)
{
foreach(var conceptset in compose.Include)
{
if (conceptset.Code.Contains(value)) return true;
}
return false;
}
示例5: ParseInterestOfCare
/// <summary>
/// Parse InterestOfCare
/// </summary>
public static Hl7.Fhir.Model.InterestOfCare ParseInterestOfCare(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.InterestOfCare existingInstance = null )
{
Hl7.Fhir.Model.InterestOfCare result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.InterestOfCare();
string currentElementName = reader.CurrentElementName;
reader.EnterElement();
while (reader.HasMoreElements())
{
var atName = reader.CurrentElementName;
// Parse element extension
if( atName == "extension" )
{
result.Extension = new List<Hl7.Fhir.Model.Extension>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "extension") )
result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
reader.LeaveArray();
}
// Parse element language
else if( atName == "language" )
result.LanguageElement = CodeParser.ParseCode(reader, errors);
// Parse element text
else if( atName == "text" )
result.Text = NarrativeParser.ParseNarrative(reader, errors);
// Parse element contained
else if( atName == "contained" )
{
result.Contained = new List<Hl7.Fhir.Model.Resource>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "contained") )
result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors));
reader.LeaveArray();
}
// Parse element _id
else if( atName == "_id" )
result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
else
{
errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
reader.SkipSubElementsFor(currentElementName);
result = null;
}
}
reader.LeaveElement();
return result;
}
示例6: ParseQuantity
/// <summary>
/// Parse Quantity
/// </summary>
public static Hl7.Fhir.Model.Quantity ParseQuantity(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Quantity existingInstance = null )
{
Hl7.Fhir.Model.Quantity result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Quantity();
string currentElementName = reader.CurrentElementName;
reader.EnterElement();
while (reader.HasMoreElements())
{
var atName = reader.CurrentElementName;
// Parse element extension
if( atName == "extension" )
{
result.Extension = new List<Hl7.Fhir.Model.Extension>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "extension") )
result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
reader.LeaveArray();
}
// Parse element _id
else if( atName == "_id" )
result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
// Parse element value
else if( atName == "value" )
result.ValueElement = FhirDecimalParser.ParseFhirDecimal(reader, errors);
// Parse element comparator
else if( atName == "comparator" )
result.ComparatorElement = CodeParser.ParseCode<Hl7.Fhir.Model.Quantity.QuantityCompararator>(reader, errors);
// Parse element units
else if( atName == "units" )
result.UnitsElement = FhirStringParser.ParseFhirString(reader, errors);
// Parse element system
else if( atName == "system" )
result.SystemElement = FhirUriParser.ParseFhirUri(reader, errors);
// Parse element code
else if( atName == "code" )
result.CodeElement = CodeParser.ParseCode(reader, errors);
else
{
errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
reader.SkipSubElementsFor(currentElementName);
result = null;
}
}
reader.LeaveElement();
return result;
}
示例7: ParseChoice
/// <summary>
/// Parse Choice
/// </summary>
public static Hl7.Fhir.Model.Choice ParseChoice(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Choice existingInstance = null )
{
Hl7.Fhir.Model.Choice result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Choice();
string currentElementName = reader.CurrentElementName;
reader.EnterElement();
while (reader.HasMoreElements())
{
var atName = reader.CurrentElementName;
// Parse element extension
if( atName == "extension" )
{
result.Extension = new List<Hl7.Fhir.Model.Extension>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "extension") )
result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
reader.LeaveArray();
}
// Parse element _id
else if( atName == "_id" )
result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
// Parse element code
else if( atName == "code" )
result.CodeElement = CodeParser.ParseCode(reader, errors);
// Parse element option
else if( atName == "option" )
{
result.Option = new List<Hl7.Fhir.Model.Choice.ChoiceOptionComponent>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "option") )
result.Option.Add(ChoiceParser.ParseChoiceOptionComponent(reader, errors));
reader.LeaveArray();
}
// Parse element isOrdered
else if( atName == "isOrdered" )
result.IsOrderedElement = FhirBooleanParser.ParseFhirBoolean(reader, errors);
else
{
errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
reader.SkipSubElementsFor(currentElementName);
result = null;
}
}
reader.LeaveElement();
return result;
}
示例8: ParseCodeableConcept
/// <summary>
/// Parse CodeableConcept
/// </summary>
public static Hl7.Fhir.Model.CodeableConcept ParseCodeableConcept(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.CodeableConcept existingInstance = null )
{
Hl7.Fhir.Model.CodeableConcept result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.CodeableConcept();
string currentElementName = reader.CurrentElementName;
reader.EnterElement();
while (reader.HasMoreElements())
{
var atName = reader.CurrentElementName;
// Parse element extension
if( atName == "extension" )
{
result.Extension = new List<Hl7.Fhir.Model.Extension>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "extension") )
result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
reader.LeaveArray();
}
// Parse element _id
else if( atName == "_id" )
result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
// Parse element coding
else if( atName == "coding" )
{
result.Coding = new List<Hl7.Fhir.Model.Coding>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "coding") )
result.Coding.Add(CodingParser.ParseCoding(reader, errors));
reader.LeaveArray();
}
// Parse element text
else if( atName == "text" )
result.TextElement = FhirStringParser.ParseFhirString(reader, errors);
// Parse element primary
else if( atName == "primary" )
result.PrimaryElement = IdRefParser.ParseIdRef(reader, errors);
else
{
errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
reader.SkipSubElementsFor(currentElementName);
result = null;
}
}
reader.LeaveElement();
return result;
}
示例9: HarvestFixedValue
private void HarvestFixedValue(Hl7.Fhir.Model.Profile.ElementDefinitionComponent source, Element target)
{
target.FixedValue = null;
if (source.Fixed != null)
target.FixedValue = source.Fixed;
if (source.Pattern != null)
target.PatternValue = source.Pattern;
}
示例10: SerializeInterestOfCare
public static void SerializeInterestOfCare(Hl7.Fhir.Model.InterestOfCare value, IFhirWriter writer, bool summary)
{
writer.WriteStartRootObject("InterestOfCare");
writer.WriteStartComplexContent();
// Serialize element _id
if(value.LocalIdElement != null)
writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
// Serialize element extension
if(value.Extension != null && !summary && value.Extension.Count > 0)
{
writer.WriteStartArrayElement("extension");
foreach(var item in value.Extension)
{
writer.WriteStartArrayMember("extension");
ExtensionSerializer.SerializeExtension(item, writer, summary);
writer.WriteEndArrayMember();
}
writer.WriteEndArrayElement();
}
// Serialize element language
if(value.LanguageElement != null && !summary)
{
writer.WriteStartElement("language");
CodeSerializer.SerializeCode(value.LanguageElement, writer, summary);
writer.WriteEndElement();
}
// Serialize element text
if(value.Text != null && !summary)
{
writer.WriteStartElement("text");
NarrativeSerializer.SerializeNarrative(value.Text, writer, summary);
writer.WriteEndElement();
}
// Serialize element contained
if(value.Contained != null && !summary && value.Contained.Count > 0)
{
writer.WriteStartArrayElement("contained");
foreach(var item in value.Contained)
{
writer.WriteStartArrayMember("contained");
FhirSerializer.SerializeResource(item, writer, summary);
writer.WriteEndArrayMember();
}
writer.WriteEndArrayElement();
}
writer.WriteEndComplexContent();
writer.WriteEndRootObject();
}
示例11: ParseSchedule
/// <summary>
/// Parse Schedule
/// </summary>
public static Hl7.Fhir.Model.Schedule ParseSchedule(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Schedule existingInstance = null )
{
Hl7.Fhir.Model.Schedule result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Schedule();
string currentElementName = reader.CurrentElementName;
reader.EnterElement();
while (reader.HasMoreElements())
{
var atName = reader.CurrentElementName;
// Parse element extension
if( atName == "extension" )
{
result.Extension = new List<Hl7.Fhir.Model.Extension>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "extension") )
result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
reader.LeaveArray();
}
// Parse element _id
else if( atName == "_id" )
result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
// Parse element event
else if( atName == "event" )
{
result.Event = new List<Hl7.Fhir.Model.Period>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "event") )
result.Event.Add(PeriodParser.ParsePeriod(reader, errors));
reader.LeaveArray();
}
// Parse element repeat
else if( atName == "repeat" )
result.Repeat = ScheduleParser.ParseScheduleRepeatComponent(reader, errors);
else
{
errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
reader.SkipSubElementsFor(currentElementName);
result = null;
}
}
reader.LeaveElement();
return result;
}
示例12: SerializeChoice
public static void SerializeChoice(Hl7.Fhir.Model.Choice value, IFhirWriter writer, bool summary)
{
writer.WriteStartComplexContent();
// Serialize element _id
if(value.LocalIdElement != null)
writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
// Serialize element extension
if(value.Extension != null && !summary && value.Extension.Count > 0)
{
writer.WriteStartArrayElement("extension");
foreach(var item in value.Extension)
{
writer.WriteStartArrayMember("extension");
ExtensionSerializer.SerializeExtension(item, writer, summary);
writer.WriteEndArrayMember();
}
writer.WriteEndArrayElement();
}
// Serialize element code
if(value.CodeElement != null)
{
writer.WriteStartElement("code");
CodeSerializer.SerializeCode(value.CodeElement, writer, summary);
writer.WriteEndElement();
}
// Serialize element option
if(value.Option != null && value.Option.Count > 0)
{
writer.WriteStartArrayElement("option");
foreach(var item in value.Option)
{
writer.WriteStartArrayMember("option");
ChoiceSerializer.SerializeChoiceOptionComponent(item, writer, summary);
writer.WriteEndArrayMember();
}
writer.WriteEndArrayElement();
}
// Serialize element isOrdered
if(value.IsOrderedElement != null)
{
writer.WriteStartElement("isOrdered");
FhirBooleanSerializer.SerializeFhirBoolean(value.IsOrderedElement, writer, summary);
writer.WriteEndElement();
}
writer.WriteEndComplexContent();
}
示例13: ParseElementComponent
/// <summary>
/// Parse ElementComponent
/// </summary>
public static Hl7.Fhir.Model.Profile.ElementComponent ParseElementComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Profile.ElementComponent existingInstance = null )
{
Hl7.Fhir.Model.Profile.ElementComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Profile.ElementComponent();
string currentElementName = reader.CurrentElementName;
reader.EnterElement();
while (reader.HasMoreElements())
{
var atName = reader.CurrentElementName;
// Parse element extension
if( atName == "extension" )
{
result.Extension = new List<Hl7.Fhir.Model.Extension>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "extension") )
result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
reader.LeaveArray();
}
// Parse element _id
else if( atName == "_id" )
result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
// Parse element path
else if( atName == "path" )
result.PathElement = FhirStringParser.ParseFhirString(reader, errors);
// Parse element name
else if( atName == "name" )
result.NameElement = FhirStringParser.ParseFhirString(reader, errors);
// Parse element slicing
else if( atName == "slicing" )
result.Slicing = ProfileParser.ParseElementSlicingComponent(reader, errors);
// Parse element definition
else if( atName == "definition" )
result.Definition = ProfileParser.ParseElementDefinitionComponent(reader, errors);
else
{
errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
reader.SkipSubElementsFor(currentElementName);
result = null;
}
}
reader.LeaveElement();
return result;
}
示例14: SerializeCodeableConcept
public static void SerializeCodeableConcept(Hl7.Fhir.Model.CodeableConcept value, IFhirWriter writer, bool summary)
{
writer.WriteStartComplexContent();
// Serialize element _id
if(value.LocalIdElement != null)
writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
// Serialize element extension
if(value.Extension != null && !summary && value.Extension.Count > 0)
{
writer.WriteStartArrayElement("extension");
foreach(var item in value.Extension)
{
writer.WriteStartArrayMember("extension");
ExtensionSerializer.SerializeExtension(item, writer, summary);
writer.WriteEndArrayMember();
}
writer.WriteEndArrayElement();
}
// Serialize element coding
if(value.Coding != null && value.Coding.Count > 0)
{
writer.WriteStartArrayElement("coding");
foreach(var item in value.Coding)
{
writer.WriteStartArrayMember("coding");
CodingSerializer.SerializeCoding(item, writer, summary);
writer.WriteEndArrayMember();
}
writer.WriteEndArrayElement();
}
// Serialize element text
if(value.TextElement != null)
{
writer.WriteStartElement("text");
FhirStringSerializer.SerializeFhirString(value.TextElement, writer, summary);
writer.WriteEndElement();
}
// Serialize element primary
if(value.PrimaryElement != null)
{
writer.WriteStartElement("primary");
IdRefSerializer.SerializeIdRef(value.PrimaryElement, writer, summary);
writer.WriteEndElement();
}
writer.WriteEndComplexContent();
}
示例15: HarvestConstraints
private void HarvestConstraints(Hl7.Fhir.Model.Profile.ElementDefinitionComponent source, Element target)
{
if (source.Constraint == null)
return;
foreach (Hl7.Fhir.Model.Profile.ElementDefinitionConstraintComponent c in source.Constraint)
{
Constraint constraint = new Constraint();
constraint.Name = c.Name ?? c.Key;
constraint.XPath = c.Xpath;
constraint.HumanReadable = c.Human;
target.Constraints.Add(constraint);
}
}