добавление необходимых для отчетов файлов

This commit is contained in:
ValAnn 2024-05-05 01:55:19 +04:00
parent 07826a9fe0
commit 6c1c337da5
5 changed files with 155 additions and 0 deletions

View File

@ -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<ReportPatientViewModel> GetPatients(ReportBindingModel model, PatientBindingModel patientModel)
{
var list = new List<ReportPatientViewModel>();
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<string>(),
Diseases = new List<string>()
};
var allRecipes = _recipeStorage.GetFullList();
var patientRecipes = new List<RecipeViewModel>();
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<ReportProcedureRecipeViewModel> 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();
}
}
}

View File

@ -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; }
}
}

View File

@ -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<ReportProcedureRecipeViewModel> GetProcedureRecipes();
List<ReportPatientViewModel> GetPatients(ReportBindingModel model, PatientBindingModel patientModel);
void SaveProcedureRecipesToWordFile(ReportBindingModel model);
void SaveProcedureRecipesToExcelFile(ReportBindingModel model);
void SavePatientsToPdfFile(ReportBindingModel model);
}
}

View File

@ -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<string> Medicines { get; set; } = new();
public List<string> Diseases { get; set; } = new();
}
}

View File

@ -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;
}
}