Compare commits
2 Commits
main
...
adding-con
Author | SHA1 | Date | |
---|---|---|---|
a071f504d2 | |||
fa0258b99c |
@ -3,19 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34723.18
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalDataModels", "HospitalDataModels\HospitalDataModels.csproj", "{3CBB9321-2FA0-453A-970F-D8DCD6D4C654}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalView", "Hospital\HospitalView.csproj", "{C50859B7-7F2C-4308-B9F7-86119A83E155}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalContracts", "HospitalContracts\HospitalContracts.csproj", "{78516D88-C507-42D8-B534-89BBB1D8E136}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HospitalDataModels", "HospitalDataModels\HospitalDataModels.csproj", "{3CBB9321-2FA0-453A-970F-D8DCD6D4C654}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalBusinessLogic", "HospitalBusinessLogic\HospitalBusinessLogic.csproj", "{FA80C91B-0CE2-48A1-9B9A-EB443F3ABC44}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalDatabaseImplement", "HospitalDatabaseImplement\HospitalDatabaseImplement.csproj", "{651AD7CE-7821-4BDF-9FA4-4F61DC5CF5C4}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalPharmacistApp", "PharmacistApp\HospitalPharmacistApp.csproj", "{5CE4060B-0791-4F09-A52D-EF3EFF4EBF03}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalRestApi", "HospitalRestApi\HospitalRestApi.csproj", "{C524A697-427E-40BD-955C-334255D958B7}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalDoctorApp", "HospitalDoctorApp\HospitalDoctorApp.csproj", "{0E3C0346-E31B-401F-8047-CE157D984F33}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HospitalContracts", "HospitalContracts\HospitalContracts.csproj", "{78516D88-C507-42D8-B534-89BBB1D8E136}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -23,6 +15,10 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C50859B7-7F2C-4308-B9F7-86119A83E155}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C50859B7-7F2C-4308-B9F7-86119A83E155}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C50859B7-7F2C-4308-B9F7-86119A83E155}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C50859B7-7F2C-4308-B9F7-86119A83E155}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3CBB9321-2FA0-453A-970F-D8DCD6D4C654}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3CBB9321-2FA0-453A-970F-D8DCD6D4C654}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3CBB9321-2FA0-453A-970F-D8DCD6D4C654}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@ -31,26 +27,6 @@ Global
|
||||
{78516D88-C507-42D8-B534-89BBB1D8E136}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{78516D88-C507-42D8-B534-89BBB1D8E136}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{78516D88-C507-42D8-B534-89BBB1D8E136}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FA80C91B-0CE2-48A1-9B9A-EB443F3ABC44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FA80C91B-0CE2-48A1-9B9A-EB443F3ABC44}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FA80C91B-0CE2-48A1-9B9A-EB443F3ABC44}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FA80C91B-0CE2-48A1-9B9A-EB443F3ABC44}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{651AD7CE-7821-4BDF-9FA4-4F61DC5CF5C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{651AD7CE-7821-4BDF-9FA4-4F61DC5CF5C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{651AD7CE-7821-4BDF-9FA4-4F61DC5CF5C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{651AD7CE-7821-4BDF-9FA4-4F61DC5CF5C4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5CE4060B-0791-4F09-A52D-EF3EFF4EBF03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5CE4060B-0791-4F09-A52D-EF3EFF4EBF03}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5CE4060B-0791-4F09-A52D-EF3EFF4EBF03}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5CE4060B-0791-4F09-A52D-EF3EFF4EBF03}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C524A697-427E-40BD-955C-334255D958B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C524A697-427E-40BD-955C-334255D958B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C524A697-427E-40BD-955C-334255D958B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C524A697-427E-40BD-955C-334255D958B7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0E3C0346-E31B-401F-8047-CE157D984F33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0E3C0346-E31B-401F-8047-CE157D984F33}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0E3C0346-E31B-401F-8047-CE157D984F33}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0E3C0346-E31B-401F-8047-CE157D984F33}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -8,18 +8,4 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.17">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\HospitalBusinessLogic\HospitalBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\HospitalContracts\HospitalContracts.csproj" />
|
||||
<ProjectReference Include="..\HospitalDatabaseImplement\HospitalDatabaseImplement.csproj" />
|
||||
<ProjectReference Include="..\HospitalDataModels\HospitalDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"profiles": {
|
||||
"HospitalView": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:51159;http://localhost:51164"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using HospitalDataModels.Models;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.BusinessLogicContracts;
|
||||
|
||||
namespace HospitalBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class DescriptionProcedureLogic : IDescriptionProcedureLogic
|
||||
{
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly IDescriptionProcedureStorage _descriptionProcedureStorage;
|
||||
|
||||
public DescriptionProcedureLogic(ILogger<DescriptionProcedureLogic> logger, IDescriptionProcedureStorage descriptionProcedureStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_descriptionProcedureStorage = descriptionProcedureStorage;
|
||||
}
|
||||
|
||||
public DescriptionProcedureViewModel? ReadElement(DescriptionProcedureSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
|
||||
var element = _descriptionProcedureStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<DescriptionProcedureViewModel>? ReadList(DescriptionProcedureSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
|
||||
var list = model == null ? _descriptionProcedureStorage.GetFullList() :
|
||||
_descriptionProcedureStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool Create(DescriptionProcedureBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_descriptionProcedureStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(DescriptionProcedureBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_descriptionProcedureStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(DescriptionProcedureBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_descriptionProcedureStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(DescriptionProcedureBindingModel model, bool withParams =
|
||||
true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Description))
|
||||
{
|
||||
throw new ArgumentNullException("Нет текста рекомендации",
|
||||
nameof(model.Description));
|
||||
}
|
||||
|
||||
_logger.LogInformation("descriptionProcedure. Text:{Text}.", model.Description);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class DiseaseLogic : IDiseaseLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IDiseaseStorage _diseaseStorage;
|
||||
|
||||
public DiseaseLogic(ILogger<DiseaseLogic> logger, IDiseaseStorage diseaseStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_diseaseStorage = diseaseStorage;
|
||||
}
|
||||
|
||||
public bool Create(DiseaseBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_diseaseStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(DiseaseBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_diseaseStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(DiseaseBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_diseaseStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public DiseaseViewModel? ReadElement(DiseaseSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Name:{Name}. Id:{ Id}", model.Name, model.Id);
|
||||
var element = _diseaseStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<DiseaseViewModel>? ReadList(DiseaseSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. DiseaseId:{Id}", model?.Id);
|
||||
var list = model == null ? _diseaseStorage.GetFullList() : _diseaseStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
private void CheckModel(DiseaseBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия болезни", nameof(model.Name));
|
||||
}
|
||||
_logger.LogInformation("Disease. Name:{Name}. Description:{Description}. DoctorId:{DoctorId}. Id:{ Id}", model.Name, model.Description, model.DoctorId, model.Id);
|
||||
var element = _diseaseStorage.GetElement(new DiseaseSearchModel
|
||||
{
|
||||
Name = model.Name,
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Болезнь с такими данными уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,124 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class DoctorLogic : IDoctorLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IDoctorStorage _doctorStorage;
|
||||
|
||||
public DoctorLogic(ILogger<DoctorLogic> logger, IDoctorStorage doctorStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_doctorStorage = doctorStorage;
|
||||
}
|
||||
|
||||
public bool Create(DoctorBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_doctorStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(DoctorBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_doctorStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(DoctorBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_doctorStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public DoctorViewModel? ReadElement(DoctorSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Login:{Login}. PhoneNumber:{PhoneNumber}. Id:{ Id}", model.Login, model.PhoneNumber, model.Id);
|
||||
var element = _doctorStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<DoctorViewModel>? ReadList(DoctorSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. DoctorId:{Id}", model?.Id);
|
||||
var list = model == null ? _doctorStorage.GetFullList() : _doctorStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
private void CheckModel(DoctorBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Login))
|
||||
{
|
||||
throw new ArgumentNullException("Нет логина врача", nameof(model.Login));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.PhoneNumber))
|
||||
{
|
||||
throw new ArgumentNullException("Нет номера телефона врача", nameof(model.PhoneNumber));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
throw new ArgumentNullException("Нет пароля врача", nameof(model.Password));
|
||||
}
|
||||
_logger.LogInformation("Doctor. Login:{Login}. PhoneNumber:{PhoneNumber}. Password:{Password}. Id:{ Id}", model.Login, model.PhoneNumber, model.Password, model.Id);
|
||||
var element = _doctorStorage.GetElement(new DoctorSearchModel
|
||||
{
|
||||
Login = model.Login,
|
||||
Password = model.Password
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Врач с таким именем уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using HospitalDataModels.Models;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.BusinessLogicContracts;
|
||||
|
||||
namespace HospitalBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class MedicineLogic : IMedicineLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IMedicineStorage _medicineStorage;
|
||||
public MedicineLogic(ILogger<MedicineLogic> logger, IMedicineStorage iceCreamStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_medicineStorage = iceCreamStorage;
|
||||
}
|
||||
|
||||
public List<MedicineViewModel>? ReadList(MedicineSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. MedicineName:{MedicineName}. Id:{ Id}", model?.Name, model?.Id);
|
||||
var list = model == null ? _medicineStorage.GetFullList() :
|
||||
_medicineStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public MedicineViewModel? ReadElement(MedicineSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. MedicineName:{MedicineName}.Id:{ Id}", model.Name, model.Id);
|
||||
var element = _medicineStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public bool Create(MedicineBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_medicineStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(MedicineBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_medicineStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(MedicineBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_medicineStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(MedicineBindingModel model, bool withParams =
|
||||
true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия лекарства",
|
||||
nameof(model.Name));
|
||||
}
|
||||
if (model.Price <= 0)
|
||||
{
|
||||
throw new ArgumentNullException("Цена лекарства должна быть больше 0", nameof(model.Price));
|
||||
}
|
||||
_logger.LogInformation("Medicine. Medicine:{MedicineName}. Price:{ Price }. Id: { Id}", model.Name, model.Price, model.Id);
|
||||
var element = _medicineStorage.GetElement(new MedicineSearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Лекарство с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class PatientLogic : IPatientLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPatientStorage _patientStorage;
|
||||
|
||||
public PatientLogic(ILogger<PatientLogic> logger, IPatientStorage patientStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_patientStorage = patientStorage;
|
||||
}
|
||||
|
||||
public bool Create(PatientBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_patientStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(PatientBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_patientStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(PatientBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_patientStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public PatientViewModel? ReadElement(PatientSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. FIO:{FIO}. Id:{ Id}", model.FIO, model.Id);
|
||||
var element = _patientStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<PatientViewModel>? ReadList(PatientSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. PatientId:{Id}", model?.Id);
|
||||
var list = model == null ? _patientStorage.GetFullList() : _patientStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
private void CheckModel(PatientBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.FIO))
|
||||
{
|
||||
throw new ArgumentNullException("Нет FIO пациента", nameof(model.FIO));
|
||||
}
|
||||
|
||||
/*if (model.BirthDate < DateTime.Now.)
|
||||
{
|
||||
throw new ArgumentNullException("Возраст пациента должен быть больше 0", nameof(model.FIO));
|
||||
}*/ //TODO
|
||||
//_logger.LogInformation("Patient. Login:{Login}. PhoneNumber:{PhoneNumber}. Password:{Password}. BirthDate:{BirthDate}. DoctorId:{DoctorId}. Id:{ Id}", model.FIO, model.BirthDate, model.DoctorId, model.Id);
|
||||
var element = _patientStorage.GetElement(new PatientSearchModel
|
||||
{
|
||||
FIO = model.FIO,
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Пациент с такими данными уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,124 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class PharmacistLogic : IPharmacistLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPharmacistStorage _PharmacistStorage;
|
||||
|
||||
public PharmacistLogic(ILogger<PharmacistLogic> logger, IPharmacistStorage PharmacistStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_PharmacistStorage = PharmacistStorage;
|
||||
}
|
||||
|
||||
public bool Create(PharmacistBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_PharmacistStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(PharmacistBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_PharmacistStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(PharmacistBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_PharmacistStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public PharmacistViewModel? ReadElement(PharmacistSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Login:{Login}. PhoneNumber:{PhoneNumber}. Id:{ Id}", model.Login, model.PhoneNumber, model.Id);
|
||||
var element = _PharmacistStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<PharmacistViewModel>? ReadList(PharmacistSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. PharmacistId:{Id}", model?.Id);
|
||||
var list = model == null ? _PharmacistStorage.GetFullList() : _PharmacistStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
private void CheckModel(PharmacistBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Login))
|
||||
{
|
||||
throw new ArgumentNullException("Нет логина врача", nameof(model.Login));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.PhoneNumber))
|
||||
{
|
||||
throw new ArgumentNullException("Нет номера телефона врача", nameof(model.PhoneNumber));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
throw new ArgumentNullException("Нет пароля врача", nameof(model.Password));
|
||||
}
|
||||
_logger.LogInformation("Pharmacist. Login:{Login}. PhoneNumber:{PhoneNumber}. Password:{Password}. Id:{ Id}", model.Login, model.PhoneNumber, model.Password, model.Id);
|
||||
var element = _PharmacistStorage.GetElement(new PharmacistSearchModel
|
||||
{
|
||||
Login = model.Login,
|
||||
Password = model.Password
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Врач с таким именем уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using HospitalDataModels.Models;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.BusinessLogicContracts;
|
||||
|
||||
namespace HospitalBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ProcedureLogic : IProcedureLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IProcedureStorage _procedureStorage;
|
||||
public ProcedureLogic(ILogger<ProcedureLogic> logger, IProcedureStorage procedureStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_procedureStorage = procedureStorage;
|
||||
}
|
||||
|
||||
public List<ProcedureViewModel>? ReadList(ProcedureSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. ProcedureName:{ProcedureName}. Id:{ Id}", model?.Name, model?.Id);
|
||||
var list = model == null ? _procedureStorage.GetFullList() :
|
||||
_procedureStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public ProcedureViewModel? ReadElement(ProcedureSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. ProcedureName:{ProcedureName}.Id:{ Id}", model.Name, model.Id);
|
||||
var element = _procedureStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public bool Create(ProcedureBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_procedureStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(ProcedureBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_procedureStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(ProcedureBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_procedureStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(ProcedureBindingModel model, bool withParams =
|
||||
true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия процедуры",
|
||||
nameof(model.Name));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Procedure. ProcedureName:{ProcedureName}. Id: { Id}", model.Name, model.Id);
|
||||
var element = _procedureStorage.GetElement(new ProcedureSearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Процедура с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class RecipeLogic : IRecipeLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IRecipeStorage _recipeStorage;
|
||||
|
||||
public RecipeLogic(ILogger<RecipeLogic> logger, IRecipeStorage recipeStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_recipeStorage = recipeStorage;
|
||||
}
|
||||
|
||||
public bool Create(RecipeBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_recipeStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(RecipeBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_recipeStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(RecipeBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_recipeStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public RecipeViewModel? ReadElement(RecipeSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
|
||||
var element = _recipeStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<RecipeViewModel>? ReadList(RecipeSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. RecipeId:{Id}", model?.Id);
|
||||
var list = model == null ? _recipeStorage.GetFullList() : _recipeStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
private void CheckModel(RecipeBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
/*if (model.RecipeMedicines == null || model.RecipeMedicines.Count == 0)
|
||||
{
|
||||
throw new ArgumentNullException("Нет лекарств в рецепте", nameof(model.RecipeMedicines));
|
||||
}TODO*/
|
||||
_logger.LogInformation("Recipe. Id:{ Id}. DiseaseId:{DiseaseId}. DoctorId:{DoctorId}", model.Id, model.DiseaseId, model.DoctorId);
|
||||
var element = _recipeStorage.GetElement(new RecipeSearchModel
|
||||
{
|
||||
Id = model.Id,
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Пациент с такими данными уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,272 +0,0 @@
|
||||
using DocumentFormat.OpenXml.Office2010.ExcelAc;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataModels.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalBusinessLogic.OfficePackage;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
|
||||
namespace HospitalBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ReportLogicDoctor : IDoctorReportLogic
|
||||
{
|
||||
|
||||
private readonly IPatientStorage _patientStorage;
|
||||
private readonly IMedicineStorage _medicineStorage;
|
||||
private readonly IProcedureStorage _procedureStorage;
|
||||
private readonly IRecipeStorage _recipeStorage;
|
||||
private readonly IDiseaseStorage _diseaseStorage;
|
||||
private readonly AbstractSaveToExcelDoctor _saveToExcel;
|
||||
private readonly AbstractSaveToWordDoctor _saveToWord;
|
||||
private readonly AbstractSaveToPdfDoctor _saveToPdf;
|
||||
|
||||
public ReportLogicDoctor(IPatientStorage patientStorage, IMedicineStorage medicineStorage, IProcedureStorage procedureStorage, IRecipeStorage recipeStorage, IDiseaseStorage diseaseStorage,
|
||||
AbstractSaveToExcelDoctor saveToExcel, AbstractSaveToWordDoctor saveToWord, AbstractSaveToPdfDoctor saveToPdf)
|
||||
{
|
||||
|
||||
_patientStorage = patientStorage;
|
||||
_medicineStorage = medicineStorage;
|
||||
_procedureStorage = procedureStorage;
|
||||
_recipeStorage = recipeStorage;
|
||||
_diseaseStorage = diseaseStorage;
|
||||
_saveToExcel = saveToExcel;
|
||||
_saveToWord = saveToWord;
|
||||
_saveToPdf = saveToPdf;
|
||||
|
||||
}
|
||||
|
||||
//отчет по лекарствам и болезням у пациента за период
|
||||
/*public List<ReportPatientViewModel> GetPatientDiseases(ReportBindingModel model, PatientBindingModel patientModel)
|
||||
{
|
||||
var list = new List<ReportPatientViewModel>();
|
||||
var patients = _patientStorage.GetFilteredList(new PatientSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo, Id = patientModel.Id });
|
||||
|
||||
foreach (var patient in patients)
|
||||
{
|
||||
var purchase = _patientStorage.GetElement(new() { Id = patient.Id })!;
|
||||
List<string> diseaseList = new List<string>();
|
||||
List<string> patientList = new List<string>();
|
||||
foreach (var recipe in _recipeStorage.GetFilteredList(new RecipeSearchModel {PatientId = patient.Id}))
|
||||
{
|
||||
foreach (var patient in _patientStorage.GetFilteredList(new PatientSearchModel { RecipeId = recipe.Id }))
|
||||
{
|
||||
patientList.Add(new(patient.Name));
|
||||
|
||||
|
||||
foreach (var disease in patient.PatientRecipes)
|
||||
{
|
||||
diseaseList.Add(disease.Value.Description);
|
||||
}
|
||||
}
|
||||
}
|
||||
var record = new ReportPatientViewModel
|
||||
{
|
||||
Id = purchase.Id,
|
||||
FIO = patient.FIO,
|
||||
|
||||
Diseases = diseaseList,
|
||||
Patients = patientList
|
||||
};
|
||||
list.Add(record);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<ReportPatientRecipeViewModel> GetPatients()
|
||||
{
|
||||
var list = new List<ReportPatientRecipeViewModel>();
|
||||
var patients = _patientStorage.GetFullList();
|
||||
|
||||
foreach (var patient in patients)
|
||||
{
|
||||
var purchase = _patientStorage.GetElement(new() { Id = patient.Id })!;
|
||||
List<string> diseaseList = new List<string>();
|
||||
List<string> recipeList = new List<string>();
|
||||
foreach (var recipe in _recipeStorage.GetFilteredList(new RecipeSearchModel { PatientId = patient.Id }))
|
||||
{
|
||||
recipeList.Add(recipe.IssueDate.ToString());
|
||||
foreach (var disease in _diseaseStorage.GetFilteredList(new DiseaseSearchModel { RecipeId = recipe.Id }))
|
||||
{
|
||||
diseaseList.Add(disease.Name);
|
||||
}
|
||||
}
|
||||
var record = new ReportPatientRecipeViewModel
|
||||
{
|
||||
Diseases = diseaseList,
|
||||
Recipes = recipeList
|
||||
};
|
||||
list.Add(record);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void SaveProcedureRecipesToWordFile(ReportBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<ListProceduresViewModel> GetRecipeProcedures(List<int> recipes)
|
||||
{
|
||||
|
||||
List<ListProceduresViewModel> ans = new();
|
||||
List<Tuple<RecipeViewModel, List<Tuple<PatientViewModel, List<ProcedureViewModel>>>>> response =
|
||||
_recipeStorage.GetReportInfo(new ListProceduresSearchModel { recipesIds = recipes });
|
||||
|
||||
foreach (var recipe in response)
|
||||
{
|
||||
Dictionary<int, (ProcedureViewModel, int)> counter = new();
|
||||
foreach (var patient in recipe.Item2)
|
||||
{
|
||||
foreach (var procedure in patient.Item2)
|
||||
{
|
||||
if (!counter.ContainsKey(procedure.Id))
|
||||
counter.Add(procedure.Id, (procedure, 1));
|
||||
else
|
||||
{
|
||||
counter[procedure.Id] = (counter[procedure.Id].Item1, counter[procedure.Id].Item2 + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<ProcedureViewModel> res = new();
|
||||
foreach (var cnt in counter)
|
||||
{
|
||||
if (cnt.Value.Item2 != recipe.Item2.Count)
|
||||
continue;
|
||||
res.Add(cnt.Value.Item1);
|
||||
}
|
||||
ans.Add(new ListProceduresViewModel
|
||||
{
|
||||
RecipeName = recipe.Item1.Description,
|
||||
Procedures = res
|
||||
});
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
}*/
|
||||
public List<ListProceduresViewModel> GetRecipeProcedures(List<int> recipes)
|
||||
{
|
||||
|
||||
List<ListProceduresViewModel> ans = new();
|
||||
List<Tuple<RecipeViewModel, List<Tuple<PatientViewModel, List<ProcedureViewModel>>>>> response =
|
||||
_recipeStorage.GetReportInfo(new ListProceduresSearchModel { recipesIds = recipes });
|
||||
|
||||
foreach (var recipe in response)
|
||||
{
|
||||
Dictionary<int, (ProcedureViewModel, int)> counter = new();
|
||||
foreach (var patient in recipe.Item2)
|
||||
{
|
||||
foreach (var procedure in patient.Item2)
|
||||
{
|
||||
if (!counter.ContainsKey(procedure.Id))
|
||||
counter.Add(procedure.Id, (procedure, 1));
|
||||
else
|
||||
{
|
||||
counter[procedure.Id] = (counter[procedure.Id].Item1, counter[procedure.Id].Item2 + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<ProcedureViewModel> res = new();
|
||||
foreach (var cnt in counter)
|
||||
{
|
||||
if (cnt.Value.Item2 != recipe.Item2.Count)
|
||||
continue;
|
||||
res.Add(cnt.Value.Item1);
|
||||
}
|
||||
ans.Add(new ListProceduresViewModel
|
||||
{
|
||||
RecipeName = recipe.Item1.Description,
|
||||
Procedures = res
|
||||
});
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
|
||||
public void SaveProceduresToExcelFile(ListProceduresBindingModel model)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfoDoctor
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список процедур для рецептов",
|
||||
RecipesProcedures = GetRecipeProcedures(model.Recipes)
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveProceduresToWordFile(ListProceduresBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfoDoctor
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список процедур для рецептов",
|
||||
RecipesProcedures = GetRecipeProcedures(model.Recipes)
|
||||
});
|
||||
}
|
||||
|
||||
public List<MedicinesDiseasesViewModel> GetPatientMedicinesAndDiseases(MedicinesDiseasesBindingModel model)
|
||||
{
|
||||
List<MedicinesDiseasesViewModel> ans = new();
|
||||
List<Tuple<PatientViewModel, List<Tuple<RecipeViewModel, List<DiseaseViewModel>>>>> responseDisease =
|
||||
_patientStorage.GetDiseasesInfo(new MedicineDiseasesSearchModel { DateFrom = model.DateFrom!, DateTo = model.DateTo!, DoctorId = model.DoctorId! });
|
||||
List<Tuple<PatientViewModel, List<Tuple<RecipeViewModel, List<MedicineViewModel>>>>> responseMedicines =
|
||||
_patientStorage.GetMedicinesInfo(new MedicineDiseasesSearchModel { DateFrom = model.DateFrom!, DateTo = model.DateTo!, DoctorId = model.DoctorId! });
|
||||
Dictionary<int, MedicinesDiseasesViewModel> dict = new();
|
||||
|
||||
foreach (var patient in responseDisease)
|
||||
{
|
||||
dict.Add(patient.Item1.Id, new());
|
||||
dict[patient.Item1.Id].PatientFIO = patient.Item1.FIO;
|
||||
dict[patient.Item1.Id].Date = patient.Item1.BirthDate;
|
||||
foreach (var recipe in patient.Item2)
|
||||
{
|
||||
foreach (var guidance in recipe.Item2)
|
||||
{
|
||||
dict[patient.Item1.Id].Diseases.Add(guidance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var patient in responseMedicines)
|
||||
{
|
||||
HashSet<int> used = new();
|
||||
foreach (var recipe in patient.Item2)
|
||||
{
|
||||
foreach (var medicine in recipe.Item2)
|
||||
{
|
||||
if (used.Contains(medicine.Id))
|
||||
continue;
|
||||
dict[patient.Item1.Id].Medicines.Add(medicine);
|
||||
}
|
||||
}
|
||||
ans.Add(dict[patient.Item1.Id]);
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
|
||||
public void SavePatientsToPdfFile(MedicinesDiseasesBindingModel model)
|
||||
{
|
||||
_saveToPdf.CreateDoc(new PdfInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список пациентов",
|
||||
DateFrom = model.DateFrom!,
|
||||
DateTo = model.DateTo!,
|
||||
Patients = GetPatientMedicinesAndDiseases(model)
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,89 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalBusinessLogic.OfficePackage;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicsContracts;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ReportLogicPharmacist : IReportLogicPharmacist
|
||||
{
|
||||
private readonly IProcedureStorage _procedureStorage;
|
||||
private readonly IMedicineStorage _medicineStorage;
|
||||
private readonly AbstractSaveToExcelPharmacist _saveToExcel;
|
||||
private readonly AbstractSaveToWordPharmacist _saveToWord;
|
||||
public ReportLogicPharmacist(IProcedureStorage procedureStorage, IMedicineStorage medicineStorage,
|
||||
AbstractSaveToExcelPharmacist saveToExcel, AbstractSaveToWordPharmacist saveToWord)
|
||||
{
|
||||
_procedureStorage = procedureStorage;
|
||||
_medicineStorage = medicineStorage;
|
||||
_saveToExcel = saveToExcel;
|
||||
_saveToWord = saveToWord;
|
||||
}
|
||||
|
||||
public List<ListRecipesViewModel> GetProcedureRecipes(List<int> procedures)
|
||||
{
|
||||
|
||||
List<ListRecipesViewModel> ans = new();
|
||||
List<Tuple<ProcedureViewModel, List<Tuple<MedicineViewModel, List<RecipeViewModel>>>>> response =
|
||||
_procedureStorage.GetReportInfo(new ListRecipesSearchModel { proceduresIds = procedures });
|
||||
|
||||
foreach (var procedure in response)
|
||||
{
|
||||
Dictionary<int, (RecipeViewModel, int)> counter = new();
|
||||
foreach (var medicine in procedure.Item2)
|
||||
{
|
||||
foreach (var recipe in medicine.Item2)
|
||||
{
|
||||
if (!counter.ContainsKey(recipe.Id))
|
||||
counter.Add(recipe.Id, (recipe, 1));
|
||||
else
|
||||
{
|
||||
counter[recipe.Id] = (counter[recipe.Id].Item1, counter[recipe.Id].Item2 + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<RecipeViewModel> res = new();
|
||||
foreach (var cnt in counter)
|
||||
{
|
||||
if (cnt.Value.Item2 != procedure.Item2.Count)
|
||||
continue;
|
||||
res.Add(cnt.Value.Item1);
|
||||
}
|
||||
ans.Add(new ListRecipesViewModel
|
||||
{
|
||||
ProcedureName = procedure.Item1.Name,
|
||||
Recipes = res
|
||||
});
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
|
||||
public void SaveRecipesToExcelFile(ListRecipesBindingModel model)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfoPharmacist
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список рецептов для процедур",
|
||||
ProceduresRecipes = GetProcedureRecipes(model.Procedures)
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveRecipesToWordFile(ListRecipesBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfoPharmacist
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список рецептов для процедур",
|
||||
ProceduresRecipes = GetProcedureRecipes(model.Procedures)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.9" />
|
||||
<PackageReference Include="Microsoft.NETCore.App" Version="2.1.30" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\HospitalContracts\HospitalContracts.csproj" />
|
||||
<ProjectReference Include="..\HospitalDataModels\HospitalDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,64 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.BusinessLogicContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.MailWorker
|
||||
{
|
||||
public abstract class AbstractMailWorker
|
||||
{
|
||||
protected string _mailLogin = string.Empty;
|
||||
protected string _mailPassword = string.Empty;
|
||||
protected string _smtpClientHost = string.Empty;
|
||||
protected int _smtpClientPort;
|
||||
protected string _popHost = string.Empty;
|
||||
protected int _popPort;
|
||||
private readonly IPharmacistLogic _pharmacistLogic;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public AbstractMailWorker(ILogger<AbstractMailWorker> logger, IPharmacistLogic pharmacistLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_pharmacistLogic = pharmacistLogic;
|
||||
}
|
||||
|
||||
public void MailConfig(MailConfigBindingModel config)
|
||||
{
|
||||
_mailLogin = config.MailLogin;
|
||||
_mailPassword = config.MailPassword;
|
||||
_smtpClientHost = config.SmtpClientHost;
|
||||
_smtpClientPort = config.SmtpClientPort;
|
||||
_popHost = config.PopHost;
|
||||
_popPort = config.PopPort;
|
||||
_logger.LogDebug("Config: {login}, {password}, {clientHost}, {clientPOrt}, {popHost}, {popPort}", _mailLogin, _mailPassword, _smtpClientHost, _smtpClientPort, _popHost, _popPort);
|
||||
}
|
||||
|
||||
public async void MailSendAsync(MailSendInfoBindingModel info)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_mailLogin) || string.IsNullOrEmpty(_mailPassword))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(_smtpClientHost) || _smtpClientPort == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(info.MailAddress) || string.IsNullOrEmpty(info.Subject) || string.IsNullOrEmpty(info.Text))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogDebug("Send Mail: {To}, {Subject}", info.MailAddress, info.Subject);
|
||||
|
||||
await SendMailAsync(info);
|
||||
}
|
||||
|
||||
protected abstract Task SendMailAsync(MailSendInfoBindingModel info);
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
using HospitalContracts.BusinessLogicContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Mail;
|
||||
using System.Net.Mime;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalContracts.BindingModels;
|
||||
|
||||
namespace HospitalBusinessLogic.MailWorker
|
||||
{
|
||||
public class MailKitWorker : AbstractMailWorker
|
||||
{
|
||||
public MailKitWorker(ILogger<MailKitWorker> logger, IPharmacistLogic pharmacistLogic) : base(logger, pharmacistLogic) { }
|
||||
|
||||
protected override async Task SendMailAsync(MailSendInfoBindingModel info)
|
||||
{
|
||||
using var objMailMessage = new MailMessage();
|
||||
using var objSmtpClient = new SmtpClient(_smtpClientHost, _smtpClientPort);
|
||||
|
||||
try
|
||||
{
|
||||
objMailMessage.From = new MailAddress(_mailLogin);
|
||||
objMailMessage.To.Add(new MailAddress(info.MailAddress));
|
||||
objMailMessage.Subject = info.Subject;
|
||||
objMailMessage.Body = info.Text;
|
||||
objMailMessage.SubjectEncoding = Encoding.UTF8;
|
||||
objMailMessage.BodyEncoding = Encoding.UTF8;
|
||||
Attachment attachment = new Attachment("C:\\ReportsCourseWork\\pdffile.pdf", new ContentType(MediaTypeNames.Application.Pdf));
|
||||
objMailMessage.Attachments.Add(attachment);
|
||||
|
||||
objSmtpClient.UseDefaultCredentials = false;
|
||||
objSmtpClient.EnableSsl = true;
|
||||
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
|
||||
objSmtpClient.Credentials = new NetworkCredential(_mailLogin, _mailPassword);
|
||||
|
||||
await Task.Run(() => objSmtpClient.Send(objMailMessage));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToExcelDoctor
|
||||
{
|
||||
public void CreateReport(ExcelInfoDoctor info)
|
||||
{
|
||||
CreateExcel(info);
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 1,
|
||||
Text = info.Title,
|
||||
StyleInfo = ExcelStyleInfoType.Title
|
||||
});
|
||||
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "C1"
|
||||
});
|
||||
|
||||
uint rowIndex = 2;
|
||||
|
||||
foreach (var rec in info.RecipesProcedures)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = rec.ProcedureName,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
|
||||
foreach (var animal in rec.Procedures)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = animal.Name,
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
SaveExcel(info);
|
||||
}
|
||||
|
||||
protected abstract void CreateExcel(ExcelInfoDoctor info);
|
||||
|
||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
||||
|
||||
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
||||
|
||||
protected abstract void SaveExcel(ExcelInfoDoctor info);
|
||||
}
|
||||
}
|
||||
|
@ -1,72 +0,0 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToExcelPharmacist
|
||||
{
|
||||
public void CreateReport(ExcelInfoPharmacist info)
|
||||
{
|
||||
CreateExcel(info);
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 1,
|
||||
Text = info.Title,
|
||||
StyleInfo = ExcelStyleInfoType.Title
|
||||
});
|
||||
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "C1"
|
||||
});
|
||||
|
||||
uint rowIndex = 2;
|
||||
|
||||
foreach (var rec in info.ProceduresRecipes)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = rec.ProcedureName,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
|
||||
foreach (var animal in rec.Recipes)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = animal.Description,
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
SaveExcel(info);
|
||||
}
|
||||
|
||||
protected abstract void CreateExcel(ExcelInfoPharmacist info);
|
||||
|
||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
||||
|
||||
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
||||
|
||||
protected abstract void SaveExcel(ExcelInfoPharmacist info);
|
||||
}
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToPdfDoctor
|
||||
{
|
||||
public void CreateDoc(PdfInfo info)
|
||||
{
|
||||
CreatePdf(info);
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = info.Title,
|
||||
Style =
|
||||
"NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
||||
Style
|
||||
= "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
CreateTable(new List<string> { "4cm", "4cm", "4cm", "4cm" });
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "Дата", "ФИО пациента", "Болезнь",
|
||||
"Лекарство" },
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
foreach (var patient in info.Patients)
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { patient.Date.ToString(), patient.PatientFIO, "", "" },
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
foreach (var disease in patient.Diseases)
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "", "", disease.Name.ToString(), "" },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
}
|
||||
foreach (var medicine in patient.Medicines)
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "", "", "", medicine.Name.ToString() },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
SavePdf(info);
|
||||
}
|
||||
protected abstract void CreatePdf(PdfInfo info);
|
||||
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
||||
protected abstract void CreateTable(List<string> columns);
|
||||
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
||||
protected abstract void SavePdf(PdfInfo info);
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToWordDoctor
|
||||
{
|
||||
public void CreateDoc(WordInfoDoctor info)
|
||||
{
|
||||
CreateWord(info);
|
||||
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var rec in info.RecipesProcedures)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)>
|
||||
{ (rec.ProcedureName, new WordTextProperties { Size = "24", Bold=true})},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var procedure in rec.Procedures)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)>
|
||||
{ (procedure.Name, new WordTextProperties { Size = "20", Bold=false})},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
SaveWord(info);
|
||||
}
|
||||
|
||||
protected abstract void CreateWord(WordInfoDoctor info);
|
||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||
protected abstract void SaveWord(WordInfoDoctor info);
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToWordPharmacist
|
||||
{
|
||||
public void CreateDoc(WordInfoPharmacist info)
|
||||
{
|
||||
CreateWord(info);
|
||||
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var rec in info.ProceduresRecipes)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)>
|
||||
{ (rec.ProcedureName, new WordTextProperties { Size = "24", Bold=true})},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var animal in rec.Recipes)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)>
|
||||
{ (animal.Description, new WordTextProperties { Size = "20", Bold=false})},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
SaveWord(info);
|
||||
}
|
||||
|
||||
protected abstract void CreateWord(WordInfoPharmacist info);
|
||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||
protected abstract void SaveWord(WordInfoPharmacist info);
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum ExcelStyleInfoType
|
||||
{
|
||||
Title,
|
||||
Text,
|
||||
TextWithBroder
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum PdfParagraphAlignmentType
|
||||
{
|
||||
Center,
|
||||
Left,
|
||||
Rigth
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum WordJustificationType
|
||||
{
|
||||
Center,
|
||||
Both
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelCellParameters
|
||||
{
|
||||
public string ColumnName { get; set; } = string.Empty;
|
||||
public uint RowIndex { get; set; }
|
||||
public string Text { get; set; } = string.Empty;
|
||||
public string CellReference => $"{ColumnName}{RowIndex}";
|
||||
public ExcelStyleInfoType StyleInfo { get; set; }
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelInfoDoctor
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ListProceduresViewModel> RecipesProcedures
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelInfoPharmacist
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ListRecipesViewModel> ProceduresRecipes
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelMergeParameters
|
||||
{
|
||||
public string CellFromName { get; set; } = string.Empty;
|
||||
public string CellToName { get; set; } = string.Empty;
|
||||
public string Merge => $"{CellFromName}:{CellToName}";
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfInfo
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public DateTime DateFrom { get; set; }
|
||||
public DateTime DateTo { get; set; }
|
||||
public List<MedicinesDiseasesViewModel> Patients { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfParagraph
|
||||
{
|
||||
public string Text { get; set; } = string.Empty;
|
||||
public string Style { get; set; } = string.Empty;
|
||||
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfRowParameters
|
||||
{
|
||||
public List<string> Texts { get; set; } = new();
|
||||
public string Style { get; set; } = string.Empty;
|
||||
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordInfoDoctor
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ListProceduresViewModel> RecipesProcedures { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordInfoPharmacist
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ListRecipesViewModel> ProceduresRecipes { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordParagraph
|
||||
{
|
||||
public List<(string, WordTextProperties)> Texts { get; set; } = new();
|
||||
public WordTextProperties? TextProperties { get; set; }
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordTextProperties
|
||||
{
|
||||
public string Size { get; set; } = string.Empty;
|
||||
public bool Bold { get; set; }
|
||||
public WordJustificationType JustificationType { get; set; }
|
||||
}
|
||||
}
|
@ -1,333 +0,0 @@
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using DocumentFormat.OpenXml.Office2013.Excel;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using DocumentFormat.OpenXml;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToExcelDoctor : AbstractSaveToExcelDoctor
|
||||
{
|
||||
private SpreadsheetDocument? _spreadsheetDocument;
|
||||
private SharedStringTablePart? _shareStringPart;
|
||||
private Worksheet? _worksheet;
|
||||
|
||||
private static void CreateStyles(WorkbookPart workbookpart)
|
||||
{
|
||||
var sp = workbookpart.AddNewPart<WorkbookStylesPart>();
|
||||
sp.Stylesheet = new Stylesheet();
|
||||
|
||||
var fonts = new Fonts() { Count = 2U, KnownFonts = true };
|
||||
|
||||
var fontUsual = new Font();
|
||||
fontUsual.Append(new FontSize() { Val = 12D });
|
||||
fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Theme = 1U });
|
||||
fontUsual.Append(new FontName() { Val = "Times New Roman" });
|
||||
fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
|
||||
fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||
|
||||
var fontTitle = new Font();
|
||||
fontTitle.Append(new Bold());
|
||||
fontTitle.Append(new FontSize() { Val = 14D });
|
||||
fontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Theme = 1U });
|
||||
fontTitle.Append(new FontName() { Val = "Times New Roman" });
|
||||
fontTitle.Append(new FontFamilyNumbering() { Val = 2 });
|
||||
fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||
|
||||
fonts.Append(fontUsual);
|
||||
fonts.Append(fontTitle);
|
||||
|
||||
var fills = new Fills() { Count = 2U };
|
||||
|
||||
var fill1 = new Fill();
|
||||
fill1.Append(new PatternFill() { PatternType = PatternValues.None });
|
||||
|
||||
var fill2 = new Fill();
|
||||
fill2.Append(new PatternFill() { PatternType = PatternValues.Gray125 });
|
||||
|
||||
fills.Append(fill1);
|
||||
fills.Append(fill2);
|
||||
|
||||
var borders = new Borders() { Count = 2U };
|
||||
|
||||
var borderNoBorder = new Border();
|
||||
borderNoBorder.Append(new LeftBorder());
|
||||
borderNoBorder.Append(new RightBorder());
|
||||
borderNoBorder.Append(new TopBorder());
|
||||
borderNoBorder.Append(new BottomBorder());
|
||||
borderNoBorder.Append(new DiagonalBorder());
|
||||
|
||||
var borderThin = new Border();
|
||||
|
||||
var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
|
||||
leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
|
||||
var rightBorder = new RightBorder() { Style = BorderStyleValues.Thin };
|
||||
rightBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
|
||||
var topBorder = new TopBorder() { Style = BorderStyleValues.Thin };
|
||||
topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
|
||||
var bottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin };
|
||||
bottomBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
|
||||
borderThin.Append(leftBorder);
|
||||
borderThin.Append(rightBorder);
|
||||
borderThin.Append(topBorder);
|
||||
borderThin.Append(bottomBorder);
|
||||
borderThin.Append(new DiagonalBorder());
|
||||
|
||||
borders.Append(borderNoBorder);
|
||||
borders.Append(borderThin);
|
||||
|
||||
var cellStyleFormats = new CellStyleFormats()
|
||||
{
|
||||
Count = 1U
|
||||
};
|
||||
var cellFormatStyle = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId = 0U,
|
||||
FillId = 0U,
|
||||
BorderId = 0U
|
||||
};
|
||||
|
||||
cellStyleFormats.Append(cellFormatStyle);
|
||||
|
||||
var cellFormats = new CellFormats()
|
||||
{
|
||||
Count = 3U
|
||||
};
|
||||
var cellFormatFont = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId = 0U,
|
||||
FillId = 0U,
|
||||
BorderId = 0U,
|
||||
FormatId = 0U,
|
||||
ApplyFont = true
|
||||
};
|
||||
var cellFormatFontAndBorder = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId = 0U,
|
||||
FillId = 0U,
|
||||
BorderId = 1U,
|
||||
FormatId = 0U,
|
||||
ApplyFont = true,
|
||||
ApplyBorder = true
|
||||
};
|
||||
var cellFormatTitle = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId = 1U,
|
||||
FillId = 0U,
|
||||
BorderId = 0U,
|
||||
FormatId = 0U,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true,
|
||||
Horizontal = HorizontalAlignmentValues.Center
|
||||
},
|
||||
ApplyFont = true
|
||||
};
|
||||
cellFormats.Append(cellFormatFont);
|
||||
cellFormats.Append(cellFormatFontAndBorder);
|
||||
cellFormats.Append(cellFormatTitle);
|
||||
var cellStyles = new CellStyles() { Count = 1U };
|
||||
cellStyles.Append(new CellStyle()
|
||||
{
|
||||
Name = "Normal",
|
||||
FormatId = 0U,
|
||||
BuiltinId = 0U
|
||||
});
|
||||
var differentialFormats = new DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats()
|
||||
{
|
||||
Count = 0U
|
||||
};
|
||||
|
||||
var tableStyles = new TableStyles()
|
||||
{
|
||||
Count = 0U,
|
||||
DefaultTableStyle = "TableStyleMedium2",
|
||||
DefaultPivotStyle = "PivotStyleLight16"
|
||||
};
|
||||
var stylesheetExtensionList = new StylesheetExtensionList();
|
||||
var stylesheetExtension1 = new StylesheetExtension()
|
||||
{
|
||||
Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"
|
||||
};
|
||||
stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||
stylesheetExtension1.Append(new SlicerStyles()
|
||||
{
|
||||
DefaultSlicerStyle = "SlicerStyleLight1"
|
||||
});
|
||||
var stylesheetExtension2 = new StylesheetExtension()
|
||||
{
|
||||
Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}"
|
||||
};
|
||||
stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");
|
||||
stylesheetExtension2.Append(new TimelineStyles()
|
||||
{
|
||||
DefaultTimelineStyle = "TimeSlicerStyleLight1"
|
||||
});
|
||||
|
||||
stylesheetExtensionList.Append(stylesheetExtension1);
|
||||
stylesheetExtensionList.Append(stylesheetExtension2);
|
||||
|
||||
sp.Stylesheet.Append(fonts);
|
||||
sp.Stylesheet.Append(fills);
|
||||
sp.Stylesheet.Append(borders);
|
||||
sp.Stylesheet.Append(cellStyleFormats);
|
||||
sp.Stylesheet.Append(cellFormats);
|
||||
sp.Stylesheet.Append(cellStyles);
|
||||
sp.Stylesheet.Append(differentialFormats);
|
||||
sp.Stylesheet.Append(tableStyles);
|
||||
sp.Stylesheet.Append(stylesheetExtensionList);
|
||||
}
|
||||
|
||||
private static uint GetStyleValue(ExcelStyleInfoType styleInfo)
|
||||
{
|
||||
return styleInfo switch
|
||||
{
|
||||
ExcelStyleInfoType.Title => 2U,
|
||||
ExcelStyleInfoType.TextWithBroder => 1U,
|
||||
ExcelStyleInfoType.Text => 0U,
|
||||
_ => 0U,
|
||||
};
|
||||
}
|
||||
|
||||
protected override void CreateExcel(ExcelInfoDoctor info)
|
||||
{
|
||||
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName, SpreadsheetDocumentType.Workbook);
|
||||
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
|
||||
workbookpart.Workbook = new Workbook();
|
||||
CreateStyles(workbookpart);
|
||||
_shareStringPart = _spreadsheetDocument.WorkbookPart!.GetPartsOfType<SharedStringTablePart>().Any() ? _spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First() : _spreadsheetDocument.WorkbookPart.AddNewPart<SharedStringTablePart>();
|
||||
|
||||
if (_shareStringPart.SharedStringTable == null)
|
||||
{
|
||||
_shareStringPart.SharedStringTable = new SharedStringTable();
|
||||
}
|
||||
|
||||
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
||||
worksheetPart.Worksheet = new Worksheet(new SheetData());
|
||||
|
||||
var sheets = _spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
|
||||
var sheet = new Sheet()
|
||||
{
|
||||
Id = _spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
||||
SheetId = 1,
|
||||
Name = "Лист"
|
||||
};
|
||||
sheets.Append(sheet);
|
||||
_worksheet = worksheetPart.Worksheet;
|
||||
}
|
||||
|
||||
protected override void InsertCellInWorksheet(ExcelCellParameters excelParams)
|
||||
{
|
||||
if (_worksheet == null || _shareStringPart == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var sheetData = _worksheet.GetFirstChild<SheetData>();
|
||||
|
||||
if (sheetData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Row row;
|
||||
|
||||
if (sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).Any())
|
||||
{
|
||||
row = sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).First();
|
||||
}
|
||||
else
|
||||
{
|
||||
row = new Row() { RowIndex = excelParams.RowIndex };
|
||||
sheetData.Append(row);
|
||||
}
|
||||
|
||||
Cell cell;
|
||||
|
||||
if (row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).Any())
|
||||
{
|
||||
cell = row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).First();
|
||||
}
|
||||
else
|
||||
{
|
||||
Cell? refCell = null;
|
||||
foreach (Cell rowCell in row.Elements<Cell>())
|
||||
{
|
||||
if (string.Compare(rowCell.CellReference!.Value, excelParams.CellReference, true) > 0)
|
||||
{
|
||||
refCell = rowCell;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var newCell = new Cell()
|
||||
{
|
||||
CellReference = excelParams.CellReference
|
||||
};
|
||||
row.InsertBefore(newCell, refCell);
|
||||
cell = newCell;
|
||||
}
|
||||
|
||||
_shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new Text(excelParams.Text)));
|
||||
_shareStringPart.SharedStringTable.Save();
|
||||
cell.CellValue = new CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count() - 1).ToString());
|
||||
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
|
||||
cell.StyleIndex = GetStyleValue(excelParams.StyleInfo);
|
||||
}
|
||||
|
||||
protected override void MergeCells(ExcelMergeParameters excelParams)
|
||||
{
|
||||
if (_worksheet == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
MergeCells mergeCells;
|
||||
if (_worksheet.Elements<MergeCells>().Any())
|
||||
{
|
||||
mergeCells = _worksheet.Elements<MergeCells>().First();
|
||||
}
|
||||
else
|
||||
{
|
||||
mergeCells = new MergeCells();
|
||||
if (_worksheet.Elements<CustomSheetView>().Any())
|
||||
{
|
||||
_worksheet.InsertAfter(mergeCells, _worksheet.Elements<CustomSheetView>().First());
|
||||
}
|
||||
else
|
||||
{
|
||||
_worksheet.InsertAfter(mergeCells, _worksheet.Elements<SheetData>().First());
|
||||
}
|
||||
}
|
||||
var mergeCell = new MergeCell()
|
||||
{
|
||||
Reference = new StringValue(excelParams.Merge)
|
||||
};
|
||||
mergeCells.Append(mergeCell);
|
||||
}
|
||||
|
||||
protected override void SaveExcel(ExcelInfoDoctor info)
|
||||
{
|
||||
if (_spreadsheetDocument == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
||||
_spreadsheetDocument.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,335 +0,0 @@
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using DocumentFormat.OpenXml.Office2013.Excel;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using HospitalBusinessLogic.OfficePackage;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VetClinicBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToExcelPharmacist : AbstractSaveToExcelPharmacist
|
||||
{
|
||||
private SpreadsheetDocument? _spreadsheetDocument;
|
||||
private SharedStringTablePart? _shareStringPart;
|
||||
private Worksheet? _worksheet;
|
||||
|
||||
private static void CreateStyles(WorkbookPart workbookpart)
|
||||
{
|
||||
var sp = workbookpart.AddNewPart<WorkbookStylesPart>();
|
||||
sp.Stylesheet = new Stylesheet();
|
||||
|
||||
var fonts = new Fonts() { Count = 2U, KnownFonts = true };
|
||||
|
||||
var fontUsual = new Font();
|
||||
fontUsual.Append(new FontSize() { Val = 12D });
|
||||
fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Theme = 1U });
|
||||
fontUsual.Append(new FontName() { Val = "Times New Roman" });
|
||||
fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
|
||||
fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||
|
||||
var fontTitle = new Font();
|
||||
fontTitle.Append(new Bold());
|
||||
fontTitle.Append(new FontSize() { Val = 14D });
|
||||
fontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Theme = 1U });
|
||||
fontTitle.Append(new FontName() { Val = "Times New Roman" });
|
||||
fontTitle.Append(new FontFamilyNumbering() { Val = 2 });
|
||||
fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
||||
|
||||
fonts.Append(fontUsual);
|
||||
fonts.Append(fontTitle);
|
||||
|
||||
var fills = new Fills() { Count = 2U };
|
||||
|
||||
var fill1 = new Fill();
|
||||
fill1.Append(new PatternFill() { PatternType = PatternValues.None });
|
||||
|
||||
var fill2 = new Fill();
|
||||
fill2.Append(new PatternFill() { PatternType = PatternValues.Gray125 });
|
||||
|
||||
fills.Append(fill1);
|
||||
fills.Append(fill2);
|
||||
|
||||
var borders = new Borders() { Count = 2U };
|
||||
|
||||
var borderNoBorder = new Border();
|
||||
borderNoBorder.Append(new LeftBorder());
|
||||
borderNoBorder.Append(new RightBorder());
|
||||
borderNoBorder.Append(new TopBorder());
|
||||
borderNoBorder.Append(new BottomBorder());
|
||||
borderNoBorder.Append(new DiagonalBorder());
|
||||
|
||||
var borderThin = new Border();
|
||||
|
||||
var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
|
||||
leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
|
||||
var rightBorder = new RightBorder() { Style = BorderStyleValues.Thin };
|
||||
rightBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
|
||||
var topBorder = new TopBorder() { Style = BorderStyleValues.Thin };
|
||||
topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
|
||||
var bottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin };
|
||||
bottomBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color() { Indexed = 64U });
|
||||
|
||||
borderThin.Append(leftBorder);
|
||||
borderThin.Append(rightBorder);
|
||||
borderThin.Append(topBorder);
|
||||
borderThin.Append(bottomBorder);
|
||||
borderThin.Append(new DiagonalBorder());
|
||||
|
||||
borders.Append(borderNoBorder);
|
||||
borders.Append(borderThin);
|
||||
|
||||
var cellStyleFormats = new CellStyleFormats()
|
||||
{
|
||||
Count = 1U
|
||||
};
|
||||
var cellFormatStyle = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId = 0U,
|
||||
FillId = 0U,
|
||||
BorderId = 0U
|
||||
};
|
||||
|
||||
cellStyleFormats.Append(cellFormatStyle);
|
||||
|
||||
var cellFormats = new CellFormats()
|
||||
{
|
||||
Count = 3U
|
||||
};
|
||||
var cellFormatFont = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId = 0U,
|
||||
FillId = 0U,
|
||||
BorderId = 0U,
|
||||
FormatId = 0U,
|
||||
ApplyFont = true
|
||||
};
|
||||
var cellFormatFontAndBorder = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId = 0U,
|
||||
FillId = 0U,
|
||||
BorderId = 1U,
|
||||
FormatId = 0U,
|
||||
ApplyFont = true,
|
||||
ApplyBorder = true
|
||||
};
|
||||
var cellFormatTitle = new CellFormat()
|
||||
{
|
||||
NumberFormatId = 0U,
|
||||
FontId = 1U,
|
||||
FillId = 0U,
|
||||
BorderId = 0U,
|
||||
FormatId = 0U,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true,
|
||||
Horizontal = HorizontalAlignmentValues.Center
|
||||
},
|
||||
ApplyFont = true
|
||||
};
|
||||
cellFormats.Append(cellFormatFont);
|
||||
cellFormats.Append(cellFormatFontAndBorder);
|
||||
cellFormats.Append(cellFormatTitle);
|
||||
var cellStyles = new CellStyles() { Count = 1U };
|
||||
cellStyles.Append(new CellStyle()
|
||||
{
|
||||
Name = "Normal",
|
||||
FormatId = 0U,
|
||||
BuiltinId = 0U
|
||||
});
|
||||
var differentialFormats = new DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats()
|
||||
{
|
||||
Count = 0U
|
||||
};
|
||||
|
||||
var tableStyles = new TableStyles()
|
||||
{
|
||||
Count = 0U,
|
||||
DefaultTableStyle = "TableStyleMedium2",
|
||||
DefaultPivotStyle = "PivotStyleLight16"
|
||||
};
|
||||
var stylesheetExtensionList = new StylesheetExtensionList();
|
||||
var stylesheetExtension1 = new StylesheetExtension()
|
||||
{
|
||||
Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"
|
||||
};
|
||||
stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||
stylesheetExtension1.Append(new SlicerStyles()
|
||||
{
|
||||
DefaultSlicerStyle = "SlicerStyleLight1"
|
||||
});
|
||||
var stylesheetExtension2 = new StylesheetExtension()
|
||||
{
|
||||
Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}"
|
||||
};
|
||||
stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");
|
||||
stylesheetExtension2.Append(new TimelineStyles()
|
||||
{
|
||||
DefaultTimelineStyle = "TimeSlicerStyleLight1"
|
||||
});
|
||||
|
||||
stylesheetExtensionList.Append(stylesheetExtension1);
|
||||
stylesheetExtensionList.Append(stylesheetExtension2);
|
||||
|
||||
sp.Stylesheet.Append(fonts);
|
||||
sp.Stylesheet.Append(fills);
|
||||
sp.Stylesheet.Append(borders);
|
||||
sp.Stylesheet.Append(cellStyleFormats);
|
||||
sp.Stylesheet.Append(cellFormats);
|
||||
sp.Stylesheet.Append(cellStyles);
|
||||
sp.Stylesheet.Append(differentialFormats);
|
||||
sp.Stylesheet.Append(tableStyles);
|
||||
sp.Stylesheet.Append(stylesheetExtensionList);
|
||||
}
|
||||
|
||||
private static uint GetStyleValue(ExcelStyleInfoType styleInfo)
|
||||
{
|
||||
return styleInfo switch
|
||||
{
|
||||
ExcelStyleInfoType.Title => 2U,
|
||||
ExcelStyleInfoType.TextWithBroder => 1U,
|
||||
ExcelStyleInfoType.Text => 0U,
|
||||
_ => 0U,
|
||||
};
|
||||
}
|
||||
|
||||
protected override void CreateExcel(ExcelInfoPharmacist info)
|
||||
{
|
||||
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName, SpreadsheetDocumentType.Workbook);
|
||||
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
|
||||
workbookpart.Workbook = new Workbook();
|
||||
CreateStyles(workbookpart);
|
||||
_shareStringPart = _spreadsheetDocument.WorkbookPart!.GetPartsOfType<SharedStringTablePart>().Any() ? _spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First() : _spreadsheetDocument.WorkbookPart.AddNewPart<SharedStringTablePart>();
|
||||
|
||||
if (_shareStringPart.SharedStringTable == null)
|
||||
{
|
||||
_shareStringPart.SharedStringTable = new SharedStringTable();
|
||||
}
|
||||
|
||||
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
||||
worksheetPart.Worksheet = new Worksheet(new SheetData());
|
||||
|
||||
var sheets = _spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
|
||||
var sheet = new Sheet()
|
||||
{
|
||||
Id = _spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
||||
SheetId = 1,
|
||||
Name = "Лист"
|
||||
};
|
||||
sheets.Append(sheet);
|
||||
_worksheet = worksheetPart.Worksheet;
|
||||
}
|
||||
|
||||
protected override void InsertCellInWorksheet(ExcelCellParameters excelParams)
|
||||
{
|
||||
if (_worksheet == null || _shareStringPart == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var sheetData = _worksheet.GetFirstChild<SheetData>();
|
||||
|
||||
if (sheetData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Row row;
|
||||
|
||||
if (sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).Any())
|
||||
{
|
||||
row = sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).First();
|
||||
}
|
||||
else
|
||||
{
|
||||
row = new Row() { RowIndex = excelParams.RowIndex };
|
||||
sheetData.Append(row);
|
||||
}
|
||||
|
||||
Cell cell;
|
||||
|
||||
if (row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).Any())
|
||||
{
|
||||
cell = row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).First();
|
||||
}
|
||||
else
|
||||
{
|
||||
Cell? refCell = null;
|
||||
foreach (Cell rowCell in row.Elements<Cell>())
|
||||
{
|
||||
if (string.Compare(rowCell.CellReference!.Value, excelParams.CellReference, true) > 0)
|
||||
{
|
||||
refCell = rowCell;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var newCell = new Cell()
|
||||
{
|
||||
CellReference = excelParams.CellReference
|
||||
};
|
||||
row.InsertBefore(newCell, refCell);
|
||||
cell = newCell;
|
||||
}
|
||||
|
||||
_shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new Text(excelParams.Text)));
|
||||
_shareStringPart.SharedStringTable.Save();
|
||||
cell.CellValue = new CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count() - 1).ToString());
|
||||
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
|
||||
cell.StyleIndex = GetStyleValue(excelParams.StyleInfo);
|
||||
}
|
||||
|
||||
protected override void MergeCells(ExcelMergeParameters excelParams)
|
||||
{
|
||||
if (_worksheet == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
MergeCells mergeCells;
|
||||
if (_worksheet.Elements<MergeCells>().Any())
|
||||
{
|
||||
mergeCells = _worksheet.Elements<MergeCells>().First();
|
||||
}
|
||||
else
|
||||
{
|
||||
mergeCells = new MergeCells();
|
||||
if (_worksheet.Elements<CustomSheetView>().Any())
|
||||
{
|
||||
_worksheet.InsertAfter(mergeCells, _worksheet.Elements<CustomSheetView>().First());
|
||||
}
|
||||
else
|
||||
{
|
||||
_worksheet.InsertAfter(mergeCells, _worksheet.Elements<SheetData>().First());
|
||||
}
|
||||
}
|
||||
var mergeCell = new MergeCell()
|
||||
{
|
||||
Reference = new StringValue(excelParams.Merge)
|
||||
};
|
||||
mergeCells.Append(mergeCell);
|
||||
}
|
||||
|
||||
protected override void SaveExcel(ExcelInfoPharmacist info)
|
||||
{
|
||||
if (_spreadsheetDocument == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
||||
_spreadsheetDocument.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.Rendering;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.DocumentObjectModel.Tables;
|
||||
using MigraDoc.Rendering;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToPdfDoctor : AbstractSaveToPdfDoctor
|
||||
{
|
||||
private Document? _document;
|
||||
private Section? _section;
|
||||
private Table? _table;
|
||||
private static ParagraphAlignment
|
||||
GetParagraphAlignment(PdfParagraphAlignmentType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
|
||||
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
|
||||
PdfParagraphAlignmentType.Rigth => ParagraphAlignment.Right,
|
||||
_ => ParagraphAlignment.Justify,
|
||||
};
|
||||
}
|
||||
/// <summary>
|
||||
/// Создание стилей для документа
|
||||
/// </summary>
|
||||
/// <param name="document"></param>
|
||||
private static void DefineStyles(Document document)
|
||||
{
|
||||
var style = document.Styles["Normal"];
|
||||
style.Font.Name = "Times New Roman";
|
||||
style.Font.Size = 14;
|
||||
style = document.Styles.AddStyle("NormalTitle", "Normal");
|
||||
style.Font.Bold = true;
|
||||
}
|
||||
protected override void CreatePdf(PdfInfo info)
|
||||
{
|
||||
_document = new Document();
|
||||
DefineStyles(_document);
|
||||
_section = _document.AddSection();
|
||||
}
|
||||
protected override void CreateParagraph(PdfParagraph pdfParagraph)
|
||||
{
|
||||
if (_section == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var paragraph = _section.AddParagraph(pdfParagraph.Text);
|
||||
paragraph.Format.SpaceAfter = "1cm";
|
||||
paragraph.Format.Alignment =
|
||||
GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
|
||||
paragraph.Style = pdfParagraph.Style;
|
||||
}
|
||||
protected override void CreateTable(List<string> columns)
|
||||
{
|
||||
if (_document == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_table = _document.LastSection.AddTable();
|
||||
foreach (var elem in columns)
|
||||
{
|
||||
_table.AddColumn(elem);
|
||||
}
|
||||
}
|
||||
protected override void CreateRow(PdfRowParameters rowParameters)
|
||||
{
|
||||
if (_table == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var row = _table.AddRow();
|
||||
for (int i = 0; i < rowParameters.Texts.Count; ++i)
|
||||
{
|
||||
row.Cells[i].AddParagraph(rowParameters.Texts[i]);
|
||||
if (!string.IsNullOrEmpty(rowParameters.Style))
|
||||
{
|
||||
row.Cells[i].Style = rowParameters.Style;
|
||||
}
|
||||
Unit borderWidth = 0.5;
|
||||
row.Cells[i].Borders.Left.Width = borderWidth;
|
||||
row.Cells[i].Borders.Right.Width = borderWidth;
|
||||
row.Cells[i].Borders.Top.Width = borderWidth;
|
||||
row.Cells[i].Borders.Bottom.Width = borderWidth;
|
||||
row.Cells[i].Format.Alignment =
|
||||
GetParagraphAlignment(rowParameters.ParagraphAlignment);
|
||||
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
|
||||
}
|
||||
}
|
||||
protected override void SavePdf(PdfInfo info)
|
||||
{
|
||||
var renderer = new PdfDocumentRenderer(true)
|
||||
{
|
||||
Document = _document
|
||||
};
|
||||
renderer.RenderDocument();
|
||||
renderer.PdfDocument.Save(info.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using DocumentFormat.OpenXml;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToWordDoctor : AbstractSaveToWordDoctor
|
||||
{
|
||||
private WordprocessingDocument? _wordDocument;
|
||||
private Body? _docBody;
|
||||
private static JustificationValues
|
||||
GetJustificationValues(WordJustificationType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
WordJustificationType.Both => JustificationValues.Both,
|
||||
WordJustificationType.Center => JustificationValues.Center,
|
||||
_ => JustificationValues.Left,
|
||||
};
|
||||
}
|
||||
private static SectionProperties CreateSectionProperties()
|
||||
{
|
||||
var properties = new SectionProperties();
|
||||
var pageSize = new PageSize
|
||||
{
|
||||
Orient = PageOrientationValues.Portrait
|
||||
};
|
||||
properties.AppendChild(pageSize);
|
||||
return properties;
|
||||
}
|
||||
|
||||
private static ParagraphProperties?
|
||||
CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
||||
{
|
||||
if (paragraphProperties == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var properties = new ParagraphProperties();
|
||||
properties.AppendChild(new Justification()
|
||||
{
|
||||
Val =
|
||||
GetJustificationValues(paragraphProperties.JustificationType)
|
||||
});
|
||||
properties.AppendChild(new SpacingBetweenLines
|
||||
{
|
||||
LineRule = LineSpacingRuleValues.Auto
|
||||
});
|
||||
properties.AppendChild(new Indentation());
|
||||
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
||||
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
||||
{
|
||||
paragraphMarkRunProperties.AppendChild(new FontSize
|
||||
{
|
||||
Val =
|
||||
paragraphProperties.Size
|
||||
});
|
||||
}
|
||||
properties.AppendChild(paragraphMarkRunProperties);
|
||||
return properties;
|
||||
}
|
||||
protected override void CreateWord(WordInfoDoctor info)
|
||||
{
|
||||
_wordDocument = WordprocessingDocument.Create(info.FileName,
|
||||
WordprocessingDocumentType.Document);
|
||||
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
||||
mainPart.Document = new Document();
|
||||
_docBody = mainPart.Document.AppendChild(new Body());
|
||||
}
|
||||
protected override void CreateParagraph(WordParagraph paragraph)
|
||||
{
|
||||
if (_docBody == null || paragraph == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var docParagraph = new Paragraph();
|
||||
|
||||
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
||||
foreach (var run in paragraph.Texts)
|
||||
{
|
||||
var docRun = new Run();
|
||||
var properties = new RunProperties();
|
||||
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
||||
if (run.Item2.Bold)
|
||||
{
|
||||
properties.AppendChild(new Bold());
|
||||
}
|
||||
docRun.AppendChild(properties);
|
||||
docRun.AppendChild(new Text
|
||||
{
|
||||
Text = run.Item1,
|
||||
Space =
|
||||
SpaceProcessingModeValues.Preserve
|
||||
});
|
||||
docParagraph.AppendChild(docRun);
|
||||
}
|
||||
_docBody.AppendChild(docParagraph);
|
||||
}
|
||||
protected override void SaveWord(WordInfoDoctor info)
|
||||
{
|
||||
if (_docBody == null || _wordDocument == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_docBody.AppendChild(CreateSectionProperties());
|
||||
_wordDocument.MainDocumentPart!.Document.Save();
|
||||
_wordDocument.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using DocumentFormat.OpenXml;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperEnums;
|
||||
using HospitalBusinessLogic.OfficePackage.HelperModels;
|
||||
using HospitalBusinessLogic.OfficePackage;
|
||||
|
||||
namespace VetClinicBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToWordPharmacist : AbstractSaveToWordPharmacist
|
||||
{
|
||||
private WordprocessingDocument? _wordDocument;
|
||||
private Body? _docBody;
|
||||
private static JustificationValues
|
||||
GetJustificationValues(WordJustificationType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
WordJustificationType.Both => JustificationValues.Both,
|
||||
WordJustificationType.Center => JustificationValues.Center,
|
||||
_ => JustificationValues.Left,
|
||||
};
|
||||
}
|
||||
private static SectionProperties CreateSectionProperties()
|
||||
{
|
||||
var properties = new SectionProperties();
|
||||
var pageSize = new PageSize
|
||||
{
|
||||
Orient = PageOrientationValues.Portrait
|
||||
};
|
||||
properties.AppendChild(pageSize);
|
||||
return properties;
|
||||
}
|
||||
|
||||
private static ParagraphProperties?
|
||||
CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
||||
{
|
||||
if (paragraphProperties == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var properties = new ParagraphProperties();
|
||||
properties.AppendChild(new Justification()
|
||||
{
|
||||
Val =
|
||||
GetJustificationValues(paragraphProperties.JustificationType)
|
||||
});
|
||||
properties.AppendChild(new SpacingBetweenLines
|
||||
{
|
||||
LineRule = LineSpacingRuleValues.Auto
|
||||
});
|
||||
properties.AppendChild(new Indentation());
|
||||
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
||||
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
||||
{
|
||||
paragraphMarkRunProperties.AppendChild(new FontSize
|
||||
{
|
||||
Val =
|
||||
paragraphProperties.Size
|
||||
});
|
||||
}
|
||||
properties.AppendChild(paragraphMarkRunProperties);
|
||||
return properties;
|
||||
}
|
||||
protected override void CreateWord(WordInfoPharmacist info)
|
||||
{
|
||||
_wordDocument = WordprocessingDocument.Create(info.FileName,
|
||||
WordprocessingDocumentType.Document);
|
||||
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
||||
mainPart.Document = new Document();
|
||||
_docBody = mainPart.Document.AppendChild(new Body());
|
||||
}
|
||||
protected override void CreateParagraph(WordParagraph paragraph)
|
||||
{
|
||||
if (_docBody == null || paragraph == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var docParagraph = new Paragraph();
|
||||
|
||||
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
||||
foreach (var run in paragraph.Texts)
|
||||
{
|
||||
var docRun = new Run();
|
||||
var properties = new RunProperties();
|
||||
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
||||
if (run.Item2.Bold)
|
||||
{
|
||||
properties.AppendChild(new Bold());
|
||||
}
|
||||
docRun.AppendChild(properties);
|
||||
docRun.AppendChild(new Text
|
||||
{
|
||||
Text = run.Item1,
|
||||
Space =
|
||||
SpaceProcessingModeValues.Preserve
|
||||
});
|
||||
docParagraph.AppendChild(docRun);
|
||||
}
|
||||
_docBody.AppendChild(docParagraph);
|
||||
}
|
||||
protected override void SaveWord(WordInfoPharmacist info)
|
||||
{
|
||||
if (_docBody == null || _wordDocument == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_docBody.AppendChild(CreateSectionProperties());
|
||||
_wordDocument.MainDocumentPart!.Document.Save();
|
||||
_wordDocument.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"profiles": {
|
||||
"HospitalBusinessLogic": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:51157;http://localhost:51163"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class DescriptionProcedureBindingModel : IDescriptionProcedureModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
public int PharmacistId { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class DiseaseBindingModel : IDiseaseModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public int DoctorId { get; set; }
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalDataModels.Models;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class DoctorBindingModel : IDoctorModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
public string Login { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string MailAddress { get; set; } = string.Empty;
|
||||
public string PhoneNumber { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class ListProceduresBindingModel
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public List<int> Recipes { get; set; } = new();
|
||||
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class ListRecipesBindingModel
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public List<int> Procedures { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class MailConfigBindingModel
|
||||
{
|
||||
public string MailLogin { get; set; } = string.Empty;
|
||||
public string MailPassword { get; set; } = string.Empty;
|
||||
public string SmtpClientHost { get; set; } = string.Empty;
|
||||
public int SmtpClientPort { get; set; }
|
||||
public string PopHost { get; set; } = string.Empty;
|
||||
public int PopPort { get; set; }
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class MailSendInfoBindingModel
|
||||
{
|
||||
public string MailAddress { get; set; } = string.Empty;
|
||||
public string Subject { get; set; } = string.Empty;
|
||||
public string Text { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalDataModels.Models;
|
||||
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class MedicineBindingModel : IMedicineModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string CountryOrigin { get; set; } = string.Empty;
|
||||
public double Price { get; set; }
|
||||
public int PharmacistId { get; set; }
|
||||
public Dictionary<int, IRecipeModel> MedicineRecipes { get; set; } = new();
|
||||
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class MedicinesDiseasesBindingModel
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public DateTime DateFrom { get; set; } = DateTime.Now;
|
||||
public DateTime DateTo { get; set; } = DateTime.Now;
|
||||
public int? DoctorId { get; set; }
|
||||
public string? Email { get; set; }
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class PatientBindingModel : IPatientModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
|
||||
public string Address { get; set; } = string.Empty;
|
||||
|
||||
public DateTime BirthDate { get; set; }
|
||||
|
||||
public int DoctorId { get; set; }
|
||||
|
||||
public Dictionary<int, IProcedureModel> PatientProcedures { get; set; } = new();
|
||||
public Dictionary<int, IRecipeModel> PatientRecipes { get; set; } = new();
|
||||
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class PatientsDescriptionProceduresBindingModel
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public List<int> Medicines { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class PharmacistBindingModel : IPharmacistModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
public string Login { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string PhoneNumber { get; set; } = string.Empty;
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalDataModels.Models;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
|
||||
public class ProcedureBindingModel : IProcedureModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int DescriptionProcedureId { get; set; }
|
||||
|
||||
public int PharmacistId { get; set; }
|
||||
|
||||
|
||||
public Dictionary<int, IMedicineModel> ProcedureMedicines { get; set; } = new();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +0,0 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class RecipeBindingModel : IRecipeModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
public DateTime IssueDate { get; set; } = DateTime.Now;
|
||||
|
||||
public int DiseaseId { get; set; }
|
||||
|
||||
public int DoctorId { get; set; }
|
||||
|
||||
public Dictionary<int, IPatientModel> RecipePatients { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BindingModels
|
||||
{
|
||||
public class ReportBindingModel
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? DateFrom { get; set; }
|
||||
|
||||
public DateTime? DateTo { get; set; }
|
||||
|
||||
public int? PatientId { get; set; }
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IDescriptionProcedureLogic
|
||||
{
|
||||
List<DescriptionProcedureViewModel>? ReadList(DescriptionProcedureSearchModel? model);
|
||||
DescriptionProcedureViewModel? ReadElement(DescriptionProcedureSearchModel model);
|
||||
bool Create(DescriptionProcedureBindingModel model);
|
||||
bool Update(DescriptionProcedureBindingModel model);
|
||||
bool Delete(DescriptionProcedureBindingModel model);
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IDiseaseLogic
|
||||
{
|
||||
List<DiseaseViewModel>? ReadList(DiseaseSearchModel? model);
|
||||
|
||||
DiseaseViewModel? ReadElement(DiseaseSearchModel model);
|
||||
|
||||
bool Create(DiseaseBindingModel model);
|
||||
|
||||
bool Update(DiseaseBindingModel model);
|
||||
|
||||
bool Delete(DiseaseBindingModel model);
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IDoctorLogic
|
||||
{
|
||||
List<DoctorViewModel>? ReadList(DoctorSearchModel? model);
|
||||
|
||||
DoctorViewModel? ReadElement(DoctorSearchModel model);
|
||||
|
||||
bool Create(DoctorBindingModel model);
|
||||
|
||||
bool Update(DoctorBindingModel model);
|
||||
|
||||
bool Delete(DoctorBindingModel model);
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IDoctorReportLogic
|
||||
{
|
||||
// List<ReportPatientRecipeViewModel> GetPatients();
|
||||
List<ListProceduresViewModel> GetRecipeProcedures(List<int> services);
|
||||
//List<ReportPatientViewModel> GetMedicineDiseases(ReportBindingModel model, PatientBindingModel patientModel);
|
||||
List<MedicinesDiseasesViewModel> GetPatientMedicinesAndDiseases(MedicinesDiseasesBindingModel services);
|
||||
void SaveProceduresToWordFile(ListProceduresBindingModel model);
|
||||
void SaveProceduresToExcelFile(ListProceduresBindingModel model);
|
||||
void SavePatientsToPdfFile(MedicinesDiseasesBindingModel model);
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IMedicineLogic
|
||||
{
|
||||
List<MedicineViewModel>? ReadList(MedicineSearchModel? model);
|
||||
MedicineViewModel? ReadElement(MedicineSearchModel model);
|
||||
bool Create(MedicineBindingModel model);
|
||||
bool Update(MedicineBindingModel model);
|
||||
bool Delete(MedicineBindingModel model);
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IPatientLogic
|
||||
{
|
||||
List<PatientViewModel>? ReadList(PatientSearchModel? model);
|
||||
|
||||
PatientViewModel? ReadElement(PatientSearchModel model);
|
||||
|
||||
bool Create(PatientBindingModel model);
|
||||
|
||||
bool Update(PatientBindingModel model);
|
||||
|
||||
bool Delete(PatientBindingModel model);
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalContracts.SearchModels;
|
||||
|
||||
namespace HospitalContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IPharmacistLogic
|
||||
{
|
||||
List<PharmacistViewModel>? ReadList(PharmacistSearchModel? model);
|
||||
PharmacistViewModel? ReadElement(PharmacistSearchModel model);
|
||||
bool Create(PharmacistBindingModel model);
|
||||
bool Update(PharmacistBindingModel model);
|
||||
bool Delete(PharmacistBindingModel model);
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IProcedureLogic
|
||||
{
|
||||
List<ProcedureViewModel>? ReadList(ProcedureSearchModel? model);
|
||||
ProcedureViewModel? ReadElement(ProcedureSearchModel model);
|
||||
bool Create(ProcedureBindingModel model);
|
||||
bool Update(ProcedureBindingModel model);
|
||||
bool Delete(ProcedureBindingModel model);
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.BusinessLogicContracts
|
||||
{
|
||||
public interface IRecipeLogic
|
||||
{
|
||||
List<RecipeViewModel>? ReadList(RecipeSearchModel? model);
|
||||
|
||||
RecipeViewModel? ReadElement(RecipeSearchModel model);
|
||||
|
||||
bool Create(RecipeBindingModel model);
|
||||
|
||||
bool Update(RecipeBindingModel model);
|
||||
|
||||
bool Delete(RecipeBindingModel model);
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IReportLogicPharmacist //В процессе
|
||||
{
|
||||
List<ListRecipesViewModel> GetProcedureRecipes(List<int> procedures);
|
||||
void SaveRecipesToWordFile(ListRecipesBindingModel model);
|
||||
void SaveRecipesToExcelFile(ListRecipesBindingModel model);
|
||||
}
|
||||
}
|
7
Hospital/HospitalContracts/Class1.cs
Normal file
7
Hospital/HospitalContracts/Class1.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace HospitalContracts
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"profiles": {
|
||||
"HospitalContracts": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:51160;http://localhost:51162"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class DescriptionProcedureSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
public int? PharmacistId { get; set; }
|
||||
public int? ProcedureId { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class DiseaseSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
public int? DoctorId { get; set; }
|
||||
public int? RecipeId { get; set; }
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class DoctorSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? FIO { get; set; }
|
||||
public string? Login { get; set; }
|
||||
public string? Password { get; set; }
|
||||
public string? MailAddress { get; set; }
|
||||
public string? PhoneNumber { get; set; }
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class ListProceduresSearchModel
|
||||
{
|
||||
public List<int>? recipesIds { get; set; }
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class ListRecipesSearchModel
|
||||
{
|
||||
public List<int>? proceduresIds { get; set; }
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class MedicineDiseasesSearchModel
|
||||
{
|
||||
public List<int>? patientsIds { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
public int? DoctorId { get; set; }
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class MedicineSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; } = string.Empty;
|
||||
public string? CountryOrigin { get; set; }
|
||||
public double? Price { get; set; }
|
||||
public int? PharmacistId { get; set; }
|
||||
|
||||
public int? RecipeId { get; set; }
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class PatientDescriptionProceduresSearchModel
|
||||
{
|
||||
public List<int>? medicinesIds { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class PatientSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public string? FIO { get; set; }
|
||||
|
||||
public string? Adress { get; set; }
|
||||
|
||||
public DateTime? BirthDate { get; set; }
|
||||
|
||||
public int? DoctorId { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class PharmacistSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? FIO { get; set; } = string.Empty;
|
||||
public string? Login { get; set; } = string.Empty;
|
||||
public string? Password { get; set; } = string.Empty;
|
||||
public string? PhoneNumber { get; set; }
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class ProcedureSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; } = string.Empty;
|
||||
public DateTime? Date { get; set; }
|
||||
public int? DescriptionOfTheProcedureId { get; set; }
|
||||
public int? PharmacistId { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.SearchModels
|
||||
{
|
||||
public class RecipeSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public int? DoctorId { get; set; }
|
||||
public int? MedicineId { get; set; }
|
||||
public int? PatientId { get; set; }
|
||||
DateTime IssueDate { get; }
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.StoragesContracts
|
||||
{
|
||||
public interface IDescriptionProcedureStorage
|
||||
{
|
||||
List<DescriptionProcedureViewModel> GetFullList();
|
||||
List<DescriptionProcedureViewModel> GetFilteredList(DescriptionProcedureSearchModel model);
|
||||
DescriptionProcedureViewModel? GetElement(DescriptionProcedureSearchModel model);
|
||||
DescriptionProcedureViewModel? Insert(DescriptionProcedureBindingModel model);
|
||||
DescriptionProcedureViewModel? Update(DescriptionProcedureBindingModel model);
|
||||
DescriptionProcedureViewModel? Delete(DescriptionProcedureBindingModel model);
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.StoragesContracts
|
||||
{
|
||||
public interface IDiseaseStorage
|
||||
{
|
||||
List<DiseaseViewModel> GetFullList();
|
||||
|
||||
List<DiseaseViewModel> GetFilteredList(DiseaseSearchModel model);
|
||||
|
||||
DiseaseViewModel? GetElement(DiseaseSearchModel model);
|
||||
|
||||
DiseaseViewModel? Insert(DiseaseBindingModel model);
|
||||
|
||||
DiseaseViewModel? Update(DiseaseBindingModel model);
|
||||
|
||||
DiseaseViewModel? Delete(DiseaseBindingModel model);
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.StoragesContracts
|
||||
{
|
||||
public interface IDoctorStorage
|
||||
{
|
||||
List<DoctorViewModel> GetFullList();
|
||||
|
||||
List<DoctorViewModel> GetFilteredList(DoctorSearchModel model);
|
||||
|
||||
DoctorViewModel? GetElement(DoctorSearchModel model);
|
||||
|
||||
DoctorViewModel? Insert(DoctorBindingModel model);
|
||||
|
||||
DoctorViewModel? Update(DoctorBindingModel model);
|
||||
|
||||
DoctorViewModel? Delete(DoctorBindingModel model);
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.StoragesContracts
|
||||
{
|
||||
public interface IMedicineStorage
|
||||
{
|
||||
List<MedicineViewModel> GetFullList();
|
||||
List<MedicineViewModel> GetFilteredList(MedicineSearchModel model);
|
||||
List<Tuple<MedicineViewModel, List<Tuple<ProcedureViewModel, List<DescriptionProcedureViewModel>>>>> GetDescriptionProceduresInfo(PatientDescriptionProceduresSearchModel model);
|
||||
List<Tuple<MedicineViewModel, List<Tuple<ProcedureViewModel, List<PatientViewModel>>>>> GetPatientsInfo(PatientDescriptionProceduresSearchModel model);
|
||||
MedicineViewModel? GetElement(MedicineSearchModel model);
|
||||
MedicineViewModel? Insert(MedicineBindingModel model);
|
||||
MedicineViewModel? Update(MedicineBindingModel model);
|
||||
MedicineViewModel? Delete(MedicineBindingModel model);
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.StoragesContracts
|
||||
{
|
||||
public interface IPatientStorage
|
||||
{
|
||||
List<PatientViewModel> GetFullList();
|
||||
|
||||
List<PatientViewModel> GetFilteredList(PatientSearchModel model);
|
||||
|
||||
PatientViewModel? GetElement(PatientSearchModel model);
|
||||
|
||||
PatientViewModel? Insert(PatientBindingModel model);
|
||||
|
||||
PatientViewModel? Update(PatientBindingModel model);
|
||||
|
||||
PatientViewModel? Delete(PatientBindingModel model);
|
||||
List<Tuple<PatientViewModel, List<Tuple<RecipeViewModel, List<DiseaseViewModel>>>>> GetDiseasesInfo(MedicineDiseasesSearchModel model);
|
||||
List<Tuple<PatientViewModel, List<Tuple<RecipeViewModel, List<MedicineViewModel>>>>> GetMedicinesInfo(MedicineDiseasesSearchModel model);
|
||||
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.StoragesContracts
|
||||
{
|
||||
public interface IPharmacistStorage
|
||||
{
|
||||
List<PharmacistViewModel> GetFullList();
|
||||
List<PharmacistViewModel> GetFilteredList(PharmacistSearchModel model);
|
||||
PharmacistViewModel? GetElement(PharmacistSearchModel model);
|
||||
PharmacistViewModel? Insert(PharmacistBindingModel model);
|
||||
PharmacistViewModel? Update(PharmacistBindingModel model);
|
||||
PharmacistViewModel? Delete(PharmacistBindingModel model);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalContracts.StoragesContracts
|
||||
{
|
||||
public interface IProcedureStorage
|
||||
{
|
||||
List<ProcedureViewModel> GetFullList();
|
||||
List<ProcedureViewModel> GetFilteredList(ProcedureSearchModel model);
|
||||
List<Tuple<ProcedureViewModel, List<Tuple<MedicineViewModel, List<RecipeViewModel>>>>> GetReportInfo(ListRecipesSearchModel model);
|
||||
ProcedureViewModel? GetElement(ProcedureSearchModel model);
|
||||
ProcedureViewModel? Insert(ProcedureBindingModel model);
|
||||
ProcedureViewModel? Update(ProcedureBindingModel model);
|
||||
ProcedureViewModel? Delete(ProcedureBindingModel model);
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.StoragesContracts
|
||||
{
|
||||
public interface IRecipeStorage
|
||||
{
|
||||
List<RecipeViewModel> GetFullList();
|
||||
|
||||
List<RecipeViewModel> GetFilteredList(RecipeSearchModel model);
|
||||
|
||||
RecipeViewModel? GetElement(RecipeSearchModel model);
|
||||
|
||||
RecipeViewModel? Insert(RecipeBindingModel model);
|
||||
|
||||
RecipeViewModel? Update(RecipeBindingModel model);
|
||||
|
||||
RecipeViewModel? Delete(RecipeBindingModel model);
|
||||
List<Tuple<RecipeViewModel, List<Tuple<PatientViewModel, List<ProcedureViewModel>>>>> GetReportInfo(ListProceduresSearchModel model);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalDataModels.Models;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class DescriptionProcedureViewModel : IDescriptionProcedureModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Описание процедупы")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Фармацевт")]
|
||||
public int PharmacistId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class DiseaseViewModel : IDiseaseModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название болезни")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Описание болезни")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
public int DoctorId { get; set; }
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
@ -8,23 +7,23 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class DoctorViewModel : IDoctorModel
|
||||
public class DoctorViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("ФИО")]
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
string FIO { get; }
|
||||
|
||||
[DisplayName("Логин")]
|
||||
public string Login { get; set; } = string.Empty;
|
||||
string Login { get; }
|
||||
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
string Password { get; }
|
||||
|
||||
[DisplayName("Электронная почта")]
|
||||
public string MailAddress { get; set; } = string.Empty;
|
||||
string MailAddress { get; }
|
||||
|
||||
[DisplayName("Номер телефона")]
|
||||
public string PhoneNumber { get; set; } = string.Empty;
|
||||
string PhoneNumber { get; }
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class ListProceduresViewModel
|
||||
{
|
||||
public string ProcedureName { get; set; } = string.Empty;
|
||||
public string RecipeName { get; set; } = string.Empty;
|
||||
public List<ProcedureViewModel> Procedures { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class ListRecipesViewModel
|
||||
{
|
||||
public string ProcedureName { get; set; } = string.Empty;
|
||||
public List<RecipeViewModel> Recipes { get; set; } = new();
|
||||
public List<ProcedureViewModel> Procedures { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalDataModels.Models;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class MedicineViewModel : IMedicineModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название лекарства")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DisplayName("Цена лекарства")]
|
||||
public double Price { get; set; }
|
||||
[DisplayName("Страна производителя")]
|
||||
public string CountryOrigin { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Фармацевт")]
|
||||
public int PharmacistId { get; set; }
|
||||
|
||||
public Dictionary<int, IRecipeModel> MedicineRecipes { get; set; } = new();
|
||||
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class MedicinesDiseasesViewModel
|
||||
{
|
||||
public string PatientFIO { get; set; } = string.Empty;
|
||||
public DateTime Date { get; set; } = new DateTime();
|
||||
public List<MedicineViewModel> Medicines { get; set; } = new();
|
||||
public List<DiseaseViewModel> Diseases { get; set; } = new();
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalContracts.ViewModels;
|
||||
|
||||
namespace HospitalDataBaseImplement.Implements
|
||||
{
|
||||
public class PatientsDescriptionProceduresViewModel
|
||||
{
|
||||
public string PatientName { get; set; } = string.Empty;
|
||||
public List<PatientViewModel> Patients { get; set; } = new();
|
||||
public List<DescriptionProcedureViewModel> DescriptionProcedures { get; set; } = new();
|
||||
}
|
||||
}
|
@ -8,25 +8,24 @@ using HospitalDataModels.Models;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class PatientViewModel : IPatientModel
|
||||
public class PatientViewModel
|
||||
{
|
||||
[DisplayName("Номер")]
|
||||
public int Id { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("ФИО")]
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
string FIO { get; }
|
||||
|
||||
[DisplayName("Дата рождения")]
|
||||
public DateTime BirthDate { get; set; } = new DateTime(Int32.Parse("2000"), Int32.Parse("01"), Int32.Parse("01"));
|
||||
DateOnly BirthDate { get; }
|
||||
|
||||
[DisplayName("Адрес")]
|
||||
public string Address { get; set; } = string.Empty;
|
||||
string Adress { get; }
|
||||
|
||||
public int DoctorId { get; set; }
|
||||
|
||||
public Dictionary<int, IProcedureModel> PatientProcedures { get; set; } = new();
|
||||
|
||||
|
||||
public Dictionary<int, IRecipeModel> PatientRecipes { get; set; } = new();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +0,0 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class PharmacistViewModel : IPharmacistModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("ФИО кладовщика")]
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
[DisplayName("Логин")]
|
||||
public string Login { get; set; } = string.Empty;
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[DisplayName("Номер телефона")]
|
||||
public string PhoneNumber { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class ProcedureViewModel : IProcedureModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название услуги")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DisplayName("Дата процедуры")]
|
||||
public DateTime Date { get; set; }
|
||||
[DisplayName("Фармацевт")]
|
||||
|
||||
public int PharmacistId { get; set; }
|
||||
[DisplayName("Описание процедуры")]
|
||||
public int DescriptionProcedureId { get; set; }
|
||||
public Dictionary<int, IMedicineModel> ProcedureMedicines { get; set; } = new();
|
||||
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
using HospitalDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalContracts.ViewModels
|
||||
{
|
||||
public class RecipeViewModel : IRecipeModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
public DateTime IssueDate { get; set; } = DateTime.Now;
|
||||
|
||||
public int DiseaseId { get; set; }
|
||||
|
||||
public int DoctorId { get; set; }
|
||||
|
||||
public Dictionary<int, IPatientModel> RecipePatients { get; set; } = new();
|
||||
|
||||
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user