From 215304007f0030bf5c1948ec2c9d79fef8d5acef Mon Sep 17 00:00:00 2001 From: Anastasia Date: Fri, 7 Apr 2023 14:50:12 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B4=D0=BB=D1=8F=20=D0=BE?= =?UTF-8?q?=D1=82=D1=87=D0=B5=D1=82=D0=BE=D0=B2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/ReportLogic.cs | 176 ++++++++++++++++++ .../OfficePackage/AbstractSaveToExcel.cs | 83 +++++++++ .../OfficePackage/AbstractSaveToPdf.cs | 75 ++++++++ .../OfficePackage/AbstractSaveToWord.cs | 56 ++++++ .../HelperEnums/ExcelStyleInfoType.cs | 16 ++ .../HelperEnums/PdfParagraphAlignmentType.cs | 15 ++ .../HelperEnums/WordJustificationType.cs | 14 ++ .../HelperModels/ExcelCellParameters.cs | 19 ++ .../OfficePackage/HelperModels/ExcelInfo.cs | 21 +++ .../HelperModels/ExcelMergeParameters.cs | 15 ++ .../OfficePackage/HelperModels/PdfInfo.cs | 19 ++ .../HelperModels/PdfParagraph.cs | 16 ++ .../HelperModels/PdfRowParameters.cs | 17 ++ .../OfficePackage/HelperModels/WordInfo.cs | 17 ++ .../HelperModels/WordParagraph.cs | 16 ++ .../HelperModels/WordTextProperties.cs | 16 ++ .../BindingModels/ReportBindingModel.cs | 17 ++ .../BusinessLogicsContracts/IReportLogic.cs | 40 ++++ .../SearchModels/PatientSearchModel.cs | 2 + .../ReportPatientMedicineViewModel.cs | 29 +++ .../ViewModels/ReportPatientsViewModel.cs | 29 +++ 21 files changed, 708 insertions(+) create mode 100644 Hospital/HospitalBusinessLogic/BusinessLogics/ReportLogic.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/AbstractSaveToExcel.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/AbstractSaveToPdf.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/AbstractSaveToWord.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/HelperEnums/WordJustificationType.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/WordInfo.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs create mode 100644 Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs create mode 100644 Hospital/HospitalContracts/BindingModels/ReportBindingModel.cs create mode 100644 Hospital/HospitalContracts/BusinessLogicsContracts/IReportLogic.cs create mode 100644 Hospital/HospitalContracts/ViewModels/ReportPatientMedicineViewModel.cs create mode 100644 Hospital/HospitalContracts/ViewModels/ReportPatientsViewModel.cs diff --git a/Hospital/HospitalBusinessLogic/BusinessLogics/ReportLogic.cs b/Hospital/HospitalBusinessLogic/BusinessLogics/ReportLogic.cs new file mode 100644 index 0000000..08dbd16 --- /dev/null +++ b/Hospital/HospitalBusinessLogic/BusinessLogics/ReportLogic.cs @@ -0,0 +1,176 @@ +using HospitalBusinessLogic.OfficePackage; +using HospitalBusinessLogic.OfficePackage.HelperModels; +using HospitalContracts.BindingModels; +using HospitalContracts.BusinessLogicsContracts; +using HospitalContracts.SearchModels; +using HospitalContracts.StoragesContracts; +using HospitalContracts.ViewModels; +using HospitalDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.BusinessLogics +{ + public class ReportLogic : IReportLogic + { + private readonly IPatientStorage _patientStorage; + private readonly IRecipeStorage _recipeStorage; + private readonly IMedicineStorage _medicineStorage; + private readonly AbstractSaveToExcel _saveToExcel; + private readonly AbstractSaveToWord _saveToWord; + private readonly AbstractSaveToPdf _saveToPdf; + public ReportLogic(IPatientStorage patientStorage, IRecipeStorage recipeStorage, IMedicineStorage medicineStorage, AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf) + { + _patientStorage = patientStorage; + _recipeStorage = recipeStorage; + _medicineStorage = medicineStorage; + _saveToExcel = saveToExcel; + _saveToWord = saveToWord; + _saveToPdf = saveToPdf; + } + + public List GetPatientMedicine() + { + throw new NotImplementedException(); + } + + /// + /// Получение списка лекарств с указанием пациентов + /// + /// + public List GetPatientMedicineModule() + { + var medicines = _medicineStorage.GetFullList(); + var recipes = _recipeStorage.GetFullList(); + var patients = _patientStorage.GetFullList(); + var list = new List(); + + foreach (var patient in patients) + { + var record = new ReportPatientMedicineViewModel + { + PatientSurname = patient.Surname, + PatientName = patient.Name, + PatientPatronymic = patient.Patronymic, + Medicines = new Dictionary(), + }; + foreach (var recipe in recipes) + { + if (patient.PatientRecipes.ContainsValue(recipe)) + { + foreach (var medicine in medicines) + { + if (recipe.RecipeMedicines.ContainsKey(medicine.Id)) + { + record.Medicines.Add(medicine.Id, medicine.Name); + } + } + } + + } + list.Add(record); + } + + return list; + } + /// + /// Получение списка пациентов за определенный период + /// + /// + /// + public List GetPatients(ReportBindingModel model) + { + var patients = _patientStorage.GetFilteredList(new PatientSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo }); + var medicines = _medicineStorage.GetFullList(); + var recipes = _recipeStorage.GetFullList(); + var list = new List(); + + foreach (var patient in patients) + { + var record = new ReportPatientsViewModel + { + Id = patient.Id, + PatientSurname = patient.Surname, + PatientName = patient.Name, + PatientPatronymic = patient.Patronymic, + Medicines = new Dictionary() + }; + foreach (var recipe in recipes) + { + if (patient.PatientRecipes.ContainsValue(recipe)) + { + foreach (var medicine in medicines) + { + if (recipe.RecipeMedicines.ContainsKey(medicine.Id)) + { + record.Medicines.Add(medicine.Id, medicine.Name); + } + } + } + } + list.Add(record); + } + + return list; + } + + public void SavePatientMedicineToExcelFile(ReportBindingModel model) + { + throw new NotImplementedException(); + } + + public void SavePatientMedicineToWordFile(ReportBindingModel model) + { + throw new NotImplementedException(); + } + + public void SavePatientsToPdfFile(ReportBindingModel model) + { + throw new NotImplementedException(); + } + ///// + ///// Сохранение компонент в файл-Word + ///// + ///// + //public void SaveFurnitureModuleToWordFile(ReportBindingModel model) + //{ + // _saveToWord.CreateDoc(new WordInfo + // { + // FileName = model.FileName, + // Title = "Список компонент", + // Sets = _setStorage.GetFullList() + // }); + //} + ///// + ///// Сохранение компонент с указаеним продуктов в файл-Excel + ///// + ///// + //public void SaveSetFurnitureModuleToExcelFile(ReportBindingModel model) + //{ + // _saveToExcel.CreateReport(new ExcelInfo + // { + // FileName = model.FileName, + // Title = "Список компонент", + // SetFurnitureModules = GetSetFurnitureModule() + // }); + //} + ///// + ///// Сохранение заказов в файл-Pdf + ///// + ///// + //public void SaveOrdersToPdfFile(ReportBindingModel model) + //{ + // _saveToPdf.CreateDoc(new PdfInfo + // { + // FileName = model.FileName, + // Title = "Список заказов", + // DateFrom = model.DateFrom!.Value, + // DateTo = model.DateTo!.Value, + // Orders = GetOrders(model) + // }); + //} + } +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/Hospital/HospitalBusinessLogic/OfficePackage/AbstractSaveToExcel.cs new file mode 100644 index 0000000..069ed99 --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/AbstractSaveToExcel.cs @@ -0,0 +1,83 @@ +using HospitalBusinessLogic.OfficePackage.HelperEnums; +using HospitalBusinessLogic.OfficePackage.HelperModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage +{ + public abstract class AbstractSaveToExcel + { + /// + /// Создание отчета + /// + /// + public void CreateReport(ExcelInfo info) + { + CreateExcel(info); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = 1, + Text = info.Title, + StyleInfo = ExcelStyleInfoType.Title + }); + MergeCells(new ExcelMergeParameters + { + CellFromName = "A1", + CellToName = "C1" + }); + uint rowIndex = 2; + foreach (var pm in info.PatientMedicines) + { + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = rowIndex, + Text = pm.MedicineName, + StyleInfo = ExcelStyleInfoType.Text + }); + rowIndex++; + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = rowIndex, + Text = "Итого", + StyleInfo = ExcelStyleInfoType.Text + }); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "C", + RowIndex = rowIndex, + //Text = pm.TotalCount.ToString(), + StyleInfo = ExcelStyleInfoType.Text + }); + rowIndex++; + } + SaveExcel(info); + } + /// + /// Создание excel-файла + /// + /// + protected abstract void CreateExcel(ExcelInfo info); + /// + /// Добавляем новую ячейку в лист + /// + /// + protected abstract void InsertCellInWorksheet(ExcelCellParameters + excelParams); + /// + /// Объединение ячеек + /// + /// + protected abstract void MergeCells(ExcelMergeParameters excelParams); + /// + /// Сохранение файла + /// + /// + protected abstract void SaveExcel(ExcelInfo info); + } +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/Hospital/HospitalBusinessLogic/OfficePackage/AbstractSaveToPdf.cs new file mode 100644 index 0000000..8a5912f --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -0,0 +1,75 @@ +using HospitalBusinessLogic.OfficePackage.HelperEnums; +using HospitalBusinessLogic.OfficePackage.HelperModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage +{ + public abstract class AbstractSaveToPdf + { + public void CreateDoc(PdfInfo info) + { + CreatePdf(info); + CreateParagraph(new PdfParagraph + { + Text = info.Title, + Style = + "NormalTitle", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + CreateParagraph(new PdfParagraph + { + Text = $"с { info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + CreateTable(new List { "2cm", "3cm", "6cm", "3cm" }); + CreateRow(new PdfRowParameters + { + Texts = new List { "Номер", "Дата", "Пациент","Лекарства" }, + Style = "NormalTitle", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + foreach (var patient in info.Patients) + { + CreateRow(new PdfRowParameters + { + Texts = new List { patient.Id.ToString(), patient.PatientSurname, patient.PatientName, patient.PatientPatronymic, patient.MedicineName}, + Style = "Normal", + ParagraphAlignment = PdfParagraphAlignmentType.Left + }); + } + SavePdf(info); + } + /// + /// Создание doc-файла + /// + /// + protected abstract void CreatePdf(PdfInfo info); + /// + /// Создание параграфа с текстом + /// + /// + /// + protected abstract void CreateParagraph(PdfParagraph paragraph); + /// + /// Создание таблицы + /// + /// + /// + protected abstract void CreateTable(List columns); + /// + /// Создание и заполнение строки + /// + /// + protected abstract void CreateRow(PdfRowParameters rowParameters); + /// + /// Сохранение файла + /// + /// + protected abstract void SavePdf(PdfInfo info); + } + +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/Hospital/HospitalBusinessLogic/OfficePackage/AbstractSaveToWord.cs new file mode 100644 index 0000000..9d0b924 --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/AbstractSaveToWord.cs @@ -0,0 +1,56 @@ +using HospitalBusinessLogic.OfficePackage.HelperEnums; +using HospitalBusinessLogic.OfficePackage.HelperModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage +{ + public abstract class AbstractSaveToWord + { + public void CreateDoc(WordInfo info) + { + CreateWord(info); + CreateParagraph(new WordParagraph + { + Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) }, + TextProperties = new WordTextProperties + { + Size = "24", + JustificationType = WordJustificationType.Center + } + }); + foreach (var medicine in info.Medicines) + { + CreateParagraph(new WordParagraph + { + Texts = new List<(string, WordTextProperties)> {(medicine.Name, new WordTextProperties { Size = "24", }) }, + TextProperties = new WordTextProperties + { + Size = "24", + JustificationType = WordJustificationType.Both + } + }); + } + SaveWord(info); + } + /// + /// Создание doc-файла + /// + /// + protected abstract void CreateWord(WordInfo info); + /// + /// Создание абзаца с текстом + /// + /// + /// + protected abstract void CreateParagraph(WordParagraph paragraph); + /// + /// Сохранение файла + /// + /// + protected abstract void SaveWord(WordInfo info); + } +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs b/Hospital/HospitalBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs new file mode 100644 index 0000000..bf76908 --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage.HelperEnums +{ + public enum ExcelStyleInfoType + { + Title, + Text, + TextWithBroder + } + +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs b/Hospital/HospitalBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs new file mode 100644 index 0000000..6aa2f54 --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage.HelperEnums +{ + public enum PdfParagraphAlignmentType + { + Center, + Left, + Rigth + } +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/HelperEnums/WordJustificationType.cs b/Hospital/HospitalBusinessLogic/OfficePackage/HelperEnums/WordJustificationType.cs new file mode 100644 index 0000000..0558e3f --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/HelperEnums/WordJustificationType.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage.HelperEnums +{ + public enum WordJustificationType + { + Center, + Both + } +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs new file mode 100644 index 0000000..b66b87c --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs @@ -0,0 +1,19 @@ +using HospitalBusinessLogic.OfficePackage.HelperEnums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage.HelperModels +{ + public class ExcelCellParameters + { + public string ColumnName { get; set; } = string.Empty; + public uint RowIndex { get; set; } + public string Text { get; set; } = string.Empty; + public string CellReference => $"{ColumnName}{RowIndex}"; + public ExcelStyleInfoType StyleInfo { get; set; } + } + +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs new file mode 100644 index 0000000..83ebbd4 --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs @@ -0,0 +1,21 @@ +using HospitalContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage.HelperModels +{ + public class ExcelInfo + { + public string FileName { get; set; } = string.Empty; + public string Title { get; set; } = string.Empty; + public List PatientMedicines + { + get; + set; + } = new(); + } + +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs new file mode 100644 index 0000000..9b6b6b0 --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage.HelperModels +{ + public class ExcelMergeParameters + { + public string CellFromName { get; set; } = string.Empty; + public string CellToName { get; set; } = string.Empty; + public string Merge => $"{CellFromName}:{CellToName}"; + } +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs new file mode 100644 index 0000000..251ef82 --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs @@ -0,0 +1,19 @@ +using HospitalContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage.HelperModels +{ + public class PdfInfo + { + public string FileName { get; set; } = string.Empty; + public string Title { get; set; } = string.Empty; + public DateTime DateFrom { get; set; } + public DateTime DateTo { get; set; } + public List Patients { get; set; } = new(); + } + +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs new file mode 100644 index 0000000..5c32a5f --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs @@ -0,0 +1,16 @@ +using HospitalBusinessLogic.OfficePackage.HelperEnums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage.HelperModels +{ + public class PdfParagraph + { + public string Text { get; set; } = string.Empty; + public string Style { get; set; } = string.Empty; + public PdfParagraphAlignmentType ParagraphAlignment { get; set; } + } +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs new file mode 100644 index 0000000..5dd34ec --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs @@ -0,0 +1,17 @@ +using HospitalBusinessLogic.OfficePackage.HelperEnums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage.HelperModels +{ + public class PdfRowParameters + { + public List Texts { get; set; } = new(); + public string Style { get; set; } = string.Empty; + public PdfParagraphAlignmentType ParagraphAlignment { get; set; } + } + +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/WordInfo.cs b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/WordInfo.cs new file mode 100644 index 0000000..46d3411 --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/WordInfo.cs @@ -0,0 +1,17 @@ +using HospitalContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage.HelperModels +{ + public class WordInfo + { + public string FileName { get; set; } = string.Empty; + public string Title { get; set; } = string.Empty; + public List Medicines { get; set; } = new(); + public IEnumerable Components { get; internal set; } + } +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs new file mode 100644 index 0000000..531b89f --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage.HelperModels +{ + public class WordParagraph + { + public List<(string, WordTextProperties)> Texts { get; set; } = new(); + + public WordTextProperties? TextProperties { get; set; } + + } +} diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs new file mode 100644 index 0000000..5d0bc32 --- /dev/null +++ b/Hospital/HospitalBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs @@ -0,0 +1,16 @@ +using HospitalBusinessLogic.OfficePackage.HelperEnums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.OfficePackage.HelperModels +{ + public class WordTextProperties + { + public string Size { get; set; } = string.Empty; + public bool Bold { get; set; } + public WordJustificationType JustificationType { get; set; } + } +} diff --git a/Hospital/HospitalContracts/BindingModels/ReportBindingModel.cs b/Hospital/HospitalContracts/BindingModels/ReportBindingModel.cs new file mode 100644 index 0000000..cfb4b8b --- /dev/null +++ b/Hospital/HospitalContracts/BindingModels/ReportBindingModel.cs @@ -0,0 +1,17 @@ +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; } + } +} diff --git a/Hospital/HospitalContracts/BusinessLogicsContracts/IReportLogic.cs b/Hospital/HospitalContracts/BusinessLogicsContracts/IReportLogic.cs new file mode 100644 index 0000000..e6cde8a --- /dev/null +++ b/Hospital/HospitalContracts/BusinessLogicsContracts/IReportLogic.cs @@ -0,0 +1,40 @@ +using HospitalContracts.BindingModels; +using HospitalContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalContracts.BusinessLogicsContracts +{ + public interface IReportLogic + { + /// + /// получение списка по «Medicine» на основе выбранных записях «Patient» + /// + /// + List GetPatientMedicine(); + /// + /// Получение списка пациентов за определенный период + /// + /// + /// + List GetPatients(ReportBindingModel model); + /// + /// Сохранение лекарств в файл-Word + /// + /// + void SavePatientMedicineToWordFile(ReportBindingModel model); + /// + /// Сохранение лекарств в файл-Excel + /// + /// + void SavePatientMedicineToExcelFile(ReportBindingModel model); + /// + /// Сохранение пациентов в файл-Pdf + /// + /// + void SavePatientsToPdfFile(ReportBindingModel model); + } +} diff --git a/Hospital/HospitalContracts/SearchModels/PatientSearchModel.cs b/Hospital/HospitalContracts/SearchModels/PatientSearchModel.cs index 83b039f..a855863 100644 --- a/Hospital/HospitalContracts/SearchModels/PatientSearchModel.cs +++ b/Hospital/HospitalContracts/SearchModels/PatientSearchModel.cs @@ -17,5 +17,7 @@ namespace HospitalContracts.SearchModels public string? Patronymic { get; set; } public int? DoctorId { get; set; } + public DateTime? DateFrom { get; set; } + public DateTime? DateTo { get; set; } } } diff --git a/Hospital/HospitalContracts/ViewModels/ReportPatientMedicineViewModel.cs b/Hospital/HospitalContracts/ViewModels/ReportPatientMedicineViewModel.cs new file mode 100644 index 0000000..b992b0d --- /dev/null +++ b/Hospital/HospitalContracts/ViewModels/ReportPatientMedicineViewModel.cs @@ -0,0 +1,29 @@ +using HospitalDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalContracts.ViewModels +{ + public class ReportPatientMedicineViewModel + { + public int Id { get; set; } + + public string PatientSurname { get; set; } = string.Empty; + + public string PatientName { get; set; } = string.Empty; + + public string PatientPatronymic { get; set; } = string.Empty; + + public int RecipeId { get; set; } + + public int DoctorId { get; set; } + + public Dictionary Medicines { get; set; } = new(); + + public string MedicineName { get; set; } + } +} diff --git a/Hospital/HospitalContracts/ViewModels/ReportPatientsViewModel.cs b/Hospital/HospitalContracts/ViewModels/ReportPatientsViewModel.cs new file mode 100644 index 0000000..de0e08d --- /dev/null +++ b/Hospital/HospitalContracts/ViewModels/ReportPatientsViewModel.cs @@ -0,0 +1,29 @@ +using HospitalDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalContracts.ViewModels +{ + public class ReportPatientsViewModel + { + public int Id { get; set; } + + public string PatientSurname { get; set; } = string.Empty; + + public string PatientName { get; set; } = string.Empty; + + public string PatientPatronymic { get; set; } = string.Empty; + + public int RecipeId { get; set; } + + public string MedicineName { get; set; } = string.Empty; + + public List Recipes { get; set; } = new(); + + public Dictionary Medicines { get; set; } = new(); + + } +}