Exemplo n.º 1
0
        /// <summary>
        /// Get a collection of observation given patient id
        /// </summary>
        /// <param name="id"> Patient ID </param>
        /// <returns> A collection of Observation </returns>
        public async Task <IEnumerable <Observation> > GetObservationById(string id)
        {
            List <Observation> observations = (List <Observation>) await ObservationRepository.GetByPatientAndBloodPressure(id);

            observations.AddRange(await ObservationRepository.GetByPatientAndTotalCholesterol(id));
            observations.AddRange(await ObservationRepository.GetByPatientAndTobacco(id));
            return(observations);
        }
Exemplo n.º 2
0
        public async void GetObservationsAsync()
        {
            if (monitoringPressure)
            {
                var retrievedObservations = await observationRepository.GetByPatientAndBloodPressure(PatientId);

                foreach (var o in retrievedObservations)
                {
                    if (Observations.Where(observation => observation.Id == o.Id).ToList().Count() == 0)
                    {
                        Observations.Add(o);
                    }
                }
            }
            if (monitoringCholesterol)
            {
                var retrievedObservations = await observationRepository.GetByPatientAndTotalCholesterol(PatientId);

                foreach (var o in retrievedObservations)
                {
                    if (Observations.Where(observation => observation.Id == o.Id).ToList().Count() == 0)
                    {
                        Observations.Add(o);
                    }
                }
            }
            if (monitoringTobacco)
            {
                var retrievedObservations = await observationRepository.GetByPatientAndTobacco(PatientId);

                foreach (var o in retrievedObservations)
                {
                    if (Observations.Where(observation => observation.Id == o.Id).ToList().Count() == 0)
                    {
                        Observations.Add(o);
                    }
                }
            }
            foreach (var o in Observations)
            {
                foreach (var observer in Observers)
                {
                    observer.OnNext(o);
                }
            }
        }