From 49aa246bcfc4265a1170ce378b3063eeb45e3045 Mon Sep 17 00:00:00 2001 From: Alenka Date: Fri, 3 May 2024 15:20:53 +0400 Subject: [PATCH] mission complete --- .../Implements/SaveToWordPharmacist.cs | 1 + .../IReportLogicPharmacist.cs | 2 +- .../Implementss/MedicineStorage.cs | 14 +++++++------- .../20240430102720_InitCreate.Designer.cs | 4 ++-- .../Migrations/HospitalDatabaseModelSnapshot.cs | 4 ++-- .../HospitalDatabaseImplement/Models/Patient.cs | 10 +++++----- Hospital/HospitalDoctorApp/Program.cs | 2 +- .../PharmacistApp/Controllers/HomeController.cs | 2 +- Hospital/PharmacistApp/Views/Home/Index.cshtml | 4 ++-- .../Views/Home/IndexProcedures.cshtml | 6 +++--- 10 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Hospital/HospitalBusinessLogic/OfficePackage/Implements/SaveToWordPharmacist.cs b/Hospital/HospitalBusinessLogic/OfficePackage/Implements/SaveToWordPharmacist.cs index 4a88152..174a597 100644 --- a/Hospital/HospitalBusinessLogic/OfficePackage/Implements/SaveToWordPharmacist.cs +++ b/Hospital/HospitalBusinessLogic/OfficePackage/Implements/SaveToWordPharmacist.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading.Tasks; using HospitalBusinessLogic.OfficePackage.HelperEnums; using HospitalBusinessLogic.OfficePackage.HelperModels; +using HospitalBusinessLogic.OfficePackage; namespace VetClinicBusinessLogic.OfficePackage.Implements { diff --git a/Hospital/HospitalContracts/BusinessLogicContracts/IReportLogicPharmacist.cs b/Hospital/HospitalContracts/BusinessLogicContracts/IReportLogicPharmacist.cs index 0cb3d49..d59efcb 100644 --- a/Hospital/HospitalContracts/BusinessLogicContracts/IReportLogicPharmacist.cs +++ b/Hospital/HospitalContracts/BusinessLogicContracts/IReportLogicPharmacist.cs @@ -11,7 +11,7 @@ namespace HospitalContracts.BusinessLogicsContracts { public interface IReportLogicPharmacist //В процессе { - List GetProcedureRecipes(List services); + List GetProcedureRecipes(List procedures); void SaveRecipesToWordFile(ListRecipesBindingModel model); void SaveRecipesToExcelFile(ListRecipesBindingModel model); } diff --git a/Hospital/HospitalDataBaseImplement/Implementss/MedicineStorage.cs b/Hospital/HospitalDataBaseImplement/Implementss/MedicineStorage.cs index 0c309da..d1c8085 100644 --- a/Hospital/HospitalDataBaseImplement/Implementss/MedicineStorage.cs +++ b/Hospital/HospitalDataBaseImplement/Implementss/MedicineStorage.cs @@ -45,9 +45,9 @@ namespace HospitalDatabaseImplement.Implements return context.Medicines .Where(medicine => model.medicinesIds.Contains(medicine.Id)) .Select(medicine => new Tuple>>>(medicine.GetViewModel, - context.ProcedureMedicines.Include(service => service.Procedure) - .Include(service => service.Medicine).Where(service => medicine.Id == service.MedicineId). - Select(service => new Tuple>(service.Procedure.GetViewModel, + context.ProcedureMedicines.Include(procedure => procedure.Procedure) + .Include(procedure => procedure.Medicine).Where(procedure => medicine.Id == procedure.MedicineId). + Select(procedure => new Tuple>(procedure.Procedure.GetViewModel, context.DescriptionProcedures.Include(x => x.Procedures). Select(x => x.GetViewModel).ToList())).ToList())).ToList(); @@ -62,10 +62,10 @@ namespace HospitalDatabaseImplement.Implements return context.Medicines .Where(medicine => model.medicinesIds.Contains(medicine.Id)) .Select(medicine => new Tuple>>>(medicine.GetViewModel, - context.ProcedureMedicines.Include(service => service.Procedure) - .Include(service => service.Medicine).Where(service => medicine.Id == service.MedicineId). - Select(service => new Tuple>(service.Procedure.GetViewModel, - context.PatientProcedures.Include(x => x.Patient).Where(x => x.ProcedureId == service.ProcedureId ). + context.ProcedureMedicines.Include(procedure => procedure.Procedure) + .Include(procedure => procedure.Medicine).Where(procedure => medicine.Id == procedure.MedicineId). + Select(procedure => new Tuple>(procedure.Procedure.GetViewModel, + context.PatientProcedures.Include(x => x.Patient).Where(x => x.ProcedureId == procedure.ProcedureId ). Select(x => x.Patient.GetViewModel).ToList())).ToList())).ToList(); } diff --git a/Hospital/HospitalDatabaseImplement/Migrations/20240430102720_InitCreate.Designer.cs b/Hospital/HospitalDatabaseImplement/Migrations/20240430102720_InitCreate.Designer.cs index 0e6160f..0f78a68 100644 --- a/Hospital/HospitalDatabaseImplement/Migrations/20240430102720_InitCreate.Designer.cs +++ b/Hospital/HospitalDatabaseImplement/Migrations/20240430102720_InitCreate.Designer.cs @@ -468,7 +468,7 @@ namespace HospitalDatabaseImplement.Migrations modelBuilder.Entity("HospitalDatabaseImplement.Models.ProcedureMedicine", b => { b.HasOne("HospitalDatabaseImplement.Models.Medicine", "Medicine") - .WithMany("Services") + .WithMany("procedures") .HasForeignKey("MedicineId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -545,7 +545,7 @@ namespace HospitalDatabaseImplement.Migrations { b.Navigation("Recipes"); - b.Navigation("Services"); + b.Navigation("procedures"); }); modelBuilder.Entity("HospitalDatabaseImplement.Models.Patient", b => diff --git a/Hospital/HospitalDatabaseImplement/Migrations/HospitalDatabaseModelSnapshot.cs b/Hospital/HospitalDatabaseImplement/Migrations/HospitalDatabaseModelSnapshot.cs index 3611c63..7646a9b 100644 --- a/Hospital/HospitalDatabaseImplement/Migrations/HospitalDatabaseModelSnapshot.cs +++ b/Hospital/HospitalDatabaseImplement/Migrations/HospitalDatabaseModelSnapshot.cs @@ -465,7 +465,7 @@ namespace HospitalDatabaseImplement.Migrations modelBuilder.Entity("HospitalDatabaseImplement.Models.ProcedureMedicine", b => { b.HasOne("HospitalDatabaseImplement.Models.Medicine", "Medicine") - .WithMany("Services") + .WithMany("procedures") .HasForeignKey("MedicineId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -542,7 +542,7 @@ namespace HospitalDatabaseImplement.Migrations { b.Navigation("Recipes"); - b.Navigation("Services"); + b.Navigation("procedures"); }); modelBuilder.Entity("HospitalDatabaseImplement.Models.Patient", b => diff --git a/Hospital/HospitalDatabaseImplement/Models/Patient.cs b/Hospital/HospitalDatabaseImplement/Models/Patient.cs index ac46c49..739259d 100644 --- a/Hospital/HospitalDatabaseImplement/Models/Patient.cs +++ b/Hospital/HospitalDatabaseImplement/Models/Patient.cs @@ -106,14 +106,14 @@ namespace HospitalDatabaseImplement.Models public void UpdateProcedures(HospitalDatabase context, PatientBindingModel model) { - var servicePatients = context.PatientProcedures.Where(rec => rec.PatientId == model.Id).ToList(); - if (servicePatients != null) + var procedurePatients = context.PatientProcedures.Where(rec => rec.PatientId == model.Id).ToList(); + if (procedurePatients != null) { // удалили те, которых нет в модели - context.PatientProcedures.RemoveRange(servicePatients.Where(rec => !model.PatientProcedures.ContainsKey(rec.ProcedureId))); + context.PatientProcedures.RemoveRange(procedurePatients.Where(rec => !model.PatientProcedures.ContainsKey(rec.ProcedureId))); context.SaveChanges(); - foreach (var service in servicePatients) + foreach (var procedure in procedurePatients) { - model.PatientProcedures.Remove(service.ProcedureId); + model.PatientProcedures.Remove(procedure.ProcedureId); } context.SaveChanges(); } diff --git a/Hospital/HospitalDoctorApp/Program.cs b/Hospital/HospitalDoctorApp/Program.cs index 868e558..74c5819 100644 --- a/Hospital/HospitalDoctorApp/Program.cs +++ b/Hospital/HospitalDoctorApp/Program.cs @@ -1,7 +1,7 @@ using HospitalDoctorApp; var builder = WebApplication.CreateBuilder(args); -// Add services to the container. +// Add procedures to the container. builder.Services.AddControllersWithViews(); var app = builder.Build(); diff --git a/Hospital/PharmacistApp/Controllers/HomeController.cs b/Hospital/PharmacistApp/Controllers/HomeController.cs index 9c34b37..4247d09 100644 --- a/Hospital/PharmacistApp/Controllers/HomeController.cs +++ b/Hospital/PharmacistApp/Controllers/HomeController.cs @@ -94,7 +94,7 @@ View(APIPharmacist.GetRequest>($"api/disease/getdiseases? [HttpGet] public IActionResult RecipeListReport() { - ViewBag.Services = APIPharmacist.GetRequest>($"api/service/getservices?pharmacistid={APIPharmacist.Pharmacist.Id}"); + ViewBag.procedures = APIPharmacist.GetRequest>($"api/procedure/getprocedures?pharmacistid={APIPharmacist.Pharmacist.Id}"); return View(); } [HttpGet] diff --git a/Hospital/PharmacistApp/Views/Home/Index.cshtml b/Hospital/PharmacistApp/Views/Home/Index.cshtml index 407d50f..b590cb5 100644 --- a/Hospital/PharmacistApp/Views/Home/Index.cshtml +++ b/Hospital/PharmacistApp/Views/Home/Index.cshtml @@ -20,10 +20,10 @@

Редактировать лекарство Удалить лекарство - Связать лекарство и рецепт + Связать лекарство и рецепт

- Создать лекарство + Создать лекарство

diff --git a/Hospital/PharmacistApp/Views/Home/IndexProcedures.cshtml b/Hospital/PharmacistApp/Views/Home/IndexProcedures.cshtml index e801dd9..1db819a 100644 --- a/Hospital/PharmacistApp/Views/Home/IndexProcedures.cshtml +++ b/Hospital/PharmacistApp/Views/Home/IndexProcedures.cshtml @@ -14,9 +14,9 @@ return; }

- Создать процедуру - Обновить процедуру - Удалить процедуру + Создать процедуру + Обновить процедуру + Удалить процедуру