Compare commits
2 Commits
b3ca3c51ea
...
ab56bf3c20
Author | SHA1 | Date |
---|---|---|
|
ab56bf3c20 | |
|
1a813edf6a |
|
@ -13,7 +13,7 @@
|
|||
},
|
||||
"SiteSettings": {
|
||||
"KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B",
|
||||
"BaseUrl": "http://localhost:32769",
|
||||
"BaseUrl": "http://localhost:32780",
|
||||
"UserSetting": {
|
||||
"Username": "Root",
|
||||
"Email": "info@brizco.io",
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -30,32 +32,32 @@ public class HospitalController : ICarterModule
|
|||
}
|
||||
|
||||
// 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));
|
||||
}
|
||||
|
||||
// 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));
|
||||
}
|
||||
|
||||
// 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
|
||||
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
|
||||
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);
|
||||
repositoryWrapper.SetRepository<MedicalHistory>().Delete(ent);
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
using DocuMed.Domain.CommandQueries.Queries;
|
||||
using DocuMed.Domain.Models;
|
||||
using MediatR;
|
||||
|
||||
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,109 +1,111 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||
<AssemblyVersion>1.3.2.1</AssemblyVersion>
|
||||
<FileVersion>1.3.2.1</FileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||
<AssemblyVersion>1.3.2.1</AssemblyVersion>
|
||||
<FileVersion>1.3.2.1</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Asp.Versioning.Http" Version="8.1.0" />
|
||||
<PackageReference Include="Ben.BlockingDetector" Version="0.0.4" />
|
||||
<PackageReference Include="Carter" Version="8.2.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Autofac" Version="8.1.0" />
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
|
||||
<PackageReference Include="Elmah.Io.AspNetCore.Serilog" Version="5.1.23" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.5" />
|
||||
<PackageReference Include="Sentry.Serilog" Version="4.11.0" />
|
||||
<PackageReference Include="Serilog" Version="4.0.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.2" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.PostgreSQL" Version="2.3.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Seq" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.ElmahIo" Version="5.1.43" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.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.Newtonsoft" Version="10.2.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.8.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Asp.Versioning.Http" Version="8.1.0" />
|
||||
<PackageReference Include="Ben.BlockingDetector" Version="0.0.4" />
|
||||
<PackageReference Include="Carter" Version="8.2.1" />
|
||||
<PackageReference Include="MediatR.Extensions.Autofac.DependencyInjection" Version="12.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Autofac" Version="8.2.0" />
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
|
||||
<PackageReference Include="Elmah.Io.AspNetCore.Serilog" Version="5.1.23" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.5" />
|
||||
<PackageReference Include="Sentry.Serilog" Version="4.11.0" />
|
||||
<PackageReference Include="Serilog" Version="4.0.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.2" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.PostgreSQL" Version="2.3.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Seq" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.ElmahIo" Version="5.1.43" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.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.Newtonsoft" Version="10.2.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.8.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DocuMed.Infrastructure\DocuMed.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DocuMed.Infrastructure\DocuMed.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Autofac" />
|
||||
<Using Include="Autofac.Extensions.DependencyInjection" />
|
||||
<Using Include="Carter" />
|
||||
<Using Include="DocuMed.Api.WebFramework.Bases" />
|
||||
<Using Include="DocuMed.Api.WebFramework.Configurations" />
|
||||
<Using Include="DocuMed.Api.WebFramework.Swagger" />
|
||||
<Using Include="DocuMed.Common.Extensions" />
|
||||
<Using Include="DocuMed.Common.Models" />
|
||||
<Using Include="DocuMed.Common.Models.Api" />
|
||||
<Using Include="DocuMed.Common.Models.Entity" />
|
||||
<Using Include="DocuMed.Common.Models.Exception" />
|
||||
<Using Include="DocuMed.Common.Models.Mapper" />
|
||||
<Using Include="DocuMed.Core" />
|
||||
<Using Include="DocuMed.Core.CoreServices.Abstracts" />
|
||||
<Using Include="DocuMed.Core.EntityServices.Abstracts" />
|
||||
<Using Include="DocuMed.Core.Models.Api" />
|
||||
<Using Include="DocuMed.Domain" />
|
||||
<Using Include="DocuMed.Domain.Dtos.LargDtos" />
|
||||
<Using Include="DocuMed.Domain.Dtos.RequestDtos" />
|
||||
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
||||
<Using Include="DocuMed.Domain.Entities.City" />
|
||||
<Using Include="DocuMed.Domain.Entities.MedicalHistoryTemplate" />
|
||||
<Using Include="DocuMed.Domain.Entities.User" />
|
||||
<Using Include="DocuMed.Domain.Enums.QueryFilters" />
|
||||
<Using Include="DocuMed.Domain.Mappers" />
|
||||
<Using Include="DocuMed.Domain.Models.Settings" />
|
||||
<Using Include="DocuMed.Infrastructure" />
|
||||
<Using Include="DocuMed.Infrastructure.Models" />
|
||||
<Using Include="DocuMed.Repository" />
|
||||
<Using Include="DocuMed.Repository.Abstracts" />
|
||||
<Using Include="DocuMed.Repository.Extensions" />
|
||||
<Using Include="DocuMed.Repository.Models" />
|
||||
<Using Include="DocuMed.Repository.Repositories.Base.Contracts" />
|
||||
<Using Include="DocuMed.Repository.Repositories.Entities.Abstracts" />
|
||||
<Using Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
|
||||
<Using Include="Microsoft.AspNetCore.Identity" />
|
||||
<Using Include="Microsoft.AspNetCore.Mvc" />
|
||||
<Using Include="Microsoft.AspNetCore.Mvc.Filters" />
|
||||
<Using Include="Microsoft.EntityFrameworkCore" />
|
||||
<Using Include="Microsoft.Extensions.Options" />
|
||||
<Using Include="Serilog" />
|
||||
<Using Include="Serilog.Events" />
|
||||
<Using Include="Serilog.Sinks.SystemConsole.Themes" />
|
||||
<Using Include="System.Security.Claims" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Using Include="Autofac" />
|
||||
<Using Include="Autofac.Extensions.DependencyInjection" />
|
||||
<Using Include="Carter" />
|
||||
<Using Include="DocuMed.Api.WebFramework.Bases" />
|
||||
<Using Include="DocuMed.Api.WebFramework.Configurations" />
|
||||
<Using Include="DocuMed.Api.WebFramework.Swagger" />
|
||||
<Using Include="DocuMed.Common.Extensions" />
|
||||
<Using Include="DocuMed.Common.Models" />
|
||||
<Using Include="DocuMed.Common.Models.Api" />
|
||||
<Using Include="DocuMed.Common.Models.Entity" />
|
||||
<Using Include="DocuMed.Common.Models.Exception" />
|
||||
<Using Include="DocuMed.Common.Models.Mapper" />
|
||||
<Using Include="DocuMed.Core" />
|
||||
<Using Include="DocuMed.Core.CoreServices.Abstracts" />
|
||||
<Using Include="DocuMed.Core.EntityServices.Abstracts" />
|
||||
<Using Include="DocuMed.Core.Models.Api" />
|
||||
<Using Include="DocuMed.Domain" />
|
||||
<Using Include="DocuMed.Domain.Dtos.LargDtos" />
|
||||
<Using Include="DocuMed.Domain.Dtos.RequestDtos" />
|
||||
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
||||
<Using Include="DocuMed.Domain.Entities.City" />
|
||||
<Using Include="DocuMed.Domain.Entities.MedicalHistoryTemplate" />
|
||||
<Using Include="DocuMed.Domain.Entities.User" />
|
||||
<Using Include="DocuMed.Domain.Enums.QueryFilters" />
|
||||
<Using Include="DocuMed.Domain.Mappers" />
|
||||
<Using Include="DocuMed.Domain.Models.Settings" />
|
||||
<Using Include="DocuMed.Infrastructure" />
|
||||
<Using Include="DocuMed.Infrastructure.Models" />
|
||||
<Using Include="DocuMed.Repository" />
|
||||
<Using Include="DocuMed.Repository.Abstracts" />
|
||||
<Using Include="DocuMed.Repository.Extensions" />
|
||||
<Using Include="DocuMed.Repository.Models" />
|
||||
<Using Include="DocuMed.Repository.Repositories.Base.Contracts" />
|
||||
<Using Include="DocuMed.Repository.Repositories.Entities.Abstracts" />
|
||||
<Using Include="MediatR.Extensions.Autofac.DependencyInjection" />
|
||||
<Using Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
|
||||
<Using Include="Microsoft.AspNetCore.Identity" />
|
||||
<Using Include="Microsoft.AspNetCore.Mvc" />
|
||||
<Using Include="Microsoft.AspNetCore.Mvc.Filters" />
|
||||
<Using Include="Microsoft.EntityFrameworkCore" />
|
||||
<Using Include="Microsoft.Extensions.Options" />
|
||||
<Using Include="Serilog" />
|
||||
<Using Include="Serilog.Events" />
|
||||
<Using Include="Serilog.Sinks.SystemConsole.Themes" />
|
||||
<Using Include="System.Security.Claims" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using DocuMed.Api.WebFramework.MiddleWares;
|
||||
using DocuMed.Repository.Behaviors;
|
||||
using MediatR.Extensions.Autofac.DependencyInjection.Builder;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
|
||||
|
@ -65,6 +67,24 @@ builder.Host.ConfigureContainer<ContainerBuilder>(builder =>
|
|||
.AssignableTo<IScopedDependency>()
|
||||
.AsImplementedInterfaces()
|
||||
.InstancePerLifetimeScope();
|
||||
|
||||
builder.RegisterMediatR(MediatRConfigurationBuilder
|
||||
.Create(typeof(RepositoryConfig).Assembly)
|
||||
.WithCustomPipelineBehavior(typeof(ValidationBehavior<,>))
|
||||
.WithAllOpenGenericHandlerTypesRegistered()
|
||||
.Build());
|
||||
|
||||
builder.RegisterMediatR(MediatRConfigurationBuilder
|
||||
.Create(typeof(CoreConfig).Assembly)
|
||||
.WithCustomPipelineBehavior(typeof(ValidationBehavior<,>))
|
||||
.WithAllOpenGenericHandlerTypesRegistered()
|
||||
.Build());
|
||||
|
||||
builder.RegisterMediatR(MediatRConfigurationBuilder
|
||||
.Create(typeof(DomainConfig).Assembly)
|
||||
.WithCustomPipelineBehavior(typeof(ValidationBehavior<,>))
|
||||
.WithAllOpenGenericHandlerTypesRegistered()
|
||||
.Build());
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"Docker": {
|
||||
"commandName": "Docker",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger/v1",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_URLS": "http://+:80"
|
||||
},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<!--<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
@ -11,9 +11,9 @@
|
|||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.3" />
|
||||
</ItemGroup>
|
||||
</ItemGroup>-->
|
||||
|
||||
<!--<PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.1.0" />
|
||||
</ItemGroup>-->
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="MD.PersianDateTime.Standard" />
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
namespace DocuMed.Common.Models.Exception;
|
||||
|
||||
public class ValidationException : System.Exception
|
||||
{
|
||||
public ValidationException() : base("Validation has been failed")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ValidationException(params ValidationError[] validationErrors) : base($"{string.Join(",", validationErrors.Select(v => v.ErrorMessage))}")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ValidationException(List<ValidationError> validationErrors) : base($"{string.Join(",", validationErrors.Select(v => v.ErrorMessage))}")
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
public sealed record ValidationError(string PropertyName, string ErrorMessage);
|
|
@ -114,7 +114,9 @@ public class AccountService(
|
|||
.FirstOrDefaultAsync(f => f.UserId == user.Id, cancellationToken);
|
||||
if (student == null)
|
||||
{
|
||||
student = Student.Create(requestDto.UniversityId,requestDto.SectionId,user.Id);
|
||||
student = Student.Create(requestDto.UniversityId, user.Id);
|
||||
if (requestDto.SectionId != default)
|
||||
student.SetSection(requestDto.SectionId);
|
||||
repositoryWrapper.SetRepository<Student>().Add(student);
|
||||
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
}
|
||||
|
@ -126,8 +128,7 @@ public class AccountService(
|
|||
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 student = await repositoryWrapper.SetRepository<Student>().TableNoTracking
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -15,44 +15,44 @@
|
|||
<PackageReference Include="Quartz" Version="3.13.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DocuMed.Repository\DocuMed.Repository.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DocuMed.Repository\DocuMed.Repository.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="BaseServices\Abstracts\" />
|
||||
<Folder Include="CoreServices\Abstracts\" />
|
||||
<Folder Include="Models\Api\" />
|
||||
<Folder Include="Abstracts\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="BaseServices\Abstracts\" />
|
||||
<Folder Include="CoreServices\Abstracts\" />
|
||||
<Folder Include="Models\Api\" />
|
||||
<Folder Include="Abstracts\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="DocuMed.Common.Extensions" />
|
||||
<Using Include="DocuMed.Common.Models" />
|
||||
<Using Include="DocuMed.Common.Models.Api" />
|
||||
<Using Include="DocuMed.Common.Models.Claims" />
|
||||
<Using Include="DocuMed.Common.Models.Exception" />
|
||||
<Using Include="DocuMed.Core.Abstracts" />
|
||||
<Using Include="DocuMed.Core.BaseServices.Abstracts" />
|
||||
<Using Include="DocuMed.Core.CoreServices.Abstracts" />
|
||||
<Using Include="DocuMed.Core.EntityServices.Abstracts" />
|
||||
<Using Include="DocuMed.Domain.Dtos.LargDtos" />
|
||||
<Using Include="DocuMed.Domain.Dtos.RequestDtos" />
|
||||
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
||||
<Using Include="DocuMed.Domain.Entities.MedicalHistory" />
|
||||
<Using Include="DocuMed.Domain.Entities.User" />
|
||||
<Using Include="DocuMed.Domain.Enums" />
|
||||
<Using Include="DocuMed.Domain.Mappers" />
|
||||
<Using Include="DocuMed.Repository.Abstracts" />
|
||||
<Using Include="DocuMed.Repository.Repositories.Base.Contracts" />
|
||||
<Using Include="DocuMed.Repository.Repositories.Entities.Abstracts" />
|
||||
<Using Include="Mapster" />
|
||||
<Using Include="Microsoft.AspNetCore.Identity" />
|
||||
<Using Include="Microsoft.AspNetCore.Mvc" />
|
||||
<Using Include="Microsoft.EntityFrameworkCore" />
|
||||
<Using Include="Microsoft.IdentityModel.Tokens" />
|
||||
<Using Include="Newtonsoft.Json" />
|
||||
<Using Include="System.Security.Claims" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Using Include="DocuMed.Common.Extensions" />
|
||||
<Using Include="DocuMed.Common.Models" />
|
||||
<Using Include="DocuMed.Common.Models.Api" />
|
||||
<Using Include="DocuMed.Common.Models.Claims" />
|
||||
<Using Include="DocuMed.Common.Models.Exception" />
|
||||
<Using Include="DocuMed.Core.Abstracts" />
|
||||
<Using Include="DocuMed.Core.BaseServices.Abstracts" />
|
||||
<Using Include="DocuMed.Core.CoreServices.Abstracts" />
|
||||
<Using Include="DocuMed.Core.EntityServices.Abstracts" />
|
||||
<Using Include="DocuMed.Domain.Dtos.LargDtos" />
|
||||
<Using Include="DocuMed.Domain.Dtos.RequestDtos" />
|
||||
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
||||
<Using Include="DocuMed.Domain.Entities.MedicalHistory" />
|
||||
<Using Include="DocuMed.Domain.Entities.User" />
|
||||
<Using Include="DocuMed.Domain.Enums" />
|
||||
<Using Include="DocuMed.Domain.Mappers" />
|
||||
<Using Include="DocuMed.Repository.Abstracts" />
|
||||
<Using Include="DocuMed.Repository.Repositories.Base.Contracts" />
|
||||
<Using Include="DocuMed.Repository.Repositories.Entities.Abstracts" />
|
||||
<Using Include="Mapster" />
|
||||
<Using Include="Microsoft.AspNetCore.Identity" />
|
||||
<Using Include="Microsoft.AspNetCore.Mvc" />
|
||||
<Using Include="Microsoft.EntityFrameworkCore" />
|
||||
<Using Include="Microsoft.IdentityModel.Tokens" />
|
||||
<Using Include="Newtonsoft.Json" />
|
||||
<Using Include="System.Security.Claims" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -8,6 +8,7 @@ public sealed record CreateMedicalHistoryCommand(
|
|||
string FatherName,
|
||||
string NationalId,
|
||||
DateTime BirthDate,
|
||||
Guid PatientId,
|
||||
string PresentIllnessDetail,
|
||||
string PastDiseasesHistoryDetail,
|
||||
string PastSurgeryHistoryDetail,
|
||||
|
@ -23,7 +24,6 @@ public sealed record CreateMedicalHistoryCommand(
|
|||
double PulseRate,
|
||||
double SPO2,
|
||||
double Temperature,
|
||||
Guid ApplicationUserId,
|
||||
Guid MedicalHistoryTemplateId,
|
||||
List<MedicalHistoryAnswerSDto> Answers) : IRequest<Guid>;
|
||||
|
||||
|
@ -36,6 +36,7 @@ public sealed record UpdateMedicalHistoryCommand(
|
|||
string FatherName,
|
||||
string NationalId,
|
||||
DateTime BirthDate,
|
||||
Guid PatientId,
|
||||
string PresentIllnessDetail,
|
||||
string PastDiseasesHistoryDetail,
|
||||
string PastSurgeryHistoryDetail,
|
||||
|
@ -51,7 +52,6 @@ public sealed record UpdateMedicalHistoryCommand(
|
|||
double PulseRate,
|
||||
double SPO2,
|
||||
double Temperature,
|
||||
Guid ApplicationUserId,
|
||||
Guid MedicalHistoryTemplateId,
|
||||
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,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--<PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
@ -11,10 +11,10 @@
|
|||
<PackageReference Include="MediatR" Version="12.4.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="8.0.8" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
|
||||
</ItemGroup>-->
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<!--<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<PackageReference Include="MediatR" Version="12.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="5.0.0" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
|
||||
</ItemGroup>
|
||||
</ItemGroup>-->
|
||||
|
||||
|
||||
<Target Name="Mapster">
|
||||
|
@ -37,37 +37,38 @@
|
|||
<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet mapster mapper -a "$(TargetDir)$(ProjectName).dll" -n DocuMed.Domain.Mappers -o Mappers" />
|
||||
</Target>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DocuMed.Common\DocuMed.Common.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DocuMed.Common\DocuMed.Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Dtos\ResponseDtos\" />
|
||||
<Folder Include="Dtos\RequestDtos\" />
|
||||
<Folder Include="Entities\City\" />
|
||||
<Folder Include="Entities\Patients\" />
|
||||
<Folder Include="Entities\User\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Dtos\ResponseDtos\" />
|
||||
<Folder Include="Dtos\RequestDtos\" />
|
||||
<Folder Include="Entities\City\" />
|
||||
<Folder Include="Entities\Patients\" />
|
||||
<Folder Include="Entities\User\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include=" DocuMed.Domain.Entities.MedicalHistoryTemplate" />
|
||||
<Using Include="DocuMed.Common.Models.Entity" />
|
||||
<Using Include="DocuMed.Common.Models.Mapper" />
|
||||
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
||||
<Using Include="DocuMed.Domain.Entities.City" />
|
||||
<Using Include="DocuMed.Domain.Entities.Hospitals" />
|
||||
<Using Include="DocuMed.Domain.Entities.MedicalHistory" />
|
||||
<Using Include="DocuMed.Domain.Entities.Staffs" />
|
||||
<Using Include="DocuMed.Domain.Entities.User" />
|
||||
<Using Include="DocuMed.Domain.Enums" />
|
||||
<Using Include="DocuMed.Domain.Models" />
|
||||
<Using Include="Mapster" />
|
||||
<Using Include="MD.PersianDateTime.Standard" />
|
||||
<Using Include="MediatR" />
|
||||
<Using Include="Microsoft.AspNetCore.Identity" />
|
||||
<Using Include="Newtonsoft.Json" />
|
||||
<Using Include="System.ComponentModel.DataAnnotations" />
|
||||
<Using Include="System.Numerics" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Using Include=" DocuMed.Domain.Entities.MedicalHistoryTemplate" />
|
||||
<Using Include="DocuMed.Common.Models.Entity" />
|
||||
<Using Include="DocuMed.Common.Models.Mapper" />
|
||||
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
||||
<Using Include="DocuMed.Domain.Entities.City" />
|
||||
<Using Include="DocuMed.Domain.Entities.Hospitals" />
|
||||
<Using Include="DocuMed.Domain.Entities.MedicalHistory" />
|
||||
<Using Include="DocuMed.Domain.Entities.Patients" />
|
||||
<Using Include="DocuMed.Domain.Entities.Staffs" />
|
||||
<Using Include="DocuMed.Domain.Entities.User" />
|
||||
<Using Include="DocuMed.Domain.Enums" />
|
||||
<Using Include="DocuMed.Domain.Models" />
|
||||
<Using Include="Mapster" />
|
||||
<Using Include="MD.PersianDateTime.Standard" />
|
||||
<Using Include="MediatR" />
|
||||
<Using Include="Microsoft.AspNetCore.Identity" />
|
||||
<Using Include="Newtonsoft.Json" />
|
||||
<Using Include="System.ComponentModel.DataAnnotations" />
|
||||
<Using Include="System.Numerics" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
using DocuMed.Domain.Entities.Patients;
|
||||
|
||||
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;
|
||||
}
|
|
@ -7,7 +7,7 @@ public class StudentSDto : BaseDto<StudentSDto,Student>
|
|||
public Guid UniversityId { get; set; }
|
||||
public string UniversityName { get; set; } = string.Empty;
|
||||
|
||||
public Guid SectionId { get; set; }
|
||||
public Guid? SectionId { get; set; }
|
||||
public string SectionName { get; set; } = string.Empty;
|
||||
|
||||
public Guid UserId { get; set; }
|
||||
|
|
|
@ -21,6 +21,4 @@ public partial class University : ApiEntity
|
|||
|
||||
public Guid CityId { get; internal set; }
|
||||
public City? City { get; internal set; }
|
||||
|
||||
public List<Hospitals.Section> Sections { get; internal set; } = new();
|
||||
}
|
|
@ -41,7 +41,8 @@ public partial class MedicalHistory
|
|||
double pulseRate,
|
||||
double sPO2,
|
||||
double temperature,
|
||||
Guid applicationUserId,
|
||||
Guid studentId,
|
||||
Guid patientId,
|
||||
Guid medicalHistoryTemplateId)
|
||||
{
|
||||
var code = StringExtensions.GetIntId(6);
|
||||
|
@ -63,7 +64,8 @@ public partial class MedicalHistory
|
|||
sPO2,
|
||||
temperature,
|
||||
code,
|
||||
applicationUserId,
|
||||
studentId,
|
||||
patientId,
|
||||
medicalHistoryTemplateId);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ public partial class MedicalHistory : ApiEntity
|
|||
double spo2,
|
||||
double temperature,
|
||||
string code,
|
||||
Guid applicationUserId,
|
||||
Guid studentId,
|
||||
Guid patientId,
|
||||
Guid medicalHistoryTemplateId)
|
||||
{
|
||||
PresentIllnessDetail = presentIllnessDetail;
|
||||
|
@ -52,7 +53,8 @@ public partial class MedicalHistory : ApiEntity
|
|||
SPO2 = spo2;
|
||||
Temperature = temperature;
|
||||
Code = code;
|
||||
ApplicationUserId = applicationUserId;
|
||||
StudentId = studentId;
|
||||
PatientId = patientId;
|
||||
MedicalHistoryTemplateId = medicalHistoryTemplateId;
|
||||
}
|
||||
public string ChiefComplaint { get; internal set; } = string.Empty;
|
||||
|
@ -79,8 +81,11 @@ public partial class MedicalHistory : ApiEntity
|
|||
public double Temperature { get; internal set; }
|
||||
|
||||
public Guid MedicalHistoryTemplateId { get; internal set; }
|
||||
public Guid ApplicationUserId { get; internal set; }
|
||||
public ApplicationUser? ApplicationUser { get; internal set; }
|
||||
public Guid StudentId { get; internal set; }
|
||||
public Student? Student { get; internal set; }
|
||||
|
||||
public Guid PatientId { get; internal set; }
|
||||
public Patient? Patient { get; internal set; }
|
||||
|
||||
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;
|
||||
SectionId = sectionId;
|
||||
ApplicationUserId = applicationUserId;
|
||||
StudentId = studentId;
|
||||
}
|
||||
|
||||
public string ChiefComplaint { get; internal set; } = string.Empty;
|
||||
public Guid SectionId { get; set; }
|
||||
public Section? Section { get; set; }
|
||||
public Guid ApplicationUserId { get; internal set; }
|
||||
public ApplicationUser? ApplicationUser { get; set; }
|
||||
public Guid StudentId { get; internal set; }
|
||||
public Student? Student { get; set; }
|
||||
public List<MedicalHistoryQuestion> Questions { get; internal set; } = new();
|
||||
}
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
public partial class Patient
|
||||
{
|
||||
public static Patient Create(string unitNumber, string room, string bed, DateTime admissionAt, Guid sectionId, Guid userId)
|
||||
=> new Patient(unitNumber, room, bed, admissionAt, sectionId, 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,hospitalId, userId);
|
||||
}
|
|
@ -11,13 +11,18 @@ 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;
|
||||
Room = room;
|
||||
Bed = bed;
|
||||
AdmissionAt = admissionAt;
|
||||
SectionId = sectionId;
|
||||
HospitalId = hospitalId;
|
||||
UserId = userId;
|
||||
}
|
||||
public string UnitNumber { get; internal set; } = string.Empty;
|
||||
|
@ -28,6 +33,8 @@ public partial class Patient : ApiEntity
|
|||
public Guid SectionId { get; internal set; }
|
||||
public Section? Section { get; internal set; }
|
||||
|
||||
public Guid HospitalId { get; internal set; }
|
||||
|
||||
public Guid UserId { get; internal set; }
|
||||
public ApplicationUser? User { get; internal set; }
|
||||
}
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
public partial class Student
|
||||
{
|
||||
public static Student Create(Guid universityId, Guid sectionId, Guid userId)
|
||||
=> new Student(universityId, sectionId, userId);
|
||||
public static Student Create(Guid universityId, Guid userId)
|
||||
=> new Student(universityId, userId);
|
||||
|
||||
public void SetSection(Guid sectionId)
|
||||
=> SectionId = sectionId;
|
||||
}
|
|
@ -11,10 +11,9 @@ public partial class Student : ApiEntity
|
|||
|
||||
}
|
||||
|
||||
public Student(Guid universityId, Guid sectionId, Guid userId)
|
||||
public Student(Guid universityId, Guid userId)
|
||||
{
|
||||
UniversityId = universityId;
|
||||
SectionId = sectionId;
|
||||
UserId = userId;
|
||||
}
|
||||
|
||||
|
@ -23,7 +22,7 @@ public partial class Student : ApiEntity
|
|||
public Guid UniversityId { get; internal set; }
|
||||
public University? University { get; internal set; }
|
||||
|
||||
public Guid SectionId { get; internal set; }
|
||||
public Guid? SectionId { get; internal set; }
|
||||
public Section? Section { get; internal set; }
|
||||
|
||||
public Guid UserId { 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)]
|
||||
[GenerateMapper]
|
||||
|
@ -13,6 +11,6 @@ public class ApplicationUser : IdentityUser<Guid>
|
|||
public Gender Gender { get; set; }
|
||||
public SignUpStatus SignUpStatus { get; set; }
|
||||
|
||||
public Student? Student { get; set; }
|
||||
public Patient? Patient { get; set; }
|
||||
public List<Student> Students { get; set; } = [];
|
||||
public List<Patient> Patients { get; set; } = [];
|
||||
}
|
||||
|
|
|
@ -71,60 +71,47 @@ namespace DocuMed.Domain.Mappers
|
|||
PhoneNumber = p5.PhoneNumber,
|
||||
PhoneNumberConfirmed = p5.PhoneNumberConfirmed,
|
||||
NationalId = p5.NationalId,
|
||||
StudentId = funcMain1(p5.Student == null ? null : (Guid?)p5.Student.Id),
|
||||
BirthDate = p5.BirthDate,
|
||||
Gender = p5.Gender,
|
||||
SignUpStatus = p5.SignUpStatus,
|
||||
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;
|
||||
}
|
||||
ApplicationUserSDto result = p8 ?? new ApplicationUserSDto();
|
||||
ApplicationUserSDto result = p7 ?? new ApplicationUserSDto();
|
||||
|
||||
result.FirstName = p7.FirstName;
|
||||
result.LastName = p7.LastName;
|
||||
result.UserName = p7.UserName;
|
||||
result.Email = p7.Email;
|
||||
result.PhoneNumber = p7.PhoneNumber;
|
||||
result.PhoneNumberConfirmed = p7.PhoneNumberConfirmed;
|
||||
result.NationalId = p7.NationalId;
|
||||
result.StudentId = funcMain2(p7.Student == null ? null : (Guid?)p7.Student.Id, result.StudentId);
|
||||
result.BirthDate = p7.BirthDate;
|
||||
result.Gender = p7.Gender;
|
||||
result.SignUpStatus = p7.SignUpStatus;
|
||||
result.Id = p7.Id;
|
||||
result.FirstName = p6.FirstName;
|
||||
result.LastName = p6.LastName;
|
||||
result.UserName = p6.UserName;
|
||||
result.Email = p6.Email;
|
||||
result.PhoneNumber = p6.PhoneNumber;
|
||||
result.PhoneNumberConfirmed = p6.PhoneNumberConfirmed;
|
||||
result.NationalId = p6.NationalId;
|
||||
result.BirthDate = p6.BirthDate;
|
||||
result.Gender = p6.Gender;
|
||||
result.SignUpStatus = p6.SignUpStatus;
|
||||
result.Id = p6.Id;
|
||||
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,
|
||||
LastName = p11.LastName,
|
||||
UserName = p11.UserName,
|
||||
Email = p11.Email,
|
||||
PhoneNumber = p11.PhoneNumber,
|
||||
PhoneNumberConfirmed = p11.PhoneNumberConfirmed,
|
||||
NationalId = p11.NationalId,
|
||||
StudentId = p11.Student.Id.ToString(),
|
||||
BirthDate = p11.BirthDate,
|
||||
Gender = p11.Gender,
|
||||
SignUpStatus = p11.SignUpStatus,
|
||||
Id = p11.Id
|
||||
FirstName = p8.FirstName,
|
||||
LastName = p8.LastName,
|
||||
UserName = p8.UserName,
|
||||
Email = p8.Email,
|
||||
PhoneNumber = p8.PhoneNumber,
|
||||
PhoneNumberConfirmed = p8.PhoneNumberConfirmed,
|
||||
NationalId = p8.NationalId,
|
||||
BirthDate = p8.BirthDate,
|
||||
Gender = p8.Gender,
|
||||
SignUpStatus = p8.SignUpStatus,
|
||||
Id = p8.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.Entities.Hospitals;
|
||||
using DocuMed.Domain.Entities.MedicalHistory;
|
||||
using DocuMed.Domain.Entities.User;
|
||||
using Mapster.Models;
|
||||
|
||||
namespace DocuMed.Domain.Mappers
|
||||
|
@ -26,12 +25,6 @@ namespace DocuMed.Domain.Mappers
|
|||
HospitalId = p1.Section.HospitalId,
|
||||
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,
|
||||
PastDiseasesHistoryDetail = p1.PastDiseasesHistoryDetail,
|
||||
PastSurgeryHistoryDetail = p1.PastSurgeryHistoryDetail,
|
||||
|
@ -49,7 +42,6 @@ namespace DocuMed.Domain.Mappers
|
|||
SPO2 = p1.SPO2,
|
||||
Temperature = p1.Temperature,
|
||||
MedicalHistoryTemplateId = p1.MedicalHistoryTemplateId,
|
||||
ApplicationUserId = p1.ApplicationUserId,
|
||||
Answers = funcMain1(p1.Answers),
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
|
@ -66,12 +58,6 @@ namespace DocuMed.Domain.Mappers
|
|||
result.ChiefComplaint = p3.ChiefComplaint;
|
||||
result.SectionId = p3.SectionId;
|
||||
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.PastDiseasesHistoryDetail = p3.PastDiseasesHistoryDetail;
|
||||
result.PastSurgeryHistoryDetail = p3.PastSurgeryHistoryDetail;
|
||||
|
@ -89,7 +75,6 @@ namespace DocuMed.Domain.Mappers
|
|||
result.SPO2 = p3.SPO2;
|
||||
result.Temperature = p3.Temperature;
|
||||
result.MedicalHistoryTemplateId = p3.MedicalHistoryTemplateId;
|
||||
result.ApplicationUserId = p3.ApplicationUserId;
|
||||
result.Answers = funcMain3(p3.Answers, result.Answers);
|
||||
result.Id = p3.Id;
|
||||
result.CreatedAt = p3.CreatedAt;
|
||||
|
@ -107,12 +92,6 @@ namespace DocuMed.Domain.Mappers
|
|||
HospitalId = p9.Section.HospitalId,
|
||||
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,
|
||||
PastDiseasesHistoryDetail = p9.PastDiseasesHistoryDetail,
|
||||
PastSurgeryHistoryDetail = p9.PastSurgeryHistoryDetail,
|
||||
|
@ -130,7 +109,6 @@ namespace DocuMed.Domain.Mappers
|
|||
SPO2 = p9.SPO2,
|
||||
Temperature = p9.Temperature,
|
||||
MedicalHistoryTemplateId = p9.MedicalHistoryTemplateId,
|
||||
ApplicationUserId = p9.ApplicationUserId,
|
||||
Answers = p9.Answers.Select<MedicalHistoryAnswerSDto, MedicalHistoryAnswer>(p10 => new MedicalHistoryAnswer()
|
||||
{
|
||||
Answer = p10.Answer,
|
||||
|
@ -149,12 +127,6 @@ namespace DocuMed.Domain.Mappers
|
|||
{
|
||||
ChiefComplaint = p11.ChiefComplaint,
|
||||
SectionId = p11.SectionId,
|
||||
FirstName = p11.FirstName,
|
||||
LastName = p11.LastName,
|
||||
FatherName = p11.FatherName,
|
||||
NationalId = p11.NationalId,
|
||||
Age = p11.Age,
|
||||
BirthDate = p11.BirthDate,
|
||||
Code = p11.Code,
|
||||
Section = p11.Section == null ? null : new SectionSDto()
|
||||
{
|
||||
|
@ -179,7 +151,6 @@ namespace DocuMed.Domain.Mappers
|
|||
PulseRate = p11.PulseRate,
|
||||
SPO2 = p11.SPO2,
|
||||
Temperature = p11.Temperature,
|
||||
ApplicationUserId = p11.ApplicationUserId,
|
||||
CreatedAt = p11.CreatedAt,
|
||||
Answers = funcMain4(p11.Answers),
|
||||
Id = p11.Id
|
||||
|
@ -195,12 +166,6 @@ namespace DocuMed.Domain.Mappers
|
|||
|
||||
result.ChiefComplaint = p13.ChiefComplaint;
|
||||
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.Section = funcMain5(p13.Section, result.Section);
|
||||
result.PresentIllnessDetail = p13.PresentIllnessDetail;
|
||||
|
@ -219,7 +184,6 @@ namespace DocuMed.Domain.Mappers
|
|||
result.PulseRate = p13.PulseRate;
|
||||
result.SPO2 = p13.SPO2;
|
||||
result.Temperature = p13.Temperature;
|
||||
result.ApplicationUserId = p13.ApplicationUserId;
|
||||
result.CreatedAt = p13.CreatedAt;
|
||||
result.Answers = funcMain6(p13.Answers, result.Answers);
|
||||
result.Id = p13.Id;
|
||||
|
@ -230,12 +194,6 @@ namespace DocuMed.Domain.Mappers
|
|||
{
|
||||
ChiefComplaint = p19.ChiefComplaint,
|
||||
SectionId = p19.SectionId,
|
||||
FirstName = p19.FirstName,
|
||||
LastName = p19.LastName,
|
||||
FatherName = p19.FatherName,
|
||||
NationalId = p19.NationalId,
|
||||
Age = p19.Age,
|
||||
BirthDate = p19.BirthDate,
|
||||
Code = p19.Code,
|
||||
Section = p19.Section == null ? null : new SectionSDto()
|
||||
{
|
||||
|
@ -260,7 +218,6 @@ namespace DocuMed.Domain.Mappers
|
|||
PulseRate = p19.PulseRate,
|
||||
SPO2 = p19.SPO2,
|
||||
Temperature = p19.Temperature,
|
||||
ApplicationUserId = p19.ApplicationUserId,
|
||||
CreatedAt = p19.CreatedAt,
|
||||
Answers = p19.Answers.Select<MedicalHistoryAnswer, MedicalHistoryAnswerSDto>(p20 => new MedicalHistoryAnswerSDto()
|
||||
{
|
||||
|
@ -284,12 +241,6 @@ namespace DocuMed.Domain.Mappers
|
|||
Name = p21.SectionName,
|
||||
Id = p21.SectionId
|
||||
},
|
||||
FirstName = p21.FirstName,
|
||||
LastName = p21.LastName,
|
||||
FatherName = p21.FatherName,
|
||||
NationalId = p21.NationalId,
|
||||
Age = p21.Age,
|
||||
BirthDate = p21.BirthDate,
|
||||
PresentIllnessDetail = p21.PresentIllnessDetail,
|
||||
PastDiseasesHistoryDetail = p21.PastDiseasesHistoryDetail,
|
||||
PastSurgeryHistoryDetail = p21.PastSurgeryHistoryDetail,
|
||||
|
@ -307,8 +258,6 @@ namespace DocuMed.Domain.Mappers
|
|||
SPO2 = p21.SPO2,
|
||||
Temperature = p21.Temperature,
|
||||
MedicalHistoryTemplateId = p21.MedicalHistoryTemplateId,
|
||||
ApplicationUserId = p21.ApplicationUserId,
|
||||
ApplicationUser = new ApplicationUser() {Id = p21.ApplicationUserId},
|
||||
Id = p21.Id,
|
||||
CreatedAt = p21.CreatedAt
|
||||
};
|
||||
|
@ -324,12 +273,6 @@ namespace DocuMed.Domain.Mappers
|
|||
result.ChiefComplaint = p22.ChiefComplaint;
|
||||
result.SectionId = p22.SectionId;
|
||||
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.PastDiseasesHistoryDetail = p22.PastDiseasesHistoryDetail;
|
||||
result.PastSurgeryHistoryDetail = p22.PastSurgeryHistoryDetail;
|
||||
|
@ -347,119 +290,96 @@ namespace DocuMed.Domain.Mappers
|
|||
result.SPO2 = p22.SPO2;
|
||||
result.Temperature = p22.Temperature;
|
||||
result.MedicalHistoryTemplateId = p22.MedicalHistoryTemplateId;
|
||||
result.ApplicationUserId = p22.ApplicationUserId;
|
||||
result.ApplicationUser = funcMain8(new Never(), result.ApplicationUser, p22);
|
||||
result.Id = p22.Id;
|
||||
result.CreatedAt = p22.CreatedAt;
|
||||
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,
|
||||
SectionId = p28.SectionId,
|
||||
SectionName = p28.Section != null ? p28.Section.Name : string.Empty,
|
||||
FirstName = p28.FirstName,
|
||||
LastName = p28.LastName,
|
||||
FatherName = p28.FatherName,
|
||||
NationalId = p28.NationalId,
|
||||
MedicalHistoryTemplateId = p28.MedicalHistoryTemplateId,
|
||||
Age = p28.Age,
|
||||
BirthDate = p28.BirthDate,
|
||||
Code = p28.Code,
|
||||
PresentIllnessDetail = p28.PresentIllnessDetail,
|
||||
PastDiseasesHistoryDetail = p28.PastDiseasesHistoryDetail,
|
||||
PastSurgeryHistoryDetail = p28.PastSurgeryHistoryDetail,
|
||||
FamilyHistoryDetail = p28.FamilyHistoryDetail,
|
||||
AllergyDetail = p28.AllergyDetail,
|
||||
DrugHistoryDetail = p28.DrugHistoryDetail,
|
||||
AddictionHistoryDetail = p28.AddictionHistoryDetail,
|
||||
SystemReviewDetail = p28.SystemReviewDetail,
|
||||
VitalSignDetail = p28.VitalSignDetail,
|
||||
GeneralAppearanceDetail = p28.GeneralAppearanceDetail,
|
||||
SystolicBloodPressure = p28.SystolicBloodPressure,
|
||||
DiastolicBloodPressure = p28.DiastolicBloodPressure,
|
||||
PulseRate = p28.PulseRate,
|
||||
SPO2 = p28.SPO2,
|
||||
Temperature = p28.Temperature,
|
||||
ApplicationUserId = p28.ApplicationUserId,
|
||||
CreatedAt = p28.CreatedAt,
|
||||
Id = p28.Id
|
||||
ChiefComplaint = p26.ChiefComplaint,
|
||||
SectionId = p26.SectionId,
|
||||
SectionName = p26.Section != null ? p26.Section.Name : string.Empty,
|
||||
MedicalHistoryTemplateId = p26.MedicalHistoryTemplateId,
|
||||
Code = p26.Code,
|
||||
PresentIllnessDetail = p26.PresentIllnessDetail,
|
||||
PastDiseasesHistoryDetail = p26.PastDiseasesHistoryDetail,
|
||||
PastSurgeryHistoryDetail = p26.PastSurgeryHistoryDetail,
|
||||
FamilyHistoryDetail = p26.FamilyHistoryDetail,
|
||||
AllergyDetail = p26.AllergyDetail,
|
||||
DrugHistoryDetail = p26.DrugHistoryDetail,
|
||||
AddictionHistoryDetail = p26.AddictionHistoryDetail,
|
||||
SystemReviewDetail = p26.SystemReviewDetail,
|
||||
VitalSignDetail = p26.VitalSignDetail,
|
||||
GeneralAppearanceDetail = p26.GeneralAppearanceDetail,
|
||||
SystolicBloodPressure = p26.SystolicBloodPressure,
|
||||
DiastolicBloodPressure = p26.DiastolicBloodPressure,
|
||||
PulseRate = p26.PulseRate,
|
||||
SPO2 = p26.SPO2,
|
||||
Temperature = p26.Temperature,
|
||||
CreatedAt = p26.CreatedAt,
|
||||
Id = p26.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;
|
||||
}
|
||||
MedicalHistorySDto result = p30 ?? new MedicalHistorySDto();
|
||||
MedicalHistorySDto result = p28 ?? new MedicalHistorySDto();
|
||||
|
||||
result.ChiefComplaint = p29.ChiefComplaint;
|
||||
result.SectionId = p29.SectionId;
|
||||
result.SectionName = p29.Section != null ? p29.Section.Name : string.Empty;
|
||||
result.FirstName = p29.FirstName;
|
||||
result.LastName = p29.LastName;
|
||||
result.FatherName = p29.FatherName;
|
||||
result.NationalId = p29.NationalId;
|
||||
result.MedicalHistoryTemplateId = p29.MedicalHistoryTemplateId;
|
||||
result.Age = p29.Age;
|
||||
result.BirthDate = p29.BirthDate;
|
||||
result.Code = p29.Code;
|
||||
result.PresentIllnessDetail = p29.PresentIllnessDetail;
|
||||
result.PastDiseasesHistoryDetail = p29.PastDiseasesHistoryDetail;
|
||||
result.PastSurgeryHistoryDetail = p29.PastSurgeryHistoryDetail;
|
||||
result.FamilyHistoryDetail = p29.FamilyHistoryDetail;
|
||||
result.AllergyDetail = p29.AllergyDetail;
|
||||
result.DrugHistoryDetail = p29.DrugHistoryDetail;
|
||||
result.AddictionHistoryDetail = p29.AddictionHistoryDetail;
|
||||
result.SystemReviewDetail = p29.SystemReviewDetail;
|
||||
result.VitalSignDetail = p29.VitalSignDetail;
|
||||
result.GeneralAppearanceDetail = p29.GeneralAppearanceDetail;
|
||||
result.SystolicBloodPressure = p29.SystolicBloodPressure;
|
||||
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;
|
||||
result.ChiefComplaint = p27.ChiefComplaint;
|
||||
result.SectionId = p27.SectionId;
|
||||
result.SectionName = p27.Section != null ? p27.Section.Name : string.Empty;
|
||||
result.MedicalHistoryTemplateId = p27.MedicalHistoryTemplateId;
|
||||
result.Code = p27.Code;
|
||||
result.PresentIllnessDetail = p27.PresentIllnessDetail;
|
||||
result.PastDiseasesHistoryDetail = p27.PastDiseasesHistoryDetail;
|
||||
result.PastSurgeryHistoryDetail = p27.PastSurgeryHistoryDetail;
|
||||
result.FamilyHistoryDetail = p27.FamilyHistoryDetail;
|
||||
result.AllergyDetail = p27.AllergyDetail;
|
||||
result.DrugHistoryDetail = p27.DrugHistoryDetail;
|
||||
result.AddictionHistoryDetail = p27.AddictionHistoryDetail;
|
||||
result.SystemReviewDetail = p27.SystemReviewDetail;
|
||||
result.VitalSignDetail = p27.VitalSignDetail;
|
||||
result.GeneralAppearanceDetail = p27.GeneralAppearanceDetail;
|
||||
result.SystolicBloodPressure = p27.SystolicBloodPressure;
|
||||
result.DiastolicBloodPressure = p27.DiastolicBloodPressure;
|
||||
result.PulseRate = p27.PulseRate;
|
||||
result.SPO2 = p27.SPO2;
|
||||
result.Temperature = p27.Temperature;
|
||||
result.CreatedAt = p27.CreatedAt;
|
||||
result.Id = p27.Id;
|
||||
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,
|
||||
SectionId = p31.SectionId,
|
||||
SectionName = p31.Section != null ? p31.Section.Name : string.Empty,
|
||||
FirstName = p31.FirstName,
|
||||
LastName = p31.LastName,
|
||||
FatherName = p31.FatherName,
|
||||
NationalId = p31.NationalId,
|
||||
MedicalHistoryTemplateId = p31.MedicalHistoryTemplateId,
|
||||
Age = p31.Age,
|
||||
BirthDate = p31.BirthDate,
|
||||
Code = p31.Code,
|
||||
PresentIllnessDetail = p31.PresentIllnessDetail,
|
||||
PastDiseasesHistoryDetail = p31.PastDiseasesHistoryDetail,
|
||||
PastSurgeryHistoryDetail = p31.PastSurgeryHistoryDetail,
|
||||
FamilyHistoryDetail = p31.FamilyHistoryDetail,
|
||||
AllergyDetail = p31.AllergyDetail,
|
||||
DrugHistoryDetail = p31.DrugHistoryDetail,
|
||||
AddictionHistoryDetail = p31.AddictionHistoryDetail,
|
||||
SystemReviewDetail = p31.SystemReviewDetail,
|
||||
VitalSignDetail = p31.VitalSignDetail,
|
||||
GeneralAppearanceDetail = p31.GeneralAppearanceDetail,
|
||||
SystolicBloodPressure = p31.SystolicBloodPressure,
|
||||
DiastolicBloodPressure = p31.DiastolicBloodPressure,
|
||||
PulseRate = p31.PulseRate,
|
||||
SPO2 = p31.SPO2,
|
||||
Temperature = p31.Temperature,
|
||||
ApplicationUserId = p31.ApplicationUserId,
|
||||
CreatedAt = p31.CreatedAt,
|
||||
Id = p31.Id
|
||||
ChiefComplaint = p29.ChiefComplaint,
|
||||
SectionId = p29.SectionId,
|
||||
SectionName = p29.Section != null ? p29.Section.Name : string.Empty,
|
||||
MedicalHistoryTemplateId = p29.MedicalHistoryTemplateId,
|
||||
Code = p29.Code,
|
||||
PresentIllnessDetail = p29.PresentIllnessDetail,
|
||||
PastDiseasesHistoryDetail = p29.PastDiseasesHistoryDetail,
|
||||
PastSurgeryHistoryDetail = p29.PastSurgeryHistoryDetail,
|
||||
FamilyHistoryDetail = p29.FamilyHistoryDetail,
|
||||
AllergyDetail = p29.AllergyDetail,
|
||||
DrugHistoryDetail = p29.DrugHistoryDetail,
|
||||
AddictionHistoryDetail = p29.AddictionHistoryDetail,
|
||||
SystemReviewDetail = p29.SystemReviewDetail,
|
||||
VitalSignDetail = p29.VitalSignDetail,
|
||||
GeneralAppearanceDetail = p29.GeneralAppearanceDetail,
|
||||
SystolicBloodPressure = p29.SystolicBloodPressure,
|
||||
DiastolicBloodPressure = p29.DiastolicBloodPressure,
|
||||
PulseRate = p29.PulseRate,
|
||||
SPO2 = p29.SPO2,
|
||||
Temperature = p29.Temperature,
|
||||
CreatedAt = p29.CreatedAt,
|
||||
Id = p29.Id
|
||||
};
|
||||
|
||||
private static List<MedicalHistoryAnswer> funcMain1(List<MedicalHistoryAnswerSDto> p2)
|
||||
|
@ -619,14 +539,5 @@ namespace DocuMed.Domain.Mappers
|
|||
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,
|
||||
Id = p1.Section.Id
|
||||
},
|
||||
ApplicationUserId = p1.ApplicationUserId,
|
||||
Questions = funcMain1(p1.Questions),
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
|
@ -41,7 +40,6 @@ namespace DocuMed.Domain.Mappers
|
|||
result.ChiefComplaint = p3.ChiefComplaint;
|
||||
result.SectionId = p3.SectionId;
|
||||
result.Section = funcMain2(p3.Section, result.Section);
|
||||
result.ApplicationUserId = p3.ApplicationUserId;
|
||||
result.Questions = funcMain3(p3.Questions, result.Questions);
|
||||
result.Id = p3.Id;
|
||||
result.CreatedAt = p3.CreatedAt;
|
||||
|
@ -59,7 +57,6 @@ namespace DocuMed.Domain.Mappers
|
|||
HospitalId = p9.Section.HospitalId,
|
||||
Id = p9.Section.Id
|
||||
},
|
||||
ApplicationUserId = p9.ApplicationUserId,
|
||||
Questions = p9.Questions.Select<MedicalHistoryQuestionSDto, MedicalHistoryQuestion>(p10 => new MedicalHistoryQuestion()
|
||||
{
|
||||
Question = p10.Question,
|
||||
|
@ -87,7 +84,6 @@ namespace DocuMed.Domain.Mappers
|
|||
HospitalId = p11.Section.HospitalId,
|
||||
Id = p11.Section.Id
|
||||
},
|
||||
ApplicationUserId = p11.ApplicationUserId,
|
||||
CreatedAt = p11.CreatedAt,
|
||||
Questions = funcMain4(p11.Questions),
|
||||
Id = p11.Id
|
||||
|
@ -104,7 +100,6 @@ namespace DocuMed.Domain.Mappers
|
|||
result.ChiefComplaint = p13.ChiefComplaint;
|
||||
result.SectionId = p13.SectionId;
|
||||
result.Section = funcMain5(p13.Section, result.Section);
|
||||
result.ApplicationUserId = p13.ApplicationUserId;
|
||||
result.CreatedAt = p13.CreatedAt;
|
||||
result.Questions = funcMain6(p13.Questions, result.Questions);
|
||||
result.Id = p13.Id;
|
||||
|
@ -122,7 +117,6 @@ namespace DocuMed.Domain.Mappers
|
|||
HospitalId = p19.Section.HospitalId,
|
||||
Id = p19.Section.Id
|
||||
},
|
||||
ApplicationUserId = p19.ApplicationUserId,
|
||||
CreatedAt = p19.CreatedAt,
|
||||
Questions = p19.Questions.Select<MedicalHistoryQuestion, MedicalHistoryQuestionSDto>(p20 => new MedicalHistoryQuestionSDto()
|
||||
{
|
||||
|
@ -143,7 +137,6 @@ namespace DocuMed.Domain.Mappers
|
|||
{
|
||||
ChiefComplaint = p21.ChiefComplaint,
|
||||
SectionId = p21.SectionId,
|
||||
ApplicationUserId = p21.ApplicationUserId,
|
||||
Id = p21.Id,
|
||||
CreatedAt = p21.CreatedAt
|
||||
};
|
||||
|
@ -158,7 +151,6 @@ namespace DocuMed.Domain.Mappers
|
|||
|
||||
result.ChiefComplaint = p22.ChiefComplaint;
|
||||
result.SectionId = p22.SectionId;
|
||||
result.ApplicationUserId = p22.ApplicationUserId;
|
||||
result.Id = p22.Id;
|
||||
result.CreatedAt = p22.CreatedAt;
|
||||
return result;
|
||||
|
@ -171,7 +163,6 @@ namespace DocuMed.Domain.Mappers
|
|||
ChiefComplaint = p24.ChiefComplaint,
|
||||
SectionName = p24.Section == null ? null : p24.Section.Name,
|
||||
SectionId = p24.SectionId,
|
||||
ApplicationUserId = p24.ApplicationUserId,
|
||||
CreatedAt = p24.CreatedAt,
|
||||
Id = p24.Id
|
||||
};
|
||||
|
@ -187,7 +178,6 @@ namespace DocuMed.Domain.Mappers
|
|||
result.ChiefComplaint = p25.ChiefComplaint;
|
||||
result.SectionName = p25.Section == null ? null : p25.Section.Name;
|
||||
result.SectionId = p25.SectionId;
|
||||
result.ApplicationUserId = p25.ApplicationUserId;
|
||||
result.CreatedAt = p25.CreatedAt;
|
||||
result.Id = p25.Id;
|
||||
return result;
|
||||
|
@ -198,7 +188,6 @@ namespace DocuMed.Domain.Mappers
|
|||
ChiefComplaint = p27.ChiefComplaint,
|
||||
SectionName = p27.Section.Name,
|
||||
SectionId = p27.SectionId,
|
||||
ApplicationUserId = p27.ApplicationUserId,
|
||||
CreatedAt = p27.CreatedAt,
|
||||
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
|
||||
{
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
|
@ -26,7 +26,7 @@ namespace DocuMed.Domain.Mappers
|
|||
Section = new Section()
|
||||
{
|
||||
Name = p1.SectionName,
|
||||
Id = p1.SectionId
|
||||
Id = p1.SectionId.Value
|
||||
},
|
||||
UserId = p1.UserId,
|
||||
User = new ApplicationUser() {Id = p1.UserId},
|
||||
|
@ -65,7 +65,7 @@ namespace DocuMed.Domain.Mappers
|
|||
Section = new Section()
|
||||
{
|
||||
Name = p10.SectionName,
|
||||
Id = p10.SectionId
|
||||
Id = p10.SectionId.Value
|
||||
},
|
||||
UserId = p10.UserId,
|
||||
User = new ApplicationUser() {Id = p10.UserId},
|
||||
|
@ -140,7 +140,7 @@ namespace DocuMed.Domain.Mappers
|
|||
Section result = p7 ?? new Section();
|
||||
|
||||
result.Name = p2.SectionName;
|
||||
result.Id = p2.SectionId;
|
||||
result.Id = p2.SectionId.Value;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
|
|
@ -5,4 +5,5 @@ public static class Refers
|
|||
public const int SizeS = 10;
|
||||
public const int SizeM = 15;
|
||||
public const int SizeL = 20;
|
||||
public const int MaxSize = 25;
|
||||
}
|
|
@ -1,37 +1,37 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Refit" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DocuMed.Core\DocuMed.Core.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DocuMed.Core\DocuMed.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\RestApi\KaveNegar\" />
|
||||
<Folder Include="RestServices\" />
|
||||
<Folder Include="Services\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\RestApi\KaveNegar\" />
|
||||
<Folder Include="RestServices\" />
|
||||
<Folder Include="Services\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="DocuMed.Common.Models" />
|
||||
<Using Include="DocuMed.Common.Models.Api" />
|
||||
<Using Include="DocuMed.Common.Models.Exception" />
|
||||
<Using Include="DocuMed.Core.Abstracts" />
|
||||
<Using Include="DocuMed.Domain.Models.Settings" />
|
||||
<Using Include="DocuMed.Infrastructure.Models" />
|
||||
<Using Include="DocuMed.Infrastructure.Models.RestApi.KaveNegar" />
|
||||
<Using Include="DocuMed.Infrastructure.RestServices" />
|
||||
<Using Include="Microsoft.Extensions.Logging" />
|
||||
<Using Include="Microsoft.Extensions.Options" />
|
||||
<Using Include="Refit" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Using Include="DocuMed.Common.Models" />
|
||||
<Using Include="DocuMed.Common.Models.Api" />
|
||||
<Using Include="DocuMed.Common.Models.Exception" />
|
||||
<Using Include="DocuMed.Core.Abstracts" />
|
||||
<Using Include="DocuMed.Domain.Models.Settings" />
|
||||
<Using Include="DocuMed.Infrastructure.Models" />
|
||||
<Using Include="DocuMed.Infrastructure.Models.RestApi.KaveNegar" />
|
||||
<Using Include="DocuMed.Infrastructure.RestServices" />
|
||||
<Using Include="Microsoft.Extensions.Logging" />
|
||||
<Using Include="Microsoft.Extensions.Options" />
|
||||
<Using Include="Refit" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,70 +1,70 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="npm run buildcss" />
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
||||
<AssemblyVersion>1.3.2.1</AssemblyVersion>
|
||||
<FileVersion>1.3.2.1</FileVersion>
|
||||
</PropertyGroup>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="npm run buildcss" />
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
||||
<AssemblyVersion>1.3.2.1</AssemblyVersion>
|
||||
<FileVersion>1.3.2.1</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
|
||||
<PackageReference Include="Blazorise.LottieAnimation" Version="1.6.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />
|
||||
<PackageReference Include="MudBlazor" Version="6.13.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Refit" Version="7.2.1" />
|
||||
<PackageReference Include="Refit.HttpClientFactory" Version="7.2.1" />
|
||||
<PackageReference Include="Refit.Newtonsoft.Json" Version="7.2.1" />
|
||||
<PackageReference Include="Toolbelt.Blazor.PWA.Updater" Version="2.1.0.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
|
||||
<PackageReference Include="Blazorise.LottieAnimation" Version="1.6.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />
|
||||
<PackageReference Include="MudBlazor" Version="6.13.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Refit" Version="7.2.1" />
|
||||
<PackageReference Include="Refit.HttpClientFactory" Version="7.2.1" />
|
||||
<PackageReference Include="Refit.Newtonsoft.Json" Version="7.2.1" />
|
||||
<PackageReference Include="Toolbelt.Blazor.PWA.Updater" Version="2.1.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\ItemModels\" />
|
||||
<Folder Include="Helpers\" />
|
||||
<Folder Include="wwwroot\assets\lotties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\ItemModels\" />
|
||||
<Folder Include="Helpers\" />
|
||||
<Folder Include="wwwroot\assets\lotties\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DocuMed.Domain\DocuMed.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DocuMed.Domain\DocuMed.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Blazored.LocalStorage" />
|
||||
<Using Include="DocuMed.Common.Extensions" />
|
||||
<Using Include="DocuMed.Common.Models.Api" />
|
||||
<Using Include="DocuMed.Domain.Dtos.LargDtos" />
|
||||
<Using Include="DocuMed.Domain.Dtos.RequestDtos" />
|
||||
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
||||
<Using Include="DocuMed.Domain.Entities.City" />
|
||||
<Using Include="DocuMed.Domain.Entities.MedicalHistory" />
|
||||
<Using Include="DocuMed.Domain.Entities.MedicalHistoryTemplate" />
|
||||
<Using Include="DocuMed.Domain.Enums" />
|
||||
<Using Include="DocuMed.Domain.Enums.QueryFilters" />
|
||||
<Using Include="DocuMed.Domain.Models" />
|
||||
<Using Include="DocuMed.PWA" />
|
||||
<Using Include="DocuMed.PWA.Models" />
|
||||
<Using Include="DocuMed.PWA.Models.Api" />
|
||||
<Using Include="DocuMed.PWA.Services.RestServices" />
|
||||
<Using Include="DocuMed.PWA.Utilities" />
|
||||
<Using Include="Microsoft.AspNetCore.Components" />
|
||||
<Using Include="Microsoft.AspNetCore.Components.Web" />
|
||||
<Using Include="Microsoft.AspNetCore.Components.WebAssembly.Hosting" />
|
||||
<Using Include="Microsoft.IdentityModel.Tokens" />
|
||||
<Using Include="MudBlazor" />
|
||||
<Using Include="MudBlazor.Services" />
|
||||
<Using Include="Refit" />
|
||||
<Using Include="System.Reflection" />
|
||||
<Using Include="Toolbelt.Blazor.Extensions.DependencyInjection" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Using Include="Blazored.LocalStorage" />
|
||||
<Using Include="DocuMed.Common.Extensions" />
|
||||
<Using Include="DocuMed.Common.Models.Api" />
|
||||
<Using Include="DocuMed.Domain.Dtos.LargDtos" />
|
||||
<Using Include="DocuMed.Domain.Dtos.RequestDtos" />
|
||||
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
||||
<Using Include="DocuMed.Domain.Entities.City" />
|
||||
<Using Include="DocuMed.Domain.Entities.MedicalHistory" />
|
||||
<Using Include="DocuMed.Domain.Entities.MedicalHistoryTemplate" />
|
||||
<Using Include="DocuMed.Domain.Enums" />
|
||||
<Using Include="DocuMed.Domain.Enums.QueryFilters" />
|
||||
<Using Include="DocuMed.Domain.Models" />
|
||||
<Using Include="DocuMed.PWA" />
|
||||
<Using Include="DocuMed.PWA.Models" />
|
||||
<Using Include="DocuMed.PWA.Models.Api" />
|
||||
<Using Include="DocuMed.PWA.Services.RestServices" />
|
||||
<Using Include="DocuMed.PWA.Utilities" />
|
||||
<Using Include="Microsoft.AspNetCore.Components" />
|
||||
<Using Include="Microsoft.AspNetCore.Components.Web" />
|
||||
<Using Include="Microsoft.AspNetCore.Components.WebAssembly.Hosting" />
|
||||
<Using Include="Microsoft.IdentityModel.Tokens" />
|
||||
<Using Include="MudBlazor" />
|
||||
<Using Include="MudBlazor.Services" />
|
||||
<Using Include="Refit" />
|
||||
<Using Include="System.Reflection" />
|
||||
<Using Include="Toolbelt.Blazor.Extensions.DependencyInjection" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -15,4 +15,5 @@ public static class Address
|
|||
public static string UserController = $"{BaseAddress}/user";
|
||||
public static string MedicalHistoryTemplateController = $"{BaseAddress}/medicalhistory/template";
|
||||
public static string MedicalHistoryController = $"{BaseAddress}/medicalhistory";
|
||||
public static string PatientController = $"{BaseAddress}/patient";
|
||||
}
|
|
@ -8,14 +8,52 @@
|
|||
|
||||
<MudForm>
|
||||
<MudFocusTrap>
|
||||
<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"
|
||||
<MudAutocomplete Value="@SelectedPatient"
|
||||
CoerceValue="true"
|
||||
class="text-sm my-5"
|
||||
ToStringFunc="dto => dto.FullName"
|
||||
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); }"
|
||||
Min="0"
|
||||
T="int" Label="سن بیمار" Variant="Variant.Outlined" />
|
||||
T="int"
|
||||
Label="سن بیمار"
|
||||
Variant="Variant.Outlined"/>
|
||||
|
||||
|
||||
|
||||
|
@ -28,7 +66,7 @@
|
|||
<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" />
|
||||
<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>
|
||||
|
@ -40,7 +78,7 @@
|
|||
</MudAutocomplete>
|
||||
|
||||
<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"
|
||||
CoerceValue="true"
|
||||
|
@ -48,12 +86,14 @@
|
|||
ToStringFunc="dto => dto.ChiefComplaint"
|
||||
SearchFunc="@SearchTemplates"
|
||||
ValueChanged="async dto => { SelectedTemplate = dto; await SelectedTemplateChanged.InvokeAsync(SelectedTemplate); }"
|
||||
T="MedicalHistoryTemplateSDto" Label="انتخاب از پیش نویس ها" Variant="Variant.Outlined">
|
||||
T="MedicalHistoryTemplateSDto"
|
||||
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" />
|
||||
<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>
|
||||
|
@ -109,6 +149,10 @@
|
|||
|
||||
[Parameter]
|
||||
public MedicalHistoryTemplateSDto SelectedTemplate { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public PatientSDto SelectedPatient { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<MedicalHistoryTemplateSDto> SelectedTemplateChanged { get; set; }
|
||||
|
||||
|
@ -123,6 +167,7 @@
|
|||
public List<SectionSDto> Sections { get; private set; } = new List<SectionSDto>();
|
||||
|
||||
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)
|
||||
|
@ -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)
|
||||
{
|
||||
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 IUserRestApi UserRestApi { 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 IUserRestApi UserRestApi => RestService.For<IUserRestApi>(Address.UserController, setting);
|
||||
public IMedicalHistoryRestApi MedicalHistoryRestApi => RestService.For<IMedicalHistoryRestApi>(Address.MedicalHistoryController);
|
||||
public IPatientRestApi PatientRestApi => RestService.For<IPatientRestApi>(Address.PatientController,setting);
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
using FluentValidation;
|
||||
using ValidationError = DocuMed.Common.Models.Exception.ValidationError;
|
||||
|
||||
namespace DocuMed.Repository.Behaviors;
|
||||
|
||||
public class ValidationBehavior<TRequest, TResponse>(IEnumerable<IValidator<TRequest>> validators)
|
||||
: IPipelineBehavior<TRequest, TResponse>
|
||||
where TRequest : notnull
|
||||
{
|
||||
public async Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken cancellationToken)
|
||||
{
|
||||
var context = new ValidationContext<TRequest>(request);
|
||||
List<ValidationError> errors = new List<ValidationError>();
|
||||
foreach (IValidator<TRequest> validator in validators)
|
||||
{
|
||||
var result = await validator.ValidateAsync(context, cancellationToken);
|
||||
if (!result.IsValid)
|
||||
errors.AddRange(result.Errors.Select(v => new ValidationError(v.PropertyName, v.ErrorMessage)).Distinct());
|
||||
}
|
||||
|
||||
if (errors.Any())
|
||||
{
|
||||
throw new Common.Models.Exception.ValidationException(errors);
|
||||
}
|
||||
|
||||
|
||||
var response = await next();
|
||||
return response;
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentValidation" Version="11.11.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
|
||||
|
@ -42,10 +43,13 @@
|
|||
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
|
||||
<Using Include="DocuMed.Domain.Entities.MedicalHistory" />
|
||||
<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.Enums" />
|
||||
<Using Include="DocuMed.Domain.Enums.QueryFilters" />
|
||||
<Using Include="DocuMed.Domain.Mappers" />
|
||||
<Using Include="DocuMed.Domain.Models" />
|
||||
<Using Include="DocuMed.Domain.Models.Settings" />
|
||||
<Using Include="DocuMed.Repository.Abstracts" />
|
||||
<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)
|
||||
{
|
||||
if (!Guid.TryParse(currentUserService.UserId, out Guid userId))
|
||||
throw new AppException("دسترسی غیرمجاز", ApiResultStatusCode.UnAuthorized);
|
||||
|
||||
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, userId, template.MedicalHistoryTemplateId);
|
||||
var student = await repositoryWrapper.SetRepository<Student>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(f => f.UserId == userId, cancellationToken);
|
||||
|
||||
if (student == null)
|
||||
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)
|
||||
ent.AddAnswer(answer.Answer, answer.Question, answer.Part, answer.QuestionType);
|
||||
|
|
|
@ -1,22 +1,76 @@
|
|||
namespace DocuMed.Repository.Handlers.MedicalHistories;
|
||||
using DocuMed.Domain.Entities.Staffs;
|
||||
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)
|
||||
{
|
||||
if (!Guid.TryParse(currentUserService.UserId, out Guid userId))
|
||||
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
|
||||
.FirstOrDefaultAsync(m => m.Id == template.Id, cancellationToken);
|
||||
if(ent==null)
|
||||
throw new AppException("شرح حال پیدا نشد", ApiResultStatusCode.NotFound);
|
||||
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, template.ApplicationUserId, template.MedicalHistoryTemplateId);
|
||||
if (ent == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.NotFound, "شرح حال پیدا نشد");
|
||||
|
||||
if (ent.StudentId != student.Id)
|
||||
throw new BaseApiException(ApiResultStatusCode.NotFound, "شرح حال متعلق به دانشجو نیست");
|
||||
|
||||
|
||||
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.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;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,758 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DocuMed.Repository.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "public");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Cities",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Cities", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Roles",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
EnglishName = table.Column<string>(type: "text", nullable: false),
|
||||
PersianName = table.Column<string>(type: "text", nullable: false),
|
||||
Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Roles", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
FirstName = table.Column<string>(type: "text", nullable: false),
|
||||
LastName = table.Column<string>(type: "text", nullable: false),
|
||||
NationalId = table.Column<string>(type: "text", nullable: false),
|
||||
BirthDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
Gender = table.Column<int>(type: "integer", nullable: false),
|
||||
SignUpStatus = table.Column<int>(type: "integer", nullable: false),
|
||||
UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
|
||||
PasswordHash = table.Column<string>(type: "text", nullable: true),
|
||||
SecurityStamp = table.Column<string>(type: "text", nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
|
||||
PhoneNumber = table.Column<string>(type: "text", nullable: true),
|
||||
PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
|
||||
TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||
LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Users", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Universities",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Address = table.Column<string>(type: "text", nullable: false),
|
||||
CityId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Universities", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Universities_Cities_CityId",
|
||||
column: x => x.CityId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Cities",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RoleClaims",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
RoleId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ClaimType = table.Column<string>(type: "text", nullable: true),
|
||||
ClaimValue = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RoleClaims", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RoleClaims_Roles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Roles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Claims",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ClaimType = table.Column<string>(type: "text", nullable: true),
|
||||
ClaimValue = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Claims", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Claims_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Logins",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
LoginProvider = table.Column<string>(type: "text", nullable: false),
|
||||
ProviderKey = table.Column<string>(type: "text", nullable: false),
|
||||
ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Logins", x => new { x.LoginProvider, x.ProviderKey });
|
||||
table.ForeignKey(
|
||||
name: "FK_Logins_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Tokens",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
LoginProvider = table.Column<string>(type: "text", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Value = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Tokens", x => new { x.UserId, x.LoginProvider, x.Name });
|
||||
table.ForeignKey(
|
||||
name: "FK_Tokens_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserRoles",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RoleId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserRoles", x => new { x.UserId, x.RoleId });
|
||||
table.ForeignKey(
|
||||
name: "FK_UserRoles_Roles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Roles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserRoles_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Hospitals",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Detail = table.Column<string>(type: "text", nullable: false),
|
||||
Address = table.Column<string>(type: "text", nullable: false),
|
||||
UniversityId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Hospitals", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Hospitals_Universities_UniversityId",
|
||||
column: x => x.UniversityId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Universities",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Sections",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Detail = table.Column<string>(type: "text", nullable: false),
|
||||
HospitalId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
UniversityId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Sections", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Sections_Hospitals_HospitalId",
|
||||
column: x => x.HospitalId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Hospitals",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Sections_Universities_UniversityId",
|
||||
column: x => x.UniversityId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Universities",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Patients",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
UnitNumber = table.Column<string>(type: "text", nullable: false),
|
||||
Room = table.Column<string>(type: "text", nullable: false),
|
||||
Bed = table.Column<string>(type: "text", nullable: false),
|
||||
AdmissionAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
SectionId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
HospitalId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Patients", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Patients_Sections_SectionId",
|
||||
column: x => x.SectionId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Sections",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Patients_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Students",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
StudentId = table.Column<string>(type: "text", nullable: false),
|
||||
UniversityId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
SectionId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Students", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Students_Sections_SectionId",
|
||||
column: x => x.SectionId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Sections",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Students_Universities_UniversityId",
|
||||
column: x => x.UniversityId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Universities",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Students_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MedicalHistories",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ChiefComplaint = table.Column<string>(type: "text", nullable: false),
|
||||
SectionId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
PresentIllnessDetail = table.Column<string>(type: "text", nullable: false),
|
||||
PastDiseasesHistoryDetail = table.Column<string>(type: "text", nullable: false),
|
||||
PastSurgeryHistoryDetail = table.Column<string>(type: "text", nullable: false),
|
||||
FamilyHistoryDetail = table.Column<string>(type: "text", nullable: false),
|
||||
AllergyDetail = table.Column<string>(type: "text", nullable: false),
|
||||
DrugHistoryDetail = table.Column<string>(type: "text", nullable: false),
|
||||
AddictionHistoryDetail = table.Column<string>(type: "text", nullable: false),
|
||||
SystemReviewDetail = table.Column<string>(type: "text", nullable: false),
|
||||
VitalSignDetail = table.Column<string>(type: "text", nullable: false),
|
||||
GeneralAppearanceDetail = table.Column<string>(type: "text", nullable: false),
|
||||
Code = table.Column<string>(type: "text", nullable: false),
|
||||
SystolicBloodPressure = table.Column<double>(type: "double precision", nullable: false),
|
||||
DiastolicBloodPressure = table.Column<double>(type: "double precision", nullable: false),
|
||||
PulseRate = table.Column<double>(type: "double precision", nullable: false),
|
||||
SPO2 = table.Column<double>(type: "double precision", nullable: false),
|
||||
Temperature = table.Column<double>(type: "double precision", nullable: false),
|
||||
MedicalHistoryTemplateId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
StudentId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
PatientId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MedicalHistories", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MedicalHistories_Patients_PatientId",
|
||||
column: x => x.PatientId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Patients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_MedicalHistories_Sections_SectionId",
|
||||
column: x => x.SectionId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Sections",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_MedicalHistories_Students_StudentId",
|
||||
column: x => x.StudentId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Students",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MedicalHistoryTemplates",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ChiefComplaint = table.Column<string>(type: "text", nullable: false),
|
||||
SectionId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
StudentId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MedicalHistoryTemplates", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MedicalHistoryTemplates_Sections_SectionId",
|
||||
column: x => x.SectionId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Sections",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_MedicalHistoryTemplates_Students_StudentId",
|
||||
column: x => x.StudentId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Students",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MedicalHistoryAnswers",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Answer = table.Column<string>(type: "text", nullable: false),
|
||||
Question = table.Column<string>(type: "text", nullable: false),
|
||||
Part = table.Column<int>(type: "integer", nullable: false),
|
||||
QuestionType = table.Column<int>(type: "integer", nullable: false),
|
||||
MedicalHistoryId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MedicalHistoryAnswers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MedicalHistoryAnswers_MedicalHistories_MedicalHistoryId",
|
||||
column: x => x.MedicalHistoryId,
|
||||
principalSchema: "public",
|
||||
principalTable: "MedicalHistories",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MedicalHistoryQuestions",
|
||||
schema: "public",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Question = table.Column<string>(type: "text", nullable: false),
|
||||
Part = table.Column<int>(type: "integer", nullable: false),
|
||||
QuestionType = table.Column<int>(type: "integer", nullable: false),
|
||||
BodySystem = table.Column<int>(type: "integer", nullable: false),
|
||||
IsSign = table.Column<bool>(type: "boolean", nullable: false),
|
||||
IsSymptom = table.Column<bool>(type: "boolean", nullable: false),
|
||||
MedicalHistoryTemplateId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "text", nullable: true),
|
||||
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
|
||||
RemovedBy = table.Column<string>(type: "text", nullable: true),
|
||||
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
ModifiedBy = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MedicalHistoryQuestions", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MedicalHistoryQuestions_MedicalHistoryTemplates_MedicalHist~",
|
||||
column: x => x.MedicalHistoryTemplateId,
|
||||
principalSchema: "public",
|
||||
principalTable: "MedicalHistoryTemplates",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Claims_UserId",
|
||||
schema: "public",
|
||||
table: "Claims",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Hospitals_UniversityId",
|
||||
schema: "public",
|
||||
table: "Hospitals",
|
||||
column: "UniversityId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Logins_UserId",
|
||||
schema: "public",
|
||||
table: "Logins",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MedicalHistories_PatientId",
|
||||
schema: "public",
|
||||
table: "MedicalHistories",
|
||||
column: "PatientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MedicalHistories_SectionId",
|
||||
schema: "public",
|
||||
table: "MedicalHistories",
|
||||
column: "SectionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MedicalHistories_StudentId",
|
||||
schema: "public",
|
||||
table: "MedicalHistories",
|
||||
column: "StudentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MedicalHistoryAnswers_MedicalHistoryId",
|
||||
schema: "public",
|
||||
table: "MedicalHistoryAnswers",
|
||||
column: "MedicalHistoryId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MedicalHistoryQuestions_MedicalHistoryTemplateId",
|
||||
schema: "public",
|
||||
table: "MedicalHistoryQuestions",
|
||||
column: "MedicalHistoryTemplateId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MedicalHistoryTemplates_SectionId",
|
||||
schema: "public",
|
||||
table: "MedicalHistoryTemplates",
|
||||
column: "SectionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MedicalHistoryTemplates_StudentId",
|
||||
schema: "public",
|
||||
table: "MedicalHistoryTemplates",
|
||||
column: "StudentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Patients_SectionId",
|
||||
schema: "public",
|
||||
table: "Patients",
|
||||
column: "SectionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Patients_UserId",
|
||||
schema: "public",
|
||||
table: "Patients",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RoleClaims_RoleId",
|
||||
schema: "public",
|
||||
table: "RoleClaims",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "RoleNameIndex",
|
||||
schema: "public",
|
||||
table: "Roles",
|
||||
column: "NormalizedName",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Sections_HospitalId",
|
||||
schema: "public",
|
||||
table: "Sections",
|
||||
column: "HospitalId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Sections_UniversityId",
|
||||
schema: "public",
|
||||
table: "Sections",
|
||||
column: "UniversityId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Students_SectionId",
|
||||
schema: "public",
|
||||
table: "Students",
|
||||
column: "SectionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Students_UniversityId",
|
||||
schema: "public",
|
||||
table: "Students",
|
||||
column: "UniversityId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Students_UserId",
|
||||
schema: "public",
|
||||
table: "Students",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Universities_CityId",
|
||||
schema: "public",
|
||||
table: "Universities",
|
||||
column: "CityId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserRoles_RoleId",
|
||||
schema: "public",
|
||||
table: "UserRoles",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "EmailIndex",
|
||||
schema: "public",
|
||||
table: "Users",
|
||||
column: "NormalizedEmail");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "UserNameIndex",
|
||||
schema: "public",
|
||||
table: "Users",
|
||||
column: "NormalizedUserName",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Claims",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Logins",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MedicalHistoryAnswers",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MedicalHistoryQuestions",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RoleClaims",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Tokens",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserRoles",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MedicalHistories",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MedicalHistoryTemplates",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Roles",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Patients",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Students",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Sections",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Hospitals",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Universities",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Cities",
|
||||
schema: "public");
|
||||
}
|
||||
}
|
||||
}
|
1048
DocuMed.Repository/Migrations/20250112083704_UpdateStudentSetSectionIdNull.Designer.cs
generated
100644
1048
DocuMed.Repository/Migrations/20250112083704_UpdateStudentSetSectionIdNull.Designer.cs
generated
100644
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,68 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DocuMed.Repository.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class UpdateStudentSetSectionIdNull : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Students_Sections_SectionId",
|
||||
schema: "public",
|
||||
table: "Students");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "SectionId",
|
||||
schema: "public",
|
||||
table: "Students",
|
||||
type: "uuid",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Students_Sections_SectionId",
|
||||
schema: "public",
|
||||
table: "Students",
|
||||
column: "SectionId",
|
||||
principalSchema: "public",
|
||||
principalTable: "Sections",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Students_Sections_SectionId",
|
||||
schema: "public",
|
||||
table: "Students");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "SectionId",
|
||||
schema: "public",
|
||||
table: "Students",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Students_Sections_SectionId",
|
||||
schema: "public",
|
||||
table: "Students",
|
||||
column: "SectionId",
|
||||
principalSchema: "public",
|
||||
principalTable: "Sections",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,56 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DocuMed.Repository.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class EditUniAndSection : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Sections_Universities_UniversityId",
|
||||
schema: "public",
|
||||
table: "Sections");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Sections_UniversityId",
|
||||
schema: "public",
|
||||
table: "Sections");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UniversityId",
|
||||
schema: "public",
|
||||
table: "Sections");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "UniversityId",
|
||||
schema: "public",
|
||||
table: "Sections",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Sections_UniversityId",
|
||||
schema: "public",
|
||||
table: "Sections",
|
||||
column: "UniversityId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Sections_Universities_UniversityId",
|
||||
schema: "public",
|
||||
table: "Sections",
|
||||
column: "UniversityId",
|
||||
principalSchema: "public",
|
||||
principalTable: "Universities",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -7,8 +7,15 @@ public class MedicalHistoryRepository(ApplicationContext dbContext, ICurrentUser
|
|||
{
|
||||
if (!Guid.TryParse(CurrentUserService.UserId, out Guid userId))
|
||||
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
|
||||
.Where(t => t.ApplicationUserId == userId)
|
||||
.Where(t => t.StudentId == student.Id)
|
||||
.OrderByDescending(t => t.CreatedAt)
|
||||
.Skip(page * 15)
|
||||
.Take(15)
|
||||
|
@ -21,12 +28,20 @@ public class MedicalHistoryRepository(ApplicationContext dbContext, ICurrentUser
|
|||
{
|
||||
if (!Guid.TryParse(CurrentUserService.UserId, out Guid userId))
|
||||
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>();
|
||||
switch (dayQuery)
|
||||
{
|
||||
case DayQueryFilter.Today:
|
||||
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)
|
||||
.Skip(page * 15)
|
||||
.Take(15)
|
||||
|
@ -35,7 +50,7 @@ public class MedicalHistoryRepository(ApplicationContext dbContext, ICurrentUser
|
|||
break;
|
||||
case DayQueryFilter.Yesterday:
|
||||
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)
|
||||
.Skip(page * 15)
|
||||
.Take(15)
|
||||
|
@ -44,7 +59,7 @@ public class MedicalHistoryRepository(ApplicationContext dbContext, ICurrentUser
|
|||
break;
|
||||
case DayQueryFilter.Week:
|
||||
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)
|
||||
.Skip(page * 15)
|
||||
.Take(15)
|
||||
|
|
|
@ -7,8 +7,15 @@ public class MedicalHistoryTemplateRepository(ApplicationContext dbContext, ICur
|
|||
{
|
||||
if (!Guid.TryParse(CurrentUserService.UserId, out Guid userId))
|
||||
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
|
||||
.Where(t => t.ApplicationUserId == userId)
|
||||
.Where(t => t.StudentId == student.Id)
|
||||
.OrderByDescending(t => t.CreatedAt)
|
||||
.Skip(page * 15)
|
||||
.Take(15)
|
||||
|
|
Loading…
Reference in New Issue