Update to .NET 9, add patient features, and refactor
Updated target framework to .NET 9 across multiple projects and updated package references. Refactored `HospitalController` to use MediatR commands. Introduced new patient-related functionalities including new API endpoints, commands, queries, and DTOs. Removed user-related properties from medical history mappings. Added new handlers for patient creation, retrieval, and section updates.master
parent
b3ca3c51ea
commit
1a813edf6a
|
@ -1,4 +1,6 @@
|
||||||
using DocuMed.Domain.Entities.MedicalHistory;
|
using DocuMed.Domain.CommandQueries.Commands;
|
||||||
|
using DocuMed.Domain.Entities.MedicalHistory;
|
||||||
|
using MediatR;
|
||||||
|
|
||||||
namespace DocuMed.Api.Controllers;
|
namespace DocuMed.Api.Controllers;
|
||||||
|
|
||||||
|
@ -30,32 +32,32 @@ public class HospitalController : ICarterModule
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET:Get All Entity
|
// GET:Get All Entity
|
||||||
public virtual async Task<IResult> GetAllAsync([FromQuery] int page, IMedicalHistoryRepository repository, CancellationToken cancellationToken)
|
private async Task<IResult> GetAllAsync([FromQuery] int page, IMedicalHistoryRepository repository, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return TypedResults.Ok(await repository.GetMedicalHistoriesAsync(page, cancellationToken));
|
return TypedResults.Ok(await repository.GetMedicalHistoriesAsync(page, cancellationToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET:Get An Entity By Id
|
// GET:Get An Entity By Id
|
||||||
public async Task<IResult> GetAsync(Guid id, IMedicalHistoryRepository repository, CancellationToken cancellationToken)
|
private async Task<IResult> GetAsync(Guid id, IMedicalHistoryRepository repository, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
|
||||||
return TypedResults.Ok(await repository.GetMedicalHistoryAsync(id, cancellationToken));
|
return TypedResults.Ok(await repository.GetMedicalHistoryAsync(id, cancellationToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST:Add New Entity
|
// POST:Add New Entity
|
||||||
public virtual async Task<IResult> Post([FromBody] MedicalHistoryLDto dto, IMedicalHistoryService service, ICurrentUserService currentUserService, CancellationToken cancellationToken)
|
private async Task<IResult> Post([FromBody] CreateHospitalCommand dto, IMediator service, ICurrentUserService currentUserService, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return TypedResults.Ok(await service.AddAsync(dto, cancellationToken));
|
return TypedResults.Ok(await service.Send(dto,cancellationToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUT:Update Entity
|
// PUT:Update Entity
|
||||||
public virtual async Task<IResult> Put([FromBody] MedicalHistoryLDto dto, IMedicalHistoryService service, ICurrentUserService currentUserService, CancellationToken cancellationToken)
|
private async Task<IResult> Put([FromBody] UpdateHospitalCommand dto, IMediator service, ICurrentUserService currentUserService, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return TypedResults.Ok(await service.EditAsync(dto, cancellationToken));
|
return TypedResults.Ok(await service.Send(dto,cancellationToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
// DELETE:Delete Entity
|
// DELETE:Delete Entity
|
||||||
public virtual async Task<IResult> Delete(Guid id, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken)
|
private async Task<IResult> Delete(Guid id, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var ent = await repositoryWrapper.SetRepository<MedicalHistory>().GetByIdAsync(cancellationToken, id);
|
var ent = await repositoryWrapper.SetRepository<MedicalHistory>().GetByIdAsync(cancellationToken, id);
|
||||||
repositoryWrapper.SetRepository<MedicalHistory>().Delete(ent);
|
repositoryWrapper.SetRepository<MedicalHistory>().Delete(ent);
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
namespace DocuMed.Api.Controllers;
|
||||||
|
|
||||||
|
public class PatientController : ICarterModule
|
||||||
|
{
|
||||||
|
public void AddRoutes(IEndpointRouteBuilder app)
|
||||||
|
{
|
||||||
|
var group = app.NewVersionedApi("Patient")
|
||||||
|
.MapGroup($"api/patient");
|
||||||
|
|
||||||
|
group.MapGet("", GetAllAsync)
|
||||||
|
.WithDisplayName("Get All Patient")
|
||||||
|
.HasApiVersion(1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<IResult> GetAllAsync([FromQuery]int page ,
|
||||||
|
[FromQuery]int? count ,
|
||||||
|
[FromQuery]string searchName ,
|
||||||
|
[FromServices]IMediator mediator,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
=> TypedResults.Ok(await mediator.Send(new GetPatientsQuery(page, Count: count ?? Refers.SizeM, searchName), cancellationToken));
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
|
@ -13,42 +13,42 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Asp.Versioning.Http" Version="8.1.0" />
|
<PackageReference Include="Asp.Versioning.Http" Version="8.1.0" />
|
||||||
<PackageReference Include="Ben.BlockingDetector" Version="0.0.4" />
|
<PackageReference Include="Ben.BlockingDetector" Version="0.0.4" />
|
||||||
<PackageReference Include="Carter" Version="8.2.1" />
|
<PackageReference Include="Carter" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Autofac" Version="8.1.0" />
|
<PackageReference Include="Autofac" Version="8.2.0" />
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
|
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Elmah.Io.AspNetCore.Serilog" Version="5.1.23" />
|
<PackageReference Include="Elmah.Io.AspNetCore.Serilog" Version="5.1.23" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.8" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.2" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.5" />
|
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" />
|
||||||
<PackageReference Include="Sentry.Serilog" Version="4.11.0" />
|
<PackageReference Include="Sentry.Serilog" Version="5.0.0" />
|
||||||
<PackageReference Include="Serilog" Version="4.0.1" />
|
<PackageReference Include="Serilog" Version="4.2.0" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.2" />
|
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.PostgreSQL" Version="2.3.0" />
|
<PackageReference Include="Serilog.Sinks.PostgreSQL" Version="2.3.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Seq" Version="8.0.0" />
|
<PackageReference Include="Serilog.Sinks.Seq" Version="9.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.ElmahIo" Version="5.1.43" />
|
<PackageReference Include="Serilog.Sinks.ElmahIo" Version="5.2.50" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="10.2.0" />
|
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="10.2.0" />
|
||||||
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="10.2.0" />
|
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="10.2.0" />
|
||||||
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="10.2.0" />
|
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="10.2.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.8.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="7.2.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />
|
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
|
<PackageReference Include="System.Data.SqlClient" Version="4.9.0" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
|
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -73,6 +73,7 @@
|
||||||
<Using Include="DocuMed.Core.EntityServices.Abstracts" />
|
<Using Include="DocuMed.Core.EntityServices.Abstracts" />
|
||||||
<Using Include="DocuMed.Core.Models.Api" />
|
<Using Include="DocuMed.Core.Models.Api" />
|
||||||
<Using Include="DocuMed.Domain" />
|
<Using Include="DocuMed.Domain" />
|
||||||
|
<Using Include="DocuMed.Domain.CommandQueries.Queries" />
|
||||||
<Using Include="DocuMed.Domain.Dtos.LargDtos" />
|
<Using Include="DocuMed.Domain.Dtos.LargDtos" />
|
||||||
<Using Include="DocuMed.Domain.Dtos.RequestDtos" />
|
<Using Include="DocuMed.Domain.Dtos.RequestDtos" />
|
||||||
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
||||||
|
@ -81,6 +82,7 @@
|
||||||
<Using Include="DocuMed.Domain.Entities.User" />
|
<Using Include="DocuMed.Domain.Entities.User" />
|
||||||
<Using Include="DocuMed.Domain.Enums.QueryFilters" />
|
<Using Include="DocuMed.Domain.Enums.QueryFilters" />
|
||||||
<Using Include="DocuMed.Domain.Mappers" />
|
<Using Include="DocuMed.Domain.Mappers" />
|
||||||
|
<Using Include="DocuMed.Domain.Models" />
|
||||||
<Using Include="DocuMed.Domain.Models.Settings" />
|
<Using Include="DocuMed.Domain.Models.Settings" />
|
||||||
<Using Include="DocuMed.Infrastructure" />
|
<Using Include="DocuMed.Infrastructure" />
|
||||||
<Using Include="DocuMed.Infrastructure.Models" />
|
<Using Include="DocuMed.Infrastructure.Models" />
|
||||||
|
@ -90,6 +92,7 @@
|
||||||
<Using Include="DocuMed.Repository.Models" />
|
<Using Include="DocuMed.Repository.Models" />
|
||||||
<Using Include="DocuMed.Repository.Repositories.Base.Contracts" />
|
<Using Include="DocuMed.Repository.Repositories.Base.Contracts" />
|
||||||
<Using Include="DocuMed.Repository.Repositories.Entities.Abstracts" />
|
<Using Include="DocuMed.Repository.Repositories.Entities.Abstracts" />
|
||||||
|
<Using Include="MediatR" />
|
||||||
<Using Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
|
<Using Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
|
||||||
<Using Include="Microsoft.AspNetCore.Identity" />
|
<Using Include="Microsoft.AspNetCore.Identity" />
|
||||||
<Using Include="Microsoft.AspNetCore.Mvc" />
|
<Using Include="Microsoft.AspNetCore.Mvc" />
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<!--<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<LangVersion>10</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
@ -11,10 +11,10 @@
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.3" />
|
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>-->
|
||||||
|
|
||||||
<!--<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<LangVersion>10</LangVersion>
|
<LangVersion>10</LangVersion>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -24,8 +24,8 @@
|
||||||
<PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" />
|
<PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.1.0" />
|
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.3.0" />
|
||||||
</ItemGroup>-->
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Using Include="MD.PersianDateTime.Standard" />
|
<Using Include="MD.PersianDateTime.Standard" />
|
||||||
|
|
|
@ -126,7 +126,6 @@ public class AccountService(
|
||||||
return await CompleteLogin(user, cancellationToken);
|
return await CompleteLogin(user, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task<AccessToken<ApplicationUserSDto>> CompleteLogin(ApplicationUser user, CancellationToken cancellationToken)
|
private async Task<AccessToken<ApplicationUserSDto>> CompleteLogin(ApplicationUser user, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var token = await jwtService.Generate<ApplicationUserSDto, ApplicationUser>(user);
|
var token = await jwtService.Generate<ApplicationUserSDto, ApplicationUser>(user);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<PackageReference Include="AspNetCoreRateLimit.Redis" Version="2.0.0" />
|
<PackageReference Include="AspNetCoreRateLimit.Redis" Version="2.0.0" />
|
||||||
<PackageReference Include="Autofac.Extras.Quartz" Version="10.0.0" />
|
<PackageReference Include="Autofac.Extras.Quartz" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
||||||
<PackageReference Include="Quartz" Version="3.13.0" />
|
<PackageReference Include="Quartz" Version="3.13.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -8,6 +8,7 @@ public sealed record CreateMedicalHistoryCommand(
|
||||||
string FatherName,
|
string FatherName,
|
||||||
string NationalId,
|
string NationalId,
|
||||||
DateTime BirthDate,
|
DateTime BirthDate,
|
||||||
|
Guid PatientId,
|
||||||
string PresentIllnessDetail,
|
string PresentIllnessDetail,
|
||||||
string PastDiseasesHistoryDetail,
|
string PastDiseasesHistoryDetail,
|
||||||
string PastSurgeryHistoryDetail,
|
string PastSurgeryHistoryDetail,
|
||||||
|
@ -23,7 +24,6 @@ public sealed record CreateMedicalHistoryCommand(
|
||||||
double PulseRate,
|
double PulseRate,
|
||||||
double SPO2,
|
double SPO2,
|
||||||
double Temperature,
|
double Temperature,
|
||||||
Guid ApplicationUserId,
|
|
||||||
Guid MedicalHistoryTemplateId,
|
Guid MedicalHistoryTemplateId,
|
||||||
List<MedicalHistoryAnswerSDto> Answers) : IRequest<Guid>;
|
List<MedicalHistoryAnswerSDto> Answers) : IRequest<Guid>;
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ public sealed record UpdateMedicalHistoryCommand(
|
||||||
string FatherName,
|
string FatherName,
|
||||||
string NationalId,
|
string NationalId,
|
||||||
DateTime BirthDate,
|
DateTime BirthDate,
|
||||||
|
Guid PatientId,
|
||||||
string PresentIllnessDetail,
|
string PresentIllnessDetail,
|
||||||
string PastDiseasesHistoryDetail,
|
string PastDiseasesHistoryDetail,
|
||||||
string PastSurgeryHistoryDetail,
|
string PastSurgeryHistoryDetail,
|
||||||
|
@ -51,7 +52,6 @@ public sealed record UpdateMedicalHistoryCommand(
|
||||||
double PulseRate,
|
double PulseRate,
|
||||||
double SPO2,
|
double SPO2,
|
||||||
double Temperature,
|
double Temperature,
|
||||||
Guid ApplicationUserId,
|
|
||||||
Guid MedicalHistoryTemplateId,
|
Guid MedicalHistoryTemplateId,
|
||||||
List<MedicalHistoryAnswerSDto> Answers) : IRequest<Guid>;
|
List<MedicalHistoryAnswerSDto> Answers) : IRequest<Guid>;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
namespace DocuMed.Domain.CommandQueries.Commands;
|
||||||
|
|
||||||
|
public sealed record CreatePatientCommand(
|
||||||
|
string FirstName,
|
||||||
|
string LastName,
|
||||||
|
string UnitNumber,
|
||||||
|
string NationalId,
|
||||||
|
string Room,
|
||||||
|
string Bed,
|
||||||
|
DateTime AdmissionAt,
|
||||||
|
Guid SectionId) : IRequest<Guid>;
|
||||||
|
|
||||||
|
public sealed record UpdatePatientCommand(
|
||||||
|
Guid Id,
|
||||||
|
string FirstName,
|
||||||
|
string LastName,
|
||||||
|
string UnitNumber,
|
||||||
|
string NationalId,
|
||||||
|
string Room,
|
||||||
|
string Bed,
|
||||||
|
DateTime AdmissionAt,
|
||||||
|
Guid SectionId) : IRequest<Guid>;
|
||||||
|
|
||||||
|
public sealed record UpdatePatientSectionCommand(Guid Id, Guid SectionId) : IRequest<Guid>;
|
||||||
|
|
||||||
|
public sealed record DeletePatientCommand(Guid Id) : IRequest<bool>;
|
|
@ -0,0 +1,4 @@
|
||||||
|
namespace DocuMed.Domain.CommandQueries.Queries;
|
||||||
|
|
||||||
|
public sealed record GetPatientQuery(Guid? Id = null , string? NationalId = null) : IRequest<PatientSDto>;
|
||||||
|
public sealed record GetPatientsQuery(int Page , int Count , string? SearchName = null , string? NationalId = null) : IRequest<List<PatientSDto>>;
|
|
@ -1,22 +1,22 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<!--<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Mapster" Version="7.4.0" />
|
<PackageReference Include="Mapster" Version="7.4.0" />
|
||||||
<PackageReference Include="Mapster.Core" Version="1.2.1" />
|
<PackageReference Include="Mapster.Core" Version="1.2.1" />
|
||||||
<PackageReference Include="MediatR" Version="12.4.1" />
|
<PackageReference Include="MediatR" Version="12.4.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="8.0.8" />
|
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="9.0.0" />
|
||||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
|
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
|
||||||
</ItemGroup>-->
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
<PropertyGroup>
|
<!--<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<LangVersion>10</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
<PackageReference Include="MediatR" Version="12.1.1" />
|
<PackageReference Include="MediatR" Version="12.1.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="5.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="5.0.0" />
|
||||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
|
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>-->
|
||||||
|
|
||||||
|
|
||||||
<Target Name="Mapster">
|
<Target Name="Mapster">
|
||||||
|
@ -37,37 +37,37 @@
|
||||||
<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet mapster mapper -a "$(TargetDir)$(ProjectName).dll" -n DocuMed.Domain.Mappers -o Mappers" />
|
<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet mapster mapper -a "$(TargetDir)$(ProjectName).dll" -n DocuMed.Domain.Mappers -o Mappers" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\DocuMed.Common\DocuMed.Common.csproj" />
|
<ProjectReference Include="..\DocuMed.Common\DocuMed.Common.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Dtos\ResponseDtos\" />
|
<Folder Include="Dtos\ResponseDtos\" />
|
||||||
<Folder Include="Dtos\RequestDtos\" />
|
<Folder Include="Dtos\RequestDtos\" />
|
||||||
<Folder Include="Entities\City\" />
|
<Folder Include="Entities\City\" />
|
||||||
<Folder Include="Entities\Patients\" />
|
<Folder Include="Entities\User\" />
|
||||||
<Folder Include="Entities\User\" />
|
</ItemGroup>
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Using Include=" DocuMed.Domain.Entities.MedicalHistoryTemplate" />
|
<Using Include=" DocuMed.Domain.Entities.MedicalHistoryTemplate" />
|
||||||
<Using Include="DocuMed.Common.Models.Entity" />
|
<Using Include="DocuMed.Common.Models.Entity" />
|
||||||
<Using Include="DocuMed.Common.Models.Mapper" />
|
<Using Include="DocuMed.Common.Models.Mapper" />
|
||||||
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
||||||
<Using Include="DocuMed.Domain.Entities.City" />
|
<Using Include="DocuMed.Domain.Entities.City" />
|
||||||
<Using Include="DocuMed.Domain.Entities.Hospitals" />
|
<Using Include="DocuMed.Domain.Entities.Hospitals" />
|
||||||
<Using Include="DocuMed.Domain.Entities.MedicalHistory" />
|
<Using Include="DocuMed.Domain.Entities.MedicalHistory" />
|
||||||
<Using Include="DocuMed.Domain.Entities.Staffs" />
|
<Using Include="DocuMed.Domain.Entities.Patients" />
|
||||||
<Using Include="DocuMed.Domain.Entities.User" />
|
<Using Include="DocuMed.Domain.Entities.Staffs" />
|
||||||
<Using Include="DocuMed.Domain.Enums" />
|
<Using Include="DocuMed.Domain.Entities.User" />
|
||||||
<Using Include="DocuMed.Domain.Models" />
|
<Using Include="DocuMed.Domain.Enums" />
|
||||||
<Using Include="Mapster" />
|
<Using Include="DocuMed.Domain.Models" />
|
||||||
<Using Include="MD.PersianDateTime.Standard" />
|
<Using Include="Mapster" />
|
||||||
<Using Include="MediatR" />
|
<Using Include="MD.PersianDateTime.Standard" />
|
||||||
<Using Include="Microsoft.AspNetCore.Identity" />
|
<Using Include="MediatR" />
|
||||||
<Using Include="Newtonsoft.Json" />
|
<Using Include="Microsoft.AspNetCore.Identity" />
|
||||||
<Using Include="System.ComponentModel.DataAnnotations" />
|
<Using Include="Newtonsoft.Json" />
|
||||||
<Using Include="System.Numerics" />
|
<Using Include="System.ComponentModel.DataAnnotations" />
|
||||||
</ItemGroup>
|
<Using Include="System.Numerics" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
namespace DocuMed.Domain.Dtos.SmallDtos;
|
||||||
|
|
||||||
|
public class PatientSDto : BaseDto<PatientSDto,Patient>
|
||||||
|
{
|
||||||
|
public string UnitNumber { get; set; } = string.Empty;
|
||||||
|
public string Room { get; set; } = string.Empty;
|
||||||
|
public string Bed { get; set; } = string.Empty;
|
||||||
|
public DateTime AdmissionAt { get; set; }
|
||||||
|
public string FirstName { get; set; } = string.Empty;
|
||||||
|
public string LastName { get; set; } = string.Empty;
|
||||||
|
public string NationalId { get; set; } = string.Empty;
|
||||||
|
public DateTime BirthDate { get; set; }
|
||||||
|
public Gender Gender { get; set; }
|
||||||
|
public Guid HospitalId { get; set; }
|
||||||
|
public Guid SectionId { get; set; }
|
||||||
|
public string SectionName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string FullName => FirstName + " " + LastName;
|
||||||
|
}
|
|
@ -41,7 +41,8 @@ public partial class MedicalHistory
|
||||||
double pulseRate,
|
double pulseRate,
|
||||||
double sPO2,
|
double sPO2,
|
||||||
double temperature,
|
double temperature,
|
||||||
Guid applicationUserId,
|
Guid studentId,
|
||||||
|
Guid patientId,
|
||||||
Guid medicalHistoryTemplateId)
|
Guid medicalHistoryTemplateId)
|
||||||
{
|
{
|
||||||
var code = StringExtensions.GetIntId(6);
|
var code = StringExtensions.GetIntId(6);
|
||||||
|
@ -63,7 +64,8 @@ public partial class MedicalHistory
|
||||||
sPO2,
|
sPO2,
|
||||||
temperature,
|
temperature,
|
||||||
code,
|
code,
|
||||||
applicationUserId,
|
studentId,
|
||||||
|
patientId,
|
||||||
medicalHistoryTemplateId);
|
medicalHistoryTemplateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,8 @@ public partial class MedicalHistory : ApiEntity
|
||||||
double spo2,
|
double spo2,
|
||||||
double temperature,
|
double temperature,
|
||||||
string code,
|
string code,
|
||||||
Guid applicationUserId,
|
Guid studentId,
|
||||||
|
Guid patientId,
|
||||||
Guid medicalHistoryTemplateId)
|
Guid medicalHistoryTemplateId)
|
||||||
{
|
{
|
||||||
PresentIllnessDetail = presentIllnessDetail;
|
PresentIllnessDetail = presentIllnessDetail;
|
||||||
|
@ -52,7 +53,8 @@ public partial class MedicalHistory : ApiEntity
|
||||||
SPO2 = spo2;
|
SPO2 = spo2;
|
||||||
Temperature = temperature;
|
Temperature = temperature;
|
||||||
Code = code;
|
Code = code;
|
||||||
ApplicationUserId = applicationUserId;
|
StudentId = studentId;
|
||||||
|
PatientId = patientId;
|
||||||
MedicalHistoryTemplateId = medicalHistoryTemplateId;
|
MedicalHistoryTemplateId = medicalHistoryTemplateId;
|
||||||
}
|
}
|
||||||
public string ChiefComplaint { get; internal set; } = string.Empty;
|
public string ChiefComplaint { get; internal set; } = string.Empty;
|
||||||
|
@ -79,8 +81,11 @@ public partial class MedicalHistory : ApiEntity
|
||||||
public double Temperature { get; internal set; }
|
public double Temperature { get; internal set; }
|
||||||
|
|
||||||
public Guid MedicalHistoryTemplateId { get; internal set; }
|
public Guid MedicalHistoryTemplateId { get; internal set; }
|
||||||
public Guid ApplicationUserId { get; internal set; }
|
public Guid StudentId { get; internal set; }
|
||||||
public ApplicationUser? ApplicationUser { get; internal set; }
|
public Student? Student { get; internal set; }
|
||||||
|
|
||||||
|
public Guid PatientId { get; set; }
|
||||||
|
public Patient? Patient { get; set; }
|
||||||
|
|
||||||
public List<MedicalHistoryAnswer> Answers { get; internal set; } = new();
|
public List<MedicalHistoryAnswer> Answers { get; internal set; } = new();
|
||||||
}
|
}
|
|
@ -10,17 +10,17 @@ public partial class MedicalHistoryTemplate : ApiEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public MedicalHistoryTemplate(string chiefComplaint,Guid sectionId,Guid applicationUserId)
|
public MedicalHistoryTemplate(string chiefComplaint,Guid sectionId,Guid studentId)
|
||||||
{
|
{
|
||||||
ChiefComplaint = chiefComplaint;
|
ChiefComplaint = chiefComplaint;
|
||||||
SectionId = sectionId;
|
SectionId = sectionId;
|
||||||
ApplicationUserId = applicationUserId;
|
StudentId = studentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ChiefComplaint { get; internal set; } = string.Empty;
|
public string ChiefComplaint { get; internal set; } = string.Empty;
|
||||||
public Guid SectionId { get; set; }
|
public Guid SectionId { get; set; }
|
||||||
public Section? Section { get; set; }
|
public Section? Section { get; set; }
|
||||||
public Guid ApplicationUserId { get; internal set; }
|
public Guid StudentId { get; internal set; }
|
||||||
public ApplicationUser? ApplicationUser { get; set; }
|
public Student? Student { get; set; }
|
||||||
public List<MedicalHistoryQuestion> Questions { get; internal set; } = new();
|
public List<MedicalHistoryQuestion> Questions { get; internal set; } = new();
|
||||||
}
|
}
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
public partial class Patient
|
public partial class Patient
|
||||||
{
|
{
|
||||||
public static Patient Create(string unitNumber, string room, string bed, DateTime admissionAt, Guid sectionId, Guid userId)
|
public static Patient Create(string unitNumber, string room, string bed, DateTime admissionAt,Guid sectionId,Guid hospitalId, Guid userId)
|
||||||
=> new Patient(unitNumber, room, bed, admissionAt, sectionId, userId);
|
=> new Patient(unitNumber, room, bed, admissionAt,sectionId,hospitalId, userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,13 +11,14 @@ public partial class Patient : ApiEntity
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Patient(string unitNumber, string room, string bed, DateTime admissionAt, Guid sectionId, Guid userId)
|
public Patient(string unitNumber, string room, string bed, DateTime admissionAt,Guid sectionId,Guid hospitalId, Guid userId)
|
||||||
{
|
{
|
||||||
UnitNumber = unitNumber;
|
UnitNumber = unitNumber;
|
||||||
Room = room;
|
Room = room;
|
||||||
Bed = bed;
|
Bed = bed;
|
||||||
AdmissionAt = admissionAt;
|
AdmissionAt = admissionAt;
|
||||||
SectionId = sectionId;
|
SectionId = sectionId;
|
||||||
|
HospitalId = hospitalId;
|
||||||
UserId = userId;
|
UserId = userId;
|
||||||
}
|
}
|
||||||
public string UnitNumber { get; internal set; } = string.Empty;
|
public string UnitNumber { get; internal set; } = string.Empty;
|
||||||
|
@ -28,6 +29,8 @@ public partial class Patient : ApiEntity
|
||||||
public Guid SectionId { get; internal set; }
|
public Guid SectionId { get; internal set; }
|
||||||
public Section? Section { get; internal set; }
|
public Section? Section { get; internal set; }
|
||||||
|
|
||||||
|
public Guid HospitalId { get; internal set; }
|
||||||
|
|
||||||
public Guid UserId { get; internal set; }
|
public Guid UserId { get; internal set; }
|
||||||
public ApplicationUser? User { get; internal set; }
|
public ApplicationUser? User { get; internal set; }
|
||||||
}
|
}
|
|
@ -1,6 +1,4 @@
|
||||||
using DocuMed.Domain.Entities.Patients;
|
namespace DocuMed.Domain.Entities.User;
|
||||||
|
|
||||||
namespace DocuMed.Domain.Entities.User;
|
|
||||||
|
|
||||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||||
[GenerateMapper]
|
[GenerateMapper]
|
||||||
|
@ -13,6 +11,6 @@ public class ApplicationUser : IdentityUser<Guid>
|
||||||
public Gender Gender { get; set; }
|
public Gender Gender { get; set; }
|
||||||
public SignUpStatus SignUpStatus { get; set; }
|
public SignUpStatus SignUpStatus { get; set; }
|
||||||
|
|
||||||
public Student? Student { get; set; }
|
public List<Student> Students { get; set; } = [];
|
||||||
public Patient? Patient { get; set; }
|
public List<Patient> Patients { get; set; } = [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,60 +71,47 @@ namespace DocuMed.Domain.Mappers
|
||||||
PhoneNumber = p5.PhoneNumber,
|
PhoneNumber = p5.PhoneNumber,
|
||||||
PhoneNumberConfirmed = p5.PhoneNumberConfirmed,
|
PhoneNumberConfirmed = p5.PhoneNumberConfirmed,
|
||||||
NationalId = p5.NationalId,
|
NationalId = p5.NationalId,
|
||||||
StudentId = funcMain1(p5.Student == null ? null : (Guid?)p5.Student.Id),
|
|
||||||
BirthDate = p5.BirthDate,
|
BirthDate = p5.BirthDate,
|
||||||
Gender = p5.Gender,
|
Gender = p5.Gender,
|
||||||
SignUpStatus = p5.SignUpStatus,
|
SignUpStatus = p5.SignUpStatus,
|
||||||
Id = p5.Id
|
Id = p5.Id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static ApplicationUserSDto AdaptTo(this ApplicationUser p7, ApplicationUserSDto p8)
|
public static ApplicationUserSDto AdaptTo(this ApplicationUser p6, ApplicationUserSDto p7)
|
||||||
{
|
{
|
||||||
if (p7 == null)
|
if (p6 == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ApplicationUserSDto result = p8 ?? new ApplicationUserSDto();
|
ApplicationUserSDto result = p7 ?? new ApplicationUserSDto();
|
||||||
|
|
||||||
result.FirstName = p7.FirstName;
|
result.FirstName = p6.FirstName;
|
||||||
result.LastName = p7.LastName;
|
result.LastName = p6.LastName;
|
||||||
result.UserName = p7.UserName;
|
result.UserName = p6.UserName;
|
||||||
result.Email = p7.Email;
|
result.Email = p6.Email;
|
||||||
result.PhoneNumber = p7.PhoneNumber;
|
result.PhoneNumber = p6.PhoneNumber;
|
||||||
result.PhoneNumberConfirmed = p7.PhoneNumberConfirmed;
|
result.PhoneNumberConfirmed = p6.PhoneNumberConfirmed;
|
||||||
result.NationalId = p7.NationalId;
|
result.NationalId = p6.NationalId;
|
||||||
result.StudentId = funcMain2(p7.Student == null ? null : (Guid?)p7.Student.Id, result.StudentId);
|
result.BirthDate = p6.BirthDate;
|
||||||
result.BirthDate = p7.BirthDate;
|
result.Gender = p6.Gender;
|
||||||
result.Gender = p7.Gender;
|
result.SignUpStatus = p6.SignUpStatus;
|
||||||
result.SignUpStatus = p7.SignUpStatus;
|
result.Id = p6.Id;
|
||||||
result.Id = p7.Id;
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
public static Expression<Func<ApplicationUser, ApplicationUserSDto>> ProjectToSDto => p11 => new ApplicationUserSDto()
|
public static Expression<Func<ApplicationUser, ApplicationUserSDto>> ProjectToSDto => p8 => new ApplicationUserSDto()
|
||||||
{
|
{
|
||||||
FirstName = p11.FirstName,
|
FirstName = p8.FirstName,
|
||||||
LastName = p11.LastName,
|
LastName = p8.LastName,
|
||||||
UserName = p11.UserName,
|
UserName = p8.UserName,
|
||||||
Email = p11.Email,
|
Email = p8.Email,
|
||||||
PhoneNumber = p11.PhoneNumber,
|
PhoneNumber = p8.PhoneNumber,
|
||||||
PhoneNumberConfirmed = p11.PhoneNumberConfirmed,
|
PhoneNumberConfirmed = p8.PhoneNumberConfirmed,
|
||||||
NationalId = p11.NationalId,
|
NationalId = p8.NationalId,
|
||||||
StudentId = p11.Student.Id.ToString(),
|
BirthDate = p8.BirthDate,
|
||||||
BirthDate = p11.BirthDate,
|
Gender = p8.Gender,
|
||||||
Gender = p11.Gender,
|
SignUpStatus = p8.SignUpStatus,
|
||||||
SignUpStatus = p11.SignUpStatus,
|
Id = p8.Id
|
||||||
Id = p11.Id
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private static string funcMain1(Guid? p6)
|
|
||||||
{
|
|
||||||
return p6 == null ? null : ((Guid)p6).ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string funcMain2(Guid? p9, string p10)
|
|
||||||
{
|
|
||||||
return p9 == null ? null : ((Guid)p9).ToString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,6 @@ using DocuMed.Domain.Dtos.LargDtos;
|
||||||
using DocuMed.Domain.Dtos.SmallDtos;
|
using DocuMed.Domain.Dtos.SmallDtos;
|
||||||
using DocuMed.Domain.Entities.Hospitals;
|
using DocuMed.Domain.Entities.Hospitals;
|
||||||
using DocuMed.Domain.Entities.MedicalHistory;
|
using DocuMed.Domain.Entities.MedicalHistory;
|
||||||
using DocuMed.Domain.Entities.User;
|
|
||||||
using Mapster.Models;
|
using Mapster.Models;
|
||||||
|
|
||||||
namespace DocuMed.Domain.Mappers
|
namespace DocuMed.Domain.Mappers
|
||||||
|
@ -26,12 +25,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
HospitalId = p1.Section.HospitalId,
|
HospitalId = p1.Section.HospitalId,
|
||||||
Id = p1.Section.Id
|
Id = p1.Section.Id
|
||||||
},
|
},
|
||||||
FirstName = p1.FirstName,
|
|
||||||
LastName = p1.LastName,
|
|
||||||
FatherName = p1.FatherName,
|
|
||||||
NationalId = p1.NationalId,
|
|
||||||
Age = p1.Age,
|
|
||||||
BirthDate = p1.BirthDate,
|
|
||||||
PresentIllnessDetail = p1.PresentIllnessDetail,
|
PresentIllnessDetail = p1.PresentIllnessDetail,
|
||||||
PastDiseasesHistoryDetail = p1.PastDiseasesHistoryDetail,
|
PastDiseasesHistoryDetail = p1.PastDiseasesHistoryDetail,
|
||||||
PastSurgeryHistoryDetail = p1.PastSurgeryHistoryDetail,
|
PastSurgeryHistoryDetail = p1.PastSurgeryHistoryDetail,
|
||||||
|
@ -49,7 +42,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
SPO2 = p1.SPO2,
|
SPO2 = p1.SPO2,
|
||||||
Temperature = p1.Temperature,
|
Temperature = p1.Temperature,
|
||||||
MedicalHistoryTemplateId = p1.MedicalHistoryTemplateId,
|
MedicalHistoryTemplateId = p1.MedicalHistoryTemplateId,
|
||||||
ApplicationUserId = p1.ApplicationUserId,
|
|
||||||
Answers = funcMain1(p1.Answers),
|
Answers = funcMain1(p1.Answers),
|
||||||
Id = p1.Id,
|
Id = p1.Id,
|
||||||
CreatedAt = p1.CreatedAt
|
CreatedAt = p1.CreatedAt
|
||||||
|
@ -66,12 +58,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
result.ChiefComplaint = p3.ChiefComplaint;
|
result.ChiefComplaint = p3.ChiefComplaint;
|
||||||
result.SectionId = p3.SectionId;
|
result.SectionId = p3.SectionId;
|
||||||
result.Section = funcMain2(p3.Section, result.Section);
|
result.Section = funcMain2(p3.Section, result.Section);
|
||||||
result.FirstName = p3.FirstName;
|
|
||||||
result.LastName = p3.LastName;
|
|
||||||
result.FatherName = p3.FatherName;
|
|
||||||
result.NationalId = p3.NationalId;
|
|
||||||
result.Age = p3.Age;
|
|
||||||
result.BirthDate = p3.BirthDate;
|
|
||||||
result.PresentIllnessDetail = p3.PresentIllnessDetail;
|
result.PresentIllnessDetail = p3.PresentIllnessDetail;
|
||||||
result.PastDiseasesHistoryDetail = p3.PastDiseasesHistoryDetail;
|
result.PastDiseasesHistoryDetail = p3.PastDiseasesHistoryDetail;
|
||||||
result.PastSurgeryHistoryDetail = p3.PastSurgeryHistoryDetail;
|
result.PastSurgeryHistoryDetail = p3.PastSurgeryHistoryDetail;
|
||||||
|
@ -89,7 +75,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
result.SPO2 = p3.SPO2;
|
result.SPO2 = p3.SPO2;
|
||||||
result.Temperature = p3.Temperature;
|
result.Temperature = p3.Temperature;
|
||||||
result.MedicalHistoryTemplateId = p3.MedicalHistoryTemplateId;
|
result.MedicalHistoryTemplateId = p3.MedicalHistoryTemplateId;
|
||||||
result.ApplicationUserId = p3.ApplicationUserId;
|
|
||||||
result.Answers = funcMain3(p3.Answers, result.Answers);
|
result.Answers = funcMain3(p3.Answers, result.Answers);
|
||||||
result.Id = p3.Id;
|
result.Id = p3.Id;
|
||||||
result.CreatedAt = p3.CreatedAt;
|
result.CreatedAt = p3.CreatedAt;
|
||||||
|
@ -107,12 +92,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
HospitalId = p9.Section.HospitalId,
|
HospitalId = p9.Section.HospitalId,
|
||||||
Id = p9.Section.Id
|
Id = p9.Section.Id
|
||||||
},
|
},
|
||||||
FirstName = p9.FirstName,
|
|
||||||
LastName = p9.LastName,
|
|
||||||
FatherName = p9.FatherName,
|
|
||||||
NationalId = p9.NationalId,
|
|
||||||
Age = p9.Age,
|
|
||||||
BirthDate = p9.BirthDate,
|
|
||||||
PresentIllnessDetail = p9.PresentIllnessDetail,
|
PresentIllnessDetail = p9.PresentIllnessDetail,
|
||||||
PastDiseasesHistoryDetail = p9.PastDiseasesHistoryDetail,
|
PastDiseasesHistoryDetail = p9.PastDiseasesHistoryDetail,
|
||||||
PastSurgeryHistoryDetail = p9.PastSurgeryHistoryDetail,
|
PastSurgeryHistoryDetail = p9.PastSurgeryHistoryDetail,
|
||||||
|
@ -130,7 +109,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
SPO2 = p9.SPO2,
|
SPO2 = p9.SPO2,
|
||||||
Temperature = p9.Temperature,
|
Temperature = p9.Temperature,
|
||||||
MedicalHistoryTemplateId = p9.MedicalHistoryTemplateId,
|
MedicalHistoryTemplateId = p9.MedicalHistoryTemplateId,
|
||||||
ApplicationUserId = p9.ApplicationUserId,
|
|
||||||
Answers = p9.Answers.Select<MedicalHistoryAnswerSDto, MedicalHistoryAnswer>(p10 => new MedicalHistoryAnswer()
|
Answers = p9.Answers.Select<MedicalHistoryAnswerSDto, MedicalHistoryAnswer>(p10 => new MedicalHistoryAnswer()
|
||||||
{
|
{
|
||||||
Answer = p10.Answer,
|
Answer = p10.Answer,
|
||||||
|
@ -149,12 +127,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
{
|
{
|
||||||
ChiefComplaint = p11.ChiefComplaint,
|
ChiefComplaint = p11.ChiefComplaint,
|
||||||
SectionId = p11.SectionId,
|
SectionId = p11.SectionId,
|
||||||
FirstName = p11.FirstName,
|
|
||||||
LastName = p11.LastName,
|
|
||||||
FatherName = p11.FatherName,
|
|
||||||
NationalId = p11.NationalId,
|
|
||||||
Age = p11.Age,
|
|
||||||
BirthDate = p11.BirthDate,
|
|
||||||
Code = p11.Code,
|
Code = p11.Code,
|
||||||
Section = p11.Section == null ? null : new SectionSDto()
|
Section = p11.Section == null ? null : new SectionSDto()
|
||||||
{
|
{
|
||||||
|
@ -179,7 +151,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
PulseRate = p11.PulseRate,
|
PulseRate = p11.PulseRate,
|
||||||
SPO2 = p11.SPO2,
|
SPO2 = p11.SPO2,
|
||||||
Temperature = p11.Temperature,
|
Temperature = p11.Temperature,
|
||||||
ApplicationUserId = p11.ApplicationUserId,
|
|
||||||
CreatedAt = p11.CreatedAt,
|
CreatedAt = p11.CreatedAt,
|
||||||
Answers = funcMain4(p11.Answers),
|
Answers = funcMain4(p11.Answers),
|
||||||
Id = p11.Id
|
Id = p11.Id
|
||||||
|
@ -195,12 +166,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
|
|
||||||
result.ChiefComplaint = p13.ChiefComplaint;
|
result.ChiefComplaint = p13.ChiefComplaint;
|
||||||
result.SectionId = p13.SectionId;
|
result.SectionId = p13.SectionId;
|
||||||
result.FirstName = p13.FirstName;
|
|
||||||
result.LastName = p13.LastName;
|
|
||||||
result.FatherName = p13.FatherName;
|
|
||||||
result.NationalId = p13.NationalId;
|
|
||||||
result.Age = p13.Age;
|
|
||||||
result.BirthDate = p13.BirthDate;
|
|
||||||
result.Code = p13.Code;
|
result.Code = p13.Code;
|
||||||
result.Section = funcMain5(p13.Section, result.Section);
|
result.Section = funcMain5(p13.Section, result.Section);
|
||||||
result.PresentIllnessDetail = p13.PresentIllnessDetail;
|
result.PresentIllnessDetail = p13.PresentIllnessDetail;
|
||||||
|
@ -219,7 +184,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
result.PulseRate = p13.PulseRate;
|
result.PulseRate = p13.PulseRate;
|
||||||
result.SPO2 = p13.SPO2;
|
result.SPO2 = p13.SPO2;
|
||||||
result.Temperature = p13.Temperature;
|
result.Temperature = p13.Temperature;
|
||||||
result.ApplicationUserId = p13.ApplicationUserId;
|
|
||||||
result.CreatedAt = p13.CreatedAt;
|
result.CreatedAt = p13.CreatedAt;
|
||||||
result.Answers = funcMain6(p13.Answers, result.Answers);
|
result.Answers = funcMain6(p13.Answers, result.Answers);
|
||||||
result.Id = p13.Id;
|
result.Id = p13.Id;
|
||||||
|
@ -230,12 +194,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
{
|
{
|
||||||
ChiefComplaint = p19.ChiefComplaint,
|
ChiefComplaint = p19.ChiefComplaint,
|
||||||
SectionId = p19.SectionId,
|
SectionId = p19.SectionId,
|
||||||
FirstName = p19.FirstName,
|
|
||||||
LastName = p19.LastName,
|
|
||||||
FatherName = p19.FatherName,
|
|
||||||
NationalId = p19.NationalId,
|
|
||||||
Age = p19.Age,
|
|
||||||
BirthDate = p19.BirthDate,
|
|
||||||
Code = p19.Code,
|
Code = p19.Code,
|
||||||
Section = p19.Section == null ? null : new SectionSDto()
|
Section = p19.Section == null ? null : new SectionSDto()
|
||||||
{
|
{
|
||||||
|
@ -260,7 +218,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
PulseRate = p19.PulseRate,
|
PulseRate = p19.PulseRate,
|
||||||
SPO2 = p19.SPO2,
|
SPO2 = p19.SPO2,
|
||||||
Temperature = p19.Temperature,
|
Temperature = p19.Temperature,
|
||||||
ApplicationUserId = p19.ApplicationUserId,
|
|
||||||
CreatedAt = p19.CreatedAt,
|
CreatedAt = p19.CreatedAt,
|
||||||
Answers = p19.Answers.Select<MedicalHistoryAnswer, MedicalHistoryAnswerSDto>(p20 => new MedicalHistoryAnswerSDto()
|
Answers = p19.Answers.Select<MedicalHistoryAnswer, MedicalHistoryAnswerSDto>(p20 => new MedicalHistoryAnswerSDto()
|
||||||
{
|
{
|
||||||
|
@ -284,12 +241,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
Name = p21.SectionName,
|
Name = p21.SectionName,
|
||||||
Id = p21.SectionId
|
Id = p21.SectionId
|
||||||
},
|
},
|
||||||
FirstName = p21.FirstName,
|
|
||||||
LastName = p21.LastName,
|
|
||||||
FatherName = p21.FatherName,
|
|
||||||
NationalId = p21.NationalId,
|
|
||||||
Age = p21.Age,
|
|
||||||
BirthDate = p21.BirthDate,
|
|
||||||
PresentIllnessDetail = p21.PresentIllnessDetail,
|
PresentIllnessDetail = p21.PresentIllnessDetail,
|
||||||
PastDiseasesHistoryDetail = p21.PastDiseasesHistoryDetail,
|
PastDiseasesHistoryDetail = p21.PastDiseasesHistoryDetail,
|
||||||
PastSurgeryHistoryDetail = p21.PastSurgeryHistoryDetail,
|
PastSurgeryHistoryDetail = p21.PastSurgeryHistoryDetail,
|
||||||
|
@ -307,8 +258,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
SPO2 = p21.SPO2,
|
SPO2 = p21.SPO2,
|
||||||
Temperature = p21.Temperature,
|
Temperature = p21.Temperature,
|
||||||
MedicalHistoryTemplateId = p21.MedicalHistoryTemplateId,
|
MedicalHistoryTemplateId = p21.MedicalHistoryTemplateId,
|
||||||
ApplicationUserId = p21.ApplicationUserId,
|
|
||||||
ApplicationUser = new ApplicationUser() {Id = p21.ApplicationUserId},
|
|
||||||
Id = p21.Id,
|
Id = p21.Id,
|
||||||
CreatedAt = p21.CreatedAt
|
CreatedAt = p21.CreatedAt
|
||||||
};
|
};
|
||||||
|
@ -324,12 +273,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
result.ChiefComplaint = p22.ChiefComplaint;
|
result.ChiefComplaint = p22.ChiefComplaint;
|
||||||
result.SectionId = p22.SectionId;
|
result.SectionId = p22.SectionId;
|
||||||
result.Section = funcMain7(new Never(), result.Section, p22);
|
result.Section = funcMain7(new Never(), result.Section, p22);
|
||||||
result.FirstName = p22.FirstName;
|
|
||||||
result.LastName = p22.LastName;
|
|
||||||
result.FatherName = p22.FatherName;
|
|
||||||
result.NationalId = p22.NationalId;
|
|
||||||
result.Age = p22.Age;
|
|
||||||
result.BirthDate = p22.BirthDate;
|
|
||||||
result.PresentIllnessDetail = p22.PresentIllnessDetail;
|
result.PresentIllnessDetail = p22.PresentIllnessDetail;
|
||||||
result.PastDiseasesHistoryDetail = p22.PastDiseasesHistoryDetail;
|
result.PastDiseasesHistoryDetail = p22.PastDiseasesHistoryDetail;
|
||||||
result.PastSurgeryHistoryDetail = p22.PastSurgeryHistoryDetail;
|
result.PastSurgeryHistoryDetail = p22.PastSurgeryHistoryDetail;
|
||||||
|
@ -347,119 +290,96 @@ namespace DocuMed.Domain.Mappers
|
||||||
result.SPO2 = p22.SPO2;
|
result.SPO2 = p22.SPO2;
|
||||||
result.Temperature = p22.Temperature;
|
result.Temperature = p22.Temperature;
|
||||||
result.MedicalHistoryTemplateId = p22.MedicalHistoryTemplateId;
|
result.MedicalHistoryTemplateId = p22.MedicalHistoryTemplateId;
|
||||||
result.ApplicationUserId = p22.ApplicationUserId;
|
|
||||||
result.ApplicationUser = funcMain8(new Never(), result.ApplicationUser, p22);
|
|
||||||
result.Id = p22.Id;
|
result.Id = p22.Id;
|
||||||
result.CreatedAt = p22.CreatedAt;
|
result.CreatedAt = p22.CreatedAt;
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
public static MedicalHistorySDto AdaptToSDto(this MedicalHistory p28)
|
public static MedicalHistorySDto AdaptToSDto(this MedicalHistory p26)
|
||||||
{
|
{
|
||||||
return p28 == null ? null : new MedicalHistorySDto()
|
return p26 == null ? null : new MedicalHistorySDto()
|
||||||
{
|
{
|
||||||
ChiefComplaint = p28.ChiefComplaint,
|
ChiefComplaint = p26.ChiefComplaint,
|
||||||
SectionId = p28.SectionId,
|
SectionId = p26.SectionId,
|
||||||
SectionName = p28.Section != null ? p28.Section.Name : string.Empty,
|
SectionName = p26.Section != null ? p26.Section.Name : string.Empty,
|
||||||
FirstName = p28.FirstName,
|
MedicalHistoryTemplateId = p26.MedicalHistoryTemplateId,
|
||||||
LastName = p28.LastName,
|
Code = p26.Code,
|
||||||
FatherName = p28.FatherName,
|
PresentIllnessDetail = p26.PresentIllnessDetail,
|
||||||
NationalId = p28.NationalId,
|
PastDiseasesHistoryDetail = p26.PastDiseasesHistoryDetail,
|
||||||
MedicalHistoryTemplateId = p28.MedicalHistoryTemplateId,
|
PastSurgeryHistoryDetail = p26.PastSurgeryHistoryDetail,
|
||||||
Age = p28.Age,
|
FamilyHistoryDetail = p26.FamilyHistoryDetail,
|
||||||
BirthDate = p28.BirthDate,
|
AllergyDetail = p26.AllergyDetail,
|
||||||
Code = p28.Code,
|
DrugHistoryDetail = p26.DrugHistoryDetail,
|
||||||
PresentIllnessDetail = p28.PresentIllnessDetail,
|
AddictionHistoryDetail = p26.AddictionHistoryDetail,
|
||||||
PastDiseasesHistoryDetail = p28.PastDiseasesHistoryDetail,
|
SystemReviewDetail = p26.SystemReviewDetail,
|
||||||
PastSurgeryHistoryDetail = p28.PastSurgeryHistoryDetail,
|
VitalSignDetail = p26.VitalSignDetail,
|
||||||
FamilyHistoryDetail = p28.FamilyHistoryDetail,
|
GeneralAppearanceDetail = p26.GeneralAppearanceDetail,
|
||||||
AllergyDetail = p28.AllergyDetail,
|
SystolicBloodPressure = p26.SystolicBloodPressure,
|
||||||
DrugHistoryDetail = p28.DrugHistoryDetail,
|
DiastolicBloodPressure = p26.DiastolicBloodPressure,
|
||||||
AddictionHistoryDetail = p28.AddictionHistoryDetail,
|
PulseRate = p26.PulseRate,
|
||||||
SystemReviewDetail = p28.SystemReviewDetail,
|
SPO2 = p26.SPO2,
|
||||||
VitalSignDetail = p28.VitalSignDetail,
|
Temperature = p26.Temperature,
|
||||||
GeneralAppearanceDetail = p28.GeneralAppearanceDetail,
|
CreatedAt = p26.CreatedAt,
|
||||||
SystolicBloodPressure = p28.SystolicBloodPressure,
|
Id = p26.Id
|
||||||
DiastolicBloodPressure = p28.DiastolicBloodPressure,
|
|
||||||
PulseRate = p28.PulseRate,
|
|
||||||
SPO2 = p28.SPO2,
|
|
||||||
Temperature = p28.Temperature,
|
|
||||||
ApplicationUserId = p28.ApplicationUserId,
|
|
||||||
CreatedAt = p28.CreatedAt,
|
|
||||||
Id = p28.Id
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static MedicalHistorySDto AdaptTo(this MedicalHistory p29, MedicalHistorySDto p30)
|
public static MedicalHistorySDto AdaptTo(this MedicalHistory p27, MedicalHistorySDto p28)
|
||||||
{
|
{
|
||||||
if (p29 == null)
|
if (p27 == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
MedicalHistorySDto result = p30 ?? new MedicalHistorySDto();
|
MedicalHistorySDto result = p28 ?? new MedicalHistorySDto();
|
||||||
|
|
||||||
result.ChiefComplaint = p29.ChiefComplaint;
|
result.ChiefComplaint = p27.ChiefComplaint;
|
||||||
result.SectionId = p29.SectionId;
|
result.SectionId = p27.SectionId;
|
||||||
result.SectionName = p29.Section != null ? p29.Section.Name : string.Empty;
|
result.SectionName = p27.Section != null ? p27.Section.Name : string.Empty;
|
||||||
result.FirstName = p29.FirstName;
|
result.MedicalHistoryTemplateId = p27.MedicalHistoryTemplateId;
|
||||||
result.LastName = p29.LastName;
|
result.Code = p27.Code;
|
||||||
result.FatherName = p29.FatherName;
|
result.PresentIllnessDetail = p27.PresentIllnessDetail;
|
||||||
result.NationalId = p29.NationalId;
|
result.PastDiseasesHistoryDetail = p27.PastDiseasesHistoryDetail;
|
||||||
result.MedicalHistoryTemplateId = p29.MedicalHistoryTemplateId;
|
result.PastSurgeryHistoryDetail = p27.PastSurgeryHistoryDetail;
|
||||||
result.Age = p29.Age;
|
result.FamilyHistoryDetail = p27.FamilyHistoryDetail;
|
||||||
result.BirthDate = p29.BirthDate;
|
result.AllergyDetail = p27.AllergyDetail;
|
||||||
result.Code = p29.Code;
|
result.DrugHistoryDetail = p27.DrugHistoryDetail;
|
||||||
result.PresentIllnessDetail = p29.PresentIllnessDetail;
|
result.AddictionHistoryDetail = p27.AddictionHistoryDetail;
|
||||||
result.PastDiseasesHistoryDetail = p29.PastDiseasesHistoryDetail;
|
result.SystemReviewDetail = p27.SystemReviewDetail;
|
||||||
result.PastSurgeryHistoryDetail = p29.PastSurgeryHistoryDetail;
|
result.VitalSignDetail = p27.VitalSignDetail;
|
||||||
result.FamilyHistoryDetail = p29.FamilyHistoryDetail;
|
result.GeneralAppearanceDetail = p27.GeneralAppearanceDetail;
|
||||||
result.AllergyDetail = p29.AllergyDetail;
|
result.SystolicBloodPressure = p27.SystolicBloodPressure;
|
||||||
result.DrugHistoryDetail = p29.DrugHistoryDetail;
|
result.DiastolicBloodPressure = p27.DiastolicBloodPressure;
|
||||||
result.AddictionHistoryDetail = p29.AddictionHistoryDetail;
|
result.PulseRate = p27.PulseRate;
|
||||||
result.SystemReviewDetail = p29.SystemReviewDetail;
|
result.SPO2 = p27.SPO2;
|
||||||
result.VitalSignDetail = p29.VitalSignDetail;
|
result.Temperature = p27.Temperature;
|
||||||
result.GeneralAppearanceDetail = p29.GeneralAppearanceDetail;
|
result.CreatedAt = p27.CreatedAt;
|
||||||
result.SystolicBloodPressure = p29.SystolicBloodPressure;
|
result.Id = p27.Id;
|
||||||
result.DiastolicBloodPressure = p29.DiastolicBloodPressure;
|
|
||||||
result.PulseRate = p29.PulseRate;
|
|
||||||
result.SPO2 = p29.SPO2;
|
|
||||||
result.Temperature = p29.Temperature;
|
|
||||||
result.ApplicationUserId = p29.ApplicationUserId;
|
|
||||||
result.CreatedAt = p29.CreatedAt;
|
|
||||||
result.Id = p29.Id;
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
public static Expression<Func<MedicalHistory, MedicalHistorySDto>> ProjectToSDto => p31 => new MedicalHistorySDto()
|
public static Expression<Func<MedicalHistory, MedicalHistorySDto>> ProjectToSDto => p29 => new MedicalHistorySDto()
|
||||||
{
|
{
|
||||||
ChiefComplaint = p31.ChiefComplaint,
|
ChiefComplaint = p29.ChiefComplaint,
|
||||||
SectionId = p31.SectionId,
|
SectionId = p29.SectionId,
|
||||||
SectionName = p31.Section != null ? p31.Section.Name : string.Empty,
|
SectionName = p29.Section != null ? p29.Section.Name : string.Empty,
|
||||||
FirstName = p31.FirstName,
|
MedicalHistoryTemplateId = p29.MedicalHistoryTemplateId,
|
||||||
LastName = p31.LastName,
|
Code = p29.Code,
|
||||||
FatherName = p31.FatherName,
|
PresentIllnessDetail = p29.PresentIllnessDetail,
|
||||||
NationalId = p31.NationalId,
|
PastDiseasesHistoryDetail = p29.PastDiseasesHistoryDetail,
|
||||||
MedicalHistoryTemplateId = p31.MedicalHistoryTemplateId,
|
PastSurgeryHistoryDetail = p29.PastSurgeryHistoryDetail,
|
||||||
Age = p31.Age,
|
FamilyHistoryDetail = p29.FamilyHistoryDetail,
|
||||||
BirthDate = p31.BirthDate,
|
AllergyDetail = p29.AllergyDetail,
|
||||||
Code = p31.Code,
|
DrugHistoryDetail = p29.DrugHistoryDetail,
|
||||||
PresentIllnessDetail = p31.PresentIllnessDetail,
|
AddictionHistoryDetail = p29.AddictionHistoryDetail,
|
||||||
PastDiseasesHistoryDetail = p31.PastDiseasesHistoryDetail,
|
SystemReviewDetail = p29.SystemReviewDetail,
|
||||||
PastSurgeryHistoryDetail = p31.PastSurgeryHistoryDetail,
|
VitalSignDetail = p29.VitalSignDetail,
|
||||||
FamilyHistoryDetail = p31.FamilyHistoryDetail,
|
GeneralAppearanceDetail = p29.GeneralAppearanceDetail,
|
||||||
AllergyDetail = p31.AllergyDetail,
|
SystolicBloodPressure = p29.SystolicBloodPressure,
|
||||||
DrugHistoryDetail = p31.DrugHistoryDetail,
|
DiastolicBloodPressure = p29.DiastolicBloodPressure,
|
||||||
AddictionHistoryDetail = p31.AddictionHistoryDetail,
|
PulseRate = p29.PulseRate,
|
||||||
SystemReviewDetail = p31.SystemReviewDetail,
|
SPO2 = p29.SPO2,
|
||||||
VitalSignDetail = p31.VitalSignDetail,
|
Temperature = p29.Temperature,
|
||||||
GeneralAppearanceDetail = p31.GeneralAppearanceDetail,
|
CreatedAt = p29.CreatedAt,
|
||||||
SystolicBloodPressure = p31.SystolicBloodPressure,
|
Id = p29.Id
|
||||||
DiastolicBloodPressure = p31.DiastolicBloodPressure,
|
|
||||||
PulseRate = p31.PulseRate,
|
|
||||||
SPO2 = p31.SPO2,
|
|
||||||
Temperature = p31.Temperature,
|
|
||||||
ApplicationUserId = p31.ApplicationUserId,
|
|
||||||
CreatedAt = p31.CreatedAt,
|
|
||||||
Id = p31.Id
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private static List<MedicalHistoryAnswer> funcMain1(List<MedicalHistoryAnswerSDto> p2)
|
private static List<MedicalHistoryAnswer> funcMain1(List<MedicalHistoryAnswerSDto> p2)
|
||||||
|
@ -619,14 +539,5 @@ namespace DocuMed.Domain.Mappers
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ApplicationUser funcMain8(Never p26, ApplicationUser p27, MedicalHistorySDto p22)
|
|
||||||
{
|
|
||||||
ApplicationUser result = p27 ?? new ApplicationUser();
|
|
||||||
|
|
||||||
result.Id = p22.ApplicationUserId;
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -24,7 +24,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
HospitalId = p1.Section.HospitalId,
|
HospitalId = p1.Section.HospitalId,
|
||||||
Id = p1.Section.Id
|
Id = p1.Section.Id
|
||||||
},
|
},
|
||||||
ApplicationUserId = p1.ApplicationUserId,
|
|
||||||
Questions = funcMain1(p1.Questions),
|
Questions = funcMain1(p1.Questions),
|
||||||
Id = p1.Id,
|
Id = p1.Id,
|
||||||
CreatedAt = p1.CreatedAt
|
CreatedAt = p1.CreatedAt
|
||||||
|
@ -41,7 +40,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
result.ChiefComplaint = p3.ChiefComplaint;
|
result.ChiefComplaint = p3.ChiefComplaint;
|
||||||
result.SectionId = p3.SectionId;
|
result.SectionId = p3.SectionId;
|
||||||
result.Section = funcMain2(p3.Section, result.Section);
|
result.Section = funcMain2(p3.Section, result.Section);
|
||||||
result.ApplicationUserId = p3.ApplicationUserId;
|
|
||||||
result.Questions = funcMain3(p3.Questions, result.Questions);
|
result.Questions = funcMain3(p3.Questions, result.Questions);
|
||||||
result.Id = p3.Id;
|
result.Id = p3.Id;
|
||||||
result.CreatedAt = p3.CreatedAt;
|
result.CreatedAt = p3.CreatedAt;
|
||||||
|
@ -59,7 +57,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
HospitalId = p9.Section.HospitalId,
|
HospitalId = p9.Section.HospitalId,
|
||||||
Id = p9.Section.Id
|
Id = p9.Section.Id
|
||||||
},
|
},
|
||||||
ApplicationUserId = p9.ApplicationUserId,
|
|
||||||
Questions = p9.Questions.Select<MedicalHistoryQuestionSDto, MedicalHistoryQuestion>(p10 => new MedicalHistoryQuestion()
|
Questions = p9.Questions.Select<MedicalHistoryQuestionSDto, MedicalHistoryQuestion>(p10 => new MedicalHistoryQuestion()
|
||||||
{
|
{
|
||||||
Question = p10.Question,
|
Question = p10.Question,
|
||||||
|
@ -87,7 +84,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
HospitalId = p11.Section.HospitalId,
|
HospitalId = p11.Section.HospitalId,
|
||||||
Id = p11.Section.Id
|
Id = p11.Section.Id
|
||||||
},
|
},
|
||||||
ApplicationUserId = p11.ApplicationUserId,
|
|
||||||
CreatedAt = p11.CreatedAt,
|
CreatedAt = p11.CreatedAt,
|
||||||
Questions = funcMain4(p11.Questions),
|
Questions = funcMain4(p11.Questions),
|
||||||
Id = p11.Id
|
Id = p11.Id
|
||||||
|
@ -104,7 +100,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
result.ChiefComplaint = p13.ChiefComplaint;
|
result.ChiefComplaint = p13.ChiefComplaint;
|
||||||
result.SectionId = p13.SectionId;
|
result.SectionId = p13.SectionId;
|
||||||
result.Section = funcMain5(p13.Section, result.Section);
|
result.Section = funcMain5(p13.Section, result.Section);
|
||||||
result.ApplicationUserId = p13.ApplicationUserId;
|
|
||||||
result.CreatedAt = p13.CreatedAt;
|
result.CreatedAt = p13.CreatedAt;
|
||||||
result.Questions = funcMain6(p13.Questions, result.Questions);
|
result.Questions = funcMain6(p13.Questions, result.Questions);
|
||||||
result.Id = p13.Id;
|
result.Id = p13.Id;
|
||||||
|
@ -122,7 +117,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
HospitalId = p19.Section.HospitalId,
|
HospitalId = p19.Section.HospitalId,
|
||||||
Id = p19.Section.Id
|
Id = p19.Section.Id
|
||||||
},
|
},
|
||||||
ApplicationUserId = p19.ApplicationUserId,
|
|
||||||
CreatedAt = p19.CreatedAt,
|
CreatedAt = p19.CreatedAt,
|
||||||
Questions = p19.Questions.Select<MedicalHistoryQuestion, MedicalHistoryQuestionSDto>(p20 => new MedicalHistoryQuestionSDto()
|
Questions = p19.Questions.Select<MedicalHistoryQuestion, MedicalHistoryQuestionSDto>(p20 => new MedicalHistoryQuestionSDto()
|
||||||
{
|
{
|
||||||
|
@ -143,7 +137,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
{
|
{
|
||||||
ChiefComplaint = p21.ChiefComplaint,
|
ChiefComplaint = p21.ChiefComplaint,
|
||||||
SectionId = p21.SectionId,
|
SectionId = p21.SectionId,
|
||||||
ApplicationUserId = p21.ApplicationUserId,
|
|
||||||
Id = p21.Id,
|
Id = p21.Id,
|
||||||
CreatedAt = p21.CreatedAt
|
CreatedAt = p21.CreatedAt
|
||||||
};
|
};
|
||||||
|
@ -158,7 +151,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
|
|
||||||
result.ChiefComplaint = p22.ChiefComplaint;
|
result.ChiefComplaint = p22.ChiefComplaint;
|
||||||
result.SectionId = p22.SectionId;
|
result.SectionId = p22.SectionId;
|
||||||
result.ApplicationUserId = p22.ApplicationUserId;
|
|
||||||
result.Id = p22.Id;
|
result.Id = p22.Id;
|
||||||
result.CreatedAt = p22.CreatedAt;
|
result.CreatedAt = p22.CreatedAt;
|
||||||
return result;
|
return result;
|
||||||
|
@ -171,7 +163,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
ChiefComplaint = p24.ChiefComplaint,
|
ChiefComplaint = p24.ChiefComplaint,
|
||||||
SectionName = p24.Section == null ? null : p24.Section.Name,
|
SectionName = p24.Section == null ? null : p24.Section.Name,
|
||||||
SectionId = p24.SectionId,
|
SectionId = p24.SectionId,
|
||||||
ApplicationUserId = p24.ApplicationUserId,
|
|
||||||
CreatedAt = p24.CreatedAt,
|
CreatedAt = p24.CreatedAt,
|
||||||
Id = p24.Id
|
Id = p24.Id
|
||||||
};
|
};
|
||||||
|
@ -187,7 +178,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
result.ChiefComplaint = p25.ChiefComplaint;
|
result.ChiefComplaint = p25.ChiefComplaint;
|
||||||
result.SectionName = p25.Section == null ? null : p25.Section.Name;
|
result.SectionName = p25.Section == null ? null : p25.Section.Name;
|
||||||
result.SectionId = p25.SectionId;
|
result.SectionId = p25.SectionId;
|
||||||
result.ApplicationUserId = p25.ApplicationUserId;
|
|
||||||
result.CreatedAt = p25.CreatedAt;
|
result.CreatedAt = p25.CreatedAt;
|
||||||
result.Id = p25.Id;
|
result.Id = p25.Id;
|
||||||
return result;
|
return result;
|
||||||
|
@ -198,7 +188,6 @@ namespace DocuMed.Domain.Mappers
|
||||||
ChiefComplaint = p27.ChiefComplaint,
|
ChiefComplaint = p27.ChiefComplaint,
|
||||||
SectionName = p27.Section.Name,
|
SectionName = p27.Section.Name,
|
||||||
SectionId = p27.SectionId,
|
SectionId = p27.SectionId,
|
||||||
ApplicationUserId = p27.ApplicationUserId,
|
|
||||||
CreatedAt = p27.CreatedAt,
|
CreatedAt = p27.CreatedAt,
|
||||||
Id = p27.Id
|
Id = p27.Id
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,91 @@
|
||||||
|
using System;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using DocuMed.Domain.Dtos.SmallDtos;
|
||||||
|
using DocuMed.Domain.Entities.Patients;
|
||||||
|
|
||||||
namespace DocuMed.Domain.Mappers
|
namespace DocuMed.Domain.Mappers
|
||||||
{
|
{
|
||||||
public static partial class PatientMapper
|
public static partial class PatientMapper
|
||||||
{
|
{
|
||||||
|
public static Patient AdaptToPatient(this PatientSDto p1)
|
||||||
|
{
|
||||||
|
return p1 == null ? null : new Patient()
|
||||||
|
{
|
||||||
|
UnitNumber = p1.UnitNumber,
|
||||||
|
Room = p1.Room,
|
||||||
|
Bed = p1.Bed,
|
||||||
|
AdmissionAt = p1.AdmissionAt,
|
||||||
|
SectionId = p1.SectionId,
|
||||||
|
Id = p1.Id
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public static Patient AdaptTo(this PatientSDto p2, Patient p3)
|
||||||
|
{
|
||||||
|
if (p2 == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Patient result = p3 ?? new Patient();
|
||||||
|
|
||||||
|
result.UnitNumber = p2.UnitNumber;
|
||||||
|
result.Room = p2.Room;
|
||||||
|
result.Bed = p2.Bed;
|
||||||
|
result.AdmissionAt = p2.AdmissionAt;
|
||||||
|
result.SectionId = p2.SectionId;
|
||||||
|
result.Id = p2.Id;
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
public static Expression<Func<PatientSDto, Patient>> ProjectToPatient => p4 => new Patient()
|
||||||
|
{
|
||||||
|
UnitNumber = p4.UnitNumber,
|
||||||
|
Room = p4.Room,
|
||||||
|
Bed = p4.Bed,
|
||||||
|
AdmissionAt = p4.AdmissionAt,
|
||||||
|
SectionId = p4.SectionId,
|
||||||
|
Id = p4.Id
|
||||||
|
};
|
||||||
|
public static PatientSDto AdaptToSDto(this Patient p5)
|
||||||
|
{
|
||||||
|
return p5 == null ? null : new PatientSDto()
|
||||||
|
{
|
||||||
|
UnitNumber = p5.UnitNumber,
|
||||||
|
Room = p5.Room,
|
||||||
|
Bed = p5.Bed,
|
||||||
|
AdmissionAt = p5.AdmissionAt,
|
||||||
|
SectionId = p5.SectionId,
|
||||||
|
SectionName = p5.Section == null ? null : p5.Section.Name,
|
||||||
|
Id = p5.Id
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public static PatientSDto AdaptTo(this Patient p6, PatientSDto p7)
|
||||||
|
{
|
||||||
|
if (p6 == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
PatientSDto result = p7 ?? new PatientSDto();
|
||||||
|
|
||||||
|
result.UnitNumber = p6.UnitNumber;
|
||||||
|
result.Room = p6.Room;
|
||||||
|
result.Bed = p6.Bed;
|
||||||
|
result.AdmissionAt = p6.AdmissionAt;
|
||||||
|
result.SectionId = p6.SectionId;
|
||||||
|
result.SectionName = p6.Section == null ? null : p6.Section.Name;
|
||||||
|
result.Id = p6.Id;
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
public static Expression<Func<Patient, PatientSDto>> ProjectToSDto => p8 => new PatientSDto()
|
||||||
|
{
|
||||||
|
UnitNumber = p8.UnitNumber,
|
||||||
|
Room = p8.Room,
|
||||||
|
Bed = p8.Bed,
|
||||||
|
HospitalId = p8.HospitalId,
|
||||||
|
AdmissionAt = p8.AdmissionAt,
|
||||||
|
SectionId = p8.SectionId,
|
||||||
|
SectionName = p8.Section.Name,
|
||||||
|
Id = p8.Id
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,4 +5,5 @@ public static class Refers
|
||||||
public const int SizeS = 10;
|
public const int SizeS = 10;
|
||||||
public const int SizeM = 15;
|
public const int SizeM = 15;
|
||||||
public const int SizeL = 20;
|
public const int SizeL = 20;
|
||||||
|
public const int MaxSize = 25;
|
||||||
}
|
}
|
|
@ -1,13 +1,13 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Refit" Version="7.2.1" />
|
<PackageReference Include="Refit" Version="8.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<Exec Command="npm run buildcss" />
|
<Exec Command="npm run buildcss" />
|
||||||
</Target>
|
</Target>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
||||||
|
@ -13,15 +13,15 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
|
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
|
||||||
<PackageReference Include="Blazorise.LottieAnimation" Version="1.6.1" />
|
<PackageReference Include="Blazorise.LottieAnimation" Version="1.7.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" PrivateAssets="all" />
|
||||||
<PackageReference Include="MudBlazor" Version="6.13.0" />
|
<PackageReference Include="MudBlazor" Version="6.13.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Refit" Version="7.2.1" />
|
<PackageReference Include="Refit" Version="8.0.0" />
|
||||||
<PackageReference Include="Refit.HttpClientFactory" Version="7.2.1" />
|
<PackageReference Include="Refit.HttpClientFactory" Version="8.0.0" />
|
||||||
<PackageReference Include="Refit.Newtonsoft.Json" Version="7.2.1" />
|
<PackageReference Include="Refit.Newtonsoft.Json" Version="8.0.0" />
|
||||||
<PackageReference Include="Toolbelt.Blazor.PWA.Updater" Version="2.1.0.1" />
|
<PackageReference Include="Toolbelt.Blazor.PWA.Updater" Version="3.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -15,4 +15,5 @@ public static class Address
|
||||||
public static string UserController = $"{BaseAddress}/user";
|
public static string UserController = $"{BaseAddress}/user";
|
||||||
public static string MedicalHistoryTemplateController = $"{BaseAddress}/medicalhistory/template";
|
public static string MedicalHistoryTemplateController = $"{BaseAddress}/medicalhistory/template";
|
||||||
public static string MedicalHistoryController = $"{BaseAddress}/medicalhistory";
|
public static string MedicalHistoryController = $"{BaseAddress}/medicalhistory";
|
||||||
|
public static string PatientController = $"{BaseAddress}/patient";
|
||||||
}
|
}
|
|
@ -5,17 +5,55 @@
|
||||||
<p class="text-center text-md">شرح حال بیمار را در مراحل مختلف و اطلاعات را با دقت وارد نمایید ، در مرحله اخر میتوانید شرحال کامل را مشاهده کنید
|
<p class="text-center text-md">شرح حال بیمار را در مراحل مختلف و اطلاعات را با دقت وارد نمایید ، در مرحله اخر میتوانید شرحال کامل را مشاهده کنید
|
||||||
</p>
|
</p>
|
||||||
<BasePartDivider Index="1" Title="شکایت اصلی بیمار" />
|
<BasePartDivider Index="1" Title="شکایت اصلی بیمار" />
|
||||||
|
|
||||||
<MudForm>
|
<MudForm>
|
||||||
<MudFocusTrap>
|
<MudFocusTrap>
|
||||||
<MudTextField Required="true" RequiredError="نام بیمار خود را وارد کنید" Value="@PatientFirstName" ValueChanged="async detail => { PatientFirstName = detail; await PatientFirstNameChanged.InvokeAsync(detail); }"
|
<MudAutocomplete Value="@SelectedPatient"
|
||||||
T="string" Label="نام بیمار" Variant="Variant.Outlined" class="text-sm my-5" />
|
CoerceValue="true"
|
||||||
<MudTextField Required="true" RequiredError="نام خانوادگی بیمار خود را وارد کنید" Value="@PatientLastName" ValueChanged="async detail => { PatientLastName = detail; await PatientLastNameChanged.InvokeAsync(detail); }"
|
class="text-sm my-5"
|
||||||
T="string" Label="نام خانوادگی بیمار" Variant="Variant.Outlined" class="text-sm my-5" />
|
ToStringFunc="dto => dto.FullName"
|
||||||
<MudNumericField Required="true" RequiredError="سن بیمار خود را وارد کنید" Value="@PatientAge"
|
SearchFunc="@SearchPatients"
|
||||||
|
ValueChanged="async dto => { SelectedPatient = dto; }"
|
||||||
|
T="PatientSDto"
|
||||||
|
Label="کد ملی بیمار"
|
||||||
|
Variant="Variant.Outlined">
|
||||||
|
<ProgressIndicatorInPopoverTemplate>
|
||||||
|
<MudList Clickable="false">
|
||||||
|
<MudListItem>
|
||||||
|
<div class="flex flex-row w-full mx-auto">
|
||||||
|
<MudProgressCircular class="my-auto mr-1 -ml-4" Size="Size.Small" Indeterminate="true"/>
|
||||||
|
<p class="font-bold my-1 mx-auto text-md">منتظر بمانید</p>
|
||||||
|
</div>
|
||||||
|
</MudListItem>
|
||||||
|
</MudList>
|
||||||
|
</ProgressIndicatorInPopoverTemplate>
|
||||||
|
<ItemTemplate Context="e">
|
||||||
|
<p>@e.FullName</p>
|
||||||
|
</ItemTemplate>
|
||||||
|
</MudAutocomplete>
|
||||||
|
|
||||||
|
<MudTextField Required="true" RequiredError="نام بیمار خود را وارد کنید" Value="@PatientFirstName"
|
||||||
|
ValueChanged="async detail => { PatientFirstName = detail; await PatientFirstNameChanged.InvokeAsync(detail); }"
|
||||||
|
T="string" Label="نام بیمار"
|
||||||
|
Variant="Variant.Outlined"
|
||||||
|
class="text-sm my-5"/>
|
||||||
|
|
||||||
|
<MudTextField Required="true"
|
||||||
|
RequiredError="نام خانوادگی بیمار خود را وارد کنید"
|
||||||
|
Value="@PatientLastName"
|
||||||
|
ValueChanged="async detail => { PatientLastName = detail; await PatientLastNameChanged.InvokeAsync(detail); }"
|
||||||
|
T="string"
|
||||||
|
Label="نام خانوادگی بیمار"
|
||||||
|
Variant="Variant.Outlined"
|
||||||
|
class="text-sm my-5"/>
|
||||||
|
|
||||||
|
<MudNumericField Required="true"
|
||||||
|
RequiredError="سن بیمار خود را وارد کنید" Value="@PatientAge"
|
||||||
ValueChanged="async detail => { PatientAge = detail; await PatientAgeChanged.InvokeAsync(detail); }"
|
ValueChanged="async detail => { PatientAge = detail; await PatientAgeChanged.InvokeAsync(detail); }"
|
||||||
Min="0"
|
Min="0"
|
||||||
T="int" Label="سن بیمار" Variant="Variant.Outlined" />
|
T="int"
|
||||||
|
Label="سن بیمار"
|
||||||
|
Variant="Variant.Outlined"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +66,7 @@
|
||||||
<MudList Clickable="false">
|
<MudList Clickable="false">
|
||||||
<MudListItem>
|
<MudListItem>
|
||||||
<div class="flex flex-row w-full mx-auto">
|
<div class="flex flex-row w-full mx-auto">
|
||||||
<MudProgressCircular class="my-auto mr-1 -ml-4" Size="Size.Small" Indeterminate="true" />
|
<MudProgressCircular class="my-auto mr-1 -ml-4" Size="Size.Small" Indeterminate="true"/>
|
||||||
<p class="font-bold my-1 mx-auto text-md">منتظر بمانید</p>
|
<p class="font-bold my-1 mx-auto text-md">منتظر بمانید</p>
|
||||||
</div>
|
</div>
|
||||||
</MudListItem>
|
</MudListItem>
|
||||||
|
@ -40,20 +78,22 @@
|
||||||
</MudAutocomplete>
|
</MudAutocomplete>
|
||||||
|
|
||||||
<MudTextField Required="true" RequiredError="شکایت اصلی بیمار را وارد کنید" Value="@ChiefComplaint" ValueChanged="async detail => { ChiefComplaint = detail; await ChiefComplaintChanged.InvokeAsync(detail); }"
|
<MudTextField Required="true" RequiredError="شکایت اصلی بیمار را وارد کنید" Value="@ChiefComplaint" ValueChanged="async detail => { ChiefComplaint = detail; await ChiefComplaintChanged.InvokeAsync(detail); }"
|
||||||
T="string" Label="شکایت اصلی بیمار" Variant="Variant.Outlined" class="text-sm my-5" />
|
T="string" Label="شکایت اصلی بیمار" Variant="Variant.Outlined" class="text-sm my-5"/>
|
||||||
|
|
||||||
<MudAutocomplete Value="@SelectedTemplate"
|
<MudAutocomplete Value="@SelectedTemplate"
|
||||||
CoerceValue="true"
|
CoerceValue="true"
|
||||||
class="text-sm my-5"
|
class="text-sm my-5"
|
||||||
ToStringFunc="dto => dto.ChiefComplaint"
|
ToStringFunc="dto => dto.ChiefComplaint"
|
||||||
SearchFunc="@SearchTemplates"
|
SearchFunc="@SearchTemplates"
|
||||||
ValueChanged="async dto => { SelectedTemplate = dto; await SelectedTemplateChanged.InvokeAsync(SelectedTemplate); }"
|
ValueChanged="async dto => { SelectedTemplate = dto; await SelectedTemplateChanged.InvokeAsync(SelectedTemplate); }"
|
||||||
T="MedicalHistoryTemplateSDto" Label="انتخاب از پیش نویس ها" Variant="Variant.Outlined">
|
T="MedicalHistoryTemplateSDto"
|
||||||
|
Label="انتخاب از پیش نویس ها"
|
||||||
|
Variant="Variant.Outlined">
|
||||||
<ProgressIndicatorInPopoverTemplate>
|
<ProgressIndicatorInPopoverTemplate>
|
||||||
<MudList Clickable="false">
|
<MudList Clickable="false">
|
||||||
<MudListItem>
|
<MudListItem>
|
||||||
<div class="flex flex-row w-full mx-auto">
|
<div class="flex flex-row w-full mx-auto">
|
||||||
<MudProgressCircular class="my-auto mr-1 -ml-4" Size="Size.Small" Indeterminate="true" />
|
<MudProgressCircular class="my-auto mr-1 -ml-4" Size="Size.Small" Indeterminate="true"/>
|
||||||
<p class="font-bold my-1 mx-auto text-md">منتظر بمانید</p>
|
<p class="font-bold my-1 mx-auto text-md">منتظر بمانید</p>
|
||||||
</div>
|
</div>
|
||||||
</MudListItem>
|
</MudListItem>
|
||||||
|
@ -109,6 +149,10 @@
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public MedicalHistoryTemplateSDto SelectedTemplate { get; set; } = new();
|
public MedicalHistoryTemplateSDto SelectedTemplate { get; set; } = new();
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public PatientSDto SelectedPatient { get; set; } = new();
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public EventCallback<MedicalHistoryTemplateSDto> SelectedTemplateChanged { get; set; }
|
public EventCallback<MedicalHistoryTemplateSDto> SelectedTemplateChanged { get; set; }
|
||||||
|
|
||||||
|
@ -123,6 +167,7 @@
|
||||||
public List<SectionSDto> Sections { get; private set; } = new List<SectionSDto>();
|
public List<SectionSDto> Sections { get; private set; } = new List<SectionSDto>();
|
||||||
|
|
||||||
public List<MedicalHistoryTemplateSDto> Templates { get; private set; } = new List<MedicalHistoryTemplateSDto>();
|
public List<MedicalHistoryTemplateSDto> Templates { get; private set; } = new List<MedicalHistoryTemplateSDto>();
|
||||||
|
public List<PatientSDto> Patients { get; private set; } = new List<PatientSDto>();
|
||||||
|
|
||||||
|
|
||||||
public async Task<IEnumerable<MedicalHistoryTemplateSDto>> SearchTemplates(string template)
|
public async Task<IEnumerable<MedicalHistoryTemplateSDto>> SearchTemplates(string template)
|
||||||
|
@ -149,6 +194,27 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<PatientSDto>> SearchPatients(string name)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var token = await UserUtility.GetBearerTokenAsync();
|
||||||
|
var list = await RestWrapper.PatientRestApi.GetPatientsAsync(token,0,Refers.SizeM,null,name);
|
||||||
|
Patients = list;
|
||||||
|
return Patients;
|
||||||
|
}
|
||||||
|
catch (ApiException ex)
|
||||||
|
{
|
||||||
|
var exe = await ex.GetContentAsAsync<ApiResult>();
|
||||||
|
return Patients;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return Patients;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<IEnumerable<SectionSDto>> SearchSection(string section)
|
public async Task<IEnumerable<SectionSDto>> SearchSection(string section)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
namespace DocuMed.PWA.Services.RestServices;
|
||||||
|
|
||||||
|
public interface IPatientRestApi
|
||||||
|
{
|
||||||
|
[Get("/")]
|
||||||
|
Task<List<PatientSDto>> GetPatientsAsync([Header("Authorization")] string authorization,
|
||||||
|
[Query]int page ,
|
||||||
|
[Query]int? count = null,
|
||||||
|
[Query]string? searchName = null,
|
||||||
|
[Query]string? nationalId = null );
|
||||||
|
}
|
|
@ -11,4 +11,5 @@ public interface IRestWrapper
|
||||||
public ICityRestApi CityRestApi { get; }
|
public ICityRestApi CityRestApi { get; }
|
||||||
public IUserRestApi UserRestApi { get; }
|
public IUserRestApi UserRestApi { get; }
|
||||||
public IMedicalHistoryRestApi MedicalHistoryRestApi { get; }
|
public IMedicalHistoryRestApi MedicalHistoryRestApi { get; }
|
||||||
|
public IPatientRestApi PatientRestApi { get; }
|
||||||
}
|
}
|
|
@ -25,4 +25,5 @@ public class RestWrapper : IRestWrapper
|
||||||
public ICityRestApi CityRestApi => RestService.For<ICityRestApi>(Address.CityController, setting);
|
public ICityRestApi CityRestApi => RestService.For<ICityRestApi>(Address.CityController, setting);
|
||||||
public IUserRestApi UserRestApi => RestService.For<IUserRestApi>(Address.UserController, setting);
|
public IUserRestApi UserRestApi => RestService.For<IUserRestApi>(Address.UserController, setting);
|
||||||
public IMedicalHistoryRestApi MedicalHistoryRestApi => RestService.For<IMedicalHistoryRestApi>(Address.MedicalHistoryController);
|
public IMedicalHistoryRestApi MedicalHistoryRestApi => RestService.For<IMedicalHistoryRestApi>(Address.MedicalHistoryController);
|
||||||
|
public IPatientRestApi PatientRestApi => RestService.For<IPatientRestApi>(Address.PatientController,setting);
|
||||||
}
|
}
|
|
@ -1,26 +1,26 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Pluralize.NET" Version="1.0.2" />
|
<PackageReference Include="Pluralize.NET" Version="1.0.2" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.8" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.2" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.0" />
|
||||||
<PackageReference Include="StackExchange.Redis" Version="2.8.16" />
|
<PackageReference Include="StackExchange.Redis" Version="2.8.24" />
|
||||||
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="10.2.0" />
|
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="10.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -42,10 +42,13 @@
|
||||||
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
||||||
<Using Include="DocuMed.Domain.Entities.MedicalHistory" />
|
<Using Include="DocuMed.Domain.Entities.MedicalHistory" />
|
||||||
<Using Include="DocuMed.Domain.Entities.MedicalHistoryTemplate" />
|
<Using Include="DocuMed.Domain.Entities.MedicalHistoryTemplate" />
|
||||||
|
<Using Include="DocuMed.Domain.Entities.Patients" />
|
||||||
|
<Using Include="DocuMed.Domain.Entities.Staffs" />
|
||||||
<Using Include="DocuMed.Domain.Entities.User" />
|
<Using Include="DocuMed.Domain.Entities.User" />
|
||||||
<Using Include="DocuMed.Domain.Enums" />
|
<Using Include="DocuMed.Domain.Enums" />
|
||||||
<Using Include="DocuMed.Domain.Enums.QueryFilters" />
|
<Using Include="DocuMed.Domain.Enums.QueryFilters" />
|
||||||
<Using Include="DocuMed.Domain.Mappers" />
|
<Using Include="DocuMed.Domain.Mappers" />
|
||||||
|
<Using Include="DocuMed.Domain.Models" />
|
||||||
<Using Include="DocuMed.Domain.Models.Settings" />
|
<Using Include="DocuMed.Domain.Models.Settings" />
|
||||||
<Using Include="DocuMed.Repository.Abstracts" />
|
<Using Include="DocuMed.Repository.Abstracts" />
|
||||||
<Using Include="DocuMed.Repository.Extensions" />
|
<Using Include="DocuMed.Repository.Extensions" />
|
||||||
|
|
|
@ -1,18 +1,70 @@
|
||||||
namespace DocuMed.Repository.Handlers.MedicalHistories;
|
using DocuMed.Domain.Entities.Staffs;
|
||||||
|
|
||||||
public class CreateMedicalHistoryCommandHandler(IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService) : IRequestHandler<CreateMedicalHistoryCommand,Guid>
|
namespace DocuMed.Repository.Handlers.MedicalHistories;
|
||||||
|
|
||||||
|
public class CreateMedicalHistoryCommandHandler(
|
||||||
|
IRepositoryWrapper repositoryWrapper,
|
||||||
|
ICurrentUserService currentUserService,
|
||||||
|
IMediator mediator) : IRequestHandler<CreateMedicalHistoryCommand,Guid>
|
||||||
{
|
{
|
||||||
public async Task<Guid> Handle(CreateMedicalHistoryCommand template, CancellationToken cancellationToken)
|
public async Task<Guid> Handle(CreateMedicalHistoryCommand template, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (!Guid.TryParse(currentUserService.UserId, out Guid userId))
|
if (!Guid.TryParse(currentUserService.UserId, out Guid userId))
|
||||||
throw new AppException("دسترسی غیرمجاز", ApiResultStatusCode.UnAuthorized);
|
throw new AppException("دسترسی غیرمجاز", ApiResultStatusCode.UnAuthorized);
|
||||||
|
|
||||||
var ent = MedicalHistory.Create(template.ChiefComplaint, template.SectionId,
|
var student = await repositoryWrapper.SetRepository<Student>()
|
||||||
template.PresentIllnessDetail, template.PastDiseasesHistoryDetail, template.PastSurgeryHistoryDetail,
|
.TableNoTracking
|
||||||
template.FamilyHistoryDetail, template.AllergyDetail, template.DrugHistoryDetail,
|
.FirstOrDefaultAsync(f => f.UserId == userId, cancellationToken);
|
||||||
template.AddictionHistoryDetail, template.SystemReviewDetail, template.VitalSignDetail, template.GeneralAppearanceDetail,
|
|
||||||
template.SystolicBloodPressure, template.DiastolicBloodPressure, template.PulseRate, template.SPO2,
|
if (student == null)
|
||||||
template.Temperature, userId, template.MedicalHistoryTemplateId);
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "Student not found");
|
||||||
|
|
||||||
|
|
||||||
|
Guid patientId;
|
||||||
|
if (template.PatientId != default)
|
||||||
|
{
|
||||||
|
var patient = await repositoryWrapper.SetRepository<Patient>()
|
||||||
|
.TableNoTracking
|
||||||
|
.FirstOrDefaultAsync(f => f.Id == template.PatientId, cancellationToken);
|
||||||
|
if (patient == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "Patient not found");
|
||||||
|
patientId = patient.Id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var patentCommand = new CreatePatientCommand(template.FirstName,
|
||||||
|
template.LastName,
|
||||||
|
string.Empty,
|
||||||
|
template.NationalId,
|
||||||
|
string.Empty,
|
||||||
|
string.Empty,
|
||||||
|
DateTime.Now,
|
||||||
|
template.SectionId
|
||||||
|
);
|
||||||
|
|
||||||
|
patientId = await mediator.Send(patentCommand, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
var ent = MedicalHistory.Create(template.ChiefComplaint,
|
||||||
|
template.SectionId,
|
||||||
|
template.PresentIllnessDetail,
|
||||||
|
template.PastDiseasesHistoryDetail,
|
||||||
|
template.PastSurgeryHistoryDetail,
|
||||||
|
template.FamilyHistoryDetail,
|
||||||
|
template.AllergyDetail,
|
||||||
|
template.DrugHistoryDetail,
|
||||||
|
template.AddictionHistoryDetail,
|
||||||
|
template.SystemReviewDetail,
|
||||||
|
template.VitalSignDetail,
|
||||||
|
template.GeneralAppearanceDetail,
|
||||||
|
template.SystolicBloodPressure,
|
||||||
|
template.DiastolicBloodPressure,
|
||||||
|
template.PulseRate,
|
||||||
|
template.SPO2,
|
||||||
|
template.Temperature,
|
||||||
|
student.Id,
|
||||||
|
patientId,
|
||||||
|
template.MedicalHistoryTemplateId);
|
||||||
|
|
||||||
foreach (var answer in template.Answers)
|
foreach (var answer in template.Answers)
|
||||||
ent.AddAnswer(answer.Answer, answer.Question, answer.Part, answer.QuestionType);
|
ent.AddAnswer(answer.Answer, answer.Question, answer.Part, answer.QuestionType);
|
||||||
|
|
|
@ -1,22 +1,75 @@
|
||||||
namespace DocuMed.Repository.Handlers.MedicalHistories;
|
using MediatR;
|
||||||
|
|
||||||
public class UpdateMedicalHistoryCommandHandler(IRepositoryWrapper repositoryWrapper, ICurrentUserService currentUserService) : IRequestHandler<UpdateMedicalHistoryCommand, Guid>
|
namespace DocuMed.Repository.Handlers.MedicalHistories;
|
||||||
|
|
||||||
|
public class UpdateMedicalHistoryCommandHandler(IRepositoryWrapper repositoryWrapper,
|
||||||
|
ICurrentUserService currentUserService,
|
||||||
|
IMediator mediator) : IRequestHandler<UpdateMedicalHistoryCommand, Guid>
|
||||||
{
|
{
|
||||||
public async Task<Guid> Handle(UpdateMedicalHistoryCommand template, CancellationToken cancellationToken)
|
public async Task<Guid> Handle(UpdateMedicalHistoryCommand template, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (!Guid.TryParse(currentUserService.UserId, out Guid userId))
|
if (!Guid.TryParse(currentUserService.UserId, out Guid userId))
|
||||||
throw new AppException("دسترسی غیرمجاز", ApiResultStatusCode.UnAuthorized);
|
throw new AppException("دسترسی غیرمجاز", ApiResultStatusCode.UnAuthorized);
|
||||||
|
var student = await repositoryWrapper.SetRepository<Student>()
|
||||||
|
.TableNoTracking
|
||||||
|
.FirstOrDefaultAsync(f => f.UserId == userId, cancellationToken);
|
||||||
|
if (student == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "Student not found");
|
||||||
|
|
||||||
var ent = await repositoryWrapper.SetRepository<MedicalHistory>().TableNoTracking
|
var ent = await repositoryWrapper.SetRepository<MedicalHistory>().TableNoTracking
|
||||||
.FirstOrDefaultAsync(m => m.Id == template.Id, cancellationToken);
|
.FirstOrDefaultAsync(m => m.Id == template.Id, cancellationToken);
|
||||||
if(ent==null)
|
if (ent == null)
|
||||||
throw new AppException("شرح حال پیدا نشد", ApiResultStatusCode.NotFound);
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "شرح حال پیدا نشد");
|
||||||
var newEnt = MedicalHistory.Create(template.ChiefComplaint, template.SectionId,
|
|
||||||
template.PresentIllnessDetail, template.PastDiseasesHistoryDetail, template.PastSurgeryHistoryDetail,
|
if (ent.StudentId != student.Id)
|
||||||
template.FamilyHistoryDetail, template.AllergyDetail, template.DrugHistoryDetail,
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "شرح حال متعلق به دانشجو نیست");
|
||||||
template.AddictionHistoryDetail, template.SystemReviewDetail, template.VitalSignDetail, template.GeneralAppearanceDetail,
|
|
||||||
template.SystolicBloodPressure, template.DiastolicBloodPressure, template.PulseRate, template.SPO2,
|
|
||||||
template.Temperature, template.ApplicationUserId, template.MedicalHistoryTemplateId);
|
Guid patientId;
|
||||||
|
if (template.PatientId != default)
|
||||||
|
{
|
||||||
|
var patient = await repositoryWrapper.SetRepository<Patient>()
|
||||||
|
.TableNoTracking
|
||||||
|
.FirstOrDefaultAsync(f => f.Id == template.PatientId, cancellationToken);
|
||||||
|
if (patient == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "Patient not found");
|
||||||
|
patientId = patient.Id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var patentCommand = new CreatePatientCommand(template.FirstName,
|
||||||
|
template.LastName,
|
||||||
|
string.Empty,
|
||||||
|
template.NationalId,
|
||||||
|
string.Empty,
|
||||||
|
string.Empty,
|
||||||
|
DateTime.Now,
|
||||||
|
template.SectionId
|
||||||
|
);
|
||||||
|
|
||||||
|
patientId = await mediator.Send(patentCommand, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
var newEnt = MedicalHistory.Create(template.ChiefComplaint,
|
||||||
|
template.SectionId,
|
||||||
|
template.PresentIllnessDetail,
|
||||||
|
template.PastDiseasesHistoryDetail,
|
||||||
|
template.PastSurgeryHistoryDetail,
|
||||||
|
template.FamilyHistoryDetail,
|
||||||
|
template.AllergyDetail,
|
||||||
|
template.DrugHistoryDetail,
|
||||||
|
template.AddictionHistoryDetail,
|
||||||
|
template.SystemReviewDetail,
|
||||||
|
template.VitalSignDetail,
|
||||||
|
template.GeneralAppearanceDetail,
|
||||||
|
template.SystolicBloodPressure,
|
||||||
|
template.DiastolicBloodPressure,
|
||||||
|
template.PulseRate,
|
||||||
|
template.SPO2,
|
||||||
|
template.Temperature,
|
||||||
|
student.Id,
|
||||||
|
patientId,
|
||||||
|
template.MedicalHistoryTemplateId);
|
||||||
newEnt.Id = ent.Id;
|
newEnt.Id = ent.Id;
|
||||||
newEnt.CreatedAt = ent.CreatedAt;
|
newEnt.CreatedAt = ent.CreatedAt;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
namespace DocuMed.Repository.Handlers.Patients;
|
||||||
|
|
||||||
|
public class CreatePatientCommandHandler(IRepositoryWrapper repositoryWrapper , UserManager<ApplicationUser> userManager) : IRequestHandler<CreatePatientCommand,Guid>
|
||||||
|
{
|
||||||
|
public async Task<Guid> Handle(CreatePatientCommand request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var user = await userManager.Users.FirstOrDefaultAsync(u => u.NationalId == request.NationalId,
|
||||||
|
cancellationToken);
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
user = new ApplicationUser
|
||||||
|
{
|
||||||
|
UserName = request.NationalId,
|
||||||
|
NationalId = request.NationalId,
|
||||||
|
FirstName = request.FirstName,
|
||||||
|
LastName = request.LastName,
|
||||||
|
SignUpStatus = SignUpStatus.StartSignUp
|
||||||
|
};
|
||||||
|
var result = await userManager.CreateAsync(user);
|
||||||
|
if (!result.Succeeded)
|
||||||
|
throw new AppException(string.Join('|', result.Errors));
|
||||||
|
}
|
||||||
|
var section = await repositoryWrapper.SetRepository<Section>()
|
||||||
|
.TableNoTracking
|
||||||
|
.FirstOrDefaultAsync(f => f.Id == request.SectionId, cancellationToken);
|
||||||
|
if (section == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "Section not found");
|
||||||
|
|
||||||
|
var patient = Patient.Create(
|
||||||
|
request.UnitNumber,
|
||||||
|
request.Room,
|
||||||
|
request.Bed,
|
||||||
|
request.AdmissionAt,
|
||||||
|
request.SectionId,
|
||||||
|
user.Id,
|
||||||
|
section.HospitalId
|
||||||
|
);
|
||||||
|
|
||||||
|
repositoryWrapper.SetRepository<Patient>()
|
||||||
|
.Add(patient);
|
||||||
|
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||||
|
return patient.Id;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
namespace DocuMed.Repository.Handlers.Patients;
|
||||||
|
|
||||||
|
public class GetPatientQueryHandler(IRepositoryWrapper repositoryWrapper,UserManager<ApplicationUser> userManager) : IRequestHandler<GetPatientQuery, PatientSDto>
|
||||||
|
{
|
||||||
|
public async Task<PatientSDto> Handle(GetPatientQuery request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
if (request.Id != null)
|
||||||
|
{
|
||||||
|
var ent = await repositoryWrapper.SetRepository<Patient>()
|
||||||
|
.TableNoTracking
|
||||||
|
.Where(f => f.Id == request.Id)
|
||||||
|
.Select(PatientMapper.ProjectToSDto)
|
||||||
|
.FirstOrDefaultAsync(cancellationToken);
|
||||||
|
if(ent == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "Patient not found");
|
||||||
|
return ent;
|
||||||
|
}
|
||||||
|
else if (request.NationalId != null)
|
||||||
|
{
|
||||||
|
var user = await userManager.Users.FirstOrDefaultAsync(f => f.NationalId == request.NationalId,
|
||||||
|
cancellationToken);
|
||||||
|
if (user == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "User with this national id not found");
|
||||||
|
|
||||||
|
var ent = await repositoryWrapper.SetRepository<Patient>()
|
||||||
|
.TableNoTracking
|
||||||
|
.Where(f => f.UserId == user.Id)
|
||||||
|
.Select(PatientMapper.ProjectToSDto)
|
||||||
|
.FirstOrDefaultAsync(cancellationToken);
|
||||||
|
if (ent == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "Patient not found");
|
||||||
|
return ent;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Request is not correct - NationalId and Id is null");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
namespace DocuMed.Repository.Handlers.Patients;
|
||||||
|
|
||||||
|
public class GetPatientsQueryHandler(IRepositoryWrapper repositoryWrapper,UserManager<ApplicationUser> userManager) : IRequestHandler<GetPatientsQuery,List<PatientSDto>>
|
||||||
|
{
|
||||||
|
public async Task<List<PatientSDto>> Handle(GetPatientsQuery request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var count = request.Count;
|
||||||
|
if(count > Refers.MaxSize)
|
||||||
|
count = Refers.SizeM;
|
||||||
|
var query = repositoryWrapper.SetRepository<Patient>()
|
||||||
|
.TableNoTracking;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(request.SearchName))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
if(!string.IsNullOrEmpty(request.NationalId))
|
||||||
|
{
|
||||||
|
query = from users in userManager.Users
|
||||||
|
join patients in query on users.Id equals patients.UserId
|
||||||
|
where users.NationalId == request.NationalId
|
||||||
|
select patients;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await query
|
||||||
|
.OrderByDescending(x => x.CreatedAt)
|
||||||
|
.Skip(request.Page * count)
|
||||||
|
.Take(count)
|
||||||
|
.Select(PatientMapper.ProjectToSDto)
|
||||||
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
namespace DocuMed.Repository.Handlers.Patients;
|
||||||
|
|
||||||
|
public class UpdatePatientSectionCommandHandler(IRepositoryWrapper repositoryWrapper) : IRequestHandler<UpdatePatientSectionCommand,Guid>
|
||||||
|
{
|
||||||
|
public async Task<Guid> Handle(UpdatePatientSectionCommand request, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var patient = await repositoryWrapper.SetRepository<Patient>()
|
||||||
|
.TableNoTracking
|
||||||
|
.Where(f => f.Id == request.Id)
|
||||||
|
.Select(PatientMapper.ProjectToSDto)
|
||||||
|
.FirstOrDefaultAsync(cancellationToken);
|
||||||
|
|
||||||
|
if (patient == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "Patient not found");
|
||||||
|
|
||||||
|
var section = await repositoryWrapper.SetRepository<Section>()
|
||||||
|
.TableNoTracking
|
||||||
|
.FirstOrDefaultAsync(f => f.Id == request.SectionId, cancellationToken);
|
||||||
|
|
||||||
|
if (section == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "Section not found");
|
||||||
|
|
||||||
|
if(patient.HospitalId != section.HospitalId)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.BadRequest, "Patient and Section hospital is not same");
|
||||||
|
|
||||||
|
var newEnt = Patient.Create(
|
||||||
|
patient.UnitNumber,
|
||||||
|
patient.Room,
|
||||||
|
patient.Bed,
|
||||||
|
patient.AdmissionAt,
|
||||||
|
section.Id,
|
||||||
|
patient.HospitalId,
|
||||||
|
patient.Id);
|
||||||
|
repositoryWrapper.SetRepository<Patient>().Update(newEnt);
|
||||||
|
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||||
|
return newEnt.Id;
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,8 +7,15 @@ public class MedicalHistoryRepository(ApplicationContext dbContext, ICurrentUser
|
||||||
{
|
{
|
||||||
if (!Guid.TryParse(CurrentUserService.UserId, out Guid userId))
|
if (!Guid.TryParse(CurrentUserService.UserId, out Guid userId))
|
||||||
throw new AppException("توکن غیرمجاز", ApiResultStatusCode.UnAuthorized);
|
throw new AppException("توکن غیرمجاز", ApiResultStatusCode.UnAuthorized);
|
||||||
|
|
||||||
|
var student = await dbContext.Set<Student>()
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefaultAsync(f => f.UserId == userId, cancellationToken);
|
||||||
|
if (student == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "Student not found");
|
||||||
|
|
||||||
var list = await TableNoTracking
|
var list = await TableNoTracking
|
||||||
.Where(t => t.ApplicationUserId == userId)
|
.Where(t => t.StudentId == student.Id)
|
||||||
.OrderByDescending(t => t.CreatedAt)
|
.OrderByDescending(t => t.CreatedAt)
|
||||||
.Skip(page * 15)
|
.Skip(page * 15)
|
||||||
.Take(15)
|
.Take(15)
|
||||||
|
@ -21,12 +28,20 @@ public class MedicalHistoryRepository(ApplicationContext dbContext, ICurrentUser
|
||||||
{
|
{
|
||||||
if (!Guid.TryParse(CurrentUserService.UserId, out Guid userId))
|
if (!Guid.TryParse(CurrentUserService.UserId, out Guid userId))
|
||||||
throw new AppException("توکن غیرمجاز", ApiResultStatusCode.UnAuthorized);
|
throw new AppException("توکن غیرمجاز", ApiResultStatusCode.UnAuthorized);
|
||||||
|
|
||||||
|
var student = await dbContext.Set<Student>()
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefaultAsync(f => f.UserId == userId, cancellationToken);
|
||||||
|
if (student == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "Student not found");
|
||||||
|
|
||||||
|
|
||||||
var list = new List<MedicalHistorySDto>();
|
var list = new List<MedicalHistorySDto>();
|
||||||
switch (dayQuery)
|
switch (dayQuery)
|
||||||
{
|
{
|
||||||
case DayQueryFilter.Today:
|
case DayQueryFilter.Today:
|
||||||
list = await TableNoTracking
|
list = await TableNoTracking
|
||||||
.Where(t => t.ApplicationUserId == userId && t.CreatedAt.Date == DateTime.Today)
|
.Where(t => t.StudentId == student.Id && t.CreatedAt.Date == DateTime.Today)
|
||||||
.OrderByDescending(t => t.CreatedAt)
|
.OrderByDescending(t => t.CreatedAt)
|
||||||
.Skip(page * 15)
|
.Skip(page * 15)
|
||||||
.Take(15)
|
.Take(15)
|
||||||
|
@ -35,7 +50,7 @@ public class MedicalHistoryRepository(ApplicationContext dbContext, ICurrentUser
|
||||||
break;
|
break;
|
||||||
case DayQueryFilter.Yesterday:
|
case DayQueryFilter.Yesterday:
|
||||||
list = await TableNoTracking
|
list = await TableNoTracking
|
||||||
.Where(t => t.ApplicationUserId == userId && t.CreatedAt.Date == DateTime.Today.AddDays(-1))
|
.Where(t => t.StudentId == student.Id && t.CreatedAt.Date == DateTime.Today.AddDays(-1))
|
||||||
.OrderByDescending(t => t.CreatedAt)
|
.OrderByDescending(t => t.CreatedAt)
|
||||||
.Skip(page * 15)
|
.Skip(page * 15)
|
||||||
.Take(15)
|
.Take(15)
|
||||||
|
@ -44,7 +59,7 @@ public class MedicalHistoryRepository(ApplicationContext dbContext, ICurrentUser
|
||||||
break;
|
break;
|
||||||
case DayQueryFilter.Week:
|
case DayQueryFilter.Week:
|
||||||
list = await TableNoTracking
|
list = await TableNoTracking
|
||||||
.Where(t => t.ApplicationUserId == userId && t.CreatedAt.Date >= DateTime.Today.AddDays(-7) )
|
.Where(t => t.StudentId == student.Id && t.CreatedAt.Date >= DateTime.Today.AddDays(-7) )
|
||||||
.OrderByDescending(t => t.CreatedAt)
|
.OrderByDescending(t => t.CreatedAt)
|
||||||
.Skip(page * 15)
|
.Skip(page * 15)
|
||||||
.Take(15)
|
.Take(15)
|
||||||
|
|
|
@ -7,8 +7,15 @@ public class MedicalHistoryTemplateRepository(ApplicationContext dbContext, ICur
|
||||||
{
|
{
|
||||||
if (!Guid.TryParse(CurrentUserService.UserId, out Guid userId))
|
if (!Guid.TryParse(CurrentUserService.UserId, out Guid userId))
|
||||||
throw new AppException("توکن غیرمجاز", ApiResultStatusCode.UnAuthorized);
|
throw new AppException("توکن غیرمجاز", ApiResultStatusCode.UnAuthorized);
|
||||||
|
|
||||||
|
var student = await dbContext.Set<Student>()
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefaultAsync(f => f.UserId == userId, cancellationToken);
|
||||||
|
if (student == null)
|
||||||
|
throw new BaseApiException(ApiResultStatusCode.NotFound, "Student not found");
|
||||||
|
|
||||||
var list = await TableNoTracking
|
var list = await TableNoTracking
|
||||||
.Where(t => t.ApplicationUserId == userId)
|
.Where(t => t.StudentId == student.Id)
|
||||||
.OrderByDescending(t => t.CreatedAt)
|
.OrderByDescending(t => t.CreatedAt)
|
||||||
.Skip(page * 15)
|
.Skip(page * 15)
|
||||||
.Take(15)
|
.Take(15)
|
||||||
|
|
Loading…
Reference in New Issue