Compare commits
77 Commits
stage7_use
...
3e78e51f7c
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e78e51f7c | |||
| 64558376ee | |||
| 68c704f47c | |||
| 3f0ea55aad | |||
| 036c2373a3 | |||
| 97c8230045 | |||
| 00dbb2356c | |||
| 1c68c684c6 | |||
| db2fdf4763 | |||
| f36d9c8d1d | |||
| bcd851627e | |||
| 099384e070 | |||
| 7b94e137ad | |||
| aa1e0c4e99 | |||
| 93ba4756b1 | |||
| d1fc181b08 | |||
| 92e74d1d7d | |||
| ea7b4f252b | |||
| 5504fbf970 | |||
| 3bfc9cf130 | |||
| 4ac7886a74 | |||
| 79f512bb16 | |||
| 1c6afcfa2b | |||
| ed9494b8a9 | |||
| 84a5ee78c7 | |||
| a1bacf5b8f | |||
| e558327e81 | |||
| 0b7869e140 | |||
| f1a112715c | |||
| 3b067247ad | |||
| 9d840a764e | |||
| 7eb6e50cd6 | |||
| 4f3243bb1c | |||
| 58fbf0ac08 | |||
| 9c97590f23 | |||
| abc0bcf254 | |||
| 3641f5e5d2 | |||
| 18380f3532 | |||
| 549379a588 | |||
| 7ed2d70455 | |||
| f6c52a08ad | |||
| e8a9d126e4 | |||
| bf0bf081c7 | |||
| b8e5d33365 | |||
| 1ab91e7b63 | |||
| be8a36c9eb | |||
| 320e2a4ace | |||
| 34cae3a0ed | |||
| d747d42272 | |||
| 48dd095182 | |||
| 19f7fbb7f4 | |||
| 1e02a06b49 | |||
| 171ca6d819 | |||
| fa8d5d9d8e | |||
| 4f6a0ba0be | |||
| 4b5cf5582e | |||
| c5b0f0fe6c | |||
| bd594232f9 | |||
| d61c3124bc | |||
| 25c1152969 | |||
| 9f82321bc8 | |||
| 13ecdcaecc | |||
| 21b9bed09b | |||
| c26bbd5d6a | |||
| bdd5a9649a | |||
| a24099df3c | |||
| 9f44ad75be | |||
| 5546ab58e7 | |||
| 9210c87079 | |||
| 2047774700 | |||
| 05109f7b3f | |||
| b13b15c597 | |||
| 5a05bebae3 | |||
| a02725ff2b | |||
| ae8143bbee | |||
| 4624023c86 | |||
| 138d0b9c76 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -398,3 +398,6 @@ FodyWeavers.xsd
|
|||||||
# JetBrains Rider
|
# JetBrains Rider
|
||||||
*.sln.iml
|
*.sln.iml
|
||||||
|
|
||||||
|
*.docx
|
||||||
|
*.xlsx
|
||||||
|
*.pdf
|
||||||
@@ -12,7 +12,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
private ILogger _logger;
|
private ILogger _logger;
|
||||||
private ICourseStorage _courseStorage;
|
private ICourseStorage _courseStorage;
|
||||||
|
|
||||||
public CourseLogic(ILogger logger, ICourseStorage courseStorage)
|
public CourseLogic(ILogger<CourseLogic> logger, ICourseStorage courseStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_courseStorage = courseStorage;
|
_courseStorage = courseStorage;
|
||||||
@@ -58,14 +58,14 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CourseViewModel>? ReadList(CourseSearchModel? model)
|
public List<CourseViewModel> ReadList(CourseSearchModel? model = null)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("ReadList. Id:{Id}", model?.Id);
|
_logger.LogInformation("ReadList. Id:{Id}", model?.Id);
|
||||||
var list = model == null ? _courseStorage.GetFullList() : _courseStorage.GetFilteredList(model);
|
var list = model == null ? _courseStorage.GetFullList() : _courseStorage.GetFilteredList(model);
|
||||||
if (list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("ReadList return null list");
|
_logger.LogWarning("ReadList return null list");
|
||||||
return null;
|
return new List<CourseViewModel>();
|
||||||
}
|
}
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
private ILogger _logger;
|
private ILogger _logger;
|
||||||
private IDiagnoseStorage _diagnoseStorage;
|
private IDiagnoseStorage _diagnoseStorage;
|
||||||
|
|
||||||
public DiagnoseLogic(ILogger logger, IDiagnoseStorage diagnoseStorage)
|
public DiagnoseLogic(ILogger<DiagnoseLogic> logger, IDiagnoseStorage diagnoseStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_diagnoseStorage = diagnoseStorage;
|
_diagnoseStorage = diagnoseStorage;
|
||||||
@@ -58,14 +58,14 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DiagnoseViewModel>? ReadList(DiagnoseSearchModel? model)
|
public List<DiagnoseViewModel> ReadList(DiagnoseSearchModel? model = null)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("ReadList. Name:{Name} Id:{Id}, UserId:{UserId}", model?.Name, model?.Id, model?.UserId);
|
_logger.LogInformation("ReadList. Name:{Name} Id:{Id}, UserId:{UserId}", model?.Name, model?.Id, model?.UserId);
|
||||||
var list = model == null ? _diagnoseStorage.GetFullList() : _diagnoseStorage.GetFilteredList(model);
|
var list = model == null ? _diagnoseStorage.GetFullList() : _diagnoseStorage.GetFilteredList(model);
|
||||||
if (list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("ReadList return null list");
|
_logger.LogWarning("ReadList return null list");
|
||||||
return null;
|
return new List<DiagnoseViewModel>();
|
||||||
}
|
}
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
@@ -99,10 +99,6 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
throw new ArgumentNullException("Какой-то неправильный идентификатор процедуры...", nameof(model));
|
throw new ArgumentNullException("Какой-то неправильный идентификатор процедуры...", nameof(model));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(model.Comment))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет комментария", nameof(model.Comment));
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.Name))
|
if (string.IsNullOrEmpty(model.Name))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Нет названия у препарата", nameof(model.Comment));
|
throw new ArgumentNullException("Нет названия у препарата", nameof(model.Comment));
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
if (list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
logger.LogWarning("ReadList return null list");
|
logger.LogWarning("ReadList return null list");
|
||||||
return null;
|
return new List<ProcedureViewModel>();
|
||||||
}
|
}
|
||||||
logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
@@ -58,14 +58,14 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RecipeViewModel>? ReadList(RecipeSearchModel? model)
|
public List<RecipeViewModel>? ReadList(RecipeSearchModel? model = null)
|
||||||
{
|
{
|
||||||
logger.LogInformation("ReadList. Comment:{Comment}. Id:{ Id}", model?.Comment, model?.Id);
|
logger.LogInformation("ReadList. Comment:{Comment}. Id:{ Id}", model?.Comment, model?.Id);
|
||||||
var list = model == null ? recipeStorage.GetFullList() : recipeStorage.GetFilteredList(model);
|
var list = model == null ? recipeStorage.GetFullList() : recipeStorage.GetFilteredList(model);
|
||||||
if (list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
logger.LogWarning("ReadList return null list");
|
logger.LogWarning("ReadList return null list");
|
||||||
return null;
|
return new List<RecipeViewModel>();
|
||||||
}
|
}
|
||||||
logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||||
return list;
|
return list;
|
||||||
@@ -96,10 +96,6 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
throw new ArgumentNullException("Количество процедур не может быть равно нулю или быть меньше нуля", nameof(model));
|
throw new ArgumentNullException("Количество процедур не может быть равно нулю или быть меньше нуля", nameof(model));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(model.Comment))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет комментария", nameof(model.Comment));
|
|
||||||
}
|
|
||||||
logger.LogInformation("Recipe. Comment:{Comment}. Id: { Id}", model.Comment, model.Id);
|
logger.LogInformation("Recipe. Comment:{Comment}. Id: { Id}", model.Comment, model.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
using PolyclinicContracts.BindingModels;
|
using PolyclinicBusinessLogic.OfficePackage;
|
||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperModels.Excel;
|
||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperModels.PDF;
|
||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperModels.Word;
|
||||||
|
using PolyclinicContracts.BindingModels;
|
||||||
using PolyclinicContracts.BusinessLogicsContracts;
|
using PolyclinicContracts.BusinessLogicsContracts;
|
||||||
using PolyclinicContracts.SearchModels;
|
using PolyclinicContracts.SearchModels;
|
||||||
using PolyclinicContracts.StoragesContracts;
|
using PolyclinicContracts.StoragesContracts;
|
||||||
@@ -15,35 +19,37 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
private readonly ICourseStorage courseStorage;
|
private readonly ICourseStorage courseStorage;
|
||||||
private readonly ISymptomStorage symptomStorage;
|
private readonly ISymptomStorage symptomStorage;
|
||||||
private readonly IRecipeStorage recipeStorage;
|
private readonly IRecipeStorage recipeStorage;
|
||||||
|
|
||||||
|
private readonly AbstractSaveToWordCoursesByProcedures saveToWord;
|
||||||
|
private readonly AbstractSaveToExcelCoursesByProcedure saveToExcel;
|
||||||
|
private readonly AbstractSaveToPdfProcedures saveToPdf;
|
||||||
public SuretorReportLogic(IProcedureStorage procedureStorage, IMedicamentStorage medicamentStorage,
|
public SuretorReportLogic(IProcedureStorage procedureStorage, IMedicamentStorage medicamentStorage,
|
||||||
ICourseStorage courseStorage, ISymptomStorage symptomStorage, IRecipeStorage recipeStorage)
|
ICourseStorage courseStorage, ISymptomStorage symptomStorage, IRecipeStorage recipeStorage,
|
||||||
|
AbstractSaveToWordCoursesByProcedures saveToWord, AbstractSaveToExcelCoursesByProcedure saveToExcel,
|
||||||
|
AbstractSaveToPdfProcedures saveToPdf)
|
||||||
{
|
{
|
||||||
this.procedureStorage = procedureStorage;
|
this.procedureStorage = procedureStorage;
|
||||||
this.medicamentStorage = medicamentStorage;
|
this.medicamentStorage = medicamentStorage;
|
||||||
this.courseStorage = courseStorage;
|
this.courseStorage = courseStorage;
|
||||||
this.symptomStorage = symptomStorage;
|
this.symptomStorage = symptomStorage;
|
||||||
this.recipeStorage = recipeStorage;
|
this.recipeStorage = recipeStorage;
|
||||||
|
this.saveToWord = saveToWord;
|
||||||
|
this.saveToExcel = saveToExcel;
|
||||||
|
this.saveToPdf = saveToPdf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ReportCoursesByProcedureViewModel> GetProcedureCourses(ProcedureSearchModel model)
|
public List<CourseViewModel> GetProcedureCourses(ProcedureSearchModel model)
|
||||||
{
|
{
|
||||||
var procedure = procedureStorage.GetElement(model);
|
var procedure = procedureStorage.GetElement(model);
|
||||||
var courses = courseStorage.GetFullList();
|
var courses = courseStorage.GetFullList();
|
||||||
var recipes = recipeStorage.GetFullList();
|
var recipes = recipeStorage.GetFullList();
|
||||||
var list = new List<ReportCoursesByProcedureViewModel>();
|
var list = new List<CourseViewModel>();
|
||||||
|
|
||||||
var record = new ReportCoursesByProcedureViewModel
|
|
||||||
{
|
|
||||||
Name = procedure!.Name,
|
|
||||||
Courses = new List<(int countDays, int pillsPerDay, string comment)>()
|
|
||||||
};
|
|
||||||
|
|
||||||
using var context = new PolyclinicDatabase();
|
using var context = new PolyclinicDatabase();
|
||||||
|
|
||||||
var recipeProcedureId = context.RecipeProcedures
|
var recipeProcedureId = context.RecipeProcedures
|
||||||
.Where(x => x.ProcedureId == model.Id).Select(x => x.RecipeId).ToList();
|
.Where(x => x.ProcedureId == model.Id).Select(x => x.RecipeId).ToList();
|
||||||
|
|
||||||
|
|
||||||
foreach (var recipe in recipes)
|
foreach (var recipe in recipes)
|
||||||
{
|
{
|
||||||
foreach (var recipeId in recipeProcedureId)
|
foreach (var recipeId in recipeProcedureId)
|
||||||
@@ -54,17 +60,16 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
if(recipe.CourseId == course.Id)
|
if(recipe.CourseId == course.Id)
|
||||||
{
|
{
|
||||||
record.Courses.Add((course.DaysCount, course.PillsPerDay, course.Comment));
|
list.Add(course);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list.Add(record);
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ReportProceduresViewModel> GetProcedures(ReportBindingModel model)
|
public List<ReportProceduresViewModel> GetProceduresByMedicametsAndSymptoms()
|
||||||
{
|
{
|
||||||
var procedures = procedureStorage.GetFullList();
|
var procedures = procedureStorage.GetFullList();
|
||||||
var medicaments = medicamentStorage.GetFullList();
|
var medicaments = medicamentStorage.GetFullList();
|
||||||
@@ -75,9 +80,10 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
var record = new ReportProceduresViewModel
|
var record = new ReportProceduresViewModel
|
||||||
{
|
{
|
||||||
|
Id = procedure.Id,
|
||||||
ProcedureName = procedure.Name,
|
ProcedureName = procedure.Name,
|
||||||
DateStartProcedure = procedure.DateStartProcedure,
|
DateStartProcedure = procedure.DateStartProcedure,
|
||||||
DateStopProcedure = procedure.DateStopProcedure,
|
DateStopProcedure = procedure.DateStopProcedure ?? DateTime.MaxValue,
|
||||||
MedicamentSymptom = new List<(string medicamentName, string symptomName)>()
|
MedicamentSymptom = new List<(string medicamentName, string symptomName)>()
|
||||||
};
|
};
|
||||||
foreach (var medicament in medicaments)
|
foreach (var medicament in medicaments)
|
||||||
@@ -98,19 +104,36 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveCoursesByProcedureToExcelFile(ReportBindingModel model)
|
public void SaveCoursesByProcedureToExcelFile(ReportBindingModel model, ProcedureSearchModel procedureSearchMode)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
saveToExcel.CreateReport(new ExcelCoursesByProceduresInfo
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Курсы по процедуре" + $" '{procedureSearchMode.Name}'",
|
||||||
|
Courses = GetProcedureCourses(procedureSearchMode)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveCoursesByProcedureToWordFile(ReportBindingModel model)
|
public void SaveCoursesByProcedureToWordFile(ReportBindingModel model, ProcedureSearchModel procedureSearchMode)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
saveToWord.CreateDoc(new WordCoursesByProceduresInfo
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Курсы по процедуре" + $" '{procedureSearchMode.Name}'",
|
||||||
|
Courses = GetProcedureCourses(procedureSearchMode)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
public void SaveProceduresToPdfFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
saveToPdf.CreateDoc(new PdfProceduresByMedicamentsAndSymptomsInfo
|
||||||
|
{
|
||||||
|
FileName= model.FileName,
|
||||||
|
Title = "Отчет по процедурам с расшифровкой по симптомам и лекарствам",
|
||||||
|
DateFrom = model.DateFrom!.Value,
|
||||||
|
DateTo = model.DateTo.Value,
|
||||||
|
Procedures = GetProceduresByMedicametsAndSymptoms()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
private ILogger _logger;
|
private ILogger _logger;
|
||||||
private ISymptomStorage _symptomStorage;
|
private ISymptomStorage _symptomStorage;
|
||||||
|
|
||||||
public SymptomLogic(ILogger logger, ISymptomStorage symptomStorage)
|
public SymptomLogic(ILogger<SymptomLogic> logger, ISymptomStorage symptomStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_symptomStorage = symptomStorage;
|
_symptomStorage = symptomStorage;
|
||||||
@@ -58,14 +58,14 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SymptomViewModel>? ReadList(SymptomSearchModel? model)
|
public List<SymptomViewModel> ReadList(SymptomSearchModel? model = null)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("ReadList. Name:{Name} Id:{Id}", model?.Name, model?.Id);
|
_logger.LogInformation("ReadList. Name:{Name} Id:{Id}", model?.Name, model?.Id);
|
||||||
var list = model == null ? _symptomStorage.GetFullList() : _symptomStorage.GetFilteredList(model);
|
var list = model == null ? _symptomStorage.GetFullList() : _symptomStorage.GetFilteredList(model);
|
||||||
if (list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("ReadList return null list");
|
_logger.LogWarning("ReadList return null list");
|
||||||
return null;
|
return new List<SymptomViewModel>();
|
||||||
}
|
}
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||||
return list;
|
return list;
|
||||||
@@ -73,7 +73,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
public bool Update(SymptomBindingModel model)
|
public bool Update(SymptomBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model);
|
CheckModel(model, false);
|
||||||
if (_symptomStorage.Update(model) == null)
|
if (_symptomStorage.Update(model) == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Update operation failed");
|
_logger.LogWarning("Update operation failed");
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
private ILogger _logger;
|
private ILogger _logger;
|
||||||
private IUserStorage _userStorage;
|
private IUserStorage _userStorage;
|
||||||
|
|
||||||
public UserLogic(ILogger logger, IUserStorage userStorage)
|
public UserLogic(ILogger<UserLogic> logger, IUserStorage userStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_userStorage = userStorage;
|
_userStorage = userStorage;
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperModels.Excel;
|
||||||
|
|
||||||
|
namespace PolyclinicBusinessLogic.OfficePackage
|
||||||
|
{
|
||||||
|
public abstract class AbstractSaveToExcelCoursesByProcedure
|
||||||
|
{
|
||||||
|
public void CreateReport(ExcelCoursesByProceduresInfo info)
|
||||||
|
{
|
||||||
|
CreateExcel(info);
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = 1,
|
||||||
|
Text = info.Title,
|
||||||
|
StyleInfo = ExcelStyleInfoType.Title
|
||||||
|
});
|
||||||
|
MergeCells(new ExcelMergeParameters
|
||||||
|
{
|
||||||
|
CellFromName = "A1",
|
||||||
|
CellToName = "C1"
|
||||||
|
});
|
||||||
|
uint rowIndex = 2;
|
||||||
|
foreach (var course in info.Courses)
|
||||||
|
{
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = "Количество пилюль в день: " + course.PillsPerDay.ToString(),
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "B",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = "Количество дней: " + course.DaysCount.ToString(),
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
rowIndex++;
|
||||||
|
}
|
||||||
|
SaveExcel(info);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Создание excel-файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
protected abstract void CreateExcel(ExcelCoursesByProceduresInfo info);
|
||||||
|
/// <summary>
|
||||||
|
/// Добавляем новую ячейку в лист
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cellParameters"></param>
|
||||||
|
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
||||||
|
/// <summary>
|
||||||
|
/// Объединение ячеек
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mergeParameters"></param>
|
||||||
|
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
protected abstract void SaveExcel(ExcelCoursesByProceduresInfo info);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperModels.PDF;
|
||||||
|
|
||||||
|
namespace PolyclinicBusinessLogic.OfficePackage
|
||||||
|
{
|
||||||
|
public abstract class AbstractSaveToPdfProcedures
|
||||||
|
{
|
||||||
|
public void CreateDoc(PdfProceduresByMedicamentsAndSymptomsInfo info)
|
||||||
|
{
|
||||||
|
CreatePdf(info);
|
||||||
|
CreateParagraph(new PdfParagraph
|
||||||
|
{
|
||||||
|
Text = info.Title,
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
CreateParagraph(new PdfParagraph
|
||||||
|
{
|
||||||
|
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
CreateTable(new List<string> { "2cm", "3cm", "3cm", "4cm", "4cm", "4cm" });
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { "Номер", "Период 'с'", "Период 'до'", "Процедура", "Лекарство", "Симптом" },
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
foreach (var procedure in info.Procedures)
|
||||||
|
{
|
||||||
|
// Добавление строки с основной информацией о процедуре
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string>
|
||||||
|
{
|
||||||
|
procedure.Id.ToString(),
|
||||||
|
procedure.DateStartProcedure.ToShortTimeString(),
|
||||||
|
procedure.DateStopProcedure?.ToShortTimeString() ?? "нет даты окончания процедуры",
|
||||||
|
procedure.ProcedureName,
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
},
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Left,
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var ms in procedure.MedicamentSymptom)
|
||||||
|
{
|
||||||
|
// Добавление строки для каждого лекарства и симптома без дублирования названия процедуры
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string>
|
||||||
|
{
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
ms.medicamentName,
|
||||||
|
ms.symptomName
|
||||||
|
},
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Left,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SavePdf(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void CreatePdf(PdfProceduresByMedicamentsAndSymptomsInfo info);
|
||||||
|
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
||||||
|
protected abstract void CreateTable(List<string> columns);
|
||||||
|
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
||||||
|
protected abstract void SavePdf(PdfProceduresByMedicamentsAndSymptomsInfo info);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperModels.Word;
|
||||||
|
|
||||||
|
namespace PolyclinicBusinessLogic.OfficePackage
|
||||||
|
{
|
||||||
|
public abstract class AbstractSaveToWordCoursesByProcedures
|
||||||
|
{
|
||||||
|
public void CreateDoc(WordCoursesByProceduresInfo info)
|
||||||
|
{
|
||||||
|
CreateWord(info);
|
||||||
|
CreateParagraph(new WordParagraph
|
||||||
|
{
|
||||||
|
Texts = new List<(string, WordTextProperties)>
|
||||||
|
{
|
||||||
|
(info.Title, new WordTextProperties { Bold = true, Size = "32", })
|
||||||
|
},
|
||||||
|
TextProperties = new WordTextProperties
|
||||||
|
{
|
||||||
|
Size = "32",
|
||||||
|
JustificationType = WordJustificationType.Center
|
||||||
|
}
|
||||||
|
});
|
||||||
|
foreach (var course in info.Courses)
|
||||||
|
{
|
||||||
|
CreateParagraph(new WordParagraph
|
||||||
|
{
|
||||||
|
Texts = new List<(string, WordTextProperties)>
|
||||||
|
{
|
||||||
|
("Количество пилюль в день: " + course.PillsPerDay.ToString() + " единиц\t", new WordTextProperties{ Size = "24"}),
|
||||||
|
("Количество дней приёма: " + course.DaysCount.ToString() + " дней", new WordTextProperties{ Size = "24"}),
|
||||||
|
},
|
||||||
|
|
||||||
|
TextProperties = new WordTextProperties
|
||||||
|
{
|
||||||
|
Size = "24",
|
||||||
|
JustificationType = WordJustificationType.Both
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
SaveWord(info);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Создание doc-файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
protected abstract void CreateWord(WordCoursesByProceduresInfo info);
|
||||||
|
/// <summary>
|
||||||
|
/// Создание абзаца с текстом
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="paragraph"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
protected abstract void SaveWord(WordCoursesByProceduresInfo info);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.HelperEnums
|
||||||
|
{
|
||||||
|
public enum ExcelStyleInfoType
|
||||||
|
{
|
||||||
|
Title,
|
||||||
|
Text,
|
||||||
|
TextWithBorder
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.HelperEnums
|
||||||
|
{
|
||||||
|
public enum PdfParagraphAlignmentType
|
||||||
|
{
|
||||||
|
Center,
|
||||||
|
Left,
|
||||||
|
Rigth
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.HelperEnums
|
||||||
|
{
|
||||||
|
public enum WordJustificationType
|
||||||
|
{
|
||||||
|
Center,
|
||||||
|
Both
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
|
||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.HelperModels.Excel
|
||||||
|
{
|
||||||
|
public class ExcelCellParameters
|
||||||
|
{
|
||||||
|
public string ColumnName { get; set; } = string.Empty;
|
||||||
|
public uint RowIndex { get; set; }
|
||||||
|
public string Text { get; set; } = string.Empty;
|
||||||
|
public string CellReference => $"{ColumnName}{RowIndex}";
|
||||||
|
public ExcelStyleInfoType StyleInfo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using PolyclinicContracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.HelperModels.Excel
|
||||||
|
{
|
||||||
|
public class ExcelCoursesByProceduresInfo
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public string ProcedureName { get; set; } = string.Empty;
|
||||||
|
public List<CourseViewModel> Courses { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.HelperModels.Excel
|
||||||
|
{
|
||||||
|
public class ExcelMergeParameters
|
||||||
|
{
|
||||||
|
public string CellFromName { get; set; } = string.Empty;
|
||||||
|
public string CellToName { get; set; } = string.Empty;
|
||||||
|
public string Merge => $"{CellFromName}:{CellToName}";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
|
||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.HelperModels.PDF
|
||||||
|
{
|
||||||
|
public class PdfParagraph
|
||||||
|
{
|
||||||
|
public string Text { get; set; } = string.Empty;
|
||||||
|
public string Style { get; set; } = string.Empty;
|
||||||
|
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using PolyclinicContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.HelperModels.PDF
|
||||||
|
{
|
||||||
|
public class PdfProceduresByMedicamentsAndSymptomsInfo
|
||||||
|
{
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public DateTime DateFrom { get; set; }
|
||||||
|
public DateTime DateTo { get; set; }
|
||||||
|
public List<ReportProceduresViewModel> Procedures { get; set; } = new();
|
||||||
|
|
||||||
|
//public List<ReportProceduresViewModel> Procedures{ get; set; } = new();
|
||||||
|
|
||||||
|
//public List<ReportProceduresViewModel> MedicamentSymptom { get; set; } = new();
|
||||||
|
|
||||||
|
/*public List<(string medicamentName, string symptomName)> MedicamentSymptom { get; set; } = new();*/
|
||||||
|
/* public List<MedicamentViewModel> Medicaments { get; set; } = new();
|
||||||
|
public List<SymptomViewModel> Symptoms { get; set; } = new();*/
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
|
||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.HelperModels.PDF
|
||||||
|
{
|
||||||
|
public class PdfRowParameters
|
||||||
|
{
|
||||||
|
public List<string> Texts { get; set; } = new();
|
||||||
|
public string Style { get; set; } = string.Empty;
|
||||||
|
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using PolyclinicContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.HelperModels.Word
|
||||||
|
{
|
||||||
|
public class WordCoursesByProceduresInfo
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public string ProcedureName { get; set; } = string.Empty;
|
||||||
|
public List<CourseViewModel> Courses { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.HelperModels.Word
|
||||||
|
{
|
||||||
|
public class WordParagraph
|
||||||
|
{
|
||||||
|
public List<(string, WordTextProperties)> Texts { get; set; } = new();
|
||||||
|
public WordTextProperties? TextProperties { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
|
||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.HelperModels.Word
|
||||||
|
{
|
||||||
|
public class WordTextProperties
|
||||||
|
{
|
||||||
|
public string Size { get; set; } = string.Empty;
|
||||||
|
public bool Bold { get; set; }
|
||||||
|
public WordJustificationType JustificationType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,334 @@
|
|||||||
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||||
|
using DocumentFormat.OpenXml.Office2013.Excel;
|
||||||
|
using DocumentFormat.OpenXml.Packaging;
|
||||||
|
using DocumentFormat.OpenXml.Spreadsheet;
|
||||||
|
using DocumentFormat.OpenXml;
|
||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperModels.Excel;
|
||||||
|
|
||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.Implements
|
||||||
|
{
|
||||||
|
public class SaveToExcelCoursesByProcedure : AbstractSaveToExcelCoursesByProcedure
|
||||||
|
{
|
||||||
|
private SpreadsheetDocument? _spreadsheetDocument;
|
||||||
|
private SharedStringTablePart? _shareStringPart;
|
||||||
|
private Worksheet? _worksheet;
|
||||||
|
/// <summary>
|
||||||
|
/// Настройка стилей для файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="workbookpart"></param>
|
||||||
|
private static void CreateStyles(WorkbookPart workbookpart)
|
||||||
|
{
|
||||||
|
var sp = workbookpart.AddNewPart<WorkbookStylesPart>();
|
||||||
|
sp.Stylesheet = new Stylesheet();
|
||||||
|
var fonts = new Fonts() { Count = 2U, KnownFonts = true };
|
||||||
|
var fontUsual = new Font();
|
||||||
|
fontUsual.Append(new FontSize() { Val = 12D });
|
||||||
|
fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||||
|
{ Theme = 1U });
|
||||||
|
fontUsual.Append(new FontName() { Val = "Times New Roman" });
|
||||||
|
fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
|
||||||
|
fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||||
|
var fontTitle = new Font();
|
||||||
|
fontTitle.Append(new Bold());
|
||||||
|
fontTitle.Append(new FontSize() { Val = 14D });
|
||||||
|
fontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||||
|
{ Theme = 1U });
|
||||||
|
fontTitle.Append(new FontName() { Val = "Times New Roman" });
|
||||||
|
fontTitle.Append(new FontFamilyNumbering() { Val = 2 });
|
||||||
|
fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||||
|
fonts.Append(fontUsual);
|
||||||
|
fonts.Append(fontTitle);
|
||||||
|
var fills = new Fills() { Count = 2U };
|
||||||
|
var fill1 = new Fill();
|
||||||
|
fill1.Append(new PatternFill() { PatternType = PatternValues.None });
|
||||||
|
var fill2 = new Fill();
|
||||||
|
fill2.Append(new PatternFill()
|
||||||
|
{
|
||||||
|
PatternType = PatternValues.Gray125
|
||||||
|
});
|
||||||
|
fills.Append(fill1);
|
||||||
|
fills.Append(fill2);
|
||||||
|
var borders = new Borders() { Count = 2U };
|
||||||
|
var borderNoBorder = new Border();
|
||||||
|
borderNoBorder.Append(new LeftBorder());
|
||||||
|
borderNoBorder.Append(new RightBorder());
|
||||||
|
borderNoBorder.Append(new TopBorder());
|
||||||
|
borderNoBorder.Append(new BottomBorder());
|
||||||
|
borderNoBorder.Append(new DiagonalBorder());
|
||||||
|
var borderThin = new Border();
|
||||||
|
var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
|
||||||
|
leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||||
|
{ Indexed = 64U });
|
||||||
|
var rightBorder = new RightBorder()
|
||||||
|
{
|
||||||
|
Style = BorderStyleValues.Thin
|
||||||
|
};
|
||||||
|
rightBorder.Append(new
|
||||||
|
DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||||
|
{ Indexed = 64U });
|
||||||
|
var topBorder = new TopBorder() { Style = BorderStyleValues.Thin };
|
||||||
|
topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||||
|
{ Indexed = 64U });
|
||||||
|
var bottomBorder = new BottomBorder()
|
||||||
|
{
|
||||||
|
Style =
|
||||||
|
BorderStyleValues.Thin
|
||||||
|
};
|
||||||
|
bottomBorder.Append(new
|
||||||
|
DocumentFormat.OpenXml.Office2010.Excel.Color()
|
||||||
|
{ Indexed = 64U });
|
||||||
|
borderThin.Append(leftBorder);
|
||||||
|
borderThin.Append(rightBorder);
|
||||||
|
borderThin.Append(topBorder);
|
||||||
|
borderThin.Append(bottomBorder);
|
||||||
|
borderThin.Append(new DiagonalBorder());
|
||||||
|
borders.Append(borderNoBorder);
|
||||||
|
borders.Append(borderThin);
|
||||||
|
var cellStyleFormats = new CellStyleFormats() { Count = 1U };
|
||||||
|
var cellFormatStyle = new CellFormat()
|
||||||
|
{
|
||||||
|
NumberFormatId = 0U,
|
||||||
|
FontId
|
||||||
|
= 0U,
|
||||||
|
FillId = 0U,
|
||||||
|
BorderId = 0U
|
||||||
|
};
|
||||||
|
cellStyleFormats.Append(cellFormatStyle);
|
||||||
|
var cellFormats = new CellFormats() { Count = 3U };
|
||||||
|
var cellFormatFont = new CellFormat()
|
||||||
|
{
|
||||||
|
NumberFormatId = 0U,
|
||||||
|
FontId =
|
||||||
|
0U,
|
||||||
|
FillId = 0U,
|
||||||
|
BorderId = 0U,
|
||||||
|
FormatId = 0U,
|
||||||
|
ApplyFont = true
|
||||||
|
};
|
||||||
|
var cellFormatFontAndBorder = new CellFormat()
|
||||||
|
{
|
||||||
|
NumberFormatId = 0U,
|
||||||
|
FontId = 0U,
|
||||||
|
FillId = 0U,
|
||||||
|
BorderId = 1U,
|
||||||
|
FormatId = 0U,
|
||||||
|
ApplyFont = true,
|
||||||
|
ApplyBorder = true
|
||||||
|
};
|
||||||
|
var cellFormatTitle = new CellFormat()
|
||||||
|
{
|
||||||
|
NumberFormatId = 0U,
|
||||||
|
FontId
|
||||||
|
= 1U,
|
||||||
|
FillId = 0U,
|
||||||
|
BorderId = 0U,
|
||||||
|
FormatId = 0U,
|
||||||
|
Alignment = new Alignment()
|
||||||
|
{
|
||||||
|
Vertical = VerticalAlignmentValues.Center,
|
||||||
|
WrapText = true,
|
||||||
|
Horizontal =
|
||||||
|
HorizontalAlignmentValues.Center
|
||||||
|
},
|
||||||
|
ApplyFont = true
|
||||||
|
};
|
||||||
|
cellFormats.Append(cellFormatFont);
|
||||||
|
cellFormats.Append(cellFormatFontAndBorder);
|
||||||
|
cellFormats.Append(cellFormatTitle);
|
||||||
|
var cellStyles = new CellStyles() { Count = 1U };
|
||||||
|
cellStyles.Append(new CellStyle()
|
||||||
|
{
|
||||||
|
Name = "Normal",
|
||||||
|
FormatId = 0U,
|
||||||
|
BuiltinId = 0U
|
||||||
|
});
|
||||||
|
var differentialFormats = new
|
||||||
|
DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats()
|
||||||
|
{ Count = 0U };
|
||||||
|
|
||||||
|
var tableStyles = new TableStyles()
|
||||||
|
{
|
||||||
|
Count = 0U,
|
||||||
|
DefaultTableStyle = "TableStyleMedium2",
|
||||||
|
DefaultPivotStyle = "PivotStyleLight16"
|
||||||
|
};
|
||||||
|
var stylesheetExtensionList = new StylesheetExtensionList();
|
||||||
|
var stylesheetExtension1 = new StylesheetExtension()
|
||||||
|
{
|
||||||
|
Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"
|
||||||
|
};
|
||||||
|
stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||||
|
stylesheetExtension1.Append(new SlicerStyles()
|
||||||
|
{
|
||||||
|
DefaultSlicerStyle = "SlicerStyleLight1"
|
||||||
|
});
|
||||||
|
var stylesheetExtension2 = new StylesheetExtension()
|
||||||
|
{
|
||||||
|
Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}"
|
||||||
|
};
|
||||||
|
stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");
|
||||||
|
stylesheetExtension2.Append(new TimelineStyles()
|
||||||
|
{
|
||||||
|
DefaultTimelineStyle = "TimeSlicerStyleLight1"
|
||||||
|
});
|
||||||
|
stylesheetExtensionList.Append(stylesheetExtension1);
|
||||||
|
stylesheetExtensionList.Append(stylesheetExtension2);
|
||||||
|
sp.Stylesheet.Append(fonts);
|
||||||
|
sp.Stylesheet.Append(fills);
|
||||||
|
sp.Stylesheet.Append(borders);
|
||||||
|
sp.Stylesheet.Append(cellStyleFormats);
|
||||||
|
sp.Stylesheet.Append(cellFormats);
|
||||||
|
sp.Stylesheet.Append(cellStyles);
|
||||||
|
sp.Stylesheet.Append(differentialFormats);
|
||||||
|
sp.Stylesheet.Append(tableStyles);
|
||||||
|
sp.Stylesheet.Append(stylesheetExtensionList);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение номера стиля из типа
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="styleInfo"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static uint GetStyleValue(ExcelStyleInfoType styleInfo)
|
||||||
|
{
|
||||||
|
return styleInfo switch
|
||||||
|
{
|
||||||
|
ExcelStyleInfoType.Title => 2U,
|
||||||
|
ExcelStyleInfoType.TextWithBorder => 1U,
|
||||||
|
ExcelStyleInfoType.Text => 0U,
|
||||||
|
_ => 0U,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
protected override void CreateExcel(ExcelCoursesByProceduresInfo info)
|
||||||
|
{
|
||||||
|
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName,
|
||||||
|
SpreadsheetDocumentType.Workbook);
|
||||||
|
// Создаем книгу (в ней хранятся листы)
|
||||||
|
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
|
||||||
|
workbookpart.Workbook = new Workbook();
|
||||||
|
CreateStyles(workbookpart);
|
||||||
|
// Получаем/создаем хранилище текстов для книги
|
||||||
|
_shareStringPart =
|
||||||
|
_spreadsheetDocument.WorkbookPart!.GetPartsOfType<SharedStringTablePart>().Any()
|
||||||
|
?
|
||||||
|
_spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First()
|
||||||
|
:
|
||||||
|
_spreadsheetDocument.WorkbookPart.AddNewPart<SharedStringTablePart>();
|
||||||
|
// Создаем SharedStringTable, если его нет
|
||||||
|
if (_shareStringPart.SharedStringTable == null)
|
||||||
|
{
|
||||||
|
_shareStringPart.SharedStringTable = new SharedStringTable();
|
||||||
|
}
|
||||||
|
// Создаем лист в книгу
|
||||||
|
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
||||||
|
worksheetPart.Worksheet = new Worksheet(new SheetData());
|
||||||
|
// Добавляем лист в книгу
|
||||||
|
var sheets =
|
||||||
|
_spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
|
||||||
|
var sheet = new Sheet()
|
||||||
|
{
|
||||||
|
Id =
|
||||||
|
_spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
||||||
|
SheetId = 1,
|
||||||
|
Name = "Лист"
|
||||||
|
};
|
||||||
|
sheets.Append(sheet);
|
||||||
|
_worksheet = worksheetPart.Worksheet;
|
||||||
|
}
|
||||||
|
protected override void InsertCellInWorksheet(ExcelCellParameters excelParams)
|
||||||
|
{
|
||||||
|
if (_worksheet == null || _shareStringPart == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var sheetData = _worksheet.GetFirstChild<SheetData>();
|
||||||
|
if (sheetData == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Ищем строку, либо добавляем ее
|
||||||
|
Row row;
|
||||||
|
if (sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).Any())
|
||||||
|
{
|
||||||
|
row = sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).First();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
row = new Row() { RowIndex = excelParams.RowIndex };
|
||||||
|
sheetData.Append(row);
|
||||||
|
}
|
||||||
|
// Ищем нужную ячейку
|
||||||
|
Cell cell;
|
||||||
|
if (row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).Any())
|
||||||
|
{
|
||||||
|
cell = row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).First();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Все ячейки должны быть последовательно друг за другом расположены
|
||||||
|
// нужно определить, после какой вставлять
|
||||||
|
Cell? refCell = null;
|
||||||
|
foreach (Cell rowCell in row.Elements<Cell>())
|
||||||
|
{
|
||||||
|
if (string.Compare(rowCell.CellReference!.Value, excelParams.CellReference, true) > 0)
|
||||||
|
{
|
||||||
|
refCell = rowCell;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var newCell = new Cell()
|
||||||
|
{
|
||||||
|
CellReference = excelParams.CellReference
|
||||||
|
};
|
||||||
|
row.InsertBefore(newCell, refCell);
|
||||||
|
cell = newCell;
|
||||||
|
}
|
||||||
|
// вставляем новый текст
|
||||||
|
_shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new Text(excelParams.Text)));
|
||||||
|
_shareStringPart.SharedStringTable.Save();
|
||||||
|
cell.CellValue = new CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count() - 1).ToString());
|
||||||
|
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
|
||||||
|
cell.StyleIndex = GetStyleValue(excelParams.StyleInfo);
|
||||||
|
}
|
||||||
|
protected override void MergeCells(ExcelMergeParameters excelParams)
|
||||||
|
{
|
||||||
|
if (_worksheet == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MergeCells mergeCells;
|
||||||
|
if (_worksheet.Elements<MergeCells>().Any())
|
||||||
|
{
|
||||||
|
mergeCells = _worksheet.Elements<MergeCells>().First();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mergeCells = new MergeCells();
|
||||||
|
if (_worksheet.Elements<CustomSheetView>().Any())
|
||||||
|
{
|
||||||
|
_worksheet.InsertAfter(mergeCells,
|
||||||
|
_worksheet.Elements<CustomSheetView>().First());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_worksheet.InsertAfter(mergeCells,
|
||||||
|
_worksheet.Elements<SheetData>().First());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var mergeCell = new MergeCell()
|
||||||
|
{
|
||||||
|
Reference = new StringValue(excelParams.Merge)
|
||||||
|
};
|
||||||
|
mergeCells.Append(mergeCell);
|
||||||
|
}
|
||||||
|
protected override void SaveExcel(ExcelCoursesByProceduresInfo info)
|
||||||
|
{
|
||||||
|
if (_spreadsheetDocument == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
||||||
|
_spreadsheetDocument.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
using MigraDoc.DocumentObjectModel;
|
||||||
|
using MigraDoc.DocumentObjectModel.Tables;
|
||||||
|
using MigraDoc.Rendering;
|
||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperModels.PDF;
|
||||||
|
|
||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.Implements
|
||||||
|
{
|
||||||
|
public class SaveToPdfProcedures : AbstractSaveToPdfProcedures
|
||||||
|
{
|
||||||
|
private Document? _document;
|
||||||
|
private Section? _section;
|
||||||
|
private Table? _table;
|
||||||
|
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type)
|
||||||
|
{
|
||||||
|
return type switch
|
||||||
|
{
|
||||||
|
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
|
||||||
|
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
|
||||||
|
PdfParagraphAlignmentType.Rigth => ParagraphAlignment.Right,
|
||||||
|
_ => ParagraphAlignment.Justify,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Создание стилей для документа
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="document"></param>
|
||||||
|
private static void DefineStyles(Document document)
|
||||||
|
{
|
||||||
|
var style = document.Styles["Normal"];
|
||||||
|
style.Font.Name = "Times New Roman";
|
||||||
|
style.Font.Size = 11;
|
||||||
|
style = document.Styles.AddStyle("NormalTitle", "Normal");
|
||||||
|
style.Font.Bold = true;
|
||||||
|
}
|
||||||
|
protected override void CreatePdf(PdfProceduresByMedicamentsAndSymptomsInfo info)
|
||||||
|
{
|
||||||
|
_document = new Document();
|
||||||
|
DefineStyles(_document);
|
||||||
|
_section = _document.AddSection();
|
||||||
|
}
|
||||||
|
protected override void CreateParagraph(PdfParagraph pdfParagraph)
|
||||||
|
{
|
||||||
|
if (_section == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var paragraph = _section.AddParagraph(pdfParagraph.Text);
|
||||||
|
paragraph.Format.SpaceAfter = "1cm";
|
||||||
|
paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
|
||||||
|
paragraph.Style = pdfParagraph.Style;
|
||||||
|
}
|
||||||
|
protected override void CreateTable(List<string> columns)
|
||||||
|
{
|
||||||
|
if (_document == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_table = _document.LastSection.AddTable();
|
||||||
|
// Получаем доступную ширину страницы, чтобы таблица не вылезала за края
|
||||||
|
var pageWidth = _document.DefaultPageSetup.PageWidth - _document.DefaultPageSetup.LeftMargin - _document.DefaultPageSetup.RightMargin;
|
||||||
|
var totalWidth = columns.Sum(col => Unit.FromCentimeter(double.Parse(col.Replace("cm", ""))));
|
||||||
|
|
||||||
|
// Если ширина таблицы превышает доступную ширину страницы, уменьшаем ширину колонок пропорционально
|
||||||
|
if (totalWidth > pageWidth)
|
||||||
|
{
|
||||||
|
var scale = pageWidth / totalWidth;
|
||||||
|
for (int i = 0; i < columns.Count; i++)
|
||||||
|
{
|
||||||
|
columns[i] = $"{Unit.FromCentimeter(double.Parse(columns[i].Replace("cm", "")) * scale).Centimeter}cm";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (var elem in columns)
|
||||||
|
{
|
||||||
|
_table.AddColumn(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected override void CreateRow(PdfRowParameters rowParameters)
|
||||||
|
{
|
||||||
|
if (_table == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var row = _table.AddRow();
|
||||||
|
for (int i = 0; i < rowParameters.Texts.Count; ++i)
|
||||||
|
{
|
||||||
|
row.Cells[i].AddParagraph(rowParameters.Texts[i]);
|
||||||
|
if (!string.IsNullOrEmpty(rowParameters.Style))
|
||||||
|
{
|
||||||
|
row.Cells[i].Style = rowParameters.Style;
|
||||||
|
}
|
||||||
|
Unit borderWidth = 0.5;
|
||||||
|
row.Cells[i].Borders.Left.Width = borderWidth;
|
||||||
|
row.Cells[i].Borders.Right.Width = borderWidth;
|
||||||
|
row.Cells[i].Borders.Top.Width = borderWidth;
|
||||||
|
row.Cells[i].Borders.Bottom.Width = borderWidth;
|
||||||
|
row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment);
|
||||||
|
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected override void SavePdf(PdfProceduresByMedicamentsAndSymptomsInfo info)
|
||||||
|
{
|
||||||
|
var renderer = new PdfDocumentRenderer(true)
|
||||||
|
{
|
||||||
|
Document = _document
|
||||||
|
};
|
||||||
|
renderer.RenderDocument();
|
||||||
|
renderer.PdfDocument.Save(info.FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using PolyclinicBusinessLogic.OfficePackage.HelperModels.Word;
|
||||||
|
using DocumentFormat.OpenXml;
|
||||||
|
using DocumentFormat.OpenXml.Packaging;
|
||||||
|
using DocumentFormat.OpenXml.Wordprocessing;
|
||||||
|
|
||||||
|
namespace PolyclinicBusinessLogic.OfficePackage.Implements
|
||||||
|
{
|
||||||
|
public class SaveToWordCoursesByProcedure : AbstractSaveToWordCoursesByProcedures
|
||||||
|
{
|
||||||
|
private WordprocessingDocument? _wordDocument;
|
||||||
|
private Body? _docBody;
|
||||||
|
/// <summary>
|
||||||
|
/// Получение типа выравнивания
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static JustificationValues GetJustificationValues(WordJustificationType type)
|
||||||
|
{
|
||||||
|
return type switch
|
||||||
|
{
|
||||||
|
WordJustificationType.Both => JustificationValues.Both,
|
||||||
|
WordJustificationType.Center => JustificationValues.Center,
|
||||||
|
_ => JustificationValues.Left,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Настройки страницы
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static SectionProperties CreateSectionProperties()
|
||||||
|
{
|
||||||
|
var properties = new SectionProperties();
|
||||||
|
var pageSize = new PageSize
|
||||||
|
{
|
||||||
|
Orient = PageOrientationValues.Portrait
|
||||||
|
};
|
||||||
|
properties.AppendChild(pageSize);
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Задание форматирования для абзаца
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="paragraphProperties"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
||||||
|
{
|
||||||
|
if (paragraphProperties == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var properties = new ParagraphProperties();
|
||||||
|
properties.AppendChild(new Justification()
|
||||||
|
{
|
||||||
|
Val = GetJustificationValues(paragraphProperties.JustificationType)
|
||||||
|
});
|
||||||
|
properties.AppendChild(new SpacingBetweenLines
|
||||||
|
{
|
||||||
|
LineRule = LineSpacingRuleValues.Auto
|
||||||
|
});
|
||||||
|
properties.AppendChild(new Indentation());
|
||||||
|
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
||||||
|
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
||||||
|
{
|
||||||
|
paragraphMarkRunProperties.AppendChild(new FontSize
|
||||||
|
{
|
||||||
|
Val = paragraphProperties.Size
|
||||||
|
});
|
||||||
|
}
|
||||||
|
properties.AppendChild(paragraphMarkRunProperties);
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
protected override void CreateWord(WordCoursesByProceduresInfo info)
|
||||||
|
{
|
||||||
|
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
|
||||||
|
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
||||||
|
mainPart.Document = new Document();
|
||||||
|
_docBody = mainPart.Document.AppendChild(new Body());
|
||||||
|
}
|
||||||
|
protected override void CreateParagraph(WordParagraph paragraph)
|
||||||
|
{
|
||||||
|
if (_docBody == null || paragraph == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var docParagraph = new Paragraph();
|
||||||
|
|
||||||
|
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
||||||
|
foreach (var run in paragraph.Texts)
|
||||||
|
{
|
||||||
|
var docRun = new Run();
|
||||||
|
var properties = new RunProperties();
|
||||||
|
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
||||||
|
if (run.Item2.Bold)
|
||||||
|
{
|
||||||
|
properties.AppendChild(new Bold());
|
||||||
|
}
|
||||||
|
docRun.AppendChild(properties);
|
||||||
|
docRun.AppendChild(new Text
|
||||||
|
{
|
||||||
|
Text = run.Item1,
|
||||||
|
Space = SpaceProcessingModeValues.Preserve
|
||||||
|
});
|
||||||
|
docParagraph.AppendChild(docRun);
|
||||||
|
}
|
||||||
|
_docBody.AppendChild(docParagraph);
|
||||||
|
}
|
||||||
|
protected override void SaveWord(WordCoursesByProceduresInfo info)
|
||||||
|
{
|
||||||
|
if (_docBody == null || _wordDocument == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_docBody.AppendChild(CreateSectionProperties());
|
||||||
|
_wordDocument.MainDocumentPart!.Document.Save();
|
||||||
|
_wordDocument.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -7,7 +7,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
||||||
|
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.9" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace PolyclinicContracts.BindingModels
|
|||||||
{
|
{
|
||||||
public int DaysCount { get; set; }
|
public int DaysCount { get; set; }
|
||||||
public int PillsPerDay { get; set; }
|
public int PillsPerDay { get; set; }
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; } = string.Empty;
|
||||||
public Dictionary<int, IDiagnoseModel> CourseDiagnoses { get; set; } = new();
|
public Dictionary<int, IDiagnoseModel> CourseDiagnoses { get; set; } = new();
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ namespace PolyclinicContracts.BindingModels
|
|||||||
public class DiagnoseBindingModel : IDiagnoseModel
|
public class DiagnoseBindingModel : IDiagnoseModel
|
||||||
{
|
{
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; }
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public DateTime DateStartDiagnose { get; }
|
public DateTime DateStartDiagnose { get; set; }
|
||||||
public DateTime? DateStopDiagnose { get; }
|
public DateTime? DateStopDiagnose { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ namespace PolyclinicContracts.BindingModels
|
|||||||
public int? SymptomId { get; set; }
|
public int? SymptomId { get; set; }
|
||||||
public int ProcedureId { get; set; }
|
public int ProcedureId { get; set; }
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ namespace PolyclinicContracts.BindingModels
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; } = string.Empty;
|
||||||
public DateTime DateStartProcedure { get; set; } = DateTime.Now;
|
public DateTime DateStartProcedure { get; set; } = DateTime.Now;
|
||||||
public DateTime? DateStopProcedure { get; set; }
|
public DateTime? DateStopProcedure { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace PolyclinicContracts.BindingModels
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int? CourseId { get; set; }
|
public int? CourseId { get; set; }
|
||||||
public int ProceduresCount { get; set; }
|
public int ProceduresCount { get; set; }
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; } = string.Empty;
|
||||||
public Dictionary<int, IProcedureModel> RecipeProcedures { get; } = new();
|
public Dictionary<int, IProcedureModel> RecipeProcedures { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace PolyclinicContracts.BindingModels
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace PolyclinicContracts.BindingModels
|
|
||||||
{
|
{
|
||||||
public class ReportBindingModel
|
public class ReportBindingModel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace PolyclinicContracts.BindingModels
|
|||||||
public class SymptomBindingModel : ISymptomModel
|
public class SymptomBindingModel : ISymptomModel
|
||||||
{
|
{
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; } = string.Empty;
|
||||||
public Dictionary<int, IDiagnoseModel> SymptomDiagnoses { get; set; } = new();
|
public Dictionary<int, IDiagnoseModel> SymptomDiagnoses { get; set; } = new();
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace PolyclinicContracts.BusinessLogicsContracts
|
|||||||
{
|
{
|
||||||
public interface ICourseLogic
|
public interface ICourseLogic
|
||||||
{
|
{
|
||||||
List<CourseViewModel>? ReadList(CourseSearchModel? model);
|
List<CourseViewModel> ReadList(CourseSearchModel? model = null);
|
||||||
CourseViewModel? ReadElement(CourseSearchModel model);
|
CourseViewModel? ReadElement(CourseSearchModel model);
|
||||||
bool Create(CourseBindingModel model);
|
bool Create(CourseBindingModel model);
|
||||||
bool Update(CourseBindingModel model);
|
bool Update(CourseBindingModel model);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace PolyclinicContracts.BusinessLogicsContracts
|
|||||||
{
|
{
|
||||||
public interface IDiagnoseLogic
|
public interface IDiagnoseLogic
|
||||||
{
|
{
|
||||||
List<DiagnoseViewModel>? ReadList(DiagnoseSearchModel? model);
|
List<DiagnoseViewModel> ReadList(DiagnoseSearchModel? model = null);
|
||||||
DiagnoseViewModel? ReadElement(DiagnoseSearchModel model);
|
DiagnoseViewModel? ReadElement(DiagnoseSearchModel model);
|
||||||
bool Create(DiagnoseBindingModel model);
|
bool Create(DiagnoseBindingModel model);
|
||||||
bool Update(DiagnoseBindingModel model);
|
bool Update(DiagnoseBindingModel model);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace PolyclinicContracts.BusinessLogicsContracts
|
|||||||
{
|
{
|
||||||
public interface IProcedureLogic
|
public interface IProcedureLogic
|
||||||
{
|
{
|
||||||
List<ProcedureViewModel>? ReadList(ProcedureSearchModel? model);
|
List<ProcedureViewModel>? ReadList(ProcedureSearchModel? model = null);
|
||||||
ProcedureViewModel? ReadElement(ProcedureSearchModel model);
|
ProcedureViewModel? ReadElement(ProcedureSearchModel model);
|
||||||
bool Create(ProcedureBindingModel model);
|
bool Create(ProcedureBindingModel model);
|
||||||
bool Update(ProcedureBindingModel model);
|
bool Update(ProcedureBindingModel model);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace PolyclinicContracts.BusinessLogicsContracts
|
|||||||
{
|
{
|
||||||
public interface IRecipeLogic
|
public interface IRecipeLogic
|
||||||
{
|
{
|
||||||
List<RecipeViewModel>? ReadList(RecipeSearchModel? model);
|
List<RecipeViewModel>? ReadList(RecipeSearchModel? model = null);
|
||||||
RecipeViewModel? ReadElement(RecipeSearchModel model);
|
RecipeViewModel? ReadElement(RecipeSearchModel model);
|
||||||
bool Create(RecipeBindingModel model);
|
bool Create(RecipeBindingModel model);
|
||||||
bool Update(RecipeBindingModel model);
|
bool Update(RecipeBindingModel model);
|
||||||
|
|||||||
@@ -12,30 +12,34 @@ namespace PolyclinicContracts.BusinessLogicsContracts
|
|||||||
public interface ISuretorReportLogic
|
public interface ISuretorReportLogic
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение списка компонент с указанием, в каких изделиях используются
|
/// Получение данных (списка) курсов по выбранным процедурам
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
List<ReportCoursesByProcedureViewModel> GetProcedureCourses(ProcedureSearchModel model);
|
List<CourseViewModel> GetProcedureCourses(ProcedureSearchModel model);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение списка заказов за определенный период
|
/// Получение списка процедур
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
List<ReportProceduresViewModel> GetProcedures(ReportBindingModel model);
|
List<ReportProceduresViewModel> GetProceduresByMedicametsAndSymptoms();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Сохранение компонент в файл-Word
|
/// Сохранение курсов по процедурам в файл-Word
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
void SaveCoursesByProcedureToWordFile(ReportBindingModel model);
|
void SaveCoursesByProcedureToWordFile(ReportBindingModel model, ProcedureSearchModel procedureSearchMode);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
/// Сохранение курсов по процедурам в файл-Excel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
void SaveCoursesByProcedureToExcelFile(ReportBindingModel model);
|
void SaveCoursesByProcedureToExcelFile(ReportBindingModel model, ProcedureSearchModel procedureSearchMode);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Сохранение заказов в файл-Pdf
|
/// Сохранение заказов в файл-Pdf
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
void SaveOrdersToPdfFile(ReportBindingModel model);
|
void SaveProceduresToPdfFile(ReportBindingModel model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace PolyclinicContracts.BusinessLogicsContracts
|
|||||||
{
|
{
|
||||||
public interface ISymptomLogic
|
public interface ISymptomLogic
|
||||||
{
|
{
|
||||||
List<SymptomViewModel>? ReadList(SymptomSearchModel? model);
|
List<SymptomViewModel> ReadList(SymptomSearchModel? model = null);
|
||||||
SymptomViewModel? ReadElement(SymptomSearchModel model);
|
SymptomViewModel? ReadElement(SymptomSearchModel model);
|
||||||
bool Create(SymptomBindingModel model);
|
bool Create(SymptomBindingModel model);
|
||||||
bool Update(SymptomBindingModel model);
|
bool Update(SymptomBindingModel model);
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
public class SymptomSearchModel
|
public class SymptomSearchModel
|
||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string?Name { get; set; }
|
public string? Name { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace PolyclinicContracts.ViewModels
|
|||||||
[DisplayName("Препарата в день")]
|
[DisplayName("Препарата в день")]
|
||||||
public int PillsPerDay { get; set; }
|
public int PillsPerDay { get; set; }
|
||||||
[DisplayName("Комментарий")]
|
[DisplayName("Комментарий")]
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; } = string.Empty;
|
||||||
public Dictionary<int, IDiagnoseModel> CourseDiagnoses { get; set; } = new();
|
public Dictionary<int, IDiagnoseModel> CourseDiagnoses { get; set; } = new();
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using PolyclinicDataModels.Models;
|
using PolyclinicDataModels.Models;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace PolyclinicContracts.ViewModels
|
namespace PolyclinicContracts.ViewModels
|
||||||
{
|
{
|
||||||
@@ -9,7 +10,7 @@ namespace PolyclinicContracts.ViewModels
|
|||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Комментарий")]
|
[DisplayName("Комментарий")]
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Дата 'от'")]
|
[DisplayName("Дата 'от'")]
|
||||||
public DateTime DateStartDiagnose { get; set; }
|
public DateTime DateStartDiagnose { get; set; }
|
||||||
|
|||||||
@@ -8,9 +8,19 @@ namespace PolyclinicContracts.ViewModels
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int ProcedureId { get; set; }
|
public int ProcedureId { get; set; }
|
||||||
public int? SymptomId { get; set; }
|
public int? SymptomId { get; set; }
|
||||||
|
|
||||||
[DisplayName("Название медикамента")]
|
[DisplayName("Название медикамента")]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
[DisplayName("Комментарий")]
|
[DisplayName("Комментарий")]
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
[DisplayName("Название симптома")]
|
||||||
|
public string SymptomName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Название процедуры")]
|
||||||
|
public string ProcedureName { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace PolyclinicContracts.ViewModels
|
|||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Комментарий")]
|
[DisplayName("Комментарий")]
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Дата 'от'")]
|
[DisplayName("Дата 'от'")]
|
||||||
public DateTime DateStartProcedure { get; set; } = DateTime.Now;
|
public DateTime DateStartProcedure { get; set; } = DateTime.Now;
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ namespace PolyclinicContracts.ViewModels
|
|||||||
public int ProceduresCount { get; set; }
|
public int ProceduresCount { get; set; }
|
||||||
|
|
||||||
[DisplayName("Комментарий")]
|
[DisplayName("Комментарий")]
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Номер курса")]
|
||||||
public int? CourseId { get; set; }
|
public int? CourseId { get; set; }
|
||||||
public Dictionary<int, IProcedureModel> RecipeProcedures { get; } = new();
|
public Dictionary<int, IProcedureModel> RecipeProcedures { get; } = new();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace PolyclinicContracts.ViewModels
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace PolyclinicContracts.ViewModels
|
|
||||||
{
|
{
|
||||||
public class ReportCoursesByProcedureViewModel
|
public class ReportCoursesByProcedureViewModel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,14 +1,8 @@
|
|||||||
using PolyclinicDataModels.Models;
|
namespace PolyclinicContracts.ViewModels
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace PolyclinicContracts.ViewModels
|
|
||||||
{
|
{
|
||||||
public class ReportProceduresViewModel
|
public class ReportProceduresViewModel
|
||||||
{
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
public string ProcedureName { get; set; } = string.Empty;
|
public string ProcedureName { get; set; } = string.Empty;
|
||||||
public DateTime DateStartProcedure { get; set; }
|
public DateTime DateStartProcedure { get; set; }
|
||||||
public DateTime? DateStopProcedure { get; set;}
|
public DateTime? DateStopProcedure { get; set;}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace PolyclinicContracts.ViewModels
|
|||||||
[DisplayName("Название")]
|
[DisplayName("Название")]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
[DisplayName("Комментарий")]
|
[DisplayName("Комментарий")]
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; } = string.Empty;
|
||||||
public Dictionary<int, IDiagnoseModel> SymptomDiagnoses { get; set; } = new();
|
public Dictionary<int, IDiagnoseModel> SymptomDiagnoses { get; set; } = new();
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,8 @@
|
|||||||
{
|
{
|
||||||
public enum UserRole
|
public enum UserRole
|
||||||
{
|
{
|
||||||
Неизвестный = -1,
|
Неизвестный = 0,
|
||||||
Администратор = 0,
|
|
||||||
Исполнитель = 1,
|
Исполнитель = 1,
|
||||||
Поручитель = 2,
|
Поручитель = 2,
|
||||||
Клиент = 3
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
{
|
{
|
||||||
int DaysCount { get; }
|
int DaysCount { get; }
|
||||||
int PillsPerDay { get; }
|
int PillsPerDay { get; }
|
||||||
string Comment { get; }
|
string? Comment { get; }
|
||||||
Dictionary<int, IDiagnoseModel> CourseDiagnoses { get; }
|
Dictionary<int, IDiagnoseModel> CourseDiagnoses { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
public interface IDiagnoseModel : IId
|
public interface IDiagnoseModel : IId
|
||||||
{
|
{
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
string Comment { get; }
|
string? Comment { get; }
|
||||||
int UserId { get; }
|
int UserId { get; }
|
||||||
DateTime DateStartDiagnose { get; }
|
DateTime DateStartDiagnose { get; }
|
||||||
DateTime? DateStopDiagnose { get; }
|
DateTime? DateStopDiagnose { get; }
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
public interface IMedicamentModel : IId
|
public interface IMedicamentModel : IId
|
||||||
{
|
{
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
string Comment { get; }
|
string? Comment { get; }
|
||||||
int ProcedureId { get; }
|
int ProcedureId { get; }
|
||||||
int? SymptomId { get; }
|
int? SymptomId { get; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
public interface IProcedureModel : IId
|
public interface IProcedureModel : IId
|
||||||
{
|
{
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
string Comment { get; }
|
string? Comment { get; }
|
||||||
int UserId { get; }
|
int UserId { get; }
|
||||||
DateTime DateStartProcedure { get; }
|
DateTime DateStartProcedure { get; }
|
||||||
DateTime? DateStopProcedure { get; }
|
DateTime? DateStopProcedure { get; }
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
public interface IRecipeModel : IId
|
public interface IRecipeModel : IId
|
||||||
{
|
{
|
||||||
int ProceduresCount { get; set; }
|
int ProceduresCount { get; set; }
|
||||||
string Comment { get; set; }
|
string? Comment { get; set; }
|
||||||
int? CourseId { get; set; }
|
int? CourseId { get; set; }
|
||||||
Dictionary<int, IProcedureModel> RecipeProcedures { get; }
|
Dictionary<int, IProcedureModel> RecipeProcedures { get; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
public interface ISymptomModel : IId
|
public interface ISymptomModel : IId
|
||||||
{
|
{
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
string Comment { get; }
|
string? Comment { get; }
|
||||||
Dictionary<int, IDiagnoseModel> SymptomDiagnoses { get; }
|
Dictionary<int, IDiagnoseModel> SymptomDiagnoses { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,12 +31,9 @@ namespace PolyclinicDatabaseImplement.Implements
|
|||||||
public List<CourseViewModel> GetFilteredList(CourseSearchModel model)
|
public List<CourseViewModel> GetFilteredList(CourseSearchModel model)
|
||||||
{
|
{
|
||||||
var elements = GetFullList();
|
var elements = GetFullList();
|
||||||
foreach (var prop in model.GetType().GetProperties())
|
if (model.Id != null)
|
||||||
{
|
{
|
||||||
if (model.GetType().GetProperty(prop.Name)?.GetValue(model, null) != null)
|
elements = elements.Where(x => x.Id == model.Id).ToList();
|
||||||
{
|
|
||||||
elements = elements.Where(x => x.GetType().GetProperty(prop.Name)?.GetValue(x, null) == model.GetType().GetProperty(prop.Name)?.GetValue(model, null)).ToList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return elements;
|
return elements;
|
||||||
}
|
}
|
||||||
@@ -67,14 +64,25 @@ namespace PolyclinicDatabaseImplement.Implements
|
|||||||
public CourseViewModel? Update(CourseBindingModel model)
|
public CourseViewModel? Update(CourseBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new PolyclinicDatabase();
|
using var context = new PolyclinicDatabase();
|
||||||
var element = context.Courses.FirstOrDefault(x => x.Id == model.Id);
|
using var transaction = context.Database.BeginTransaction();
|
||||||
if (element == null)
|
try
|
||||||
{
|
{
|
||||||
return null;
|
var element = context.Courses.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
element.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
element.UpdateDiagnoses(context, model);
|
||||||
|
transaction.Commit();
|
||||||
|
return element.GetViewModel;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
transaction.Rollback();
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
element.Update(model);
|
|
||||||
context.SaveChanges();
|
|
||||||
return element.GetViewModel;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace PolyclinicDatabaseImplement.Implements
|
|||||||
|
|
||||||
public RecipeViewModel? GetElement(RecipeSearchModel bindingModel)
|
public RecipeViewModel? GetElement(RecipeSearchModel bindingModel)
|
||||||
{
|
{
|
||||||
if (!bindingModel.Id.HasValue || string.IsNullOrEmpty(bindingModel.Comment))
|
if (!bindingModel.Id.HasValue)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using PolyclinicContracts.BindingModels;
|
using PolyclinicContracts.BindingModels;
|
||||||
using PolyclinicContracts.SearchModels;
|
using PolyclinicContracts.SearchModels;
|
||||||
using PolyclinicContracts.StoragesContracts;
|
using PolyclinicContracts.StoragesContracts;
|
||||||
@@ -31,12 +32,13 @@ namespace PolyclinicDatabaseImplement.Implements
|
|||||||
public List<SymptomViewModel> GetFilteredList(SymptomSearchModel model)
|
public List<SymptomViewModel> GetFilteredList(SymptomSearchModel model)
|
||||||
{
|
{
|
||||||
var elements = GetFullList();
|
var elements = GetFullList();
|
||||||
foreach (var prop in model.GetType().GetProperties())
|
if (model.Id != null)
|
||||||
{
|
{
|
||||||
if (model.GetType().GetProperty(prop.Name)?.GetValue(model, null) != null)
|
elements = elements.Where(x => x.Id == model.Id).ToList();
|
||||||
{
|
}
|
||||||
elements = elements.Where(x => x.GetType().GetProperty(prop.Name)?.GetValue(x, null) == model.GetType().GetProperty(prop.Name)?.GetValue(model, null)).ToList();
|
if (!model.Name.IsNullOrEmpty())
|
||||||
}
|
{
|
||||||
|
elements = elements.Where(x => x.Name == model.Name).ToList();
|
||||||
}
|
}
|
||||||
return elements;
|
return elements;
|
||||||
}
|
}
|
||||||
@@ -67,14 +69,26 @@ namespace PolyclinicDatabaseImplement.Implements
|
|||||||
public SymptomViewModel? Update(SymptomBindingModel model)
|
public SymptomViewModel? Update(SymptomBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new PolyclinicDatabase();
|
using var context = new PolyclinicDatabase();
|
||||||
var element = context.Symptomes.FirstOrDefault(x => x.Id == model.Id);
|
using var transaction = context.Database.BeginTransaction();
|
||||||
if (element == null)
|
try
|
||||||
{
|
{
|
||||||
return null;
|
var element = context.Symptomes.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
element.Update(model);
|
||||||
|
context.SaveChanges();
|
||||||
|
element.UpdateDiagnoses(context, model);
|
||||||
|
transaction.Commit();
|
||||||
|
return element.GetViewModel;
|
||||||
}
|
}
|
||||||
element.Update(model);
|
catch (Exception ex)
|
||||||
context.SaveChanges();
|
{
|
||||||
return element.GetViewModel;
|
transaction.Rollback();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,12 +31,19 @@ namespace PolyclinicDatabaseImplement.Implements
|
|||||||
public List<UserViewModel> GetFilteredList(UserSearchModel model)
|
public List<UserViewModel> GetFilteredList(UserSearchModel model)
|
||||||
{
|
{
|
||||||
var elements = GetFullList();
|
var elements = GetFullList();
|
||||||
foreach (var prop in model.GetType().GetProperties())
|
if (model.Id != null)
|
||||||
{
|
{
|
||||||
if (model.GetType().GetProperty(prop.Name)?.GetValue(model, null) != null)
|
elements = elements.Where(x => x.Id == model.Id).ToList();
|
||||||
{
|
}
|
||||||
elements = elements.Where(x => x.GetType().GetProperty(prop.Name)?.GetValue(x, null) == model.GetType().GetProperty(prop.Name)?.GetValue(model, null)).ToList();
|
if (!model.Email.IsNullOrEmpty())
|
||||||
}
|
{
|
||||||
|
elements = elements.Where(x => x.Email == model.Email).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
if (!model.Password.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
elements = elements.Where(x => x.Password == model.Password).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
return elements;
|
return elements;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace PolyclinicDatabaseImplement.Migrations
|
|||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
DaysCount = table.Column<int>(type: "int", nullable: false),
|
DaysCount = table.Column<int>(type: "int", nullable: false),
|
||||||
PillsPerDay = table.Column<int>(type: "int", nullable: false),
|
PillsPerDay = table.Column<int>(type: "int", nullable: false),
|
||||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@@ -33,7 +33,7 @@ namespace PolyclinicDatabaseImplement.Migrations
|
|||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@@ -63,7 +63,7 @@ namespace PolyclinicDatabaseImplement.Migrations
|
|||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
ProceduresCount = table.Column<int>(type: "int", nullable: false),
|
ProceduresCount = table.Column<int>(type: "int", nullable: false),
|
||||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
CourseId = table.Column<int>(type: "int", nullable: true)
|
CourseId = table.Column<int>(type: "int", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
@@ -83,7 +83,7 @@ namespace PolyclinicDatabaseImplement.Migrations
|
|||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
UserId = table.Column<int>(type: "int", nullable: false),
|
UserId = table.Column<int>(type: "int", nullable: false),
|
||||||
DateStartDiagnose = table.Column<DateTime>(type: "datetime2", nullable: false),
|
DateStartDiagnose = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
DateStopDiagnose = table.Column<DateTime>(type: "datetime2", nullable: true)
|
DateStopDiagnose = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||||
@@ -109,7 +109,7 @@ namespace PolyclinicDatabaseImplement.Migrations
|
|||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
DateStartProcedure = table.Column<DateTime>(type: "datetime2", nullable: false),
|
DateStartProcedure = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
DateStopProcedure = table.Column<DateTime>(type: "datetime2", nullable: true),
|
DateStopProcedure = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@@ -207,7 +207,7 @@ namespace PolyclinicDatabaseImplement.Migrations
|
|||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
ProcedureId = table.Column<int>(type: "int", nullable: false),
|
ProcedureId = table.Column<int>(type: "int", nullable: false),
|
||||||
SymptomId = table.Column<int>(type: "int", nullable: false)
|
SymptomId = table.Column<int>(type: "int", nullable: false)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
public int DaysCount { get; set; }
|
public int DaysCount { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int PillsPerDay { get; set; }
|
public int PillsPerDay { get; set; }
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; } = string.Empty;
|
||||||
[ForeignKey("CourseId")]
|
[ForeignKey("CourseId")]
|
||||||
public virtual List<CourseDiagnose> Diagnoses { get; set; } = new();
|
public virtual List<CourseDiagnose> Diagnoses { get; set; } = new();
|
||||||
private Dictionary<int, IDiagnoseModel>? _courseDiagnoses = null;
|
private Dictionary<int, IDiagnoseModel>? _courseDiagnoses = null;
|
||||||
@@ -34,7 +34,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Course Create(PolyclinicDatabase context, CourseBindingModel model)
|
public static Course? Create(PolyclinicDatabase context, CourseBindingModel model)
|
||||||
{
|
{
|
||||||
return new Course()
|
return new Course()
|
||||||
{
|
{
|
||||||
@@ -71,8 +71,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
if (courseDiagnoses != null && courseDiagnoses.Count > 0)
|
if (courseDiagnoses != null && courseDiagnoses.Count > 0)
|
||||||
{
|
{
|
||||||
// удалили те, которых нет в модели
|
// удалили те, которых нет в модели
|
||||||
context.CourseDiagnoses.RemoveRange(courseDiagnoses
|
context.CourseDiagnoses.RemoveRange(courseDiagnoses);
|
||||||
.Where(rec => !model.CourseDiagnoses.ContainsKey(rec.DiagnoseId)));
|
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
}
|
}
|
||||||
var course = context.Courses.First(x => x.Id == Id);
|
var course = context.Courses.First(x => x.Id == Id);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
public int CourseId { get; set; }
|
public int CourseId { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int DiagnoseId { get; set; }
|
public int DiagnoseId { get; set; }
|
||||||
public virtual Course Course { get; set; } = new();
|
public virtual Course? Course { get; set; }
|
||||||
public virtual Diagnose Diagnose { get; set; } = new();
|
public virtual Diagnose? Diagnose { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
[Required]
|
public string? Comment { get; set; }
|
||||||
public string Comment { get; set; } = string.Empty;
|
|
||||||
[Required]
|
[Required]
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
|
|
||||||
@@ -18,7 +17,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
public DateTime DateStartDiagnose { get; set; } = DateTime.Now;
|
public DateTime DateStartDiagnose { get; set; } = DateTime.Now;
|
||||||
public DateTime? DateStopDiagnose { get; set; }
|
public DateTime? DateStopDiagnose { get; set; }
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public virtual User User { get; set; } = new();
|
public virtual User? User { get; set; }
|
||||||
|
|
||||||
public static Diagnose? Create(DiagnoseBindingModel? model)
|
public static Diagnose? Create(DiagnoseBindingModel? model)
|
||||||
{
|
{
|
||||||
@@ -45,6 +44,8 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
}
|
}
|
||||||
Name = model.Name;
|
Name = model.Name;
|
||||||
Comment = model.Comment;
|
Comment = model.Comment;
|
||||||
|
DateStartDiagnose = model.DateStartDiagnose;
|
||||||
|
DateStopDiagnose = model.DateStopDiagnose;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiagnoseViewModel GetViewModel => new()
|
public DiagnoseViewModel GetViewModel => new()
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Required]
|
public string? Comment { get; set; } = string.Empty;
|
||||||
public string Comment { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public int ProcedureId { get; set; }
|
public int ProcedureId { get; set; }
|
||||||
@@ -25,7 +24,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
public virtual Symptom? Symptom { get; set; }
|
public virtual Symptom? Symptom { get; set; }
|
||||||
public virtual Procedure? Procedure { get; set; }
|
public virtual Procedure? Procedure { get; set; }
|
||||||
|
|
||||||
public static Medicament Create(MedicamentBindingModel bindingModel)
|
public static Medicament? Create(MedicamentBindingModel bindingModel)
|
||||||
{
|
{
|
||||||
return new Medicament()
|
return new Medicament()
|
||||||
{
|
{
|
||||||
@@ -41,6 +40,8 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
{
|
{
|
||||||
Name = bindingModel.Name;
|
Name = bindingModel.Name;
|
||||||
Comment = bindingModel.Comment;
|
Comment = bindingModel.Comment;
|
||||||
|
ProcedureId = bindingModel.ProcedureId;
|
||||||
|
SymptomId = bindingModel.SymptomId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MedicamentViewModel GetViewModel => new()
|
public MedicamentViewModel GetViewModel => new()
|
||||||
@@ -49,7 +50,9 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
Name = Name,
|
Name = Name,
|
||||||
Comment = Comment,
|
Comment = Comment,
|
||||||
ProcedureId = ProcedureId,
|
ProcedureId = ProcedureId,
|
||||||
SymptomId = Symptom?.Id ?? null
|
SymptomId = Symptom?.Id ?? null,
|
||||||
|
SymptomName = Symptom?.Name ?? string.Empty,
|
||||||
|
ProcedureName = Procedure?.Name ?? string.Empty,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,12 +19,11 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public DateTime DateStartProcedure { get; set; } = DateTime.Now;
|
public DateTime DateStartProcedure { get; set; } = DateTime.Now;
|
||||||
public DateTime? DateStopProcedure { get; set; }
|
public DateTime? DateStopProcedure { get; set; }
|
||||||
public virtual User User { get; set; } = new();
|
public virtual User? User { get; set; }
|
||||||
|
|
||||||
[Required]
|
public string? Comment { get; set; } = string.Empty;
|
||||||
public string Comment { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public static Procedure Create(ProcedureBindingModel bindingModel)
|
public static Procedure? Create(ProcedureBindingModel bindingModel)
|
||||||
{
|
{
|
||||||
return new Procedure()
|
return new Procedure()
|
||||||
{
|
{
|
||||||
@@ -37,10 +36,16 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(ProcedureBindingModel bindingModel)
|
public void Update(ProcedureBindingModel? bindingModel)
|
||||||
{
|
{
|
||||||
|
if (bindingModel == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
Name = bindingModel.Name;
|
Name = bindingModel.Name;
|
||||||
Comment = bindingModel.Comment;
|
Comment = bindingModel.Comment;
|
||||||
|
DateStartProcedure = bindingModel.DateStartProcedure;
|
||||||
|
DateStopProcedure = bindingModel.DateStopProcedure;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProcedureViewModel GetViewModel => new()
|
public ProcedureViewModel GetViewModel => new()
|
||||||
|
|||||||
@@ -14,10 +14,9 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int ProceduresCount { get; set; }
|
public int ProceduresCount { get; set; }
|
||||||
|
|
||||||
[Required]
|
public string? Comment { get; set; } = string.Empty;
|
||||||
public string Comment { get; set; } = string.Empty;
|
|
||||||
public int? CourseId { get; set; }
|
public int? CourseId { get; set; }
|
||||||
public virtual Course Course { get; set; } = new();
|
public virtual Course? Course { get; set; }
|
||||||
|
|
||||||
private Dictionary<int, IProcedureModel>? _recipeProcedures = null;
|
private Dictionary<int, IProcedureModel>? _recipeProcedures = null;
|
||||||
|
|
||||||
@@ -37,7 +36,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Recipe Create(PolyclinicDatabase database, RecipeBindingModel bindingModel)
|
public static Recipe? Create(PolyclinicDatabase database, RecipeBindingModel bindingModel)
|
||||||
{
|
{
|
||||||
return new Recipe()
|
return new Recipe()
|
||||||
{
|
{
|
||||||
@@ -47,7 +46,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
CourseId = bindingModel.CourseId,
|
CourseId = bindingModel.CourseId,
|
||||||
Procedures = bindingModel.RecipeProcedures.Select(x => new RecipeProcedure
|
Procedures = bindingModel.RecipeProcedures.Select(x => new RecipeProcedure
|
||||||
{
|
{
|
||||||
Recipe = database.Recipes.First(y => y.Id == x.Key)
|
Procedure = database.Procedures.First(y => y.Id == x.Key),
|
||||||
}).ToList()
|
}).ToList()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -64,17 +63,21 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
Id = Id,
|
Id = Id,
|
||||||
ProceduresCount = ProceduresCount,
|
ProceduresCount = ProceduresCount,
|
||||||
Comment = Comment,
|
Comment = Comment,
|
||||||
CourseId = Course?.Id ?? null,
|
CourseId = CourseId ?? null,
|
||||||
};
|
};
|
||||||
|
|
||||||
public void UpdateProcedures(PolyclinicDatabase database, RecipeBindingModel bindingModel)
|
public void UpdateProcedures(PolyclinicDatabase database, RecipeBindingModel bindingModel)
|
||||||
{
|
{
|
||||||
|
if (database.Procedures.Count() == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
var RecipeProcedures = database.RecipeProcedures.Where(x => x.ProcedureId == bindingModel.Id).ToList();
|
var RecipeProcedures = database.RecipeProcedures.Where(x => x.ProcedureId == bindingModel.Id).ToList();
|
||||||
|
|
||||||
if (RecipeProcedures != null)
|
if (RecipeProcedures != null)
|
||||||
{
|
{
|
||||||
// удалили те, которых нет в модели
|
// удалили те, которых нет в модели
|
||||||
database.RecipeProcedures.RemoveRange(RecipeProcedures.Where(rec => !bindingModel.RecipeProcedures.ContainsKey(rec.RecipeId)));
|
database.RecipeProcedures.RemoveRange(RecipeProcedures);
|
||||||
database.SaveChanges();
|
database.SaveChanges();
|
||||||
}
|
}
|
||||||
var Procedure = database.Procedures.First(x => x.Id == bindingModel.Id);
|
var Procedure = database.Procedures.First(x => x.Id == bindingModel.Id);
|
||||||
@@ -85,6 +88,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
Procedure = Procedure,
|
Procedure = Procedure,
|
||||||
Recipe = database.Recipes.First(x => x.Id == pc.Key)
|
Recipe = database.Recipes.First(x => x.Id == pc.Key)
|
||||||
});
|
});
|
||||||
|
database.SaveChanges();
|
||||||
}
|
}
|
||||||
_recipeProcedures = null;
|
_recipeProcedures = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
public int ProcedureId { get; set; }
|
public int ProcedureId { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int RecipeId { get; set; }
|
public int RecipeId { get; set; }
|
||||||
public virtual Procedure Procedure { get; set; } = new();
|
public virtual Procedure? Procedure { get; set; }
|
||||||
public virtual Recipe Recipe { get; set; } = new();
|
public virtual Recipe? Recipe { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
[Required]
|
public string? Comment { get; set; } = string.Empty;
|
||||||
public string Comment { get; set; } = string.Empty;
|
|
||||||
[ForeignKey("SymptomId")]
|
[ForeignKey("SymptomId")]
|
||||||
public virtual List<SymptomDiagnose> Diagnoses { get; set; } = new();
|
public virtual List<SymptomDiagnose> Diagnoses { get; set; } = new();
|
||||||
private Dictionary<int, IDiagnoseModel>? _symptomDiagnoses = null;
|
private Dictionary<int, IDiagnoseModel>? _symptomDiagnoses = null;
|
||||||
@@ -33,7 +32,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
}
|
}
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public static Symptom Create(PolyclinicDatabase context, SymptomBindingModel model)
|
public static Symptom? Create(PolyclinicDatabase context, SymptomBindingModel model)
|
||||||
{
|
{
|
||||||
return new Symptom()
|
return new Symptom()
|
||||||
{
|
{
|
||||||
@@ -64,19 +63,18 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
public void UpdateDiagnoses(PolyclinicDatabase context, SymptomBindingModel model)
|
public void UpdateDiagnoses(PolyclinicDatabase context, SymptomBindingModel model)
|
||||||
{
|
{
|
||||||
var symptomDiagnoses = context.SymptomDiagnoses.Where(rec => rec.SymptomId == model.Id).ToList();
|
var symptomDiagnoses = context.SymptomDiagnoses.Where(rec => rec.SymptomId == model.Id).ToList();
|
||||||
|
|
||||||
if (symptomDiagnoses != null && symptomDiagnoses.Count > 0)
|
if (symptomDiagnoses != null && symptomDiagnoses.Count > 0)
|
||||||
{
|
{
|
||||||
// удалили те, которых нет в модели
|
context.SymptomDiagnoses.RemoveRange(symptomDiagnoses);
|
||||||
context.SymptomDiagnoses.RemoveRange(symptomDiagnoses
|
|
||||||
.Where(rec => !model.SymptomDiagnoses.ContainsKey(rec.DiagnoseId)));
|
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
}
|
}
|
||||||
var course = context.Symptomes.First(x => x.Id == Id);
|
var symptom = context.Symptomes.First(x => x.Id == model.Id);
|
||||||
foreach (var pc in model.SymptomDiagnoses)
|
foreach (var pc in model.SymptomDiagnoses)
|
||||||
{
|
{
|
||||||
context.SymptomDiagnoses.Add(new SymptomDiagnose
|
context.SymptomDiagnoses.Add(new SymptomDiagnose
|
||||||
{
|
{
|
||||||
Symptom = course,
|
Symptom = symptom,
|
||||||
Diagnose = context.Diagnoses.First(x => x.Id == pc.Key),
|
Diagnose = context.Diagnoses.First(x => x.Id == pc.Key),
|
||||||
});
|
});
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
public int SymptomId { get; set; }
|
public int SymptomId { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int DiagnoseId { get; set; }
|
public int DiagnoseId { get; set; }
|
||||||
public virtual Symptom Symptom { get; set; } = new();
|
public virtual Symptom? Symptom { get; set; }
|
||||||
public virtual Diagnose Diagnose { get; set; } = new();
|
public virtual Diagnose? Diagnose { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
public int SymptomId { get; set; }
|
public int SymptomId { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int RecipeId { get; set; }
|
public int RecipeId { get; set; }
|
||||||
public virtual Symptom Symptom { get; set; } = new();
|
public virtual Symptom? Symptom { get; set; }
|
||||||
public virtual Recipe Recipe { get; set; } = new();
|
public virtual Recipe? Recipe { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,6 @@ namespace PolyclinicDatabaseImplement.Models
|
|||||||
FIO = model.FIO;
|
FIO = model.FIO;
|
||||||
Email = model.Email;
|
Email = model.Email;
|
||||||
Password = model.Password;
|
Password = model.Password;
|
||||||
Role = model.Role;
|
|
||||||
FIO = model.FIO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserViewModel GetViewModel => new()
|
public UserViewModel GetViewModel => new()
|
||||||
|
|||||||
@@ -0,0 +1,125 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using PolyclinicContracts.BindingModels;
|
||||||
|
using PolyclinicContracts.BusinessLogicsContracts;
|
||||||
|
using PolyclinicContracts.SearchModels;
|
||||||
|
using PolyclinicContracts.ViewModels;
|
||||||
|
using PolyclinicDataModels.Models;
|
||||||
|
using PolyclinicWebAppImplementer.Models;
|
||||||
|
|
||||||
|
namespace PolyclinicWebAppImplementer.Controllers
|
||||||
|
{
|
||||||
|
public class CoursesController : Controller
|
||||||
|
{
|
||||||
|
private readonly IDiagnoseLogic _diagnoseLogic;
|
||||||
|
private readonly ICourseLogic _courseLogic;
|
||||||
|
|
||||||
|
public CoursesController(IDiagnoseLogic diagnoseLogic, ICourseLogic courseLogic)
|
||||||
|
{
|
||||||
|
_diagnoseLogic = diagnoseLogic;
|
||||||
|
_courseLogic = courseLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
var currentUser = LoginManager.LogginedUser;
|
||||||
|
if (currentUser == null)
|
||||||
|
{
|
||||||
|
return RedirectToAction("Login", "User");
|
||||||
|
}
|
||||||
|
List<CourseViewModel> courses = _courseLogic.ReadList();
|
||||||
|
ViewData["Title"] = "Список курсов";
|
||||||
|
return View("CoursesList", courses);
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Add(CourseFormModel model, int[] selectedDiagnoses)
|
||||||
|
{
|
||||||
|
var currentUser = LoginManager.LogginedUser;
|
||||||
|
if (currentUser == null)
|
||||||
|
{
|
||||||
|
return RedirectToAction("Login", "User");
|
||||||
|
}
|
||||||
|
if (HttpContext.Request.Method == "GET")
|
||||||
|
{
|
||||||
|
ViewData["Title"] = "Новый курс";
|
||||||
|
model = new()
|
||||||
|
{
|
||||||
|
Diagnoses = _diagnoseLogic.ReadList().Select(x => (x, false)).ToList()
|
||||||
|
};
|
||||||
|
return View("CourseForm", model);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var allDiagnoses = _diagnoseLogic.ReadList();
|
||||||
|
CourseBindingModel course = new CourseBindingModel
|
||||||
|
{
|
||||||
|
Comment = model.CourseViewModel.Comment,
|
||||||
|
DaysCount = model.CourseViewModel.DaysCount,
|
||||||
|
PillsPerDay = model.CourseViewModel.PillsPerDay,
|
||||||
|
CourseDiagnoses = selectedDiagnoses
|
||||||
|
.ToDictionary(
|
||||||
|
x => x,
|
||||||
|
x => allDiagnoses.Where(y => y.Id == x) as IDiagnoseModel
|
||||||
|
)
|
||||||
|
};
|
||||||
|
_courseLogic.Create(course);
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Edit(int id, CourseFormModel model, int[] selectedDiagnoses)
|
||||||
|
{
|
||||||
|
var currentUser = LoginManager.LogginedUser;
|
||||||
|
if (currentUser == null)
|
||||||
|
{
|
||||||
|
return RedirectToAction("Login", "User");
|
||||||
|
}
|
||||||
|
if (HttpContext.Request.Method == "GET")
|
||||||
|
{
|
||||||
|
var obj = _courseLogic.ReadElement(new CourseSearchModel { Id = id });
|
||||||
|
model = new()
|
||||||
|
{
|
||||||
|
CourseViewModel = obj,
|
||||||
|
Diagnoses = _diagnoseLogic.ReadList().Select(x => (x, obj.CourseDiagnoses.ContainsKey(x.Id))).ToList()
|
||||||
|
};
|
||||||
|
ViewData["Title"] = "Редактировать симптом";
|
||||||
|
return View("CourseForm", model);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var allDiagnoses = _diagnoseLogic.ReadList();
|
||||||
|
CourseBindingModel course = new CourseBindingModel
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
Comment = model.CourseViewModel.Comment,
|
||||||
|
DaysCount = model.CourseViewModel.DaysCount,
|
||||||
|
PillsPerDay = model.CourseViewModel.PillsPerDay,
|
||||||
|
CourseDiagnoses = selectedDiagnoses
|
||||||
|
.ToDictionary(
|
||||||
|
x => x,
|
||||||
|
x => allDiagnoses.Where(y => y.Id == x) as IDiagnoseModel
|
||||||
|
)
|
||||||
|
};
|
||||||
|
_courseLogic.Update(course);
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Delete(int id)
|
||||||
|
{
|
||||||
|
var currentUser = LoginManager.LogginedUser;
|
||||||
|
if (currentUser == null)
|
||||||
|
{
|
||||||
|
return RedirectToAction("Login", "User");
|
||||||
|
}
|
||||||
|
var obj = _courseLogic.ReadElement(new CourseSearchModel { Id = id });
|
||||||
|
if (obj != null)
|
||||||
|
{
|
||||||
|
_courseLogic.Delete(new CourseBindingModel { Id = obj.Id });
|
||||||
|
}
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using PolyclinicContracts.BindingModels;
|
||||||
|
using PolyclinicContracts.BusinessLogicsContracts;
|
||||||
|
using PolyclinicContracts.SearchModels;
|
||||||
|
using PolyclinicContracts.ViewModels;
|
||||||
|
using PolyclinicWebAppImplementer.Models;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
namespace PolyclinicWebAppImplementer.Controllers
|
||||||
|
{
|
||||||
|
public class DiagnosesController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger<DiagnosesController> _logger;
|
||||||
|
private readonly IDiagnoseLogic _diagnoseLogic;
|
||||||
|
|
||||||
|
public DiagnosesController(ILogger<DiagnosesController> logger, IDiagnoseLogic diagnoseLogic)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_diagnoseLogic = diagnoseLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
var currentUser = LoginManager.LogginedUser;
|
||||||
|
if (currentUser == null)
|
||||||
|
{
|
||||||
|
return RedirectToAction("Login", "User");
|
||||||
|
}
|
||||||
|
List<DiagnoseViewModel> diagnoses = _diagnoseLogic.ReadList(new DiagnoseSearchModel { UserId = currentUser.Id });
|
||||||
|
ViewData["Title"] = "Список диагнозов";
|
||||||
|
return View("DiagnosesList", diagnoses);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Add(DiagnoseViewModel model)
|
||||||
|
{
|
||||||
|
var currentUser = LoginManager.LogginedUser;
|
||||||
|
if (currentUser == null)
|
||||||
|
{
|
||||||
|
return RedirectToAction("Login", "User");
|
||||||
|
}
|
||||||
|
if (HttpContext.Request.Method == "GET")
|
||||||
|
{
|
||||||
|
ViewData["Title"] = "Новый диагноз";
|
||||||
|
return View("DiagnoseForm");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DiagnoseBindingModel diagnose = new DiagnoseBindingModel
|
||||||
|
{
|
||||||
|
UserId = currentUser.Id,
|
||||||
|
Name = model.Name,
|
||||||
|
Comment = model.Comment,
|
||||||
|
DateStartDiagnose = model.DateStartDiagnose,
|
||||||
|
DateStopDiagnose = model.DateStopDiagnose,
|
||||||
|
};
|
||||||
|
_diagnoseLogic.Create(diagnose);
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Edit(int id, DiagnoseViewModel model)
|
||||||
|
{
|
||||||
|
var currentUser = LoginManager.LogginedUser;
|
||||||
|
if (currentUser == null)
|
||||||
|
{
|
||||||
|
return RedirectToAction("Login", "User");
|
||||||
|
}
|
||||||
|
var obj = _diagnoseLogic.ReadElement(new DiagnoseSearchModel { Id = id });
|
||||||
|
if (obj.UserId != currentUser.Id)
|
||||||
|
{
|
||||||
|
return StatusCode(403, "Нельзя редактировать чужой диагноз");
|
||||||
|
}
|
||||||
|
if (HttpContext.Request.Method == "GET")
|
||||||
|
{
|
||||||
|
ViewData["Title"] = "Редактировать диагноз";
|
||||||
|
return View("DiagnoseForm", obj);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DiagnoseBindingModel diagnose = new DiagnoseBindingModel
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
Name = model.Name,
|
||||||
|
Comment = model.Comment,
|
||||||
|
DateStartDiagnose = model.DateStartDiagnose,
|
||||||
|
DateStopDiagnose = model.DateStopDiagnose,
|
||||||
|
};
|
||||||
|
_diagnoseLogic.Update(diagnose);
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Delete(int id)
|
||||||
|
{
|
||||||
|
var currentUser = LoginManager.LogginedUser;
|
||||||
|
if (currentUser == null)
|
||||||
|
{
|
||||||
|
return RedirectToAction("Login", "User");
|
||||||
|
}
|
||||||
|
var obj = _diagnoseLogic.ReadElement(new DiagnoseSearchModel { Id = id });
|
||||||
|
if (obj.UserId != currentUser.Id)
|
||||||
|
{
|
||||||
|
return StatusCode(403, "Нельзя удалить чужой диагноз");
|
||||||
|
}
|
||||||
|
if (obj != null)
|
||||||
|
{
|
||||||
|
_diagnoseLogic.Delete(new DiagnoseBindingModel { Id = obj.Id });
|
||||||
|
}
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,79 +17,12 @@ namespace PolyclinicWebAppImplementer.Controllers
|
|||||||
{
|
{
|
||||||
return View();
|
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()
|
public IActionResult Privacy()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[HttpPost]
|
|
||||||
public IActionResult Login()
|
|
||||||
{
|
|
||||||
if (HttpContext.Request.Method == "POST")
|
|
||||||
{
|
|
||||||
return Redirect("~/");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IActionResult Register()
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult AddRecipeToCourse()
|
public IActionResult AddRecipeToCourse()
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using PolyclinicBusinessLogic.BusinessLogics;
|
||||||
|
using PolyclinicContracts.BindingModels;
|
||||||
|
using PolyclinicContracts.BusinessLogicsContracts;
|
||||||
|
using PolyclinicContracts.SearchModels;
|
||||||
|
using PolyclinicWebAppImplementer.Models;
|
||||||
|
|
||||||
|
namespace PolyclinicWebAppImplementer.Controllers
|
||||||
|
{
|
||||||
|
public class RecipeController : Controller
|
||||||
|
{
|
||||||
|
private readonly IRecipeLogic _recipeLogic;
|
||||||
|
private readonly ICourseLogic _courseLogic;
|
||||||
|
|
||||||
|
public RecipeController(IRecipeLogic recipeLogic, ICourseLogic courseLogic)
|
||||||
|
{
|
||||||
|
_recipeLogic = recipeLogic;
|
||||||
|
_courseLogic = courseLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult LinkCourse(RecipeLinkCourseModel model)
|
||||||
|
{
|
||||||
|
var recipes = _recipeLogic.ReadList();
|
||||||
|
var courses = _courseLogic.ReadList();
|
||||||
|
var linkedRecipes = recipes
|
||||||
|
.Where(x => x.CourseId != null)
|
||||||
|
.Select(x => (x, _courseLogic.ReadElement(new CourseSearchModel { Id = x.CourseId }))).ToList();
|
||||||
|
|
||||||
|
if (HttpContext.Request.Method == "GET")
|
||||||
|
{
|
||||||
|
model = new()
|
||||||
|
{
|
||||||
|
Recipes = recipes,
|
||||||
|
Courses = courses,
|
||||||
|
LinkedRecipes = linkedRecipes
|
||||||
|
};
|
||||||
|
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var recipe = _recipeLogic.ReadElement(new RecipeSearchModel { Id = model.RecipeId });
|
||||||
|
var recipeBindingModel = new RecipeBindingModel
|
||||||
|
{
|
||||||
|
Id = recipe.Id,
|
||||||
|
ProceduresCount = recipe.ProceduresCount,
|
||||||
|
Comment = recipe.Comment,
|
||||||
|
RecipeProcedures = recipe.RecipeProcedures,
|
||||||
|
CourseId = model.CourseId
|
||||||
|
};
|
||||||
|
_recipeLogic.Update(recipeBindingModel);
|
||||||
|
return RedirectToAction("LinkCourse");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult UnLinkCourse(int id)
|
||||||
|
{
|
||||||
|
var recipe = _recipeLogic.ReadElement(new RecipeSearchModel { Id = id });
|
||||||
|
var recipeBindingModel = new RecipeBindingModel
|
||||||
|
{
|
||||||
|
Id = recipe.Id,
|
||||||
|
ProceduresCount = recipe.ProceduresCount,
|
||||||
|
Comment = recipe.Comment,
|
||||||
|
RecipeProcedures = recipe.RecipeProcedures
|
||||||
|
};
|
||||||
|
_recipeLogic.Update(recipeBindingModel);
|
||||||
|
return RedirectToAction("LinkCourse");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using PolyclinicContracts.BindingModels;
|
||||||
|
using PolyclinicContracts.BusinessLogicsContracts;
|
||||||
|
using PolyclinicContracts.SearchModels;
|
||||||
|
using PolyclinicContracts.ViewModels;
|
||||||
|
using PolyclinicDataModels.Models;
|
||||||
|
using PolyclinicWebAppImplementer.Models;
|
||||||
|
|
||||||
|
namespace PolyclinicWebAppImplementer.Controllers
|
||||||
|
{
|
||||||
|
public class SymptomesController : Controller
|
||||||
|
{
|
||||||
|
private readonly ISymptomLogic _symptomLogic;
|
||||||
|
private readonly IDiagnoseLogic _diagnoseLogic;
|
||||||
|
public SymptomesController(ISymptomLogic symptomLogic, IDiagnoseLogic diagnoseLogic)
|
||||||
|
{
|
||||||
|
_symptomLogic = symptomLogic;
|
||||||
|
_diagnoseLogic = diagnoseLogic;
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
var currentUser = LoginManager.LogginedUser;
|
||||||
|
if (currentUser == null)
|
||||||
|
{
|
||||||
|
return RedirectToAction("Login", "User");
|
||||||
|
}
|
||||||
|
List<SymptomViewModel> symptomes = _symptomLogic.ReadList();
|
||||||
|
ViewData["Title"] = "Список симптомов";
|
||||||
|
return View("SymptomesList", symptomes);
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Add(SymptomFormModel model, int[] selectedDiagnoses)
|
||||||
|
{
|
||||||
|
var currentUser = LoginManager.LogginedUser;
|
||||||
|
if (currentUser == null)
|
||||||
|
{
|
||||||
|
return RedirectToAction("Login", "User");
|
||||||
|
}
|
||||||
|
if (HttpContext.Request.Method == "GET")
|
||||||
|
{
|
||||||
|
ViewData["Title"] = "Новый симптом";
|
||||||
|
model = new()
|
||||||
|
{
|
||||||
|
Diagnoses = _diagnoseLogic.ReadList().Select(x => (x, false)).ToList()
|
||||||
|
};
|
||||||
|
return View("SymptomForm", model);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var allDiagnoses = _diagnoseLogic.ReadList();
|
||||||
|
SymptomBindingModel symptom = new SymptomBindingModel
|
||||||
|
{
|
||||||
|
Name = model.SymptomViewModel.Name,
|
||||||
|
Comment = model.SymptomViewModel.Comment,
|
||||||
|
SymptomDiagnoses = selectedDiagnoses
|
||||||
|
.ToDictionary(
|
||||||
|
x => x,
|
||||||
|
x => allDiagnoses.Where(y => y.Id == x) as IDiagnoseModel
|
||||||
|
)
|
||||||
|
};
|
||||||
|
_symptomLogic.Create(symptom);
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Edit(int id, SymptomFormModel model, int[] selectedDiagnoses)
|
||||||
|
{
|
||||||
|
var currentUser = LoginManager.LogginedUser;
|
||||||
|
if (currentUser == null)
|
||||||
|
{
|
||||||
|
return RedirectToAction("Login", "User");
|
||||||
|
}
|
||||||
|
if (HttpContext.Request.Method == "GET")
|
||||||
|
{
|
||||||
|
var obj = _symptomLogic.ReadElement(new SymptomSearchModel { Id = id });
|
||||||
|
model = new()
|
||||||
|
{
|
||||||
|
SymptomViewModel = obj,
|
||||||
|
Diagnoses = _diagnoseLogic.ReadList().Select(x => (x, obj.SymptomDiagnoses.ContainsKey(x.Id))).ToList()
|
||||||
|
};
|
||||||
|
ViewData["Title"] = "Редактировать симптом";
|
||||||
|
return View("SymptomForm", model);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var allDiagnoses = _diagnoseLogic.ReadList();
|
||||||
|
SymptomBindingModel symptom = new SymptomBindingModel
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
Name = model.SymptomViewModel.Name,
|
||||||
|
Comment = model.SymptomViewModel.Comment,
|
||||||
|
SymptomDiagnoses = selectedDiagnoses
|
||||||
|
.ToDictionary(
|
||||||
|
x => x,
|
||||||
|
x => allDiagnoses.Where(y => y.Id == x) as IDiagnoseModel
|
||||||
|
)
|
||||||
|
};
|
||||||
|
_symptomLogic.Update(symptom);
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Delete(int id)
|
||||||
|
{
|
||||||
|
var currentUser = LoginManager.LogginedUser;
|
||||||
|
if (currentUser == null)
|
||||||
|
{
|
||||||
|
return RedirectToAction("Login", "User");
|
||||||
|
}
|
||||||
|
var obj = _symptomLogic.ReadElement(new SymptomSearchModel { Id = id });
|
||||||
|
if (obj != null)
|
||||||
|
{
|
||||||
|
_symptomLogic.Delete(new SymptomBindingModel { Id = obj.Id });
|
||||||
|
}
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
using PolyclinicContracts.BindingModels;
|
||||||
|
using PolyclinicContracts.BusinessLogicsContracts;
|
||||||
|
using PolyclinicContracts.SearchModels;
|
||||||
|
using PolyclinicDataModels.Enums;
|
||||||
|
using PolyclinicDataModels.Models;
|
||||||
|
using PolyclinicWebAppImplementer.Models;
|
||||||
|
|
||||||
|
namespace PolyclinicWebAppImplementer.Controllers
|
||||||
|
{
|
||||||
|
public class UserController : Controller
|
||||||
|
{
|
||||||
|
private readonly IUserLogic _userLogic;
|
||||||
|
public UserController(IUserLogic userLogic)
|
||||||
|
{
|
||||||
|
_userLogic = userLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Login(LoginModel model)
|
||||||
|
{
|
||||||
|
var errors = new List<string>();
|
||||||
|
if (HttpContext.Request.Method == "POST")
|
||||||
|
{
|
||||||
|
var user = _userLogic.ReadElement(new UserSearchModel { Email = model.Email, Password = model.Password });
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
errors.Add("Неверные логин или пароль");
|
||||||
|
}
|
||||||
|
else if (user.Role != UserRole.Исполнитель)
|
||||||
|
{
|
||||||
|
errors.Add("Пользователь имеет неразрешенную роль");
|
||||||
|
}
|
||||||
|
if (errors.Count > 0)
|
||||||
|
{
|
||||||
|
model = new LoginModel
|
||||||
|
{
|
||||||
|
Errors = errors
|
||||||
|
};
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
LoginManager.LogginedUser = user;
|
||||||
|
return RedirectToAction("", "Home");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
model = new();
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Register(RegisterModel model)
|
||||||
|
{
|
||||||
|
var errors = new List<string>();
|
||||||
|
if (HttpContext.Request.Method == "POST")
|
||||||
|
{
|
||||||
|
if (_userLogic.ReadElement(new UserSearchModel { Email = model.Email }) != null)
|
||||||
|
{
|
||||||
|
errors.Add("Пользователь с таким Email уже есть");
|
||||||
|
}
|
||||||
|
if (model.Password != model.ConfirmPassword)
|
||||||
|
{
|
||||||
|
errors.Add("Пароли не совпадают");
|
||||||
|
}
|
||||||
|
if (errors.Count > 0)
|
||||||
|
{
|
||||||
|
model.Errors = errors;
|
||||||
|
model.Password = string.Empty;
|
||||||
|
model.ConfirmPassword = string.Empty;
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
var user = new UserBindingModel
|
||||||
|
{
|
||||||
|
FIO = model.FIO,
|
||||||
|
Email = model.Email,
|
||||||
|
Password = model.Password,
|
||||||
|
Role = UserRole.Исполнитель
|
||||||
|
};
|
||||||
|
_userLogic.Create(user);
|
||||||
|
return RedirectToAction("Login");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Logout()
|
||||||
|
{
|
||||||
|
LoginManager.LogginedUser = null;
|
||||||
|
return RedirectToAction("Login");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult Privacy(UserPrivacyModel model)
|
||||||
|
{
|
||||||
|
var currentUser = LoginManager.LogginedUser;
|
||||||
|
if (currentUser == null)
|
||||||
|
{
|
||||||
|
return RedirectToAction("Login");
|
||||||
|
}
|
||||||
|
if (HttpContext.Request.Method == "POST")
|
||||||
|
{
|
||||||
|
var errors = new List<string>();
|
||||||
|
var checkedUser = _userLogic.ReadElement(new UserSearchModel { Email = model.Email });
|
||||||
|
if (checkedUser != null && checkedUser.Id != LoginManager.LogginedUser.Id)
|
||||||
|
{
|
||||||
|
errors.Add("Пользователь с таким Email уже есть");
|
||||||
|
}
|
||||||
|
if (model.Password != model.ConfirmPassword)
|
||||||
|
{
|
||||||
|
errors.Add("Пароли не совпадают");
|
||||||
|
}
|
||||||
|
if (errors.Count > 0)
|
||||||
|
{
|
||||||
|
model.Errors = errors;
|
||||||
|
model.Password = string.Empty;
|
||||||
|
model.ConfirmPassword = string.Empty;
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
var user = new UserBindingModel
|
||||||
|
{
|
||||||
|
Id = currentUser.Id,
|
||||||
|
FIO = model.FIO,
|
||||||
|
Email = model.Email,
|
||||||
|
Password = model.Password.IsNullOrEmpty() ? LoginManager.LogginedUser.Password : model.Password,
|
||||||
|
};
|
||||||
|
_userLogic.Update(user);
|
||||||
|
LoginManager.LogginedUser = _userLogic.ReadElement(new UserSearchModel { Id = model.Id });
|
||||||
|
return RedirectToAction("Privacy");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
model = new()
|
||||||
|
{
|
||||||
|
Id = currentUser.Id,
|
||||||
|
FIO = currentUser.FIO,
|
||||||
|
Email = currentUser.Email,
|
||||||
|
Role = currentUser.Role
|
||||||
|
};
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
Polyclinic/PolyclinicWebAppImplementer/LoginManager.cs
Normal file
9
Polyclinic/PolyclinicWebAppImplementer/LoginManager.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using PolyclinicContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace PolyclinicWebAppImplementer
|
||||||
|
{
|
||||||
|
public static class LoginManager
|
||||||
|
{
|
||||||
|
public static UserViewModel? LogginedUser { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using PolyclinicContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace PolyclinicWebAppImplementer.Models
|
||||||
|
{
|
||||||
|
public class CourseFormModel
|
||||||
|
{
|
||||||
|
public CourseViewModel? CourseViewModel { get; set; }
|
||||||
|
public List<(DiagnoseViewModel Diagnose, bool IsChecked)> Diagnoses { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace PolyclinicWebAppImplementer.Models
|
||||||
|
{
|
||||||
|
public class LoginModel
|
||||||
|
{
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
|
public string Password { get; set; } = string.Empty;
|
||||||
|
public List<string> Errors { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using PolyclinicContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace PolyclinicWebAppImplementer.Models
|
||||||
|
{
|
||||||
|
public class RecipeLinkCourseModel
|
||||||
|
{
|
||||||
|
public List<RecipeViewModel> Recipes { get; set; } = new();
|
||||||
|
public List<CourseViewModel> Courses { get; set; } = new();
|
||||||
|
public int? RecipeId { get; set; }
|
||||||
|
public int? CourseId { get; set; }
|
||||||
|
public RecipeViewModel? Recipe { get; set; }
|
||||||
|
public CourseViewModel? Course { get; set; }
|
||||||
|
public List<(RecipeViewModel Recipe, CourseViewModel Course)> LinkedRecipes { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace PolyclinicWebAppImplementer.Models
|
||||||
|
{
|
||||||
|
public class RegisterModel
|
||||||
|
{
|
||||||
|
[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 string ConfirmPassword { get; set; } = string.Empty;
|
||||||
|
public List<string> Errors { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using PolyclinicContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace PolyclinicWebAppImplementer.Models
|
||||||
|
{
|
||||||
|
public class SymptomFormModel
|
||||||
|
{
|
||||||
|
public SymptomViewModel? SymptomViewModel { get; set; }
|
||||||
|
public List<(DiagnoseViewModel Diagnose, bool IsChecked)> Diagnoses { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using PolyclinicDataModels.Enums;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace PolyclinicWebAppImplementer.Models
|
||||||
|
{
|
||||||
|
public class UserPrivacyModel : RegisterModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
[DisplayName("Роль")]
|
||||||
|
public UserRole Role { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,56 +1,56 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Update="Views\Home\Course.cshtml">
|
<Content Update="log4net.config">
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
</Content>
|
||||||
</Content>
|
<Content Update="Views\Courses\CourseForm.cshtml">
|
||||||
<Content Update="Views\Home\Index.cshtml">
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
</Content>
|
||||||
</Content>
|
<Content Update="Views\Home\Index.cshtml">
|
||||||
<Content Update="Views\Home\Register.cshtml">
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
</Content>
|
||||||
</Content>
|
<Content Update="Views\User\Register.cshtml">
|
||||||
<Content Update="Views\Home\Symptomes.cshtml">
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
</Content>
|
||||||
</Content>
|
<Content Update="Views\Symptomes\SymptomesList.cshtml">
|
||||||
<Content Update="Views\Shared\_Layout.cshtml">
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
</Content>
|
||||||
</Content>
|
<Content Update="Views\Shared\_Layout.cshtml">
|
||||||
</ItemGroup>
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<UpToDateCheckInput Remove="Views\Home\Courses.cshtml" />
|
<UpToDateCheckInput Remove="Views\Home\Courses.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<_ContentIncludedByDefault Remove="Views\Home\Courses.cshtml" />
|
<_ContentIncludedByDefault Remove="Views\Home\Courses.cshtml" />
|
||||||
<_ContentIncludedByDefault Remove="Views\Home\Diagnoses.cshtml" />
|
</ItemGroup>
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<UpToDateCheckInput Remove="Views\Home\Diagnoses.cshtml" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.16">
|
||||||
</ItemGroup>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.16">
|
<ProjectReference Include="..\PolyclinicBusinessLogic\PolyclinicBusinessLogic.csproj" />
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<ProjectReference Include="..\PolyclinicDatabaseImplement\PolyclinicDatabaseImplement.csproj" />
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
</ItemGroup>
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\PolyclinicDatabaseImplement\PolyclinicDatabaseImplement.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,7 +1,32 @@
|
|||||||
|
using PolyclinicBusinessLogic.BusinessLogics;
|
||||||
|
using PolyclinicContracts.BusinessLogicsContracts;
|
||||||
|
using PolyclinicContracts.StoragesContracts;
|
||||||
|
using PolyclinicDatabaseImplement.Implements;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddControllersWithViews();
|
builder.Services.AddControllersWithViews();
|
||||||
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
||||||
|
builder.Logging.AddLog4Net("log4net.config");
|
||||||
|
builder.Services.AddTransient<IDiagnoseLogic, DiagnoseLogic>();
|
||||||
|
builder.Services.AddTransient<ICourseLogic, CourseLogic>();
|
||||||
|
builder.Services.AddTransient<ISymptomLogic, SymptomLogic>();
|
||||||
|
|
||||||
|
builder.Services.AddTransient<IDiagnoseStorage, DiagnoseStorage>();
|
||||||
|
builder.Services.AddTransient<ICourseStorage, CourseStorage>();
|
||||||
|
builder.Services.AddTransient<ISymptomStorage, SymptomStorage>();
|
||||||
|
|
||||||
|
builder.Services.AddTransient<IUserStorage, UserStorage>();
|
||||||
|
builder.Services.AddTransient<IUserLogic, UserLogic>();
|
||||||
|
|
||||||
|
builder.Services.AddTransient<IProcedureLogic, ProcedureLogic>();
|
||||||
|
builder.Services.AddTransient<IMedicamentLogic, MedicamentLogic>();
|
||||||
|
builder.Services.AddTransient<IRecipeLogic, RecipeLogic>();
|
||||||
|
|
||||||
|
builder.Services.AddTransient<IProcedureStorage, ProcedureStorage>();
|
||||||
|
builder.Services.AddTransient<IMedicamentStorage, MedicamentStorage>();
|
||||||
|
builder.Services.AddTransient<IRecipeStorage, RecipeStorage>();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace PolyclinicWebAppImplementer
|
||||||
|
{
|
||||||
|
public enum PageVisible
|
||||||
|
{
|
||||||
|
AllowAnyBody = 0,
|
||||||
|
AllowOnlyAuthorized = 1,
|
||||||
|
AllowOnlyNotAuthorized = 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,21 +2,18 @@
|
|||||||
{
|
{
|
||||||
public static class SiteMenuItems
|
public static class SiteMenuItems
|
||||||
{
|
{
|
||||||
public static (string Url, string Title) Index = ("", "Главная");
|
public static (string Controller, string Action, string Title, PageVisible Visible) Index = ("Home", "", "Главная", PageVisible.AllowAnyBody);
|
||||||
public static (string Url, string Title) Courses = ("Courses", "Курсы");
|
public static (string Controller, string Action, string Title, PageVisible Visible) Courses = ("Courses", "", "Курсы", PageVisible.AllowOnlyAuthorized);
|
||||||
public static (string Url, string Title) Diagnoses = ("Diagnoses", "Болезни");
|
public static (string Controller, string Action, string Title, PageVisible Visible) Diagnoses = ("Diagnoses", "", "Болезни", PageVisible.AllowOnlyAuthorized);
|
||||||
public static (string Url, string Title) Symptomes = ("Symptomes", "Симптомы");
|
public static (string Controller, string Action, string Title, PageVisible Visible) Symptomes = ("Symptomes", "", "Симптомы", PageVisible.AllowOnlyAuthorized);
|
||||||
public static (string Url, string Title) Symptom = ("Symptom", "Симптом");
|
public static (string Controller, string Action, string Title, PageVisible Visible) Login = ("User", "Login", "Вход", PageVisible.AllowOnlyNotAuthorized);
|
||||||
public static (string Url, string Title) Diagnose = ("Diagnose", "Болезнь");
|
public static (string Controller, string Action, string Title, PageVisible Visible) Register = ("User", "Register", "Регистрация", PageVisible.AllowOnlyNotAuthorized);
|
||||||
public static (string Url, string Title) Course = ("Course", "Курс");
|
public static (string Controller, string Action, string Title, PageVisible Visible) Privacy = ("User", "Privacy", "Личный кабинет", PageVisible.AllowOnlyAuthorized);
|
||||||
public static (string Url, string Title) Login = ("Login", "Вход");
|
public static (string Controller, string Action, string Title, PageVisible Visible) AddRecipeToCourse = ("Recipe", "LinkCourse", "Привязка рецептов", PageVisible.AllowOnlyAuthorized);
|
||||||
public static (string Url, string Title) Register = ("Register", "Регистрация");
|
public static (string Controller, string Action, string Title, PageVisible Visible) MedicamentsByDiagnoses = ("Home", "MedicamentsByDiagnoses", "Лекарства по болезням", PageVisible.AllowOnlyAuthorized);
|
||||||
public static (string Url, string Title) Privacy = ("Privacy", "Политика приватности");
|
public static (string Controller, string Action, string Title, PageVisible Visible) DiagnosesReport = ("Home", "DiagnosesReport", "Отчет по болезням", PageVisible.AllowOnlyAuthorized);
|
||||||
public static (string Url, string Title) AddRecipeToCourse = ("AddRecipeToCourse", "Привязка рецепта");
|
|
||||||
public static (string Url, string Title) MedicamentsByDiagnoses = ("MedicamentsByDiagnoses", "Лекарства по болезням");
|
|
||||||
public static (string Url, string Title) DiagnosesReport = ("DiagnosesReport", "Отчет по болезням");
|
|
||||||
|
|
||||||
public static List<(string Url, string Title)> MenuItemsOrder = new List<(string Url, string Title)>
|
public static List<(string Controller, string Action, string Title, PageVisible Visible)> MenuItemsOrder = new List<(string Controller, string Action, string Title, PageVisible Visible)>
|
||||||
{
|
{
|
||||||
Index, Courses, Diagnoses, Symptomes, Login, Register, AddRecipeToCourse, MedicamentsByDiagnoses, DiagnosesReport
|
Index, Courses, Diagnoses, Symptomes, Login, Register, AddRecipeToCourse, MedicamentsByDiagnoses, DiagnosesReport
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
@model CourseFormModel
|
||||||
|
<h4>@ViewData["Title"]</h4>
|
||||||
|
<form class="d-flex flex-column" method="post">
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-3">Количество дней:</div>
|
||||||
|
<div class="col-8"><input required asp-for="CourseViewModel.DaysCount" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-3">Количество препарата в день:</div>
|
||||||
|
<div class="col-8"><input required asp-for="CourseViewModel.PillsPerDay" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-3">Коментарий:</div>
|
||||||
|
<div class="col-8"><textarea asp-for="CourseViewModel.Comment"></textarea></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5 overflow-auto" style="max-height: 100px; max-width: 500px;">
|
||||||
|
<ol>
|
||||||
|
@foreach (var item in Model.Diagnoses)
|
||||||
|
{
|
||||||
|
@if (LoginManager.LogginedUser.Id != item.Diagnose.UserId)
|
||||||
|
{
|
||||||
|
@if (item.IsChecked)
|
||||||
|
{
|
||||||
|
<input type="checkbox" hidden id="diagnose-@item.Diagnose.Id" name="selectedDiagnoses" value="@item.Diagnose.Id" checked />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<input type="checkbox" hidden id="diagnose-@item.Diagnose.Id" name="selectedDiagnoses" value="@item.Diagnose.Id" />
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
<li class="mb-2 ps-1 ms-1">
|
||||||
|
@if (item.IsChecked)
|
||||||
|
{
|
||||||
|
<input type="checkbox" id="diagnose-@item.Diagnose.Id" name="selectedDiagnoses" value="@item.Diagnose.Id" checked />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<input type="checkbox" id="diagnose-@item.Diagnose.Id" name="selectedDiagnoses" value="@item.Diagnose.Id" />
|
||||||
|
}
|
||||||
|
<label for="diagnose-@item.Diagnose.Id">@item.Diagnose.Name</label>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">
|
||||||
|
<button class="btn btn-success" type="submit">
|
||||||
|
Сохранить
|
||||||
|
</button>
|
||||||
|
@Html.ActionLink("Отмена", "", "Courses", null, new { @class = "btn btn-danger" })
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
@using PolyclinicContracts.ViewModels
|
||||||
|
@model List<CourseViewModel>
|
||||||
|
@{
|
||||||
|
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Courses;
|
||||||
|
}
|
||||||
|
<div>
|
||||||
|
<div class="d-flex flex-row">
|
||||||
|
<a class="btn btn-primary" asp-action="Add" 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>
|
||||||
|
@foreach (var item in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<th scope="row">@item.Id</th>
|
||||||
|
<td>@item.DaysCount</td>
|
||||||
|
<td>@item.PillsPerDay</td>
|
||||||
|
<td>@item.Comment</td>
|
||||||
|
<td class="d-flex">
|
||||||
|
<form method="post" asp-action="Delete" asp-route-id="@item.Id">
|
||||||
|
<button class="btn btn-danger me-1" title="Удалить" type="submit">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill" viewBox="0 0 16 16">
|
||||||
|
<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<a class="btn btn-warning text-light" title="Редактировать" asp-action="Edit" asp-route-id="@item.Id">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-fill" viewBox="0 0 16 16">
|
||||||
|
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.5.5 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11z" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
@using PolyclinicContracts.ViewModels
|
||||||
|
@model DiagnoseViewModel
|
||||||
|
<h4>@ViewData["Title"]</h4>
|
||||||
|
<form class="d-flex flex-column" method="post">
|
||||||
|
<input type="hidden" readonly asp-for="Id" />
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col">Название:</div>
|
||||||
|
<div class="col"><input required asp-for="Name" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col">Коментарий:</div>
|
||||||
|
<div class="col"><textarea asp-for="Comment"></textarea></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col">Начало:</div>
|
||||||
|
<div class="col"><input required type="date" asp-for="DateStartDiagnose" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col">Конец:</div>
|
||||||
|
<div class="col"><input type="date" asp-for="DateStopDiagnose" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-4">
|
||||||
|
<button class="btn btn-success" type="submit">
|
||||||
|
Сохранить
|
||||||
|
</button>
|
||||||
|
@Html.ActionLink("Отмена", "", "Diagnoses", null, new { @class = "btn btn-danger" })
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace PolyclinicWebAppImplementer.Views.Diagnoses
|
||||||
|
{
|
||||||
|
public class DiagnoseFormModel : PageModel
|
||||||
|
{
|
||||||
|
public void OnGet()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
@using PolyclinicContracts.ViewModels
|
||||||
|
@model List<DiagnoseViewModel>
|
||||||
|
@{
|
||||||
|
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Diagnoses;
|
||||||
|
}
|
||||||
|
<div>
|
||||||
|
<div class="d-flex flex-row">
|
||||||
|
<a class="btn btn-primary" asp-action="Add" asp-controller="Diagnoses" 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>
|
||||||
|
@foreach (var item in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<th scope="row">@item.Id</th>
|
||||||
|
<td>@item.Name</td>
|
||||||
|
<td>@item.DateStartDiagnose.ToShortDateString()</td>
|
||||||
|
<td>@item.DateStopDiagnose?.ToShortDateString()</td>
|
||||||
|
<td>@item.Comment</td>
|
||||||
|
<td class="d-flex">
|
||||||
|
<form method="post" asp-action="Delete" asp-route-id="@item.Id">
|
||||||
|
<button class="btn btn-danger me-1" title="Удалить" type="submit">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill" viewBox="0 0 16 16">
|
||||||
|
<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<a class="btn btn-warning text-light" title="Редактировать" asp-action="Edit" asp-route-id="@item.Id">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-fill" viewBox="0 0 16 16">
|
||||||
|
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.5.5 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11z" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace PolyclinicWebAppImplementer.Views.Diagnoses
|
||||||
|
{
|
||||||
|
public class IndexModel : PageModel
|
||||||
|
{
|
||||||
|
public void OnGet()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.AddRecipeToCourse;
|
|
||||||
}
|
|
||||||
<h4>Привязка рецепта к курсу</h4>
|
|
||||||
<form id="addrecipetocourse" method="post">
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="col-3 d-flex align-content-center">
|
|
||||||
<h5 class="me-2">Рецепт</h5>
|
|
||||||
<select id="recipeId" name="recipeId" class="me-2">
|
|
||||||
<option value="">Выберите рецепт</option>
|
|
||||||
@{
|
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
{
|
|
||||||
<option value="@i">Рецепт оууеее @i</option>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="col-3 d-flex align-content-center">
|
|
||||||
<h5 class="me-2">Курс</h5>
|
|
||||||
<select id="courseId" name="courseId" class="me-2">
|
|
||||||
<option value="">Выберите курс</option>
|
|
||||||
@{
|
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
{
|
|
||||||
<option value="@i">Какой то курс @i</option>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="col-3">
|
|
||||||
<button class="btn btn-primary" type="submit">
|
|
||||||
Привязать
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Course;
|
|
||||||
}
|
|
||||||
<h4>Новый курс лечения</h4>
|
|
||||||
<form class="d-flex flex-column" method="post">
|
|
||||||
<div class="row mb-5">
|
|
||||||
<div class="col-3">Количество дней:</div>
|
|
||||||
<div class="col-8"><input type="number" id="daysCount" name="daysCount" /></div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-5">
|
|
||||||
<div class="col-3">Количество препарата в день:</div>
|
|
||||||
<div class="col-8"><input type="number" id="pillsPerDay" name="pillsPerDay" /></div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-5">
|
|
||||||
<div class="col-3">Коментарий:</div>
|
|
||||||
<div class="col-8"><textarea id="comment" name="comment"></textarea></div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-5">
|
|
||||||
<div class="col-3 d-flex align-content-center">
|
|
||||||
<h5 class="me-2">Болезни</h5>
|
|
||||||
<select id="diagnoseId" name="diagnoseId" class="me-2">
|
|
||||||
<option value="">Выберите болезнь</option>
|
|
||||||
@{
|
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
{
|
|
||||||
<option value="@i">Какая-то противная болезнь @i</option>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
<button class="btn btn-success" type="button">
|
|
||||||
Добавить
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-5 overflow-auto" style="max-height: 100px; max-width: 500px;">
|
|
||||||
<ol>
|
|
||||||
@{
|
|
||||||
for (int i = 0; i < 7; i++)
|
|
||||||
{
|
|
||||||
<li class="mb-2 ps-1 ms-1">
|
|
||||||
<a asp-action="Course" class="text-decoration-none">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill text-danger " viewBox="0 0 16 16">
|
|
||||||
<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0" />
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
<span>Выбранная болезнь</span>
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-5">
|
|
||||||
<div class="col-4">
|
|
||||||
<button class="btn btn-success" type="submit">
|
|
||||||
Сохранить
|
|
||||||
</button>
|
|
||||||
@Html.ActionLink("Отмена", "Courses", "Home", null, new { @class = "btn btn-danger" })
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Courses;
|
|
||||||
}
|
|
||||||
<div>
|
|
||||||
<div class="d-flex flex-row">
|
|
||||||
<a class="btn btn-primary" asp-action="Course" asp-controller="Home" title="Добавить">
|
|
||||||
Добавить курс
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th scope="col">Номер</th>
|
|
||||||
<th scope="col">Количество дней</th>
|
|
||||||
<th scope="col">Количество препаратов в день</th>
|
|
||||||
<th scope="col">Комментарий</th>
|
|
||||||
<th scope="col"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@{
|
|
||||||
int count = 20;
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<th scope="row">@i</th>
|
|
||||||
<td>12</td>
|
|
||||||
<td>3</td>
|
|
||||||
<td>Очень хороший курс приема</td>
|
|
||||||
<td class="d-flex">
|
|
||||||
<a class="btn btn-danger me-1" title="Удалить">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill" viewBox="0 0 16 16">
|
|
||||||
<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0" />
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
<a class="btn btn-warning text-light" title="Редактировать" asp-action="Course" asp-controller="Home">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-fill" viewBox="0 0 16 16">
|
|
||||||
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.5.5 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11z" />
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Diagnose;
|
|
||||||
}
|
|
||||||
<h4>Новая болезнь</h4>
|
|
||||||
<form class="d-flex flex-column" method="post">
|
|
||||||
<div class="row mb-5">
|
|
||||||
<div class="col-3">Название:</div>
|
|
||||||
<div class="col-8"><input type="text" id="name" name="name" /></div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-5">
|
|
||||||
<div class="col-3">Коментарий:</div>
|
|
||||||
<div class="col-8"><textarea id="comment" name="comment"></textarea></div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-5">
|
|
||||||
<div class="col-3">Начало:</div>
|
|
||||||
<div class="col-8"><input type="date" id="dateStartInput" name="dateStart" /></div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-5">
|
|
||||||
<div class="col-3">Конец:</div>
|
|
||||||
<div class="col-8"><input type="date" id="dateStopInput" name="dateStop" /></div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-5">
|
|
||||||
<div class="col-4">
|
|
||||||
<button class="btn btn-success" type="submit">
|
|
||||||
Сохранить
|
|
||||||
</button>
|
|
||||||
@Html.ActionLink("Отмена", "Diagnoses", "Home", null, new { @class = "btn btn-danger" })
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user