Реализовал вторую функцию для отчета исполнителя

This commit is contained in:
Никита Потапов 2024-05-02 02:19:56 +04:00
parent 68329a7444
commit c3a43503f8

View File

@ -23,7 +23,31 @@ namespace PolyclinicBusinessLogic.BusinessLogics
public List<ReportDiagnoseWithCoursesAndSymptomesViewModel> GetDiagnoses() public List<ReportDiagnoseWithCoursesAndSymptomesViewModel> GetDiagnoses()
{ {
throw new NotImplementedException(); var diagnoses = _diagnoseStorage.GetFullList();
var courses = _courseStorage.GetFullList();
var symptomes = _symptomStorage.GetFullList();
var result = new List<ReportDiagnoseWithCoursesAndSymptomesViewModel>();
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<ReportMedicamentsByDiagnoseViewModel> GetMedicamentsByDiagnoses(ReportBindingModel model) public List<ReportMedicamentsByDiagnoseViewModel> GetMedicamentsByDiagnoses(ReportBindingModel model)