Beispiel #1
0
        internal static Patient ToFhirInternal(PersonalImage personalImage, Patient patient)
        {
            using (var stream = personalImage.ReadImage())
            {
                var bytes = new byte[stream.Length];
                stream.Read(bytes, 0, (int)stream.Length);

                if (!bytes.IsNullOrEmpty())
                {
                    patient.Photo.Add(new Attachment
                    {
                        Data = bytes
                    });
                }
            }

            return(patient);
        }
Beispiel #2
0
        private async Task <ImageSource> GetImageAsync()
        {
            var query = new ThingQuery(PersonalImage.TypeId)
            {
                View = { Sections = ThingSections.Xml | ThingSections.BlobPayload | ThingSections.Signature }
            };

            var things = await _thingClient.GetThingsAsync(_recordId, query);

            IThing firstThing = things?.FirstOrDefault();

            if (firstThing == null)
            {
                return(null);
            }
            PersonalImage image = (PersonalImage)firstThing;

            return(ImageSource.FromStream(() => image.ReadImage()));
        }