Работает вывод отчета по болезням за период на форму
This commit is contained in:
parent
490216b6c1
commit
7d5a3f2a7b
@ -22,13 +22,13 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
||||
_symptomStorage = symptomStorage;
|
||||
}
|
||||
|
||||
public ReportSymptomesCoursesViewModel GetReportDiagnosesWithSymptomesAndCoursesByPeriod(DateTime? dateStart, DateTime? dateEnd)
|
||||
public ReportDiagnosesByPeriodViewModel GetReportDiagnosesByPeriod(DateTime? dateStart, DateTime? dateEnd)
|
||||
{
|
||||
var diagnoses = _diagnoseStorage.GetFilteredList(new DiagnoseSearchModel { From = dateStart, To = dateEnd });
|
||||
var courses = _courseStorage.GetFullList();
|
||||
var symptomes = _symptomStorage.GetFullList();
|
||||
|
||||
var report = new ReportSymptomesCoursesViewModel();
|
||||
var report = new ReportDiagnosesByPeriodViewModel();
|
||||
|
||||
foreach (var diagnose in diagnoses)
|
||||
{
|
||||
@ -39,6 +39,8 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
||||
report.DiagnosesData.Add((diagnose, diagnoseSymptomes, diagnoseCourses));
|
||||
}
|
||||
}
|
||||
report.DateStart = dateStart;
|
||||
report.DateEnd = dateEnd;
|
||||
return report;
|
||||
}
|
||||
|
||||
@ -71,7 +73,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
||||
return report;
|
||||
}
|
||||
|
||||
public void SaveReportDiagnosesWithSymptomesAndCoursesByPeriodToPdfFile(ReportInfoModel reportInfo, ReportSymptomesCoursesViewModel reportModel)
|
||||
public void SaveReportDiagnosesWithSymptomesAndCoursesByPeriodToPdfFile(ReportInfoModel reportInfo, ReportDiagnosesByPeriodViewModel reportModel)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PolyclinicBusinessLogic.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum ReportType
|
||||
{
|
||||
Web = 0,
|
||||
Email = 1,
|
||||
Word = 2,
|
||||
Excel = 3,
|
||||
Pdf = 4,
|
||||
}
|
||||
}
|
@ -6,10 +6,10 @@ namespace PolyclinicContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IImplementerReportLogic
|
||||
{
|
||||
ReportSymptomesCoursesViewModel GetReportDiagnosesWithSymptomesAndCoursesByPeriod(DateTime? dateStart, DateTime? dateEnd);
|
||||
ReportDiagnosesByPeriodViewModel GetReportDiagnosesByPeriod(DateTime? dateStart, DateTime? dateEnd);
|
||||
List<ReportMedicamentsByDiagnoseViewModel> GetReportMedicamentsByDiagnoses(List<IDiagnoseModel> diagnoses);
|
||||
void SaveReportMedicamentsByDiagnosesToWordFile(ReportInfoModel reportInfo, List<ReportMedicamentsByDiagnoseViewModel> reportModel);
|
||||
void SaveReportMedicamentsByDiagnosesToExcelFile(ReportInfoModel reportInfo, List<ReportMedicamentsByDiagnoseViewModel> reportModel);
|
||||
void SaveReportDiagnosesWithSymptomesAndCoursesByPeriodToPdfFile(ReportInfoModel reportInfo, ReportSymptomesCoursesViewModel reportModel);
|
||||
void SaveReportDiagnosesWithSymptomesAndCoursesByPeriodToPdfFile(ReportInfoModel reportInfo, ReportDiagnosesByPeriodViewModel reportModel);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace PolyclinicContracts.ViewModels
|
||||
{
|
||||
public class ReportSymptomesCoursesViewModel
|
||||
public class ReportDiagnosesByPeriodViewModel
|
||||
{
|
||||
public DateTime DateStart { get; set; }
|
||||
public DateTime DateEnd { get; set; }
|
||||
public DateTime? DateStart { get; set; }
|
||||
public DateTime? DateEnd { get; set; }
|
||||
public List<(DiagnoseViewModel Diagnose, List<SymptomViewModel> Symptomes, List<CourseViewModel> Courses)> DiagnosesData { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PolyclinicContracts.BusinessLogicsContracts;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using PolyclinicWebAppImplementer.Models;
|
||||
|
||||
namespace PolyclinicWebAppImplementer.Controllers
|
||||
{
|
||||
public class ReportsController : Controller
|
||||
{
|
||||
private readonly IImplementerReportLogic _reportLogic;
|
||||
private readonly IDiagnoseLogic _diagnoseLogic;
|
||||
|
||||
public ReportsController(IImplementerReportLogic reportLogic, IDiagnoseLogic diagnoseLogic)
|
||||
{
|
||||
_reportLogic = reportLogic;
|
||||
_diagnoseLogic = diagnoseLogic;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpPost]
|
||||
public IActionResult DiagnosesByPeriod(DiagnosesByPeriodFormModel model)
|
||||
{
|
||||
var currentUser = LoginManager.LogginedUser;
|
||||
if (currentUser == null)
|
||||
{
|
||||
return RedirectToAction("Login", "User");
|
||||
}
|
||||
if (HttpContext.Request.Method == "GET")
|
||||
{
|
||||
return View(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
model.Report = _reportLogic.GetReportDiagnosesByPeriod(model.DateStart, model.DateEnd);
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpPost]
|
||||
public IActionResult MedicamentsByDiagnoses(MedicamentsByDiagnosesFormModel model)
|
||||
{
|
||||
var currentUser = LoginManager.LogginedUser;
|
||||
if (currentUser == null)
|
||||
{
|
||||
return RedirectToAction("Login", "User");
|
||||
}
|
||||
if (HttpContext.Request.Method == "GET")
|
||||
{
|
||||
return View(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using PolyclinicBusinessLogic.OfficePackage.HelperEnums;
|
||||
using PolyclinicContracts.ViewModels;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace PolyclinicWebAppImplementer.Models
|
||||
{
|
||||
public class DiagnosesByPeriodFormModel
|
||||
{
|
||||
[DisplayName("Начало периода")]
|
||||
public DateTime? DateStart { get; set; }
|
||||
[DisplayName("Конец периода")]
|
||||
public DateTime? DateEnd { get; set; }
|
||||
public ReportType ReportType { get; set; }
|
||||
public ReportDiagnosesByPeriodViewModel? Report { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace PolyclinicWebAppImplementer.Models
|
||||
{
|
||||
public class MedicamentsByDiagnosesFormModel
|
||||
{
|
||||
}
|
||||
}
|
@ -10,8 +10,8 @@
|
||||
public static (string Controller, string Action, string Title, PageVisible Visible) Register = ("User", "Register", "Регистрация", PageVisible.AllowOnlyNotAuthorized);
|
||||
public static (string Controller, string Action, string Title, PageVisible Visible) Privacy = ("User", "Privacy", "Личный кабинет", PageVisible.AllowOnlyAuthorized);
|
||||
public static (string Controller, string Action, string Title, PageVisible Visible) AddRecipeToCourse = ("Recipe", "LinkCourse", "Привязка рецептов", PageVisible.AllowOnlyAuthorized);
|
||||
public static (string Controller, string Action, string Title, PageVisible Visible) MedicamentsByDiagnoses = ("Home", "MedicamentsByDiagnoses", "Лекарства по болезням", PageVisible.AllowOnlyAuthorized);
|
||||
public static (string Controller, string Action, string Title, PageVisible Visible) DiagnosesReport = ("Home", "DiagnosesReport", "Отчет по болезням", PageVisible.AllowOnlyAuthorized);
|
||||
public static (string Controller, string Action, string Title, PageVisible Visible) MedicamentsByDiagnoses = ("Reports", "MedicamentsByDiagnoses", "Отчет по лекарствам", PageVisible.AllowOnlyAuthorized);
|
||||
public static (string Controller, string Action, string Title, PageVisible Visible) DiagnosesReport = ("Reports", "DiagnosesByPeriod", "Отчет по болезням", PageVisible.AllowOnlyAuthorized);
|
||||
|
||||
public static List<(string Controller, string Action, string Title, PageVisible Visible)> MenuItemsOrder = new List<(string Controller, string Action, string Title, PageVisible Visible)>
|
||||
{
|
||||
|
@ -1,113 +0,0 @@
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.DiagnosesReport;
|
||||
}
|
||||
<div class="d-flex flex-column">
|
||||
<form id="diagnosesReportForm" method="post" class="d-flex mb-4">
|
||||
<div class="me-5">
|
||||
<label for="dateFrom">
|
||||
Дата начала
|
||||
</label>
|
||||
<input type="date" id="dateFrom" name="dateFrom" />
|
||||
</div>
|
||||
<div class="me-5">
|
||||
<label for="dateTo">
|
||||
Дата завершения
|
||||
</label>
|
||||
<input type="date" id="dateTo" name="dateTo" />
|
||||
</div>
|
||||
<div class="me-5">
|
||||
<fieldset class="d-flex">
|
||||
<div class="me-4">
|
||||
<label for="radioreportTypeEmail">Отправить на почту</label>
|
||||
<input id="radioreportTypeEmail" type="radio" name="reportType" value="email" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="radioreportTypeForm">Показать на форме</label>
|
||||
<input id="radioreportTypeForm" type="radio" name="reportType" value="form" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<button class="btn btn-primary btn-sm" type="submit">
|
||||
Сформировать
|
||||
</button>
|
||||
</form>
|
||||
@if (ViewData.ContainsKey("ShowReport"))
|
||||
{
|
||||
<table class="table mt-3 caption-top table-hover">
|
||||
<caption>Отчет по болезням с 01.01.2023 по 31.12.2023</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
#
|
||||
</th>
|
||||
<th scope="col">
|
||||
Болезнь
|
||||
</th>
|
||||
<th scope="col">
|
||||
Дата начала
|
||||
</th>
|
||||
<th scope="col">
|
||||
Дата завершения
|
||||
</th>
|
||||
<th scope="col">
|
||||
Курсы
|
||||
</th>
|
||||
<th scope="col">
|
||||
Симптомы
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
<tr>
|
||||
<th scope="row">
|
||||
@(i + 1)
|
||||
</th>
|
||||
<td>
|
||||
Лихорадка Эбола
|
||||
</td>
|
||||
<td>
|
||||
16.03.2023
|
||||
</td>
|
||||
<td>
|
||||
20.10.2023
|
||||
</td>
|
||||
<td>
|
||||
Курс приема топорина<sup>®</sup>
|
||||
</td>
|
||||
<td>
|
||||
Лихорадка
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Курс приема четвертина<sup>®</sup></td>
|
||||
<td>Покрасения</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Курс приема колесовина<sup>®</sup></td>
|
||||
<td>Головокружение</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Курс электрофореза</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
@ -0,0 +1,112 @@
|
||||
@model DiagnosesByPeriodFormModel
|
||||
@{
|
||||
ViewBag.SelectedSiteMenuItem = SiteMenuItems.DiagnosesReport;
|
||||
}
|
||||
<div class="d-flex flex-column">
|
||||
<form id="diagnosesReportForm" method="post" class="d-flex mb-4">
|
||||
<div class="me-5">
|
||||
<label asp-for="DateStart"></label>
|
||||
<input type="date" asp-for="DateStart" />
|
||||
</div>
|
||||
<div class="me-5">
|
||||
<label asp-for="DateEnd"></label>
|
||||
<input type="date" asp-for="DateEnd" />
|
||||
</div>
|
||||
<div class="me-5">
|
||||
<fieldset class="d-flex">
|
||||
<div class="me-4">
|
||||
<label for="reportTypeWeb">Показать на форме</label>
|
||||
<input id="reportTypeWeb" checked asp-for="ReportType" type="radio" value="ReportType.Web" />
|
||||
</div>
|
||||
<div class="me-4">
|
||||
<label for="reportTypeEmail">Отправить на почту</label>
|
||||
<input id="reportTypeEmail" asp-for="ReportType" type="radio" value="ReportType.Email" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<button class="btn btn-primary btn-sm" type="submit">
|
||||
Сформировать
|
||||
</button>
|
||||
</form>
|
||||
@if (Model.Report != null)
|
||||
{
|
||||
<table class="table mt-3 caption-top table-hover">
|
||||
@if (@Model.DateStart != null || @Model.DateEnd != null)
|
||||
{
|
||||
@if (Model.DateStart == null)
|
||||
{
|
||||
<caption>Отчет по болезням по @Model.DateEnd?.ToShortDateString()</caption>
|
||||
}
|
||||
else if (Model.DateEnd == null)
|
||||
{
|
||||
<caption>Отчет по болезням с @Model.DateStart?.ToShortDateString()</caption>
|
||||
}
|
||||
else
|
||||
{
|
||||
<caption>Отчет по болезням с @Model.DateStart?.ToShortDateString() по @Model.DateEnd?.ToShortDateString()</caption>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<caption>Отчет по болезням за весь период</caption>
|
||||
}
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
#
|
||||
</th>
|
||||
<th scope="col">
|
||||
Болезнь
|
||||
</th>
|
||||
<th scope="col">
|
||||
Дата начала
|
||||
</th>
|
||||
<th scope="col">
|
||||
Дата завершения
|
||||
</th>
|
||||
<th scope="col">
|
||||
Симптомы
|
||||
</th>
|
||||
<th scope="col">
|
||||
Курсы
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@{
|
||||
int i = 0;
|
||||
}
|
||||
@foreach (var item in Model.Report.DiagnosesData)
|
||||
{
|
||||
i++;
|
||||
<tr>
|
||||
<th scope="row">
|
||||
@i
|
||||
</th>
|
||||
<td>
|
||||
@item.Diagnose.Name
|
||||
</td>
|
||||
<td>
|
||||
@item.Diagnose.DateStartDiagnose.ToShortDateString()
|
||||
</td>
|
||||
<td>
|
||||
@item.Diagnose.DateStopDiagnose?.ToShortDateString()
|
||||
</td>
|
||||
<td>
|
||||
@foreach (var symptom in item.Symptomes)
|
||||
{
|
||||
<p>@symptom.Name</p>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@foreach (var course in item.Courses)
|
||||
{
|
||||
<p>курс #@course.Id @course.Comment</p>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user