diff --git a/Hospital/HospitalBusinessLogic/BusinessLogics/DoctorReportLogic.cs b/Hospital/HospitalBusinessLogic/BusinessLogics/DoctorReportLogic.cs index 755f26d..b0135e0 100644 --- a/Hospital/HospitalBusinessLogic/BusinessLogics/DoctorReportLogic.cs +++ b/Hospital/HospitalBusinessLogic/BusinessLogics/DoctorReportLogic.cs @@ -32,9 +32,34 @@ namespace HospitalBusinessLogic.BusinessLogics _diseaseStorage = diseaseStorage; } - public List GetPatients(ReportBindingModel model) + public List GetPatients(ReportBindingModel model, PatientBindingModel patientModel) { - throw new NotImplementedException(); + var list = new List(); + var patients = _patientStorage.GetFilteredList(new PatientSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo, Id = patientModel.Id }); + + foreach (var patient in patients) + { + var record = new ReportPatientViewModel + { + Id = patient.Id, + Medicines = new List(), + Diseases = new List() + }; + + var allRecipes = _recipeStorage.GetFullList(); + var patientRecipes = new List(); + + foreach (var recipe in allRecipes) + { + if (recipe.Id == patient.Id) + { + record.Diseases.Add(_diseaseStorage.GetElement(new DiseaseSearchModel { Id = recipe.DiseaseId }).Description); + } + } + + list.Add(record); + } + return list; } public List GetProcedureRecipes() diff --git a/Hospital/HospitalContracts/BusinessLogicContracts/IDoctorReportLogic.cs b/Hospital/HospitalContracts/BusinessLogicContracts/IDoctorReportLogic.cs index 31380f1..7b1927d 100644 --- a/Hospital/HospitalContracts/BusinessLogicContracts/IDoctorReportLogic.cs +++ b/Hospital/HospitalContracts/BusinessLogicContracts/IDoctorReportLogic.cs @@ -11,7 +11,7 @@ namespace HospitalContracts.BusinessLogicContracts public interface IDoctorReportLogic { List GetProcedureRecipes(); - List GetPatients(ReportBindingModel model); + List GetPatients(ReportBindingModel model, PatientBindingModel patientModel); void SaveProcedureRecipesToWordFile(ReportBindingModel model); void SaveProcedureRecipesToExcelFile(ReportBindingModel model); void SavePatientsToPdfFile(ReportBindingModel model); diff --git a/Hospital/HospitalContracts/ViewModels/ReportPatientViewModel.cs b/Hospital/HospitalContracts/ViewModels/ReportPatientViewModel.cs index c6be150..94ea181 100644 --- a/Hospital/HospitalContracts/ViewModels/ReportPatientViewModel.cs +++ b/Hospital/HospitalContracts/ViewModels/ReportPatientViewModel.cs @@ -9,7 +9,8 @@ namespace HospitalContracts.ViewModels public class ReportPatientViewModel { public int Id { get; set; } - public string MedicineName { get; set; } = string.Empty; - public List Patients { get; set; } = new(); + public string FIO { get; set; } = string.Empty; + public List Medicines { get; set; } = new(); + public List Diseases { get; set; } = new(); } }