Beispiel #1
0
        public async Task Handle(ObservationCreated message)
        {
            var obj = this.ParseMessage(message);

            var nhsNumber = obj.Subject.Identifier.Value;
            var patient   = await this.Patients.GetOne(nhsNumber);

            if (patient == null)
            {
                return;
            }

            var value    = (SimpleQuantity)obj.Value;
            var dateTime = (FhirDateTime)obj.Effective;

            var clinicalNote = new ClinicalNote
            {
                ClinicalNotesType = "Observation",
                Notes             = $"{obj.Code.Coding[0].Display}. Value: {value.Value}. Unit: {value.Unit}.",
                PatientId         = nhsNumber,
                Author            = obj.Performer[0].Display,
                DateCreated       = dateTime.ToDateTime() ?? DateTime.UtcNow,
                Source            = "INR",
                SourceId          = obj.Identifier[0].Value
            };

            await this.ClinicalNotes.AddOrUpdate(clinicalNote);
        }
Beispiel #2
0
        public async Task Handle(ObservationCreated message)
        {
            var obj = this.ParseMessage(message);

            var value = (SimpleQuantity)obj.Value;

            var notification = new Notification
            {
                Ods         = message.Destination,
                System      = message.System,
                NhsNumber   = obj.Subject.Identifier.Value,
                DateCreated = DateTime.UtcNow,
                Type        = obj.TypeName,
                Summary     = $"{obj.Code.Coding[0].Display}.",
                Details     = $"Value: {value.Value}. Unit: {value.Unit}.",
                Json        = this.ToString()
            };

            await this.Notifications.AddOrUpdate(notification);

            await this.Hub.Clients.Group(message.Destination?.ToLowerInvariant()).SendAsync("notification", notification);
        }