38 Commits

Author SHA1 Message Date
549379a588 что-то подредактировала в процедурах и рецептах 2024-05-28 15:03:28 +04:00
f6c52a08ad Merge branch 'stage9_10' of https://git.is.ulstu.ru/ns.potapov/PIbd-21_CourseWork_Polyclinic_BeSick into stage9_10 2024-05-28 11:23:35 +04:00
e8a9d126e4 абстрактный класс для сохранения курсов приема в ворд сделала 2024-05-28 11:23:31 +04:00
bf0bf081c7 Merge branch 'stage9_10' of https://git.is.ulstu.ru/ns.potapov/PIbd-21_CourseWork_Polyclinic_BeSick into stage9_10 2024-05-28 01:07:44 +04:00
b8e5d33365 Начало реалиации контроллера симптомов 2024-05-28 01:07:41 +04:00
1ab91e7b63 добавила пока просто класс абстрактный для сохранения в ворд курсов по рецепту 2024-05-28 00:45:32 +04:00
be8a36c9eb Merge branch 'stage9_10' of https://git.is.ulstu.ru/ns.potapov/PIbd-21_CourseWork_Polyclinic_BeSick into stage9_10 2024-05-28 00:28:55 +04:00
320e2a4ace начала делать отчеты для ворда 2024-05-28 00:28:53 +04:00
34cae3a0ed Merge branch 'stage9_10' of https://git.is.ulstu.ru/ns.potapov/PIbd-21_CourseWork_Polyclinic_BeSick into stage9_10 2024-05-28 00:27:22 +04:00
d747d42272 Добавил контроллер для симптомов 2024-05-28 00:27:17 +04:00
48dd095182 сделала создание медикаментов (без симптомов), мучаюсь с созданием рецептов... многие ко многим 2024-05-28 00:17:46 +04:00
19f7fbb7f4 Добавил коммент 2024-05-27 22:30:16 +04:00
1e02a06b49 Добавил коммент 2024-05-27 22:23:44 +04:00
171ca6d819 исправила и добавила вывод названия симптома и процедуры во вью модель 2024-05-27 21:53:53 +04:00
fa8d5d9d8e Merge branch 'stage9_10' of https://git.is.ulstu.ru/ns.potapov/PIbd-21_CourseWork_Polyclinic_BeSick into stage9_10 2024-05-27 21:27:53 +04:00
4f6a0ba0be доделала круды для процедур 2024-05-27 21:27:51 +04:00
4b5cf5582e Поменял сигнатцрц функций в контроллере диагнозов 2024-05-27 19:21:15 +04:00
c5b0f0fe6c Merge branch 'stage9_10' of https://git.is.ulstu.ru/ns.potapov/PIbd-21_CourseWork_Polyclinic_BeSick into stage9_10 2024-05-27 19:09:17 +04:00
bd594232f9 поправила даты и редактирование процедур 2024-05-27 19:09:14 +04:00
d61c3124bc Удалил лишние шаблоны для диагнозов 2024-05-27 18:57:16 +04:00
25c1152969 Merge branch 'stage9_10' of https://git.is.ulstu.ru/ns.potapov/PIbd-21_CourseWork_Polyclinic_BeSick into stage9_10 2024-05-27 12:37:21 +04:00
9f82321bc8 Убрал лишние роли 2024-05-27 12:37:05 +04:00
13ecdcaecc да я не знаю уже блин 2024-05-27 00:22:48 +04:00
21b9bed09b ну... процедура создается, но пока не меняется (не апдейтится) 2024-05-26 18:16:46 +04:00
c26bbd5d6a Merge branch 'stage9_10' of https://git.is.ulstu.ru/ns.potapov/PIbd-21_CourseWork_Polyclinic_BeSick into stage9_10 2024-05-26 14:49:10 +04:00
bdd5a9649a Работает добавление, редактирование и удаление диагнозов 2024-05-26 14:49:08 +04:00
a24099df3c исправлен котроллер, сделала вывод списка процедур
добавила файл логов, класс апиклиент, прописала зависимости
2024-05-26 13:45:07 +04:00
9f44ad75be Обновил схему БД, разрешил null на комментариях 2024-05-26 13:03:03 +04:00
5546ab58e7 Поменял области видимости у классов OfficePackage 2024-05-26 11:48:19 +04:00
9210c87079 Реструктурировал проект с бизнеслогикой 2024-05-26 11:43:01 +04:00
2047774700 Измененена сигнатура функции получения списка для логики курсов и симптомов 2024-05-26 11:33:55 +04:00
05109f7b3f Поменял сигнатуру функции получения списка элементов для диагнозов 2024-05-26 11:27:12 +04:00
b13b15c597 добавила общие классы для работы с вордом, экселем и пдф 2024-05-23 20:10:20 +04:00
5a05bebae3 добавила перечисления для ворда и пдф 2024-05-23 18:38:14 +04:00
a02725ff2b добавлено перечисление для экселя 2024-05-23 18:36:23 +04:00
ae8143bbee Merge branch 'stage9_10' of https://git.is.ulstu.ru/ns.potapov/PIbd-21_CourseWork_Polyclinic_BeSick into stage9_10 2024-05-23 15:02:25 +04:00
4624023c86 добавила папки для работы с файлами (офис пакеты) 2024-05-23 15:02:22 +04:00
138d0b9c76 Создал контроллер для диагнозов 2024-05-23 14:58:59 +04:00
61 changed files with 1096 additions and 441 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -0,0 +1,64 @@
using PolyclinicBusinessLogic.OfficePackage.HelperEnums;
using PolyclinicBusinessLogic.OfficePackage.HelperModels.Word;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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 = "24", })
},
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
foreach (var course in info.Courses)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{
("Количество пилюль в день: " + course.PillsPerDay.ToString() + " единиц", new WordTextProperties{ Size = "16"}),
("Количество дней приёма: " + course.DaysCount.ToString() + " дней", new WordTextProperties{ Size = "16"}),
},
TextProperties = new WordTextProperties
{
Size = "16",
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);
}
}

View File

@@ -0,0 +1,9 @@
namespace PolyclinicBusinessLogic.OfficePackage.HelperEnums
{
public enum ExcelStyleInfoType
{
Title,
Text,
TextWithBorder
}
}

View File

@@ -0,0 +1,9 @@
namespace PolyclinicBusinessLogic.OfficePackage.HelperEnums
{
public enum PdfParagraphAlignmentType
{
Center,
Left,
Rigth
}
}

View File

@@ -0,0 +1,8 @@
namespace PolyclinicBusinessLogic.OfficePackage.HelperEnums
{
public enum WordJustificationType
{
Center,
Both
}
}

View File

@@ -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; }
}
}

View File

@@ -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}";
}
}

View File

@@ -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; }
}
}

View File

@@ -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; }
}
}

View File

@@ -0,0 +1,11 @@
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 List<CourseViewModel> Courses { get; set; } = new();
}
}

View File

@@ -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; }
}
}

View File

@@ -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; }
}
}

View File

@@ -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; }
} }
} }

View File

@@ -8,6 +8,6 @@ namespace PolyclinicContracts.BindingModels
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();
} }
} }

View File

@@ -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
{ {

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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; }

View File

@@ -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;
} }
} }

View File

@@ -12,6 +12,8 @@ namespace PolyclinicContracts.ViewModels
[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();
} }

View File

@@ -1,11 +1,4 @@
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
{ {

View File

@@ -2,10 +2,8 @@
{ {
public enum UserRole public enum UserRole
{ {
Неизвестный = -1, Неизвестный = 0,
Администратор = 0,
Исполнитель = 1, Исполнитель = 1,
Поручитель = 2, Поручитель = 2,
Клиент = 3
} }
} }

View File

@@ -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; }

View File

@@ -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)
}, },

View File

@@ -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; }
@@ -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()

View File

@@ -13,7 +13,6 @@ 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]
@@ -49,7 +48,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,
}; };
} }
} }

View File

@@ -21,7 +21,6 @@ namespace PolyclinicDatabaseImplement.Models
public DateTime? DateStopProcedure { get; set; } public DateTime? DateStopProcedure { get; set; }
public virtual User User { get; set; } = new(); public virtual User User { get; set; } = new();
[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)
@@ -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()

View File

@@ -14,7 +14,6 @@ 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; } = new();
@@ -85,6 +84,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;
} }

View File

@@ -11,7 +11,6 @@ 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();

View File

@@ -0,0 +1,92 @@
using Microsoft.AspNetCore.Mvc;
using PolyclinicContracts.BindingModels;
using PolyclinicContracts.BusinessLogicsContracts;
using PolyclinicContracts.SearchModels;
using PolyclinicContracts.ViewModels;
using PolyclinicWebAppImplementer.Models;
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()
{
// TODO выводить только пользовательские диагнозы
List<DiagnoseViewModel> diagnoses = _diagnoseLogic.ReadList();
ViewData["Title"] = "Список диагнозов";
return View("DiagnosesList", diagnoses);
}
[HttpGet]
[HttpPost]
public IActionResult Add(DiagnoseViewModel model)
{
if (HttpContext.Request.Method == "GET")
{
ViewData["Title"] = "Новый диагноз";
return View("DiagnoseForm");
}
else
{
// TODO прописать UserId
DiagnoseBindingModel diagnose = new DiagnoseBindingModel
{
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)
{
// TODO проверить, что пользователь хочет редактировать свой диагноз (UserId)
if (HttpContext.Request.Method == "GET")
{
var obj = _diagnoseLogic.ReadElement(new DiagnoseSearchModel { Id = id });
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)
{
// TODO проверить, что пользователь хочет удалить свой диагноз (UserId)
var obj = _diagnoseLogic.ReadElement(new DiagnoseSearchModel { Id = id });
if (obj != null)
{
_diagnoseLogic.Delete(new DiagnoseBindingModel { Id = obj.Id });
}
return RedirectToAction("Index");
}
}
}

View File

@@ -34,22 +34,6 @@ namespace PolyclinicWebAppImplementer.Controllers
{ {
return View(); 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() public IActionResult Symptom()
{ {
if (HttpContext.Request.Method == "POST") if (HttpContext.Request.Method == "POST")

View File

@@ -0,0 +1,81 @@
using Microsoft.AspNetCore.Mvc;
using PolyclinicContracts.BindingModels;
using PolyclinicContracts.BusinessLogicsContracts;
using PolyclinicContracts.SearchModels;
using PolyclinicContracts.ViewModels;
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()
{
List<SymptomViewModel> symptomes = _symptomLogic.ReadList();
ViewData["Title"] = "Список симптомов";
return View("SymptomesList", symptomes);
}
[HttpGet]
[HttpPost]
public IActionResult Add(SymptomFormModel model)
{
if (HttpContext.Request.Method == "GET")
{
ViewData["Title"] = "Новый симптом";
model = new();
model.AvailableDiagnoses = _diagnoseLogic.ReadList();
return View("SymptomForm", model);
}
else
{
SymptomBindingModel symptom = new SymptomBindingModel
{
Name = model.SymptomViewModel.Name,
Comment = model.SymptomViewModel.Comment,
};
_symptomLogic.Create(symptom);
return RedirectToAction("Index");
}
}
[HttpGet]
[HttpPost]
public IActionResult Edit(int id, SymptomViewModel model)
{
if (HttpContext.Request.Method == "GET")
{
var obj = _symptomLogic.ReadElement(new SymptomSearchModel { Id = id });
ViewData["Title"] = "Редактировать симптом";
return View("SymptomForm", obj);
}
else
{
SymptomBindingModel symptom = new SymptomBindingModel
{
Id = model.Id,
Name = model.Name,
Comment = model.Comment,
};
_symptomLogic.Update(symptom);
return RedirectToAction("Index");
}
}
[HttpPost]
public IActionResult Delete(int id)
{
var obj = _symptomLogic.ReadElement(new SymptomSearchModel { Id = id });
if (obj != null)
{
_symptomLogic.Delete(new SymptomBindingModel { Id = obj.Id });
}
return RedirectToAction("Index");
}
}
}

View File

@@ -0,0 +1,11 @@
using PolyclinicContracts.ViewModels;
namespace PolyclinicWebAppImplementer.Models
{
public class SymptomFormModel
{
public SymptomViewModel? SymptomViewModel { get; set; }
public List<DiagnoseViewModel> SelectecDiagnoses { get; set; } = new();
public List<DiagnoseViewModel> AvailableDiagnoses { get; set; } = new();
}
}

View File

@@ -7,6 +7,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Content Update="log4net.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Views\Home\Course.cshtml"> <Content Update="Views\Home\Course.cshtml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile> <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
@@ -19,7 +22,7 @@
<ExcludeFromSingleFile>true</ExcludeFromSingleFile> <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content> </Content>
<Content Update="Views\Home\Symptomes.cshtml"> <Content Update="Views\Symptomes\SymptomesList.cshtml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile> <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content> </Content>
@@ -35,11 +38,6 @@
<ItemGroup> <ItemGroup>
<_ContentIncludedByDefault Remove="Views\Home\Courses.cshtml" /> <_ContentIncludedByDefault Remove="Views\Home\Courses.cshtml" />
<_ContentIncludedByDefault Remove="Views\Home\Diagnoses.cshtml" />
</ItemGroup>
<ItemGroup>
<UpToDateCheckInput Remove="Views\Home\Diagnoses.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -47,9 +45,11 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\PolyclinicBusinessLogic\PolyclinicBusinessLogic.csproj" />
<ProjectReference Include="..\PolyclinicDatabaseImplement\PolyclinicDatabaseImplement.csproj" /> <ProjectReference Include="..\PolyclinicDatabaseImplement\PolyclinicDatabaseImplement.csproj" />
</ItemGroup> </ItemGroup>

View File

@@ -1,7 +1,21 @@
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>();
var app = builder.Build(); var app = builder.Build();

View File

@@ -2,21 +2,21 @@
{ {
public static class SiteMenuItems public static class SiteMenuItems
{ {
public static (string Url, string Title) Index = ("", "Главная"); public static (string Controller, string Action, string Title) Index = ("Home", "", "Главная");
public static (string Url, string Title) Courses = ("Courses", "Курсы"); public static (string Controller, string Action, string Title) Courses = ("Home", "Courses", "Курсы");
public static (string Url, string Title) Diagnoses = ("Diagnoses", "Болезни"); public static (string Controller, string Action, string Title) Diagnoses = ("Diagnoses", "", "Болезни");
public static (string Url, string Title) Symptomes = ("Symptomes", "Симптомы"); public static (string Controller, string Action, string Title) Symptomes = ("Symptomes", "", "Симптомы");
public static (string Url, string Title) Symptom = ("Symptom", "Симптом"); public static (string Controller, string Action, string Title) Symptom = ("Home", "Symptom", "Симптом");
public static (string Url, string Title) Diagnose = ("Diagnose", "Болезнь"); public static (string Controller, string Action, string Title) Diagnose = ("Home", "Diagnose", "Болезнь");
public static (string Url, string Title) Course = ("Course", "Курс"); public static (string Controller, string Action, string Title) Course = ("Home", "Course", "Курс");
public static (string Url, string Title) Login = ("Login", "Вход"); public static (string Controller, string Action, string Title) Login = ("Home", "Login", "Вход");
public static (string Url, string Title) Register = ("Register", "Регистрация"); public static (string Controller, string Action, string Title) Register = ("Home", "Register", "Регистрация");
public static (string Url, string Title) Privacy = ("Privacy", "Политика приватности"); public static (string Controller, string Action, string Title) Privacy = ("Home", "Privacy", "Политика приватности");
public static (string Url, string Title) AddRecipeToCourse = ("AddRecipeToCourse", "Привязка рецепта"); public static (string Controller, string Action, string Title) AddRecipeToCourse = ("Home", "AddRecipeToCourse", "Привязка рецепта");
public static (string Url, string Title) MedicamentsByDiagnoses = ("MedicamentsByDiagnoses", "Лекарства по болезням"); public static (string Controller, string Action, string Title) MedicamentsByDiagnoses = ("Home", "MedicamentsByDiagnoses", "Лекарства по болезням");
public static (string Url, string Title) DiagnosesReport = ("DiagnosesReport", "Отчет по болезням"); public static (string Controller, string Action, string Title) DiagnosesReport = ("Home", "DiagnosesReport", "Отчет по болезням");
public static List<(string Url, string Title)> MenuItemsOrder = new List<(string Url, string Title)> public static List<(string Controller, string Action, string Title)> MenuItemsOrder = new List<(string Controller, string Action, string Title)>
{ {
Index, Courses, Diagnoses, Symptomes, Login, Register, AddRecipeToCourse, MedicamentsByDiagnoses, DiagnosesReport Index, Courses, Diagnoses, Symptomes, Login, Register, AddRecipeToCourse, MedicamentsByDiagnoses, DiagnosesReport
}; };

View File

@@ -1,30 +1,30 @@
@{ @using PolyclinicContracts.ViewModels
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Diagnose; @model DiagnoseViewModel
} <h4>@ViewData["Title"]</h4>
<h4>Новая болезнь</h4>
<form class="d-flex flex-column" method="post"> <form class="d-flex flex-column" method="post">
<input type="hidden" readonly asp-for="Id" />
<div class="row mb-5"> <div class="row mb-5">
<div class="col-3">Название:</div> <div class="col-3">Название:</div>
<div class="col-8"><input type="text" id="name" name="name" /></div> <div class="col-8"><input required asp-for="Name" /></div>
</div> </div>
<div class="row mb-5"> <div class="row mb-5">
<div class="col-3">Коментарий:</div> <div class="col-3">Коментарий:</div>
<div class="col-8"><textarea id="comment" name="comment"></textarea></div> <div class="col-8"><textarea asp-for="Comment"></textarea></div>
</div> </div>
<div class="row mb-5"> <div class="row mb-5">
<div class="col-3">Начало:</div> <div class="col-3">Начало:</div>
<div class="col-8"><input type="date" id="dateStartInput" name="dateStart" /></div> <div class="col-8"><input required type="date" asp-for="DateStartDiagnose" /></div>
</div> </div>
<div class="row mb-5"> <div class="row mb-5">
<div class="col-3">Конец:</div> <div class="col-3">Конец:</div>
<div class="col-8"><input type="date" id="dateStopInput" name="dateStop" /></div> <div class="col-8"><input type="date" asp-for="DateStopDiagnose" /></div>
</div> </div>
<div class="row mb-5"> <div class="row mb-5">
<div class="col-4"> <div class="col-4">
<button class="btn btn-success" type="submit"> <button class="btn btn-success" type="submit">
Сохранить Сохранить
</button> </button>
@Html.ActionLink("Отмена", "Diagnoses", "Home", null, new { @class = "btn btn-danger" }) @Html.ActionLink("Отмена", "", "Diagnoses", null, new { @class = "btn btn-danger" })
</div> </div>
</div> </div>
</form> </form>

View File

@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace PolyclinicWebAppImplementer.Views.Diagnoses
{
public class DiagnoseFormModel : PageModel
{
public void OnGet()
{
}
}
}

View File

@@ -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>

View File

@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace PolyclinicWebAppImplementer.Views.Diagnoses
{
public class IndexModel : PageModel
{
public void OnGet()
{
}
}
}

View File

@@ -1,49 +0,0 @@
@{
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Diagnoses;
}
<div>
<div class="d-flex flex-row">
<a class="btn btn-primary" asp-action="Diagnose" asp-controller="Home" title="Добавить">
Добавить болезнь
</a>
</div>
<table class="table">
<thead>
<tr>
<th scope="col">Номер</th>
<th scope="col">Название</th>
<th scope="col">Начало</th>
<th scope="col">Конец</th>
<th scope="col">Комментарий</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@{
int count = 10;
for (int i = 0; i < count; i++)
{
<tr>
<th scope="row">@i</th>
<td>синдром Мюнхгаузена</td>
<td>12.04.2024</td>
<td>17.05.2024</td>
<td>заболевание, при котором человек постоянно симулирует или преувеличивает симптомы болезней, чтобы привлечь внимание окружающих.</td>
<td class="d-flex">
<a class="btn btn-danger me-1" title="Удалить">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill" viewBox="0 0 16 16">
<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0" />
</svg>
</a>
<a class="btn btn-warning text-light" title="Редактировать" asp-action="Diagnose" asp-controller="Home">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-fill" viewBox="0 0 16 16">
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.5.5 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11z" />
</svg>
</a>
</td>
</tr>
}
}
</tbody>
</table>
</div>

View File

@@ -1,45 +0,0 @@
@{
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Symptomes;
}
<div>
<div class="d-flex flex-row">
<a class="btn btn-primary" asp-action="Symptom" asp-controller="Home" title="Добавить">
Добавить симптом
</a>
</div>
<table class="table">
<thead>
<tr>
<th scope="col">Номер</th>
<th scope="col">Название</th>
<th scope="col">Комментарий</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@{
int count = 10;
for (int i = 0; i < count; i++)
{
<tr>
<th scope="row">@i</th>
<td>вранье</td>
<td>пациент постоянно врёт о своих приключениях</td>
<td class="d-flex">
<a class="btn btn-danger me-1" title="Удалить">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill" viewBox="0 0 16 16">
<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0" />
</svg>
</a>
<a class="btn btn-warning text-light" title="Редактировать" asp-action="Symptom" asp-controller="Home">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-fill" viewBox="0 0 16 16">
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.5.5 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11z" />
</svg>
</a>
</td>
</tr>
}
}
</tbody>
</table>
</div>

View File

@@ -35,8 +35,8 @@
<li class="menu-item"> <li class="menu-item">
@Html.RouteLink(menuItem.Title, new @Html.RouteLink(menuItem.Title, new
{ {
controller = "Home", controller = menuItem.Controller,
action = menuItem.Url action = menuItem.Action
}, new }, new
{ {
@class = "nav-link text-dark" + (menuItem.Equals(ViewBag.SelectedSiteMenuItem) ? " fw-bold" : "") @class = "nav-link text-dark" + (menuItem.Equals(ViewBag.SelectedSiteMenuItem) ? " fw-bold" : "")

View File

@@ -1,27 +1,23 @@
@{ @model SymptomFormModel
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Symptom;
} <h4>@ViewData["Title"]</h4>
<h4>Новый симптом</h4>
<form class="d-flex flex-column" method="post"> <form class="d-flex flex-column" method="post">
<div class="row mb-5"> <div class="row mb-5">
<div class="col-3">Название:</div> <div class="col-3">Название:</div>
<div class="col-8"><input type="text" id="name" name="name" /></div> <div class="col-8"><input type="text" asp-for="SymptomViewModel.Name" /></div>
</div> </div>
<div class="row mb-5"> <div class="row mb-5">
<div class="col-3">Коментарий:</div> <div class="col-3">Коментарий:</div>
<div class="col-8"><textarea id="comment" name="comment"></textarea></div> <div class="col-8"><textarea asp-for="SymptomViewModel.Comment"></textarea></div>
</div> </div>
<div class="row mb-5"> <div class="row mb-5">
<div class="col-3 d-flex align-content-center"> <div class="col-3 d-flex align-content-center">
<h5 class="me-2">Болезни</h5> <h5 class="me-2">Болезни</h5>
<select id="diagnoseId" name="diagnoseId" class="me-2"> <select id="diagnoseId" name="diagnoseId" class="me-2">
<option value="">Выберите болезнь</option> <option value="">Выберите болезнь</option>
@{ @foreach (var availableDiagnose in Model.AvailableDiagnoses)
int count = 10;
for (int i = 0; i < count; i++)
{ {
<option value="@i">Какая-то противная болезнь @i</option> <option value="@availableDiagnose.Id">@availableDiagnose.Name</option>
}
} }
</select> </select>
<button class="btn btn-success" type="button"> <button class="btn btn-success" type="button">
@@ -32,7 +28,7 @@
<div class="row mb-5 overflow-auto" style="max-height: 100px; max-width: 500px;"> <div class="row mb-5 overflow-auto" style="max-height: 100px; max-width: 500px;">
<ol> <ol>
@{ @{
count = 7; int count = 7;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
<li class="mb-2 ps-1 ms-1"> <li class="mb-2 ps-1 ms-1">
@@ -52,7 +48,7 @@
<button class="btn btn-success" type="submit"> <button class="btn btn-success" type="submit">
Сохранить Сохранить
</button> </button>
@Html.ActionLink("Отмена", "Courses", "Home", null, new { @class = "btn btn-danger" }) @Html.ActionLink("Отмена", "", "Symptomes", null, new { @class = "btn btn-danger" })
</div> </div>
</div> </div>
</form> </form>

View File

@@ -0,0 +1,46 @@
@using PolyclinicContracts.ViewModels
@model List<SymptomViewModel>
@{
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Symptomes;
}
<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>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<th scope="row">@item.Id</th>
<td>@item.Name</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>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="logs/polyclinicimplementerclient.log" />
<appendToFile value="true" />
<maximumFileSize value="100KB" />
<maxSizeRollBackups value="2" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %5level %logger.%method [%line] - MESSAGE: %message%newline %exception" />
</layout>
</appender>
<root>
<level value="TRACE" />
<appender-ref ref="RollingFile" />
</root>
</log4net>

View File

@@ -0,0 +1,44 @@
using Newtonsoft.Json;
using PolyclinicContracts.ViewModels;
using System.Net.Http.Headers;
using System.Text;
namespace PolyclinicWebAppSuretor
{
public class APIClient
{
private static readonly HttpClient _client = new();
public static UserViewModel? User { get; set; } = null;
public static void Connect(IConfiguration configuration)
{
_client.BaseAddress = new Uri(configuration["IPAddress"]);
_client.DefaultRequestHeaders.Accept.Clear();
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
}
public static T? GetRequest<T>(string requestUrl)
{
var response = _client.GetAsync(requestUrl);
var result = response.Result.Content.ReadAsStringAsync().Result;
if (response.Result.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<T>(result);
}
else
{
throw new Exception(result);
}
}
public static void PostRequest<T>(string requestUrl, T model)
{
var json = JsonConvert.SerializeObject(model);
var data = new StringContent(json, Encoding.UTF8, "application/json");
var response = _client.PostAsync(requestUrl, data);
var result = response.Result.Content.ReadAsStringAsync().Result;
if (!response.Result.IsSuccessStatusCode)
{
throw new Exception(result);
}
}
}
}

View File

@@ -1,4 +1,9 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using PolyclinicBusinessLogic.BusinessLogics;
using PolyclinicContracts.BindingModels;
using PolyclinicContracts.BusinessLogicsContracts;
using PolyclinicContracts.SearchModels;
using PolyclinicContracts.ViewModels;
using PolyclinicWebAppSuretor.Models; using PolyclinicWebAppSuretor.Models;
using System.Diagnostics; using System.Diagnostics;
@@ -7,10 +12,22 @@ namespace PolyclinicWebAppSuretor.Controllers
public class HomeController : Controller public class HomeController : Controller
{ {
private readonly ILogger<HomeController> _logger; private readonly ILogger<HomeController> _logger;
private readonly IProcedureLogic _procedureLogic;
private readonly IMedicamentLogic _medicamentLogic;
private readonly IRecipeLogic _recipeLogic;
private readonly ISymptomLogic _symptomLogic;
public HomeController(ILogger<HomeController> logger) public HomeController(ILogger<HomeController> logger,
IProcedureLogic procedureLogic,
IMedicamentLogic medicamentLogic,
IRecipeLogic recipeLogic,
ISymptomLogic symptomLogic)
{ {
_logger = logger; _logger = logger;
_procedureLogic = procedureLogic;
_medicamentLogic = medicamentLogic;
_recipeLogic = recipeLogic;
_symptomLogic = symptomLogic;
} }
public IActionResult Index() public IActionResult Index()
@@ -23,34 +40,219 @@ namespace PolyclinicWebAppSuretor.Controllers
return View(); return View();
} }
public IActionResult Medicaments() public IActionResult Recipes()
{ {
List<RecipeViewModel> recipes = _recipeLogic.ReadList(null);
if (recipes == null)
{
recipes = new();
}
return View(recipes);
}
[HttpGet]
[HttpPost]
public IActionResult CreateRecipe(RecipeViewModel model)
{
ViewBag.Procedures = _procedureLogic.ReadList(null);
//ViewBag.RecipeProcedures = _recipeLogic.
if (HttpContext.Request.Method == "GET")
{
ViewData["Title"] = "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
return View(); return View();
} }
else
{
// TODO <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> UserId
RecipeBindingModel recipe = new RecipeBindingModel
{
Comment = model.Comment,
CourseId = model.CourseId,
ProceduresCount = model.ProceduresCount,
RecipeProcedures = model.RecipeProcedures
};
_recipeLogic.Create(recipe);
return RedirectToAction("Medicaments");
}
}
[HttpGet]
[HttpPost]
public IActionResult EditRecipe(MedicamentViewModel model)
{
if (HttpContext.Request.Method == "GET")
{
var obj = _medicamentLogic.ReadElement(new MedicamentSearchModel { Id = model.Id });
ViewData["Title"] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
return View("CreateMedicament", obj);
}
else
{
MedicamentBindingModel medicament = new MedicamentBindingModel
{
Id = model.Id,
Name = model.Name,
Comment = model.Comment ?? string.Empty,
SymptomId = model.SymptomId,
ProcedureId = model.ProcedureId,
};
_medicamentLogic.Update(medicament);
return RedirectToAction("Medicaments");
}
}
[HttpPost]
public IActionResult DeleteRecipe(int id)
{
var obj = _medicamentLogic.ReadElement(new MedicamentSearchModel { Id = id });
if (obj != null)
{
_medicamentLogic.Delete(new MedicamentBindingModel { Id = obj.Id });
}
return RedirectToAction("Medicaments");
}
public IActionResult Medicaments()
{
List<MedicamentViewModel> medicaments = _medicamentLogic.ReadList(null);
if (medicaments == null)
{
medicaments = new();
}
return View(medicaments);
}
[HttpGet]
[HttpPost]
public IActionResult CreateMedicament(MedicamentViewModel model)
{
ViewBag.Procedures = _procedureLogic.ReadList(null);
ViewBag.Symptomes = _symptomLogic.ReadList(null);
if (HttpContext.Request.Method == "GET")
{
ViewData["Title"] = "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
return View();
}
else
{
// TODO <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> UserId
MedicamentBindingModel medicament = new MedicamentBindingModel
{
Name = model.Name,
Comment = model.Comment ?? string.Empty,
SymptomId = model.SymptomId,
ProcedureId = model.ProcedureId,
};
_medicamentLogic.Create(medicament);
return RedirectToAction("Medicaments");
}
}
[HttpGet]
[HttpPost]
public IActionResult EditMedicament(MedicamentViewModel model)
{
if (HttpContext.Request.Method == "GET")
{
var obj = _medicamentLogic.ReadElement(new MedicamentSearchModel { Id = model.Id });
ViewData["Title"] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
return View("CreateMedicament", obj);
}
else
{
MedicamentBindingModel medicament = new MedicamentBindingModel
{
Id = model.Id,
Name = model.Name,
Comment = model.Comment ?? string.Empty,
SymptomId = model.SymptomId,
ProcedureId = model.ProcedureId,
};
_medicamentLogic.Update(medicament);
return RedirectToAction("Medicaments");
}
}
[HttpPost]
public IActionResult DeleteMedicament(int id)
{
var obj = _medicamentLogic.ReadElement(new MedicamentSearchModel { Id = id });
if (obj != null)
{
_medicamentLogic.Delete(new MedicamentBindingModel { Id = obj.Id });
}
return RedirectToAction("Medicaments");
}
public IActionResult Procedures() public IActionResult Procedures()
{ {
return View(); List<ProcedureViewModel> procedure = _procedureLogic.ReadList(null);
if (procedure == null)
{
procedure = new();
}
return View(procedure);
} }
public IActionResult Recipes() [HttpGet]
[HttpPost]
public IActionResult CreateProcedure(ProcedureViewModel model)
{ {
if (HttpContext.Request.Method == "GET")
{
ViewData["Title"] = "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
return View(); return View();
} }
else
public IActionResult CreateRecipe()
{ {
return View(); // TODO <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> UserId
ProcedureBindingModel procedure = new ProcedureBindingModel
{
Name = model.Name,
Comment = model.Comment ?? string.Empty,
DateStartProcedure = model.DateStartProcedure,
DateStopProcedure = model.DateStopProcedure
};
_procedureLogic.Create(procedure);
return RedirectToAction("Procedures");
}
} }
public IActionResult CreateProcedure() [HttpGet]
[HttpPost]
public IActionResult EditProcedure(ProcedureViewModel model)
{ {
return View(); if (HttpContext.Request.Method == "GET")
{
var obj = _procedureLogic.ReadElement(new ProcedureSearchModel { Id = model.Id });
ViewData["Title"] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
return View("CreateProcedure", obj);
}
else
{
ProcedureBindingModel procedure = new ProcedureBindingModel
{
Id = model.Id,
Name = model.Name,
Comment = model.Comment,
DateStartProcedure = model.DateStartProcedure,
DateStopProcedure = model.DateStopProcedure
};
_procedureLogic.Update(procedure);
return RedirectToAction("Procedures");
}
} }
public IActionResult CreateMedicament() [HttpPost]
public IActionResult DeleteProcedure(int id)
{ {
return View(); var obj = _procedureLogic.ReadElement(new ProcedureSearchModel { Id = id });
if (obj != null)
{
_procedureLogic.Delete(new ProcedureBindingModel { Id = obj.Id });
}
return RedirectToAction("Procedures");
} }
public IActionResult ListCoursesByProcedures() public IActionResult ListCoursesByProcedures()

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
@@ -7,10 +7,13 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="log4net.Extensions.AspNetCore" Version="1.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.16"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.16">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -20,4 +23,10 @@
<ProjectReference Include="..\PolyclinicDataModels\PolyclinicDataModels.csproj" /> <ProjectReference Include="..\PolyclinicDataModels\PolyclinicDataModels.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Update="log4net.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project> </Project>

View File

@@ -1,7 +1,30 @@
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<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>();
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>();
var app = builder.Build(); var app = builder.Build();

View File

@@ -1,10 +1,9 @@
@using PolyclinicContracts.ViewModels @using PolyclinicContracts.ViewModels
@model List<MedicamentViewModel> @model MedicamentViewModel
@{
ViewData["Title"] = "CreateMedicament";
}
<div class="text-center mt-3 mb-3"> <div class="text-center mt-3 mb-3">
<h2 class="display-4">Создание препарата</h2> <h3>@ViewData["Title"]</h3>
</div> </div>
<form method="post" class="form-create-medicament d-flex flex-row justify-content-around align-items-center"> <form method="post" class="form-create-medicament d-flex flex-row justify-content-around align-items-center">
@@ -15,14 +14,14 @@
<h3 class="col-3"> <h3 class="col-3">
Название: Название:
</h3> </h3>
<input class="col-6" type="text" style="width: 45vh" /> <input class="col-6" type="text" style="width: 45vh" asp-for="Name" />
</div> </div>
<div class="d-flex flex-row mb-5 flex-row justify-content-between align-items-center"> <div class="d-flex flex-row mb-5 flex-row justify-content-between align-items-center">
<h3 class="col-3"> <h3 class="col-3">
Комментарий: Комментарий:
</h3> </h3>
<textarea class="col-6" id="comment" name="comment" style="width: 45vh"> <textarea class="col-6" id="comment" name="comment" style="width: 45vh" asp-for="Comment">
</textarea> </textarea>
@@ -32,14 +31,12 @@
<h3 class="col-3"> <h3 class="col-3">
Выбор процедуры: Выбор процедуры:
</h3> </h3>
<select id="procedureId" name="procedureId" style="width: 45vh">
@* <option value="">Выберите процедуру</option> *@ <select id="procedureId" name="procedureId" style="width: 45vh" asp-for="ProcedureId">
@{ <option value="">Выберите процедуру</option>
int count = 3; @foreach (var procedure in ViewBag.Procedures)
for (int i = 1; i <= count; i++)
{ {
<option value="@i">процедура "@i"</option> <option value="@procedure.Id">@procedure.Name</option>
}
} }
</select> </select>
@@ -50,13 +47,11 @@
<h3 class="col-3"> <h3 class="col-3">
Выбор симптома: Выбор симптома:
</h3> </h3>
<select id="symptomId" name="symptomId" style="width: 45vh"> <select id="symptomId" name="symptomId" style="width: 45vh" asp-for="SymptomId">
@* <option value="">Выберите симптом</option> *@ <option value="">Выберите симптом</option>
@{ @foreach (var symptom in ViewBag.Symptomes)
for (int i = 1; i <= count; i++)
{ {
<option value="@i">симптом "@i"</option> <option value="@symptom.Id">@symptom.Name</option>
}
} }
</select> </select>
</div> </div>
@@ -64,7 +59,7 @@
<div class="d-flex flex-column mb-5 mt-5"> <div class="d-flex flex-column mb-5 mt-5">
<div class="col-8"></div> <div class="col-8"></div>
<div class="col-4"> <div class="col-4">
<input type="submit" value="Сохранить" class="button-save-medicament btn" asp-action="Medicaments" /> <input type="submit" value="Сохранить" class="button-save-medicament btn"/>
</div> </div>
</div> </div>
</form> </form>

View File

@@ -1,49 +1,45 @@
@using PolyclinicContracts.ViewModels @using PolyclinicContracts.ViewModels
@model List<ProcedureViewModel> @model ProcedureViewModel
@{
ViewData["Title"] = "CreateProcedure";
}
<div class="text-center mt-3 mb-3"> <div class="text-center mt-3 mb-3">
<h2 class="display-4">Создание процедуры</h2> <h3>@ViewData["Title"]</h3>
</div> </div>
<form method="post" class="form-create-procedure d-flex flex-row justify-content-around align-items-center"> <form method="post" class="form-create-procedure d-flex flex-row justify-content-around align-items-center">
<div class="procedure-info d-flex flex-column mb-5 mt-5"> <div class="procedure-info d-flex flex-column mb-5 mt-5">
<input type="hidden" readonly asp-for="Id" />
<div class="d-flex flex-row mb-5 flex-row justify-content-between align-items-center"> <div class="d-flex flex-row mb-5 flex-row justify-content-between align-items-center">
<h3 class="col-3 m-3"> <h3 class="col-3 m-3">
Название: Название:
</h3> </h3>
<input class="col-6" type="text" style="width: 45vh" /> <input required type="text" asp-for="Name" />
</div> </div>
<div class="d-flex flex-row mb-5 flex-row justify-content-between align-items-center"> <div class="d-flex flex-row mb-5 flex-row justify-content-between align-items-center">
<h3 class="col-3 m-3"> <h3 class="col-3 m-3">
Комментарий: Комментарий:
</h3> </h3>
<textarea class="col-6" id="comment" name="comment" style="width: 45vh"> <textarea type="text" asp-for="Comment" style="width: 45vh">
</textarea> </textarea>
</div> </div>
</div> </div>
<div class="d-flex flex-column mb-5 mt-5 justify-content-between align-content-around"> <div class="d-flex flex-column mb-5 mt-5 justify-content-between align-content-around">
<div class="mb-5 me-3"> <div class="mb-5 me-3">
<label for="dateFrom" class="me-3"> <label for="dateStart" class="me-3">
Дата начала Дата начала
</label> </label>
<input type="date" id="dateFrom" name="dateFrom" /> <input type="date" id="dateStart" asp-for="DateStartProcedure" />
</div> </div>
<div class="mb-5 me-3"> <div class="mb-5 me-3">
<label for="dateTo" class="me-3"> <label for="dateStop" class="me-3">
Дата завершения Дата завершения
</label> </label>
<input type="date" id="dateTo" name="dateTo" /> <input type="date" id="dateStop" asp-for="DateStopProcedure" />
</div> </div>
<div class="col-4"> <div class="col-4">
<input type="submit" value="Сохранить" class="button-save-procedure btn" asp-action="Procedures" /> <input type="submit" value="Сохранить" class="button-save-procedure btn" />
</div> </div>
</div> </div>
</form> </form>

View File

@@ -1,10 +1,10 @@
@using PolyclinicContracts.ViewModels @using PolyclinicContracts.ViewModels
@model List<RecipeViewModel> @model RecipeViewModel
@{ @{
ViewData["Title"] = "CreateRecipe";
} }
<div class="text-center mt-3 mb-3"> <div class="text-center mt-3 mb-3">
<h2 class="display-4">Создание рецепта</h2> <h2 class="display-4">@ViewData["Title"]</h2>
</div> </div>
<form method="post" class="form-create-recipe d-flex flex-row justify-content-around align-items-center"> <form method="post" class="form-create-recipe d-flex flex-row justify-content-around align-items-center">
@@ -15,14 +15,14 @@
<h3 class="col-3"> <h3 class="col-3">
Количество процедур: Количество процедур:
</h3> </h3>
<input class="col-6" type="text" style="width: 45vh" /> <input class="col-6" type="text" style="width: 45vh" asp-for="ProceduresCount" />
</div> </div>
<div class="d-flex flex-row mb-5 flex-row justify-content-between align-items-center"> <div class="d-flex flex-row mb-5 flex-row justify-content-between align-items-center">
<h3 class="col-3"> <h3 class="col-3">
Комментарий: Комментарий:
</h3> </h3>
<textarea class="col-6" id="comment" name="comment" style="width: 45vh"> <textarea class="col-6" id="comment" name="comment" style="width: 45vh" asp-for="Comment">
</textarea> </textarea>
@@ -33,13 +33,10 @@
Выбор процедуры: Выбор процедуры:
</h3> </h3>
<select id="procedureId" name="procedureId" style="width: 45vh"> <select id="procedureId" name="procedureId" style="width: 45vh">
@* <option value="">Выберите процедуру/ы</option> *@ <option value="">Выберите процедуру/ы</option>
@{ @foreach (var item in ViewBag.Procedures)
int count = 3;
for (int i = 1; i <= count; i++)
{ {
<option value="@i">процедура "@i"</option> <option value="@item.Id">@item.Name</option>
}
} }
</select> </select>
</div> </div>
@@ -55,12 +52,10 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@{ @foreach (var item in ViewBag.Procedures)
int cRows = 20;
for (int i = 1; i <= cRows; i++)
{ {
<tr> <tr>
<td>Процедура № @i </td> <td>Процедура № @item.Id @item.Name</td>
<td> <td>
<svg class="bi-cart-delete" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg class="bi-cart-delete" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" /> <path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
@@ -69,7 +64,7 @@
</svg> </svg>
</td> </td>
</tr> </tr>
}
} }
</tbody> </tbody>
</table> </table>

View File

@@ -1,8 +1,6 @@
@using PolyclinicContracts.ViewModels @using PolyclinicContracts.ViewModels
@model List<MedicamentViewModel> @model List<MedicamentViewModel>
@{ @ViewData["Title"] = "Medicaments";
ViewData["Title"] = "Medicaments";
}
<div class="text-center"> <div class="text-center">
<h1 class="display-4">Препараты</h1> <h1 class="display-4">Препараты</h1>
@@ -31,7 +29,7 @@
Симптом Симптом
</th> </th>
<th> <th>
Рецепт (номер) Процедура
</th> </th>
<th> <th>
Комментарий Комментарий
@@ -45,35 +43,34 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var item in Model)
{
<td>@item.Id</td>
<td>@item.Name</td>
<td>@item.SymptomName</td>
<td>@item.ProcedureName</td>
<td>@item.Comment</td>
<td> <td>
1 <a asp-action="EditMedicament" asp-route-id="@item.Id">
</td>
<td>
Фенибут
</td>
<td>
Сопли до колен
</td>
<td>
3
</td>
<td>
При особом неврозе употребляйте каждый день и спина не будет болеть
</td>
<td>
<a asp-action="CreateMedicament">
<svg class="bi-edit-pen" viewBox="0 0 127 127" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg class="bi-edit-pen" viewBox="0 0 127 127" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M105.5 26L37 114.5C34.5 117 16.3 121.7 7.5 122.5C79.1 34.1 101 5.5 102 4C104.833 4.5 119.3 14.6 122.5 21C105 44 98.5 55 111.5 58.5" stroke="#008315" stroke-width="6" stroke-linecap="round" /> <path d="M105.5 26L37 114.5C34.5 117 16.3 121.7 7.5 122.5C79.1 34.1 101 5.5 102 4C104.833 4.5 119.3 14.6 122.5 21C105 44 98.5 55 111.5 58.5" stroke="#008315" stroke-width="6" stroke-linecap="round" />
</svg> </svg>
</a> </a>
</td> </td>
<td> <td>
<form method="post" asp-action="DeleteMedicament" asp-route-id="@item.Id">
<button class="btn" type="submit">
<svg class="bi-cart-delete" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg class="bi-cart-delete" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" /> <path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
<path d="M65.2123 159.963L56 60.0001C88.0236 76.3307 119.521 77.4194 149 60.0001C141.63 142.346 140.08 160.953 140.226 159.963H65.2123Z" stroke="#D10000" stroke-width="8" /> <path d="M65.2123 159.963L56 60.0001C88.0236 76.3307 119.521 77.4194 149 60.0001C141.63 142.346 140.08 160.953 140.226 159.963H65.2123Z" stroke="#D10000" stroke-width="8" />
<path d="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" /> <path d="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
</svg> </svg>
</button>
</form>
</td> </td>
}
</tbody> </tbody>
</table> </table>
} }

View File

@@ -7,72 +7,62 @@
<h1 class="display-4">Процедуры</h1> <h1 class="display-4">Процедуры</h1>
</div> </div>
<div class="text-center"> <div>
@{ @{
// if (Model == null) // if (Model == null)
// { // {
// <h3 class="display-4">Авторизируйтесь</h3> // <h3 class="display-4">Авторизируйтесь</h3>
// return; // return;
// } // }
<div class="text-center">
<p> <p>
<a asp-action="CreateProcedure">Создать процедуру</a> <a asp-action="CreateProcedure">Создать процедуру</a>
</p> </p>
</div>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th> <th scope="col">Номер</th>
Номер <th scope="col">Название процедуры</th>
</th> <th scope="col">Дата начала процедуры</th>
<th> <th scope="col">Дата окончания процедуры</th>
Название процедуры <th scope="col">Комментарий</th>
</th> <th scope="col">Редактировать</th>
<th> <th scope="col">Удалить</th>
Дата начала процедуры
</th>
<th>
Дата окончания процедуры
</th>
<th>
Комментарий
</th>
<th>
Редактировать
</th>
<th>
Удалить
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var item in Model)
{
<tr>
<td scope="row">@item.Id</td>
<td>@item.Name</td>
<td>@item.DateStartProcedure.ToShortDateString()</td>
<td>@item.DateStopProcedure?.ToShortDateString()</td>
<td>@item.Comment</td>
<td> <td>
1 <a asp-action="EditProcedure" asp-route-id="@item.Id">
</td>
<td>
Массаж пяточек
</td>
<td>
12.04.2024
</td>
<td>
17.04.2024
</td>
<td>
ммммммм
</td>
<td>
<a asp-action="CreateProcedure">
<svg class="bi-edit-pen" viewBox="0 0 127 127" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg class="bi-edit-pen" viewBox="0 0 127 127" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M105.5 26L37 114.5C34.5 117 16.3 121.7 7.5 122.5C79.1 34.1 101 5.5 102 4C104.833 4.5 119.3 14.6 122.5 21C105 44 98.5 55 111.5 58.5" stroke="#008315" stroke-width="6" stroke-linecap="round" /> <path d="M105.5 26L37 114.5C34.5 117 16.3 121.7 7.5 122.5C79.1 34.1 101 5.5 102 4C104.833 4.5 119.3 14.6 122.5 21C105 44 98.5 55 111.5 58.5" stroke="#008315" stroke-width="6" stroke-linecap="round" />
</svg> </svg>
</a> </a>
</td> </td>
<td> <td>
<form method="post" asp-action="DeleteProcedure" asp-route-id="@item.Id">
<button class="btn" type="submit">
<svg class="bi-cart-delete" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg class="bi-cart-delete" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" /> <path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
<path d="M65.2123 159.963L56 60.0001C88.0236 76.3307 119.521 77.4194 149 60.0001C141.63 142.346 140.08 160.953 140.226 159.963H65.2123Z" stroke="#D10000" stroke-width="8" /> <path d="M65.2123 159.963L56 60.0001C88.0236 76.3307 119.521 77.4194 149 60.0001C141.63 142.346 140.08 160.953 140.226 159.963H65.2123Z" stroke="#D10000" stroke-width="8" />
<path d="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" /> <path d="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
</svg> </svg>
</button>
</form>
</td> </td>
</tr>
}
</tbody> </tbody>
</table> </table>
} }

View File

@@ -1,8 +1,5 @@
@using PolyclinicContracts.ViewModels @using PolyclinicContracts.ViewModels
@model List<RecipeViewModel> @model List<RecipeViewModel>
@{
ViewData["Title"] = "Recipes";
}
<div class="text-center"> <div class="text-center">
<h1 class="display-4">Рецепты</h1> <h1 class="display-4">Рецепты</h1>
</div> </div>
@@ -42,29 +39,32 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var item in Model)
{
<td>@item.Id</td>
<td>@item.Comment</td>
<td>@item.ProceduresCount</td>
<td> <td>
1 <a asp-action="CreateRecipe" asp-route-id="@item.Id">
</td>
<td>
Это процедура для вашей спины
</td>
<td>
4
</td>
<td>
<a asp-action="CreateRecipe">
<svg class="bi-edit-pen" viewBox="0 0 127 127" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg class="bi-edit-pen" viewBox="0 0 127 127" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M105.5 26L37 114.5C34.5 117 16.3 121.7 7.5 122.5C79.1 34.1 101 5.5 102 4C104.833 4.5 119.3 14.6 122.5 21C105 44 98.5 55 111.5 58.5" stroke="#008315" stroke-width="6" stroke-linecap="round" /> <path d="M105.5 26L37 114.5C34.5 117 16.3 121.7 7.5 122.5C79.1 34.1 101 5.5 102 4C104.833 4.5 119.3 14.6 122.5 21C105 44 98.5 55 111.5 58.5" stroke="#008315" stroke-width="6" stroke-linecap="round" />
</svg> </svg>
</a> </a>
</td> </td>
<td> <td>
<form method="post" asp-route-id="@item.Id">
<button class="btn" type="submit">
<svg class="bi-cart-delete" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg class="bi-cart-delete" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" /> <path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
<path d="M65.2123 159.963L56 60.0001C88.0236 76.3307 119.521 77.4194 149 60.0001C141.63 142.346 140.08 160.953 140.226 159.963H65.2123Z" stroke="#D10000" stroke-width="8" /> <path d="M65.2123 159.963L56 60.0001C88.0236 76.3307 119.521 77.4194 149 60.0001C141.63 142.346 140.08 160.953 140.226 159.963H65.2123Z" stroke="#D10000" stroke-width="8" />
<path d="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" /> <path d="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
</svg> </svg>
</button>
</form>
</td> </td>
}
</tbody> </tbody>
</table> </table>
} }

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="logs/polyclinicsuretorclient.log" />
<appendToFile value="true" />
<maximumFileSize value="100KB" />
<maxSizeRollBackups value="2" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %5level %logger.%method [%line] - MESSAGE: %message%newline %exception" />
</layout>
</appender>
<root>
<level value="TRACE" />
<appender-ref ref="RollingFile" />
</root>
</log4net>