mission completed

This commit is contained in:
Alenka 2024-05-01 16:44:54 +04:00
parent d6abaccf9b
commit b3f954abd7
21 changed files with 151 additions and 157 deletions

View File

@ -1,32 +0,0 @@
@using HospitalContracts.ViewModels;
@{
ViewData["Title"] = "PatientRecipes";
}
<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="recipe" name="recipe" class="form-control")"></select>
</div>
</div>
<div class="row">
<div class="col-4">Пациенты:</div>
<div class="col-8">
<select name="patients" class="form-control" multiple size="5" id="patients">
</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>

View File

@ -8,20 +8,20 @@ namespace HospitalDoctorApp
{
public class APIPharmacist
{
private static readonly HttpClient _doctor = new();
private static readonly HttpClient _pharmacist = new();
public static DoctorViewModel? Doctor { get; set; } = null;
public static PharmacistViewModel? Pharmacist { 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"));
_pharmacist.BaseAddress = new Uri(configuration["IPAddress"]);
_pharmacist.DefaultRequestHeaders.Accept.Clear();
_pharmacist.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
}
public static T? GetRequest<T>(string requestUrl)
{
var response = _doctor.GetAsync(requestUrl);
var response = _pharmacist.GetAsync(requestUrl);
var result = response.Result.Content.ReadAsStringAsync().Result;
if (response.Result.IsSuccessStatusCode)
@ -39,7 +39,7 @@ namespace HospitalDoctorApp
var json = JsonConvert.SerializeObject(model);
var data = new StringContent(json, Encoding.UTF8, "application/json");
var response = _doctor.PostAsync(requestUrl, data);
var response = _pharmacist.PostAsync(requestUrl, data);
var result = response.Result.Content.ReadAsStringAsync().Result;

View File

@ -3,8 +3,9 @@ using HospitalContracts.ViewModels;
using PharmacistApp.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using HospitalDoctorApp;
namespace HospitalDoctorApp.Controllers
namespace HospitalPharmacistApp.Controllers
{
public class HomeController : Controller
{
@ -35,32 +36,32 @@ namespace HospitalDoctorApp.Controllers
public IActionResult Index()
{
if (APIPharmacist.Doctor == null)
if (APIPharmacist.Pharmacist == null)
{
return Redirect("~/Home/Enter");
}
return
View(APIPharmacist.GetRequest<List<PatientViewModel>>($"api/visit/getpatients?doctorId={APIPharmacist.Doctor.Id}"));
View(APIPharmacist.GetRequest<List<PatientViewModel>>($"api/visit/getpatients?PharmacistId={APIPharmacist.Pharmacist.Id}"));
}
public IActionResult IndexRecipes()
{
if (APIPharmacist.Doctor == null)
if (APIPharmacist.Pharmacist == null)
{
return Redirect("~/Home/Enter");
}
return
View(APIPharmacist.GetRequest<List<RecipeViewModel>>($"api/animal/getrecipelist?doctorId={APIPharmacist.Doctor.Id}"));
View(APIPharmacist.GetRequest<List<RecipeViewModel>>($"api/animal/getrecipelist?PharmacistId={APIPharmacist.Pharmacist.Id}"));
}
public IActionResult IndexDiseases()
{
if (APIPharmacist.Doctor == null)
if (APIPharmacist.Pharmacist == null)
{
return Redirect("~/Home/Enter");
}
return
View(APIPharmacist.GetRequest<List<DiseaseViewModel>>($"api/disease/getdiseases?diseaseId={APIPharmacist.Doctor.Id}"));
View(APIPharmacist.GetRequest<List<DiseaseViewModel>>($"api/disease/getdiseases?diseaseId={APIPharmacist.Pharmacist.Id}"));
}
@ -83,11 +84,11 @@ View(APIPharmacist.GetRequest<List<DiseaseViewModel>>($"api/disease/getdiseases?
[HttpGet]
public IActionResult Privacy()
{
if (APIPharmacist.Doctor == null)
if (APIPharmacist.Pharmacist == null)
{
return Redirect("~/Home/Enter");
}
return View(APIPharmacist.Doctor);
return View(APIPharmacist.Pharmacist);
}
[HttpGet]
@ -100,7 +101,7 @@ View(APIPharmacist.GetRequest<List<DiseaseViewModel>>($"api/disease/getdiseases?
[HttpPost]
public void Privacy(string login, string email, string password, string fio, string telephone)
{
if (APIPharmacist.Doctor == null)
if (APIPharmacist.Pharmacist == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
@ -108,21 +109,21 @@ View(APIPharmacist.GetRequest<List<DiseaseViewModel>>($"api/disease/getdiseases?
{
throw new Exception("Введите логин, пароль и ФИО");
}
APIPharmacist.PostRequest("api/doctor/updatedata", new DoctorBindingModel
APIPharmacist.PostRequest("api/Pharmacist/updatedata", new PharmacistBindingModel
{
Id = APIPharmacist.Doctor.Id,
Id = APIPharmacist.Pharmacist.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;
APIPharmacist.Pharmacist.FIO = fio;
APIPharmacist.Pharmacist.Login = login;
APIPharmacist.Pharmacist.Password = password;
APIPharmacist.Pharmacist.PhoneNumber = telephone;
Response.Redirect("Index");
}
@ -133,12 +134,12 @@ View(APIPharmacist.GetRequest<List<DiseaseViewModel>>($"api/disease/getdiseases?
{
throw new Exception("Введите логин, пароль и ФИО");
}
APIPharmacist.PostRequest("api/doctor/register", new DoctorBindingModel
APIPharmacist.PostRequest("api/Pharmacist/register", new PharmacistBindingModel
{
FIO = fio,
Login = login,
Password = password,
MailAddress = email,
PhoneNumber = telephone
});
@ -153,8 +154,8 @@ View(APIPharmacist.GetRequest<List<DiseaseViewModel>>($"api/disease/getdiseases?
{
throw new Exception("Введите логин и пароль");
}
APIPharmacist.Doctor = APIPharmacist.GetRequest<DoctorViewModel>($"api/doctor/login?login={login}&password={password}");
if (APIPharmacist.Doctor == null)
APIPharmacist.Pharmacist = APIPharmacist.GetRequest<PharmacistViewModel>($"api/Pharmacist/login?login={login}&password={password}");
if (APIPharmacist.Pharmacist == null)
{
throw new Exception("Неверный логин/пароль");
}

View File

@ -1,5 +1,5 @@
@{
ViewData["Title"] = "CreateDisease";
ViewData["Title"] = "AddMedicineToRecipe";
}
<head>
@ -8,17 +8,17 @@
<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>
<label class="u-label u-text-custom-color-1 u-label-1">Название лекарства</label>
<input type="text"
placeholder="Введите название болезни"
name="conferenceName"
placeholder="Введите название лекарства"
name="medicineName"
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"
placeholder="Введите описание лекарства"
name="medicineName"
class="u-input u-input-rectangle" />
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">

View File

@ -3,18 +3,24 @@
}
<head>
<link rel="stylesheet" href="~/css/createdescriptionprocedure.css" asp-append-version="true" />
<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>
<label class="u-label u-text-custom-color-1 u-label-1">Название описания процедуры</label>
<input type="text"
placeholder="Введите описание"
name="Name"
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>

View File

@ -1,5 +1,5 @@
@{
ViewData["Title"] = "CreatePatient";
ViewData["Title"] = "CreateMedicine";
}
<head>
@ -8,23 +8,17 @@
<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>
<label class="u-label u-text-custom-color-1 u-label-1">Название</label>
<input type="text"
placeholder="Введите ФИО"
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>
<label class="u-label u-text-custom-color-1 u-label-2">Страна производителя</label>
<input type="text"
placeholder="Введите адрес "
placeholder="Введите страну производителя "
name="address"
class="u-input u-input-rectangle" />
</div>

View File

@ -1,9 +1,9 @@
@{
ViewData["Title"] = "CreateRecipe";
ViewData["Title"] = "CreateProcedure";
}
<div class="text-center">
<h2 class="display-4">Создание рецепта</h2>
<h2 class="display-4">Создание процедуры</h2>
</div>
<form method="post">
<div class="row">
@ -13,17 +13,12 @@
</div>
</div>
<div class="row">
<div class="col-4">Болезнь:</div>
<div class="col-4">Название:</div>
<div class="col-8">
<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" />
<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-8"></div>
<div class="col-4">
@ -33,17 +28,17 @@
<script src="~/lib/jquery/dist/jquery.min.js"></script>
</form>
<script>
$('#disease').on('change', function () {
$('#procedure').on('change', function () {
//check();
});
function check() {
if (snack) {
$.ajax({
method: "POST",
url: "/Home/GetDisease",
data: { disease: disease },
url: "/Home/Getprocedure",
data: { procedure: procedure },
success: function (result) {
$("#disease").val(result);
$("#procedure").val(result);
}
});
};

View File

@ -0,0 +1,28 @@
@{
ViewData["Title"] = "DeleteDescriptionProcedure";
}
<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="DescriptionProcedureName"
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="DescriptionProcedureName"
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,5 +1,5 @@
@{
ViewData["Title"] = "CreateDisease";
ViewData["Title"] = "DeleteMedicine";
}
<head>
@ -8,17 +8,17 @@
<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>
<label class="u-label u-text-custom-color-1 u-label-1">Название лекарства</label>
<input type="text"
placeholder="Введите название болезни"
name="conferenceName"
placeholder="Введите название лекарства"
name="medicineName"
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"
placeholder="Введите страну"
name="medicineName"
class="u-input u-input-rectangle" />
</div>
<div class="u-align-right u-form-group u-form-submit u-label-top">

View File

@ -1,5 +1,5 @@
@{
ViewData["Title"] = "CreateDisease";
ViewData["Title"] = "DeleteProcedure";
}
<head>
@ -8,16 +8,16 @@
<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>
<label class="u-label u-text-custom-color-1 u-label-1">Название процедуры</label>
<input type="text"
placeholder="Введите название болезни"
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="Введите описание болезни"
placeholder="Введите описание"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>

View File

@ -13,7 +13,7 @@
</div>
<form method="post">
<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>
<label class="u-label u-text-custom-color-1 u-label-1">Логин</label>
<input
type="text"
placeholder="Введите свой логин"

View File

@ -1,13 +1,13 @@
@using HospitalContracts.ViewModels
@model List<PatientViewModel>
@model List<MedicineViewModel>
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Пациенты</h1>
<h1 class="display-4">Лекарства</h1>
</div>
<div class="text-center">
@ -18,12 +18,12 @@
return;
}
<p>
<a asp-action="Update">Редактировать пациента</a>
<a asp-action="Delete">Удалить пациента</a>
<a asp-action="ServiceVisits">Связать пацииента и процедуру</a>
<a asp-action="UpdatePatient">Редактировать лекарство</a>
<a asp-action="DeletePatient">Удалить лекарство</a>
<a asp-action="ServiceVisits">Связать лекарство и рецепт</a>
</p>
<p>
<a asp-action="Create">Создать пациента</a>
<a asp-action="CreatePatient">Создать лекарство</a>
</p>
<table class="table">
<thead>
@ -35,7 +35,7 @@
Название
</th>
<th>
Дата
Страна производителя
</th>
</tr>
@ -49,10 +49,10 @@
</td>
<td>
@Html.DisplayFor(modelItem => item.FIO)
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Address)
@Html.DisplayFor(modelItem => item.CountryOrigin)
</td>
</tr>

View File

@ -1,9 +1,9 @@
@using HospitalContracts.ViewModels
@model List<DiseaseViewModel>
@model List<DescriptionProcedureViewModel>
@{
ViewData["Title"] = "IndexDiseases";
ViewData["Title"] = "IndexDescriptionProcedures";
}
<div class="text-center">
@ -18,11 +18,11 @@
return;
}
<p>
<a asp-action="UpdateAnimal">Редактировать болезнь</a>
<a asp-action="DeleteAnimal">Удалить болезнь</a>
<a asp-action="UpdateAnimal">Редактировать описание</a>
<a asp-action="DeleteAnimal">Удалить описание</a>
</p>
<p>
<a asp-action="CreateAnimal">Создать болезнь</a>
<a asp-action="CreateAnimal">Создать описание</a>
</p>
<table class="table">
<thead>
@ -47,9 +47,6 @@
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>

View File

@ -1,13 +1,13 @@
@using HospitalContracts.ViewModels
@model List<RecipeViewModel>
@model List<ProcedureViewModel>
@{
ViewData["Title"] = "IndexProcedure";
}
<div class="text-center">
<h1 class="display-4">Процедуры</h1>
<h1 class="display-4">Рецепты</h1>
</div>
<div class="text-center">
@ -20,7 +20,7 @@
<p>
<a asp-action="Update">Редактировать процедуру</a>
<a asp-action="Delete">Удалить процедуру</a>
<a asp-action="ServiceVisits">Связать процедуру и описание</a>
<a asp-action="ServiceVisits">Связать описание и процедуру</a>
</p>
<p>
<a asp-action="Create">Создать процедуру</a>
@ -34,9 +34,7 @@
<th>
Описание
</th>
<th>
Дата
</th>
</tr>
</thead>
@ -49,10 +47,7 @@
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
<td>
@Html.DisplayFor(modelItem => item.IssueDate)
@Html.DisplayFor(modelItem => item.Name)
</td>
</tr>

View File

@ -1,5 +1,7 @@
@{
ViewData["Title"] = "CreateDisease";
@using HospitalContracts.ViewModels;
@{
ViewData["Title"] = "Link";
}
<head>
@ -8,16 +10,16 @@
<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>
<label class="u-label u-text-custom-color-1 u-label-1">Название процудуры</label>
<input type="text"
placeholder="Введите название болезни"
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="Введите описание болезни"
placeholder="Введите описание процедуры"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>
@ -26,3 +28,5 @@
<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,6 +1,6 @@
@using HospitalContracts.ViewModels
@model DoctorViewModel
@model PharmacistViewModel
@{
ViewData["Title"] = "Privacy";
@ -23,9 +23,9 @@
<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="Введите электронную почту"
placeholder="Введите"
name="email"
value="@Model.MailAddress"
value="@Model.Login"
class="u-input u-input-rectangle" />
</div>
<div class="u-form-group u-label-top u-form-group-3">

View File

@ -15,7 +15,13 @@
name="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"
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"

View File

@ -1,5 +1,5 @@
@{
ViewData["Title"] = "CreateDisease";
ViewData["Title"] = "UpdateDescriptionProcedure";
}
<head>
@ -8,16 +8,16 @@
<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>
<label class="u-label u-text-custom-color-1 u-label-1">Название описания</label>
<input type="text"
placeholder="Введите название болезни"
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="Введите описание болезни"
placeholder="Введите описание"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>

View File

@ -1,5 +1,5 @@
@{
ViewData["Title"] = "CreateDisease";
ViewData["Title"] = "UpdateMedicine";
}
<head>
@ -8,16 +8,16 @@
<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>
<label class="u-label u-text-custom-color-1 u-label-1">Название лекарства</label>
<input type="text"
placeholder="Введите название болезни"
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="Введите описание болезни"
placeholder="Введите производителя лекарства"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>

View File

@ -1,5 +1,5 @@
@{
ViewData["Title"] = "CreateDisease";
ViewData["Title"] = "UpdateProcedure";
}
<head>
@ -8,16 +8,16 @@
<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>
<label class="u-label u-text-custom-color-1 u-label-1">Название процедуры</label>
<input type="text"
placeholder="Введите название болезни"
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="Введите описание болезни"
placeholder="Введите описание процедуры"
name="conferenceName"
class="u-input u-input-rectangle" />
</div>