отчеты о пациентах

This commit is contained in:
ValAnn 2024-05-05 02:46:56 +04:00
parent 6c1c337da5
commit b5e9c5c194
7 changed files with 81 additions and 46 deletions

View File

@ -1,8 +1,10 @@
using HospitalContracts.BindingModels;
using DocumentFormat.OpenXml.Office2010.ExcelAc;
using HospitalContracts.BindingModels;
using HospitalContracts.BusinessLogicContracts;
using HospitalContracts.SearchModels;
using HospitalContracts.StoragesContracts;
using HospitalContracts.ViewModels;
using HospitalDataModels.Models;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
@ -32,40 +34,71 @@ namespace HospitalBusinessLogic.BusinessLogics
_diseaseStorage = diseaseStorage;
}
public List<ReportPatientViewModel> GetPatients(ReportBindingModel model, PatientBindingModel patientModel)
//отчет по лекарствам и болезням у пациента за период
public List<ReportPatientViewModel> GetMedicineDiseases(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 purchase = _patientStorage.GetElement(new() { Id = patient.Id })!;
List<string> diseaseList = new List<string>();
List<string> medicineList = new List<string>();
foreach (var recipe in _recipeStorage.GetFilteredList(new RecipeSearchModel {PatientId = patient.Id}))
{
foreach (var medicine in _medicineStorage.GetFilteredList(new MedicineSearchModel { RecipeId = recipe.Id}))
{
medicineList.Add(new(medicine.Name));
}
foreach (var disease in _diseaseStorage.GetFilteredList(new DiseaseSearchModel {RecipeId = recipe.Id}))
{
diseaseList.Add(disease.Name);
}
}
var record = new ReportPatientViewModel
{
Id = purchase.Id,
FIO = patient.FIO,
Diseases = diseaseList,
Medicines = medicineList
};
list.Add(record);
}
return list;
}
var allRecipes = _recipeStorage.GetFullList();
var patientRecipes = new List<RecipeViewModel>();
public List<ReportPatientRecipeViewModel> GetPatients()
{
var list = new List<ReportPatientRecipeViewModel>();
var patients = _patientStorage.GetFullList();
foreach (var recipe in allRecipes)
{
if (recipe.Id == patient.Id)
{
record.Diseases.Add(_diseaseStorage.GetElement(new DiseaseSearchModel { Id = recipe.DiseaseId }).Description);
}
}
foreach (var patient in patients)
{
var purchase = _patientStorage.GetElement(new() { Id = patient.Id })!;
List<string> diseaseList = new List<string>();
List<string> recipeList = new List<string>();
foreach (var recipe in _recipeStorage.GetFilteredList(new RecipeSearchModel { PatientId = patient.Id }))
{
recipeList.Add(recipe.IssueDate.ToString());
foreach (var disease in _diseaseStorage.GetFilteredList(new DiseaseSearchModel { RecipeId = recipe.Id }))
{
diseaseList.Add(disease.Name);
}
}
var record = new ReportPatientRecipeViewModel
{
Diseases = diseaseList,
Recipes = recipeList
};
list.Add(record);
}
return list;
}
list.Add(record);
}
return list;
}
public List<ReportProcedureRecipeViewModel> GetProcedureRecipes()
{
throw new NotImplementedException();
}
public void SavePatientsToPdfFile(ReportBindingModel model)
{

View File

@ -10,8 +10,8 @@ namespace HospitalContracts.BusinessLogicContracts
{
public interface IDoctorReportLogic
{
List<ReportProcedureRecipeViewModel> GetProcedureRecipes();
List<ReportPatientViewModel> GetPatients(ReportBindingModel model, PatientBindingModel patientModel);
List<ReportPatientRecipeViewModel> GetPatients();
List<ReportPatientViewModel> GetMedicineDiseases(ReportBindingModel model, PatientBindingModel patientModel);
void SaveProcedureRecipesToWordFile(ReportBindingModel model);
void SaveProcedureRecipesToExcelFile(ReportBindingModel model);
void SavePatientsToPdfFile(ReportBindingModel model);

View File

@ -14,5 +14,6 @@ namespace HospitalContracts.SearchModels
public string? Description { get; set; }
public int? DoctorId { get; set; }
}
public int? RecipeId { get; set; }
}
}

View File

@ -13,5 +13,7 @@ namespace HospitalContracts.SearchModels
public string? CountryOrigin { get; set; }
public double? Price { get; set; }
public int? PharmacistId { get; set; }
}
public int? RecipeId { get; set; }
}
}

View File

@ -12,6 +12,7 @@ namespace HospitalContracts.SearchModels
public int? DoctorId { get; set; }
public int? MedicineId { get; set; }
DateTime IssueDate { get; }
public int? PatientId { get; set; }
DateTime IssueDate { get; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.ViewModels
{
public class ReportPatientRecipeViewModel
{
public List<string> Recipes { get; set; } = new();
public List<string> Diseases { get; set; } = new();
}
}

View File

@ -1,16 +0,0 @@
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;
}
}