вливаю всё, что было создано на 5, 6, 7 этапах в ветку main #12
@ -3,7 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34714.143
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PolyclinicView", "PolyclinicView\PolyclinicView.csproj", "{D45F3F15-39D7-416B-882F-517D479E8BBC}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolyclinicDataModels", "PolyclinicDataModels\PolyclinicDataModels.csproj", "{4270CD59-76A0-4011-8A30-284FE5F75C26}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolyclinicContracts", "PolyclinicContracts\PolyclinicContracts.csproj", "{83EF9483-CD78-4C56-9848-C0A8325FEB41}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolyclinicDatabaseImplement", "PolyclinicDatabaseImplement\PolyclinicDatabaseImplement.csproj", "{E1C0ECAB-93C0-4364-B920-456F2CAA31C5}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolyclinicBusinessLogic", "PolyclinicBusinessLogic\PolyclinicBusinessLogic.csproj", "{E3BCC45F-09E7-4E60-A662-8FAB01B25885}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolyclinicWebAppImplementer", "PolyclinicWebAppImplementer\PolyclinicWebAppImplementer.csproj", "{F7058962-2A56-434D-A0DF-6B2F3C9DD8DF}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolyclinicWebAppSuretor", "PolyclinicWebAppSuretor\PolyclinicWebAppSuretor.csproj", "{1247F34E-E27A-4653-9BEC-BC5CE5FB216A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -11,10 +21,30 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D45F3F15-39D7-416B-882F-517D479E8BBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D45F3F15-39D7-416B-882F-517D479E8BBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D45F3F15-39D7-416B-882F-517D479E8BBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D45F3F15-39D7-416B-882F-517D479E8BBC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4270CD59-76A0-4011-8A30-284FE5F75C26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4270CD59-76A0-4011-8A30-284FE5F75C26}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4270CD59-76A0-4011-8A30-284FE5F75C26}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4270CD59-76A0-4011-8A30-284FE5F75C26}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{83EF9483-CD78-4C56-9848-C0A8325FEB41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{83EF9483-CD78-4C56-9848-C0A8325FEB41}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{83EF9483-CD78-4C56-9848-C0A8325FEB41}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{83EF9483-CD78-4C56-9848-C0A8325FEB41}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E1C0ECAB-93C0-4364-B920-456F2CAA31C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E1C0ECAB-93C0-4364-B920-456F2CAA31C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E1C0ECAB-93C0-4364-B920-456F2CAA31C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E1C0ECAB-93C0-4364-B920-456F2CAA31C5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E3BCC45F-09E7-4E60-A662-8FAB01B25885}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E3BCC45F-09E7-4E60-A662-8FAB01B25885}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E3BCC45F-09E7-4E60-A662-8FAB01B25885}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E3BCC45F-09E7-4E60-A662-8FAB01B25885}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F7058962-2A56-434D-A0DF-6B2F3C9DD8DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F7058962-2A56-434D-A0DF-6B2F3C9DD8DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F7058962-2A56-434D-A0DF-6B2F3C9DD8DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F7058962-2A56-434D-A0DF-6B2F3C9DD8DF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1247F34E-E27A-4653-9BEC-BC5CE5FB216A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1247F34E-E27A-4653-9BEC-BC5CE5FB216A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1247F34E-E27A-4653-9BEC-BC5CE5FB216A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1247F34E-E27A-4653-9BEC-BC5CE5FB216A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
105
Polyclinic/PolyclinicBusinessLogic/BusinessLogics/CourseLogic.cs
Normal file
105
Polyclinic/PolyclinicBusinessLogic/BusinessLogics/CourseLogic.cs
Normal file
@ -0,0 +1,105 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.BusinessLogicsContracts;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class CourseLogic : ICourseLogic
|
||||
{
|
||||
private ILogger _logger;
|
||||
private ICourseStorage _courseStorage;
|
||||
|
||||
public CourseLogic(ILogger logger, ICourseStorage courseStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_courseStorage = courseStorage;
|
||||
}
|
||||
|
||||
public bool Create(CourseBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_courseStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(CourseBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_courseStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public CourseViewModel? ReadElement(CourseSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Id:{Id}", model.Id);
|
||||
var element = _courseStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<CourseViewModel>? ReadList(CourseSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Id:{Id}", model?.Id);
|
||||
var list = model == null ? _courseStorage.GetFullList() : _courseStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool Update(CourseBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_courseStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(CourseBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (model.DaysCount < 1)
|
||||
{
|
||||
throw new ArgumentNullException("Количество дней приема должно быть больше нуля", nameof(model.DaysCount));
|
||||
}
|
||||
if (model.PillsPerDay < 1)
|
||||
{
|
||||
throw new ArgumentNullException("Количество препарата в день должно быть больше нуля", nameof(model.PillsPerDay));
|
||||
}
|
||||
_logger.LogInformation("Course. Id: {Id}", model.Id);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.BusinessLogicsContracts;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class DiagnoseLogic : IDiagnoseLogic
|
||||
{
|
||||
private ILogger _logger;
|
||||
private IDiagnoseStorage _diagnoseStorage;
|
||||
|
||||
public DiagnoseLogic(ILogger logger, IDiagnoseStorage diagnoseStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_diagnoseStorage = diagnoseStorage;
|
||||
}
|
||||
|
||||
public bool Create(DiagnoseBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_diagnoseStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(DiagnoseBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Name:{Name}, Id:{Id}", model.Name, model.Id);
|
||||
if (_diagnoseStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public DiagnoseViewModel? ReadElement(DiagnoseSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Name:{Name}, Id:{Id}, UserId:{UserId}", model.Name, model.Id, model.UserId);
|
||||
var element = _diagnoseStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Name:{Name}, Id:{Id}, UserId:{UserId}", element.Name, element.Id, element.UserId);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<DiagnoseViewModel>? ReadList(DiagnoseSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Name:{Name} Id:{Id}, UserId:{UserId}", model?.Name, model?.Id, model?.UserId);
|
||||
var list = model == null ? _diagnoseStorage.GetFullList() : _diagnoseStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool Update(DiagnoseBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_diagnoseStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(DiagnoseBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия болезни", nameof(model.Name));
|
||||
}
|
||||
_logger.LogInformation("Diagnose. Name:{Name}. Id: {Id}", model.Name, model.Id);
|
||||
var element = _diagnoseStorage.GetElement(new DiagnoseSearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Болезнь с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.BusinessLogicsContracts;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class MedicamentLogic : IMedicamentLogic
|
||||
{
|
||||
private readonly ILogger logger;
|
||||
private readonly IMedicamentStorage medicamentStorage;
|
||||
|
||||
public MedicamentLogic(ILogger<MedicamentLogic> logger, IMedicamentStorage medicamentStorage)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.medicamentStorage = medicamentStorage;
|
||||
}
|
||||
public bool Create(MedicamentBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if(medicamentStorage.Insert(model) == null)
|
||||
{
|
||||
logger.LogWarning("Create operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(MedicamentBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
if (medicamentStorage.Delete(model) == null)
|
||||
{
|
||||
logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
return true;
|
||||
}
|
||||
|
||||
public MedicamentViewModel? ReadElement(MedicamentSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
logger.LogInformation("ReadElement. MedicamentName:{Name}.Id:{ Id}", model.Name, model.Id);
|
||||
var element = medicamentStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<MedicamentViewModel>? ReadList(MedicamentSearchModel? model)
|
||||
{
|
||||
logger.LogInformation("ReadList. Name:{Name}. Id:{ Id}", model?.Name, model?.Id);
|
||||
var list = model == null ? medicamentStorage.GetFullList() : medicamentStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool Update(MedicamentBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (medicamentStorage.Update(model) == null)
|
||||
{
|
||||
logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(MedicamentBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (model.SymptomId <= 0)
|
||||
{
|
||||
throw new ArgumentNullException("Какой-то неправильный идентификатор симптома...", nameof(model));
|
||||
}
|
||||
if (model.ProcedureId <= 0)
|
||||
{
|
||||
throw new ArgumentNullException("Какой-то неправильный идентификатор процедуры...", nameof(model));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Comment))
|
||||
{
|
||||
throw new ArgumentNullException("Нет комментария", nameof(model.Comment));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия у препарата", nameof(model.Comment));
|
||||
}
|
||||
|
||||
var element = medicamentStorage.GetElement(new MedicamentSearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
});
|
||||
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Препарат с таким названием уже есть");
|
||||
}
|
||||
|
||||
logger.LogInformation("Medicament. Comment:{Comment}. Id: { Id}", model.Comment, model.Id);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.BusinessLogicsContracts;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ProcedureLogic : IProcedureLogic
|
||||
{
|
||||
|
||||
private readonly ILogger logger;
|
||||
private readonly IProcedureStorage procedureStorage;
|
||||
|
||||
public ProcedureLogic(ILogger<ProcedureLogic> logger, IProcedureStorage procedureStorage)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.procedureStorage = procedureStorage;
|
||||
}
|
||||
public bool Create(ProcedureBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (procedureStorage.Insert(model) == null)
|
||||
{
|
||||
logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(ProcedureBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
|
||||
logger.LogInformation("Delete Id:{Id}", model.Id);
|
||||
if(procedureStorage.Delete(model) == null)
|
||||
{
|
||||
logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public ProcedureViewModel? ReadElement(ProcedureSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
logger.LogInformation("ReadElement. ProcedureName:{ProcedureName}.Id:{ Id}", model.Name, model.Id);
|
||||
var element = procedureStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<ProcedureViewModel>? ReadList(ProcedureSearchModel? model)
|
||||
{
|
||||
logger.LogInformation("ReadList. Name:{Name}. Id:{ Id}", model?.Name, model?.Id);
|
||||
var list = model == null ? procedureStorage.GetFullList() : procedureStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool Update(ProcedureBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (procedureStorage.Update(model) == null)
|
||||
{
|
||||
logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(ProcedureBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия процедуры", nameof(model.Name));
|
||||
}
|
||||
logger.LogInformation("Procedure. Name:{Name}. Id: { Id}", model.Name, model.Id);
|
||||
|
||||
var element = procedureStorage.GetElement(new ProcedureSearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
});
|
||||
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Процедура с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
106
Polyclinic/PolyclinicBusinessLogic/BusinessLogics/RecipeLogic.cs
Normal file
106
Polyclinic/PolyclinicBusinessLogic/BusinessLogics/RecipeLogic.cs
Normal file
@ -0,0 +1,106 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.BusinessLogicsContracts;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class RecipeLogic : IRecipeLogic
|
||||
{
|
||||
|
||||
private readonly ILogger logger;
|
||||
private readonly IRecipeStorage recipeStorage;
|
||||
|
||||
public RecipeLogic(ILogger<RecipeLogic> logger, IRecipeStorage recipeStorage)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.recipeStorage = recipeStorage;
|
||||
}
|
||||
public bool Create(RecipeBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if(recipeStorage.Insert(model) == null)
|
||||
{
|
||||
logger.LogWarning("Create operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(RecipeBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
if(recipeStorage.Delete(model) == null)
|
||||
{
|
||||
logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
logger.LogInformation("Delete Id:{Id}", model.Id);
|
||||
return true;
|
||||
}
|
||||
|
||||
public RecipeViewModel? ReadElement(RecipeSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
logger.LogInformation("ReadElement. Comment:{Comment}.Id:{ Id}", model.Comment, model.Id);
|
||||
var element = recipeStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<RecipeViewModel>? ReadList(RecipeSearchModel? model)
|
||||
{
|
||||
logger.LogInformation("ReadList. Comment:{Comment}. Id:{ Id}", model?.Comment, model?.Id);
|
||||
var list = model == null ? recipeStorage.GetFullList() : recipeStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool Update(RecipeBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if(recipeStorage.Update(model) == null)
|
||||
{
|
||||
logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(RecipeBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(model.ProceduresCount <= 0)
|
||||
{
|
||||
throw new ArgumentNullException("Количество процедур не может быть равно нулю или быть меньше нуля", nameof(model));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Comment))
|
||||
{
|
||||
throw new ArgumentNullException("Нет комментария", nameof(model.Comment));
|
||||
}
|
||||
logger.LogInformation("Recipe. Comment:{Comment}. Id: { Id}", model.Comment, model.Id);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.BusinessLogicsContracts;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class SymptomLogic : ISymptomLogic
|
||||
{
|
||||
private ILogger _logger;
|
||||
private ISymptomStorage _symptomStorage;
|
||||
|
||||
public SymptomLogic(ILogger logger, ISymptomStorage symptomStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_symptomStorage = symptomStorage;
|
||||
}
|
||||
|
||||
public bool Create(SymptomBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_symptomStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(SymptomBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Name:{Name}, Id:{Id}", model.Name, model.Id);
|
||||
if (_symptomStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public SymptomViewModel? ReadElement(SymptomSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Name:{Name}, Id:{Id}", model.Name, model.Id);
|
||||
var element = _symptomStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Name:{Name}, Id:{Id}", element.Name, element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<SymptomViewModel>? ReadList(SymptomSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Name:{Name} Id:{Id}", model?.Name, model?.Id);
|
||||
var list = model == null ? _symptomStorage.GetFullList() : _symptomStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool Update(SymptomBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_symptomStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(SymptomBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия симптома", nameof(model.Name));
|
||||
}
|
||||
_logger.LogInformation("Symptom. Name:{Name}. Id: {Id}", model.Name, model.Id);
|
||||
var element = _symptomStorage.GetElement(new SymptomSearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Симптом с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
Polyclinic/PolyclinicBusinessLogic/BusinessLogics/UserLogic.cs
Normal file
117
Polyclinic/PolyclinicBusinessLogic/BusinessLogics/UserLogic.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.BusinessLogicsContracts;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class UserLogic : IUserLogic
|
||||
{
|
||||
private ILogger _logger;
|
||||
private IUserStorage _userStorage;
|
||||
|
||||
public UserLogic(ILogger logger, IUserStorage userStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_userStorage = userStorage;
|
||||
}
|
||||
|
||||
public bool Create(UserBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_userStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(UserBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_userStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public UserViewModel? ReadElement(UserSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Email:{Email}. Id:{Id}", model.Email, model.Id);
|
||||
var element = _userStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<UserViewModel>? ReadList(UserSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Email:{Email}. Id:{Id}", model?.Email, model?.Id);
|
||||
var list = model == null ? _userStorage.GetFullList() : _userStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool Update(UserBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_userStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(UserBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Email))
|
||||
{
|
||||
throw new ArgumentNullException("Нет email пользователя", nameof(model.Email));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
throw new ArgumentNullException("Нет пароля пользователя", nameof(model.Password));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.FIO))
|
||||
{
|
||||
throw new ArgumentNullException("Нет фио пользователя", nameof(model.FIO));
|
||||
}
|
||||
_logger.LogInformation("User. Email:{Email}. Id: {Id}", model.Email, model.Id);
|
||||
var element = _userStorage.GetElement(new UserSearchModel
|
||||
{
|
||||
Email = model.Email
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Пользователь с таким email уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PolyclinicContracts\PolyclinicContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,13 @@
|
||||
using PolyclinicDataModels.Models;
|
||||
|
||||
namespace PolyclinicContracts.BindingModels
|
||||
{
|
||||
public class CourseBindingModel : ICourseModel
|
||||
{
|
||||
public int DaysCount { get; set; }
|
||||
public int PillsPerDay { get; set; }
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
public Dictionary<int, IDiagnoseModel> CourseDiagnoses { get; set; } = new();
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using PolyclinicDataModels.Models;
|
||||
|
||||
namespace PolyclinicContracts.BindingModels
|
||||
{
|
||||
public class DiagnoseBindingModel : IDiagnoseModel
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
public int UserId { get; set; }
|
||||
public int Id { get; set; }
|
||||
public DateTime DateStartDiagnose { get; }
|
||||
public DateTime? DateStopDiagnose { get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using PolyclinicDataModels.Models;
|
||||
|
||||
namespace PolyclinicContracts.BindingModels
|
||||
{
|
||||
public class MedicamentBindingModel : IMedicamentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int? SymptomId { get; set; }
|
||||
public int ProcedureId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using PolyclinicDataModels.Models;
|
||||
|
||||
namespace PolyclinicContracts.BindingModels
|
||||
{
|
||||
public class ProcedureBindingModel : IProcedureModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int UserId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
public DateTime DateStartProcedure { get; set; } = DateTime.Now;
|
||||
public DateTime? DateStopProcedure { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using PolyclinicDataModels.Models;
|
||||
|
||||
namespace PolyclinicContracts.BindingModels
|
||||
{
|
||||
public class RecipeBindingModel : IRecipeModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int? CourseId { get; set; }
|
||||
public int ProceduresCount { get; set; }
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
public Dictionary<int, IProcedureModel> RecipeProcedures { get; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using PolyclinicDataModels.Models;
|
||||
|
||||
namespace PolyclinicContracts.BindingModels
|
||||
{
|
||||
public class SymptomBindingModel : ISymptomModel
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
public Dictionary<int, IDiagnoseModel> SymptomDiagnoses { get; set; } = new();
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using PolyclinicDataModels.Enums;
|
||||
using PolyclinicDataModels.Models;
|
||||
|
||||
namespace PolyclinicContracts.BindingModels
|
||||
{
|
||||
public class UserBindingModel : IUserModel
|
||||
{
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public UserRole Role { get; set; } = UserRole.Неизвестный;
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface ICourseLogic
|
||||
{
|
||||
List<CourseViewModel>? ReadList(CourseSearchModel? model);
|
||||
CourseViewModel? ReadElement(CourseSearchModel model);
|
||||
bool Create(CourseBindingModel model);
|
||||
bool Update(CourseBindingModel model);
|
||||
bool Delete(CourseBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IDiagnoseLogic
|
||||
{
|
||||
List<DiagnoseViewModel>? ReadList(DiagnoseSearchModel? model);
|
||||
DiagnoseViewModel? ReadElement(DiagnoseSearchModel model);
|
||||
bool Create(DiagnoseBindingModel model);
|
||||
bool Update(DiagnoseBindingModel model);
|
||||
bool Delete(DiagnoseBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IMedicamentLogic
|
||||
{
|
||||
List<MedicamentViewModel>? ReadList(MedicamentSearchModel? model);
|
||||
MedicamentViewModel? ReadElement(MedicamentSearchModel model);
|
||||
bool Create(MedicamentBindingModel model);
|
||||
bool Update(MedicamentBindingModel model);
|
||||
bool Delete(MedicamentBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IProcedureLogic
|
||||
{
|
||||
List<ProcedureViewModel>? ReadList(ProcedureSearchModel? model);
|
||||
ProcedureViewModel? ReadElement(ProcedureSearchModel model);
|
||||
bool Create(ProcedureBindingModel model);
|
||||
bool Update(ProcedureBindingModel model);
|
||||
bool Delete(ProcedureBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IRecipeLogic
|
||||
{
|
||||
List<RecipeViewModel>? ReadList(RecipeSearchModel? model);
|
||||
RecipeViewModel? ReadElement(RecipeSearchModel model);
|
||||
bool Create(RecipeBindingModel model);
|
||||
bool Update(RecipeBindingModel model);
|
||||
bool Delete(RecipeBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface ISymptomLogic
|
||||
{
|
||||
List<SymptomViewModel>? ReadList(SymptomSearchModel? model);
|
||||
SymptomViewModel? ReadElement(SymptomSearchModel model);
|
||||
bool Create(SymptomBindingModel model);
|
||||
bool Update(SymptomBindingModel model);
|
||||
bool Delete(SymptomBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IUserLogic
|
||||
{
|
||||
List<UserViewModel>? ReadList(UserSearchModel? model);
|
||||
UserViewModel? ReadElement(UserSearchModel model);
|
||||
bool Create(UserBindingModel model);
|
||||
bool Update(UserBindingModel model);
|
||||
bool Delete(UserBindingModel model);
|
||||
}
|
||||
}
|
13
Polyclinic/PolyclinicContracts/PolyclinicContracts.csproj
Normal file
13
Polyclinic/PolyclinicContracts/PolyclinicContracts.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PolyclinicDataModels\PolyclinicDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,7 @@
|
||||
namespace PolyclinicContracts.SearchModels
|
||||
{
|
||||
public class CourseSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
namespace PolyclinicContracts.SearchModels
|
||||
{
|
||||
public class DiagnoseSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
public DateTime? From { get; }
|
||||
public DateTime? To { get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace PolyclinicContracts.SearchModels
|
||||
{
|
||||
public class MedicamentSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
namespace PolyclinicContracts.SearchModels
|
||||
{
|
||||
public class ProcedureSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public DateTime? From { get; set; }
|
||||
public DateTime? To { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace PolyclinicContracts.SearchModels
|
||||
{
|
||||
public class RecipeSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Comment { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace PolyclinicContracts.SearchModels
|
||||
{
|
||||
public class SymptomSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string?Name { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace PolyclinicContracts.SearchModels
|
||||
{
|
||||
public class UserSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicContracts.StoragesContracts
|
||||
{
|
||||
public interface ICourseStorage
|
||||
{
|
||||
List<CourseViewModel> GetFullList();
|
||||
List<CourseViewModel> GetFilteredList(CourseSearchModel model);
|
||||
CourseViewModel? GetElement(CourseSearchModel model);
|
||||
CourseViewModel? Insert(CourseBindingModel model);
|
||||
CourseViewModel? Update(CourseBindingModel model);
|
||||
CourseViewModel? Delete(CourseBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicContracts.StoragesContracts
|
||||
{
|
||||
public interface IDiagnoseStorage
|
||||
{
|
||||
List<DiagnoseViewModel> GetFullList();
|
||||
List<DiagnoseViewModel> GetFilteredList(DiagnoseSearchModel model);
|
||||
DiagnoseViewModel? GetElement(DiagnoseSearchModel model);
|
||||
DiagnoseViewModel? Insert(DiagnoseBindingModel model);
|
||||
DiagnoseViewModel? Update(DiagnoseBindingModel model);
|
||||
DiagnoseViewModel? Delete(DiagnoseBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicContracts.StoragesContracts
|
||||
{
|
||||
public interface IMedicamentStorage
|
||||
{
|
||||
List<MedicamentViewModel> GetFullList();
|
||||
List<MedicamentViewModel> GetFilteredList(MedicamentSearchModel model);
|
||||
MedicamentViewModel? GetElement(MedicamentSearchModel model);
|
||||
MedicamentViewModel? Insert(MedicamentBindingModel model);
|
||||
MedicamentViewModel? Update(MedicamentBindingModel model);
|
||||
MedicamentViewModel? Delete(MedicamentBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicContracts.StoragesContracts
|
||||
{
|
||||
public interface IProcedureStorage
|
||||
{
|
||||
List<ProcedureViewModel> GetFullList();
|
||||
List<ProcedureViewModel> GetFilteredList(ProcedureSearchModel model);
|
||||
ProcedureViewModel? GetElement(ProcedureSearchModel model);
|
||||
ProcedureViewModel? Insert(ProcedureBindingModel model);
|
||||
ProcedureViewModel? Update(ProcedureBindingModel model);
|
||||
ProcedureViewModel? Delete(ProcedureBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicContracts.StoragesContracts
|
||||
{
|
||||
public interface IRecipeStorage
|
||||
{
|
||||
List<RecipeViewModel> GetFullList();
|
||||
List<RecipeViewModel> GetFilteredList(RecipeSearchModel model);
|
||||
RecipeViewModel? GetElement(RecipeSearchModel model);
|
||||
RecipeViewModel? Insert(RecipeBindingModel model);
|
||||
RecipeViewModel? Update(RecipeBindingModel model);
|
||||
RecipeViewModel? Delete(RecipeBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicContracts.StoragesContracts
|
||||
{
|
||||
public interface ISymptomStorage
|
||||
{
|
||||
List<SymptomViewModel> GetFullList();
|
||||
List<SymptomViewModel> GetFilteredList(SymptomSearchModel model);
|
||||
SymptomViewModel? GetElement(SymptomSearchModel model);
|
||||
SymptomViewModel? Insert(SymptomBindingModel model);
|
||||
SymptomViewModel? Update(SymptomBindingModel model);
|
||||
SymptomViewModel? Delete(SymptomBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
|
||||
namespace PolyclinicContracts.StoragesContracts
|
||||
{
|
||||
public interface IUserStorage
|
||||
{
|
||||
List<UserViewModel> GetFullList();
|
||||
List<UserViewModel> GetFilteredList(UserSearchModel model);
|
||||
UserViewModel? GetElement(UserSearchModel model);
|
||||
UserViewModel? Insert(UserBindingModel model);
|
||||
UserViewModel? Update(UserBindingModel model);
|
||||
UserViewModel? Delete(UserBindingModel model);
|
||||
}
|
||||
}
|
17
Polyclinic/PolyclinicContracts/ViewModels/CourseViewModel.cs
Normal file
17
Polyclinic/PolyclinicContracts/ViewModels/CourseViewModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using PolyclinicDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace PolyclinicContracts.ViewModels
|
||||
{
|
||||
public class CourseViewModel : ICourseModel
|
||||
{
|
||||
[DisplayName("Количество дней курса")]
|
||||
public int DaysCount { get; set; }
|
||||
[DisplayName("Препарата в день")]
|
||||
public int PillsPerDay { get; set; }
|
||||
[DisplayName("Комментарий")]
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
public Dictionary<int, IDiagnoseModel> CourseDiagnoses { get; set; } = new();
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using PolyclinicDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace PolyclinicContracts.ViewModels
|
||||
{
|
||||
public class DiagnoseViewModel : IDiagnoseModel
|
||||
{
|
||||
[DisplayName("Название")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Комментарий")]
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата 'от'")]
|
||||
public DateTime DateStartDiagnose { get; set; }
|
||||
|
||||
[DisplayName("Дата 'до'")]
|
||||
public DateTime? DateStopDiagnose { get; set; }
|
||||
public int UserId { get; set; }
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using PolyclinicDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace PolyclinicContracts.ViewModels
|
||||
{
|
||||
public class MedicamentViewModel : IMedicamentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int ProcedureId { get; set; }
|
||||
public int? SymptomId { get; set; }
|
||||
[DisplayName("Название медикамента")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DisplayName("Комментарий")]
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using PolyclinicDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace PolyclinicContracts.ViewModels
|
||||
{
|
||||
public class ProcedureViewModel : IProcedureModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int UserId { get; set; }
|
||||
|
||||
[DisplayName("Название процедуры")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Комментарий")]
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата 'от'")]
|
||||
public DateTime DateStartProcedure { get; set; } = DateTime.Now;
|
||||
|
||||
[DisplayName("Дата 'до'")]
|
||||
public DateTime? DateStopProcedure { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
18
Polyclinic/PolyclinicContracts/ViewModels/RecipeViewModel.cs
Normal file
18
Polyclinic/PolyclinicContracts/ViewModels/RecipeViewModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using PolyclinicDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace PolyclinicContracts.ViewModels
|
||||
{
|
||||
public class RecipeViewModel : IRecipeModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Количество процедур")]
|
||||
public int ProceduresCount { get; set; }
|
||||
|
||||
[DisplayName("Комментарий")]
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
public int? CourseId { get; set; }
|
||||
public Dictionary<int, IProcedureModel> RecipeProcedures { get; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using PolyclinicDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace PolyclinicContracts.ViewModels
|
||||
{
|
||||
public class SymptomViewModel : ISymptomModel
|
||||
{
|
||||
[DisplayName("Название")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DisplayName("Комментарий")]
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
public Dictionary<int, IDiagnoseModel> SymptomDiagnoses { get; set; } = new();
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
19
Polyclinic/PolyclinicContracts/ViewModels/UserViewModel.cs
Normal file
19
Polyclinic/PolyclinicContracts/ViewModels/UserViewModel.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using PolyclinicDataModels.Enums;
|
||||
using PolyclinicDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace PolyclinicContracts.ViewModels
|
||||
{
|
||||
public class UserViewModel : IUserModel
|
||||
{
|
||||
[DisplayName("ФИО")]
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
[DisplayName("Email")]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[DisplayName("Роль")]
|
||||
public UserRole Role { get; set; } = UserRole.Неизвестный;
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
11
Polyclinic/PolyclinicDataModels/Enums/UserRole.cs
Normal file
11
Polyclinic/PolyclinicDataModels/Enums/UserRole.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace PolyclinicDataModels.Enums
|
||||
{
|
||||
public enum UserRole
|
||||
{
|
||||
Неизвестный = -1,
|
||||
Администратор = 0,
|
||||
Исполнитель = 1,
|
||||
Поручитель = 2,
|
||||
Клиент = 3
|
||||
}
|
||||
}
|
7
Polyclinic/PolyclinicDataModels/IId.cs
Normal file
7
Polyclinic/PolyclinicDataModels/IId.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace PolyclinicDataModels
|
||||
{
|
||||
public interface IId
|
||||
{
|
||||
int Id { get; }
|
||||
}
|
||||
}
|
10
Polyclinic/PolyclinicDataModels/Models/ICourseModel.cs
Normal file
10
Polyclinic/PolyclinicDataModels/Models/ICourseModel.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace PolyclinicDataModels.Models
|
||||
{
|
||||
public interface ICourseModel : IId
|
||||
{
|
||||
int DaysCount { get; }
|
||||
int PillsPerDay { get; }
|
||||
string Comment { get; }
|
||||
Dictionary<int, IDiagnoseModel> CourseDiagnoses { get; }
|
||||
}
|
||||
}
|
11
Polyclinic/PolyclinicDataModels/Models/IDiagnoseModel.cs
Normal file
11
Polyclinic/PolyclinicDataModels/Models/IDiagnoseModel.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace PolyclinicDataModels.Models
|
||||
{
|
||||
public interface IDiagnoseModel : IId
|
||||
{
|
||||
string Name { get; }
|
||||
string Comment { get; }
|
||||
int UserId { get; }
|
||||
DateTime DateStartDiagnose { get; }
|
||||
DateTime? DateStopDiagnose { get; }
|
||||
}
|
||||
}
|
10
Polyclinic/PolyclinicDataModels/Models/IMedicamentModel.cs
Normal file
10
Polyclinic/PolyclinicDataModels/Models/IMedicamentModel.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace PolyclinicDataModels.Models
|
||||
{
|
||||
public interface IMedicamentModel : IId
|
||||
{
|
||||
string Name { get; }
|
||||
string Comment { get; }
|
||||
int ProcedureId { get; }
|
||||
int? SymptomId { get; }
|
||||
}
|
||||
}
|
11
Polyclinic/PolyclinicDataModels/Models/IProcedureModel.cs
Normal file
11
Polyclinic/PolyclinicDataModels/Models/IProcedureModel.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace PolyclinicDataModels.Models
|
||||
{
|
||||
public interface IProcedureModel : IId
|
||||
{
|
||||
string Name { get; }
|
||||
string Comment { get; }
|
||||
int UserId { get; }
|
||||
DateTime DateStartProcedure { get; }
|
||||
DateTime? DateStopProcedure { get; }
|
||||
}
|
||||
}
|
10
Polyclinic/PolyclinicDataModels/Models/IRecipeModel.cs
Normal file
10
Polyclinic/PolyclinicDataModels/Models/IRecipeModel.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace PolyclinicDataModels.Models
|
||||
{
|
||||
public interface IRecipeModel : IId
|
||||
{
|
||||
int ProceduresCount { get; set; }
|
||||
string Comment { get; set; }
|
||||
int? CourseId { get; set; }
|
||||
Dictionary<int, IProcedureModel> RecipeProcedures { get; }
|
||||
}
|
||||
}
|
9
Polyclinic/PolyclinicDataModels/Models/ISymptomModel.cs
Normal file
9
Polyclinic/PolyclinicDataModels/Models/ISymptomModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace PolyclinicDataModels.Models
|
||||
{
|
||||
public interface ISymptomModel : IId
|
||||
{
|
||||
string Name { get; }
|
||||
string Comment { get; }
|
||||
Dictionary<int, IDiagnoseModel> SymptomDiagnoses { get; }
|
||||
}
|
||||
}
|
12
Polyclinic/PolyclinicDataModels/Models/IUserModel.cs
Normal file
12
Polyclinic/PolyclinicDataModels/Models/IUserModel.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using PolyclinicDataModels.Enums;
|
||||
|
||||
namespace PolyclinicDataModels.Models
|
||||
{
|
||||
public interface IUserModel : IId
|
||||
{
|
||||
string FIO { get; }
|
||||
string Email { get; }
|
||||
string Password { get; }
|
||||
UserRole Role { get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,80 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Implements
|
||||
{
|
||||
public class CourseStorage : ICourseStorage
|
||||
{
|
||||
public CourseViewModel? Delete(CourseBindingModel model)
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
var element = context.Courses.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Courses.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public CourseViewModel? GetElement(CourseSearchModel model)
|
||||
{
|
||||
return GetFilteredList(model).FirstOrDefault();
|
||||
}
|
||||
|
||||
public List<CourseViewModel> GetFilteredList(CourseSearchModel model)
|
||||
{
|
||||
var elements = GetFullList();
|
||||
foreach (var prop in model.GetType().GetProperties())
|
||||
{
|
||||
if (model.GetType().GetProperty(prop.Name)?.GetValue(model, null) != null)
|
||||
{
|
||||
elements = elements.Where(x => x.GetType().GetProperty(prop.Name)?.GetValue(x, null) == model.GetType().GetProperty(prop.Name)?.GetValue(model, null)).ToList();
|
||||
}
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
public List<CourseViewModel> GetFullList()
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
return context.Courses
|
||||
.Include(x => x.Diagnoses)
|
||||
.ThenInclude(x => x.Diagnose)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public CourseViewModel? Insert(CourseBindingModel model)
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
var element = Course.Create(context, model);
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Courses.Add(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
|
||||
public CourseViewModel? Update(CourseBindingModel model)
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
var element = context.Courses.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
element.Update(model);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Implements
|
||||
{
|
||||
public class DiagnoseStorage : IDiagnoseStorage
|
||||
{
|
||||
public DiagnoseViewModel? Delete(DiagnoseBindingModel model)
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
var element = context.Diagnoses.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Diagnoses.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public DiagnoseViewModel? GetElement(DiagnoseSearchModel model)
|
||||
{
|
||||
return GetFilteredList(model).FirstOrDefault();
|
||||
}
|
||||
|
||||
public List<DiagnoseViewModel> GetFilteredList(DiagnoseSearchModel model)
|
||||
{
|
||||
var elements = GetFullList();
|
||||
if (model.Id != null)
|
||||
{
|
||||
elements = elements.Where(x => x.Id == model.Id.Value).ToList();
|
||||
}
|
||||
if (!model.Name.IsNullOrEmpty())
|
||||
{
|
||||
elements = elements.Where(x => x.Name == model.Name).ToList();
|
||||
}
|
||||
if (model.UserId != null)
|
||||
{
|
||||
elements = elements.Where(x => x.UserId == model.UserId.Value).ToList();
|
||||
}
|
||||
if (model.From != null)
|
||||
{
|
||||
elements = elements.Where(x => x.DateStartDiagnose >= model.From.Value).ToList();
|
||||
}
|
||||
if (model.To != null)
|
||||
{
|
||||
elements = elements.Where(x => x.DateStartDiagnose <= model.To.Value).ToList();
|
||||
|
||||
var elemWithDateStop = elements
|
||||
.Where(x => x.DateStopDiagnose != null)
|
||||
.Where(x => x.DateStopDiagnose <= model.To.Value)
|
||||
.ToList();
|
||||
|
||||
var elemWithoutDateStop = elements.Where(x => x.DateStopDiagnose == null).ToList();
|
||||
|
||||
elemWithDateStop.AddRange(elemWithoutDateStop);
|
||||
|
||||
elements = elemWithDateStop;
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
public List<DiagnoseViewModel> GetFullList()
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
return context.Diagnoses
|
||||
.Include(x => x.User)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public DiagnoseViewModel? Insert(DiagnoseBindingModel model)
|
||||
{
|
||||
var element = Diagnose.Create(model);
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new PolyclinicDatabase();
|
||||
context.Diagnoses.Add(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
|
||||
public DiagnoseViewModel? Update(DiagnoseBindingModel model)
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
var element = context.Diagnoses.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
element.Update(model);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Implements
|
||||
{
|
||||
public class MedicamentStorage : IMedicamentStorage
|
||||
{
|
||||
public List<MedicamentViewModel> GetFullList()
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
return context.Medicaments
|
||||
.Include(x => x.Symptom)
|
||||
.Include(x => x.Procedure)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<MedicamentViewModel> GetFilteredList(MedicamentSearchModel model)
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
|
||||
if (!model.Id.HasValue || !string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
return context.Medicaments
|
||||
.Where(x => x.Id == model.Id || model.Name == x.Name)
|
||||
.Include(x => x.Symptom)
|
||||
.Include(x => x.Procedure)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public MedicamentViewModel? GetElement(MedicamentSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new PolyclinicDatabase();
|
||||
return context.Medicaments
|
||||
.Include(x => x.Symptom)
|
||||
.Include(x => x.Procedure)
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?
|
||||
.GetViewModel;
|
||||
}
|
||||
|
||||
public MedicamentViewModel? Insert(MedicamentBindingModel model)
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
|
||||
var newMedicament = Medicament.Create(model);
|
||||
if(newMedicament == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Medicaments.Add(newMedicament);
|
||||
context.SaveChanges();
|
||||
return context.Medicaments
|
||||
.Include(x => x.Symptom)
|
||||
.Include(x => x.Procedure)
|
||||
.FirstOrDefault(x => x.Id == newMedicament.Id)?.GetViewModel;
|
||||
}
|
||||
|
||||
public MedicamentViewModel? Update(MedicamentBindingModel model)
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
var medicament = context.Medicaments.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (medicament == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
medicament.Update(model);
|
||||
context.SaveChanges();
|
||||
return context.Medicaments
|
||||
.Include(x => x.Symptom)
|
||||
.Include(x => x.Procedure)
|
||||
.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
public MedicamentViewModel? Delete(MedicamentBindingModel model)
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
var element = context.Medicaments.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Medicaments.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Implements
|
||||
{
|
||||
public class ProcedureStorage : IProcedureStorage
|
||||
{
|
||||
public List<ProcedureViewModel> GetFullList()
|
||||
{
|
||||
using var database = new PolyclinicDatabase();
|
||||
return database.Procedures
|
||||
.Include(p => p.User)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<ProcedureViewModel> GetFilteredList(ProcedureSearchModel model)
|
||||
{
|
||||
var elements = GetFullList();
|
||||
if (model.Id != null)
|
||||
{
|
||||
elements = elements.Where(x => x.Id == model.Id.Value).ToList();
|
||||
}
|
||||
if (model.UserId != null)
|
||||
{
|
||||
elements = elements.Where(x => x.UserId == model.UserId.Value).ToList();
|
||||
}
|
||||
if (!model.Name.IsNullOrEmpty())
|
||||
{
|
||||
elements = elements.Where(x => x.Name == model.Name).ToList();
|
||||
}
|
||||
if (model.From != null)
|
||||
{
|
||||
elements = elements.Where(x => x.DateStartProcedure >= model.From.Value).ToList();
|
||||
}
|
||||
if (model.To != null)
|
||||
{
|
||||
elements = elements.Where(x => x.DateStartProcedure <= model.To.Value).ToList();
|
||||
|
||||
var elemWithDateStop = elements
|
||||
.Where(x => x.DateStopProcedure != null)
|
||||
.Where(x => x.DateStopProcedure <= model.To.Value)
|
||||
.ToList();
|
||||
|
||||
var elemWithoutDateStop = elements.Where(x => x.DateStopProcedure == null).ToList();
|
||||
|
||||
elemWithDateStop.AddRange(elemWithoutDateStop);
|
||||
|
||||
elements = elemWithDateStop;
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
public ProcedureViewModel? GetElement(ProcedureSearchModel model)
|
||||
{
|
||||
return GetFilteredList(model).FirstOrDefault();
|
||||
}
|
||||
|
||||
public ProcedureViewModel? Insert(ProcedureBindingModel model)
|
||||
{
|
||||
using var database = new PolyclinicDatabase();
|
||||
var newProcedure = Procedure.Create(model);
|
||||
if (newProcedure == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
database.Procedures.Add(newProcedure);
|
||||
database.SaveChanges();
|
||||
return newProcedure.GetViewModel;
|
||||
}
|
||||
public ProcedureViewModel? Update(ProcedureBindingModel model)
|
||||
{
|
||||
using var database = new PolyclinicDatabase();
|
||||
var procedure = database.Procedures.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (procedure == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
procedure.Update(model);
|
||||
database.SaveChanges();
|
||||
return procedure.GetViewModel;
|
||||
}
|
||||
public ProcedureViewModel? Delete(ProcedureBindingModel model)
|
||||
{
|
||||
using var database = new PolyclinicDatabase();
|
||||
var element = database.Procedures
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
database.Procedures.Remove(element);
|
||||
database.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Implements
|
||||
{
|
||||
public class RecipeStorage : IRecipeStorage
|
||||
{
|
||||
public List<RecipeViewModel> GetFullList()
|
||||
{
|
||||
using var database = new PolyclinicDatabase();
|
||||
return database.Recipes
|
||||
.Include(x => x.Course)
|
||||
.Include(x => x.Procedures)
|
||||
.ThenInclude(x => x.Procedure)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<RecipeViewModel> GetFilteredList(RecipeSearchModel bindingModel)
|
||||
{
|
||||
if (!bindingModel.Id.HasValue || string.IsNullOrEmpty(bindingModel.Comment))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var database = new PolyclinicDatabase();
|
||||
return database.Recipes
|
||||
.Include(x => x.Procedures)
|
||||
.ThenInclude(x => x.Procedure)
|
||||
.Where(x => x.Comment.Contains(bindingModel.Comment))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public RecipeViewModel? GetElement(RecipeSearchModel bindingModel)
|
||||
{
|
||||
if (!bindingModel.Id.HasValue || string.IsNullOrEmpty(bindingModel.Comment))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var database = new PolyclinicDatabase();
|
||||
return database.Recipes
|
||||
.Include(x => x.Procedures)
|
||||
.ThenInclude(x => x.Procedure)
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(bindingModel.Comment) &&
|
||||
x.Comment == bindingModel.Comment) ||
|
||||
(bindingModel.Id.HasValue && x.Id == bindingModel.Id))?
|
||||
.GetViewModel;
|
||||
}
|
||||
|
||||
public RecipeViewModel? Insert(RecipeBindingModel bindingModel)
|
||||
{
|
||||
using var database = new PolyclinicDatabase();
|
||||
var newRecipe = Recipe.Create(database, bindingModel);
|
||||
if (newRecipe == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
database.Recipes.Add(newRecipe);
|
||||
database.SaveChanges();
|
||||
return newRecipe.GetViewModel;
|
||||
}
|
||||
|
||||
public RecipeViewModel? Update(RecipeBindingModel bindingModel)
|
||||
{
|
||||
using var database = new PolyclinicDatabase();
|
||||
using var transaction = database.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var Recipe = database.Recipes.FirstOrDefault(rec => rec.Id == bindingModel.Id);
|
||||
if (Recipe == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Recipe.Update(bindingModel);
|
||||
database.SaveChanges();
|
||||
Recipe.UpdateProcedures(database, bindingModel);
|
||||
transaction.Commit();
|
||||
return Recipe.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public RecipeViewModel? Delete(RecipeBindingModel bindingModel)
|
||||
{
|
||||
using var database = new PolyclinicDatabase();
|
||||
var recipe = database.Recipes
|
||||
.Include(x => x.Procedures)
|
||||
.FirstOrDefault(x => x.Id == bindingModel.Id);
|
||||
if (recipe == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
database.Recipes.Remove(recipe);
|
||||
database.SaveChanges();
|
||||
return recipe.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Implements
|
||||
{
|
||||
public class SymptomStorage : ISymptomStorage
|
||||
{
|
||||
public SymptomViewModel? Delete(SymptomBindingModel model)
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
var element = context.Symptomes.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Symptomes.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public SymptomViewModel? GetElement(SymptomSearchModel model)
|
||||
{
|
||||
return GetFilteredList(model).FirstOrDefault();
|
||||
}
|
||||
|
||||
public List<SymptomViewModel> GetFilteredList(SymptomSearchModel model)
|
||||
{
|
||||
var elements = GetFullList();
|
||||
foreach (var prop in model.GetType().GetProperties())
|
||||
{
|
||||
if (model.GetType().GetProperty(prop.Name)?.GetValue(model, null) != null)
|
||||
{
|
||||
elements = elements.Where(x => x.GetType().GetProperty(prop.Name)?.GetValue(x, null) == model.GetType().GetProperty(prop.Name)?.GetValue(model, null)).ToList();
|
||||
}
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
public List<SymptomViewModel> GetFullList()
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
return context.Symptomes
|
||||
.Include(x => x.Diagnoses)
|
||||
.ThenInclude(x => x.Diagnose)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public SymptomViewModel? Insert(SymptomBindingModel model)
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
var element = Symptom.Create(context, model);
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Symptomes.Add(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
|
||||
public SymptomViewModel? Update(SymptomBindingModel model)
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
var element = context.Symptomes.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
element.Update(model);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.SearchModels;
|
||||
using PolyclinicContracts.StoragesContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Implements
|
||||
{
|
||||
public class UserStorage : IUserStorage
|
||||
{
|
||||
public UserViewModel? Delete(UserBindingModel model)
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
var element = context.Users.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Users.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public UserViewModel? GetElement(UserSearchModel model)
|
||||
{
|
||||
return GetFilteredList(model).FirstOrDefault();
|
||||
}
|
||||
|
||||
public List<UserViewModel> GetFilteredList(UserSearchModel model)
|
||||
{
|
||||
var elements = GetFullList();
|
||||
foreach (var prop in model.GetType().GetProperties())
|
||||
{
|
||||
if (model.GetType().GetProperty(prop.Name)?.GetValue(model, null) != null)
|
||||
{
|
||||
elements = elements.Where(x => x.GetType().GetProperty(prop.Name)?.GetValue(x, null) == model.GetType().GetProperty(prop.Name)?.GetValue(model, null)).ToList();
|
||||
}
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
public List<UserViewModel> GetFullList()
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
return context.Users.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public UserViewModel? Insert(UserBindingModel model)
|
||||
{
|
||||
var element = User.Create(model);
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new PolyclinicDatabase();
|
||||
context.Users.Add(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
|
||||
public UserViewModel? Update(UserBindingModel model)
|
||||
{
|
||||
using var context = new PolyclinicDatabase();
|
||||
var element = context.Users.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
element.Update(model);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
456
Polyclinic/PolyclinicDatabaseImplement/Migrations/20240501145526_Init-Create.Designer.cs
generated
Normal file
456
Polyclinic/PolyclinicDatabaseImplement/Migrations/20240501145526_Init-Create.Designer.cs
generated
Normal file
@ -0,0 +1,456 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(PolyclinicDatabase))]
|
||||
[Migration("20240501145526_Init-Create")]
|
||||
partial class InitCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.16")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Course", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DaysCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PillsPerDay")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Courses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.CourseDiagnose", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CourseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DiagnoseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CourseId");
|
||||
|
||||
b.HasIndex("DiagnoseId");
|
||||
|
||||
b.ToTable("CourseDiagnoses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Diagnose", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DateStartDiagnose")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateStopDiagnose")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Diagnoses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Medicament", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ProcedureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("SymptomId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProcedureId");
|
||||
|
||||
b.HasIndex("SymptomId");
|
||||
|
||||
b.ToTable("Medicaments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Procedure", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DateStartProcedure")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateStopProcedure")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Procedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Recipe", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("CourseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ProceduresCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CourseId");
|
||||
|
||||
b.ToTable("Recipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.RecipeProcedure", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ProcedureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RecipeId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProcedureId");
|
||||
|
||||
b.HasIndex("RecipeId");
|
||||
|
||||
b.ToTable("RecipeProcedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Symptom", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Symptomes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.SymptomDiagnose", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DiagnoseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SymptomId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DiagnoseId");
|
||||
|
||||
b.HasIndex("SymptomId");
|
||||
|
||||
b.ToTable("SymptomDiagnoses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.SymptomRecipe", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("RecipeId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SymptomId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RecipeId");
|
||||
|
||||
b.HasIndex("SymptomId");
|
||||
|
||||
b.ToTable("SymptomRecipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.CourseDiagnose", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Course", "Course")
|
||||
.WithMany("Diagnoses")
|
||||
.HasForeignKey("CourseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Diagnose", "Diagnose")
|
||||
.WithMany()
|
||||
.HasForeignKey("DiagnoseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Course");
|
||||
|
||||
b.Navigation("Diagnose");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Diagnose", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Medicament", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Procedure", "Procedure")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Symptom", "Symptom")
|
||||
.WithMany()
|
||||
.HasForeignKey("SymptomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Procedure");
|
||||
|
||||
b.Navigation("Symptom");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Procedure", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Recipe", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Course", "Course")
|
||||
.WithMany()
|
||||
.HasForeignKey("CourseId");
|
||||
|
||||
b.Navigation("Course");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.RecipeProcedure", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Procedure", "Procedure")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Recipe", "Recipe")
|
||||
.WithMany("Procedures")
|
||||
.HasForeignKey("RecipeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Procedure");
|
||||
|
||||
b.Navigation("Recipe");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.SymptomDiagnose", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Diagnose", "Diagnose")
|
||||
.WithMany()
|
||||
.HasForeignKey("DiagnoseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Symptom", "Symptom")
|
||||
.WithMany("Diagnoses")
|
||||
.HasForeignKey("SymptomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Diagnose");
|
||||
|
||||
b.Navigation("Symptom");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.SymptomRecipe", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Recipe", "Recipe")
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Symptom", "Symptom")
|
||||
.WithMany()
|
||||
.HasForeignKey("SymptomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Recipe");
|
||||
|
||||
b.Navigation("Symptom");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Course", b =>
|
||||
{
|
||||
b.Navigation("Diagnoses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Recipe", b =>
|
||||
{
|
||||
b.Navigation("Procedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Symptom", b =>
|
||||
{
|
||||
b.Navigation("Diagnoses");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,360 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Courses",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
DaysCount = table.Column<int>(type: "int", nullable: false),
|
||||
PillsPerDay = table.Column<int>(type: "int", nullable: false),
|
||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Courses", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Symptomes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Symptomes", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Role = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Users", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Recipes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ProceduresCount = table.Column<int>(type: "int", nullable: false),
|
||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
CourseId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Recipes", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Recipes_Courses_CourseId",
|
||||
column: x => x.CourseId,
|
||||
principalTable: "Courses",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Diagnoses",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
UserId = table.Column<int>(type: "int", nullable: false),
|
||||
DateStartDiagnose = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DateStopDiagnose = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Diagnoses", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Diagnoses_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Procedures",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
UserId = table.Column<int>(type: "int", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
DateStartProcedure = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DateStopProcedure = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Procedures", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Procedures_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SymptomRecipes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
SymptomId = table.Column<int>(type: "int", nullable: false),
|
||||
RecipeId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SymptomRecipes", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_SymptomRecipes_Recipes_RecipeId",
|
||||
column: x => x.RecipeId,
|
||||
principalTable: "Recipes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_SymptomRecipes_Symptomes_SymptomId",
|
||||
column: x => x.SymptomId,
|
||||
principalTable: "Symptomes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CourseDiagnoses",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
CourseId = table.Column<int>(type: "int", nullable: false),
|
||||
DiagnoseId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CourseDiagnoses", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CourseDiagnoses_Courses_CourseId",
|
||||
column: x => x.CourseId,
|
||||
principalTable: "Courses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_CourseDiagnoses_Diagnoses_DiagnoseId",
|
||||
column: x => x.DiagnoseId,
|
||||
principalTable: "Diagnoses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SymptomDiagnoses",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
SymptomId = table.Column<int>(type: "int", nullable: false),
|
||||
DiagnoseId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SymptomDiagnoses", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_SymptomDiagnoses_Diagnoses_DiagnoseId",
|
||||
column: x => x.DiagnoseId,
|
||||
principalTable: "Diagnoses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_SymptomDiagnoses_Symptomes_SymptomId",
|
||||
column: x => x.SymptomId,
|
||||
principalTable: "Symptomes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Medicaments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ProcedureId = table.Column<int>(type: "int", nullable: false),
|
||||
SymptomId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Medicaments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Medicaments_Procedures_ProcedureId",
|
||||
column: x => x.ProcedureId,
|
||||
principalTable: "Procedures",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Medicaments_Symptomes_SymptomId",
|
||||
column: x => x.SymptomId,
|
||||
principalTable: "Symptomes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RecipeProcedures",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ProcedureId = table.Column<int>(type: "int", nullable: false),
|
||||
RecipeId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RecipeProcedures", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RecipeProcedures_Procedures_ProcedureId",
|
||||
column: x => x.ProcedureId,
|
||||
principalTable: "Procedures",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_RecipeProcedures_Recipes_RecipeId",
|
||||
column: x => x.RecipeId,
|
||||
principalTable: "Recipes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CourseDiagnoses_CourseId",
|
||||
table: "CourseDiagnoses",
|
||||
column: "CourseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CourseDiagnoses_DiagnoseId",
|
||||
table: "CourseDiagnoses",
|
||||
column: "DiagnoseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Diagnoses_UserId",
|
||||
table: "Diagnoses",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Medicaments_ProcedureId",
|
||||
table: "Medicaments",
|
||||
column: "ProcedureId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Medicaments_SymptomId",
|
||||
table: "Medicaments",
|
||||
column: "SymptomId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Procedures_UserId",
|
||||
table: "Procedures",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RecipeProcedures_ProcedureId",
|
||||
table: "RecipeProcedures",
|
||||
column: "ProcedureId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RecipeProcedures_RecipeId",
|
||||
table: "RecipeProcedures",
|
||||
column: "RecipeId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Recipes_CourseId",
|
||||
table: "Recipes",
|
||||
column: "CourseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SymptomDiagnoses_DiagnoseId",
|
||||
table: "SymptomDiagnoses",
|
||||
column: "DiagnoseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SymptomDiagnoses_SymptomId",
|
||||
table: "SymptomDiagnoses",
|
||||
column: "SymptomId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SymptomRecipes_RecipeId",
|
||||
table: "SymptomRecipes",
|
||||
column: "RecipeId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SymptomRecipes_SymptomId",
|
||||
table: "SymptomRecipes",
|
||||
column: "SymptomId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CourseDiagnoses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Medicaments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RecipeProcedures");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SymptomDiagnoses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SymptomRecipes");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Procedures");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Diagnoses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Recipes");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Symptomes");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Courses");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,453 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(PolyclinicDatabase))]
|
||||
partial class PolyclinicDatabaseModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.16")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Course", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DaysCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PillsPerDay")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Courses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.CourseDiagnose", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CourseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DiagnoseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CourseId");
|
||||
|
||||
b.HasIndex("DiagnoseId");
|
||||
|
||||
b.ToTable("CourseDiagnoses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Diagnose", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DateStartDiagnose")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateStopDiagnose")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Diagnoses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Medicament", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ProcedureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("SymptomId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProcedureId");
|
||||
|
||||
b.HasIndex("SymptomId");
|
||||
|
||||
b.ToTable("Medicaments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Procedure", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DateStartProcedure")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateStopProcedure")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Procedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Recipe", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("CourseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ProceduresCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CourseId");
|
||||
|
||||
b.ToTable("Recipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.RecipeProcedure", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ProcedureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RecipeId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProcedureId");
|
||||
|
||||
b.HasIndex("RecipeId");
|
||||
|
||||
b.ToTable("RecipeProcedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Symptom", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Symptomes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.SymptomDiagnose", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DiagnoseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SymptomId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DiagnoseId");
|
||||
|
||||
b.HasIndex("SymptomId");
|
||||
|
||||
b.ToTable("SymptomDiagnoses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.SymptomRecipe", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("RecipeId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SymptomId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RecipeId");
|
||||
|
||||
b.HasIndex("SymptomId");
|
||||
|
||||
b.ToTable("SymptomRecipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.CourseDiagnose", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Course", "Course")
|
||||
.WithMany("Diagnoses")
|
||||
.HasForeignKey("CourseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Diagnose", "Diagnose")
|
||||
.WithMany()
|
||||
.HasForeignKey("DiagnoseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Course");
|
||||
|
||||
b.Navigation("Diagnose");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Diagnose", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Medicament", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Procedure", "Procedure")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Symptom", "Symptom")
|
||||
.WithMany()
|
||||
.HasForeignKey("SymptomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Procedure");
|
||||
|
||||
b.Navigation("Symptom");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Procedure", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Recipe", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Course", "Course")
|
||||
.WithMany()
|
||||
.HasForeignKey("CourseId");
|
||||
|
||||
b.Navigation("Course");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.RecipeProcedure", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Procedure", "Procedure")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Recipe", "Recipe")
|
||||
.WithMany("Procedures")
|
||||
.HasForeignKey("RecipeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Procedure");
|
||||
|
||||
b.Navigation("Recipe");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.SymptomDiagnose", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Diagnose", "Diagnose")
|
||||
.WithMany()
|
||||
.HasForeignKey("DiagnoseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Symptom", "Symptom")
|
||||
.WithMany("Diagnoses")
|
||||
.HasForeignKey("SymptomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Diagnose");
|
||||
|
||||
b.Navigation("Symptom");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.SymptomRecipe", b =>
|
||||
{
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Recipe", "Recipe")
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PolyclinicDatabaseImplement.Models.Symptom", "Symptom")
|
||||
.WithMany()
|
||||
.HasForeignKey("SymptomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Recipe");
|
||||
|
||||
b.Navigation("Symptom");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Course", b =>
|
||||
{
|
||||
b.Navigation("Diagnoses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Recipe", b =>
|
||||
{
|
||||
b.Navigation("Procedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PolyclinicDatabaseImplement.Models.Symptom", b =>
|
||||
{
|
||||
b.Navigation("Diagnoses");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
91
Polyclinic/PolyclinicDatabaseImplement/Models/Course.cs
Normal file
91
Polyclinic/PolyclinicDatabaseImplement/Models/Course.cs
Normal file
@ -0,0 +1,91 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDataModels.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Models
|
||||
{
|
||||
public class Course : ICourseModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int DaysCount { get; set; }
|
||||
[Required]
|
||||
public int PillsPerDay { get; set; }
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
[ForeignKey("CourseId")]
|
||||
public virtual List<CourseDiagnose> Diagnoses { get; set; } = new();
|
||||
private Dictionary<int, IDiagnoseModel>? _courseDiagnoses = null;
|
||||
[NotMapped]
|
||||
public Dictionary<int, IDiagnoseModel> CourseDiagnoses
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_courseDiagnoses == null)
|
||||
{
|
||||
_courseDiagnoses = Diagnoses.ToDictionary(
|
||||
courseDiagnose => courseDiagnose.DiagnoseId,
|
||||
courseDiagnose => courseDiagnose.Diagnose as IDiagnoseModel
|
||||
);
|
||||
}
|
||||
return _courseDiagnoses;
|
||||
}
|
||||
}
|
||||
|
||||
public static Course Create(PolyclinicDatabase context, CourseBindingModel model)
|
||||
{
|
||||
return new Course()
|
||||
{
|
||||
Id = model.Id,
|
||||
DaysCount = model.DaysCount,
|
||||
PillsPerDay = model.PillsPerDay,
|
||||
Comment = model.Comment,
|
||||
Diagnoses = model.CourseDiagnoses.Select(courseDiagnose => new CourseDiagnose
|
||||
{
|
||||
Diagnose = context.Diagnoses.First(diagnose => diagnose.Id == courseDiagnose.Key)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(CourseBindingModel model)
|
||||
{
|
||||
DaysCount = model.DaysCount;
|
||||
PillsPerDay = model.PillsPerDay;
|
||||
Comment = model.Comment;
|
||||
}
|
||||
|
||||
public CourseViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
DaysCount = DaysCount,
|
||||
PillsPerDay = PillsPerDay,
|
||||
Comment = Comment,
|
||||
CourseDiagnoses = CourseDiagnoses
|
||||
};
|
||||
|
||||
public void UpdateDiagnoses(PolyclinicDatabase context, CourseBindingModel model)
|
||||
{
|
||||
var courseDiagnoses = context.CourseDiagnoses.Where(rec => rec.CourseId == model.Id).ToList();
|
||||
if (courseDiagnoses != null && courseDiagnoses.Count > 0)
|
||||
{
|
||||
// удалили те, которых нет в модели
|
||||
context.CourseDiagnoses.RemoveRange(courseDiagnoses
|
||||
.Where(rec => !model.CourseDiagnoses.ContainsKey(rec.DiagnoseId)));
|
||||
context.SaveChanges();
|
||||
}
|
||||
var course = context.Courses.First(x => x.Id == Id);
|
||||
foreach (var pc in model.CourseDiagnoses)
|
||||
{
|
||||
context.CourseDiagnoses.Add(new CourseDiagnose
|
||||
{
|
||||
Course = course,
|
||||
Diagnose = context.Diagnoses.First(x => x.Id == pc.Key),
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_courseDiagnoses = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Models
|
||||
{
|
||||
public class CourseDiagnose
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int CourseId { get; set; }
|
||||
[Required]
|
||||
public int DiagnoseId { get; set; }
|
||||
public virtual Course Course { get; set; } = new();
|
||||
public virtual Diagnose Diagnose { get; set; } = new();
|
||||
}
|
||||
}
|
60
Polyclinic/PolyclinicDatabaseImplement/Models/Diagnose.cs
Normal file
60
Polyclinic/PolyclinicDatabaseImplement/Models/Diagnose.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Models
|
||||
{
|
||||
public class Diagnose : IDiagnoseModel
|
||||
{
|
||||
[Required]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime DateStartDiagnose { get; set; } = DateTime.Now;
|
||||
public DateTime? DateStopDiagnose { get; set; }
|
||||
public int Id { get; set; }
|
||||
public virtual User User { get; set; } = new();
|
||||
|
||||
public static Diagnose? Create(DiagnoseBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Diagnose
|
||||
{
|
||||
Name = model.Name,
|
||||
Comment = model.Comment,
|
||||
UserId = model.UserId,
|
||||
Id = model.Id,
|
||||
DateStartDiagnose = model.DateStartDiagnose,
|
||||
DateStopDiagnose = model.DateStopDiagnose,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(DiagnoseBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Name = model.Name;
|
||||
Comment = model.Comment;
|
||||
}
|
||||
|
||||
public DiagnoseViewModel GetViewModel => new()
|
||||
{
|
||||
Name = Name,
|
||||
Comment = Comment,
|
||||
UserId = UserId,
|
||||
Id = Id,
|
||||
DateStartDiagnose = DateStartDiagnose,
|
||||
DateStopDiagnose = DateStopDiagnose,
|
||||
};
|
||||
}
|
||||
}
|
55
Polyclinic/PolyclinicDatabaseImplement/Models/Medicament.cs
Normal file
55
Polyclinic/PolyclinicDatabaseImplement/Models/Medicament.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDataModels.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Models
|
||||
{
|
||||
public class Medicament : IMedicamentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public int ProcedureId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int? SymptomId { get; set; }
|
||||
|
||||
public virtual Symptom? Symptom { get; set; }
|
||||
public virtual Procedure? Procedure { get; set; }
|
||||
|
||||
public static Medicament Create(MedicamentBindingModel bindingModel)
|
||||
{
|
||||
return new Medicament()
|
||||
{
|
||||
Id = bindingModel.Id,
|
||||
Name = bindingModel.Name,
|
||||
Comment = bindingModel.Comment,
|
||||
ProcedureId = bindingModel.ProcedureId,
|
||||
SymptomId = bindingModel.SymptomId
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(MedicamentBindingModel bindingModel)
|
||||
{
|
||||
Name = bindingModel.Name;
|
||||
Comment = bindingModel.Comment;
|
||||
}
|
||||
|
||||
public MedicamentViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Comment = Comment,
|
||||
ProcedureId = ProcedureId,
|
||||
SymptomId = Symptom?.Id ?? null
|
||||
};
|
||||
}
|
||||
}
|
56
Polyclinic/PolyclinicDatabaseImplement/Models/Procedure.cs
Normal file
56
Polyclinic/PolyclinicDatabaseImplement/Models/Procedure.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDataModels.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Models
|
||||
{
|
||||
public class Procedure : IProcedureModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public DateTime DateStartProcedure { get; set; } = DateTime.Now;
|
||||
public DateTime? DateStopProcedure { get; set; }
|
||||
public virtual User User { get; set; } = new();
|
||||
|
||||
[Required]
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
|
||||
public static Procedure Create(ProcedureBindingModel bindingModel)
|
||||
{
|
||||
return new Procedure()
|
||||
{
|
||||
Id = bindingModel.Id,
|
||||
UserId = bindingModel.UserId,
|
||||
Name = bindingModel.Name,
|
||||
Comment = bindingModel.Comment,
|
||||
DateStartProcedure = bindingModel.DateStartProcedure,
|
||||
DateStopProcedure = bindingModel.DateStopProcedure,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ProcedureBindingModel bindingModel)
|
||||
{
|
||||
Name = bindingModel.Name;
|
||||
Comment = bindingModel.Comment;
|
||||
}
|
||||
|
||||
public ProcedureViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
UserId = UserId,
|
||||
Comment = Comment,
|
||||
DateStartProcedure = DateStartProcedure,
|
||||
DateStopProcedure = DateStopProcedure,
|
||||
};
|
||||
}
|
||||
}
|
92
Polyclinic/PolyclinicDatabaseImplement/Models/Recipe.cs
Normal file
92
Polyclinic/PolyclinicDatabaseImplement/Models/Recipe.cs
Normal file
@ -0,0 +1,92 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDataModels.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Models
|
||||
{
|
||||
public class Recipe : IRecipeModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ProceduresCount { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
public int? CourseId { get; set; }
|
||||
public virtual Course Course { get; set; } = new();
|
||||
|
||||
private Dictionary<int, IProcedureModel>? _recipeProcedures = null;
|
||||
|
||||
[ForeignKey("RecipeId")]
|
||||
public virtual List<RecipeProcedure> Procedures { get; set; } = new();
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<int, IProcedureModel> RecipeProcedures
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_recipeProcedures == null)
|
||||
{
|
||||
_recipeProcedures = Procedures.ToDictionary(recPC => recPC.ProcedureId, recPC => (recPC.Procedure as IProcedureModel));
|
||||
}
|
||||
return _recipeProcedures;
|
||||
}
|
||||
}
|
||||
|
||||
public static Recipe Create(PolyclinicDatabase database, RecipeBindingModel bindingModel)
|
||||
{
|
||||
return new Recipe()
|
||||
{
|
||||
Id = bindingModel.Id,
|
||||
ProceduresCount = bindingModel.ProceduresCount,
|
||||
Comment = bindingModel.Comment,
|
||||
CourseId = bindingModel.CourseId,
|
||||
Procedures = bindingModel.RecipeProcedures.Select(x => new RecipeProcedure
|
||||
{
|
||||
Recipe = database.Recipes.First(y => y.Id == x.Key)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(RecipeBindingModel bindingModel)
|
||||
{
|
||||
ProceduresCount = bindingModel.ProceduresCount;
|
||||
Comment = bindingModel.Comment;
|
||||
CourseId = bindingModel.CourseId;
|
||||
}
|
||||
|
||||
public RecipeViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ProceduresCount = ProceduresCount,
|
||||
Comment = Comment,
|
||||
CourseId = Course?.Id ?? null,
|
||||
};
|
||||
|
||||
public void UpdateProcedures(PolyclinicDatabase database, RecipeBindingModel bindingModel)
|
||||
{
|
||||
var RecipeProcedures = database.RecipeProcedures.Where(x => x.ProcedureId == bindingModel.Id).ToList();
|
||||
|
||||
if (RecipeProcedures != null)
|
||||
{
|
||||
// удалили те, которых нет в модели
|
||||
database.RecipeProcedures.RemoveRange(RecipeProcedures.Where(rec => !bindingModel.RecipeProcedures.ContainsKey(rec.RecipeId)));
|
||||
database.SaveChanges();
|
||||
}
|
||||
var Procedure = database.Procedures.First(x => x.Id == bindingModel.Id);
|
||||
foreach (var pc in bindingModel.RecipeProcedures)
|
||||
{
|
||||
database.RecipeProcedures.Add(new RecipeProcedure
|
||||
{
|
||||
Procedure = Procedure,
|
||||
Recipe = database.Recipes.First(x => x.Id == pc.Key)
|
||||
});
|
||||
}
|
||||
_recipeProcedures = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Models
|
||||
{
|
||||
public class RecipeProcedure
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int ProcedureId { get; set; }
|
||||
[Required]
|
||||
public int RecipeId { get; set; }
|
||||
public virtual Procedure Procedure { get; set; } = new();
|
||||
public virtual Recipe Recipe { get; set; } = new();
|
||||
}
|
||||
}
|
87
Polyclinic/PolyclinicDatabaseImplement/Models/Symptom.cs
Normal file
87
Polyclinic/PolyclinicDatabaseImplement/Models/Symptom.cs
Normal file
@ -0,0 +1,87 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDataModels.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Models
|
||||
{
|
||||
public class Symptom : ISymptomModel
|
||||
{
|
||||
[Required]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
[ForeignKey("SymptomId")]
|
||||
public virtual List<SymptomDiagnose> Diagnoses { get; set; } = new();
|
||||
private Dictionary<int, IDiagnoseModel>? _symptomDiagnoses = null;
|
||||
[NotMapped]
|
||||
public Dictionary<int, IDiagnoseModel> SymptomDiagnoses
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_symptomDiagnoses == null)
|
||||
{
|
||||
_symptomDiagnoses = Diagnoses.ToDictionary(
|
||||
symptomDiagnose => symptomDiagnose.DiagnoseId,
|
||||
symptomDiagnose => symptomDiagnose.Diagnose as IDiagnoseModel
|
||||
);
|
||||
}
|
||||
return _symptomDiagnoses;
|
||||
}
|
||||
}
|
||||
public int Id { get; set; }
|
||||
|
||||
public static Symptom Create(PolyclinicDatabase context, SymptomBindingModel model)
|
||||
{
|
||||
return new Symptom()
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name,
|
||||
Comment = model.Comment,
|
||||
Diagnoses = model.SymptomDiagnoses.Select(symptomDiagnose => new SymptomDiagnose
|
||||
{
|
||||
Diagnose = context.Diagnoses.First(diagnose => diagnose.Id == symptomDiagnose.Key)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(SymptomBindingModel model)
|
||||
{
|
||||
Comment = model.Comment;
|
||||
Name = model.Name;
|
||||
}
|
||||
|
||||
public SymptomViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Comment = Comment,
|
||||
Name = Name,
|
||||
SymptomDiagnoses = SymptomDiagnoses
|
||||
};
|
||||
|
||||
public void UpdateDiagnoses(PolyclinicDatabase context, SymptomBindingModel model)
|
||||
{
|
||||
var symptomDiagnoses = context.SymptomDiagnoses.Where(rec => rec.SymptomId == model.Id).ToList();
|
||||
if (symptomDiagnoses != null && symptomDiagnoses.Count > 0)
|
||||
{
|
||||
// удалили те, которых нет в модели
|
||||
context.SymptomDiagnoses.RemoveRange(symptomDiagnoses
|
||||
.Where(rec => !model.SymptomDiagnoses.ContainsKey(rec.DiagnoseId)));
|
||||
context.SaveChanges();
|
||||
}
|
||||
var course = context.Symptomes.First(x => x.Id == Id);
|
||||
foreach (var pc in model.SymptomDiagnoses)
|
||||
{
|
||||
context.SymptomDiagnoses.Add(new SymptomDiagnose
|
||||
{
|
||||
Symptom = course,
|
||||
Diagnose = context.Diagnoses.First(x => x.Id == pc.Key),
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_symptomDiagnoses = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Models
|
||||
{
|
||||
public class SymptomDiagnose
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int SymptomId { get; set; }
|
||||
[Required]
|
||||
public int DiagnoseId { get; set; }
|
||||
public virtual Symptom Symptom { get; set; } = new();
|
||||
public virtual Diagnose Diagnose { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Models
|
||||
{
|
||||
public class SymptomRecipe
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int SymptomId { get; set; }
|
||||
[Required]
|
||||
public int RecipeId { get; set; }
|
||||
public virtual Symptom Symptom { get; set; } = new();
|
||||
public virtual Recipe Recipe { get; set; } = new();
|
||||
}
|
||||
}
|
59
Polyclinic/PolyclinicDatabaseImplement/Models/User.cs
Normal file
59
Polyclinic/PolyclinicDatabaseImplement/Models/User.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using PolyclinicContracts.BindingModels;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicDataModels.Enums;
|
||||
using PolyclinicDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PolyclinicDatabaseImplement.Models
|
||||
{
|
||||
public class User : IUserModel
|
||||
{
|
||||
[Required]
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public UserRole Role { get; set; } = UserRole.Неизвестный;
|
||||
public int Id { get; set; }
|
||||
|
||||
public static User? Create(UserBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new User
|
||||
{
|
||||
FIO = model.FIO,
|
||||
Email = model.Email,
|
||||
Password = model.Password,
|
||||
Role = model.Role,
|
||||
Id = model.Id
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(UserBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
FIO = model.FIO;
|
||||
Email = model.Email;
|
||||
Password = model.Password;
|
||||
Role = model.Role;
|
||||
FIO = model.FIO;
|
||||
}
|
||||
|
||||
public UserViewModel GetViewModel => new()
|
||||
{
|
||||
FIO = FIO,
|
||||
Email = Email,
|
||||
Password = Password,
|
||||
Role = Role,
|
||||
Id = Id
|
||||
};
|
||||
}
|
||||
}
|
29
Polyclinic/PolyclinicDatabaseImplement/PolyclinicDatabase.cs
Normal file
29
Polyclinic/PolyclinicDatabaseImplement/PolyclinicDatabase.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PolyclinicDatabaseImplement.Models;
|
||||
|
||||
namespace SecuritySystemDatabaseImplement
|
||||
{
|
||||
public class PolyclinicDatabase : DbContext
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=PolyclinicDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
public virtual DbSet<Course> Courses { set; get; }
|
||||
public virtual DbSet<CourseDiagnose> CourseDiagnoses { set; get; }
|
||||
public virtual DbSet<Diagnose> Diagnoses { set; get; }
|
||||
public virtual DbSet<Medicament> Medicaments { set; get; }
|
||||
public virtual DbSet<Procedure> Procedures { set; get; }
|
||||
public virtual DbSet<RecipeProcedure> RecipeProcedures { set; get; }
|
||||
public virtual DbSet<Recipe> Recipes { set; get; }
|
||||
public virtual DbSet<Symptom> Symptomes { set; get; }
|
||||
public virtual DbSet<SymptomDiagnose> SymptomDiagnoses { set; get; }
|
||||
public virtual DbSet<SymptomRecipe> SymptomRecipes { set; get; }
|
||||
public virtual DbSet<User> Users { set; get; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.16" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.16">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PolyclinicContracts\PolyclinicContracts.csproj" />
|
||||
<ProjectReference Include="..\PolyclinicDataModels\PolyclinicDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -8,4 +8,15 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.16">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PolyclinicDatabaseImplement\PolyclinicDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -11,7 +11,7 @@ namespace PolyclinicView
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
//Application.Run();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PolyclinicWebAppImplementer.Models;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace PolyclinicWebAppImplementer.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpGet]
|
||||
[HttpPost]
|
||||
public IActionResult Course()
|
||||
{
|
||||
if (HttpContext.Request.Method == "POST")
|
||||
{
|
||||
return Redirect("~/Home/Courses");
|
||||
}
|
||||
else
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
public IActionResult Courses()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
public IActionResult Diagnose()
|
||||
{
|
||||
if (HttpContext.Request.Method == "POST")
|
||||
{
|
||||
return Redirect("~/Home/Diagnoses");
|
||||
}
|
||||
else
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult Diagnoses()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
public IActionResult Symptom()
|
||||
{
|
||||
if (HttpContext.Request.Method == "POST")
|
||||
{
|
||||
return Redirect("~/Home/Symptomes");
|
||||
}
|
||||
else
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
public IActionResult Symptomes()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpPost]
|
||||
public IActionResult Login()
|
||||
{
|
||||
if (HttpContext.Request.Method == "POST")
|
||||
{
|
||||
return Redirect("~/");
|
||||
}
|
||||
else
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult Register()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpPost]
|
||||
public IActionResult AddRecipeToCourse()
|
||||
{
|
||||
if (HttpContext.Request.Method == "POST")
|
||||
{
|
||||
return Redirect("~/");
|
||||
}
|
||||
else
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpPost]
|
||||
public IActionResult MedicamentsByDiagnoses()
|
||||
{
|
||||
if (HttpContext.Request.Method == "POST")
|
||||
{
|
||||
return View();
|
||||
}
|
||||
else
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
[HttpPost]
|
||||
public IActionResult DiagnosesReport()
|
||||
{
|
||||
if (HttpContext.Request.Method == "POST")
|
||||
{
|
||||
ViewData["ShowReport"] = true;
|
||||
return View();
|
||||
}
|
||||
else
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace PolyclinicWebAppImplementer.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="Views\Home\Course.cshtml">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
<Content Update="Views\Home\Index.cshtml">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
<Content Update="Views\Home\Register.cshtml">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
<Content Update="Views\Home\Symptomes.cshtml">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
<Content Update="Views\Shared\_Layout.cshtml">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<UpToDateCheckInput Remove="Views\Home\Courses.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="Views\Home\Courses.cshtml" />
|
||||
<_ContentIncludedByDefault Remove="Views\Home\Diagnoses.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<UpToDateCheckInput Remove="Views\Home\Diagnoses.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.16">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PolyclinicDatabaseImplement\PolyclinicDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
27
Polyclinic/PolyclinicWebAppImplementer/Program.cs
Normal file
27
Polyclinic/PolyclinicWebAppImplementer/Program.cs
Normal file
@ -0,0 +1,27 @@
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
app.Run();
|
@ -0,0 +1,28 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:29749",
|
||||
"sslPort": 44318
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"PolyclinicWebAppImplementer": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7264;http://localhost:5151",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
24
Polyclinic/PolyclinicWebAppImplementer/SiteMenuItems.cs
Normal file
24
Polyclinic/PolyclinicWebAppImplementer/SiteMenuItems.cs
Normal file
@ -0,0 +1,24 @@
|
||||
namespace PolyclinicWebAppImplementer
|
||||
{
|
||||
public static class SiteMenuItems
|
||||
{
|
||||
public static (string Url, string Title) Index = ("", "Главная");
|
||||
public static (string Url, string Title) Courses = ("Courses", "Курсы");
|
||||
public static (string Url, string Title) Diagnoses = ("Diagnoses", "Болезни");
|
||||
public static (string Url, string Title) Symptomes = ("Symptomes", "Симптомы");
|
||||
public static (string Url, string Title) Symptom = ("Symptom", "Симптом");
|
||||
public static (string Url, string Title) Diagnose = ("Diagnose", "Болезнь");
|
||||
public static (string Url, string Title) Course = ("Course", "Курс");
|
||||
public static (string Url, string Title) Login = ("Login", "Вход");
|
||||
public static (string Url, string Title) Register = ("Register", "Регистрация");
|
||||
public static (string Url, string Title) Privacy = ("Privacy", "Политика приватности");
|
||||
public static (string Url, string Title) AddRecipeToCourse = ("AddRecipeToCourse", "Привязка рецепта");
|
||||
public static (string Url, string Title) MedicamentsByDiagnoses = ("MedicamentsByDiagnoses", "Лекарства по болезням");
|
||||
public static (string Url, string Title) DiagnosesReport = ("DiagnosesReport", "Отчет по болезням");
|
||||
|
||||
public static List<(string Url, string Title)> MenuItemsOrder = new List<(string Url, string Title)>
|
||||
{
|
||||
Index, Courses, Diagnoses, Symptomes, Login, Register, AddRecipeToCourse, MedicamentsByDiagnoses, DiagnosesReport
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.AddRecipeToCourse;
|
||||
}
|
||||
<h4>Привязка рецепта к курсу</h4>
|
||||
<form id="addrecipetocourse" method="post">
|
||||
<div class="row mb-2">
|
||||
<div class="col-3 d-flex align-content-center">
|
||||
<h5 class="me-2">Рецепт</h5>
|
||||
<select id="recipeId" name="recipeId" class="me-2">
|
||||
<option value="">Выберите рецепт</option>
|
||||
@{
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
<option value="@i">Рецепт оууеее @i</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<div class="col-3 d-flex align-content-center">
|
||||
<h5 class="me-2">Курс</h5>
|
||||
<select id="courseId" name="courseId" class="me-2">
|
||||
<option value="">Выберите курс</option>
|
||||
@{
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
<option value="@i">Какой то курс @i</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<div class="col-3">
|
||||
<button class="btn btn-primary" type="submit">
|
||||
Привязать
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,60 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Course;
|
||||
}
|
||||
<h4>Новый курс лечения</h4>
|
||||
<form class="d-flex flex-column" method="post">
|
||||
<div class="row mb-5">
|
||||
<div class="col-3">Количество дней:</div>
|
||||
<div class="col-8"><input type="number" id="daysCount" name="daysCount" /></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-3">Количество препарата в день:</div>
|
||||
<div class="col-8"><input type="number" id="pillsPerDay" name="pillsPerDay" /></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-3">Коментарий:</div>
|
||||
<div class="col-8"><textarea id="comment" name="comment"></textarea></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-3 d-flex align-content-center">
|
||||
<h5 class="me-2">Болезни</h5>
|
||||
<select id="diagnoseId" name="diagnoseId" class="me-2">
|
||||
<option value="">Выберите болезнь</option>
|
||||
@{
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
<option value="@i">Какая-то противная болезнь @i</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<button class="btn btn-success" type="button">
|
||||
Добавить
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-5 overflow-auto" style="max-height: 100px; max-width: 500px;">
|
||||
<ol>
|
||||
@{
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
<li class="mb-2 ps-1 ms-1">
|
||||
<a asp-action="Course" class="text-decoration-none">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill text-danger " viewBox="0 0 16 16">
|
||||
<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0" />
|
||||
</svg>
|
||||
</a>
|
||||
<span>Выбранная болезнь</span>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ol>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">
|
||||
<button class="btn btn-success" type="submit">
|
||||
Сохранить
|
||||
</button>
|
||||
@Html.ActionLink("Отмена", "Courses", "Home", null, new { @class = "btn btn-danger" })
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,47 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Courses;
|
||||
}
|
||||
<div>
|
||||
<div class="d-flex flex-row">
|
||||
<a class="btn btn-primary" asp-action="Course" asp-controller="Home" title="Добавить">
|
||||
Добавить курс
|
||||
</a>
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Номер</th>
|
||||
<th scope="col">Количество дней</th>
|
||||
<th scope="col">Количество препаратов в день</th>
|
||||
<th scope="col">Комментарий</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@{
|
||||
int count = 20;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
<tr>
|
||||
<th scope="row">@i</th>
|
||||
<td>12</td>
|
||||
<td>3</td>
|
||||
<td>Очень хороший курс приема</td>
|
||||
<td class="d-flex">
|
||||
<a class="btn btn-danger me-1" title="Удалить">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill" viewBox="0 0 16 16">
|
||||
<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0" />
|
||||
</svg>
|
||||
</a>
|
||||
<a class="btn btn-warning text-light" title="Редактировать" asp-action="Course" asp-controller="Home">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-fill" viewBox="0 0 16 16">
|
||||
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.5.5 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11z" />
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
@ -0,0 +1,30 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Diagnose;
|
||||
}
|
||||
<h4>Новая болезнь</h4>
|
||||
<form class="d-flex flex-column" method="post">
|
||||
<div class="row mb-5">
|
||||
<div class="col-3">Название:</div>
|
||||
<div class="col-8"><input type="text" id="name" name="name" /></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-3">Коментарий:</div>
|
||||
<div class="col-8"><textarea id="comment" name="comment"></textarea></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-3">Начало:</div>
|
||||
<div class="col-8"><input type="date" id="dateStartInput" name="dateStart" /></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-3">Конец:</div>
|
||||
<div class="col-8"><input type="date" id="dateStopInput" name="dateStop" /></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">
|
||||
<button class="btn btn-success" type="submit">
|
||||
Сохранить
|
||||
</button>
|
||||
@Html.ActionLink("Отмена", "Diagnoses", "Home", null, new { @class = "btn btn-danger" })
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,49 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Diagnoses;
|
||||
}
|
||||
<div>
|
||||
<div class="d-flex flex-row">
|
||||
<a class="btn btn-primary" asp-action="Diagnose" asp-controller="Home" title="Добавить">
|
||||
Добавить болезнь
|
||||
</a>
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Номер</th>
|
||||
<th scope="col">Название</th>
|
||||
<th scope="col">Начало</th>
|
||||
<th scope="col">Конец</th>
|
||||
<th scope="col">Комментарий</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@{
|
||||
int count = 10;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
<tr>
|
||||
<th scope="row">@i</th>
|
||||
<td>синдром Мюнхгаузена</td>
|
||||
<td>12.04.2024</td>
|
||||
<td>17.05.2024</td>
|
||||
<td>заболевание, при котором человек постоянно симулирует или преувеличивает симптомы болезней, чтобы привлечь внимание окружающих.</td>
|
||||
<td class="d-flex">
|
||||
<a class="btn btn-danger me-1" title="Удалить">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill" viewBox="0 0 16 16">
|
||||
<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0" />
|
||||
</svg>
|
||||
</a>
|
||||
<a class="btn btn-warning text-light" title="Редактировать" asp-action="Diagnose" asp-controller="Home">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-fill" viewBox="0 0 16 16">
|
||||
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.5.5 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11z" />
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
@ -0,0 +1,113 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.DiagnosesReport;
|
||||
}
|
||||
<div class="d-flex flex-column">
|
||||
<form id="diagnosesReportForm" method="post" class="d-flex mb-4">
|
||||
<div class="me-5">
|
||||
<label for="dateFrom">
|
||||
Дата начала
|
||||
</label>
|
||||
<input type="date" id="dateFrom" name="dateFrom" />
|
||||
</div>
|
||||
<div class="me-5">
|
||||
<label for="dateTo">
|
||||
Дата завершения
|
||||
</label>
|
||||
<input type="date" id="dateTo" name="dateTo" />
|
||||
</div>
|
||||
<div class="me-5">
|
||||
<fieldset class="d-flex">
|
||||
<div class="me-4">
|
||||
<label for="radioreportTypeEmail">Отправить на почту</label>
|
||||
<input id="radioreportTypeEmail" type="radio" name="reportType" value="email" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="radioreportTypeForm">Показать на форме</label>
|
||||
<input id="radioreportTypeForm" type="radio" name="reportType" value="form" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<button class="btn btn-primary btn-sm" type="submit">
|
||||
Сформировать
|
||||
</button>
|
||||
</form>
|
||||
@if (ViewData.ContainsKey("ShowReport"))
|
||||
{
|
||||
<table class="table mt-3 caption-top table-hover">
|
||||
<caption>Отчет по болезням с 01.01.2023 по 31.12.2023</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
#
|
||||
</th>
|
||||
<th scope="col">
|
||||
Болезнь
|
||||
</th>
|
||||
<th scope="col">
|
||||
Дата начала
|
||||
</th>
|
||||
<th scope="col">
|
||||
Дата завершения
|
||||
</th>
|
||||
<th scope="col">
|
||||
Курсы
|
||||
</th>
|
||||
<th scope="col">
|
||||
Симптомы
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
<tr>
|
||||
<th scope="row">
|
||||
@(i + 1)
|
||||
</th>
|
||||
<td>
|
||||
Лихорадка Эбола
|
||||
</td>
|
||||
<td>
|
||||
16.03.2023
|
||||
</td>
|
||||
<td>
|
||||
20.10.2023
|
||||
</td>
|
||||
<td>
|
||||
Курс приема топорина<sup>®</sup>
|
||||
</td>
|
||||
<td>
|
||||
Лихорадка
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Курс приема четвертина<sup>®</sup></td>
|
||||
<td>Покрасения</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Курс приема колесовина<sup>®</sup></td>
|
||||
<td>Головокружение</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Курс электрофореза</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
@ -0,0 +1,8 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Index;
|
||||
}
|
||||
|
||||
<div class="text-center d-flex flex-column justify-content-center align-items-center">
|
||||
<h2>кабинет Исполнителя</h3>
|
||||
<img class="img-fluid w-50" src="~/img/polyclinic_logo.svg"/>
|
||||
</div>
|
@ -0,0 +1,23 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Login;
|
||||
}
|
||||
<div class="d-flex w-100 h-100 align-content-center justify-content-center">
|
||||
<form class="d-flex flex-column" id="loginForm"method="post">
|
||||
<h4>Вход</h4>
|
||||
<div class="mb-2 d-flex w-100">
|
||||
<label for="emailInput" class="me-2">
|
||||
Email
|
||||
</label>
|
||||
<input id="emailInput" type="email" name="email" placeholder="mail@example.com" class="w-100"/>
|
||||
</div>
|
||||
<div class="mb-2 d-flex w-100">
|
||||
<label for="passwordInput" class="me-2">
|
||||
Пароль
|
||||
</label>
|
||||
<input id="passwordInput" type="password" name="password" class="w-100"/>
|
||||
</div>
|
||||
<button class="btn btn-outline-primary" type="submit">
|
||||
Войти
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1,40 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.MedicamentsByDiagnoses;
|
||||
}
|
||||
<h4>Список лекарств по болезням</h4>
|
||||
<form class="d-flex flex-column mt-2">
|
||||
<h5>Выберите болезни</h5>
|
||||
<div class="mb-3 overflow-auto" style="max-width: 500px; max-height: 300px;">
|
||||
<ul>
|
||||
@{
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
<li class="d-flex mb-2">
|
||||
<input class="me-2" name="diagnose-@i" type="checkbox" id="diagnose-@i"/>
|
||||
<label for="diagnose-@i">Название болезни @i</label>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<fieldset class="mb-3">
|
||||
<h5>Укажите формат файла</h5>
|
||||
<div class="d-flex">
|
||||
<div class="d-flex me-3">
|
||||
<input class="me-2" type="radio" name="fileFormat" value="docx" id="radio-docx"/>
|
||||
<label for="radio-docx">DOCX</label>
|
||||
</div>
|
||||
<div class="d-flex me-3">
|
||||
<input class="me-2" type="radio" name="fileFormat" value="xlsx" id="radio-xlsx" />
|
||||
<label for="radio-xlsx">XLSX</label>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="mb-3">
|
||||
<h5>Укажите название файла</h5>
|
||||
<input type="text" id="fileName"/>
|
||||
</div>
|
||||
<button class="btn btn-primary col-2" type="submit">
|
||||
Скачать отчет
|
||||
</button>
|
||||
</form>
|
@ -0,0 +1,6 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Privacy;
|
||||
}
|
||||
<h1>Политика приватности</h1>
|
||||
|
||||
<p>Здесь нет никакой приватности</p>
|
@ -0,0 +1,29 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Register;
|
||||
}
|
||||
<div class="d-flex w-100 h-100 align-content-center justify-content-center">
|
||||
<form class="d-flex flex-column" id="registerForm" method="post">
|
||||
<h4>Регистрация</h4>
|
||||
<div class="mb-2 d-flex w-100">
|
||||
<label for="fioInput" class="me-2">
|
||||
ФИО
|
||||
</label>
|
||||
<input id="fioInput" name="fio" type="text" placeholder="Иванов Иван Иванович" class="w-100" />
|
||||
</div>
|
||||
<div class="mb-2 d-flex w-100">
|
||||
<label for="emailInput" class="me-2">
|
||||
Email
|
||||
</label>
|
||||
<input id="emailInput" type="email" name="email" placeholder="mail@example.com" class="w-100" />
|
||||
</div>
|
||||
<div class="mb-2 d-flex w-100">
|
||||
<label for="passwordInput" class="me-2">
|
||||
Пароль
|
||||
</label>
|
||||
<input id="passwordInput" type="password" name="password" class="w-100" />
|
||||
</div>
|
||||
<button class="btn btn-outline-success" type="submit">
|
||||
Зарегистрироваться
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1,58 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Symptom;
|
||||
}
|
||||
<h4>Новый симптом</h4>
|
||||
<form class="d-flex flex-column" method="post">
|
||||
<div class="row mb-5">
|
||||
<div class="col-3">Название:</div>
|
||||
<div class="col-8"><input type="text" id="name" name="name" /></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-3">Коментарий:</div>
|
||||
<div class="col-8"><textarea id="comment" name="comment"></textarea></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-3 d-flex align-content-center">
|
||||
<h5 class="me-2">Болезни</h5>
|
||||
<select id="diagnoseId" name="diagnoseId" class="me-2">
|
||||
<option value="">Выберите болезнь</option>
|
||||
@{
|
||||
int count = 10;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
<option value="@i">Какая-то противная болезнь @i</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<button class="btn btn-success" type="button">
|
||||
Добавить
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-5 overflow-auto" style="max-height: 100px; max-width: 500px;">
|
||||
<ol>
|
||||
@{
|
||||
count = 7;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
<li class="mb-2 ps-1 ms-1">
|
||||
<a asp-action="Symptom" class="text-decoration-none">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill text-danger " viewBox="0 0 16 16">
|
||||
<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0" />
|
||||
</svg>
|
||||
</a>
|
||||
<span>Выбранная болезнь</span>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ol>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">
|
||||
<button class="btn btn-success" type="submit">
|
||||
Сохранить
|
||||
</button>
|
||||
@Html.ActionLink("Отмена", "Courses", "Home", null, new { @class = "btn btn-danger" })
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,45 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Symptomes;
|
||||
}
|
||||
<div>
|
||||
<div class="d-flex flex-row">
|
||||
<a class="btn btn-primary" asp-action="Symptom" asp-controller="Home" title="Добавить">
|
||||
Добавить симптом
|
||||
</a>
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Номер</th>
|
||||
<th scope="col">Название</th>
|
||||
<th scope="col">Комментарий</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@{
|
||||
int count = 10;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
<tr>
|
||||
<th scope="row">@i</th>
|
||||
<td>вранье</td>
|
||||
<td>пациент постоянно врёт о своих приключениях</td>
|
||||
<td class="d-flex">
|
||||
<a class="btn btn-danger me-1" title="Удалить">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill" viewBox="0 0 16 16">
|
||||
<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0" />
|
||||
</svg>
|
||||
</a>
|
||||
<a class="btn btn-warning text-light" title="Редактировать" asp-action="Symptom" asp-controller="Home">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-fill" viewBox="0 0 16 16">
|
||||
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.5.5 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11z" />
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
@ -0,0 +1,25 @@
|
||||
@model ErrorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user