示例#1
0
        public bool GetInfo(Patient_FHIR pf)
        {
            pf.FHIR_Demographics = FHIR_SearchByIdentifier(ref pf);
            bool found = false;

            if (pf.FHIR_Demographics != null)
            {
                pf.FHIR_Family    = GetFhirFamily(pf.FHIR_Demographics, pf.Family);
                pf.FHIR_Given     = GetFhirGiven(pf.FHIR_Demographics, pf.Given);
                pf.FHIR_birthDate = GetFhirDateOfBirth(pf.FHIR_Demographics);
                pf.FHIR_Gender    = pf.FHIR_Demographics.Gender.ToString();
                pf.FullAddress    = GetAddress(pf.FHIR_Demographics);
                pf.FullTelecom    = GetTelecom(pf.FHIR_Demographics);
                pf.FullEmail      = GetEmail(pf.FHIR_Demographics);
                //pf.Conditions=FHIR_SearchConditions(pf.FHIR_Demographics.Id);
                //pf.Medications=FHIR_SearchMedications(pf.FHIR_Demographics.Id);
                //pf.Allergies=FHIR_SearchAllergies(pf.FHIR_Demographics.Id);
                //pf.Immunizations=FHIR_SearchImmunizations(pf.FHIR_Demographics.Id);
                pf.City              = GetCity(pf.FHIR_Demographics);
                pf.Race              = GetRace(pf.FHIR_Demographics);
                pf.Ethnicity         = GetEthnicity(pf.FHIR_Demographics);
                pf.FHIRServerAddress = FHIR_EndPoint_PatientInfo;
                if (pf.FHIR_Demographics.Address.Count > 0)
                {
                    pf.PractitionersNear = FHIR_SearchPractitioners(pf.FHIR_Demographics.Address[0].City);
                }
                ;
                found = true;
            }
            return(found);
        }
示例#2
0
        public Hl7.Fhir.Model.Patient FHIR_SearchByIdentifier(ref Patient_FHIR pf)
        {
            string Identifier = pf.Identifier;

            Hl7.Fhir.Model.Patient patient = new  Hl7.Fhir.Model.Patient();
            var client = new Hl7.Fhir.Rest.FhirClient(FHIR_EndPoint_PatientInfo);

            client.PreferredFormat = ResourceFormat.Json;
            Bundle bu = client.Search <Hl7.Fhir.Model.Patient> (new string[]
                                                                { "identifier=" + Identifier,
                                                                  "_revinclude=AllergyIntolerance:patient",
                                                                  "_revinclude=Condition:subject",
                                                                  "_revinclude=MedicationRequest:subject",
                                                                  "_revinclude=Immunization:patient",
                                                                  "_revinclude=CarePlan:subject" });

            foreach (Bundle.EntryComponent entry in bu.Entry)
            {
                string ResourceType = entry.Resource.TypeName;
                if (ResourceType == "Patient")
                {
                    patient = (Patient)entry.Resource;
                }
                else if (ResourceType == "AllergyIntolerance")
                {
                    var allergy = (AllergyIntolerance)entry.Resource;
                    pf.Allergies.Add(allergy);
                }
                else if (ResourceType == "Condition")
                {
                    var condition = (Condition)entry.Resource;
                    pf.Conditions.Add(condition);
                }
                else if (ResourceType == "MedicationRequest")
                {
                    var medication = (MedicationRequest)entry.Resource;
                    pf.Medications.Add(medication);
                }
                else if (ResourceType == "Immunization")
                {
                    var immunization = (Immunization)entry.Resource;
                    pf.Immunizations.Add(immunization);
                }
                else if (ResourceType == "CarePlan")
                {
                    var careplan = (CarePlan)entry.Resource;
                    pf.CarePlans.Add(careplan);
                }
            }
            return(patient);
        }