From 6c1c337da572e393bef1a2413dbc50efe48df537 Mon Sep 17 00:00:00 2001 From: ValAnn Date: Sun, 5 May 2024 01:55:19 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B5=D0=BE=D0=B1=D1=85=D0=BE=D0=B4?= =?UTF-8?q?=D0=B8=D0=BC=D1=8B=D1=85=20=D0=B4=D0=BB=D1=8F=20=D0=BE=D1=82?= =?UTF-8?q?=D1=87=D0=B5=D1=82=D0=BE=D0=B2=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/DoctorReportLogic.cs | 85 +++++++++++++++++++ .../BindingModels/ReportBindingModel.cs | 19 +++++ .../IDoctorReportLogic.cs | 19 +++++ .../ViewModels/ReportPatientViewModel.cs | 16 ++++ .../ReportProcedureRecipeViewModel.cs | 16 ++++ 5 files changed, 155 insertions(+) create mode 100644 Hospital/HospitalBusinessLogic/BusinessLogics/DoctorReportLogic.cs create mode 100644 Hospital/HospitalContracts/BindingModels/ReportBindingModel.cs create mode 100644 Hospital/HospitalContracts/BusinessLogicContracts/IDoctorReportLogic.cs create mode 100644 Hospital/HospitalContracts/ViewModels/ReportPatientViewModel.cs create mode 100644 Hospital/HospitalContracts/ViewModels/ReportProcedureRecipeViewModel.cs diff --git a/Hospital/HospitalBusinessLogic/BusinessLogics/DoctorReportLogic.cs b/Hospital/HospitalBusinessLogic/BusinessLogics/DoctorReportLogic.cs new file mode 100644 index 0000000..b0135e0 --- /dev/null +++ b/Hospital/HospitalBusinessLogic/BusinessLogics/DoctorReportLogic.cs @@ -0,0 +1,85 @@ +using HospitalContracts.BindingModels; +using HospitalContracts.BusinessLogicContracts; +using HospitalContracts.SearchModels; +using HospitalContracts.StoragesContracts; +using HospitalContracts.ViewModels; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.BusinessLogics +{ + public class DoctorReportLogic : IDoctorReportLogic + { + + private readonly IPatientStorage _patientStorage; + private readonly IMedicineStorage _medicineStorage; + private readonly IProcedureStorage _procedureStorage; + private readonly IRecipeStorage _recipeStorage; + private readonly IDiseaseStorage _diseaseStorage; + + public DoctorReportLogic(IPatientStorage patientStorage, IMedicineStorage medicineStorage, IProcedureStorage procedureStorage, IRecipeStorage recipeStorage, IDiseaseStorage diseaseStorage) + { + + _patientStorage = patientStorage; + _medicineStorage = medicineStorage; + _procedureStorage = procedureStorage; + _recipeStorage = recipeStorage; + _diseaseStorage = diseaseStorage; + } + + public List GetPatients(ReportBindingModel model, PatientBindingModel patientModel) + { + 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() + { + throw new NotImplementedException(); + } + + public void SavePatientsToPdfFile(ReportBindingModel model) + { + throw new NotImplementedException(); + } + + public void SaveProcedureRecipesToExcelFile(ReportBindingModel model) + { + throw new NotImplementedException(); + } + + public void SaveProcedureRecipesToWordFile(ReportBindingModel model) + { + throw new NotImplementedException(); + } + } +} diff --git a/Hospital/HospitalContracts/BindingModels/ReportBindingModel.cs b/Hospital/HospitalContracts/BindingModels/ReportBindingModel.cs new file mode 100644 index 0000000..9b54576 --- /dev/null +++ b/Hospital/HospitalContracts/BindingModels/ReportBindingModel.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalContracts.BindingModels +{ + public class ReportBindingModel + { + public string FileName { get; set; } = string.Empty; + + public DateTime? DateFrom { get; set; } + + public DateTime? DateTo { get; set; } + + public int? PatientId { get; set; } + } +} diff --git a/Hospital/HospitalContracts/BusinessLogicContracts/IDoctorReportLogic.cs b/Hospital/HospitalContracts/BusinessLogicContracts/IDoctorReportLogic.cs new file mode 100644 index 0000000..7b1927d --- /dev/null +++ b/Hospital/HospitalContracts/BusinessLogicContracts/IDoctorReportLogic.cs @@ -0,0 +1,19 @@ +using HospitalContracts.BindingModels; +using HospitalContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalContracts.BusinessLogicContracts +{ + public interface IDoctorReportLogic + { + List GetProcedureRecipes(); + 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 new file mode 100644 index 0000000..94ea181 --- /dev/null +++ b/Hospital/HospitalContracts/ViewModels/ReportPatientViewModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalContracts.ViewModels +{ + public class ReportPatientViewModel + { + public int Id { get; set; } + public string FIO { get; set; } = string.Empty; + public List Medicines { get; set; } = new(); + public List Diseases { get; set; } = new(); + } +} diff --git a/Hospital/HospitalContracts/ViewModels/ReportProcedureRecipeViewModel.cs b/Hospital/HospitalContracts/ViewModels/ReportProcedureRecipeViewModel.cs new file mode 100644 index 0000000..fbeb0ab --- /dev/null +++ b/Hospital/HospitalContracts/ViewModels/ReportProcedureRecipeViewModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalContracts.ViewModels +{ + public class ReportProcedureRecipeViewModel + { + public DateTime DateCreate { get; set; } + public string MedicineName { get; set; } = string.Empty; + public int Number { get; set; } + public string ProcedureName { get; set; } = string.Empty; + } +}