diff --git a/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/ImplementerReportLogic.cs b/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/ImplementerReportLogic.cs index f4745c1..9995140 100644 --- a/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/ImplementerReportLogic.cs +++ b/Polyclinic/PolyclinicBusinessLogic/BusinessLogics/ImplementerReportLogic.cs @@ -23,7 +23,31 @@ namespace PolyclinicBusinessLogic.BusinessLogics public List GetDiagnoses() { - throw new NotImplementedException(); + var diagnoses = _diagnoseStorage.GetFullList(); + var courses = _courseStorage.GetFullList(); + var symptomes = _symptomStorage.GetFullList(); + + var result = new List(); + + foreach (var diagnose in diagnoses) + { + var diagnoseCourses = courses.Where(x => x.CourseDiagnoses.ContainsKey(diagnose.Id)).ToList(); + var diagnoseSymptomes = symptomes.Where(x => x.SymptomDiagnoses.ContainsKey(diagnose.Id)).ToList(); + if (diagnoseCourses.Count > 0 && diagnoseSymptomes.Count > 0) + { + var dianoseReportModel = new ReportDiagnoseWithCoursesAndSymptomesViewModel { + DiagnoseId = diagnose.Id, + DiagnoseName = diagnose.Name, + DiagnoseComment = diagnose.Comment, + DiagnoseDateStart = diagnose.DateStartDiagnose, + DiagnoseDateStop = diagnose.DateStopDiagnose, + Courses = diagnoseCourses.Select(x => (x.DaysCount, x.PillsPerDay)).ToList(), + Symptomes = diagnoseSymptomes.Select(x => x.Name).ToList() + }; + result.Add(dianoseReportModel); + } + } + return result; } public List GetMedicamentsByDiagnoses(ReportBindingModel model)