private void PopulateEncounter(OpenHR001Encounter encounter) { ClearEncounter(); if (encounter.component != null) { foreach (string headingName in encounter.component.Select(t => t.heading.displayName).Distinct()) { DataGridViewRow row = dataGridView1.CloneDataGridViewRow(FontStyle.Bold, Color.AliceBlue); row.SetValues(headingName); _headerRows.Add(row); dataGridView1.Rows.Add(row); OpenHR001Component[] components = encounter.component.Where(t => t.heading.displayName == headingName).ToArray(); foreach (OpenHR001Component component in components) { OpenHR001HealthDomainEvent healthEvent = _patient.HealthDomainEvents.FirstOrDefault(t => new Guid(t.id) == new Guid(component.@event)); string eventType = healthEvent.eventType.GetEventTypeDescription(); string effectiveTime = healthEvent.effectiveTime.GetFormattedDate(); string displayTerm = healthEvent.displayTerm; string code = healthEvent.code.WhenNotNull(t => t.code); string description = healthEvent.GetAssociatedTextWithValue().Trim(); dataGridView1.Rows.Add(eventType, effectiveTime, code, displayTerm, description); } } } }
public static string GetObservationValueText(this OpenHR001HealthDomainEvent healthEvent) { string result = string.Empty; OpenHR001Observation observation = (healthEvent.Item as OpenHR001Observation); if (observation != null) { if (observation.value != null) { if (observation.value.Item is OpenHR001NumericValue) { OpenHR001NumericValue observationValue = observation.value.Item as OpenHR001NumericValue; result = observationValue.value.ToString() + " " + observationValue.units; } else if (observation.value.Item is OpenHR001TextValue) { OpenHR001TextValue textValue = observation.value.Item as OpenHR001TextValue; result = textValue.value; } } } return(result); }
public static string[] GetAssociatedText(this OpenHR001HealthDomainEvent healthEvent) { if (healthEvent.associatedText == null) { return new string[] { } } ; return(healthEvent.associatedText.Select(t => t.value).ToArray()); }
public static string GetAssociatedTextWithValue(this OpenHR001HealthDomainEvent healthEvent) { string value = healthEvent.GetObservationValueText(); string[] associatedText = healthEvent.GetAssociatedText(); List <string> descriptionText = new List <string>(); if (!string.IsNullOrEmpty(value)) { descriptionText.Add(value); } descriptionText.AddRange(associatedText); return(string.Join(" | ", descriptionText)); }
private void PopulateMedicationGroup(string groupDescription, OpenHR001HealthDomainEvent[] healthEvents) { DataGridViewRow headerRow = dataGridView.CloneDataGridViewRow(FontStyle.Bold, Color.AliceBlue); _headerRows.Add(headerRow); headerRow.SetValues(groupDescription); dataGridView.Rows.Add(headerRow); if (healthEvents.Length == 0) { DataGridViewRow row = dataGridView.CloneDataGridViewRow(FontStyle.Italic); row.SetValues("No medication"); dataGridView.Rows.Add(row); } else { var problems = healthEvents .Select(t => new { Medication = t.Item as OpenHR001Medication, Event = _patient.HealthDomainEvents.FirstOrDefault(s => s.id == t.id) }); foreach (var problem in problems.OrderByDescending(t => t.Event.effectiveTime.value)) { OpenHR001HealthDomainEvent healthEvent = problem.Event; string eventType = problem.Medication.drugStatus.GetDescription(); string effectiveTime = healthEvent.effectiveTime.GetFormattedDate(); string displayTerm = healthEvent.displayTerm; string code = healthEvent.code.WhenNotNull(t => t.code); string text = healthEvent.GetAssociatedTextWithValue(); DataGridViewRow row = dataGridView.CloneDataGridViewRow(); row.SetValues(eventType, effectiveTime, code, displayTerm, text); dataGridView.Rows.Add(row); } } }
private void PopulateConditionGroup(string description, OpenHR001Problem[] problems2) { DataGridViewRow headerRow = dataGridView.CloneDataGridViewRow(FontStyle.Bold, Color.AliceBlue); _headerRows.Add(headerRow); headerRow.SetValues(description); dataGridView.Rows.Add(headerRow); if (problems2.Length == 0) { DataGridViewRow row = dataGridView.CloneDataGridViewRow(FontStyle.Italic); row.SetValues("No conditions"); dataGridView.Rows.Add(row); } else { var problems = problems2 .Select(t => new { Problem = t, Event = _patient.HealthDomainEvents.FirstOrDefault(s => s.id == t.id) }); foreach (var problem in problems.OrderByDescending(t => t.Event.effectiveTime.value)) { OpenHR001HealthDomainEvent healthEvent = problem.Event; string eventType = problem.Problem.significance.GetProblemSignficance(); string effectiveTime = healthEvent.effectiveTime.GetFormattedDate(); string displayTerm = healthEvent.displayTerm; string code = healthEvent.code.WhenNotNull(t => t.code); string text = healthEvent.GetAssociatedTextWithValue(); DataGridViewRow row = dataGridView.CloneDataGridViewRow(); row.SetValues(eventType, effectiveTime, code, displayTerm, text); dataGridView.Rows.Add(row); } } }