готовый вариант
This commit is contained in:
parent
53a37ab71f
commit
a10ddb138a
55
Polyclinic/Hospital.sln
Normal file
55
Polyclinic/Hospital.sln
Normal file
@ -0,0 +1,55 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34714.143
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalDataModels", "HospitalDataModels\HospitalDataModels.csproj", "{4270CD59-76A0-4011-8A30-284FE5F75C26}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalContracts", "HospitalContracts\HospitalContracts.csproj", "{83EF9483-CD78-4C56-9848-C0A8325FEB41}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalDatabaseImplement", "HospitalDatabaseImplement\HospitalDatabaseImplement.csproj", "{E1C0ECAB-93C0-4364-B920-456F2CAA31C5}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalBusinessLogic", "HospitalBusinessLogic\HospitalBusinessLogic.csproj", "{E3BCC45F-09E7-4E60-A662-8FAB01B25885}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalWebAppImplementer", "HospitalWebAppImplementer\HospitalWebAppImplementer.csproj", "{F7058962-2A56-434D-A0DF-6B2F3C9DD8DF}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalWebAppSuretor", "HospitalWebAppSuretor\HospitalWebAppSuretor.csproj", "{1247F34E-E27A-4653-9BEC-BC5CE5FB216A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{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
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4588D5E7-1DA1-41FA-A51A-199A0FB97380}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
105
Polyclinic/HospitalBusinessLogic/BusinessLogics/CourseLogic.cs
Normal file
105
Polyclinic/HospitalBusinessLogic/BusinessLogics/CourseLogic.cs
Normal file
@ -0,0 +1,105 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicsContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalBusinessLogic.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.Days < 1)
|
||||
{
|
||||
throw new ArgumentNullException("Количество дней приема должно быть не меньше 1", nameof(model.Days));
|
||||
}
|
||||
if (model.PillsInDay < 1)
|
||||
{
|
||||
throw new ArgumentNullException("Количество препарата в день должно быть не меньше 1", nameof(model.PillsInDay));
|
||||
}
|
||||
_logger.LogInformation("Course. Id: {Id}", model.Id);
|
||||
}
|
||||
}
|
||||
}
|
109
Polyclinic/HospitalBusinessLogic/BusinessLogics/DiagnoseLogic.cs
Normal file
109
Polyclinic/HospitalBusinessLogic/BusinessLogics/DiagnoseLogic.cs
Normal file
@ -0,0 +1,109 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicsContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalBusinessLogic.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("Болезнь с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
124
Polyclinic/HospitalBusinessLogic/BusinessLogics/DrugLogic.cs
Normal file
124
Polyclinic/HospitalBusinessLogic/BusinessLogics/DrugLogic.cs
Normal file
@ -0,0 +1,124 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicsContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class DrugLogic : IDrugLogic
|
||||
{
|
||||
private readonly ILogger logger;
|
||||
private readonly IDrugStorage drugStorage;
|
||||
|
||||
public DrugLogic(ILogger<DrugLogic> logger, IDrugStorage drugStorage)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.drugStorage = drugStorage;
|
||||
}
|
||||
public bool Create(DrugBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if(drugStorage.Insert(model) == null)
|
||||
{
|
||||
logger.LogWarning("Create operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(DrugBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
if (drugStorage.Delete(model) == null)
|
||||
{
|
||||
logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
return true;
|
||||
}
|
||||
|
||||
public DrugViewModel? ReadElement(DrugSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
logger.LogInformation("ReadElement. DrugName:{Name}.Id:{ Id}", model.Name, model.Id);
|
||||
var element = drugStorage.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<DrugViewModel>? ReadList(DrugSearchModel? model)
|
||||
{
|
||||
logger.LogInformation("ReadList. Name:{Name}. Id:{ Id}", model?.Name, model?.Id);
|
||||
var list = model == null ? drugStorage.GetFullList() : drugStorage.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(DrugBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (drugStorage.Update(model) == null)
|
||||
{
|
||||
logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(DrugBindingModel 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 = drugStorage.GetElement(new DrugSearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
});
|
||||
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Препарат с таким названием уже есть");
|
||||
}
|
||||
|
||||
logger.LogInformation("Drug. Comment:{Comment}. Id: { Id}", model.Comment, model.Id);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicsContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalBusinessLogic.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/HospitalBusinessLogic/BusinessLogics/RecipeLogic.cs
Normal file
106
Polyclinic/HospitalBusinessLogic/BusinessLogics/RecipeLogic.cs
Normal file
@ -0,0 +1,106 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicsContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalBusinessLogic.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("Количество процедур не может быть меньше 1", nameof(model));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Comment))
|
||||
{
|
||||
throw new ArgumentNullException("Нет комментария", nameof(model.Comment));
|
||||
}
|
||||
logger.LogInformation("Recipe. Comment:{Comment}. Id: { Id}", model.Comment, model.Id);
|
||||
}
|
||||
}
|
||||
}
|
109
Polyclinic/HospitalBusinessLogic/BusinessLogics/SymptomLogic.cs
Normal file
109
Polyclinic/HospitalBusinessLogic/BusinessLogics/SymptomLogic.cs
Normal file
@ -0,0 +1,109 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicsContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalBusinessLogic.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/HospitalBusinessLogic/BusinessLogics/UserLogic.cs
Normal file
117
Polyclinic/HospitalBusinessLogic/BusinessLogics/UserLogic.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicsContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalBusinessLogic.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("Нет почты пользователя", 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("Пользователь с такой почтой уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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="..\HospitalContracts\HospitalContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,13 @@
|
||||
using HospitalDataModels.Models;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class CourseBindingModel : ICourseModel
|
||||
{
|
||||
public int Days { get; set; }
|
||||
public int PillsInDay { 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 HospitalDataModels.Models;
|
||||
|
||||
namespace HospitalContracts.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 HospitalDataModels.Models;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class DrugBindingModel : IDrugModel
|
||||
{
|
||||
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 HospitalDataModels.Models;
|
||||
|
||||
namespace HospitalContracts.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 HospitalDataModels.Models;
|
||||
|
||||
namespace HospitalContracts.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 HospitalDataModels.Models;
|
||||
|
||||
namespace HospitalContracts.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 HospitalDataModels.Enums;
|
||||
using HospitalDataModels.Models;
|
||||
|
||||
namespace HospitalContracts.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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IDrugLogic
|
||||
{
|
||||
List<DrugViewModel>? ReadList(DrugSearchModel? model);
|
||||
DrugViewModel? ReadElement(DrugSearchModel model);
|
||||
bool Create(DrugBindingModel model);
|
||||
bool Update(DrugBindingModel model);
|
||||
bool Delete(DrugBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.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/HospitalContracts/HospitalContracts.csproj
Normal file
13
Polyclinic/HospitalContracts/HospitalContracts.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="..\HospitalDataModels\HospitalDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,7 @@
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class CourseSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
namespace HospitalContracts.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 HospitalContracts.SearchModels
|
||||
{
|
||||
public class DrugSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
namespace HospitalContracts.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 HospitalContracts.SearchModels
|
||||
{
|
||||
public class RecipeSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Comment { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class SymptomSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class UserSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.StoragesContracts
|
||||
{
|
||||
public interface IDrugStorage
|
||||
{
|
||||
List<DrugViewModel> GetFullList();
|
||||
List<DrugViewModel> GetFilteredList(DrugSearchModel model);
|
||||
DrugViewModel? GetElement(DrugSearchModel model);
|
||||
DrugViewModel? Insert(DrugBindingModel model);
|
||||
DrugViewModel? Update(DrugBindingModel model);
|
||||
DrugViewModel? Delete(DrugBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.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/HospitalContracts/ViewModels/CourseViewModel.cs
Normal file
17
Polyclinic/HospitalContracts/ViewModels/CourseViewModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class CourseViewModel : ICourseModel
|
||||
{
|
||||
[DisplayName("Количество дней курса")]
|
||||
public int Days { get; set; }
|
||||
[DisplayName("Препарата в день")]
|
||||
public int PillsInDay { get; set; }
|
||||
[DisplayName("Комментарий")]
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
public Dictionary<int, IDiagnoseModel> CourseDiagnoses { get; set; } = new();
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
22
Polyclinic/HospitalContracts/ViewModels/DiagnoseViewModel.cs
Normal file
22
Polyclinic/HospitalContracts/ViewModels/DiagnoseViewModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HospitalContracts.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; }
|
||||
}
|
||||
}
|
16
Polyclinic/HospitalContracts/ViewModels/DrugViewModel.cs
Normal file
16
Polyclinic/HospitalContracts/ViewModels/DrugViewModel.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class DrugViewModel : IDrugModel
|
||||
{
|
||||
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 HospitalDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HospitalContracts.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/HospitalContracts/ViewModels/RecipeViewModel.cs
Normal file
18
Polyclinic/HospitalContracts/ViewModels/RecipeViewModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HospitalContracts.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();
|
||||
}
|
||||
}
|
15
Polyclinic/HospitalContracts/ViewModels/SymptomViewModel.cs
Normal file
15
Polyclinic/HospitalContracts/ViewModels/SymptomViewModel.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HospitalContracts.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/HospitalContracts/ViewModels/UserViewModel.cs
Normal file
19
Polyclinic/HospitalContracts/ViewModels/UserViewModel.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using HospitalDataModels.Enums;
|
||||
using HospitalDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HospitalContracts.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/HospitalDataModels/Enums/UserRole.cs
Normal file
11
Polyclinic/HospitalDataModels/Enums/UserRole.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace HospitalDataModels.Enums
|
||||
{
|
||||
public enum UserRole
|
||||
{
|
||||
Неизвестный = -1,
|
||||
Администратор = 0,
|
||||
Исполнитель = 1,
|
||||
Поручитель = 2,
|
||||
Клиент = 3
|
||||
}
|
||||
}
|
9
Polyclinic/HospitalDataModels/HospitalDataModels.csproj
Normal file
9
Polyclinic/HospitalDataModels/HospitalDataModels.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
7
Polyclinic/HospitalDataModels/IId.cs
Normal file
7
Polyclinic/HospitalDataModels/IId.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace HospitalDataModels
|
||||
{
|
||||
public interface IId
|
||||
{
|
||||
int Id { get; }
|
||||
}
|
||||
}
|
10
Polyclinic/HospitalDataModels/Models/ICourseModel.cs
Normal file
10
Polyclinic/HospitalDataModels/Models/ICourseModel.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace HospitalDataModels.Models
|
||||
{
|
||||
public interface ICourseModel : IId
|
||||
{
|
||||
int Days { get; }
|
||||
int PillsInDay { get; }
|
||||
string Comment { get; }
|
||||
Dictionary<int, IDiagnoseModel> CourseDiagnoses { get; }
|
||||
}
|
||||
}
|
11
Polyclinic/HospitalDataModels/Models/IDiagnoseModel.cs
Normal file
11
Polyclinic/HospitalDataModels/Models/IDiagnoseModel.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace HospitalDataModels.Models
|
||||
{
|
||||
public interface IDiagnoseModel : IId
|
||||
{
|
||||
string Name { get; }
|
||||
string Comment { get; }
|
||||
int UserId { get; }
|
||||
DateTime DateStartDiagnose { get; }
|
||||
DateTime? DateStopDiagnose { get; }
|
||||
}
|
||||
}
|
10
Polyclinic/HospitalDataModels/Models/IDrugModel.cs
Normal file
10
Polyclinic/HospitalDataModels/Models/IDrugModel.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace HospitalDataModels.Models
|
||||
{
|
||||
public interface IDrugModel : IId
|
||||
{
|
||||
string Name { get; }
|
||||
string Comment { get; }
|
||||
int ProcedureId { get; }
|
||||
int? SymptomId { get; }
|
||||
}
|
||||
}
|
11
Polyclinic/HospitalDataModels/Models/IProcedureModel.cs
Normal file
11
Polyclinic/HospitalDataModels/Models/IProcedureModel.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace HospitalDataModels.Models
|
||||
{
|
||||
public interface IProcedureModel : IId
|
||||
{
|
||||
string Name { get; }
|
||||
string Comment { get; }
|
||||
int UserId { get; }
|
||||
DateTime DateStartProcedure { get; }
|
||||
DateTime? DateStopProcedure { get; }
|
||||
}
|
||||
}
|
10
Polyclinic/HospitalDataModels/Models/IRecipeModel.cs
Normal file
10
Polyclinic/HospitalDataModels/Models/IRecipeModel.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace HospitalDataModels.Models
|
||||
{
|
||||
public interface IRecipeModel : IId
|
||||
{
|
||||
int ProceduresCount { get; set; }
|
||||
string Comment { get; set; }
|
||||
int? CourseId { get; set; }
|
||||
Dictionary<int, IProcedureModel> RecipeProcedures { get; }
|
||||
}
|
||||
}
|
9
Polyclinic/HospitalDataModels/Models/ISymptomModel.cs
Normal file
9
Polyclinic/HospitalDataModels/Models/ISymptomModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace HospitalDataModels.Models
|
||||
{
|
||||
public interface ISymptomModel : IId
|
||||
{
|
||||
string Name { get; }
|
||||
string Comment { get; }
|
||||
Dictionary<int, IDiagnoseModel> SymptomDiagnoses { get; }
|
||||
}
|
||||
}
|
12
Polyclinic/HospitalDataModels/Models/IUserModel.cs
Normal file
12
Polyclinic/HospitalDataModels/Models/IUserModel.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using HospitalDataModels.Enums;
|
||||
|
||||
namespace HospitalDataModels.Models
|
||||
{
|
||||
public interface IUserModel : IId
|
||||
{
|
||||
string FIO { get; }
|
||||
string Email { get; }
|
||||
string Password { get; }
|
||||
UserRole Role { 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="..\HospitalContracts\HospitalContracts.csproj" />
|
||||
<ProjectReference Include="..\HospitalDataModels\HospitalDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,80 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace HospitalDatabaseImplement.Implements
|
||||
{
|
||||
public class CourseStorage : ICourseStorage
|
||||
{
|
||||
public CourseViewModel? Delete(CourseBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace HospitalDatabaseImplement.Implements
|
||||
{
|
||||
public class DiagnoseStorage : IDiagnoseStorage
|
||||
{
|
||||
public DiagnoseViewModel? Delete(DiagnoseBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
context.Diagnoses.Add(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
|
||||
public DiagnoseViewModel? Update(DiagnoseBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace HospitalDatabaseImplement.Implements
|
||||
{
|
||||
public class DrugStorage : IDrugStorage
|
||||
{
|
||||
public List<DrugViewModel> GetFullList()
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
return context.Drugs
|
||||
.Include(x => x.Symptom)
|
||||
.Include(x => x.Procedure)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<DrugViewModel> GetFilteredList(DrugSearchModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
|
||||
if (!model.Id.HasValue || !string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
return context.Drugs
|
||||
.Where(x => x.Id == model.Id || model.Name == x.Name)
|
||||
.Include(x => x.Symptom)
|
||||
.Include(x => x.Procedure)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public DrugViewModel? GetElement(DrugSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new HospitalDatabase();
|
||||
return context.Drugs
|
||||
.Include(x => x.Symptom)
|
||||
.Include(x => x.Procedure)
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?
|
||||
.GetViewModel;
|
||||
}
|
||||
|
||||
public DrugViewModel? Insert(DrugBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
|
||||
var newDrug = Drug.Create(model);
|
||||
if(newDrug == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Drugs.Add(newDrug);
|
||||
context.SaveChanges();
|
||||
return context.Drugs
|
||||
.Include(x => x.Symptom)
|
||||
.Include(x => x.Procedure)
|
||||
.FirstOrDefault(x => x.Id == newDrug.Id)?.GetViewModel;
|
||||
}
|
||||
|
||||
public DrugViewModel? Update(DrugBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
var drug = context.Drugs.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (drug == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
drug.Update(model);
|
||||
context.SaveChanges();
|
||||
return context.Drugs
|
||||
.Include(x => x.Symptom)
|
||||
.Include(x => x.Procedure)
|
||||
.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
public DrugViewModel? Delete(DrugBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
var element = context.Drugs.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Drugs.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace HospitalDatabaseImplement.Implements
|
||||
{
|
||||
public class ProcedureStorage : IProcedureStorage
|
||||
{
|
||||
public List<ProcedureViewModel> GetFullList()
|
||||
{
|
||||
using var database = new HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
var element = database.Procedures
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
database.Procedures.Remove(element);
|
||||
database.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
106
Polyclinic/HospitalDatabaseImplement/Implements/RecipeStorage.cs
Normal file
106
Polyclinic/HospitalDatabaseImplement/Implements/RecipeStorage.cs
Normal file
@ -0,0 +1,106 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace HospitalDatabaseImplement.Implements
|
||||
{
|
||||
public class RecipeStorage : IRecipeStorage
|
||||
{
|
||||
public List<RecipeViewModel> GetFullList()
|
||||
{
|
||||
using var database = new HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace HospitalDatabaseImplement.Implements
|
||||
{
|
||||
public class SymptomStorage : ISymptomStorage
|
||||
{
|
||||
public SymptomViewModel? Delete(SymptomBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
|
||||
namespace HospitalDatabaseImplement.Implements
|
||||
{
|
||||
public class UserStorage : IUserStorage
|
||||
{
|
||||
public UserViewModel? Delete(UserBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
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 HospitalDatabase();
|
||||
context.Users.Add(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
|
||||
public UserViewModel? Update(UserBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
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/HospitalDatabaseImplement/Migrations/20240501173650_InitialMigr.Designer.cs
generated
Normal file
456
Polyclinic/HospitalDatabaseImplement/Migrations/20240501173650_InitialMigr.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 HospitalDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(HospitalDatabase))]
|
||||
[Migration("20240501173650_InitialMigr")]
|
||||
partial class InitialMigr
|
||||
{
|
||||
/// <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("HospitalDatabaseImplement.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>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PillsInDay")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Courses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.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("HospitalDatabaseImplement.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("HospitalDatabaseImplement.Models.Drug", 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("Drugs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.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("HospitalDatabaseImplement.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("HospitalDatabaseImplement.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("HospitalDatabaseImplement.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("HospitalDatabaseImplement.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("HospitalDatabaseImplement.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("HospitalDatabaseImplement.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("HospitalDatabaseImplement.Models.CourseDiagnose", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Course", "Course")
|
||||
.WithMany("Diagnoses")
|
||||
.HasForeignKey("CourseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Diagnose", "Diagnose")
|
||||
.WithMany()
|
||||
.HasForeignKey("DiagnoseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Course");
|
||||
|
||||
b.Navigation("Diagnose");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Diagnose", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Drug", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Procedure", "Procedure")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Symptom", "Symptom")
|
||||
.WithMany()
|
||||
.HasForeignKey("SymptomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Procedure");
|
||||
|
||||
b.Navigation("Symptom");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Procedure", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Recipe", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Course", "Course")
|
||||
.WithMany()
|
||||
.HasForeignKey("CourseId");
|
||||
|
||||
b.Navigation("Course");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.RecipeProcedure", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Procedure", "Procedure")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Recipe", "Recipe")
|
||||
.WithMany("Procedures")
|
||||
.HasForeignKey("RecipeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Procedure");
|
||||
|
||||
b.Navigation("Recipe");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.SymptomDiagnose", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Diagnose", "Diagnose")
|
||||
.WithMany()
|
||||
.HasForeignKey("DiagnoseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Symptom", "Symptom")
|
||||
.WithMany("Diagnoses")
|
||||
.HasForeignKey("SymptomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Diagnose");
|
||||
|
||||
b.Navigation("Symptom");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.SymptomRecipe", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Recipe", "Recipe")
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Symptom", "Symptom")
|
||||
.WithMany()
|
||||
.HasForeignKey("SymptomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Recipe");
|
||||
|
||||
b.Navigation("Symptom");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Course", b =>
|
||||
{
|
||||
b.Navigation("Diagnoses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Recipe", b =>
|
||||
{
|
||||
b.Navigation("Procedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Symptom", b =>
|
||||
{
|
||||
b.Navigation("Diagnoses");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,360 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace HospitalDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialMigr : 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"),
|
||||
Days = table.Column<int>(type: "int", nullable: false),
|
||||
PillsInDay = 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: "Drugs",
|
||||
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_Drugs", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Drugs_Procedures_ProcedureId",
|
||||
column: x => x.ProcedureId,
|
||||
principalTable: "Procedures",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Drugs_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_Drugs_ProcedureId",
|
||||
table: "Drugs",
|
||||
column: "ProcedureId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Drugs_SymptomId",
|
||||
table: "Drugs",
|
||||
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: "Drugs");
|
||||
|
||||
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 HospitalDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(HospitalDatabase))]
|
||||
partial class HospitalDatabaseModelSnapshot : 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("HospitalDatabaseImplement.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>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PillsInDay")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Courses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.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("HospitalDatabaseImplement.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("HospitalDatabaseImplement.Models.Drug", 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("Drugs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.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("HospitalDatabaseImplement.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("HospitalDatabaseImplement.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("HospitalDatabaseImplement.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("HospitalDatabaseImplement.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("HospitalDatabaseImplement.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("HospitalDatabaseImplement.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("HospitalDatabaseImplement.Models.CourseDiagnose", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Course", "Course")
|
||||
.WithMany("Diagnoses")
|
||||
.HasForeignKey("CourseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Diagnose", "Diagnose")
|
||||
.WithMany()
|
||||
.HasForeignKey("DiagnoseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Course");
|
||||
|
||||
b.Navigation("Diagnose");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Diagnose", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Drug", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Procedure", "Procedure")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Symptom", "Symptom")
|
||||
.WithMany()
|
||||
.HasForeignKey("SymptomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Procedure");
|
||||
|
||||
b.Navigation("Symptom");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Procedure", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Recipe", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Course", "Course")
|
||||
.WithMany()
|
||||
.HasForeignKey("CourseId");
|
||||
|
||||
b.Navigation("Course");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.RecipeProcedure", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Procedure", "Procedure")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Recipe", "Recipe")
|
||||
.WithMany("Procedures")
|
||||
.HasForeignKey("RecipeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Procedure");
|
||||
|
||||
b.Navigation("Recipe");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.SymptomDiagnose", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Diagnose", "Diagnose")
|
||||
.WithMany()
|
||||
.HasForeignKey("DiagnoseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Symptom", "Symptom")
|
||||
.WithMany("Diagnoses")
|
||||
.HasForeignKey("SymptomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Diagnose");
|
||||
|
||||
b.Navigation("Symptom");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.SymptomRecipe", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Recipe", "Recipe")
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Symptom", "Symptom")
|
||||
.WithMany()
|
||||
.HasForeignKey("SymptomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Recipe");
|
||||
|
||||
b.Navigation("Symptom");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Course", b =>
|
||||
{
|
||||
b.Navigation("Diagnoses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Recipe", b =>
|
||||
{
|
||||
b.Navigation("Procedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Symptom", b =>
|
||||
{
|
||||
b.Navigation("Diagnoses");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
90
Polyclinic/HospitalDatabaseImplement/Models/Course.cs
Normal file
90
Polyclinic/HospitalDatabaseImplement/Models/Course.cs
Normal file
@ -0,0 +1,90 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataModels.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace HospitalDatabaseImplement.Models
|
||||
{
|
||||
public class Course : ICourseModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int Days { get; set; }
|
||||
[Required]
|
||||
public int PillsInDay { 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(HospitalDatabase context, CourseBindingModel model)
|
||||
{
|
||||
return new Course()
|
||||
{
|
||||
Id = model.Id,
|
||||
Days = model.Days,
|
||||
PillsInDay = model.PillsInDay,
|
||||
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)
|
||||
{
|
||||
Days = model.Days;
|
||||
PillsInDay = model.PillsInDay;
|
||||
Comment = model.Comment;
|
||||
}
|
||||
|
||||
public CourseViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Days = Days,
|
||||
PillsInDay = PillsInDay,
|
||||
Comment = Comment,
|
||||
CourseDiagnoses = CourseDiagnoses
|
||||
};
|
||||
|
||||
public void UpdateDiagnoses(HospitalDatabase 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 HospitalDatabaseImplement.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/HospitalDatabaseImplement/Models/Diagnose.cs
Normal file
60
Polyclinic/HospitalDatabaseImplement/Models/Diagnose.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace HospitalDatabaseImplement.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/HospitalDatabaseImplement/Models/Drug.cs
Normal file
55
Polyclinic/HospitalDatabaseImplement/Models/Drug.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataModels.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace HospitalDatabaseImplement.Models
|
||||
{
|
||||
public class Drug : IDrugModel
|
||||
{
|
||||
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 Drug Create(DrugBindingModel bindingModel)
|
||||
{
|
||||
return new Drug()
|
||||
{
|
||||
Id = bindingModel.Id,
|
||||
Name = bindingModel.Name,
|
||||
Comment = bindingModel.Comment,
|
||||
ProcedureId = bindingModel.ProcedureId,
|
||||
SymptomId = bindingModel.SymptomId
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(DrugBindingModel bindingModel)
|
||||
{
|
||||
Name = bindingModel.Name;
|
||||
Comment = bindingModel.Comment;
|
||||
}
|
||||
|
||||
public DrugViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Comment = Comment,
|
||||
ProcedureId = ProcedureId,
|
||||
SymptomId = Symptom?.Id ?? null
|
||||
};
|
||||
}
|
||||
}
|
56
Polyclinic/HospitalDatabaseImplement/Models/Procedure.cs
Normal file
56
Polyclinic/HospitalDatabaseImplement/Models/Procedure.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataModels.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace HospitalDatabaseImplement.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,
|
||||
};
|
||||
}
|
||||
}
|
91
Polyclinic/HospitalDatabaseImplement/Models/Recipe.cs
Normal file
91
Polyclinic/HospitalDatabaseImplement/Models/Recipe.cs
Normal file
@ -0,0 +1,91 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataModels.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace HospitalDatabaseImplement.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(HospitalDatabase 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(HospitalDatabase 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 HospitalDatabaseImplement.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();
|
||||
}
|
||||
}
|
86
Polyclinic/HospitalDatabaseImplement/Models/Symptom.cs
Normal file
86
Polyclinic/HospitalDatabaseImplement/Models/Symptom.cs
Normal file
@ -0,0 +1,86 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataModels.Models;
|
||||
using SecuritySystemDatabaseImplement;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace HospitalDatabaseImplement.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(HospitalDatabase 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(HospitalDatabase 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 HospitalDatabaseImplement.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();
|
||||
}
|
||||
}
|
15
Polyclinic/HospitalDatabaseImplement/Models/SymptomRecipe.cs
Normal file
15
Polyclinic/HospitalDatabaseImplement/Models/SymptomRecipe.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace HospitalDatabaseImplement.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/HospitalDatabaseImplement/Models/User.cs
Normal file
59
Polyclinic/HospitalDatabaseImplement/Models/User.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataModels.Enums;
|
||||
using HospitalDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace HospitalDatabaseImplement.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/HospitalDatabaseImplement/PolyclinicDatabase.cs
Normal file
29
Polyclinic/HospitalDatabaseImplement/PolyclinicDatabase.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
|
||||
namespace SecuritySystemDatabaseImplement
|
||||
{
|
||||
public class HospitalDatabase : DbContext
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=HospitalDatabase1;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<Drug> Drugs { 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; }
|
||||
|
||||
}
|
||||
}
|
22
Polyclinic/HospitalView/PolyclinicView.csproj
Normal file
22
Polyclinic/HospitalView/PolyclinicView.csproj
Normal file
@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<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>
|
17
Polyclinic/HospitalView/Program.cs
Normal file
17
Polyclinic/HospitalView/Program.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace PolyclinicView
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
//Application.Run();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using HospitalWebAppImplementer.Models;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace HospitalWebAppImplementer.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 DrugsByDiagnoses()
|
||||
{
|
||||
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,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="..\HospitalDatabaseImplement\HospitalDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,9 @@
|
||||
namespace HospitalWebAppImplementer.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
27
Polyclinic/HospitalWebAppImplementer/Program.cs
Normal file
27
Polyclinic/HospitalWebAppImplementer/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": {
|
||||
"HospitalWebAppImplementer": {
|
||||
"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/HospitalWebAppImplementer/SiteMenuItems.cs
Normal file
24
Polyclinic/HospitalWebAppImplementer/SiteMenuItems.cs
Normal file
@ -0,0 +1,24 @@
|
||||
namespace HospitalWebAppImplementer
|
||||
{
|
||||
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) DrugsByDiagnoses = ("DrugsByDiagnoses", "Лекарства по болезням");
|
||||
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, DrugsByDiagnoses, DiagnosesReport
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
@{
|
||||
ViewData["Title"] = "AddRecipeToCourse";
|
||||
}
|
||||
<h4 class="text-center">Привязка рецепта к курсу</h4>
|
||||
<form class="d-flex justify-content-center flex-row align-content-center mb-3" 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 < 5; 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 < 5; i++)
|
||||
{
|
||||
<option value="@i">Курс @i</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<div class="col-3">
|
||||
<button class="btn btn-outline-success" type="submit">
|
||||
Привязать
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,62 @@
|
||||
@{
|
||||
ViewData["Title"] = "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 < 5; i++)
|
||||
{
|
||||
<option value="@i">Болезнь @i</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<button class="btn btn-outline-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 class="trash3-fill" width="16" height="16" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
|
||||
<path d="M65.2123 159.963L56 60.0001C88.0236 76.3307 119.521 77.4194 149 60.0001C141.63 142.346 140.08 160.953 140.226 159.963H65.2123Z" stroke="#D10000" stroke-width="8" />
|
||||
<path d="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
|
||||
</svg>
|
||||
</a>
|
||||
<span>Выбранная болезнь</span>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ol>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">
|
||||
<button class="btn btn-outline-success" type="submit">
|
||||
Сохранить
|
||||
</button>
|
||||
@Html.ActionLink("Отмена", "Courses", "Home", null, new { @class = "btn btn-outline-warning" })
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,52 @@
|
||||
@{
|
||||
ViewData["Title"] = "Courses";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Курсы</h1>
|
||||
</div>
|
||||
<div>
|
||||
<div class="d-flex flex-row">
|
||||
<a class="btn btn-outline-dark" 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>
|
||||
@{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
<tr>
|
||||
<th scope="row">@i</th>
|
||||
<td>1</td>
|
||||
<td>1</td>
|
||||
<td>Комментарий</td>
|
||||
<td class="d-flex">
|
||||
<a class="btn btn-light me-1" title="Удалить">
|
||||
<svg class="trash3-fill" width="16" height="16" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
|
||||
<path d="M65.2123 159.963L56 60.0001C88.0236 76.3307 119.521 77.4194 149 60.0001C141.63 142.346 140.08 160.953 140.226 159.963H65.2123Z" stroke="#D10000" stroke-width="8" />
|
||||
<path d="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
|
||||
</svg>
|
||||
</a>
|
||||
<a class="btn btn-light text-light" title="Редактировать" asp-action="Course" asp-controller="Home">
|
||||
<svg class="pencil" viewBox="0 0 127 127" width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M105.5 26L37 114.5C34.5 117 16.3 121.7 7.5 122.5C79.1 34.1 101 5.5 102 4C104.833 4.5 119.3 14.6 122.5 21C105 44 98.5 55 111.5 58.5" stroke="#008315" stroke-width="6" stroke-linecap="round" />
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
@ -0,0 +1,30 @@
|
||||
@{
|
||||
ViewData["Title"] = "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-outline-success" type="submit">
|
||||
Сохранить
|
||||
</button>
|
||||
@Html.ActionLink("Отмена", "Diagnoses", "Home", null, new { @class = "btn btn-outline-warning" })
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,53 @@
|
||||
@{
|
||||
ViewData["Title"] = "Diagnoses";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Болезни</h1>
|
||||
</div>
|
||||
<div>
|
||||
<div class="d-flex flex-row">
|
||||
<a class="btn btn-outline-dark" 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>
|
||||
@{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
<tr>
|
||||
<th scope="row">@i</th>
|
||||
<td>Название болезни</td>
|
||||
<td>Начало болезни</td>
|
||||
<td>Конец болезни</td>
|
||||
<td>Комментарий к болезни</td>
|
||||
<td class="d-flex">
|
||||
<a class="btn btn-light me-1" title="Удалить">
|
||||
<svg class="trash3-fill" width="16" height="16" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
|
||||
<path d="M65.2123 159.963L56 60.0001C88.0236 76.3307 119.521 77.4194 149 60.0001C141.63 142.346 140.08 160.953 140.226 159.963H65.2123Z" stroke="#D10000" stroke-width="8" />
|
||||
<path d="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
|
||||
</svg>
|
||||
</a>
|
||||
<a class="btn btn-light text-light" title="Редактировать" asp-action="Course" asp-controller="Home">
|
||||
<svg class="pencil" viewBox="0 0 127 127" width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M105.5 26L37 114.5C34.5 117 16.3 121.7 7.5 122.5C79.1 34.1 101 5.5 102 4C104.833 4.5 119.3 14.6 122.5 21C105 44 98.5 55 111.5 58.5" stroke="#008315" stroke-width="6" stroke-linecap="round" />
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
@ -0,0 +1,113 @@
|
||||
@{
|
||||
ViewData["Title"] = "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-outline-success" type="submit">
|
||||
Сформировать
|
||||
</button>
|
||||
</form>
|
||||
@if (ViewData.ContainsKey("ShowReport"))
|
||||
{
|
||||
<table class="table mt-3 caption-top table-hover">
|
||||
<caption>Отчет по болезням с 01.01.2024 по 31.12.2024</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)
|
||||
</th>
|
||||
<td>
|
||||
Болезнь
|
||||
</td>
|
||||
<td>
|
||||
Дата начала
|
||||
</td>
|
||||
<td>
|
||||
Дата завершения
|
||||
</td>
|
||||
<td>
|
||||
Курсы
|
||||
</td>
|
||||
<td>
|
||||
Симптомы
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Курс</td>
|
||||
<td>Симптом</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Курс</td>
|
||||
<td>Симптом</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Курс</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
@ -0,0 +1,40 @@
|
||||
@{
|
||||
ViewData["Title"] = "DrugsByDiagnoses";
|
||||
}
|
||||
<h4 class="text-center">Список лекарств по болезням</h4>
|
||||
<form class="text-center">
|
||||
<h5 class="text-center">Выберите болезни</h5>
|
||||
<div class="d-flex justify-content-center flex-row align-content-center mb-3" style="max-width: 500px; max-height: 300px;">
|
||||
<ul>
|
||||
@{
|
||||
for(int i = 0; i < 5; 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="d-flex justify-content-center flex-row align-content-center 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="d-flex justify-content-center flex-row align-content-center mb-3">
|
||||
<h5>Укажите название файла</h5>
|
||||
<input type="text" id="fileName"/>
|
||||
</div>
|
||||
<button class="btn btn-outline-success" type="submit">
|
||||
Скачать отчет
|
||||
</button>
|
||||
</form>
|
@ -0,0 +1,7 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1>Добро пожаловать!</h1>
|
||||
</div>
|
25
Polyclinic/HospitalWebAppImplementer/Views/Home/Login.cshtml
Normal file
25
Polyclinic/HospitalWebAppImplementer/Views/Home/Login.cshtml
Normal file
@ -0,0 +1,25 @@
|
||||
@{
|
||||
ViewData["Title"] = "Login";
|
||||
}
|
||||
<div class="d-flex w-100 h-100 align-content-center justify-content-center align-items-center mt-5 pt-5">
|
||||
<form class="d-flex flex-column border border-3 rounded-3 p-5" id="loginForm" method="post">
|
||||
<h4>Вход</h4>
|
||||
<div class="mb-2 row">
|
||||
<label for="emailInput" class="col-4 ps-0">
|
||||
Email
|
||||
</label>
|
||||
<input id="emailInput" type="email" name="email" placeholder="e-mail@mail.ru" class="col-8" />
|
||||
</div>
|
||||
<div class="mb-2 row">
|
||||
<label for="passwordInput" class="col-4 ps-0">
|
||||
Пароль
|
||||
</label>
|
||||
<input id="passwordInput" type="password" name="password" class="col-8" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<button class="btn btn-outline-success" type="submit">
|
||||
Войти
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1,4 @@
|
||||
@{
|
||||
ViewData["Title"] = "Privacy";
|
||||
}
|
||||
<h1>Политика приватности</h1>
|
@ -0,0 +1,29 @@
|
||||
@{
|
||||
ViewData["Title"] = "Register";
|
||||
}
|
||||
<div class="d-flex w-100 h-100 align-content-center justify-content-center align-items-center mt-5 pt-5">
|
||||
<form class="d-flex flex-column border border-3 rounded-3 p-5" id="loginForm" method="post">
|
||||
<h4>Регистрация</h4>
|
||||
<div class="d-flex mb-3">
|
||||
<label for="fioInput" class="pe-3 w-25">
|
||||
ФИО
|
||||
</label>
|
||||
<input class="w-100" type="text" name="fio" id="fioInput" placeholder="Олег Олег Олег" />
|
||||
</div>
|
||||
<div class="d-flex mb-3">
|
||||
<label for="emailInput" class="pe-3 w-25">
|
||||
Email
|
||||
</label>
|
||||
<input class="w-100" type="email" name="email" id="emailInput" placeholder="e-mail@mail.ru" />
|
||||
</div>
|
||||
<div class="d-flex mb-3">
|
||||
<label for="passwordInput" class="pe-3 w-25">
|
||||
Пароль
|
||||
</label>
|
||||
<input class="w-100" type="password" name="password" id="passwordInput" />
|
||||
</div>
|
||||
<button class="btn btn-outline-success" type="submit">
|
||||
Зарегистрироваться
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1,58 @@
|
||||
@{
|
||||
ViewData["Title"] = "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>
|
||||
@{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
<option value="@i">Болезнь @i</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<button class="btn btn-outline-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 < 5; i++)
|
||||
{
|
||||
<li class="mb-2 ps-1 ms-1">
|
||||
<a asp-action="Symptom" class="text-decoration-none">
|
||||
<svg class="trash3-fill" width="16" height="16" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
|
||||
<path d="M65.2123 159.963L56 60.0001C88.0236 76.3307 119.521 77.4194 149 60.0001C141.63 142.346 140.08 160.953 140.226 159.963H65.2123Z" stroke="#D10000" stroke-width="8" />
|
||||
<path d="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
|
||||
</svg>
|
||||
</a>
|
||||
<span>Выбранная болезнь</span>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ol>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">
|
||||
<button class="btn btn-outline-success" type="submit">
|
||||
Сохранить
|
||||
</button>
|
||||
@Html.ActionLink("Отмена", "Courses", "Home", null, new { @class = "btn btn-outline-warning" })
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,49 @@
|
||||
@{
|
||||
ViewData["Title"] = "Symptomes";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Симптомы</h1>
|
||||
</div>
|
||||
<div>
|
||||
<div class="d-flex flex-row">
|
||||
<a class="btn btn-outline-dark" 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>
|
||||
@{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
<tr>
|
||||
<th scope="row">@i</th>
|
||||
<td>Название симптома</td>
|
||||
<td>Комментарий к симптому</td>
|
||||
<td class="d-flex">
|
||||
<a class="btn btn-light me-1" title="Удалить">
|
||||
<svg class="trash3-fill" width="16" height="16" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
|
||||
<path d="M65.2123 159.963L56 60.0001C88.0236 76.3307 119.521 77.4194 149 60.0001C141.63 142.346 140.08 160.953 140.226 159.963H65.2123Z" stroke="#D10000" stroke-width="8" />
|
||||
<path d="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
|
||||
</svg>
|
||||
</a>
|
||||
<a class="btn btn-light text-light" title="Редактировать" asp-action="Course" asp-controller="Home">
|
||||
<svg class="pencil" viewBox="0 0 127 127" width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M105.5 26L37 114.5C34.5 117 16.3 121.7 7.5 122.5C79.1 34.1 101 5.5 102 4C104.833 4.5 119.3 14.6 122.5 21C105 44 98.5 55 111.5 58.5" stroke="#008315" stroke-width="6" stroke-linecap="round" />
|
||||
</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