Поправил логику отчетов исполнителя
This commit is contained in:
parent
3e78e51f7c
commit
490216b6c1
@ -3,6 +3,7 @@ using PolyclinicContracts.BusinessLogicsContracts;
|
|||||||
using PolyclinicContracts.SearchModels;
|
using PolyclinicContracts.SearchModels;
|
||||||
using PolyclinicContracts.StoragesContracts;
|
using PolyclinicContracts.StoragesContracts;
|
||||||
using PolyclinicContracts.ViewModels;
|
using PolyclinicContracts.ViewModels;
|
||||||
|
using PolyclinicDataModels.Models;
|
||||||
|
|
||||||
namespace PolyclinicBusinessLogic.BusinessLogics
|
namespace PolyclinicBusinessLogic.BusinessLogics
|
||||||
{
|
{
|
||||||
@ -21,13 +22,13 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
_symptomStorage = symptomStorage;
|
_symptomStorage = symptomStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ReportDiagnoseWithCoursesAndSymptomesViewModel> GetDiagnoses()
|
public ReportSymptomesCoursesViewModel GetReportDiagnosesWithSymptomesAndCoursesByPeriod(DateTime? dateStart, DateTime? dateEnd)
|
||||||
{
|
{
|
||||||
var diagnoses = _diagnoseStorage.GetFullList();
|
var diagnoses = _diagnoseStorage.GetFilteredList(new DiagnoseSearchModel { From = dateStart, To = dateEnd });
|
||||||
var courses = _courseStorage.GetFullList();
|
var courses = _courseStorage.GetFullList();
|
||||||
var symptomes = _symptomStorage.GetFullList();
|
var symptomes = _symptomStorage.GetFullList();
|
||||||
|
|
||||||
var result = new List<ReportDiagnoseWithCoursesAndSymptomesViewModel>();
|
var report = new ReportSymptomesCoursesViewModel();
|
||||||
|
|
||||||
foreach (var diagnose in diagnoses)
|
foreach (var diagnose in diagnoses)
|
||||||
{
|
{
|
||||||
@ -35,38 +36,22 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
var diagnoseSymptomes = symptomes.Where(x => x.SymptomDiagnoses.ContainsKey(diagnose.Id)).ToList();
|
var diagnoseSymptomes = symptomes.Where(x => x.SymptomDiagnoses.ContainsKey(diagnose.Id)).ToList();
|
||||||
if (diagnoseCourses.Count > 0 && diagnoseSymptomes.Count > 0)
|
if (diagnoseCourses.Count > 0 && diagnoseSymptomes.Count > 0)
|
||||||
{
|
{
|
||||||
var dianoseReportModel = new ReportDiagnoseWithCoursesAndSymptomesViewModel {
|
report.DiagnosesData.Add((diagnose, diagnoseSymptomes, diagnoseCourses));
|
||||||
DiagnoseId = diagnose.Id,
|
|
||||||
DiagnoseName = diagnose.Name,
|
|
||||||
DiagnoseComment = diagnose.Comment,
|
|
||||||
DiagnoseDateStart = diagnose.DateStartDiagnose,
|
|
||||||
DiagnoseDateStop = diagnose.DateStopDiagnose,
|
|
||||||
Courses = diagnoseCourses.Select(x => (x.DaysCount, x.PillsPerDay)).ToList(),
|
|
||||||
Symptomes = diagnoseSymptomes.Select(x => x.Name).ToList()
|
|
||||||
};
|
|
||||||
result.Add(dianoseReportModel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ReportMedicamentsByDiagnoseViewModel> GetMedicamentsByDiagnoses(ReportBindingModel model)
|
public List<ReportMedicamentsByDiagnoseViewModel> GetReportMedicamentsByDiagnoses(List<IDiagnoseModel> diagnoses)
|
||||||
{
|
{
|
||||||
var diagnoses = _diagnoseStorage
|
List<DiagnoseViewModel> diagnoseViewModels = diagnoses.Select(x => _diagnoseStorage.GetElement(new DiagnoseSearchModel { Id = x.Id })).ToList();
|
||||||
.GetFilteredList(new DiagnoseSearchModel
|
|
||||||
{
|
var symptomes = _symptomStorage.GetFullList();
|
||||||
From = model.DateFrom,
|
|
||||||
To = model.DateTo
|
|
||||||
});
|
|
||||||
|
|
||||||
var symptomes = _symptomStorage
|
|
||||||
.GetFullList();
|
|
||||||
|
|
||||||
var medicaments = _medicamentStorage.GetFullList();
|
var medicaments = _medicamentStorage.GetFullList();
|
||||||
|
|
||||||
List<ReportMedicamentsByDiagnoseViewModel> result = new();
|
List<ReportMedicamentsByDiagnoseViewModel> report = new();
|
||||||
|
|
||||||
foreach (var diagnose in diagnoses)
|
foreach (var diagnose in diagnoseViewModels)
|
||||||
{
|
{
|
||||||
var diagnoseSymptomes = symptomes
|
var diagnoseSymptomes = symptomes
|
||||||
.Where(x => x.SymptomDiagnoses.ContainsKey(diagnose.Id))
|
.Where(x => x.SymptomDiagnoses.ContainsKey(diagnose.Id))
|
||||||
@ -76,30 +61,27 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
diagnoseMedicaments.AddRange(medicaments.Where(x => x.SymptomId == symptom.Id));
|
diagnoseMedicaments.AddRange(medicaments.Where(x => x.SymptomId == symptom.Id));
|
||||||
}
|
}
|
||||||
var diagnoseReportModel = new ReportMedicamentsByDiagnoseViewModel {
|
|
||||||
DiagnoseId = diagnose.Id,
|
report.Add(new ReportMedicamentsByDiagnoseViewModel
|
||||||
DiagnoseName = diagnose.Name,
|
{
|
||||||
DiagnoseComment = diagnose.Comment,
|
Diagnose = diagnose,
|
||||||
DiagnoseDateStart = diagnose.DateStartDiagnose,
|
Medicaments = diagnoseMedicaments.DistinctBy(x => x.Name).ToList()
|
||||||
DiagnoseDateStop = diagnose.DateStopDiagnose,
|
});
|
||||||
Medicaments = diagnoseMedicaments.Distinct().Select(x => x.Name).ToList()
|
|
||||||
};
|
|
||||||
result.Add(diagnoseReportModel);
|
|
||||||
}
|
}
|
||||||
return result;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
public void SaveReportDiagnosesWithSymptomesAndCoursesByPeriodToPdfFile(ReportInfoModel reportInfo, ReportSymptomesCoursesViewModel reportModel)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveSecureComponentToExcelFile(ReportBindingModel model)
|
public void SaveReportMedicamentsByDiagnosesToExcelFile(ReportInfoModel reportInfo, List<ReportMedicamentsByDiagnoseViewModel> reportModel)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveSecuresToWordFile(ReportBindingModel model)
|
public void SaveReportMedicamentsByDiagnosesToWordFile(ReportInfoModel reportInfo, List<ReportMedicamentsByDiagnoseViewModel> reportModel)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveCoursesByProcedureToExcelFile(ReportBindingModel model, ProcedureSearchModel procedureSearchMode)
|
public void SaveCoursesByProcedureToExcelFile(ReportInfoModel model, ProcedureSearchModel procedureSearchMode)
|
||||||
{
|
{
|
||||||
saveToExcel.CreateReport(new ExcelCoursesByProceduresInfo
|
saveToExcel.CreateReport(new ExcelCoursesByProceduresInfo
|
||||||
{
|
{
|
||||||
@ -114,7 +114,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveCoursesByProcedureToWordFile(ReportBindingModel model, ProcedureSearchModel procedureSearchMode)
|
public void SaveCoursesByProcedureToWordFile(ReportInfoModel model, ProcedureSearchModel procedureSearchMode)
|
||||||
{
|
{
|
||||||
saveToWord.CreateDoc(new WordCoursesByProceduresInfo
|
saveToWord.CreateDoc(new WordCoursesByProceduresInfo
|
||||||
{
|
{
|
||||||
@ -124,7 +124,7 @@ namespace PolyclinicBusinessLogic.BusinessLogics
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveProceduresToPdfFile(ReportBindingModel model)
|
public void SaveProceduresToPdfFile(ReportInfoModel model)
|
||||||
{
|
{
|
||||||
saveToPdf.CreateDoc(new PdfProceduresByMedicamentsAndSymptomsInfo
|
saveToPdf.CreateDoc(new PdfProceduresByMedicamentsAndSymptomsInfo
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
namespace PolyclinicContracts.BindingModels
|
namespace PolyclinicContracts.BindingModels
|
||||||
{
|
{
|
||||||
public class ReportBindingModel
|
public class ReportInfoModel
|
||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string? FileName { get; set; }
|
||||||
public DateTime? DateFrom { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
public DateTime? DateTo { get; set; }
|
public DateTime? DateTo { get; set; }
|
||||||
}
|
}
|
@ -1,14 +1,15 @@
|
|||||||
using PolyclinicContracts.BindingModels;
|
using PolyclinicContracts.BindingModels;
|
||||||
using PolyclinicContracts.ViewModels;
|
using PolyclinicContracts.ViewModels;
|
||||||
|
using PolyclinicDataModels.Models;
|
||||||
|
|
||||||
namespace PolyclinicContracts.BusinessLogicsContracts
|
namespace PolyclinicContracts.BusinessLogicsContracts
|
||||||
{
|
{
|
||||||
public interface IImplementerReportLogic
|
public interface IImplementerReportLogic
|
||||||
{
|
{
|
||||||
List<ReportDiagnoseWithCoursesAndSymptomesViewModel> GetDiagnoses();
|
ReportSymptomesCoursesViewModel GetReportDiagnosesWithSymptomesAndCoursesByPeriod(DateTime? dateStart, DateTime? dateEnd);
|
||||||
List<ReportMedicamentsByDiagnoseViewModel> GetMedicamentsByDiagnoses(ReportBindingModel model);
|
List<ReportMedicamentsByDiagnoseViewModel> GetReportMedicamentsByDiagnoses(List<IDiagnoseModel> diagnoses);
|
||||||
void SaveSecuresToWordFile(ReportBindingModel model);
|
void SaveReportMedicamentsByDiagnosesToWordFile(ReportInfoModel reportInfo, List<ReportMedicamentsByDiagnoseViewModel> reportModel);
|
||||||
void SaveSecureComponentToExcelFile(ReportBindingModel model);
|
void SaveReportMedicamentsByDiagnosesToExcelFile(ReportInfoModel reportInfo, List<ReportMedicamentsByDiagnoseViewModel> reportModel);
|
||||||
void SaveOrdersToPdfFile(ReportBindingModel model);
|
void SaveReportDiagnosesWithSymptomesAndCoursesByPeriodToPdfFile(ReportInfoModel reportInfo, ReportSymptomesCoursesViewModel reportModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,18 +28,18 @@ namespace PolyclinicContracts.BusinessLogicsContracts
|
|||||||
/// Сохранение курсов по процедурам в файл-Word
|
/// Сохранение курсов по процедурам в файл-Word
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
void SaveCoursesByProcedureToWordFile(ReportBindingModel model, ProcedureSearchModel procedureSearchMode);
|
void SaveCoursesByProcedureToWordFile(ReportInfoModel model, ProcedureSearchModel procedureSearchMode);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Сохранение курсов по процедурам в файл-Excel
|
/// Сохранение курсов по процедурам в файл-Excel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
void SaveCoursesByProcedureToExcelFile(ReportBindingModel model, ProcedureSearchModel procedureSearchMode);
|
void SaveCoursesByProcedureToExcelFile(ReportInfoModel model, ProcedureSearchModel procedureSearchMode);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Сохранение заказов в файл-Pdf
|
/// Сохранение заказов в файл-Pdf
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
void SaveProceduresToPdfFile(ReportBindingModel model);
|
void SaveProceduresToPdfFile(ReportInfoModel model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
namespace PolyclinicContracts.ViewModels
|
|
||||||
{
|
|
||||||
public class ReportDiagnoseWithCoursesAndSymptomesViewModel
|
|
||||||
{
|
|
||||||
public int DiagnoseId { get; set; }
|
|
||||||
public string DiagnoseName { get; set; } = string.Empty;
|
|
||||||
public string DiagnoseComment { get; set; } = string.Empty;
|
|
||||||
public DateTime DiagnoseDateStart { get; set; }
|
|
||||||
public DateTime? DiagnoseDateStop { get; set; } = null;
|
|
||||||
public List<string> Symptomes { get; set; } = new();
|
|
||||||
public List<(int DaysCount, int PillsPerDay)> Courses = new();
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,11 +2,7 @@
|
|||||||
{
|
{
|
||||||
public class ReportMedicamentsByDiagnoseViewModel
|
public class ReportMedicamentsByDiagnoseViewModel
|
||||||
{
|
{
|
||||||
public int DiagnoseId { get; set; }
|
public DiagnoseViewModel Diagnose { get; set; } = new();
|
||||||
public string DiagnoseName { get; set; } = string.Empty;
|
public List<MedicamentViewModel> Medicaments { get; set; } = new();
|
||||||
public string DiagnoseComment { get; set; } = string.Empty;
|
|
||||||
public DateTime DiagnoseDateStart { get; set; }
|
|
||||||
public DateTime? DiagnoseDateStop { get; set; } = null;
|
|
||||||
public List<string> Medicaments = new();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
namespace PolyclinicContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ReportSymptomesCoursesViewModel
|
||||||
|
{
|
||||||
|
public DateTime DateStart { get; set; }
|
||||||
|
public DateTime DateEnd { get; set; }
|
||||||
|
public List<(DiagnoseViewModel Diagnose, List<SymptomViewModel> Symptomes, List<CourseViewModel> Courses)> DiagnosesData { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,8 @@ builder.Services.AddTransient<IProcedureLogic, ProcedureLogic>();
|
|||||||
builder.Services.AddTransient<IMedicamentLogic, MedicamentLogic>();
|
builder.Services.AddTransient<IMedicamentLogic, MedicamentLogic>();
|
||||||
builder.Services.AddTransient<IRecipeLogic, RecipeLogic>();
|
builder.Services.AddTransient<IRecipeLogic, RecipeLogic>();
|
||||||
|
|
||||||
|
builder.Services.AddTransient<IImplementerReportLogic, ImplementerReportLogic>();
|
||||||
|
|
||||||
builder.Services.AddTransient<IProcedureStorage, ProcedureStorage>();
|
builder.Services.AddTransient<IProcedureStorage, ProcedureStorage>();
|
||||||
builder.Services.AddTransient<IMedicamentStorage, MedicamentStorage>();
|
builder.Services.AddTransient<IMedicamentStorage, MedicamentStorage>();
|
||||||
builder.Services.AddTransient<IRecipeStorage, RecipeStorage>();
|
builder.Services.AddTransient<IRecipeStorage, RecipeStorage>();
|
||||||
|
@ -359,7 +359,7 @@ namespace PolyclinicWebAppSuretor.Controllers
|
|||||||
return NotFound("Ïðîöåäóðà íå íàéäåíà");
|
return NotFound("Ïðîöåäóðà íå íàéäåíà");
|
||||||
}
|
}
|
||||||
|
|
||||||
var report = new ReportBindingModel
|
var report = new ReportInfoModel
|
||||||
{
|
{
|
||||||
FileName = fileName,
|
FileName = fileName,
|
||||||
};
|
};
|
||||||
@ -415,7 +415,7 @@ namespace PolyclinicWebAppSuretor.Controllers
|
|||||||
}
|
}
|
||||||
else if (reportType == "email")
|
else if (reportType == "email")
|
||||||
{
|
{
|
||||||
var reportBindingModel = new ReportBindingModel
|
var reportBindingModel = new ReportInfoModel
|
||||||
{
|
{
|
||||||
FileName = "ProceduresReport.pdf",
|
FileName = "ProceduresReport.pdf",
|
||||||
DateFrom = dateFrom,
|
DateFrom = dateFrom,
|
||||||
|
Loading…
Reference in New Issue
Block a user