вторая попытка влить ВСЕ готовые изменения с 5, 6 и 7 этапов в главную ветку для сдачи 8 этапа >:\ #14
@ -0,0 +1,116 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.BusinessLogicsContracts;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace PolyclinicBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class SuretorReportLogic : ISuretorReportLogic
|
||||
{
|
||||
private readonly IProcedureStorage procedureStorage;
|
||||
private readonly IMedicamentStorage medicamentStorage;
|
||||
private readonly ICourseStorage courseStorage;
|
||||
private readonly ISymptomStorage symptomStorage;
|
||||
private readonly IRecipeStorage recipeStorage;
|
||||
public SuretorReportLogic(IProcedureStorage procedureStorage, IMedicamentStorage medicamentStorage,
|
||||
ICourseStorage courseStorage, ISymptomStorage symptomStorage, IRecipeStorage recipeStorage)
|
||||
{
|
||||
this.procedureStorage = procedureStorage;
|
||||
this.medicamentStorage = medicamentStorage;
|
||||
this.courseStorage = courseStorage;
|
||||
this.symptomStorage = symptomStorage;
|
||||
this.recipeStorage = recipeStorage;
|
||||
}
|
||||
|
||||
public List<ReportCoursesByProcedureViewModel> GetProcedureCourses(ProcedureSearchModel model)
|
||||
{
|
||||
var procedure = procedureStorage.GetElement(model);
|
||||
var courses = courseStorage.GetFullList();
|
||||
var recipes = recipeStorage.GetFullList();
|
||||
var list = new List<ReportCoursesByProcedureViewModel>();
|
||||
|
||||
var record = new ReportCoursesByProcedureViewModel
|
||||
{
|
||||
Name = procedure!.Name,
|
||||
Courses = new List<(int countDays, int pillsPerDay, string comment)>()
|
||||
};
|
||||
|
||||
using var context = new PolyclinicDatabase();
|
||||
|
||||
var recipeProcedureId = context.RecipeProcedures
|
||||
.Where(x => x.ProcedureId == model.Id).Select(x => x.RecipeId).ToList();
|
||||
|
||||
|
||||
foreach (var recipe in recipes)
|
||||
{
|
||||
foreach (var recipeId in recipeProcedureId)
|
||||
{
|
||||
if(recipeId == recipe.Id)
|
||||
{
|
||||
foreach (var course in courses)
|
||||
{
|
||||
if(recipe.CourseId == course.Id)
|
||||
{
|
||||
record.Courses.Add((course.DaysCount, course.PillsPerDay, course.Comment));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
list.Add(record);
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<ReportProceduresViewModel> GetProcedures(ReportBindingModel model)
|
||||
{
|
||||
var procedures = procedureStorage.GetFullList();
|
||||
var medicaments = medicamentStorage.GetFullList();
|
||||
var symptomes = symptomStorage.GetFullList();
|
||||
var list = new List<ReportProceduresViewModel>();
|
||||
|
||||
foreach (var procedure in procedures)
|
||||
{
|
||||
var record = new ReportProceduresViewModel
|
||||
{
|
||||
ProcedureName = procedure.Name,
|
||||
DateStartProcedure = procedure.DateStartProcedure,
|
||||
DateStopProcedure = procedure.DateStopProcedure,
|
||||
MedicamentSymptom = new List<(string medicamentName, string symptomName)>()
|
||||
};
|
||||
foreach (var medicament in medicaments)
|
||||
{
|
||||
if (medicament.ProcedureId == procedure.Id)
|
||||
{
|
||||
foreach (var symptom in symptomes)
|
||||
{
|
||||
if (symptom.Id == medicament.SymptomId)
|
||||
{
|
||||
record.MedicamentSymptom.Add((medicament.Name, symptom.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
list.Add(record);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void SaveCoursesByProcedureToExcelFile(ReportBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SaveCoursesByProcedureToWordFile(ReportBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PolyclinicContracts\PolyclinicContracts.csproj" />
|
||||
<ProjectReference Include="..\PolyclinicDatabaseImplement\PolyclinicDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,4 +1,5 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -14,7 +15,7 @@ namespace PolyclinicContracts.BusinessLogicsContracts
|
||||
/// Получение списка компонент с указанием, в каких изделиях используются
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<ReportCoursesByProcedureViewModel> GetProcedureCourses();
|
||||
List<ReportCoursesByProcedureViewModel> GetProcedureCourses(ProcedureSearchModel model);
|
||||
/// <summary>
|
||||
/// Получение списка заказов за определенный период
|
||||
/// </summary>
|
||||
|
@ -9,9 +9,9 @@ namespace PolyclinicContracts.ViewModels
|
||||
{
|
||||
public class ReportProceduresViewModel
|
||||
{
|
||||
public int Procedure { get; set; }
|
||||
public string ProcedureName { get; set; } = string.Empty;
|
||||
public DateTime DateStartProcedure { get; set; }
|
||||
public DateTime DateStopProcedure { get; set;}
|
||||
public DateTime? DateStopProcedure { get; set;}
|
||||
public List<(string medicamentName, string symptomName)> MedicamentSymptom { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user