Пример #1
1
        public Bundle SetBundleResult(OrderResponse orderResp, DiagnosticReport diagReport, Observation observ, Practitioner pract)
        {
            Bundle bundle = new Bundle();
            bundle.Meta = new Meta() { Profile = new string[] { MetaBundleResult } };
            bundle.Entry = new List<Bundle.BundleEntryComponent>();
            if (orderResp != null)
            {
                Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent
                {
                    Resource = orderResp,
                    Transaction = new Bundle.BundleEntryTransactionComponent { Method = Bundle.HTTPVerb.POST, Url = "OrderResponse" }
                };
                bundle.Entry.Add(component);
            }
            if (diagReport != null)
            {
                Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent
                {
                    Resource = diagReport,
                    Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "DiagnosticReport" }
                };
                bundle.Entry.Add(component);
            }
            if (observ != null)
            {
                Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent()
                {
                    Resource = observ,
                    Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Observation" }
                };
                bundle.Entry.Add(component);
            }
            //необязательный параметр
            if (pract != null)
            {
                Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent
                {
                    Resource = pract,
                    Transaction = new Bundle.BundleEntryTransactionComponent { Method = Bundle.HTTPVerb.POST, Url = "Practitioner" }
                };
                bundle.Entry.Add(component);
            }

            return bundle;
        }
Пример #2
0
        /// <summary>
        /// Get Practitioner by ID
        /// </summary>
        /// <param name="practitionerId"> ID of practitioner to be fetched </param>
        /// <returns> Practitioner </returns>
        public static async Task <Models.Practitioner> GetPractitioner(string practitionerId)
        {
            Models.Practitioner         practitioner     = null;
            Hl7.Fhir.Model.Practitioner fhirPractitioner = null;

            try
            {
                // limit to 1 to avoid huge response Bundle
                var PractitionerQuery = new SearchParams()
                                        .Where("identifier=http://hl7.org/fhir/sid/us-npi|" + practitionerId)
                                        .LimitTo(1);

                Bundle PractitionerResult = await Client.SearchAsync <Hl7.Fhir.Model.Practitioner>(PractitionerQuery);

                if (PractitionerResult.Entry.Count > 0)
                {
                    // Map the FHIR Practitioner object to App's Practitioner object
                    fhirPractitioner = (Hl7.Fhir.Model.Practitioner)PractitionerResult.Entry[0].Resource;
                    PractitionerMapper mapper = new PractitionerMapper();
                    practitioner = mapper.Map(fhirPractitioner);
                }
            }
            catch (FhirOperationException FhirException)
            {
                System.Diagnostics.Debug.WriteLine("Fhir error message: " + FhirException.Message);
            }
            catch (Exception GeneralException)
            {
                System.Diagnostics.Debug.WriteLine("General error message: " + GeneralException.Message);
            }
            return(practitioner);
        }
        public override ErrorList Validate()
        {
            var result = new ErrorList();

            result.AddRange(base.Validate());

            if (Identifier != null)
            {
                Identifier.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (StatusElement != null)
            {
                result.AddRange(StatusElement.Validate());
            }
            if (Patient != null)
            {
                result.AddRange(Patient.Validate());
            }
            if (Practitioner != null)
            {
                result.AddRange(Practitioner.Validate());
            }
            if (Encounter != null)
            {
                result.AddRange(Encounter.Validate());
            }
            if (Prescription != null)
            {
                result.AddRange(Prescription.Validate());
            }
            if (WasNotGivenElement != null)
            {
                result.AddRange(WasNotGivenElement.Validate());
            }
            if (ReasonNotGiven != null)
            {
                ReasonNotGiven.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (WhenGiven != null)
            {
                result.AddRange(WhenGiven.Validate());
            }
            if (Medication != null)
            {
                result.AddRange(Medication.Validate());
            }
            if (AdministrationDevice != null)
            {
                AdministrationDevice.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Dosage != null)
            {
                Dosage.ForEach(elem => result.AddRange(elem.Validate()));
            }

            return(result);
        }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as MedicationAdministration;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.MedicationAdministrationStatus>)StatusElement.DeepCopy();
                }
                if (Patient != null)
                {
                    dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy();
                }
                if (Practitioner != null)
                {
                    dest.Practitioner = (Hl7.Fhir.Model.ResourceReference)Practitioner.DeepCopy();
                }
                if (Encounter != null)
                {
                    dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy();
                }
                if (Prescription != null)
                {
                    dest.Prescription = (Hl7.Fhir.Model.ResourceReference)Prescription.DeepCopy();
                }
                if (WasNotGivenElement != null)
                {
                    dest.WasNotGivenElement = (Hl7.Fhir.Model.FhirBoolean)WasNotGivenElement.DeepCopy();
                }
                if (ReasonNotGiven != null)
                {
                    dest.ReasonNotGiven = new List <Hl7.Fhir.Model.CodeableConcept>(ReasonNotGiven.DeepCopy());
                }
                if (ReasonGiven != null)
                {
                    dest.ReasonGiven = new List <Hl7.Fhir.Model.CodeableConcept>(ReasonGiven.DeepCopy());
                }
                if (EffectiveTime != null)
                {
                    dest.EffectiveTime = (Hl7.Fhir.Model.Element)EffectiveTime.DeepCopy();
                }
                if (Medication != null)
                {
                    dest.Medication = (Hl7.Fhir.Model.Element)Medication.DeepCopy();
                }
                if (Device != null)
                {
                    dest.Device = new List <Hl7.Fhir.Model.ResourceReference>(Device.DeepCopy());
                }
                if (NoteElement != null)
                {
                    dest.NoteElement = (Hl7.Fhir.Model.FhirString)NoteElement.DeepCopy();
                }
                if (Dosage != null)
                {
                    dest.Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent)Dosage.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
        /// <summary>
        /// Parse Practitioner
        /// </summary>
        public static Hl7.Fhir.Model.Practitioner ParsePractitioner(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Practitioner existingInstance = null)
        {
            Hl7.Fhir.Model.Practitioner result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Practitioner();
            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)));
                }

                // Parse element identifier
                else if (atName == "identifier")
                {
                    result.Identifier = new List <Hl7.Fhir.Model.Identifier>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "identifier"))
                    {
                        result.Identifier.Add(IdentifierParser.ParseIdentifier(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element name
                else if (atName == "name")
                {
                    result.Name = HumanNameParser.ParseHumanName(reader, errors);
                }

                // Parse element telecom
                else if (atName == "telecom")
                {
                    result.Telecom = new List <Hl7.Fhir.Model.Contact>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "telecom"))
                    {
                        result.Telecom.Add(ContactParser.ParseContact(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element address
                else if (atName == "address")
                {
                    result.Address = AddressParser.ParseAddress(reader, errors);
                }

                // Parse element gender
                else if (atName == "gender")
                {
                    result.Gender = CodeableConceptParser.ParseCodeableConcept(reader, errors);
                }

                // Parse element birthDate
                else if (atName == "birthDate")
                {
                    result.BirthDateElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors);
                }

                // Parse element photo
                else if (atName == "photo")
                {
                    result.Photo = new List <Hl7.Fhir.Model.Attachment>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "photo"))
                    {
                        result.Photo.Add(AttachmentParser.ParseAttachment(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element organization
                else if (atName == "organization")
                {
                    result.Organization = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element role
                else if (atName == "role")
                {
                    result.Role = new List <Hl7.Fhir.Model.CodeableConcept>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "role"))
                    {
                        result.Role.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element specialty
                else if (atName == "specialty")
                {
                    result.Specialty = new List <Hl7.Fhir.Model.CodeableConcept>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "specialty"))
                    {
                        result.Specialty.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element period
                else if (atName == "period")
                {
                    result.Period = PeriodParser.ParsePeriod(reader, errors);
                }

                // Parse element qualification
                else if (atName == "qualification")
                {
                    result.Qualification = new List <Hl7.Fhir.Model.Practitioner.PractitionerQualificationComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "qualification"))
                    {
                        result.Qualification.Add(PractitionerParser.ParsePractitionerQualificationComponent(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element communication
                else if (atName == "communication")
                {
                    result.Communication = new List <Hl7.Fhir.Model.CodeableConcept>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "communication"))
                    {
                        result.Communication.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors));
                    }

                    reader.LeaveArray();
                }

                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
0
        private static ItemTypes.PersonItem ToPerson(this Hl7.Fhir.Model.Practitioner fhirPractitioner)
        {
            if (!fhirPractitioner.Name.Any())
            {
                throw new NotSupportedException($"{fhirPractitioner} needs to have a {nameof(HumanName)}");
            }

            var practitionerName = fhirPractitioner.Name.First(); // Let's consider just the first item

            //name
            var person = new ItemTypes.PersonItem()
            {
                PersonType         = HealthVaultThingPersonTypesCodes.Provider,
                Name               = practitionerName.ToHealthVault(),
                ContactInformation = new ContactInfo()
            };

            //address
            if (!fhirPractitioner.Address.IsNullOrEmpty())
            {
                foreach (var address in fhirPractitioner.Address)
                {
                    ItemTypes.Address hvAddress = address.ToHealthVault();

                    if (hvAddress != null)
                    {
                        person.ContactInformation.Address.Add(hvAddress);
                    }
                }
            }

            //telecom
            if (!fhirPractitioner.Telecom.IsNullOrEmpty())
            {
                foreach (var contactPoint in fhirPractitioner.Telecom)
                {
                    switch (contactPoint.System)
                    {
                    case ContactPoint.ContactPointSystem.Email:
                        person.ContactInformation.Email.Add(contactPoint.ToHealthVault <Email>());
                        break;

                    case ContactPoint.ContactPointSystem.Phone:
                        person.ContactInformation.Phone.Add(contactPoint.ToHealthVault <Phone>());
                        break;
                    }
                }
            }

            //qualification
            if (!fhirPractitioner.Qualification.IsNullOrEmpty())
            {
                var firstQualification = fhirPractitioner.Qualification.First(); //Let's take just the first one
                if (!string.IsNullOrEmpty(firstQualification.Code.Text))
                {
                    person.ProfessionalTraining = firstQualification.Code.Text;
                }
                else if (!firstQualification.Code.Coding.IsNullOrEmpty())
                {
                    person.ProfessionalTraining = firstQualification.Code.Coding.First().Display;
                }
            }

            person.Organization = fhirPractitioner.GetStringExtension(HealthVaultExtensions.Organization);

            if (fhirPractitioner.Identifier.Any())
            {
                person.PersonId = fhirPractitioner.Identifier.First().Value;
            }

            return(person);
        }
Пример #7
0
 public static ItemTypes.PersonItem ToHealthVault(this Hl7.Fhir.Model.Practitioner fhirPractitioner)
 {
     return(fhirPractitioner.ToPerson());
 }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as PractitionerRole;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (ActiveElement != null)
            {
                dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopy();
            }
            if (Period != null)
            {
                dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy();
            }
            if (Practitioner != null)
            {
                dest.Practitioner = (Hl7.Fhir.Model.ResourceReference)Practitioner.DeepCopy();
            }
            if (Organization != null)
            {
                dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopy();
            }
            if (Code != null)
            {
                dest.Code = new List <Hl7.Fhir.Model.CodeableConcept>(Code.DeepCopy());
            }
            if (Specialty != null)
            {
                dest.Specialty = new List <Hl7.Fhir.Model.CodeableConcept>(Specialty.DeepCopy());
            }
            if (Location != null)
            {
                dest.Location = new List <Hl7.Fhir.Model.ResourceReference>(Location.DeepCopy());
            }
            if (HealthcareService != null)
            {
                dest.HealthcareService = new List <Hl7.Fhir.Model.ResourceReference>(HealthcareService.DeepCopy());
            }
            if (Telecom != null)
            {
                dest.Telecom = new List <Hl7.Fhir.Model.ContactPoint>(Telecom.DeepCopy());
            }
            if (AvailableTime != null)
            {
                dest.AvailableTime = new List <Hl7.Fhir.Model.PractitionerRole.AvailableTimeComponent>(AvailableTime.DeepCopy());
            }
            if (NotAvailable != null)
            {
                dest.NotAvailable = new List <Hl7.Fhir.Model.PractitionerRole.NotAvailableComponent>(NotAvailable.DeepCopy());
            }
            if (AvailabilityExceptionsElement != null)
            {
                dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)AvailabilityExceptionsElement.DeepCopy();
            }
            if (Endpoint != null)
            {
                dest.Endpoint = new List <Hl7.Fhir.Model.ResourceReference>(Endpoint.DeepCopy());
            }
            return(dest);
        }
Пример #9
0
        internal static Practitioner CreatePractitionerResource()
        {
            // Create new Practitioner resource
            Practitioner res = new Practitioner();

            // Allocate the logical resource Id - this is what the resource is referenced by
            res.Id = "41fe704c-18e5-11e5-b60b-1697f925ec7b";

            // Add the profile for this resource (from the FGM DMS)
            Meta metadata = new Meta();
            metadata.Profile = new string[] { "urn:fhir.nhs.uk:profile/NHS-FGM-Practitioner" };
            res.Meta = metadata;

            // Add the business idetifier for the SDS User Id
            res.Identifier = new List<Identifier>();
            Identifier id1 = new Identifier("urn:fhir.nhs.uk/id/SDSUserID", "G12345678");
            id1.Use = Identifier.IdentifierUse.Official;
            res.Identifier.Add(id1);

            // Add the business idetifier for the SDS Role Profile Id
            Identifier id2 = new Identifier("urn:fhir.nhs.uk/id/SDSRoleProfileID", "PT1234");
            id2.Use = Identifier.IdentifierUse.Official;
            res.Identifier.Add(id2);

            // Add the name of the practitioner
            res.Name = HumanName.ForFamily("Wood").WithGiven("Town");
            res.Name.Use = HumanName.NameUse.Official;
            res.Name.Prefix = new String[] { "Dr." };

            // Add details about the practitioner's role
            Practitioner.PractitionerPractitionerRoleComponent pr = new Practitioner.PractitionerPractitionerRoleComponent();
            Coding code = new Coding("urn:fhir.nhs.uk:vs/SDSJobRoleName", "R0090");
            code.Display = "Hospital Practitioner";

            pr.Role = new CodeableConcept();
            pr.Role.Coding = new List<Coding>();
            pr.Role.Coding.Add(code);

            // Add details about the practitioner's managing organisation
            pr.ManagingOrganization =
                new ResourceReference()
                { Reference = "Organization/41fe704c-18e5-11e5-b60b-1697f925ec7b" };

            res.PractitionerRole.Add(pr);
            return res;
        }
        public static void SerializePractitioner(Hl7.Fhir.Model.Practitioner value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Practitioner");
            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();
            }

            // Serialize element identifier
            if (value.Identifier != null && value.Identifier.Count > 0)
            {
                writer.WriteStartArrayElement("identifier");
                foreach (var item in value.Identifier)
                {
                    writer.WriteStartArrayMember("identifier");
                    IdentifierSerializer.SerializeIdentifier(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element name
            if (value.Name != null)
            {
                writer.WriteStartElement("name");
                HumanNameSerializer.SerializeHumanName(value.Name, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element telecom
            if (value.Telecom != null && value.Telecom.Count > 0)
            {
                writer.WriteStartArrayElement("telecom");
                foreach (var item in value.Telecom)
                {
                    writer.WriteStartArrayMember("telecom");
                    ContactSerializer.SerializeContact(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element address
            if (value.Address != null)
            {
                writer.WriteStartElement("address");
                AddressSerializer.SerializeAddress(value.Address, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element gender
            if (value.Gender != null)
            {
                writer.WriteStartElement("gender");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Gender, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element birthDate
            if (value.BirthDateElement != null)
            {
                writer.WriteStartElement("birthDate");
                FhirDateTimeSerializer.SerializeFhirDateTime(value.BirthDateElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element photo
            if (value.Photo != null && !summary && value.Photo.Count > 0)
            {
                writer.WriteStartArrayElement("photo");
                foreach (var item in value.Photo)
                {
                    writer.WriteStartArrayMember("photo");
                    AttachmentSerializer.SerializeAttachment(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element organization
            if (value.Organization != null)
            {
                writer.WriteStartElement("organization");
                ResourceReferenceSerializer.SerializeResourceReference(value.Organization, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element role
            if (value.Role != null && value.Role.Count > 0)
            {
                writer.WriteStartArrayElement("role");
                foreach (var item in value.Role)
                {
                    writer.WriteStartArrayMember("role");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element specialty
            if (value.Specialty != null && value.Specialty.Count > 0)
            {
                writer.WriteStartArrayElement("specialty");
                foreach (var item in value.Specialty)
                {
                    writer.WriteStartArrayMember("specialty");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element period
            if (value.Period != null)
            {
                writer.WriteStartElement("period");
                PeriodSerializer.SerializePeriod(value.Period, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element qualification
            if (value.Qualification != null && !summary && value.Qualification.Count > 0)
            {
                writer.WriteStartArrayElement("qualification");
                foreach (var item in value.Qualification)
                {
                    writer.WriteStartArrayMember("qualification");
                    PractitionerSerializer.SerializePractitionerQualificationComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element communication
            if (value.Communication != null && !summary && value.Communication.Count > 0)
            {
                writer.WriteStartArrayElement("communication");
                foreach (var item in value.Communication)
                {
                    writer.WriteStartArrayMember("communication");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #11
0
        public Bundle SetBundleOrder(Order order, DiagnosticOrder diagnosticOrder,
                                     Specimen specimen, Encounter encounter, Condition condition,
                                     Observation observation, Practitioner practitioner, Coverage coverage, Patient patient)
        {
            Bundle bundle = new Bundle();
            bundle.Meta = new Meta() { Profile = new string[] { MetaBundleOrder } };
            bundle.Entry = new List<Bundle.BundleEntryComponent>();

            if (order != null)
            {
                Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent
                {
                    Resource = order,
                    Transaction = new Bundle.BundleEntryTransactionComponent { Method = Bundle.HTTPVerb.POST, Url = "Order" }
                };
                bundle.Entry.Add(component);
            }

            if (diagnosticOrder != null)
            {
                Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent
                {
                    Resource = diagnosticOrder,
                    Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "DiagnosticOrder" }
                };
                bundle.Entry.Add(component);
            }

            if (specimen != null)
            {
                Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent
                {
                    Resource = specimen,
                    Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Specimen" }
                };
                bundle.Entry.Add(component);
            }

            if (encounter != null)
            {
                Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent
                {
                    Resource = encounter,
                    Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Encounter" }
                };
                bundle.Entry.Add(component);
            }

            if (condition != null)
            {
                Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent
                {
                    Resource = condition,
                    Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Condition" }
                };
                bundle.Entry.Add(component);
            }

            if (observation != null)
            {
                Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent
                {
                    Resource = observation,
                    Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Observation" }
                };
                bundle.Entry.Add(component);
            }

            if (practitioner != null)
            {
                Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent
                {
                    Resource = practitioner,
                    Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Practitioner" }
                };
                bundle.Entry.Add(component);
            }
            if (coverage != null)
            {
                Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent
                {
                    Resource = coverage,
                    Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Coverage" }
                };
                bundle.Entry.Add(component);
            }
            if (patient != null)
            {
                Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent
                {
                    Resource = patient,
                    Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Patient" }
                };
                bundle.Entry.Add(component);
            }
            return bundle;
        }