почти финиш

This commit is contained in:
Alenka 2024-05-01 00:03:20 +04:00
parent 5c8b768dc1
commit d0cc63abfe
35 changed files with 923 additions and 573 deletions

View File

@ -3,16 +3,16 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - HospitalDoctorApp</title>
<title>@ViewData["Title"] - HospitalPharmacistApp</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="~/HospitalDoctorApp.styles.css" asp-append-version="true" />
<link rel="stylesheet" href="~/HospitalPharmacistApp.styles.css" asp-append-version="true" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container-fluid">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">HospitalDoctorApp</a>
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">HospitalPharmacistApp</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>
@ -50,7 +50,7 @@
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2024 - HospitalDoctorApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
&copy; 2024 - HospitalPharmacistApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>

View File

@ -1 +1,52 @@

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

View File

@ -1 +1,165 @@

using HospitalContracts.BindingModels;
using HospitalContracts.ViewModels;
using PharmacistApp.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
namespace HospitalDoctorApp.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
[HttpGet]
public IActionResult CreatePatient()
{
return View();
}
[HttpGet]
public IActionResult CreateDisease()
{
return View();
}
[HttpGet]
public IActionResult CreateRecipe()
{
return View();
}
public IActionResult Index()
{
if (APIPharmacist.Doctor == null)
{
return Redirect("~/Home/Enter");
}
return
View(APIPharmacist.GetRequest<List<PatientViewModel>>($"api/visit/getpatients?doctorId={APIPharmacist.Doctor.Id}"));
}
public IActionResult IndexRecipes()
{
if (APIPharmacist.Doctor == null)
{
return Redirect("~/Home/Enter");
}
return
View(APIPharmacist.GetRequest<List<RecipeViewModel>>($"api/animal/getrecipelist?doctorId={APIPharmacist.Doctor.Id}"));
}
public IActionResult IndexDiseases()
{
if (APIPharmacist.Doctor == null)
{
return Redirect("~/Home/Enter");
}
return
View(APIPharmacist.GetRequest<List<DiseaseViewModel>>($"api/disease/getdiseases?diseaseId={APIPharmacist.Doctor.Id}"));
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
#region Вход и регистрация
[HttpGet]
public IActionResult Register()
{
return View();
}
[HttpGet]
public IActionResult Privacy()
{
if (APIPharmacist.Doctor == null)
{
return Redirect("~/Home/Enter");
}
return View(APIPharmacist.Doctor);
}
[HttpGet]
public IActionResult Enter()
{
return View();
}
[HttpPost]
public void Privacy(string login, string email, string password, string fio, string telephone)
{
if (APIPharmacist.Doctor == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
{
throw new Exception("Введите логин, пароль и ФИО");
}
APIPharmacist.PostRequest("api/doctor/updatedata", new DoctorBindingModel
{
Id = APIPharmacist.Doctor.Id,
FIO = fio,
Login = login,
Password = password,
MailAddress = email,
PhoneNumber = telephone
});
APIPharmacist.Doctor.FIO = fio;
APIPharmacist.Doctor.Login = login;
APIPharmacist.Doctor.Password = password;
APIPharmacist.Doctor.MailAddress = email;
APIPharmacist.Doctor.PhoneNumber = telephone;
Response.Redirect("Index");
}
[HttpPost]
public void Register(string login, string email, string password, string fio, string telephone)
{
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
{
throw new Exception("Введите логин, пароль и ФИО");
}
APIPharmacist.PostRequest("api/doctor/register", new DoctorBindingModel
{
FIO = fio,
Login = login,
Password = password,
MailAddress = email,
PhoneNumber = telephone
});
Response.Redirect("Enter");
return;
}
[HttpPost]
public void Enter(string login, string password)
{
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
{
throw new Exception("Введите логин и пароль");
}
APIPharmacist.Doctor = APIPharmacist.GetRequest<DoctorViewModel>($"api/doctor/login?login={login}&password={password}");
if (APIPharmacist.Doctor == null)
{
throw new Exception("Неверный логин/пароль");
}
Response.Redirect("Index");
}
#endregion
}
}

View File

@ -7,11 +7,8 @@
</PropertyGroup>
<ItemGroup>
<Content Remove="Views\Home\Registr.cshtml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Views\Home\Registr.cshtml" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NPOI" Version="2.7.0" />
</ItemGroup>
<ItemGroup>
@ -20,7 +17,6 @@
<ProjectReference Include="..\HospitalDatabaseImplement\HospitalDatabaseImplement.csproj" />
<ProjectReference Include="..\HospitalDataModels\HospitalDataModels.csproj" />
<ProjectReference Include="..\HospitalRestApi\HospitalRestApi.csproj" />
<ProjectReference Include="..\Hospital\HospitalView.csproj" />
</ItemGroup>
</Project>

View File

@ -1,14 +1,16 @@
using HospitalDoctorApp;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddControllersWithViews();
var app = builder.Build();
APIPharmacist.Connect(builder.Configuration);
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
@ -20,6 +22,8 @@ app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();

View File

@ -0,0 +1,28 @@
@{
ViewData["Title"] = "CreateDisease";
}
<head>
<link rel="stylesheet" href="~/css/createdisease.css" asp-append-version="true" />
</head>
<form method="post">
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Название конференции</label>
<input type="text"
placeholder="Введите название болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2">Начало</label>
<input type="text"
placeholder="Введите описание болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<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>

View File

@ -1,29 +1,22 @@
@{
ViewData["Title"] = "CreateDescriptionProcedure";
ViewData["Title"] = "CreateDescriptionProcedure";
}
<div class="text-center">
<h2 class="display-4">Создание описание к процедуре</h2>
</div>
<head>
<link rel="stylesheet" href="~/css/createdescriptionprocedure.css" asp-append-version="true" />
</head>
<form method="post">
<div class="row">
<div class="col-4">Процедура:</div>
<div class="col-8">
<select id="procedure" name="procedure" class="form-control" asp-items="@(new SelectList(@ViewBag.Procedures,"Id", "Name"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Текст:</div>
<div class="col-8">
<textarea id="text" name="text" rows="5" cols="80">
</textarea>
</div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4">
<input type="submit" value="Создать" class="btn
btn-primary" />
</div>
</div>
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Описание к процедуре</label>
<input type="text"
placeholder="Введите описание"
name="Name"
class="u-input u-input-rectangle" />
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<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>

View File

@ -1,28 +1,35 @@
@{
ViewData["Title"] = "CreateMedicine";
ViewData["Title"] = "CreatePatient";
}
<div class="text-center">
<h2 class="display-4">Создание лекарства</h2>
</div>
<head>
<link rel="stylesheet" href="~/css/createpatient.css" asp-append-version="true" />
</head>
<form method="post">
<div class="row">
<div class="col-4">Название:</div>
<div class="col-8">
<input type="text" name="name" id="name" />
</div>
</div>
<div class="row">
<div class="col-4">Цена:</div>
<div class="col-8">
<input type="text" name="price" id="price" />
</div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4">
<input type="submit" value="Создать" class="btn
btn-primary" />
</div>
</div>
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">ФИО участника</label>
<input type="text"
placeholder="Введите ФИО"
name="fio"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2">Дата рождения</label>
<input type="date"
placeholder="Введите дату рождения"
name="birthdate"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2">Адрес</label>
<input type="text"
placeholder="Введите адрес "
name="address"
class="u-input u-input-rectangle" />
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<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>

View File

@ -1,34 +1,51 @@
@{
ViewData["Title"] = "CreateProcedure";
ViewData["Title"] = "CreateRecipe";
}
<div class="text-center">
<h2 class="display-4">Создание процедуры</h2>
<h2 class="display-4">Создание рецепта</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Название:</div>
<div class="col-4">Описание:</div>
<div class="col-8">
<input type="text" name="name" id="name" />
<input type="text" name="description" />
</div>
</div>
<div class="row">
<div class="col-4">Лекарства:</div>
<div class="col-4">Болезнь:</div>
<div class="col-8">
<select name="medicines" class="form-control" multiple size="6" id="medicines">
@foreach (var medicine in ViewBag.Medicines)
{
<option value="@medicine.Id">@medicine.MedicineName</option>
}
</select>
<select id="disease" name="disease" class="form-control" asp-items="@(new SelectList(@ViewBag.Diseases, "Id", "Name"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Дата назначения:</div>
<div class="col-8">
<input type="datetime" name="date" />
</div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4">
<input type="submit" value="Создать" class="btn
btn-primary" />
<input type="submit" value="Создать" class="btn btn-primary" />
</div>
</div>
</form>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
</form>
<script>
$('#disease').on('change', function () {
//check();
});
function check() {
if (snack) {
$.ajax({
method: "POST",
url: "/Home/GetDisease",
data: { disease: disease },
success: function (result) {
$("#disease").val(result);
}
});
};
}
</script>

View File

@ -1,18 +0,0 @@
@{
ViewData["Title"] = "DeleteDescriptionProcedure";
}
<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">
<select id="descriptionProcedure" name="descriptionProcedure" class="form-control" asp-items="@(new SelectList(@ViewBag.DescriptionProcedures, "Id", "Description"))"></select>
</div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-8"><input type="submit" value="Удалить" class="btn btn-danger" /></div>
</div>
</form>

View File

@ -0,0 +1,28 @@
@{
ViewData["Title"] = "CreateDisease";
}
<head>
<link rel="stylesheet" href="~/css/createdisease.css" asp-append-version="true" />
</head>
<form method="post">
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Название конференции</label>
<input type="text"
placeholder="Введите название болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2">Начало</label>
<input type="text"
placeholder="Введите описание болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<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>

View File

@ -1,18 +1,28 @@
@{
ViewData["Title"] = "Delete";
ViewData["Title"] = "CreateDisease";
}
<div class="text-center">
<h2 class="display-4">Удаление лекарства</h2>
</div>
<head>
<link rel="stylesheet" href="~/css/createdisease.css" asp-append-version="true" />
</head>
<form method="post">
<div class="row">
<div class="col-4">Лекарство:</div>
<div class="col-8">
<select id="medicine" name="medicine" class="form-control" asp-items="@(new SelectList(@ViewBag.Medicines, "Id", "Name"))"></select>
</div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-8"><input type="submit" value="Удалить" class="btn btn-danger" /></div>
</div>
</form>
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Название конференции</label>
<input type="text"
placeholder="Введите название болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2">Начало</label>
<input type="text"
placeholder="Введите описание болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<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>

View File

@ -1,18 +1,28 @@
@{
ViewData["Title"] = "DeleteProcedure";
ViewData["Title"] = "CreateDisease";
}
<div class="text-center">
<h2 class="display-4">Удаление процедуры</h2>
</div>
<head>
<link rel="stylesheet" href="~/css/createdisease.css" asp-append-version="true" />
</head>
<form method="post">
<div class="row">
<div class="col-4">Процедура:</div>
<div class="col-8">
<select id="procedure" name="procedure" class="form-control" asp-items="@(new SelectList(@ViewBag.Procedures, "Id", "Name"))"></select>
</div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-8"><input type="submit" value="Удалить" class="btn btn-danger" /></div>
</div>
</form>s
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Название конференции</label>
<input type="text"
placeholder="Введите название болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2">Начало</label>
<input type="text"
placeholder="Введите описание болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<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>

View File

@ -1,53 +0,0 @@
@using HospitalContracts.ViewModels
@model List<DescriptionProcedureViewModel>
@{
ViewData["Title"] = "DescriptionProcedure";
}
<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 asp-action="CreateDescriptionProcedure">Создать описание к процедуре</a>
<a asp-action="UpdateDescriptionProcedure">Обновить описание к процедуре</a>
<a asp-action="DeleteDescriptionProcedure">Удалить описание к процедуре</a>
</p>
<table class="table">
<thead>
<tr>
<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.Description)
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -1,20 +1,35 @@
@{
ViewData["Title"] = "Enter";
}
<head>
<link rel="stylesheet" href="~/css/entry.css" asp-append-version="true" />
</head>
<div class="text-center">
<h2 class="display-4">Вход в приложение</h2>
<h2
class="u-text u-text-custom-color-1 u-text-default u-text-1"
>
Вход
</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Email:</div>
<div class="col-8"><input type="text" name="email" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Вход" class="btn btnprimary" /></div>
</div>
<div class="u-form-group u-label-top u-form-group-1">
<label class="u-label u-text-custom-color-1 u-label-1">Электронная почта</label>
<input
type="text"
placeholder="Введите свой логин"
name="login"
class="u-input u-input-rectangle u-input-1"/>
</div>
<div class="u-form-group u-label-top u-form-group-2">
<label class="u-label u-text-custom-color-1 u-label-2">Пароль</label>
<input
type="password"
placeholder="Введите свой пароль"
name="password"
class="u-input u-input-rectangle u-input-2"/>
</div>
<div class="u-align-center u-form-group u-form-submit u-label-top" style="padding-bottom: 120px">
<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>

View File

@ -1,12 +1,15 @@
@using HospitalContracts.ViewModels
@model List<MedicineViewModel>
@model List<PatientViewModel>
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Лекарства</h1>
<h1 class="display-4">Пациенты</h1>
</div>
<div class="text-center">
@{
if (Model == null)
@ -15,10 +18,12 @@
return;
}
<p>
<a asp-action="CreateMedicine">Создать лекарство</a>
<a asp-action="UpdateMedicine">Обновить лекарство</a>
<a asp-action="DeleteMedicine">Удалить лекарство</a>
<a asp-action="MedicineAnimals">Связать лекарства и процедуры</a>
<a asp-action="Update">Редактировать пациента</a>
<a asp-action="Delete">Удалить пациента</a>
<a asp-action="ServiceVisits">Связать пацииента и процедуру</a>
</p>
<p>
<a asp-action="Create">Создать пациента</a>
</p>
<table class="table">
<thead>
@ -30,8 +35,9 @@
Название
</th>
<th>
Цена
Дата
</th>
</tr>
</thead>
<tbody>
@ -39,20 +45,19 @@
{
<tr>
<td>
@Html.DisplayFor(modelItem =>
item.Id)
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.FIO)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.Name)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.Price)
@Html.DisplayFor(modelItem => item.Address)
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>

View File

@ -0,0 +1,62 @@
@using HospitalContracts.ViewModels
@model List<DiseaseViewModel>
@{
ViewData["Title"] = "IndexDiseases";
}
<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 asp-action="UpdateAnimal">Редактировать болезнь</a>
<a asp-action="DeleteAnimal">Удалить болезнь</a>
</p>
<p>
<a asp-action="CreateAnimal">Создать болезнь</a>
</p>
<table class="table">
<thead>
<tr>
<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.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -0,0 +1,63 @@
@using HospitalContracts.ViewModels
@model List<RecipeViewModel>
@{
ViewData["Title"] = "IndexRecipe";
}
<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 asp-action="Update">Редактировать рецепт</a>
<a asp-action="Delete">Удалить рецепт</a>
<a asp-action="ServiceVisits">Связать рецепт и пациента</a>
</p>
<p>
<a asp-action="Create">Создать рецепт</a>
</p>
<table class="table">
<thead>
<tr>
<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.Description)
</td>
<td>
@Html.DisplayFor(modelItem => item.IssueDate)
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -0,0 +1,28 @@
@{
ViewData["Title"] = "CreateDisease";
}
<head>
<link rel="stylesheet" href="~/css/createdisease.css" asp-append-version="true" />
</head>
<form method="post">
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Название конференции</label>
<input type="text"
placeholder="Введите название болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2">Начало</label>
<input type="text"
placeholder="Введите описание болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<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>

View File

@ -1,65 +0,0 @@
@using HospitalContracts.ViewModels;
@{
ViewData["Title"] = "MedicineRecipe";
}
<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">
<select id="medicine" name="medicine" class="form-control" asp-items="@(new SelectList(@ViewBag.Medicines, "Id", "Name"))"></select>
</div>
</div>
<input style = "visibility: hidden" type="text" name="name" id="name" class="form-control" />
<input style = "visibility: hidden" type="text" id="price" name="price" class="form-control" />
<div class="row">
<div class="col-4">Рецепт:</div>
<div class="col-8">
<select name="recipes" class="form-control" multiple size="5" id="recipes">
@foreach (var recipe in ViewBag.Recipes)
{
<option value="@recipe.Id" id="@recipe.recipeName">@recipe.RecipeName</option>
}
</select>
</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>
@section Scripts
{
<script>
function check() {
var medicine = $('#medicine').val();
$("#recipes option:selected").removeAttr("selected");
if (medicine) {
$.ajax({
method: "GET",
url: "/Home/GetMedicine",
data: { medicineId: medicine },
success: function (result) {
console.log(result.item2);
$('#name').val(result.item1.medicineName);
$('#price').val(result.item1.price);
$.map(result.item2, function (n) {
console.log("#" + n);
$("#" + n).attr("selected", "selected")
});
}
});
};
}
check();
$('#medicine').on('change', function () {
check();
});
</script>
}

View File

@ -1,28 +1,60 @@
@using HospitalContracts.ViewModels
@model PharmacistViewModel
@model DoctorViewModel
@{
ViewData["Title"] = "Privacy Policy";
ViewData["Title"] = "Privacy";
}
<head>
<link rel="stylesheet" href="~/css/register.css" asp-append-version="true" />
</head>
<div class="text-center">
<h2 class="display-4">Личные данные</h2>
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Мои данные </h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Login:</div>
<div class="col-8"><input type="text" name="login" value="@Model.Login" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" value="@Model.Password" /></div>
</div>
<div class="row">
<div class="col-4">ФИО:</div>
<div class="col-8"><input type="text" name="fio" value="@Model.FIO" /></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>
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Логин</label>
<input type="text"
placeholder="Введите логин"
name="login"
value="@Model.Login"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2">Электронная почта</label>
<input type="email"
placeholder="Введите электронную почту"
name="email"
value="@Model.MailAddress"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-group u-label-top u-form-group-3">
<label class="u-label u-text-custom-color-1 u-label-3">ФИО</label>
<input type="text"
placeholder="Введите ФИО"
name="fio"
value="@Model.FIO"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-group u-label-top u-form-group-4">
<label class="u-label u-text-custom-color-1 u-label-4">Номер телефона</label>
<input type="text"
name="telephone"
class="u-input u-input-rectangle"
value="@Model.PhoneNumber"
placeholder="Введите номер телефона" />
</div>
<div class="u-form-group u-label-top u-form-group-5">
<label class="u-label u-text-custom-color-1 u-label-5">Пароль</label>
<input type="text"
placeholder="Введите пароль"
name="password"
value="@Model.Password"
class="u-input u-input-rectangle" />
</div>
<div class="u-align-center u-form-group u-form-submit u-label-top"
style="padding-bottom: 120px">
<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>

View File

@ -1,51 +0,0 @@
@using HospitalContracts.ViewModels
@model List<ProcedureViewModel>
@{
ViewData["Title"] = "Procedures";
}
<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 asp-action="CreateProcedure">Создать процедуру</a>
<a asp-action="UpdateProcedure">Обновить процедуру</a>
<a asp-action="DeleteProcedure">Удалить процедуру</a>
</p>
<table class="table">
<thead>
<tr>
<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.Name)
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -0,0 +1,45 @@
@{
ViewData["Title"] = "Register";
}
<head>
<link rel="stylesheet" href="~/css/register.css" asp-append-version="true" />
</head>
<div class="text-center">
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Регистрация </h2>
</div>
<form method="post">
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Логин</label>
<input type="text"
placeholder="Введите логин"
name="login"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-group u-label-top u-form-group-3">
<label class="u-label u-text-custom-color-1 u-label-3">ФИО</label>
<input type="text"
placeholder="Введите ФИО"
name="fio"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-group u-label-top u-form-group-4">
<label class="u-label u-text-custom-color-1 u-label-4">Номер телефона</label>
<input type="text"
name="telephone"
class="u-input u-input-rectangle"
placeholder="Введите номер телефона" />
</div>
<div class="u-form-group u-label-top u-form-group-5">
<label class="u-label u-text-custom-color-1 u-label-5">Пароль</label>
<input type="password"
placeholder="Введите пароль"
name="password"
class="u-input u-input-rectangle" />
</div>
<div class="u-align-center u-form-group u-form-submit u-label-top"
style="padding-bottom: 120px">
<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>

View File

@ -1,48 +0,0 @@
@{
ViewData["Title"] = "Register";
}
< div class= "text-center" >
< h2 class= "display-4" > Регистрация </ h2 >
</ div >
< form method = "post" >
< div class= "row" >
< div class= "col-4" > Email:</ div >
< div class= "col-8" >< input type = "text" name = "email" /></ div >
</ div >
< div class= "row" >
< div class= "col-4" > Пароль:</ div >
< div class= "col-8" >< input type = "password" name = "password" /></ div >
</ div >
< div class= "row" >
< div class= "col-4" > ФИО:</ div >
< div class= "col-8" >< input type = "text" name = "fio" /></ 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 >

View File

@ -1,65 +1,28 @@
@{
ViewData["Title"] = "UpdateDescriptionProcedure";
ViewData["Title"] = "CreateDisease";
}
<div class="text-center">
<h2 class="display-4">Обновление описания к процедуре</h2>
</div>
<head>
<link rel="stylesheet" href="~/css/createdisease.css" asp-append-version="true" />
</head>
<form method="post">
<div class="row">
<div class="col-4">Описание:</div>
<div class="col-8">
<select id="descriptionProcedure" name="descriptionProcedure" class="form-control" asp-items="@(new SelectList(@ViewBag.DescriptionProcedures,"Id", "Text"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Процедура:</div>
<div class="col-8">
<select name="procedure" class="form-control" id="procedure">
@foreach (var procedure in ViewBag.Procedures)
{
<option value="@procedure.Id" id="@procedure.Id">@procedure.ProcedureName</option>
}
</select>
</div>
</div>
<div class="row">
<div class="col-4">Текст:</div>
<div class="col-8">
<textarea id="text" name="text" rows="5" cols="80">
</textarea>
</div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4">
<input type="submit" value="Создать" class="btn
btn-primary" />
</div>
</div>
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Название конференции</label>
<input type="text"
placeholder="Введите название болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2">Начало</label>
<input type="text"
placeholder="Введите описание болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<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>
<script>
function check() {
var descriptionProcedure = $('#descriptionProcedure').val();
$("#procedure option:selected").removeAttr("selected");
if (descriptionProcedure) {
$.ajax({
method: "GET",
url: "/Home/GetdescriptionProcedure",
data: { descriptionProcedureId: descriptionProcedure },
success: function (result) {
console.log(result.item2);
$('#text').val(result.text);
$("#" + result.procedureId).attr("selected", "selected")
}
});
};
}
check();
$('#descriptionProcedure').on('change', function () {
check();
});
</script>

View File

@ -1,56 +1,28 @@
@using HospitalContracts.ViewModels;
@{
ViewData["Title"] = "UpdateMedicine";
@{
ViewData["Title"] = "CreateDisease";
}
<div class="text-center">
<h2 class="display-4">Редактирование лекарства</h2>
</div>
<head>
<link rel="stylesheet" href="~/css/createdisease.css" asp-append-version="true" />
</head>
<form method="post">
<div class="row">
<div class="col-4">Лекарство:</div>
<div class="col-8">
<select id="medicine" name="medicine" class="form-control" asp-items="@(new SelectList(@ViewBag.Medicines, "Id", "Name"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Название:</div>
<div class="col-8"><input type="text" name="name" id="name" class="form-control" /></div>
</div>
<div class="row">
<div class="col-4">Цена:</div>
<div class="col-8"><input type="text" id="price" name="price" class="form-control" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
</div>
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Название конференции</label>
<input type="text"
placeholder="Введите название болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2">Начало</label>
<input type="text"
placeholder="Введите описание болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<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>
@section Scripts
{
<script>
function check() {
var medicine = $('#medicine').val();
$("#animals option:selected").removeAttr("selected");
if (medicine) {
$.ajax({
method: "GET",
url: "/Home/GetMedicine",
data: { medicineId: medicine },
success: function (result) {
console.log(result.item2);
$('#name').val(result.item1.medicineName);
$('#price').val(result.item1.price);
}
});
};
}
check();
$('#medicine').on('change', function () {
check();
});
</script>
}

View File

@ -1,71 +1,28 @@
@using HospitalContracts.ViewModels;
@{
ViewData["Title"] = "UpdateProcedure";
@{
ViewData["Title"] = "CreateDisease";
}
<div class="text-center">
<h2 class="display-4">Редактирование процедуры</h2>
</div>
<head>
<link rel="stylesheet" href="~/css/createdisease.css" asp-append-version="true" />
</head>
<form method="post">
<div class="row">
<div class="col-4">Процедура:</div>
<div class="col-8">
<select id="procedure" name="procedure" class="form-control" asp-items="@(new SelectList(@ViewBag.Procedures, "Id", "Name"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Название:</div>
<div class="col-8"><input type="text" name="name" id="name" class="form-control" /></div>
</div>
<div class="row">
<div class="col-4">Цена:</div>
<div class="col-8"><input type="text" id="price" name="price" class="form-control" /></div>
</div>
<div class="row">
<div class="col-4">Лекарства:</div>
<div class="col-8">
<select name="medicines" class="form-control" multiple size="5" id="medicines">
@foreach (var medicine in ViewBag.Medicines)
{
<option value="@medicine.Id" id="@medicine.MedicineName">@medicine.MedicineName</option>
}
</select>
</div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
</div>
<div class="u-form-group u-form-name u-label-top">
<label class="u-label u-text-custom-color-1 u-label-1">Название конференции</label>
<input type="text"
placeholder="Введите название болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2">Начало</label>
<input type="text"
placeholder="Введите описание болезни"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">
<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>
@section Scripts
{
<script>
function check() {
var procedure = $('#procedure').val();
$("#medicines option:selected").removeAttr("selected");
if (procedure) {
$.ajax({
method: "GET",
url: "/Home/Getprocedure",
data: { procedureId: procedure },
success: function (result) {
console.log(result.item2);
$('#name').val(result.item1.procedureName);
$.map(result.item2, function (n) {
console.log("#" + n);
$("#" + n).attr("selected", "selected")
});
}
});
};
}
check();
$('#procedure').on('change', function () {
check();
});
</script>
}

View File

@ -0,0 +1,25 @@
@model ErrorViewModel
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>

View File

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - HospitalDoctorApp</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="~/HospitalDoctorApp.styles.css" asp-append-version="true" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container-fluid">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">HospitalDoctorApp</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>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex flex-smrow-reverse">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="IndexRecipes">Рецепты</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="IndexDiseases">Болезни</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Index">Пациенты</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Enter">Вход</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Register">Регистрация</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2024 - HospitalDoctorApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>

View File

@ -0,0 +1,48 @@
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
for details on configuring this project to bundle and minify static web assets. */
a.navbar-brand {
white-space: normal;
text-align: center;
word-break: break-all;
}
a {
color: #0077cc;
}
.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.border-top {
border-top: 1px solid #e5e5e5;
}
.border-bottom {
border-bottom: 1px solid #e5e5e5;
}
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}
button.accept-policy {
font-size: 1rem;
line-height: inherit;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
white-space: nowrap;
line-height: 60px;
}

View File

@ -0,0 +1,2 @@
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>

View File

@ -1,3 +1,3 @@
@using PharmacistApp
@using HospitalDoctorApp
@using PharmacistApp.Models
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -1,5 +1,4 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",

View File

@ -6,5 +6,5 @@
}
},
"AllowedHosts": "*",
"IPAddress": "http://localhost:5025/"
"IPAddress": "http://localhost:5092/"
}