исключение рецепт
This commit is contained in:
parent
51dff2468a
commit
dc5910e324
@ -109,3 +109,4 @@ namespace HospitalBusinessLogic.BusinessLogics
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ using HospitalContracts.BusinessLogicsContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataModels.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -21,6 +22,40 @@ namespace HospitalBusinessLogic.BusinessLogics
|
||||
_logger = logger;
|
||||
_recipesStorage = recipesStorage;
|
||||
}
|
||||
|
||||
public bool AddProcedures(RecipesSearchModel model, IProceduresModel procedure)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
_logger.LogInformation("AddProcedure.Id:{ Id}", model.Id);
|
||||
var element = _recipesStorage.GetElement(model);
|
||||
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("AddProcedure element not found");
|
||||
return false;
|
||||
}
|
||||
|
||||
_logger.LogInformation("AddProcedure find. Id:{Id}", element.Id);
|
||||
|
||||
element.RecipeProcedures[procedure.Id] = procedure;
|
||||
|
||||
_recipesStorage.Update(new()
|
||||
{
|
||||
Id = element.Id,
|
||||
Dose = element.Dose,
|
||||
ModeOfApplication = element.ModeOfApplication,
|
||||
Date = element.Date,
|
||||
ClientId = element.ClientId,
|
||||
RecipeProcedures = element.RecipeProcedures
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Create(RecipesBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
@ -7,7 +7,10 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="MigraDoc.DocumentObjectModel.Core" Version="1.0.0" />
|
||||
<PackageReference Include="MigraDoc.Rendering.Core" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -0,0 +1,88 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToExcel
|
||||
{
|
||||
/// <summary>
|
||||
/// Создание отчета
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
public void CreateReport(ExcelInfo 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 pc in info.KurseMedicines)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = pc.KurseId.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
foreach (var Medicine in pc.Medicines)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = Medicine,
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Итого",
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
SaveExcel(info);
|
||||
}
|
||||
/// <summary>
|
||||
/// Создание excel-файла
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
protected abstract void CreateExcel(ExcelInfo 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(ExcelInfo info);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToPdf
|
||||
{
|
||||
public void CreateDoc(PdfInfo 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", "6cm"});
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "Номер", "Дата создания рецепта" },
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
foreach (var recipe in info.RecipeMedicine)
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { recipe.Id.ToString(),
|
||||
recipe.DateCreate.ToShortDateString() },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
}
|
||||
SavePdf(info);
|
||||
}
|
||||
/// <summary>
|
||||
/// Создание doc-файла
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
protected abstract void CreatePdf(PdfInfo info);
|
||||
/// <summary>
|
||||
/// Создание параграфа с текстом
|
||||
/// </summary>
|
||||
/// <param name="title"></param>
|
||||
/// <param name="style"></param>
|
||||
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
||||
/// <summary>
|
||||
/// Создание таблицы
|
||||
/// </summary>
|
||||
/// <param name="title"></param>
|
||||
/// <param name="style"></param>
|
||||
protected abstract void CreateTable(List<string> columns);
|
||||
/// <summary>
|
||||
/// Создание и заполнение строки
|
||||
/// </summary>
|
||||
/// <param name="rowParameters"></param>
|
||||
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
||||
/// <summary>
|
||||
/// Сохранение файла
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
protected abstract void SavePdf(PdfInfo info);
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToWord
|
||||
{
|
||||
public void CreateDoc(WordInfo 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 kurse in info.KurseMedicines)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (kurse.Title, new WordTextProperties { Size = "24", Bold = true, }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
foreach (var medicine in kurse.Medicines)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (medicine, new WordTextProperties { Size = "20", Bold = false, }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
}
|
||||
SaveWord(info);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Создание doc-файла
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
protected abstract void CreateWord(WordInfo 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(WordInfo info);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum ExcelStyleInfoType
|
||||
{
|
||||
Title,
|
||||
Text,
|
||||
TextWithBroder
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum PdfParagraphAlignmentType
|
||||
{
|
||||
Center,
|
||||
Left,
|
||||
Right
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum WordJustificationType
|
||||
{
|
||||
Center,
|
||||
Both
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
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,20 @@
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelInfo
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ReportKurseMedicinesViewModel> KurseMedicines
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
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,18 @@
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfInfo
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public DateTime DateFrom { get; set; }
|
||||
public DateTime DateTo { get; set; }
|
||||
public List<ReportRecipeMedicineViewModel> RecipeMedicine { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
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,16 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
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,16 @@
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordInfo
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ReportKurseMedicinesViewModel> KurseMedicines { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordParagraph
|
||||
{
|
||||
public List<(string, WordTextProperties)> Texts { get; set; } = new();
|
||||
public WordTextProperties? TextProperties { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordTextProperties
|
||||
{
|
||||
public string Size { get; set; } = string.Empty;
|
||||
public bool Bold { get; set; }
|
||||
public WordJustificationType JustificationType { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,355 @@
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using DocumentFormat.OpenXml.Office2013.Excel;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToExcel : AbstractSaveToExcel
|
||||
{
|
||||
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.TextWithBroder => 1U,
|
||||
ExcelStyleInfoType.Text => 0U,
|
||||
_ => 0U,
|
||||
};
|
||||
}
|
||||
protected override void CreateExcel(ExcelInfo 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(ExcelInfo info)
|
||||
{
|
||||
if (_spreadsheetDocument == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
||||
_spreadsheetDocument.Close();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.DocumentObjectModel.Tables;
|
||||
using MigraDoc.Rendering;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToPdf : AbstractSaveToPdf
|
||||
{
|
||||
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.Right => 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 = 14;
|
||||
style = document.Styles.AddStyle("NormalTitle", "Normal");
|
||||
style.Font.Bold = true;
|
||||
}
|
||||
protected override void CreatePdf(PdfInfo 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();
|
||||
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(PdfInfo info)
|
||||
{
|
||||
var renderer = new PdfDocumentRenderer(true)
|
||||
{
|
||||
Document = _document
|
||||
};
|
||||
renderer.RenderDocument();
|
||||
renderer.PdfDocument.Save(info.FileName);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToWord : AbstractSaveToWord
|
||||
|
||||
{
|
||||
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(WordInfo 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(WordInfo info)
|
||||
{
|
||||
if (_docBody == null || _wordDocument == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_docBody.AppendChild(CreateSectionProperties());
|
||||
_wordDocument.MainDocumentPart!.Document.Save();
|
||||
_wordDocument.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -32,10 +32,7 @@ namespace HospitalClientApp
|
||||
public static void PostRequest<T>(string requestUrl, T model)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(model);
|
||||
var data = new StringContent(json, Encoding.UTF8,
|
||||
|
||||
|
||||
"application/json");
|
||||
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)
|
||||
|
@ -1,6 +1,12 @@
|
||||
using HospitalClientApp.Models;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Metrics;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace HospitalClientApp.Controllers
|
||||
{
|
||||
@ -15,14 +21,350 @@ namespace HospitalClientApp.Controllers
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Privacy()
|
||||
[HttpGet]
|
||||
public IActionResult Enter()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Enter(string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Введите логин и пароль");
|
||||
}
|
||||
APIClient.Client = APIClient.GetRequest<ClientViewModel>($"api/client/login?login={login}&password={password}");
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Неверный логин/пароль");
|
||||
}
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.Client);
|
||||
}
|
||||
[HttpPost]
|
||||
public void Privacy(string login, string password, string fio)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
|
||||
}
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и ФИО");
|
||||
}
|
||||
APIClient.PostRequest("api/client/updatedata", new ClientBindingModel
|
||||
{
|
||||
Id = APIClient.Client.Id,
|
||||
ClientFIO = fio,
|
||||
Email = login,
|
||||
Password = password
|
||||
});
|
||||
|
||||
APIClient.Client.ClientFIO = fio;
|
||||
APIClient.Client.Email = login;
|
||||
APIClient.Client.Password = password;
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Register()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Register(string login, string password, string fio)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и ФИО");
|
||||
}
|
||||
APIClient.PostRequest("api/client/register", new ClientBindingModel
|
||||
{
|
||||
ClientFIO = fio,
|
||||
Email = login,
|
||||
Password = password
|
||||
});
|
||||
Response.Redirect("Enter");
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ПРОЦЕДУРЫ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IActionResult ListProcedures()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<ProceduresViewModel>>($"api/main/GetProcedureList?ClientId={APIClient.Client.Id}"));
|
||||
}
|
||||
public IActionResult CreateProcedure(int? id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
if (!id.HasValue)
|
||||
{
|
||||
return View();
|
||||
}
|
||||
var model = APIClient.GetRequest<ProceduresViewModel?>($"api/main/getprocedure?id={id}");
|
||||
return View(model);
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreateProcedure(int? id, string procedurename, string proceduretype )
|
||||
{
|
||||
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
|
||||
}
|
||||
if (id.HasValue)
|
||||
{
|
||||
APIClient.PostRequest("api/main/updateprocedure", new ProceduresBindingModel
|
||||
{
|
||||
Id = id.Value,
|
||||
ProceduresName = procedurename,
|
||||
Type = proceduretype
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
APIClient.PostRequest("api/main/createprocedure", new ProceduresBindingModel
|
||||
{
|
||||
ClientId = APIClient.Client.Id,
|
||||
ProceduresName = procedurename,
|
||||
Type = proceduretype
|
||||
|
||||
});
|
||||
}
|
||||
Response.Redirect("ListProcedures");
|
||||
}
|
||||
[HttpGet]
|
||||
public ProceduresViewModel? GetProcedure(int procedureId)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
var result = APIClient.GetRequest<ProceduresViewModel>($"api/main/getprocedure?procedureid={procedureId}");
|
||||
if (result == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
var proceduresName = result.ProceduresName;
|
||||
var proceduretype = result.Type;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteProcedure(int procedure)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Доступно только авторизованным пользователям");
|
||||
}
|
||||
|
||||
APIClient.PostRequest($"api/main/DeleteProcedure", new ProceduresBindingModel { Id = procedure });
|
||||
Response.Redirect("ListProcedures");
|
||||
}
|
||||
|
||||
public IActionResult DeleteProcedure()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Procedures = APIClient.GetRequest<List<ProceduresViewModel>>($"api/main/getprocedurelist?clientId={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
/// <summary>
|
||||
/// ЛЕКАРСТВА
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IActionResult ListMedicines()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<MedicinesViewModel>>($"api/main/getmedicineslist?clientId={APIClient.Client.Id}"));
|
||||
}
|
||||
public IActionResult CreateMedicine(int? id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
if (!id.HasValue)
|
||||
{
|
||||
return View();
|
||||
}
|
||||
var model = APIClient.GetRequest<MedicinesViewModel?>($"api/main/getmedicine?id={id}");
|
||||
return View(model);
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreateMedicine(int? id, string namemedicine, string group)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
|
||||
}
|
||||
if (id.HasValue)
|
||||
{
|
||||
APIClient.PostRequest("api/main/updatemedicine", new MedicinesBindingModel
|
||||
{
|
||||
Id = id.Value,
|
||||
MedicinesName = namemedicine,
|
||||
Group = group
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
APIClient.PostRequest("api/main/createmedicine", new MedicinesBindingModel
|
||||
{
|
||||
ClientId = APIClient.Client.Id,
|
||||
MedicinesName = namemedicine,
|
||||
Group = group
|
||||
|
||||
});
|
||||
}
|
||||
Response.Redirect("ListMedicines");
|
||||
}
|
||||
[HttpGet]
|
||||
public MedicinesViewModel? GetMedicine(int medicineId)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
var result = APIClient.GetRequest<MedicinesViewModel>($"api/main/getmedicine?medicineid={medicineId}");
|
||||
if (result == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
var medicineName = result.MedicinesName;
|
||||
var group = result.Group;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteMedicine(int medicine)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Доступно только авторизованным пользователям");
|
||||
}
|
||||
|
||||
APIClient.PostRequest($"api/main/DeleteMedicine", new ProceduresBindingModel { Id = medicine });
|
||||
Response.Redirect("ListMedicines");
|
||||
}
|
||||
|
||||
public IActionResult DeleteMedicine()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Medicines = APIClient.GetRequest<List<MedicinesViewModel>>($"api/main/GetMedicinesList?clientId={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
/// <summary>
|
||||
/// РЕЦЕПТЫ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IActionResult ListRecipes()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<RecipesViewModel>>($"api/main/getrecipeslist?clientId={APIClient.Client.Id}"));
|
||||
}
|
||||
public IActionResult CreateRecipe(int? id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Medicines = APIClient.GetRequest<List<MedicinesViewModel>>("api/main/getmedicineslist");
|
||||
ViewBag.Procedures = APIClient.GetRequest<List<ProceduresViewModel>>("api/main/getprocedurelist");
|
||||
if (!id.HasValue)
|
||||
{
|
||||
return View(new RecipesViewModel());
|
||||
}
|
||||
var model = APIClient.GetRequest<RecipesViewModel?>($"api/main/getrecipe?id={id}");
|
||||
return View(model);
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateRecipe(RecipesBindingModel model)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
|
||||
}
|
||||
model.ClientId = APIClient.Client.Id;
|
||||
if (model.Id != 0)
|
||||
{
|
||||
APIClient.PostRequest("api/main/updaterecipe", model);
|
||||
}
|
||||
else
|
||||
{
|
||||
APIClient.PostRequest("api/main/createrecipe", model);
|
||||
}
|
||||
Response.Redirect("ListRecipes");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public Tuple<RecipesViewModel, string>? GetRecipe(int recipeId)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
var result = APIClient.GetRequest<Tuple<RecipesViewModel, List<Tuple<string, string>>>>($"api/main/getrecipe?recipeId={recipeId}");
|
||||
if (result == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
string table = "";
|
||||
for (int i = 0; i < result.Item2.Count; i++)
|
||||
{
|
||||
var proceduresName = result.Item2[i].Item1;
|
||||
var type = result.Item2[i].Item2;
|
||||
table += "<tr style=\"height: 44px\">";
|
||||
table += $"<td class=\"u-border-1 u-border-grey-30 u-table-cell\">{proceduresName}</td>";
|
||||
table += $"<td class=\"u-border-1 u-border-grey-30 u-table-cell\">{type}</td>";
|
||||
table += "</tr>";
|
||||
}
|
||||
return Tuple.Create(result.Item1, table);
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
|
@ -14,4 +14,8 @@
|
||||
<ProjectReference Include="..\..\HospitalContracts\HospitalContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\Images\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,10 +1,10 @@
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
using HospitalClientApp;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
APIClient.Connect(builder.Configuration);
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
@ -12,16 +12,11 @@ if (!app.Environment.IsDevelopment())
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
app.Run();
|
||||
|
33
Hospital/HospitalClientApp/Views/Home/AddProcedures.cshtml
Normal file
33
Hospital/HospitalClientApp/Views/Home/AddProcedures.cshtml
Normal file
@ -0,0 +1,33 @@
|
||||
@using HospitalContracts.ViewModels;
|
||||
@using System.Globalization
|
||||
@{
|
||||
ViewData["Title"] = "AddProcedures";
|
||||
}
|
||||
|
||||
@{
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Привязка процедуры</h2>
|
||||
</div>
|
||||
|
||||
<form method="post" class="form">
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Процедура:</div>
|
||||
<div class="col-8">
|
||||
<select id="procedure" name="procedure" class="form-control" asp-items="@(new SelectList(@ViewBag.Procedures,"Id", "ProceduresName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Лекарство:</div>
|
||||
<div class="col-8">
|
||||
<select id="medicine" name="medicine" class="form-control" asp-items="@(new SelectList(@ViewBag.Medicines,"Id", "MedicinesName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Сохранить" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
}
|
32
Hospital/HospitalClientApp/Views/Home/CreateMedicine.cshtml
Normal file
32
Hospital/HospitalClientApp/Views/Home/CreateMedicine.cshtml
Normal file
@ -0,0 +1,32 @@
|
||||
@{
|
||||
ViewData["Title"] = "CreateMedicine";
|
||||
}
|
||||
|
||||
@{
|
||||
if (Model != null)
|
||||
{
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Редактирование лекарства</h2>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание лекарства</h2>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Название лекарства:</div>
|
||||
<div class="col-8"><input type="text" name="namemedicine" id="namemedicine" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Группа:</div>
|
||||
<div class="col-8"><input type="text" id="group" name="group" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
31
Hospital/HospitalClientApp/Views/Home/CreateProcedure.cshtml
Normal file
31
Hospital/HospitalClientApp/Views/Home/CreateProcedure.cshtml
Normal file
@ -0,0 +1,31 @@
|
||||
@{
|
||||
ViewData["Title"] = "CreateProcedure";
|
||||
}
|
||||
|
||||
@{
|
||||
if (Model != null)
|
||||
{
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Редактирование процедуры</h2>
|
||||
</div>
|
||||
}
|
||||
else {
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание процедуры</h2>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Название процедуры:</div>
|
||||
<div class="col-8"><input type="text" name="procedurename" id="procedurename" value="@Model?.MedicinesName" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Тип:</div>
|
||||
<div class="col-8"><input type="text" id="proceduretype" name="proceduretype" value="@Model?.Type" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
95
Hospital/HospitalClientApp/Views/Home/CreateRecipe.cshtml
Normal file
95
Hospital/HospitalClientApp/Views/Home/CreateRecipe.cshtml
Normal file
@ -0,0 +1,95 @@
|
||||
@using HospitalContracts.ViewModels;
|
||||
@{
|
||||
ViewData["Title"] = "CreateRecipe";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание рецепта</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Доза:</div>
|
||||
<div class="col-8"><input type="text" name="dose" id="dose" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Способ применения:</div>
|
||||
<div class="col-8"><input type="text" id="modeofapplication" name="modeofapplication"/></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Лекарство:</div>
|
||||
<div class="col-8">
|
||||
<select id="medicines" name="medicines" class="form-control" asp-items="@(new SelectList(@ViewBag.Medicines,"Id", "MedicinesName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Добавление процедур:</label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<select id="procedures" name="procedures" class="form-control" asp-items="@(new SelectList(@ViewBag.Procedures,"Id", "ProceduresName"))"></select>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-success bg-dark" onclick="addProcedures()">Добавить</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<p class="text-center"><strong>Процедуры</strong></p>
|
||||
<table id="prodedureTable" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var procedure in Model.RecipeProcedures)
|
||||
{
|
||||
<tr>
|
||||
<td>@procedure.Value.ProceduresName</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-danger" data-id="@procedure.Key" onclick="removeProcedure('@procedure.Key')">Удалить</button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section scripts {
|
||||
<script>
|
||||
var recipesProcedures = @Json.Serialize(Model.RecipeProcedures);
|
||||
function addProcedures() {
|
||||
var procedureId = $('#procedures').val();
|
||||
var proceduresName = $('#procedures option:selected').text();
|
||||
if (recipesProcedures.hasOwnProperty(procedureId)) {
|
||||
alert('This procedure is already added.');
|
||||
return;
|
||||
}
|
||||
recipesProcedures[procedureId] = { Id: procedureId, Name: proceduresName };
|
||||
var row = $('<tr>').append($('<td>').text(proceduresName));
|
||||
var removeButton = $('<button>').text('Удалить').attr('data-id', procedureId).attr('class', 'btn btn-danger').click((function (id) {
|
||||
return function () {
|
||||
removeProcedure(id);
|
||||
};
|
||||
})(procedureId));
|
||||
row.append($('<td>').append(removeButton));
|
||||
|
||||
$('#procedureTable tbody').append(row);
|
||||
var input = $('<input>').attr('type', 'hidden').attr('name', 'RecipesProcedures[' + procedureId + ']').val(procedureId);
|
||||
$('#recipe-form').append(input);
|
||||
}
|
||||
function removeProcedure(procedureId) {
|
||||
delete recipesProcedures[procedureId];
|
||||
$('#procedureTable button[data-id="' + procedureId + '"]').closest('tr').remove();
|
||||
$('#recipe-form input[name="RecipesProcedures[' + procedureId + ']"]').remove();
|
||||
}
|
||||
</script>
|
||||
}
|
16
Hospital/HospitalClientApp/Views/Home/DeleteMedicine.cshtml
Normal file
16
Hospital/HospitalClientApp/Views/Home/DeleteMedicine.cshtml
Normal file
@ -0,0 +1,16 @@
|
||||
@{
|
||||
ViewData["Title"] = "DeleteMedicine";
|
||||
}
|
||||
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<label class="lable">Лекарство: </label>
|
||||
<div>
|
||||
<select id="medicine" name="medicine" class="form-control" asp-items="@(new SelectList(@ViewBag.Medicines, "Id", "MedicinesName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Удалить" /></div>
|
||||
</div>
|
||||
</form>
|
16
Hospital/HospitalClientApp/Views/Home/DeleteProcedure.cshtml
Normal file
16
Hospital/HospitalClientApp/Views/Home/DeleteProcedure.cshtml
Normal file
@ -0,0 +1,16 @@
|
||||
@{
|
||||
ViewData["Title"] = "DeleteProcedure";
|
||||
}
|
||||
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<label class="lable">Процедура: </label>
|
||||
<div>
|
||||
<select id="procedure" name="procedure" class="form-control" asp-items="@(new SelectList(@ViewBag.Procedures, "Id", "ProceduresName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Удалить"/></div>
|
||||
</div>
|
||||
</form>
|
21
Hospital/HospitalClientApp/Views/Home/Enter.cshtml
Normal file
21
Hospital/HospitalClientApp/Views/Home/Enter.cshtml
Normal file
@ -0,0 +1,21 @@
|
||||
@{
|
||||
ViewData["Title"] = "Enter";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Вход в приложение</h2>
|
||||
</div>
|
||||
|
||||
<form method ="post">
|
||||
<div class="mb-3">
|
||||
<label for="InputEmail1" class="form-label">Email address</label>
|
||||
<input type="email" name="login" class="form-control" id="InputEmail1" aria-describedby="emailHelp">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="InputPassword1" class="form-label">Password</label>
|
||||
<input type="password" name="password" class="form-control" id="InputPassword1">
|
||||
</div>
|
||||
<div class="mb-3" style="width: 100%">
|
||||
<button type="submit" style="background-color:black;" class="btn btn-primary">Submit</button>
|
||||
</div>
|
||||
</form>
|
@ -1,8 +1,34 @@
|
||||
@{
|
||||
@using HospitalContracts.ViewModels
|
||||
|
||||
|
||||
@model List<RecipesViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
</div>
|
||||
<head>
|
||||
<link rel="stylesheet" href="~/css/main.css" asp-append-version="true" />
|
||||
</head>
|
||||
<section style="margin-left: 50px; margin-top:50px;">
|
||||
<h2 class="lable" style="text-align: center">
|
||||
Поликлиника
|
||||
</h2>
|
||||
<h3 style="text-align: center">
|
||||
Приложение для персонала
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-container-style u-layout-cell u-size-30 u-layout-cell-2">
|
||||
<div class="u-container-layout u-valign-top u-container-layout-2"
|
||||
style="margin-left: 500px">
|
||||
<img class="u-image u-image-contain u-image-1"
|
||||
src="~/Images/logo.png"
|
||||
data-image-width="2388"
|
||||
data-image-height="1260" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
63
Hospital/HospitalClientApp/Views/Home/ListMedicines.cshtml
Normal file
63
Hospital/HospitalClientApp/Views/Home/ListMedicines.cshtml
Normal file
@ -0,0 +1,63 @@
|
||||
@using HospitalContracts.ViewModels
|
||||
|
||||
@model List<MedicinesViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "ListMedicines";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Лекарства</h1>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
|
||||
<p>
|
||||
<a class="btn btn-warning" asp-action="CreateMedicine">Создать лекарство</a>
|
||||
<a class="btn btn-warning" asp-action="DeleteMedicine">Удалить</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Номер
|
||||
</th>
|
||||
<th>
|
||||
Название лекарства
|
||||
</th>
|
||||
<th>
|
||||
Группа
|
||||
</th>
|
||||
<th>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.MedicinesName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Group)
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-warning" asp-action="CreateMedicine" asp-route-id="@item.Id">Редактировать</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
63
Hospital/HospitalClientApp/Views/Home/ListProcedures.cshtml
Normal file
63
Hospital/HospitalClientApp/Views/Home/ListProcedures.cshtml
Normal file
@ -0,0 +1,63 @@
|
||||
@using HospitalContracts.ViewModels
|
||||
|
||||
@model List<ProceduresViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "ListProcedures";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Процедуры</h1>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
|
||||
<p>
|
||||
<a class="btn btn-warning" asp-action="CreateProcedure">Создать процедуру</a>
|
||||
<a class="btn btn-warning" asp-action="DeleteProcedure">Удалить</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Номер
|
||||
</th>
|
||||
<th>
|
||||
Название процедуры
|
||||
</th>
|
||||
<th>
|
||||
Тип процедуры
|
||||
</th>
|
||||
<th>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.ProceduresName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Type)
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-warning" asp-action="CreateProcedure" asp-route-id="@item.Id">Редактировать</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
71
Hospital/HospitalClientApp/Views/Home/ListRecipes.cshtml
Normal file
71
Hospital/HospitalClientApp/Views/Home/ListRecipes.cshtml
Normal file
@ -0,0 +1,71 @@
|
||||
@using HospitalContracts.ViewModels
|
||||
|
||||
@model List<RecipesViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "ListRecipes";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Рецепты</h1>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
|
||||
<p>
|
||||
<a class="btn btn-warning" asp-action="CreateRecipe">Создать рецепт</a>
|
||||
<a class="btn btn-warning" asp-action="DeleteRecipe">Удалить</a>
|
||||
<a class="btn btn-warning" asp-action="AddProcedures">Добавить процедуры</a>
|
||||
<a class="btn btn-warning" asp-action="AddSymptoms">Добавить симптомы</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Номер
|
||||
</th>
|
||||
<th>
|
||||
Дата
|
||||
</th>
|
||||
<th>
|
||||
Доза
|
||||
</th>
|
||||
<th>
|
||||
Лекарство
|
||||
</th>
|
||||
<th>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Date)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Dose)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.MedicinesName)
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-warning" asp-action="CreateRecipe" asp-route-id="@item.Id">Редактировать</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
@ -3,7 +3,7 @@
|
||||
@model ClientViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
ViewData["Title"] = "Privacy";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Личные данные</h2>
|
||||
@ -26,4 +26,3 @@
|
||||
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
26
Hospital/HospitalClientApp/Views/Home/Register.cshtml
Normal file
26
Hospital/HospitalClientApp/Views/Home/Register.cshtml
Normal file
@ -0,0 +1,26 @@
|
||||
@{
|
||||
ViewData["Title"] = "Register";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Регистрация</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="InputEmail1" class="form-label">Email address</label>
|
||||
<input type="email" name="login" class="form-control" id="InputEmail1" aria-describedby="emailHelp">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="InputPassword1" class="form-label">Password</label>
|
||||
<input type="password" name="password" class="form-control" id="InputPassword1">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="InputFIO" class="form-label">Name</label>
|
||||
<input type="text" name="fio" class="form-control" id="InputFIO" />
|
||||
</div>
|
||||
|
||||
<div class="mb-3" style="width: 100%">
|
||||
<button type="submit" style="background-color:black;" class="btn btn-primary"> Регистрация </button>
|
||||
</div>
|
||||
</form>
|
35
Hospital/HospitalClientApp/Views/Home/UpdateMedicine.cshtml
Normal file
35
Hospital/HospitalClientApp/Views/Home/UpdateMedicine.cshtml
Normal file
@ -0,0 +1,35 @@
|
||||
@{
|
||||
ViewData["Title"] = "UpdateMedicine";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Изменения лекарства</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<label class="lable">Лекарство: </label>
|
||||
<div>
|
||||
<select id="medicine" name="medicine" class="form-control" asp-items="@(new SelectList(@ViewBag.Medicines, "Id", "MedicinesName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="lable">Название лекарства</label>
|
||||
<input type="text"
|
||||
id="medicinename"
|
||||
placeholder="Введите название процедуры"
|
||||
name="medicinename"
|
||||
class="u-input u-input-rectangle" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="lable">Группа</label>
|
||||
<input type="text"
|
||||
id="group"
|
||||
placeholder="Введите группу"
|
||||
name="group"
|
||||
class="u-input u-input-rectangle" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Сохранить" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
|
||||
</div>
|
||||
</form>
|
35
Hospital/HospitalClientApp/Views/Home/UpdateProcedure.cshtml
Normal file
35
Hospital/HospitalClientApp/Views/Home/UpdateProcedure.cshtml
Normal file
@ -0,0 +1,35 @@
|
||||
@{
|
||||
ViewData["Title"] = "UpdateProcedure";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Изменения процедуры</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<label class="lable">Процедура: </label>
|
||||
<div>
|
||||
<select id="procedure" name="procedure" class="form-control" asp-items="@(new SelectList(@ViewBag.Procedures, "Id", "ProceduresName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="lable">Название процедуры</label>
|
||||
<input type="text"
|
||||
id="procedurename"
|
||||
placeholder="Введите название процедуры"
|
||||
name="procedurename"
|
||||
class="u-input u-input-rectangle" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="lable">Тип</label>
|
||||
<input type="text"
|
||||
id="type"
|
||||
placeholder="Тип процедуры"
|
||||
name="type"
|
||||
class="u-input u-input-rectangle" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Сохранить" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
|
||||
</div>
|
||||
</form>
|
39
Hospital/HospitalClientApp/Views/Home/UpdateRecipe.cshtml
Normal file
39
Hospital/HospitalClientApp/Views/Home/UpdateRecipe.cshtml
Normal file
@ -0,0 +1,39 @@
|
||||
@{
|
||||
ViewData["Title"] = "UpdateRecipe";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Изменения рецепта</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<label class="lable">Рецепт: </label>
|
||||
<div>
|
||||
<select id="recipe" name="recipe" class="form-control" asp-items="@(new SelectList(@ViewBag.Recipes, "Id"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="lable">Доза</label>
|
||||
<input type="text"
|
||||
id="dose"
|
||||
placeholder="Введите дозу"
|
||||
name="dose"
|
||||
class="u-input u-input-rectangle" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="lable">Способ применения</label>
|
||||
<input type="text"
|
||||
id="modeofapplication"
|
||||
placeholder="Введите способ применения"
|
||||
name="modeofapplication"
|
||||
class="u-input u-input-rectangle" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="lable">Лекарство</label>
|
||||
<select id="medicinename" name="medicinename" class="form-control" asp-items="@(new SelectList(@ViewBag.Medicines, "Id","MedicinesName"))"></select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Сохранить" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
|
||||
</div>
|
||||
</form>
|
@ -3,16 +3,17 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - HospitalClientApp</title>
|
||||
<title>@ViewData["Title"] - Поликлиника</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/HospitalClientApp.styles.css" asp-append-version="true" />
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-dark bg-dark border-bottom">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">HospitalClientApp</a>
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Поликлиника</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
@ -20,12 +21,53 @@
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
||||
<a class="nav-link text-white" asp-area="" asp-controller="Home" asp-action="Index">Главная</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
<a class="nav-link text-white" asp-area="" asp-controller="Home" asp-action="Enter">Войти</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-white" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||
</li>
|
||||
<div class="dropdown">
|
||||
<a class="btn btn-secondary dropdown-toggle text-white" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
Справочники
|
||||
</a>
|
||||
|
||||
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="dropdownMenuLink">
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
asp-area="" asp-controller="Home" asp-action="ListProcedures">Процедуры</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
asp-area="" asp-controller="Home" asp-action="ListMedicines">Лекарства</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
asp-area="" asp-controller="Home" asp-action="ListRecipes">Рецепты</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="dropdown">
|
||||
<a class="btn btn-secondary dropdown-toggle text-white" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
Отчеты
|
||||
</a>
|
||||
|
||||
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="dropdownMenuLink">
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
asp-area="dropdown-item" asp-controller="Home" asp-action="ListMembers">Список участников (pdf)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
asp-area="dropdown-item" asp-controller="Home" asp-action="ListMemberConferenceToFile">Список участников (word/excel)</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@ -38,7 +80,7 @@
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2023 - HospitalClientApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
© 2023 - Поликлиника - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
|
BIN
Hospital/HospitalClientApp/wwwroot/Images/logo.png
Normal file
BIN
Hospital/HospitalClientApp/wwwroot/Images/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
173
Hospital/HospitalClientApp/wwwroot/css/entry.css
Normal file
173
Hospital/HospitalClientApp/wwwroot/css/entry.css
Normal file
@ -0,0 +1,173 @@
|
||||
.u-section-1 .u-sheet-1 {
|
||||
min-height: 594px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-wrap-1 {
|
||||
margin-top: 59px;
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-1 {
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-container-layout-1 {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.u-section-1 .u-image-1 {
|
||||
width: 569px;
|
||||
height: 300px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-2 {
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-container-layout-2 {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.u-section-1 .u-text-1 {
|
||||
font-weight: 700;
|
||||
margin: 14px auto 0;
|
||||
}
|
||||
|
||||
.u-section-1 .u-form-1 {
|
||||
height: 251px;
|
||||
width: 510px;
|
||||
margin: 9px 30px 0;
|
||||
}
|
||||
|
||||
.u-section-1 .u-form-group-1 {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.u-section-1 .u-label-1 {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.u-section-1 .u-input-1 {
|
||||
font-weight: 700;
|
||||
margin: 14px 166px 0 auto;
|
||||
}
|
||||
|
||||
.u-section-1 .u-form-group-2 {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.u-section-1 .u-label-2 {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.u-section-1 .u-input-2 {
|
||||
font-weight: 700;
|
||||
margin: 14px 166px 0 auto;
|
||||
}
|
||||
|
||||
.u-section-1 .u-btn-1 {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
@media (max-width: 1199px) {
|
||||
.u-section-1 .u-sheet-1 {
|
||||
min-height: 524px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-wrap-1 {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-1 {
|
||||
min-height: 330px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-image-1 {
|
||||
width: 470px;
|
||||
height: 248px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-2 {
|
||||
min-height: 330px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-form-1 {
|
||||
width: 470px;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.u-section-1 .u-input-1 {
|
||||
margin-right: 136px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-input-2 {
|
||||
margin-right: 136px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.u-section-1 .u-sheet-1 {
|
||||
min-height: 447px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-1 {
|
||||
min-height: 253px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-image-1 {
|
||||
width: 360px;
|
||||
height: 190px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-2 {
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-form-1 {
|
||||
width: 360px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-input-1 {
|
||||
margin-right: 104px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-input-2 {
|
||||
margin-right: 104px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.u-section-1 .u-sheet-1 {
|
||||
min-height: 674px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-1 {
|
||||
min-height: 380px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-form-1 {
|
||||
margin-top: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 575px) {
|
||||
.u-section-1 .u-sheet-1 {
|
||||
min-height: 533px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-1 {
|
||||
min-height: 239px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-image-1 {
|
||||
width: 340px;
|
||||
height: 179px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-form-1 {
|
||||
margin-top: 30px;
|
||||
width: 340px;
|
||||
}
|
||||
}
|
173
Hospital/HospitalClientApp/wwwroot/css/index.css
Normal file
173
Hospital/HospitalClientApp/wwwroot/css/index.css
Normal file
@ -0,0 +1,173 @@
|
||||
.u-section-1 .u-sheet-1 {
|
||||
min-height: 594px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-wrap-1 {
|
||||
margin-top: 59px;
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-1 {
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-container-layout-1 {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.u-section-1 .u-image-1 {
|
||||
width: 569px;
|
||||
height: 300px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-2 {
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-container-layout-2 {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.u-section-1 .u-text-1 {
|
||||
font-weight: 700;
|
||||
margin: 14px auto 0;
|
||||
}
|
||||
|
||||
.u-section-1 .u-form-1 {
|
||||
height: 251px;
|
||||
width: 510px;
|
||||
margin: 9px 30px 0;
|
||||
}
|
||||
|
||||
.u-section-1 .u-form-group-1 {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.u-section-1 .u-label-1 {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.u-section-1 .u-input-1 {
|
||||
font-weight: 700;
|
||||
margin: 14px 166px 0 auto;
|
||||
}
|
||||
|
||||
.u-section-1 .u-form-group-2 {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.u-section-1 .u-label-2 {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.u-section-1 .u-input-2 {
|
||||
font-weight: 700;
|
||||
margin: 14px 166px 0 auto;
|
||||
}
|
||||
|
||||
.u-section-1 .u-btn-1 {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
@media (max-width: 1199px) {
|
||||
.u-section-1 .u-sheet-1 {
|
||||
min-height: 524px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-wrap-1 {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-1 {
|
||||
min-height: 330px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-image-1 {
|
||||
width: 470px;
|
||||
height: 248px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-2 {
|
||||
min-height: 330px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-form-1 {
|
||||
width: 470px;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.u-section-1 .u-input-1 {
|
||||
margin-right: 136px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-input-2 {
|
||||
margin-right: 136px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.u-section-1 .u-sheet-1 {
|
||||
min-height: 447px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-1 {
|
||||
min-height: 253px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-image-1 {
|
||||
width: 360px;
|
||||
height: 190px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-2 {
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-form-1 {
|
||||
width: 360px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-input-1 {
|
||||
margin-right: 104px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-input-2 {
|
||||
margin-right: 104px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.u-section-1 .u-sheet-1 {
|
||||
min-height: 674px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-1 {
|
||||
min-height: 380px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-form-1 {
|
||||
margin-top: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 575px) {
|
||||
.u-section-1 .u-sheet-1 {
|
||||
min-height: 533px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-layout-cell-1 {
|
||||
min-height: 239px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-image-1 {
|
||||
width: 340px;
|
||||
height: 179px;
|
||||
}
|
||||
|
||||
.u-section-1 .u-form-1 {
|
||||
margin-top: 30px;
|
||||
width: 340px;
|
||||
}
|
||||
}
|
@ -15,4 +15,4 @@ html {
|
||||
|
||||
body {
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,329 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicsContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataModels.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Net;
|
||||
|
||||
namespace HospitalRestApi.Controllers
|
||||
{
|
||||
public class MainController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class MainController : Controller
|
||||
{
|
||||
return View();
|
||||
private readonly ILogger _logger;
|
||||
private readonly IClientLogic _client;
|
||||
private readonly IProceduresLogic _procedure;
|
||||
private readonly IMedicinesLogic _medicine;
|
||||
private readonly IKurseLogic _kurse;
|
||||
private readonly ISymptomsLogic _symptom;
|
||||
private readonly IRecipesLogic _recipe;
|
||||
private readonly IIllnessLogic _illness;
|
||||
|
||||
public MainController(ILogger<MainController> logger, IClientLogic client, IProceduresLogic procedure, IMedicinesLogic medicine, IKurseLogic kurse, ISymptomsLogic symptom, IRecipesLogic recipe, IIllnessLogic illness)
|
||||
{
|
||||
_logger = logger;
|
||||
_client = client;
|
||||
_procedure = procedure;
|
||||
_medicine = medicine;
|
||||
_kurse = kurse;
|
||||
_symptom = symptom;
|
||||
_recipe = recipe;
|
||||
_illness = illness;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ПРОЦЕДУРЫ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public List<ProceduresViewModel>? GetProcedureList(int? clientId)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (clientId == null)
|
||||
{
|
||||
return _procedure.ReadList(null);
|
||||
}
|
||||
return _procedure.ReadList(new ProceduresSearchModel
|
||||
{
|
||||
ClientId = clientId
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка процедур");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public List<ProceduresViewModel>? GetProcedures()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _procedure.ReadList(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка процедур");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public ProceduresViewModel? GetProcedure(int procedureId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _procedure.ReadElement(new ProceduresSearchModel
|
||||
{
|
||||
Id = procedureId
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения процедуры по id={Id}", procedureId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreateProcedure(ProceduresBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_procedure.Create(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания процедуры");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateProcedure(ProceduresBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_procedure.Update(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка обновления процедуры");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteProcedure(ProceduresBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_procedure.Delete(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления процедуры");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// ЛЕКАРСТВА
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public List<MedicinesViewModel>? GetMedicinesList(int? clientId)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (clientId == null)
|
||||
{
|
||||
return _medicine.ReadList(null);
|
||||
}
|
||||
return _medicine.ReadList(new MedicinesSearchModel
|
||||
{
|
||||
ClientId = clientId
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка лекарств");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public List<MedicinesViewModel>? GetMedicines()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _medicine.ReadList(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка лекарств");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public MedicinesViewModel? GetMedicine(int medicineId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _medicine.ReadElement(new MedicinesSearchModel
|
||||
{
|
||||
Id = medicineId
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения лекарства по id={Id}", medicineId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateMedicine(MedicinesBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_medicine.Create(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания лекарства");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void UpdateMedicine(MedicinesBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_medicine.Update(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка обновления лекарства");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteMedicine(MedicinesBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_medicine.Delete(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления лекарства");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// РЕЦЕПТЫ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpGet]
|
||||
public List<RecipesViewModel>? GetRecipesList(int clientId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _recipe.ReadList(new RecipesSearchModel
|
||||
{
|
||||
ClientId = clientId,
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка рецептов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreateRecipe(RecipesBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_recipe.Create(GetModelWithProcedures(model));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания рецепта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<RecipesViewModel>? GetRecipes()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _recipe.ReadList(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка рецептов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public RecipesViewModel? GetRecipe(int recipeId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _recipe.ReadElement(new RecipesSearchModel
|
||||
{
|
||||
Id = recipeId
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения рецепта по id={Id}", recipeId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateRecipe(RecipesBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_recipe.Update(GetModelWithProcedures(model));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка обновления данных");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void AddProcedures(Tuple<RecipesSearchModel, ProceduresViewModel> model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_recipe.AddProcedures(model.Item1, model.Item2);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка добавления участника в план питания.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private RecipesBindingModel GetModelWithProcedures( RecipesBindingModel model)
|
||||
{
|
||||
var medicines = _procedure.ReadList(new ProceduresSearchModel { Ids = model.RecipeProcedures.Keys.ToArray() });
|
||||
if (medicines != null)
|
||||
{
|
||||
model.RecipeProcedures = medicines.Where(m => model.RecipeProcedures.Keys.Contains(m.Id))
|
||||
.ToDictionary(m => m.Id, m => m as IProceduresModel);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ builder.Logging.AddLog4Net("log4net.config");
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
||||
builder.Services.AddTransient<IKurseStorage, KurseStorage>();
|
||||
builder.Services.AddTransient<IIllnessStorage, IllnessStorage>();
|
||||
builder.Services.AddTransient<ISymptomsStorage, SymptomsStorage>();
|
||||
builder.Services.AddTransient<IMedicinesStorage, MedicinesStorage>();
|
||||
@ -23,6 +24,7 @@ builder.Services.AddTransient<IIllnessLogic, IllnessLogic>();
|
||||
builder.Services.AddTransient<ISymptomsLogic, SymptomsLogic>();
|
||||
builder.Services.AddTransient<IMedicinesLogic, MedicinesLogic>();
|
||||
builder.Services.AddTransient<IProceduresLogic, ProceduresLogic>();
|
||||
builder.Services.AddTransient<IKurseLogic, KurseLogic>();
|
||||
builder.Services.AddTransient<IRecipesLogic, RecipesLogic>();
|
||||
|
||||
builder.Services.AddControllers();
|
||||
@ -45,8 +47,7 @@ var app = builder.Build();
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json",
|
||||
"GiftShopRestApi v1"));
|
||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json","HospitalRestApi v1"));
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
@ -12,5 +12,6 @@ namespace HospitalContracts.BindingModels
|
||||
public int Id { get; set; }
|
||||
public string MedicinesName { get; set; } = string.Empty;
|
||||
public string Group { get; set; } = string.Empty;
|
||||
public int ClientId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -12,5 +12,6 @@ namespace HospitalContracts.BindingModels
|
||||
public int Id { get; set; }
|
||||
public string ProceduresName { get; set; } = string.Empty;
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public int ClientId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -15,11 +15,11 @@ namespace HospitalContracts.BindingModels
|
||||
public string ModeOfApplication { get; set; } = string.Empty;
|
||||
public int ClientId { get; set; }
|
||||
public int MedicinesId { get; set; }
|
||||
public Dictionary<int, ISymptomsModel> RecipeSymptoms
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
//public Dictionary<int, ISymptomsModel> RecipeSymptoms
|
||||
//{
|
||||
// get;
|
||||
// set;
|
||||
//} = new();
|
||||
|
||||
public Dictionary<int, IProceduresModel> RecipeProcedures
|
||||
{
|
||||
|
15
HospitalContracts/BindingModels/ReportBindingModel.cs
Normal file
15
HospitalContracts/BindingModels/ReportBindingModel.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class ReportBindingModel
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -13,6 +14,7 @@ namespace HospitalContracts.BusinessLogicsContracts
|
||||
{
|
||||
List<RecipesViewModel>? ReadList(RecipesSearchModel? model);
|
||||
RecipesViewModel? ReadElement(RecipesSearchModel model);
|
||||
bool AddProcedures(RecipesSearchModel model, IProceduresModel member);
|
||||
bool Create(RecipesBindingModel model);
|
||||
bool Update(RecipesBindingModel model);
|
||||
bool Delete(RecipesBindingModel model);
|
||||
|
40
HospitalContracts/BusinessLogicsContracts/IReportLogic.cs
Normal file
40
HospitalContracts/BusinessLogicsContracts/IReportLogic.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IReportLogic
|
||||
{
|
||||
/// <summary>
|
||||
/// Получение списка компонент с указанием, в каких изделиях используются
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<ReportKurseMedicinesViewModel> GetKurseMedicines();
|
||||
/// <summary>
|
||||
/// Получение списка заказов за определенный период
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
List<ReportRecipeMedicineViewModel> GetRecipeMedicine(ReportBindingModel model);
|
||||
/// <summary>
|
||||
/// Сохранение компонент в файл-Word
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
void SaveGiftsToWordFile(ReportBindingModel model);
|
||||
/// <summary>
|
||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
void SaveGiftComponentToExcelFile(ReportBindingModel model);
|
||||
/// <summary>
|
||||
/// Сохранение заказов в файл-Pdf
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
void SaveOrdersToPdfFile(ReportBindingModel model);
|
||||
}
|
||||
}
|
@ -10,6 +10,5 @@ namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? IllnessName { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -10,5 +10,6 @@ namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? MedicinesName { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ namespace HospitalContracts.SearchModels
|
||||
public class ProceduresSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? ProceduresName { get; set; }
|
||||
}
|
||||
public string? ProceduresName { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
public int[] Ids { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -15,5 +15,6 @@ namespace HospitalContracts.ViewModels
|
||||
public string MedicinesName { get; set; } = string.Empty;
|
||||
[DisplayName("Группа")]
|
||||
public string Group { get; set; } = string.Empty;
|
||||
public int ClientId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -15,5 +15,6 @@ namespace HospitalContracts.ViewModels
|
||||
public string ProceduresName { get; set; } = string.Empty;
|
||||
[DisplayName("Тип процедуры")]
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public int ClientId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -21,13 +21,14 @@ namespace HospitalContracts.ViewModels
|
||||
[DisplayName("Способ приготовления")]
|
||||
public string ModeOfApplication { get; set; } = string.Empty;
|
||||
[DisplayName("Лекарство")]
|
||||
public string MedicinesName { get; set; } = string.Empty;
|
||||
public int MedicinesId { get; set; }
|
||||
[DisplayName("Симптом")]
|
||||
public Dictionary<int, ISymptomsModel> RecipeSymptoms
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
//[DisplayName("Симптом")]
|
||||
//public Dictionary<int, ISymptomsModel> RecipeSymptoms
|
||||
//{
|
||||
// get;
|
||||
// set;
|
||||
//} = new();
|
||||
[DisplayName("Процедура")]
|
||||
public Dictionary<int, IProceduresModel> RecipeProcedures
|
||||
{
|
||||
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class ReportKurseMedicinesViewModel
|
||||
{
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public int KurseId { get; set; }
|
||||
public List<string> Medicines { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class ReportRecipeMedicineViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public DateTime DateCreate { get; set; }
|
||||
public string MedicinesName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataBaseImplements.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -3,6 +3,7 @@ using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataBaseImplements.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -16,19 +17,21 @@ namespace HospitalDataBaseImplements.Implements
|
||||
public List<MedicinesViewModel> GetFullList()
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
return context.Medicines
|
||||
return context.Medicines.Include(x => x.Client)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<MedicinesViewModel> GetFilteredList(MedicinesSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.MedicinesName))
|
||||
if (string.IsNullOrEmpty(model.MedicinesName) && !model.ClientId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new HospitalDatabase();
|
||||
return context.Medicines
|
||||
.Where(x => x.MedicinesName.Contains(model.MedicinesName))
|
||||
|
||||
return context.Medicines
|
||||
.Include(x => x.Client)
|
||||
.Where(x => x.ClientId == model.ClientId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -73,7 +76,7 @@ namespace HospitalDataBaseImplements.Implements
|
||||
public MedicinesViewModel? Delete(MedicinesBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
var element = context.Medicines.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
var element = context.Medicines.Include(x => x.Client).FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Medicines.Remove(element);
|
||||
|
@ -3,6 +3,7 @@ using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataBaseImplements.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -16,19 +17,20 @@ namespace HospitalDataBaseImplements.Implements
|
||||
public List<ProceduresViewModel> GetFullList()
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
return context.Procedures
|
||||
return context.Procedures.Include(x => x.Client)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
public List<ProceduresViewModel> GetFilteredList(ProceduresSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ProceduresName))
|
||||
if (!model.Id.HasValue && !model.ClientId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new HospitalDatabase();
|
||||
return context.Procedures
|
||||
.Where(x => x.ProceduresName.Contains(model.ProceduresName))
|
||||
return context.Procedures
|
||||
.Include(x => x.Client)
|
||||
.Where(x => x.ClientId == model.ClientId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace HospitalDataBaseImplements.Implements
|
||||
public RecipesViewModel? Delete(RecipesBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
var element = context.Recipes.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
var element = context.Recipes.Include(x => x.Procedures).FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Recipes.Remove(element);
|
||||
@ -34,57 +34,61 @@ namespace HospitalDataBaseImplements.Implements
|
||||
return null;
|
||||
}
|
||||
using var context = new HospitalDatabase();
|
||||
return context.Recipes.Include(x => x.Client).FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
return context.Recipes.
|
||||
Include(x => x.Client).
|
||||
Include(x => x.Procedures).
|
||||
ThenInclude(x => x.Procedure).
|
||||
Include(x => x.Medicines).
|
||||
FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?
|
||||
.GetViewModel;
|
||||
}
|
||||
|
||||
public List<RecipesViewModel> GetFilteredList(RecipesSearchModel model)
|
||||
{
|
||||
if (!model.DateFrom.HasValue && !model.DateTo.HasValue && !model.ClientId.HasValue)
|
||||
if (model is null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new HospitalDatabase();
|
||||
if (model.DateFrom.HasValue)
|
||||
{
|
||||
return context.Recipes
|
||||
.Include(x => x.Medicines)
|
||||
.Include(x => x.Client)
|
||||
.Where(x => x.Date >= model.DateFrom && x.Date <= model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if (model.ClientId.HasValue)
|
||||
return context.Recipes
|
||||
|
||||
return context.Recipes.
|
||||
Include(x => x.Procedures).
|
||||
ThenInclude(x => x.Procedure)
|
||||
.Include(x => x.Medicines)
|
||||
.Include(x => x.Client)
|
||||
.Where(x => x.ClientId == model.ClientId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
return context.Recipes
|
||||
.Include(x => x.Medicines)
|
||||
.Include(x => x.Client)
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<RecipesViewModel> GetFullList()
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
return context.Recipes.Include(x => x.Client).Select(x => x.GetViewModel).ToList();
|
||||
return context.Recipes.Include(x => x.Procedures).
|
||||
ThenInclude(x => x.Procedure)
|
||||
.Include(x => x.Medicines)
|
||||
.Include(x => x.Client)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public RecipesViewModel? Insert(RecipesBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
var newRecipe = Recipes.Create(context, model);
|
||||
if (newRecipe == null)
|
||||
var newDrugCourse = Recipes.Create(model);
|
||||
if (newDrugCourse == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Recipes.Add(newRecipe);
|
||||
context.Recipes.Add(newDrugCourse);
|
||||
context.SaveChanges();
|
||||
return newRecipe.GetViewModel;
|
||||
return context.Recipes
|
||||
.Include(x => x.Procedures)
|
||||
.ThenInclude(x => x.Procedure)
|
||||
.Include(x => x.Medicines)
|
||||
.Include(x => x.Client)
|
||||
.FirstOrDefault(x => x.Id == newDrugCourse.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public RecipesViewModel? Update(RecipesBindingModel model)
|
||||
|
@ -3,6 +3,7 @@ using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataBaseImplements.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
75
HospitalDataBaseImplements/LoaderFromXML.cs
Normal file
75
HospitalDataBaseImplements/LoaderFromXML.cs
Normal file
@ -0,0 +1,75 @@
|
||||
using HospitalDataBaseImplements.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace HospitalDataBaseImplements
|
||||
{
|
||||
public class LoaderFromXML
|
||||
{
|
||||
private static readonly string IllnessFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XMLData\\Illness.xml");
|
||||
private static readonly string SymptomsFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XMLData\\Symptoms.xml");
|
||||
private static readonly string KursesFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XMLData\\Kurses.xml");
|
||||
|
||||
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
||||
{
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
return XDocument.Load(filename)?.Root?.Elements(xmlNodeName)?.Select(selectFunction)?.ToList();
|
||||
}
|
||||
return new List<T>();
|
||||
}
|
||||
/// <summary>
|
||||
/// Чтение пациентов из XML-файла
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static void LoadIllness() // (запуск после загрузки курсов)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
if (context.Illnesses.ToList().Count > 0)
|
||||
return;
|
||||
var list = LoadData(IllnessFileName, "Illness", x => Illness.Create(x)!)!;
|
||||
list.ForEach(x =>
|
||||
{
|
||||
context.Illnesses.Add(x);
|
||||
});
|
||||
context.SaveChanges();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Чтение лечений из XML-файла
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static void LoadKurses() // (запуск после загрузки симптомов)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
if (context.Kurse.ToList().Count > 0)
|
||||
return;
|
||||
//var list = LoadData(KursesFileName, "Kurses", x => Kurses.Create(context, x)!)!;
|
||||
//list.ForEach(x =>
|
||||
//{
|
||||
// context.Kurse.Add(x);
|
||||
//});
|
||||
//context.SaveChanges();
|
||||
}
|
||||
/// <summary>
|
||||
/// Чтение поцедур из XML-файла
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static void LoadSymptoms()// (запуск после старта программы)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
if (context.Symptomses.ToList().Count > 0)
|
||||
return;
|
||||
//var list = LoadData(SymptomsFileName, "Symptoms", x => Symptoms.Create(x)!)!;
|
||||
//list.ForEach(x =>
|
||||
//{
|
||||
// context.Symptomses.Add(x);
|
||||
//});
|
||||
//context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
namespace HospitalDataBaseImplements.Migrations
|
||||
{
|
||||
[DbContext(typeof(HospitalDatabase))]
|
||||
[Migration("20230407072756_InitialCreate")]
|
||||
[Migration("20230520015950_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@ -154,6 +154,9 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Group")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -164,6 +167,8 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Medicines");
|
||||
});
|
||||
|
||||
@ -175,6 +180,9 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ProceduresName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -185,6 +193,8 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Procedures");
|
||||
});
|
||||
|
||||
@ -337,10 +347,32 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
b.Navigation("Medicines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.Medicines", b =>
|
||||
{
|
||||
b.HasOne("HospitalDataBaseImplements.Models.Client", "Client")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.Procedures", b =>
|
||||
{
|
||||
b.HasOne("HospitalDataBaseImplements.Models.Client", "Client")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.Recipes", b =>
|
||||
{
|
||||
b.HasOne("HospitalDataBaseImplements.Models.Client", "Client")
|
||||
.WithMany("Recipes")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@ -378,7 +410,7 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.RecipesSymptoms", b =>
|
||||
{
|
||||
b.HasOne("HospitalDataBaseImplements.Models.Recipes", "Recipe")
|
||||
.WithMany("Symptoms")
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@ -394,11 +426,6 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
b.Navigation("Symptoms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Recipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.Illness", b =>
|
||||
{
|
||||
b.Navigation("Kurses");
|
||||
@ -414,8 +441,6 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.Recipes", b =>
|
||||
{
|
||||
b.Navigation("Procedures");
|
||||
|
||||
b.Navigation("Symptoms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.Symptoms", b =>
|
@ -40,34 +40,6 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
table.PrimaryKey("PK_Illnesses", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Medicines",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
MedicinesName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Group = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Medicines", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Procedures",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ProceduresName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Type = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Procedures", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Symptomses",
|
||||
columns: table => new
|
||||
@ -82,6 +54,74 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
table.PrimaryKey("PK_Symptomses", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Medicines",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
MedicinesName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Group = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Medicines", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Medicines_Clients_ClientId",
|
||||
column: x => x.ClientId,
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Procedures",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
ProceduresName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Type = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Procedures", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Procedures_Clients_ClientId",
|
||||
column: x => x.ClientId,
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "IllnessSymptomses",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
IllnessId = table.Column<int>(type: "int", nullable: false),
|
||||
SymptomsId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_IllnessSymptomses", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_IllnessSymptomses_Illnesses_IllnessId",
|
||||
column: x => x.IllnessId,
|
||||
principalTable: "Illnesses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_IllnessSymptomses_Symptomses_SymptomsId",
|
||||
column: x => x.SymptomsId,
|
||||
principalTable: "Symptomses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Kurse",
|
||||
columns: table => new
|
||||
@ -130,33 +170,7 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
column: x => x.MedicinesId,
|
||||
principalTable: "Medicines",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "IllnessSymptomses",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
IllnessId = table.Column<int>(type: "int", nullable: false),
|
||||
SymptomsId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_IllnessSymptomses", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_IllnessSymptomses_Illnesses_IllnessId",
|
||||
column: x => x.IllnessId,
|
||||
principalTable: "Illnesses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_IllnessSymptomses_Symptomses_SymptomsId",
|
||||
column: x => x.SymptomsId,
|
||||
principalTable: "Symptomses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@ -208,7 +222,7 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
column: x => x.RecipesId,
|
||||
principalTable: "Recipes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@ -262,6 +276,16 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
table: "Kurse",
|
||||
column: "MedicinesId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Medicines_ClientId",
|
||||
table: "Medicines",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Procedures_ClientId",
|
||||
table: "Procedures",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Recipes_ClientId",
|
||||
table: "Recipes",
|
||||
@ -324,10 +348,10 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
name: "Symptomses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Clients");
|
||||
name: "Medicines");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Medicines");
|
||||
name: "Clients");
|
||||
}
|
||||
}
|
||||
}
|
@ -151,6 +151,9 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Group")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -161,6 +164,8 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Medicines");
|
||||
});
|
||||
|
||||
@ -172,6 +177,9 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ProceduresName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -182,6 +190,8 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Procedures");
|
||||
});
|
||||
|
||||
@ -334,10 +344,32 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
b.Navigation("Medicines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.Medicines", b =>
|
||||
{
|
||||
b.HasOne("HospitalDataBaseImplements.Models.Client", "Client")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.Procedures", b =>
|
||||
{
|
||||
b.HasOne("HospitalDataBaseImplements.Models.Client", "Client")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.Recipes", b =>
|
||||
{
|
||||
b.HasOne("HospitalDataBaseImplements.Models.Client", "Client")
|
||||
.WithMany("Recipes")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@ -375,7 +407,7 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.RecipesSymptoms", b =>
|
||||
{
|
||||
b.HasOne("HospitalDataBaseImplements.Models.Recipes", "Recipe")
|
||||
.WithMany("Symptoms")
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@ -391,11 +423,6 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
b.Navigation("Symptoms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Recipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.Illness", b =>
|
||||
{
|
||||
b.Navigation("Kurses");
|
||||
@ -411,8 +438,6 @@ namespace HospitalDataBaseImplements.Migrations
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.Recipes", b =>
|
||||
{
|
||||
b.Navigation("Procedures");
|
||||
|
||||
b.Navigation("Symptoms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDataBaseImplements.Models.Symptoms", b =>
|
||||
|
@ -21,9 +21,6 @@ namespace HospitalDataBaseImplements.Models
|
||||
[Required]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
[ForeignKey("ClientId")]
|
||||
public virtual List<Recipes> Recipes { get; set; } = new();
|
||||
|
||||
public static Client? Create(ClientBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
|
@ -8,6 +8,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace HospitalDataBaseImplements.Models
|
||||
{
|
||||
@ -50,7 +51,7 @@ namespace HospitalDataBaseImplements.Models
|
||||
[ForeignKey("IllnessId")]
|
||||
public virtual List<IllnessSymptoms> Symptomses { get; set; } = new();
|
||||
|
||||
public static Illness Create(HospitalDatabase context, IllnessBindingModel model)
|
||||
public static Illness Create(HospitalDatabase context,IllnessBindingModel model)
|
||||
{
|
||||
return new Illness()
|
||||
{
|
||||
@ -67,6 +68,21 @@ namespace HospitalDataBaseImplements.Models
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
public static Illness? Create(XElement element)
|
||||
{
|
||||
if (element == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Illness()
|
||||
{
|
||||
//Surname = element.Element("Surname")!.Value,
|
||||
//Name = element.Element("Name")!.Value,
|
||||
//Patronymic = element.Element("Patronymic")?.Value,
|
||||
//BirthDate = DateTime.ParseExact(element.Element("BirthDate")!.Value, "dd.mm.yyyy", null),
|
||||
//TreatmentId = Convert.ToInt32(element.Element("TreatmentId")?.Value)
|
||||
};
|
||||
}
|
||||
public void Update(IllnessBindingModel model)
|
||||
{
|
||||
IllnessName = model.IllnessName;
|
||||
|
@ -14,60 +14,59 @@ namespace HospitalDataBaseImplements.Models
|
||||
public class Kurses : IKurseModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[ForeignKey("MedicinesId")]
|
||||
public int MedicinesId { get; private set; }
|
||||
public virtual Medicines Medicines { get; set; } = new();
|
||||
public string MedicinesName { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string Duration { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public int CountInDay { get; private set; }
|
||||
[ForeignKey("KurseId")]
|
||||
|
||||
public virtual List<IllnessKurse> IllnessKurses { get; set; } = new();
|
||||
public static Kurses? Create(KurseBindingModel model)
|
||||
[ForeignKey("MedicinesId")]
|
||||
public int MedicinesId { get; private set; }
|
||||
public virtual Medicines Medicines { get; set; } = new();
|
||||
public string MedicinesName { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string Duration { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public int CountInDay { get; private set; }
|
||||
[ForeignKey("KurseId")]
|
||||
|
||||
public virtual List<IllnessKurse> IllnessKurses { get; set; } = new();
|
||||
public static Kurses? Create(KurseBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Kurses()
|
||||
{
|
||||
Id = model.Id,
|
||||
MedicinesId = model.MedicinesId,
|
||||
MedicinesName = model.MedicinesName,
|
||||
Duration = model.Duration,
|
||||
CountInDay = model.CountInDay
|
||||
};
|
||||
return null;
|
||||
}
|
||||
public static Kurses Create(KurseViewModel model)
|
||||
return new Kurses()
|
||||
{
|
||||
return new Kurses
|
||||
{
|
||||
Id = model.Id,
|
||||
MedicinesId = model.MedicinesId,
|
||||
MedicinesName = model.MedicinesName,
|
||||
Duration = model.Duration,
|
||||
CountInDay = model.CountInDay
|
||||
};
|
||||
}
|
||||
public void Update(KurseBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
MedicinesName = model.MedicinesName;
|
||||
Duration = model.Duration;
|
||||
CountInDay = model.CountInDay;
|
||||
}
|
||||
public KurseViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
MedicinesId = MedicinesId,
|
||||
MedicinesName = MedicinesName,
|
||||
Duration = Duration,
|
||||
CountInDay = CountInDay
|
||||
Id = model.Id,
|
||||
MedicinesId = model.MedicinesId,
|
||||
Duration = model.Duration,
|
||||
CountInDay = model.CountInDay
|
||||
};
|
||||
}
|
||||
public static Kurses Create(KurseViewModel model)
|
||||
{
|
||||
return new Kurses
|
||||
{
|
||||
Id = model.Id,
|
||||
MedicinesId = model.MedicinesId,
|
||||
MedicinesName = model.MedicinesName,
|
||||
Duration = model.Duration,
|
||||
CountInDay = model.CountInDay
|
||||
};
|
||||
}
|
||||
public void Update(KurseBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
MedicinesName = model.MedicinesName;
|
||||
Duration = model.Duration;
|
||||
CountInDay = model.CountInDay;
|
||||
}
|
||||
public KurseViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
MedicinesId = MedicinesId,
|
||||
MedicinesName = MedicinesName,
|
||||
Duration = Duration,
|
||||
CountInDay = CountInDay
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ namespace HospitalDataBaseImplements.Models
|
||||
public class Medicines : IMedicinesModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int ClientId { get; private set; }
|
||||
public virtual Client Client { get; set; }
|
||||
[Required]
|
||||
public string MedicinesName { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
@ -27,6 +29,7 @@ namespace HospitalDataBaseImplements.Models
|
||||
return new Medicines()
|
||||
{
|
||||
Id = model.Id,
|
||||
ClientId = model.ClientId,
|
||||
MedicinesName = model.MedicinesName,
|
||||
Group = model.Group
|
||||
};
|
||||
@ -36,6 +39,7 @@ namespace HospitalDataBaseImplements.Models
|
||||
return new Medicines
|
||||
{
|
||||
Id = model.Id,
|
||||
ClientId = model.ClientId,
|
||||
MedicinesName = model.MedicinesName,
|
||||
Group = model.Group
|
||||
};
|
||||
@ -52,8 +56,11 @@ namespace HospitalDataBaseImplements.Models
|
||||
public MedicinesViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ClientId = ClientId,
|
||||
MedicinesName = MedicinesName,
|
||||
Group = Group
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,9 @@ namespace HospitalDataBaseImplements.Models
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public int ClientId { get; private set; }
|
||||
public virtual Client Client { get; set; }
|
||||
[Required]
|
||||
public string ProceduresName { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public string Type { get; private set; } = string.Empty;
|
||||
@ -26,6 +29,7 @@ namespace HospitalDataBaseImplements.Models
|
||||
return new Procedures()
|
||||
{
|
||||
Id = model.Id,
|
||||
ClientId = model.ClientId,
|
||||
ProceduresName = model.ProceduresName,
|
||||
Type = model.Type
|
||||
};
|
||||
@ -35,6 +39,7 @@ namespace HospitalDataBaseImplements.Models
|
||||
return new Procedures
|
||||
{
|
||||
Id = model.Id,
|
||||
ClientId = model.ClientId,
|
||||
ProceduresName = model.ProceduresName,
|
||||
Type = model.Type
|
||||
};
|
||||
@ -51,6 +56,7 @@ namespace HospitalDataBaseImplements.Models
|
||||
public ProceduresViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ClientId = ClientId,
|
||||
ProceduresName = ProceduresName,
|
||||
Type = Type
|
||||
};
|
||||
|
@ -21,7 +21,6 @@ namespace HospitalDataBaseImplements.Models
|
||||
public string Dose { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public DateTime Date { get; private set; } = DateTime.Now;
|
||||
[Required]
|
||||
public int ClientId { get; set; }
|
||||
public virtual Medicines Medicines { get; set; } = new();
|
||||
public int MedicinesId { get; private set; }
|
||||
@ -36,46 +35,43 @@ namespace HospitalDataBaseImplements.Models
|
||||
{
|
||||
if (_recipeProcedures == null)
|
||||
{
|
||||
_recipeProcedures = Procedures.ToDictionary(recPC => recPC.ProcedureId, recPC =>
|
||||
recPC.Procedure as IProceduresModel);
|
||||
_recipeProcedures = Procedures.ToDictionary(recPC => recPC.ProcedureId, recPC =>
|
||||
recPC.Procedure as IProceduresModel);
|
||||
}
|
||||
return _recipeProcedures;
|
||||
}
|
||||
}
|
||||
[ForeignKey("RecipesId")]
|
||||
[ForeignKey("RecipesId")]
|
||||
public virtual List<RecipesProcedures> Procedures { get; set; } = new();
|
||||
|
||||
private Dictionary<int, ISymptomsModel>? _recipeSymptoms = null;
|
||||
[NotMapped]
|
||||
public Dictionary<int, ISymptomsModel> RecipeSymptoms
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_recipeSymptoms == null)
|
||||
{
|
||||
_recipeSymptoms = Symptoms.ToDictionary(recPC => recPC.SymptomsId, recPC => (recPC.Symptoms as ISymptomsModel));
|
||||
}
|
||||
return _recipeSymptoms;
|
||||
}
|
||||
}
|
||||
public virtual List<RecipesSymptoms> Symptoms { get; set; } = new();
|
||||
//private Dictionary<int, ISymptomsModel>? _recipeSymptoms = null;
|
||||
//[NotMapped]
|
||||
//public Dictionary<int, ISymptomsModel> RecipeSymptoms
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (_recipeSymptoms == null)
|
||||
// {
|
||||
// _recipeSymptoms = Symptoms.ToDictionary(recPC => recPC.SymptomsId, recPC => (recPC.Symptoms as ISymptomsModel));
|
||||
// }
|
||||
// return _recipeSymptoms;
|
||||
// }
|
||||
//}
|
||||
//public virtual List<RecipesSymptoms> Symptoms { get; set; } = new();
|
||||
|
||||
public static Recipes Create(HospitalDatabase context, RecipesBindingModel model)
|
||||
public static Recipes? Create(RecipesBindingModel model)
|
||||
{
|
||||
return new Recipes()
|
||||
{
|
||||
Id = model.Id,
|
||||
Dose = model.Dose,
|
||||
Date = model.Date,
|
||||
MedicinesId = model.MedicinesId,
|
||||
ClientId = model.ClientId,
|
||||
Procedures = model.RecipeProcedures.Select(x => new RecipesProcedures
|
||||
{
|
||||
Procedure = context.Procedures.First(y => y.Id == x.Key),
|
||||
}).ToList(),
|
||||
Symptoms = model.RecipeSymptoms.Select(x => new RecipesSymptoms
|
||||
{
|
||||
Symptoms = context.Symptomses.First(y => y.Id == x.Key),
|
||||
}).ToList()
|
||||
ModeOfApplication = model.ModeOfApplication,
|
||||
ClientId = model.ClientId
|
||||
//Symptoms = model.RecipeSymptoms.Select(x => new RecipesSymptoms
|
||||
//{
|
||||
// Symptoms = context.Symptomses.First(y => y.Id == x.Key),
|
||||
//}).ToList()
|
||||
};
|
||||
}
|
||||
public void Update(RecipesBindingModel model)
|
||||
@ -85,7 +81,8 @@ namespace HospitalDataBaseImplements.Models
|
||||
}
|
||||
public RecipesViewModel GetViewModel
|
||||
{
|
||||
get {
|
||||
get
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
return new RecipesViewModel
|
||||
{
|
||||
@ -93,8 +90,9 @@ namespace HospitalDataBaseImplements.Models
|
||||
Date = Date,
|
||||
ClientId = ClientId,
|
||||
ClientFIO = context.Clients.FirstOrDefault(x => x.Id == ClientId)?.ClientFIO ?? string.Empty,
|
||||
MedicinesId = MedicinesId,
|
||||
RecipeProcedures = RecipeProcedures,
|
||||
RecipeSymptoms = RecipeSymptoms
|
||||
//RecipeSymptoms = RecipeSymptoms
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -119,26 +117,26 @@ namespace HospitalDataBaseImplements.Models
|
||||
}
|
||||
_recipeProcedures = null;
|
||||
}
|
||||
public void UpdateSymptomses(HospitalDatabase context, RecipesBindingModel model)
|
||||
{
|
||||
var recipeSymptomses = context.RecipesSymptoms.Where(rec => rec.RecipesId == model.Id).ToList();
|
||||
if (recipeSymptomses != null && recipeSymptomses.Count > 0)
|
||||
{ // удалили те, которых нет в модели
|
||||
context.RecipesSymptoms.RemoveRange(recipeSymptomses.Where(rec
|
||||
=> !model.RecipeSymptoms.ContainsKey(rec.SymptomsId)));
|
||||
context.SaveChanges();
|
||||
}
|
||||
var recipe = context.Recipes.First(x => x.Id == Id);
|
||||
foreach (var pc in model.RecipeSymptoms)
|
||||
{
|
||||
context.RecipesSymptoms.Add(new RecipesSymptoms
|
||||
{
|
||||
Recipe = recipe,
|
||||
Symptoms = context.Symptomses.First(x => x.Id == pc.Key)
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_recipeSymptoms = null;
|
||||
}
|
||||
//public void UpdateSymptomses(HospitalDatabase context, RecipesBindingModel model)
|
||||
//{
|
||||
// var recipeSymptomses = context.RecipesSymptoms.Where(rec => rec.RecipesId == model.Id).ToList();
|
||||
// if (recipeSymptomses != null && recipeSymptomses.Count > 0)
|
||||
// { // удалили те, которых нет в модели
|
||||
// context.RecipesSymptoms.RemoveRange(recipeSymptomses.Where(rec
|
||||
// => !model.RecipeSymptoms.ContainsKey(rec.SymptomsId)));
|
||||
// context.SaveChanges();
|
||||
// }
|
||||
// var recipe = context.Recipes.First(x => x.Id == Id);
|
||||
// foreach (var pc in model.RecipeSymptoms)
|
||||
// {
|
||||
// context.RecipesSymptoms.Add(new RecipesSymptoms
|
||||
// {
|
||||
// Recipe = recipe,
|
||||
// Symptoms = context.Symptomses.First(x => x.Id == pc.Key)
|
||||
// });
|
||||
// context.SaveChanges();
|
||||
// }
|
||||
// _recipeSymptoms = null;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
91
HospitalDataBaseImplements/XMLData/Illness.xml
Normal file
91
HospitalDataBaseImplements/XMLData/Illness.xml
Normal file
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Illness>
|
||||
<Illness Id="1">
|
||||
<IllnessName>Ветрянка</IllnessName>
|
||||
<Form>Тяжелая</Form>
|
||||
<Symptoms>
|
||||
<SymptomId >1</SymptomId>
|
||||
<SymptomId >2</SymptomId>
|
||||
<SymptomId >3</SymptomId>
|
||||
</Symptoms>
|
||||
<Kurses>
|
||||
<KurseId >1</KurseId>
|
||||
<KurseId >2</KurseId>
|
||||
</Kurses>
|
||||
</Illness>
|
||||
<Illness Id="2">
|
||||
<IllnessName>Воспаление аппендицита</IllnessName>
|
||||
<Form>Легкая</Form>
|
||||
<Symptoms>
|
||||
<SymptomId >1</SymptomId>
|
||||
</Symptoms>
|
||||
<Kurses>
|
||||
<KurseId >1</KurseId>
|
||||
</Kurses>
|
||||
</Illness>
|
||||
<Illness Id="3">
|
||||
<IllnessName>ОРВИ</IllnessName>
|
||||
<Form>Средняя</Form>
|
||||
<Symptoms>
|
||||
<SymptomId >1</SymptomId>
|
||||
<SymptomId >2</SymptomId>
|
||||
</Symptoms>
|
||||
<Kurses>
|
||||
<KurseId >1</KurseId>
|
||||
<KurseId >3</KurseId>
|
||||
</Kurses>
|
||||
</Illness>
|
||||
<Illness Id="4">
|
||||
<IllnessName>Отравление</IllnessName>
|
||||
<Form>Тяжелая</Form>
|
||||
<Symptoms>
|
||||
<SymptomId >1</SymptomId>
|
||||
<SymptomId >2</SymptomId>
|
||||
<SymptomId >3</SymptomId>
|
||||
<SymptomId >4</SymptomId>
|
||||
<SymptomId >5</SymptomId>
|
||||
<SymptomId >6</SymptomId>
|
||||
</Symptoms>
|
||||
<Kurses>
|
||||
<KurseId >1</KurseId>
|
||||
<KurseId >2</KurseId>
|
||||
<KurseId >3</KurseId>
|
||||
<KurseId >4</KurseId>
|
||||
</Kurses>
|
||||
</Illness>
|
||||
<Illness Id="5">
|
||||
<IllnessName>Перелом</IllnessName>
|
||||
<Form>Средняя</Form>
|
||||
<Symptoms>
|
||||
<SymptomId >3</SymptomId>
|
||||
</Symptoms>
|
||||
<Kurses>
|
||||
<KurseId >1</KurseId>
|
||||
<KurseId >2</KurseId>
|
||||
</Kurses>
|
||||
</Illness>
|
||||
<Illness Id="6">
|
||||
<IllnessName>Мигрень</IllnessName>
|
||||
<Form>Тяжелая</Form>
|
||||
<Symptoms>
|
||||
<SymptomId >1</SymptomId>
|
||||
<SymptomId >3</SymptomId>
|
||||
<SymptomId >4</SymptomId>
|
||||
</Symptoms>
|
||||
<Kurses>
|
||||
<KurseId >1</KurseId>
|
||||
<KurseId >3</KurseId>
|
||||
<KurseId >4</KurseId>
|
||||
</Kurses>
|
||||
</Illness>
|
||||
<Illness Id="7">
|
||||
<IllnessName>Астма</IllnessName>
|
||||
<Form>Легкая</Form>
|
||||
<Symptoms>
|
||||
<SymptomId >5</SymptomId>
|
||||
</Symptoms>
|
||||
<Kurses>
|
||||
<KurseId >5</KurseId>
|
||||
</Kurses>
|
||||
</Illness>
|
||||
</Illness>
|
43
HospitalDataBaseImplements/XMLData/Kurses.xml
Normal file
43
HospitalDataBaseImplements/XMLData/Kurses.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Kurses>
|
||||
<Kurses Id="1">
|
||||
<CountInDay>4</CountInDay>
|
||||
<Duration>1 месяц</Duration>
|
||||
<MedicinesId>1</MedicinesId>
|
||||
</Kurses>
|
||||
<Kurses Id="2">
|
||||
<CountInDay>3</CountInDay>
|
||||
<Duration>1 месяц</Duration>
|
||||
<MedicinesId>1</MedicinesId>
|
||||
</Kurses>
|
||||
<Kurses Id="3">
|
||||
<CountInDay>1</CountInDay>
|
||||
<Duration>2 месяца</Duration>
|
||||
<MedicinesId>1</MedicinesId>
|
||||
</Kurses>
|
||||
<Kurses Id="4">
|
||||
<CountInDay>7</CountInDay>
|
||||
<Duration>1 неделя</Duration>
|
||||
<MedicinesId>1</MedicinesId>
|
||||
</Kurses>
|
||||
<Kurses Id="5">
|
||||
<CountInDay>2</CountInDay>
|
||||
<Duration>10 дней</Duration>
|
||||
<MedicinesId>1</MedicinesId>
|
||||
</Kurses>
|
||||
<Kurses Id="6">
|
||||
<CountInDay>5</CountInDay>
|
||||
<Duration>3 недели</Duration>
|
||||
<MedicinesId>1</MedicinesId>
|
||||
</Kurses>
|
||||
<Kurses Id="7">
|
||||
<CountInDay>3</CountInDay>
|
||||
<Duration>20 дней</Duration>
|
||||
<MedicinesId>1</MedicinesId>
|
||||
</Kurses>
|
||||
<Kurses Id="8">
|
||||
<CountInDay>2</CountInDay>
|
||||
<Duration>1,5 недели</Duration>
|
||||
<MedicinesId>1</MedicinesId>
|
||||
</Kurses>
|
||||
</Kurses>
|
35
HospitalDataBaseImplements/XMLData/Symptoms.xml
Normal file
35
HospitalDataBaseImplements/XMLData/Symptoms.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Symptoms>
|
||||
<Symptoms Id="1">
|
||||
<SymptomName>Кашель</SymptomName>
|
||||
<Description>Сухой</Description>
|
||||
</Symptoms>
|
||||
<Symptoms Id="2">
|
||||
<SymptomName>Отечность</SymptomName>
|
||||
<Description>Ноги</Description>
|
||||
</Symptoms>
|
||||
<Symptoms Id="3">
|
||||
<SymptomName>Заложенность носа</SymptomName>
|
||||
<Description>2 ноздри</Description>
|
||||
</Symptoms>
|
||||
<Symptoms Id="4">
|
||||
<SymptomName>Тошнота</SymptomName>
|
||||
<Description>Прозрачные выделения</Description>
|
||||
</Symptoms>
|
||||
<Symptoms Id="5">
|
||||
<SymptomName>Боль в сердце</SymptomName>
|
||||
<Description>Постоянная</Description>
|
||||
</Symptoms>
|
||||
<Symptoms Id="6">
|
||||
<SymptomName>Боль в животе</SymptomName>
|
||||
<Description>Умеренная</Description>
|
||||
</Symptoms>
|
||||
<Symptoms Id="7">
|
||||
<SymptomName>Боль</SymptomName>
|
||||
<Description>Тяжелая</Description>
|
||||
</Symptoms>
|
||||
<Symptoms Id="8">
|
||||
<SymptomName>Головокружение</SymptomName>
|
||||
<Description>При нагрузках</Description>
|
||||
</Symptoms>
|
||||
</Symptoms>
|
@ -12,5 +12,6 @@ namespace HospitalDataModels.Models
|
||||
string Form { get; }
|
||||
Dictionary<int, ISymptomsModel> IllnessSymptoms { get; }
|
||||
Dictionary<int, IKurseModel> IllnessKurse { get; }
|
||||
//int ClientId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -12,5 +12,6 @@ namespace HospitalDataModels.Models
|
||||
int CountInDay { get; }
|
||||
int MedicinesId { get; }
|
||||
string MedicinesName { get; }
|
||||
//int ClientId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -10,5 +10,6 @@ namespace HospitalDataModels.Models
|
||||
{
|
||||
string MedicinesName { get; }
|
||||
string Group { get; }
|
||||
int ClientId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -10,5 +10,6 @@ namespace HospitalDataModels.Models
|
||||
{
|
||||
string ProceduresName { get; }
|
||||
string Type { get; }
|
||||
int ClientId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,8 @@ namespace HospitalDataModels.Models
|
||||
DateTime Date { get; }
|
||||
string ModeOfApplication { get; }
|
||||
int MedicinesId { get; }
|
||||
int ClientId { get; }
|
||||
Dictionary<int, IProceduresModel> RecipeProcedures { get; }
|
||||
Dictionary<int, ISymptomsModel> RecipeSymptoms { get; }
|
||||
//Dictionary<int, ISymptomsModel> RecipeSymptoms { get; }
|
||||
}
|
||||
}
|
||||
|
@ -10,5 +10,6 @@ namespace HospitalDataModels.Models
|
||||
{
|
||||
string SymptomName { get; }
|
||||
string Description { get; }
|
||||
//int ClientId { get; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user