diff --git a/Hospital/HospitalBusinessLogics/BusinessLogics/ReportLogic.cs b/Hospital/HospitalBusinessLogics/BusinessLogics/ReportLogic.cs index c1ff9eb..cefa655 100644 --- a/Hospital/HospitalBusinessLogics/BusinessLogics/ReportLogic.cs +++ b/Hospital/HospitalBusinessLogics/BusinessLogics/ReportLogic.cs @@ -98,11 +98,12 @@ namespace HospitalBusinessLogics.BusinessLogics { var result = new List(); - // Получаем список рецептов по идентификатору врача - var recipes = _recipeStorage.GetFilteredList(new RecipeSearchModel + // Получаем список рецептов + var recipes = new List(); + foreach (var recipeId in model.Recipes) { - DoctorId = model.DoctorId - }); + recipes.Add(_recipeStorage.GetElement(new RecipeSearchModel { Id = recipeId })!); + } // Получаем список всех пациентов, // так как рецепты и процедуры связаны через сущность "Пациент" diff --git a/Hospital/HospitalContracts/BindingModels/ReportBindingModel.cs b/Hospital/HospitalContracts/BindingModels/ReportBindingModel.cs index eafe06d..dff453a 100644 --- a/Hospital/HospitalContracts/BindingModels/ReportBindingModel.cs +++ b/Hospital/HospitalContracts/BindingModels/ReportBindingModel.cs @@ -30,5 +30,10 @@ namespace HospitalContracts.BindingModels /// Идентификатор врача /// public int DoctorId { get; set; } + + /// + /// Список рецептов + /// + public List Recipes { get; set; } = new(); } } diff --git a/Hospital/HospitalWebApp/Controllers/HomeController.cs b/Hospital/HospitalWebApp/Controllers/HomeController.cs index ecff19f..4d2c8b5 100644 --- a/Hospital/HospitalWebApp/Controllers/HomeController.cs +++ b/Hospital/HospitalWebApp/Controllers/HomeController.cs @@ -25,6 +25,11 @@ namespace HospitalWebApp.Controllers /// private readonly IDoctorLogic _doctorLogic; + /// + /// Бизнес-логика для сущности "Рецепт" + /// + private readonly IRecipeLogic _recipeLogic; + /// /// Бизнес-логика для отчетов /// @@ -40,12 +45,14 @@ namespace HospitalWebApp.Controllers /// /// /// + /// /// /// - public HomeController(ILogger logger, IDoctorLogic doctorLogic, IReportLogic reportLogic, AbstractMailWorker mailLogic) + public HomeController(ILogger logger, IDoctorLogic doctorLogic, IRecipeLogic recipeLogic, IReportLogic reportLogic, AbstractMailWorker mailLogic) { _logger = logger; _doctorLogic = doctorLogic; + _recipeLogic = recipeLogic; _reportLogic = reportLogic; _mailLogic = mailLogic; } @@ -230,6 +237,11 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } + ViewBag.Recipes = _recipeLogic.ReadList(new RecipeSearchModel + { + DoctorId = APIClient.Doctor.Id + }); + return View(); } @@ -257,6 +269,11 @@ namespace HospitalWebApp.Controllers DoctorId = APIClient.Doctor.Id }); + ViewBag.Recipes = _recipeLogic.ReadList(new RecipeSearchModel + { + DoctorId = APIClient.Doctor.Id + }); + return View(data); } @@ -265,17 +282,23 @@ namespace HospitalWebApp.Controllers /// /// [HttpPost] - public void CreateReportWord() + public void CreateReportWord(List recipes) { if (APIClient.Doctor == null) { throw new Exception("Необходимо авторизоваться!"); } - _reportLogic.SaveRecipeProceduresToWordFile(new ReportBindingModel + if (recipes == null || recipes.Count <= 0) + { + throw new Exception("Не выбраны рецепты!"); + } + + _reportLogic.SaveRecipeProceduresToWordFile(new ReportBindingModel { - FileName = $@"D:\ULSTU\Семестр 4\РПП Coursework\Reports\Список процедур {DateTime.Now.ToString("dd-MM-yyyy HH-mm-ss")}.docx", - DoctorId = APIClient.Doctor.Id + FileName = $@"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\Downloads\Список процедур {DateTime.Now.ToString("dd-MM-yyyy HH-mm-ss")}.docx", + DoctorId = APIClient.Doctor.Id, + Recipes = recipes }); Response.Redirect("/Home/Reports"); @@ -286,17 +309,23 @@ namespace HospitalWebApp.Controllers /// /// [HttpPost] - public void CreateReportExcel() + public void CreateReportExcel(List recipes) { if (APIClient.Doctor == null) { throw new Exception("Необходимо авторизоваться!"); } + if (recipes == null || recipes.Count <= 0) + { + throw new Exception("Не выбраны рецепты!"); + } + _reportLogic.SaveRecipeProceduresToExcelFile(new ReportBindingModel { - FileName = $@"D:\ULSTU\Семестр 4\РПП Coursework\Reports\Список процедур {DateTime.Now.ToString("dd-MM-yyyy HH-mm-ss")}.xlsx", - DoctorId = APIClient.Doctor.Id + FileName = $@"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\Downloads\Список процедур {DateTime.Now.ToString("dd-MM-yyyy HH-mm-ss")}.xlsx", + DoctorId = APIClient.Doctor.Id, + Recipes = recipes }); Response.Redirect("/Home/Reports"); @@ -321,7 +350,7 @@ namespace HospitalWebApp.Controllers _reportLogic.SavePatientsInfoToPdfFile(new ReportBindingModel { - FileName = $@"D:\ULSTU\Семестр 4\РПП Coursework\Reports\Сведения о пациентах {DateTime.Now.ToString("dd-MM-yyyy HH-mm-ss")}.pdf", + FileName = $@"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\Downloads\Сведения о пациентах {DateTime.Now.ToString("dd-MM-yyyy HH-mm-ss")}.pdf", DoctorId = APIClient.Doctor.Id, DateFrom = dateFrom, DateTo = dateTo @@ -349,7 +378,7 @@ namespace HospitalWebApp.Controllers } // Путь до файла - var uploadPath = @"D:\ULSTU\Семестр 4\РПП Coursework\Reports\"; + var uploadPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\Downloads\"; var fileName = Path.GetFileName(fileUpload.FileName); var fullPath = Path.Combine(uploadPath, fileName); diff --git a/Hospital/HospitalWebApp/Views/Home/Reports.cshtml b/Hospital/HospitalWebApp/Views/Home/Reports.cshtml index e57be1b..7268962 100644 --- a/Hospital/HospitalWebApp/Views/Home/Reports.cshtml +++ b/Hospital/HospitalWebApp/Views/Home/Reports.cshtml @@ -12,17 +12,31 @@
-
+
+
+ +
+
Рецепты:
+
+ +
+
+
-
+
diff --git a/Записка/Use-case-diagram.drawio b/Записка/Use-case-diagram.drawio index d56fb62..e8a14f1 100644 --- a/Записка/Use-case-diagram.drawio +++ b/Записка/Use-case-diagram.drawio @@ -1,6 +1,6 @@ - + - + @@ -16,7 +16,7 @@ - + @@ -43,7 +43,20 @@ - + + + + + + + + + + + + + + @@ -136,41 +149,20 @@ - - - - + - - - - - - - + - + - + - - - - - - - - - - - - - + @@ -178,23 +170,17 @@ - + - - + + - - + + - - - - - - - - + + @@ -202,20 +188,94 @@ - - - - - - - - - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Записка/Use-case-diagram.png b/Записка/Use-case-diagram.png index 392e3ee..b237085 100644 Binary files a/Записка/Use-case-diagram.png and b/Записка/Use-case-diagram.png differ diff --git a/Записка/ПИбд-21 Масенькин Максим.docx b/Записка/ПИбд-21 Масенькин Максим.docx index 6d6ebb4..fa66720 100644 Binary files a/Записка/ПИбд-21 Масенькин Максим.docx and b/Записка/ПИбд-21 Масенькин Максим.docx differ diff --git a/Записка/Пример отчета Excel.xlsx b/Записка/Пример отчета Excel.xlsx index 3211f15..b6e95e7 100644 Binary files a/Записка/Пример отчета Excel.xlsx and b/Записка/Пример отчета Excel.xlsx differ diff --git a/Записка/Пример отчета Pdf.pdf b/Записка/Пример отчета Pdf.pdf new file mode 100644 index 0000000..585efdf Binary files /dev/null and b/Записка/Пример отчета Pdf.pdf differ diff --git a/Записка/Пример отчета Word.docx b/Записка/Пример отчета Word.docx index 501e64a..1b403da 100644 Binary files a/Записка/Пример отчета Word.docx and b/Записка/Пример отчета Word.docx differ