add version 0.1.0.2

master
Amir Hossein Khademi 2023-10-28 23:57:28 +03:30
parent cc8aa32447
commit bb63cbab02
60 changed files with 2772 additions and 608 deletions

1
.version 100644
View File

@ -0,0 +1 @@
0.1.0.2

20
Dockerfile 100644
View File

@ -0,0 +1,20 @@
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
ENV ASPNETCORE_URLS=http://0.0.0.0:8010
WORKDIR /app
EXPOSE 8010
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["DocuMed.Api/DocuMed.Api.csproj", "DocuMed.Api/"]
RUN dotnet restore "DocuMed.Api/DocuMed.Api.csproj"
COPY . .
WORKDIR "/src/DocuMed.Api"
RUN dotnet build "DocuMed.Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "DocuMed.Api.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "DocuMed.Api.dll"]

View File

@ -1,7 +1,8 @@
{
"ConnectionStrings": {
"Postgres": "User ID=postgres;Password=root;Host=localhost;Port=5432;Database=iGarsonDB;",
"PostgresServer": "Host=pg-0,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=BrizcoDB;Load Balance Hosts=true;Target Session Attributes=primary;Application Name=iGLS"
"PostgresServer": "Host=pg-0;port=5432;Username=macsuser;Password=tDKUWlcm01iSh0O12oPqnVX1kwHQlAPks9qNC;Database=DocuMedDB",
"
},
"Logging": {
"LogLevel": {

View File

@ -0,0 +1,63 @@
using DocuMed.Domain.Entities.MedicalHistory;
namespace DocuMed.Api.Controllers;
public class MedicalHistoryController : ICarterModule
{
public virtual void AddRoutes(IEndpointRouteBuilder app)
{
var group = app.NewVersionedApi("MedicalHistory").MapGroup($"api/medicalhistory")
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
group.MapGet("", GetAllAsync)
.WithDisplayName("GetAll")
.HasApiVersion(1.0);
group.MapGet("{id}", GetAsync)
.WithDisplayName("GetOne")
.HasApiVersion(1.0);
group.MapPost("", Post)
.HasApiVersion(1.0);
group.MapPut("", Put)
.HasApiVersion(1.0);
group.MapDelete("", Delete)
.HasApiVersion(1.0);
}
// GET:Get All Entity
public virtual 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)
{
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)
{
return TypedResults.Ok(await service.AddAsync(dto, cancellationToken));
}
// PUT:Update Entity
public virtual async Task<IResult> Put([FromBody] MedicalHistoryLDto dto, IMedicalHistoryService service, ICurrentUserService currentUserService, CancellationToken cancellationToken)
{
return TypedResults.Ok(await service.EditAsync(dto, cancellationToken));
}
// DELETE:Delete Entity
public virtual async Task<IResult> Delete(int id, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken)
{
var ent = await repositoryWrapper.SetRepository<MedicalHistory>().GetByIdAsync(cancellationToken, id);
repositoryWrapper.SetRepository<MedicalHistory>().Delete(ent);
await repositoryWrapper.SaveChangesAsync(cancellationToken);
return TypedResults.Ok();
}
}

View File

@ -6,6 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
<AssemblyVersion>0.1.0.2</AssemblyVersion>
<FileVersion>0.1.0.2</FileVersion>
</PropertyGroup>
<ItemGroup>

View File

@ -39,11 +39,13 @@
<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" />

View File

@ -0,0 +1,8 @@
namespace DocuMed.Core.EntityServices.Abstracts;
public interface IMedicalHistoryService : IScopedDependency
{
public Task<bool> EditAsync(MedicalHistoryLDto template, CancellationToken cancellationToken);
public Task<bool> AddAsync(MedicalHistoryLDto template, CancellationToken cancellationToken);
}

View File

@ -0,0 +1,54 @@
namespace DocuMed.Core.EntityServices;
public class MedicalHistoryService : IMedicalHistoryService
{
private readonly IRepositoryWrapper _repositoryWrapper;
private readonly ICurrentUserService _currentUserService;
private readonly IMedicalHistoryRepository _medicalHistoryRepository;
public MedicalHistoryService(IRepositoryWrapper repositoryWrapper, ICurrentUserService currentUserService, IMedicalHistoryRepository medicalHistoryRepository)
{
_repositoryWrapper = repositoryWrapper;
_currentUserService = currentUserService;
_medicalHistoryRepository = medicalHistoryRepository;
}
public async Task<bool> EditAsync(MedicalHistoryLDto template, CancellationToken cancellationToken)
{
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
throw new AppException("دسترسی غیرمجاز", ApiResultStatusCode.UnAuthorized);
if (template.Id == Guid.Empty)
throw new AppException("شرح حال پیدا نشد", ApiResultStatusCode.NotFound);
var ent = MedicalHistory.Create(template.ChiefComplaint, template.SectionId, template.FirstName,
template.LastName, template.FatherName, template.NationalId, template.Temperature, template.BirthDate,
template.PresentIllnessDetail, template.PastDiseasesHistoryDetail, template.PastSurgeryHistoryDetail,
template.FamilyHistoryDetail, template.AllergyDetail, template.DrugHistoryDetail,
template.AddictionHistoryDetail, template.SystemReviewDetail, template.VitalSignDetail,
template.SystolicBloodPressure, template.DiastolicBloodPressure, template.PulseRate, template.SPO2,
template.Temperature, template.ApplicationUserId);
ent.Id = template.Id;
return true;
}
public async Task<bool> AddAsync(MedicalHistoryLDto 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.FirstName,
template.LastName, template.FatherName, template.NationalId, template.Temperature, template.BirthDate,
template.PresentIllnessDetail, template.PastDiseasesHistoryDetail, template.PastSurgeryHistoryDetail,
template.FamilyHistoryDetail, template.AllergyDetail, template.DrugHistoryDetail,
template.AddictionHistoryDetail, template.SystemReviewDetail, template.VitalSignDetail,
template.SystolicBloodPressure, template.DiastolicBloodPressure, template.PulseRate, template.SPO2,
template.Temperature, userId);
foreach (var answer in template.Answers)
ent.AddAnswer(answer.Answer, answer.Question, answer.Part, answer.QuestionType);
_medicalHistoryRepository.Add(ent);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return true;
}
}

View File

@ -41,7 +41,7 @@ public class MedicalHistoryTemplateService : IMedicalHistoryTemplateService
}
foreach (var question in template.Questions.Where(q=>q.Id==Guid.Empty))
ent.AddQuestion(question.Question, question.Part, question.QuestionType);
ent.AddQuestion(question.Question, question.Part, question.QuestionType,question.BodySystem,question.IsSign,question.IsSymptom);
_medicalHistoryTemplateRepository.Update(ent);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return true;
@ -53,7 +53,7 @@ public class MedicalHistoryTemplateService : IMedicalHistoryTemplateService
throw new AppException("توکن غیرمجاز", ApiResultStatusCode.UnAuthorized);
var ent = MedicalHistoryTemplate.Create(template.ChiefComplaint, template.SectionId, userId);
foreach (var question in template.Questions)
ent.AddQuestion(question.Question, question.Part, question.QuestionType);
ent.AddQuestion(question.Question, question.Part, question.QuestionType, question.BodySystem, question.IsSign, question.IsSymptom);
_medicalHistoryTemplateRepository.Add(ent);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return true;

View File

@ -3,7 +3,7 @@
public class MedicalHistoryLDto : BaseDto<MedicalHistoryLDto,MedicalHistory>
{
public string ChiefComplaint { get; set; } = string.Empty;
public string Section { get; set; } = string.Empty;
public Guid SectionId { get; set; }
public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
@ -21,6 +21,7 @@ public class MedicalHistoryLDto : BaseDto<MedicalHistoryLDto,MedicalHistory>
public string AddictionHistoryDetail { get; set; } = string.Empty;
public string SystemReviewDetail { get; set; } = string.Empty;
public string VitalSignDetail { get; set; } = string.Empty;
public string GeneralAppearanceDetail { get; set; } = string.Empty;
public int SystolicBloodPressure { get; set; }

View File

@ -15,6 +15,7 @@ public class ApplicationUserSDto : BaseDto<ApplicationUserSDto,ApplicationUser>
public SignUpStatus SignUpStatus { get; set; }
public Guid UniversityId { get; set; }
public Guid SectionId { get; set; }
public string SectionName { get; set; } = string.Empty;
public string FullName => FirstName + " " + LastName;

View File

@ -6,4 +6,8 @@ public class MedicalHistoryQuestionSDto : BaseDto<MedicalHistoryQuestionSDto,Med
public MedicalHistoryPart Part { get; set; }
public MedicalHistoryQuestionType QuestionType { get; set; }
public Guid MedicalHistoryTemplateId { get; set; }
public BodySystem BodySystem { get; set; }
public bool IsSign { get; set; }
public bool IsSymptom { get; set; }
}

View File

@ -3,7 +3,8 @@
public class MedicalHistorySDto : BaseDto<MedicalHistorySDto,MedicalHistory>
{
public string ChiefComplaint { get; set; } = string.Empty;
public string Section { get; set; } = string.Empty;
public Guid SectionId { get; set; }
public string SectionName { get; set; } = string.Empty;
public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;

View File

@ -3,6 +3,7 @@
public class MedicalHistoryTemplateSDto : BaseDto<MedicalHistoryTemplateSDto,MedicalHistoryTemplate>
{
public string ChiefComplaint { get; set; } = string.Empty;
public string SectionName { get; set; } = string.Empty;
public Guid SectionId { get; set; }
public Guid ApplicationUserId { get; set; }
}

View File

@ -23,7 +23,7 @@ public partial class MedicalHistory
}
public static MedicalHistory Create(
string chiefComplaint,
string section,
Guid sectionId,
string firstName,
string lastName,
string fatherName,
@ -55,8 +55,20 @@ public partial class MedicalHistory
addictionHistoryDetail,
systemReviewDetail,
vitalSignDetail,
chiefComplaint, section, firstName, lastName, fatherName, nationalId, age, birthDate, systolicBloodPressure,
diastolicBloodPressure, pulseRate, sPO2, temperature, applicationUserId);
chiefComplaint,
sectionId,
firstName,
lastName,
fatherName,
nationalId,
age,
birthDate,
systolicBloodPressure,
diastolicBloodPressure,
pulseRate,
sPO2,
temperature,
applicationUserId);
}
}

View File

@ -21,7 +21,7 @@ public partial class MedicalHistory : ApiEntity
string systemReviewDetail,
string vitalSignDetail,
string chiefComplaint,
string section,
Guid sectionId,
string firstName,
string lastName,
string fatherName,
@ -45,7 +45,7 @@ public partial class MedicalHistory : ApiEntity
SystemReviewDetail = systemReviewDetail;
VitalSignDetail = vitalSignDetail;
ChiefComplaint = chiefComplaint;
Section = section;
SectionId = sectionId;
FirstName = firstName;
LastName = lastName;
FatherName = fatherName;
@ -60,7 +60,8 @@ public partial class MedicalHistory : ApiEntity
ApplicationUserId = applicationUserId;
}
public string ChiefComplaint { get; internal set; } = string.Empty;
public string Section { get; internal set; } = string.Empty;
public Guid SectionId { get; internal set; }
public Section? Section { get; internal set; }
public string FirstName { get; internal set; } = string.Empty;
public string LastName { get; internal set; } = string.Empty;

View File

@ -8,23 +8,32 @@ public partial class MedicalHistoryQuestion : ApiEntity
{
}
public MedicalHistoryQuestion(
string question,
MedicalHistoryPart part,
MedicalHistoryQuestionType questionType,
Guid medicalHistoryTemplateId)
Guid medicalHistoryTemplateId,
BodySystem bodySystem,
bool isSign,
bool isSymptom)
{
Question = question;
Part = part;
QuestionType = questionType;
MedicalHistoryTemplateId = medicalHistoryTemplateId;
BodySystem = bodySystem;
IsSign = isSign;
IsSymptom = isSymptom;
}
public string Question { get; internal set; } = string.Empty;
public MedicalHistoryPart Part { get; internal set; }
public MedicalHistoryQuestionType QuestionType { get; internal set; }
public BodySystem BodySystem { get; internal set; }
public bool IsSign { get; internal set; }
public bool IsSymptom { get; internal set; }
public Guid MedicalHistoryTemplateId { get; internal set; }
public MedicalHistoryTemplate? MedicalHistoryTemplate { get; internal set; }
}

View File

@ -6,9 +6,12 @@ public partial class MedicalHistoryQuestion
string question,
MedicalHistoryPart part,
MedicalHistoryQuestionType questionType,
Guid medicalHistoryTemplateId)
Guid medicalHistoryTemplateId,
BodySystem bodySystem,
bool isSign,
bool isSymptom)
{
return new MedicalHistoryQuestion(question, part, questionType, medicalHistoryTemplateId);
return new MedicalHistoryQuestion(question, part, questionType, medicalHistoryTemplateId, bodySystem, isSign, isSymptom);
}
}
@ -17,14 +20,17 @@ public partial class MedicalHistoryTemplate
public MedicalHistoryQuestion AddQuestion(
string question,
MedicalHistoryPart part,
MedicalHistoryQuestionType questionType)
MedicalHistoryQuestionType questionType,
BodySystem bodySystem,
bool isSign,
bool isSymptom)
{
var mhQuestion = MedicalHistoryQuestion.Create(question, part, questionType, Id);
var mhQuestion = MedicalHistoryQuestion.Create(question, part, questionType, Id,bodySystem,isSign,isSymptom);
Questions.Add(mhQuestion);
return mhQuestion;
}
public static MedicalHistoryTemplate Create(string chiefComplaint,Guid sectionId,Guid applicationUserId)
public static MedicalHistoryTemplate Create(string chiefComplaint, Guid sectionId, Guid applicationUserId)
{
return new MedicalHistoryTemplate(chiefComplaint, sectionId, applicationUserId);
}

View File

@ -0,0 +1,47 @@
namespace DocuMed.Domain.Enums;
public enum BodySystem
{
[Display(Name = "پوست")]
Skin,
[Display(Name = "جمجمه")]
Skull,
[Display(Name = "گوش")]
Ear,
[Display(Name = "چشم")]
Eyes,
[Display(Name = "بینی")]
Nose,
[Display(Name = "دهان")]
Mouth,
[Display(Name = "گلو")]
Throat,
[Display(Name = "گردن")]
Neck,
[Display(Name = "غدد لنفاوی")]
LymphaticGlands,
[Display(Name = "قفسه سینه")]
Chest,
[Display(Name = "پستان")]
Breast,
[Display(Name = "قلب")]
Heart,
[Display(Name = "ریه")]
Lung,
[Display(Name = "عروق")]
Vessels,
[Display(Name = "شکم")]
Abdomen,
[Display(Name = "اندام تناسلی مذکر")]
GenitalOrganMale,
[Display(Name = "اندام تناسلی مؤنث")]
GenitalOrganFemale,
[Display(Name = "مقعد")]
Rectum,
[Display(Name = "اعصاب")]
NervousSystem,
[Display(Name = "اندام ها(فوقانی،تحتانی)")]
Extremities,
[Display(Name = "استخوان مفاصل عضلات")]
BoneJointsMuscles
}

View File

@ -17,7 +17,9 @@ public enum MedicalHistoryPart
[Display(Name = "مواد مصرفی")]
AddictionHistory,
[Display(Name = "بررسی سیستماتیک")]
SystemReview,
ReviewOfSystem,
[Display(Name = "علائم حیاتی")]
VitalSign,
[Display(Name = "ظاهر کلی بیمار")]
GeneralAppearance,
}

View File

@ -9,5 +9,7 @@ public enum MedicalHistoryQuestionType
[Display(Name = "بله و خیر")]
YesOrNo,
[Display(Name = "انتخابی")]
Selective
Selective,
[Display(Name = "انتخابی بررسی سیستم بدن")]
RosSelective
}

View File

@ -1,7 +1,9 @@
using System;
using System.Linq.Expressions;
using DocuMed.Domain.Dtos.SmallDtos;
using DocuMed.Domain.Entities.City;
using DocuMed.Domain.Entities.User;
using Mapster.Models;
namespace DocuMed.Domain.Mappers
{
@ -19,7 +21,13 @@ namespace DocuMed.Domain.Mappers
Gender = p1.Gender,
SignUpStatus = p1.SignUpStatus,
UniversityId = (Guid?)p1.UniversityId,
University = new University() {Id = p1.UniversityId},
SectionId = (Guid?)p1.SectionId,
Section = new Section()
{
Name = p1.SectionName,
Id = p1.SectionId
},
Id = p1.Id,
UserName = p1.UserName,
Email = p1.Email,
@ -43,7 +51,9 @@ namespace DocuMed.Domain.Mappers
result.Gender = p2.Gender;
result.SignUpStatus = p2.SignUpStatus;
result.UniversityId = (Guid?)p2.UniversityId;
result.University = funcMain1(new Never(), result.University, p2);
result.SectionId = (Guid?)p2.SectionId;
result.Section = funcMain2(new Never(), result.Section, p2);
result.Id = p2.Id;
result.UserName = p2.UserName;
result.Email = p2.Email;
@ -52,84 +62,112 @@ namespace DocuMed.Domain.Mappers
return result;
}
public static Expression<Func<ApplicationUserSDto, ApplicationUser>> ProjectToApplicationUser => p4 => new ApplicationUser()
{
FirstName = p4.FirstName,
LastName = p4.LastName,
NationalId = p4.NationalId,
StudentId = p4.StudentId,
BirthDate = p4.BirthDate,
Gender = p4.Gender,
SignUpStatus = p4.SignUpStatus,
UniversityId = (Guid?)p4.UniversityId,
SectionId = (Guid?)p4.SectionId,
Id = p4.Id,
UserName = p4.UserName,
Email = p4.Email,
PhoneNumber = p4.PhoneNumber,
PhoneNumberConfirmed = p4.PhoneNumberConfirmed
};
public static ApplicationUserSDto AdaptToSDto(this ApplicationUser p5)
{
return p5 == null ? null : new ApplicationUserSDto()
{
FirstName = p5.FirstName,
LastName = p5.LastName,
UserName = p5.UserName,
Email = p5.Email,
PhoneNumber = p5.PhoneNumber,
PhoneNumberConfirmed = p5.PhoneNumberConfirmed,
NationalId = p5.NationalId,
StudentId = p5.StudentId,
BirthDate = p5.BirthDate,
Gender = p5.Gender,
SignUpStatus = p5.SignUpStatus,
UniversityId = p5.UniversityId == null ? default(Guid) : (Guid)p5.UniversityId,
SectionId = p5.SectionId == null ? default(Guid) : (Guid)p5.SectionId,
Id = p5.Id
};
}
public static ApplicationUserSDto AdaptTo(this ApplicationUser p6, ApplicationUserSDto p7)
{
if (p6 == null)
{
return null;
}
ApplicationUserSDto result = p7 ?? new ApplicationUserSDto();
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.StudentId = p6.StudentId;
result.BirthDate = p6.BirthDate;
result.Gender = p6.Gender;
result.SignUpStatus = p6.SignUpStatus;
result.UniversityId = p6.UniversityId == null ? default(Guid) : (Guid)p6.UniversityId;
result.SectionId = p6.SectionId == null ? default(Guid) : (Guid)p6.SectionId;
result.Id = p6.Id;
return result;
}
public static Expression<Func<ApplicationUser, ApplicationUserSDto>> ProjectToSDto => p8 => new ApplicationUserSDto()
public static Expression<Func<ApplicationUserSDto, ApplicationUser>> ProjectToApplicationUser => p8 => new ApplicationUser()
{
FirstName = p8.FirstName,
LastName = p8.LastName,
UserName = p8.UserName,
Email = p8.Email,
PhoneNumber = p8.PhoneNumber,
PhoneNumberConfirmed = p8.PhoneNumberConfirmed,
NationalId = p8.NationalId,
StudentId = p8.StudentId,
BirthDate = p8.BirthDate,
Gender = p8.Gender,
SignUpStatus = p8.SignUpStatus,
UniversityId = p8.UniversityId == null ? default(Guid) : (Guid)p8.UniversityId,
SectionId = p8.SectionId == null ? default(Guid) : (Guid)p8.SectionId,
Id = p8.Id
UniversityId = (Guid?)p8.UniversityId,
University = new University() {Id = p8.UniversityId},
SectionId = (Guid?)p8.SectionId,
Section = new Section()
{
Name = p8.SectionName,
Id = p8.SectionId
},
Id = p8.Id,
UserName = p8.UserName,
Email = p8.Email,
PhoneNumber = p8.PhoneNumber,
PhoneNumberConfirmed = p8.PhoneNumberConfirmed
};
public static ApplicationUserSDto AdaptToSDto(this ApplicationUser p9)
{
return p9 == null ? null : new ApplicationUserSDto()
{
FirstName = p9.FirstName,
LastName = p9.LastName,
UserName = p9.UserName,
Email = p9.Email,
PhoneNumber = p9.PhoneNumber,
PhoneNumberConfirmed = p9.PhoneNumberConfirmed,
NationalId = p9.NationalId,
StudentId = p9.StudentId,
BirthDate = p9.BirthDate,
Gender = p9.Gender,
SignUpStatus = p9.SignUpStatus,
UniversityId = p9.UniversityId == null ? default(Guid) : (Guid)p9.UniversityId,
SectionId = p9.SectionId == null ? default(Guid) : (Guid)p9.SectionId,
SectionName = p9.Section != null ? p9.Section.Name : string.Empty,
Id = p9.Id
};
}
public static ApplicationUserSDto AdaptTo(this ApplicationUser p10, ApplicationUserSDto p11)
{
if (p10 == null)
{
return null;
}
ApplicationUserSDto result = p11 ?? new ApplicationUserSDto();
result.FirstName = p10.FirstName;
result.LastName = p10.LastName;
result.UserName = p10.UserName;
result.Email = p10.Email;
result.PhoneNumber = p10.PhoneNumber;
result.PhoneNumberConfirmed = p10.PhoneNumberConfirmed;
result.NationalId = p10.NationalId;
result.StudentId = p10.StudentId;
result.BirthDate = p10.BirthDate;
result.Gender = p10.Gender;
result.SignUpStatus = p10.SignUpStatus;
result.UniversityId = p10.UniversityId == null ? default(Guid) : (Guid)p10.UniversityId;
result.SectionId = p10.SectionId == null ? default(Guid) : (Guid)p10.SectionId;
result.SectionName = p10.Section != null ? p10.Section.Name : string.Empty;
result.Id = p10.Id;
return result;
}
public static Expression<Func<ApplicationUser, ApplicationUserSDto>> ProjectToSDto => p12 => new ApplicationUserSDto()
{
FirstName = p12.FirstName,
LastName = p12.LastName,
UserName = p12.UserName,
Email = p12.Email,
PhoneNumber = p12.PhoneNumber,
PhoneNumberConfirmed = p12.PhoneNumberConfirmed,
NationalId = p12.NationalId,
StudentId = p12.StudentId,
BirthDate = p12.BirthDate,
Gender = p12.Gender,
SignUpStatus = p12.SignUpStatus,
UniversityId = p12.UniversityId == null ? default(Guid) : (Guid)p12.UniversityId,
SectionId = p12.SectionId == null ? default(Guid) : (Guid)p12.SectionId,
SectionName = p12.Section != null ? p12.Section.Name : string.Empty,
Id = p12.Id
};
private static University funcMain1(Never p4, University p5, ApplicationUserSDto p2)
{
University result = p5 ?? new University();
result.Id = p2.UniversityId;
return result;
}
private static Section funcMain2(Never p6, Section p7, ApplicationUserSDto p2)
{
Section result = p7 ?? new Section();
result.Name = p2.SectionName;
result.Id = p2.SectionId;
return result;
}
}
}

View File

@ -4,7 +4,10 @@ using System.Linq;
using System.Linq.Expressions;
using DocuMed.Domain.Dtos.LargDtos;
using DocuMed.Domain.Dtos.SmallDtos;
using DocuMed.Domain.Entities.City;
using DocuMed.Domain.Entities.MedicalHistory;
using DocuMed.Domain.Entities.User;
using Mapster.Models;
namespace DocuMed.Domain.Mappers
{
@ -15,7 +18,12 @@ namespace DocuMed.Domain.Mappers
return p1 == null ? null : new MedicalHistory()
{
ChiefComplaint = p1.ChiefComplaint,
Section = p1.Section,
SectionId = p1.SectionId,
Section = new Section()
{
Name = p1.SectionName,
Id = p1.SectionId
},
FirstName = p1.FirstName,
LastName = p1.LastName,
FatherName = p1.FatherName,
@ -37,6 +45,7 @@ namespace DocuMed.Domain.Mappers
SPO2 = p1.SPO2,
Temperature = p1.Temperature,
ApplicationUserId = p1.ApplicationUserId,
ApplicationUser = new ApplicationUser() {Id = p1.ApplicationUserId},
Id = p1.Id
};
}
@ -49,7 +58,8 @@ namespace DocuMed.Domain.Mappers
MedicalHistory result = p3 ?? new MedicalHistory();
result.ChiefComplaint = p2.ChiefComplaint;
result.Section = p2.Section;
result.SectionId = p2.SectionId;
result.Section = funcMain1(new Never(), result.Section, p2);
result.FirstName = p2.FirstName;
result.LastName = p2.LastName;
result.FatherName = p2.FatherName;
@ -71,106 +81,20 @@ namespace DocuMed.Domain.Mappers
result.SPO2 = p2.SPO2;
result.Temperature = p2.Temperature;
result.ApplicationUserId = p2.ApplicationUserId;
result.ApplicationUser = funcMain2(new Never(), result.ApplicationUser, p2);
result.Id = p2.Id;
return result;
}
public static Expression<Func<MedicalHistorySDto, MedicalHistory>> ProjectToMedicalHistory => p4 => new MedicalHistory()
{
ChiefComplaint = p4.ChiefComplaint,
Section = p4.Section,
FirstName = p4.FirstName,
LastName = p4.LastName,
FatherName = p4.FatherName,
NationalId = p4.NationalId,
Age = p4.Age,
BirthDate = p4.BirthDate,
PresentIllnessDetail = p4.PresentIllnessDetail,
PastDiseasesHistoryDetail = p4.PastDiseasesHistoryDetail,
PastSurgeryHistoryDetail = p4.PastSurgeryHistoryDetail,
FamilyHistoryDetail = p4.FamilyHistoryDetail,
AllergyDetail = p4.AllergyDetail,
DrugHistoryDetail = p4.DrugHistoryDetail,
AddictionHistoryDetail = p4.AddictionHistoryDetail,
SystemReviewDetail = p4.SystemReviewDetail,
VitalSignDetail = p4.VitalSignDetail,
SystolicBloodPressure = p4.SystolicBloodPressure,
DiastolicBloodPressure = p4.DiastolicBloodPressure,
PulseRate = p4.PulseRate,
SPO2 = p4.SPO2,
Temperature = p4.Temperature,
ApplicationUserId = p4.ApplicationUserId,
Id = p4.Id
};
public static MedicalHistorySDto AdaptToSDto(this MedicalHistory p5)
{
return p5 == null ? null : new MedicalHistorySDto()
{
ChiefComplaint = p5.ChiefComplaint,
Section = p5.Section,
FirstName = p5.FirstName,
LastName = p5.LastName,
FatherName = p5.FatherName,
NationalId = p5.NationalId,
Age = p5.Age,
BirthDate = p5.BirthDate,
PresentIllnessDetail = p5.PresentIllnessDetail,
PastDiseasesHistoryDetail = p5.PastDiseasesHistoryDetail,
PastSurgeryHistoryDetail = p5.PastSurgeryHistoryDetail,
FamilyHistoryDetail = p5.FamilyHistoryDetail,
AllergyDetail = p5.AllergyDetail,
DrugHistoryDetail = p5.DrugHistoryDetail,
AddictionHistoryDetail = p5.AddictionHistoryDetail,
SystemReviewDetail = p5.SystemReviewDetail,
VitalSignDetail = p5.VitalSignDetail,
SystolicBloodPressure = p5.SystolicBloodPressure,
DiastolicBloodPressure = p5.DiastolicBloodPressure,
PulseRate = p5.PulseRate,
SPO2 = p5.SPO2,
Temperature = p5.Temperature,
ApplicationUserId = p5.ApplicationUserId,
Id = p5.Id
};
}
public static MedicalHistorySDto AdaptTo(this MedicalHistory p6, MedicalHistorySDto p7)
{
if (p6 == null)
{
return null;
}
MedicalHistorySDto result = p7 ?? new MedicalHistorySDto();
result.ChiefComplaint = p6.ChiefComplaint;
result.Section = p6.Section;
result.FirstName = p6.FirstName;
result.LastName = p6.LastName;
result.FatherName = p6.FatherName;
result.NationalId = p6.NationalId;
result.Age = p6.Age;
result.BirthDate = p6.BirthDate;
result.PresentIllnessDetail = p6.PresentIllnessDetail;
result.PastDiseasesHistoryDetail = p6.PastDiseasesHistoryDetail;
result.PastSurgeryHistoryDetail = p6.PastSurgeryHistoryDetail;
result.FamilyHistoryDetail = p6.FamilyHistoryDetail;
result.AllergyDetail = p6.AllergyDetail;
result.DrugHistoryDetail = p6.DrugHistoryDetail;
result.AddictionHistoryDetail = p6.AddictionHistoryDetail;
result.SystemReviewDetail = p6.SystemReviewDetail;
result.VitalSignDetail = p6.VitalSignDetail;
result.SystolicBloodPressure = p6.SystolicBloodPressure;
result.DiastolicBloodPressure = p6.DiastolicBloodPressure;
result.PulseRate = p6.PulseRate;
result.SPO2 = p6.SPO2;
result.Temperature = p6.Temperature;
result.ApplicationUserId = p6.ApplicationUserId;
result.Id = p6.Id;
return result;
}
public static Expression<Func<MedicalHistory, MedicalHistorySDto>> ProjectToSDto => p8 => new MedicalHistorySDto()
public static Expression<Func<MedicalHistorySDto, MedicalHistory>> ProjectToMedicalHistory => p8 => new MedicalHistory()
{
ChiefComplaint = p8.ChiefComplaint,
Section = p8.Section,
SectionId = p8.SectionId,
Section = new Section()
{
Name = p8.SectionName,
Id = p8.SectionId
},
FirstName = p8.FirstName,
LastName = p8.LastName,
FatherName = p8.FatherName,
@ -192,14 +116,16 @@ namespace DocuMed.Domain.Mappers
SPO2 = p8.SPO2,
Temperature = p8.Temperature,
ApplicationUserId = p8.ApplicationUserId,
ApplicationUser = new ApplicationUser() {Id = p8.ApplicationUserId},
Id = p8.Id
};
public static MedicalHistory AdaptToMedicalHistory(this MedicalHistoryLDto p9)
public static MedicalHistorySDto AdaptToSDto(this MedicalHistory p9)
{
return p9 == null ? null : new MedicalHistory()
return p9 == null ? null : new MedicalHistorySDto()
{
ChiefComplaint = p9.ChiefComplaint,
Section = p9.Section,
SectionId = p9.SectionId,
SectionName = p9.Section != null ? p9.Section.Name : string.Empty,
FirstName = p9.FirstName,
LastName = p9.LastName,
FatherName = p9.FatherName,
@ -221,200 +147,313 @@ namespace DocuMed.Domain.Mappers
SPO2 = p9.SPO2,
Temperature = p9.Temperature,
ApplicationUserId = p9.ApplicationUserId,
Answers = funcMain1(p9.Answers),
Id = p9.Id
};
}
public static MedicalHistory AdaptTo(this MedicalHistoryLDto p11, MedicalHistory p12)
{
if (p11 == null)
{
return null;
}
MedicalHistory result = p12 ?? new MedicalHistory();
result.ChiefComplaint = p11.ChiefComplaint;
result.Section = p11.Section;
result.FirstName = p11.FirstName;
result.LastName = p11.LastName;
result.FatherName = p11.FatherName;
result.NationalId = p11.NationalId;
result.Age = p11.Age;
result.BirthDate = p11.BirthDate;
result.PresentIllnessDetail = p11.PresentIllnessDetail;
result.PastDiseasesHistoryDetail = p11.PastDiseasesHistoryDetail;
result.PastSurgeryHistoryDetail = p11.PastSurgeryHistoryDetail;
result.FamilyHistoryDetail = p11.FamilyHistoryDetail;
result.AllergyDetail = p11.AllergyDetail;
result.DrugHistoryDetail = p11.DrugHistoryDetail;
result.AddictionHistoryDetail = p11.AddictionHistoryDetail;
result.SystemReviewDetail = p11.SystemReviewDetail;
result.VitalSignDetail = p11.VitalSignDetail;
result.SystolicBloodPressure = p11.SystolicBloodPressure;
result.DiastolicBloodPressure = p11.DiastolicBloodPressure;
result.PulseRate = p11.PulseRate;
result.SPO2 = p11.SPO2;
result.Temperature = p11.Temperature;
result.ApplicationUserId = p11.ApplicationUserId;
result.Answers = funcMain2(p11.Answers, result.Answers);
result.Id = p11.Id;
return result;
}
public static Expression<Func<MedicalHistoryLDto, MedicalHistory>> ProjectLDtoToMedicalHistory => p15 => new MedicalHistory()
{
ChiefComplaint = p15.ChiefComplaint,
Section = p15.Section,
FirstName = p15.FirstName,
LastName = p15.LastName,
FatherName = p15.FatherName,
NationalId = p15.NationalId,
Age = p15.Age,
BirthDate = p15.BirthDate,
PresentIllnessDetail = p15.PresentIllnessDetail,
PastDiseasesHistoryDetail = p15.PastDiseasesHistoryDetail,
PastSurgeryHistoryDetail = p15.PastSurgeryHistoryDetail,
FamilyHistoryDetail = p15.FamilyHistoryDetail,
AllergyDetail = p15.AllergyDetail,
DrugHistoryDetail = p15.DrugHistoryDetail,
AddictionHistoryDetail = p15.AddictionHistoryDetail,
SystemReviewDetail = p15.SystemReviewDetail,
VitalSignDetail = p15.VitalSignDetail,
SystolicBloodPressure = p15.SystolicBloodPressure,
DiastolicBloodPressure = p15.DiastolicBloodPressure,
PulseRate = p15.PulseRate,
SPO2 = p15.SPO2,
Temperature = p15.Temperature,
ApplicationUserId = p15.ApplicationUserId,
Answers = p15.Answers.Select<MedicalHistoryAnswerSDto, MedicalHistoryAnswer>(p16 => new MedicalHistoryAnswer()
{
Answer = p16.Answer,
Question = p16.Question,
Part = p16.Part,
QuestionType = p16.QuestionType,
MedicalHistoryId = p16.MedicalHistoryId,
Id = p16.Id
}).ToList<MedicalHistoryAnswer>(),
Id = p15.Id
};
public static MedicalHistoryLDto AdaptToLDto(this MedicalHistory p17)
{
return p17 == null ? null : new MedicalHistoryLDto()
{
ChiefComplaint = p17.ChiefComplaint,
Section = p17.Section,
FirstName = p17.FirstName,
LastName = p17.LastName,
FatherName = p17.FatherName,
NationalId = p17.NationalId,
Age = p17.Age,
BirthDate = p17.BirthDate,
PresentIllnessDetail = p17.PresentIllnessDetail,
PastDiseasesHistoryDetail = p17.PastDiseasesHistoryDetail,
PastSurgeryHistoryDetail = p17.PastSurgeryHistoryDetail,
FamilyHistoryDetail = p17.FamilyHistoryDetail,
AllergyDetail = p17.AllergyDetail,
DrugHistoryDetail = p17.DrugHistoryDetail,
AddictionHistoryDetail = p17.AddictionHistoryDetail,
SystemReviewDetail = p17.SystemReviewDetail,
VitalSignDetail = p17.VitalSignDetail,
SystolicBloodPressure = p17.SystolicBloodPressure,
DiastolicBloodPressure = p17.DiastolicBloodPressure,
PulseRate = p17.PulseRate,
SPO2 = p17.SPO2,
Temperature = p17.Temperature,
ApplicationUserId = p17.ApplicationUserId,
Answers = funcMain3(p17.Answers),
Id = p17.Id
};
}
public static MedicalHistoryLDto AdaptTo(this MedicalHistory p19, MedicalHistoryLDto p20)
{
if (p19 == null)
{
return null;
}
MedicalHistoryLDto result = p20 ?? new MedicalHistoryLDto();
result.ChiefComplaint = p19.ChiefComplaint;
result.Section = p19.Section;
result.FirstName = p19.FirstName;
result.LastName = p19.LastName;
result.FatherName = p19.FatherName;
result.NationalId = p19.NationalId;
result.Age = p19.Age;
result.BirthDate = p19.BirthDate;
result.PresentIllnessDetail = p19.PresentIllnessDetail;
result.PastDiseasesHistoryDetail = p19.PastDiseasesHistoryDetail;
result.PastSurgeryHistoryDetail = p19.PastSurgeryHistoryDetail;
result.FamilyHistoryDetail = p19.FamilyHistoryDetail;
result.AllergyDetail = p19.AllergyDetail;
result.DrugHistoryDetail = p19.DrugHistoryDetail;
result.AddictionHistoryDetail = p19.AddictionHistoryDetail;
result.SystemReviewDetail = p19.SystemReviewDetail;
result.VitalSignDetail = p19.VitalSignDetail;
result.SystolicBloodPressure = p19.SystolicBloodPressure;
result.DiastolicBloodPressure = p19.DiastolicBloodPressure;
result.PulseRate = p19.PulseRate;
result.SPO2 = p19.SPO2;
result.Temperature = p19.Temperature;
result.ApplicationUserId = p19.ApplicationUserId;
result.Answers = funcMain4(p19.Answers, result.Answers);
result.Id = p19.Id;
return result;
}
public static Expression<Func<MedicalHistory, MedicalHistoryLDto>> ProjectToLDto => p23 => new MedicalHistoryLDto()
{
ChiefComplaint = p23.ChiefComplaint,
Section = p23.Section,
FirstName = p23.FirstName,
LastName = p23.LastName,
FatherName = p23.FatherName,
NationalId = p23.NationalId,
Age = p23.Age,
BirthDate = p23.BirthDate,
PresentIllnessDetail = p23.PresentIllnessDetail,
PastDiseasesHistoryDetail = p23.PastDiseasesHistoryDetail,
PastSurgeryHistoryDetail = p23.PastSurgeryHistoryDetail,
FamilyHistoryDetail = p23.FamilyHistoryDetail,
AllergyDetail = p23.AllergyDetail,
DrugHistoryDetail = p23.DrugHistoryDetail,
AddictionHistoryDetail = p23.AddictionHistoryDetail,
SystemReviewDetail = p23.SystemReviewDetail,
VitalSignDetail = p23.VitalSignDetail,
SystolicBloodPressure = p23.SystolicBloodPressure,
DiastolicBloodPressure = p23.DiastolicBloodPressure,
PulseRate = p23.PulseRate,
SPO2 = p23.SPO2,
Temperature = p23.Temperature,
ApplicationUserId = p23.ApplicationUserId,
Answers = p23.Answers.Select<MedicalHistoryAnswer, MedicalHistoryAnswerSDto>(p24 => new MedicalHistoryAnswerSDto()
{
Answer = p24.Answer,
Question = p24.Question,
Part = p24.Part,
QuestionType = p24.QuestionType,
MedicalHistoryId = p24.MedicalHistoryId,
Id = p24.Id
}).ToList<MedicalHistoryAnswerSDto>(),
Id = p23.Id
};
private static List<MedicalHistoryAnswer> funcMain1(List<MedicalHistoryAnswerSDto> p10)
public static MedicalHistorySDto AdaptTo(this MedicalHistory p10, MedicalHistorySDto p11)
{
if (p10 == null)
{
return null;
}
List<MedicalHistoryAnswer> result = new List<MedicalHistoryAnswer>(p10.Count);
MedicalHistorySDto result = p11 ?? new MedicalHistorySDto();
result.ChiefComplaint = p10.ChiefComplaint;
result.SectionId = p10.SectionId;
result.SectionName = p10.Section != null ? p10.Section.Name : string.Empty;
result.FirstName = p10.FirstName;
result.LastName = p10.LastName;
result.FatherName = p10.FatherName;
result.NationalId = p10.NationalId;
result.Age = p10.Age;
result.BirthDate = p10.BirthDate;
result.PresentIllnessDetail = p10.PresentIllnessDetail;
result.PastDiseasesHistoryDetail = p10.PastDiseasesHistoryDetail;
result.PastSurgeryHistoryDetail = p10.PastSurgeryHistoryDetail;
result.FamilyHistoryDetail = p10.FamilyHistoryDetail;
result.AllergyDetail = p10.AllergyDetail;
result.DrugHistoryDetail = p10.DrugHistoryDetail;
result.AddictionHistoryDetail = p10.AddictionHistoryDetail;
result.SystemReviewDetail = p10.SystemReviewDetail;
result.VitalSignDetail = p10.VitalSignDetail;
result.SystolicBloodPressure = p10.SystolicBloodPressure;
result.DiastolicBloodPressure = p10.DiastolicBloodPressure;
result.PulseRate = p10.PulseRate;
result.SPO2 = p10.SPO2;
result.Temperature = p10.Temperature;
result.ApplicationUserId = p10.ApplicationUserId;
result.Id = p10.Id;
return result;
}
public static Expression<Func<MedicalHistory, MedicalHistorySDto>> ProjectToSDto => p12 => new MedicalHistorySDto()
{
ChiefComplaint = p12.ChiefComplaint,
SectionId = p12.SectionId,
SectionName = p12.Section != null ? p12.Section.Name : string.Empty,
FirstName = p12.FirstName,
LastName = p12.LastName,
FatherName = p12.FatherName,
NationalId = p12.NationalId,
Age = p12.Age,
BirthDate = p12.BirthDate,
PresentIllnessDetail = p12.PresentIllnessDetail,
PastDiseasesHistoryDetail = p12.PastDiseasesHistoryDetail,
PastSurgeryHistoryDetail = p12.PastSurgeryHistoryDetail,
FamilyHistoryDetail = p12.FamilyHistoryDetail,
AllergyDetail = p12.AllergyDetail,
DrugHistoryDetail = p12.DrugHistoryDetail,
AddictionHistoryDetail = p12.AddictionHistoryDetail,
SystemReviewDetail = p12.SystemReviewDetail,
VitalSignDetail = p12.VitalSignDetail,
SystolicBloodPressure = p12.SystolicBloodPressure,
DiastolicBloodPressure = p12.DiastolicBloodPressure,
PulseRate = p12.PulseRate,
SPO2 = p12.SPO2,
Temperature = p12.Temperature,
ApplicationUserId = p12.ApplicationUserId,
Id = p12.Id
};
public static MedicalHistory AdaptToMedicalHistory(this MedicalHistoryLDto p13)
{
return p13 == null ? null : new MedicalHistory()
{
ChiefComplaint = p13.ChiefComplaint,
SectionId = p13.SectionId,
FirstName = p13.FirstName,
LastName = p13.LastName,
FatherName = p13.FatherName,
NationalId = p13.NationalId,
Age = p13.Age,
BirthDate = p13.BirthDate,
PresentIllnessDetail = p13.PresentIllnessDetail,
PastDiseasesHistoryDetail = p13.PastDiseasesHistoryDetail,
PastSurgeryHistoryDetail = p13.PastSurgeryHistoryDetail,
FamilyHistoryDetail = p13.FamilyHistoryDetail,
AllergyDetail = p13.AllergyDetail,
DrugHistoryDetail = p13.DrugHistoryDetail,
AddictionHistoryDetail = p13.AddictionHistoryDetail,
SystemReviewDetail = p13.SystemReviewDetail,
VitalSignDetail = p13.VitalSignDetail,
SystolicBloodPressure = p13.SystolicBloodPressure,
DiastolicBloodPressure = p13.DiastolicBloodPressure,
PulseRate = p13.PulseRate,
SPO2 = p13.SPO2,
Temperature = p13.Temperature,
ApplicationUserId = p13.ApplicationUserId,
Answers = funcMain3(p13.Answers),
Id = p13.Id
};
}
public static MedicalHistory AdaptTo(this MedicalHistoryLDto p15, MedicalHistory p16)
{
if (p15 == null)
{
return null;
}
MedicalHistory result = p16 ?? new MedicalHistory();
result.ChiefComplaint = p15.ChiefComplaint;
result.SectionId = p15.SectionId;
result.FirstName = p15.FirstName;
result.LastName = p15.LastName;
result.FatherName = p15.FatherName;
result.NationalId = p15.NationalId;
result.Age = p15.Age;
result.BirthDate = p15.BirthDate;
result.PresentIllnessDetail = p15.PresentIllnessDetail;
result.PastDiseasesHistoryDetail = p15.PastDiseasesHistoryDetail;
result.PastSurgeryHistoryDetail = p15.PastSurgeryHistoryDetail;
result.FamilyHistoryDetail = p15.FamilyHistoryDetail;
result.AllergyDetail = p15.AllergyDetail;
result.DrugHistoryDetail = p15.DrugHistoryDetail;
result.AddictionHistoryDetail = p15.AddictionHistoryDetail;
result.SystemReviewDetail = p15.SystemReviewDetail;
result.VitalSignDetail = p15.VitalSignDetail;
result.SystolicBloodPressure = p15.SystolicBloodPressure;
result.DiastolicBloodPressure = p15.DiastolicBloodPressure;
result.PulseRate = p15.PulseRate;
result.SPO2 = p15.SPO2;
result.Temperature = p15.Temperature;
result.ApplicationUserId = p15.ApplicationUserId;
result.Answers = funcMain4(p15.Answers, result.Answers);
result.Id = p15.Id;
return result;
}
public static Expression<Func<MedicalHistoryLDto, MedicalHistory>> ProjectLDtoToMedicalHistory => p19 => new MedicalHistory()
{
ChiefComplaint = p19.ChiefComplaint,
SectionId = p19.SectionId,
FirstName = p19.FirstName,
LastName = p19.LastName,
FatherName = p19.FatherName,
NationalId = p19.NationalId,
Age = p19.Age,
BirthDate = p19.BirthDate,
PresentIllnessDetail = p19.PresentIllnessDetail,
PastDiseasesHistoryDetail = p19.PastDiseasesHistoryDetail,
PastSurgeryHistoryDetail = p19.PastSurgeryHistoryDetail,
FamilyHistoryDetail = p19.FamilyHistoryDetail,
AllergyDetail = p19.AllergyDetail,
DrugHistoryDetail = p19.DrugHistoryDetail,
AddictionHistoryDetail = p19.AddictionHistoryDetail,
SystemReviewDetail = p19.SystemReviewDetail,
VitalSignDetail = p19.VitalSignDetail,
SystolicBloodPressure = p19.SystolicBloodPressure,
DiastolicBloodPressure = p19.DiastolicBloodPressure,
PulseRate = p19.PulseRate,
SPO2 = p19.SPO2,
Temperature = p19.Temperature,
ApplicationUserId = p19.ApplicationUserId,
Answers = p19.Answers.Select<MedicalHistoryAnswerSDto, MedicalHistoryAnswer>(p20 => new MedicalHistoryAnswer()
{
Answer = p20.Answer,
Question = p20.Question,
Part = p20.Part,
QuestionType = p20.QuestionType,
MedicalHistoryId = p20.MedicalHistoryId,
Id = p20.Id
}).ToList<MedicalHistoryAnswer>(),
Id = p19.Id
};
public static MedicalHistoryLDto AdaptToLDto(this MedicalHistory p21)
{
return p21 == null ? null : new MedicalHistoryLDto()
{
ChiefComplaint = p21.ChiefComplaint,
SectionId = 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,
FamilyHistoryDetail = p21.FamilyHistoryDetail,
AllergyDetail = p21.AllergyDetail,
DrugHistoryDetail = p21.DrugHistoryDetail,
AddictionHistoryDetail = p21.AddictionHistoryDetail,
SystemReviewDetail = p21.SystemReviewDetail,
VitalSignDetail = p21.VitalSignDetail,
SystolicBloodPressure = p21.SystolicBloodPressure,
DiastolicBloodPressure = p21.DiastolicBloodPressure,
PulseRate = p21.PulseRate,
SPO2 = p21.SPO2,
Temperature = p21.Temperature,
ApplicationUserId = p21.ApplicationUserId,
Answers = funcMain5(p21.Answers),
Id = p21.Id
};
}
public static MedicalHistoryLDto AdaptTo(this MedicalHistory p23, MedicalHistoryLDto p24)
{
if (p23 == null)
{
return null;
}
MedicalHistoryLDto result = p24 ?? new MedicalHistoryLDto();
result.ChiefComplaint = p23.ChiefComplaint;
result.SectionId = p23.SectionId;
result.FirstName = p23.FirstName;
result.LastName = p23.LastName;
result.FatherName = p23.FatherName;
result.NationalId = p23.NationalId;
result.Age = p23.Age;
result.BirthDate = p23.BirthDate;
result.PresentIllnessDetail = p23.PresentIllnessDetail;
result.PastDiseasesHistoryDetail = p23.PastDiseasesHistoryDetail;
result.PastSurgeryHistoryDetail = p23.PastSurgeryHistoryDetail;
result.FamilyHistoryDetail = p23.FamilyHistoryDetail;
result.AllergyDetail = p23.AllergyDetail;
result.DrugHistoryDetail = p23.DrugHistoryDetail;
result.AddictionHistoryDetail = p23.AddictionHistoryDetail;
result.SystemReviewDetail = p23.SystemReviewDetail;
result.VitalSignDetail = p23.VitalSignDetail;
result.SystolicBloodPressure = p23.SystolicBloodPressure;
result.DiastolicBloodPressure = p23.DiastolicBloodPressure;
result.PulseRate = p23.PulseRate;
result.SPO2 = p23.SPO2;
result.Temperature = p23.Temperature;
result.ApplicationUserId = p23.ApplicationUserId;
result.Answers = funcMain6(p23.Answers, result.Answers);
result.Id = p23.Id;
return result;
}
public static Expression<Func<MedicalHistory, MedicalHistoryLDto>> ProjectToLDto => p27 => new MedicalHistoryLDto()
{
ChiefComplaint = p27.ChiefComplaint,
SectionId = p27.SectionId,
FirstName = p27.FirstName,
LastName = p27.LastName,
FatherName = p27.FatherName,
NationalId = p27.NationalId,
Age = p27.Age,
BirthDate = p27.BirthDate,
PresentIllnessDetail = p27.PresentIllnessDetail,
PastDiseasesHistoryDetail = p27.PastDiseasesHistoryDetail,
PastSurgeryHistoryDetail = p27.PastSurgeryHistoryDetail,
FamilyHistoryDetail = p27.FamilyHistoryDetail,
AllergyDetail = p27.AllergyDetail,
DrugHistoryDetail = p27.DrugHistoryDetail,
AddictionHistoryDetail = p27.AddictionHistoryDetail,
SystemReviewDetail = p27.SystemReviewDetail,
VitalSignDetail = p27.VitalSignDetail,
SystolicBloodPressure = p27.SystolicBloodPressure,
DiastolicBloodPressure = p27.DiastolicBloodPressure,
PulseRate = p27.PulseRate,
SPO2 = p27.SPO2,
Temperature = p27.Temperature,
ApplicationUserId = p27.ApplicationUserId,
Answers = p27.Answers.Select<MedicalHistoryAnswer, MedicalHistoryAnswerSDto>(p28 => new MedicalHistoryAnswerSDto()
{
Answer = p28.Answer,
Question = p28.Question,
Part = p28.Part,
QuestionType = p28.QuestionType,
MedicalHistoryId = p28.MedicalHistoryId,
Id = p28.Id
}).ToList<MedicalHistoryAnswerSDto>(),
Id = p27.Id
};
private static Section funcMain1(Never p4, Section p5, MedicalHistorySDto p2)
{
Section result = p5 ?? new Section();
result.Name = p2.SectionName;
result.Id = p2.SectionId;
return result;
}
private static ApplicationUser funcMain2(Never p6, ApplicationUser p7, MedicalHistorySDto p2)
{
ApplicationUser result = p7 ?? new ApplicationUser();
result.Id = p2.ApplicationUserId;
return result;
}
private static List<MedicalHistoryAnswer> funcMain3(List<MedicalHistoryAnswerSDto> p14)
{
if (p14 == null)
{
return null;
}
List<MedicalHistoryAnswer> result = new List<MedicalHistoryAnswer>(p14.Count);
int i = 0;
int len = p10.Count;
int len = p14.Count;
while (i < len)
{
MedicalHistoryAnswerSDto item = p10[i];
MedicalHistoryAnswerSDto item = p14[i];
result.Add(item == null ? null : new MedicalHistoryAnswer()
{
Answer = item.Answer,
@ -430,20 +469,20 @@ namespace DocuMed.Domain.Mappers
}
private static List<MedicalHistoryAnswer> funcMain2(List<MedicalHistoryAnswerSDto> p13, List<MedicalHistoryAnswer> p14)
private static List<MedicalHistoryAnswer> funcMain4(List<MedicalHistoryAnswerSDto> p17, List<MedicalHistoryAnswer> p18)
{
if (p13 == null)
if (p17 == null)
{
return null;
}
List<MedicalHistoryAnswer> result = new List<MedicalHistoryAnswer>(p13.Count);
List<MedicalHistoryAnswer> result = new List<MedicalHistoryAnswer>(p17.Count);
int i = 0;
int len = p13.Count;
int len = p17.Count;
while (i < len)
{
MedicalHistoryAnswerSDto item = p13[i];
MedicalHistoryAnswerSDto item = p17[i];
result.Add(item == null ? null : new MedicalHistoryAnswer()
{
Answer = item.Answer,
@ -459,20 +498,20 @@ namespace DocuMed.Domain.Mappers
}
private static List<MedicalHistoryAnswerSDto> funcMain3(List<MedicalHistoryAnswer> p18)
private static List<MedicalHistoryAnswerSDto> funcMain5(List<MedicalHistoryAnswer> p22)
{
if (p18 == null)
if (p22 == null)
{
return null;
}
List<MedicalHistoryAnswerSDto> result = new List<MedicalHistoryAnswerSDto>(p18.Count);
List<MedicalHistoryAnswerSDto> result = new List<MedicalHistoryAnswerSDto>(p22.Count);
int i = 0;
int len = p18.Count;
int len = p22.Count;
while (i < len)
{
MedicalHistoryAnswer item = p18[i];
MedicalHistoryAnswer item = p22[i];
result.Add(item == null ? null : new MedicalHistoryAnswerSDto()
{
Answer = item.Answer,
@ -488,20 +527,20 @@ namespace DocuMed.Domain.Mappers
}
private static List<MedicalHistoryAnswerSDto> funcMain4(List<MedicalHistoryAnswer> p21, List<MedicalHistoryAnswerSDto> p22)
private static List<MedicalHistoryAnswerSDto> funcMain6(List<MedicalHistoryAnswer> p25, List<MedicalHistoryAnswerSDto> p26)
{
if (p21 == null)
if (p25 == null)
{
return null;
}
List<MedicalHistoryAnswerSDto> result = new List<MedicalHistoryAnswerSDto>(p21.Count);
List<MedicalHistoryAnswerSDto> result = new List<MedicalHistoryAnswerSDto>(p25.Count);
int i = 0;
int len = p21.Count;
int len = p25.Count;
while (i < len)
{
MedicalHistoryAnswer item = p21[i];
MedicalHistoryAnswer item = p25[i];
result.Add(item == null ? null : new MedicalHistoryAnswerSDto()
{
Answer = item.Answer,

View File

@ -14,6 +14,9 @@ namespace DocuMed.Domain.Mappers
Question = p1.Question,
Part = p1.Part,
QuestionType = p1.QuestionType,
BodySystem = p1.BodySystem,
IsSign = p1.IsSign,
IsSymptom = p1.IsSymptom,
MedicalHistoryTemplateId = p1.MedicalHistoryTemplateId,
Id = p1.Id
};
@ -29,6 +32,9 @@ namespace DocuMed.Domain.Mappers
result.Question = p2.Question;
result.Part = p2.Part;
result.QuestionType = p2.QuestionType;
result.BodySystem = p2.BodySystem;
result.IsSign = p2.IsSign;
result.IsSymptom = p2.IsSymptom;
result.MedicalHistoryTemplateId = p2.MedicalHistoryTemplateId;
result.Id = p2.Id;
return result;
@ -39,6 +45,9 @@ namespace DocuMed.Domain.Mappers
Question = p4.Question,
Part = p4.Part,
QuestionType = p4.QuestionType,
BodySystem = p4.BodySystem,
IsSign = p4.IsSign,
IsSymptom = p4.IsSymptom,
MedicalHistoryTemplateId = p4.MedicalHistoryTemplateId,
Id = p4.Id
};
@ -50,6 +59,9 @@ namespace DocuMed.Domain.Mappers
Part = p5.Part,
QuestionType = p5.QuestionType,
MedicalHistoryTemplateId = p5.MedicalHistoryTemplateId,
BodySystem = p5.BodySystem,
IsSign = p5.IsSign,
IsSymptom = p5.IsSymptom,
Id = p5.Id
};
}
@ -65,6 +77,9 @@ namespace DocuMed.Domain.Mappers
result.Part = p6.Part;
result.QuestionType = p6.QuestionType;
result.MedicalHistoryTemplateId = p6.MedicalHistoryTemplateId;
result.BodySystem = p6.BodySystem;
result.IsSign = p6.IsSign;
result.IsSymptom = p6.IsSymptom;
result.Id = p6.Id;
return result;
@ -75,6 +90,9 @@ namespace DocuMed.Domain.Mappers
Part = p8.Part,
QuestionType = p8.QuestionType,
MedicalHistoryTemplateId = p8.MedicalHistoryTemplateId,
BodySystem = p8.BodySystem,
IsSign = p8.IsSign,
IsSymptom = p8.IsSymptom,
Id = p8.Id
};
}

View File

@ -48,6 +48,7 @@ namespace DocuMed.Domain.Mappers
return p5 == null ? null : new MedicalHistoryTemplateSDto()
{
ChiefComplaint = p5.ChiefComplaint,
SectionName = p5.Section == null ? null : p5.Section.Name,
SectionId = p5.SectionId,
ApplicationUserId = p5.ApplicationUserId,
Id = p5.Id
@ -62,6 +63,7 @@ namespace DocuMed.Domain.Mappers
MedicalHistoryTemplateSDto result = p7 ?? new MedicalHistoryTemplateSDto();
result.ChiefComplaint = p6.ChiefComplaint;
result.SectionName = p6.Section == null ? null : p6.Section.Name;
result.SectionId = p6.SectionId;
result.ApplicationUserId = p6.ApplicationUserId;
result.Id = p6.Id;
@ -71,6 +73,7 @@ namespace DocuMed.Domain.Mappers
public static Expression<Func<MedicalHistoryTemplate, MedicalHistoryTemplateSDto>> ProjectToSDto => p8 => new MedicalHistoryTemplateSDto()
{
ChiefComplaint = p8.ChiefComplaint,
SectionName = p8.Section.Name,
SectionId = p8.SectionId,
ApplicationUserId = p8.ApplicationUserId,
Id = p8.Id
@ -127,6 +130,9 @@ namespace DocuMed.Domain.Mappers
Question = p18.Question,
Part = p18.Part,
QuestionType = p18.QuestionType,
BodySystem = p18.BodySystem,
IsSign = p18.IsSign,
IsSymptom = p18.IsSymptom,
MedicalHistoryTemplateId = p18.MedicalHistoryTemplateId,
Id = p18.Id
}).ToList<MedicalHistoryQuestion>(),
@ -185,6 +191,9 @@ namespace DocuMed.Domain.Mappers
Part = p28.Part,
QuestionType = p28.QuestionType,
MedicalHistoryTemplateId = p28.MedicalHistoryTemplateId,
BodySystem = p28.BodySystem,
IsSign = p28.IsSign,
IsSymptom = p28.IsSymptom,
Id = p28.Id
}).ToList<MedicalHistoryQuestionSDto>(),
Id = p27.Id
@ -209,6 +218,9 @@ namespace DocuMed.Domain.Mappers
Question = item.Question,
Part = item.Part,
QuestionType = item.QuestionType,
BodySystem = item.BodySystem,
IsSign = item.IsSign,
IsSymptom = item.IsSymptom,
MedicalHistoryTemplateId = item.MedicalHistoryTemplateId,
Id = item.Id
});
@ -253,6 +265,9 @@ namespace DocuMed.Domain.Mappers
Question = item.Question,
Part = item.Part,
QuestionType = item.QuestionType,
BodySystem = item.BodySystem,
IsSign = item.IsSign,
IsSymptom = item.IsSymptom,
MedicalHistoryTemplateId = item.MedicalHistoryTemplateId,
Id = item.Id
});
@ -282,6 +297,9 @@ namespace DocuMed.Domain.Mappers
Part = item.Part,
QuestionType = item.QuestionType,
MedicalHistoryTemplateId = item.MedicalHistoryTemplateId,
BodySystem = item.BodySystem,
IsSign = item.IsSign,
IsSymptom = item.IsSymptom,
Id = item.Id
});
i++;
@ -326,6 +344,9 @@ namespace DocuMed.Domain.Mappers
Part = item.Part,
QuestionType = item.QuestionType,
MedicalHistoryTemplateId = item.MedicalHistoryTemplateId,
BodySystem = item.BodySystem,
IsSign = item.IsSign,
IsSymptom = item.IsSymptom,
Id = item.Id
});
i++;

View File

@ -0,0 +1,16 @@
namespace DocuMed.Domain;
public class MapsterRegister : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.NewConfig<MedicalHistory, MedicalHistorySDto>()
.Map("SectionName", org => org.Section!=null ? org.Section.Name : string.Empty)
.TwoWays();
config.NewConfig<ApplicationUser, ApplicationUserSDto>()
.Map("SectionName", org => org.Section != null ? org.Section.Name : string.Empty)
.TwoWays();
}
}

View File

@ -9,4 +9,5 @@ public static class Address
public const string SectionController = $"{BaseAddress}/section";
public const string UserController = $"{BaseAddress}/user";
public const string MedicalHistoryTemplateController = $"{BaseAddress}/medicalhistory/template";
public const string MedicalHistoryController = $"{BaseAddress}/medicalhistory";
}

View File

@ -1,11 +1,13 @@
@page "/HomePage"
@inject NavigationManager NavigationManager
@inject IUserUtility UserUtility
@inject ISnackbar Snackbar
@inject IRestWrapper RestWrapper
<MudStack class="w-screen h-screen bg-[#356859]">
<div class="flex flex-row mt-4 mb-3">
<MudStack Row="true" @onclick="ProfileClicked">
<div @onclick="ProfileClicked" class="flex flex-row mt-4 mb-3">
<MudStack Row="true" >
<MudAvatar Size="Size.Large" Class="mr-5">
<MudImage
Src="https://qph.cf2.quoracdn.net/main-thumb-161841968-200-xtisrhulnnwiuyeojsvojtoqjrqsglrj.jpeg">
@ -16,7 +18,7 @@
<p class="-mt-3 text-white font-light font-iranyekan">@ViewModel?.User.PhoneNumber</p>
</MudStack>
</MudStack>
<MudButton class="my-auto ml-5 mr-auto font-extrabold bg-white rounded-lg">اطفال</MudButton>
<MudButton class="my-auto ml-5 mr-auto font-extrabold bg-white rounded-lg">@ViewModel?.User.SectionName</MudButton>
</div>
<div class="bg-[#EEEEEE] w-full h-full flex flex-col rounded-t-xl">
<MudStack class="pb-20 bg-[#EEEEEE] rounded-t-xl">
@ -27,13 +29,37 @@
</div>
<MudButton DisableElevation="false" @onclick="CreateMedicalHistoryClicked" class="text-[#356859] my-auto mr-auto font-extrabold bg-white rounded-lg drop-shadow-md">+ افزودن</MudButton>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-2 ">
@foreach (var item in @ViewModel.MedicalHistories)
@if (@ViewModel.IsProcessing)
{
@for (int i = 0; i < 4; i++)
{
<MedicalHistoryItemTemplate MedicalHistory="@item" />
<MudCard class="bg-transparent p-4 rounded-lg" Elevation="0">
<div class="flex flex-row">
<div class="mx-4 mb-3 basis-1/3">
<MudSkeleton SkeletonType="SkeletonType.Rectangle" Animation="Animation.Wave" />
<MudSkeleton class="mt-3 h-2" SkeletonType="SkeletonType.Rectangle" Animation="Animation.Wave" />
</div>
<MudSkeleton class="mx-4 mb-3 h-10 basis-1/4 mr-auto" SkeletonType="SkeletonType.Rectangle" Animation="Animation.Wave" />
</div>
<div class="grid grid-cols-3">
<MudSkeleton class="mx-4" Animation="Animation.Wave" SkeletonType="SkeletonType.Text" />
<MudSkeleton class="mx-4" Animation="Animation.Wave" />
<MudSkeleton class="mx-4" Animation="Animation.Wave" />
</div>
</MudCard>
}
</div>
}
else
{
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-2 ">
@foreach (var item in @ViewModel.PageDto)
{
<MedicalHistoryItemTemplate MedicalHistory="@item" />
}
</div>
}
</MudStack>
@ -76,7 +102,7 @@
@code {
private HomePageViewModel? ViewModel { get; set; }
private HomePageViewModel ViewModel { get; set; }
public void ProfileClicked() => NavigationManager.NavigateTo("ProfilePage");
@ -88,7 +114,7 @@
protected override async Task OnInitializedAsync()
{
ViewModel = new HomePageViewModel(UserUtility);
ViewModel = new HomePageViewModel(UserUtility,RestWrapper,Snackbar);
await ViewModel.InitializeAsync();
await base.OnInitializedAsync();
}

View File

@ -1,60 +1,51 @@
namespace DocuMed.PWA.Pages;
using DocuMed.Common.Models.Mapper;
public class HomePageViewModel : BaseViewModel
namespace DocuMed.PWA.Pages;
public class HomePageViewModel : BaseViewModel<List<MedicalHistorySDto>>
{
private readonly IUserUtility _userUtility;
private readonly IRestWrapper _restWrapper;
private readonly ISnackbar _snackbar;
public HomePageViewModel(IUserUtility userUtility)
public HomePageViewModel(IUserUtility userUtility,IRestWrapper restWrapper,ISnackbar snackbar)
{
_userUtility = userUtility;
_restWrapper = restWrapper;
_snackbar = snackbar;
}
public List<MedicalHistorySDto> MedicalHistories { get; private set; } = new List<MedicalHistorySDto>();
public ApplicationUserSDto User { get; private set; } = new ApplicationUserSDto();
public override async Task InitializeAsync()
{
User = await _userUtility.GetUserAsync();
MedicalHistories.Add(new MedicalHistorySDto
try
{
FirstName = "امیرحسین ",
LastName = "معتمدی",
Age = 35,
ChiefComplaint = "سردرد",
Section = "داخلی",
});
MedicalHistories.Add(new MedicalHistorySDto
IsProcessing = true;
User = await _userUtility.GetUserAsync();
await Task.Delay(500);
var token = await _userUtility.GetBearerTokenAsync();
var list = await _restWrapper
.CrudDtoApiRest<MedicalHistoryLDto, MedicalHistorySDto, Guid>(Address.MedicalHistoryController)
.ReadAll(0, token);
PageDto = list;
}
catch (ApiException ex)
{
FirstName = "امیرحسین ",
LastName = "معتمدی",
Age = 35,
ChiefComplaint = "سردرد",
Section = "داخلی",
});
MedicalHistories.Add(new MedicalHistorySDto
var exe = await ex.GetContentAsAsync<ApiResult>();
_snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error);
}
catch (Exception e)
{
FirstName = "امیرحسین ",
LastName = "معتمدی",
Age = 35,
ChiefComplaint = "سردرد",
Section = "داخلی",
});
MedicalHistories.Add(new MedicalHistorySDto
_snackbar.Add(e.Message, Severity.Error);
}
finally
{
FirstName = "امیرحسین ",
LastName = "معتمدی",
Age = 35,
ChiefComplaint = "سردرد",
Section = "داخلی",
});
MedicalHistories.Add(new MedicalHistorySDto
{
FirstName = "امیرحسین ",
LastName = "معتمدی",
Age = 35,
ChiefComplaint = "سردرد",
Section = "داخلی",
});
IsProcessing = false;
}
await base.InitializeAsync();

View File

@ -1,86 +1,108 @@
@page "/MedicalHistoryActionPage"
@inject NavigationManager NavigationManager
@inject IRestWrapper RestWrapper
@inject ISnackbar Snackbar
@inject IUserUtility UserUtility
<BasePageUi Title="افزودن یک شرحال جدید" Description="لطفا اطلاعات بیمار را با دقت کامل وارد کنید">
<div class="flex flex-col w-full h-full rounded-t-xl">
<MudCarousel class="w-full h-full overflow-x-hidden overflow-y-scroll" @ref="_carousel" ShowArrows="false"
ShowBullets="false" EnableSwipeGesture="false" AutoCycle="false" TData="object">
<MudCarousel class="w-full h-full overflow-x-hidden overflow-y-scroll" @ref="@ViewModel.Carousel" ShowArrows="false"
ShowBullets="false" EnableSwipeGesture="false" AutoCycle="false" TData="object">
<MudCarouselItem>
<div class="flex flex-col w-full h-full">
<MedicalHistoryActionStep1 />
<MedicalHistoryActionStep1
@bind-ChiefComplaint="@ViewModel.PageDto.ChiefComplaint"
@bind-SelectedTemplate="@ViewModel.SelectedTemplate"
@bind-SelectedSection="@ViewModel.SelectedSelection"
@bind-PatientAge="@ViewModel.PageDto.Age"
@bind-PatientFirstName="@ViewModel.PageDto.FirstName"
@bind-PatientLastName="@ViewModel.PageDto.LastName"
/>
</div>
</MudCarouselItem>
<MudCarouselItem>
<div class="flex flex-col h-full">
<MedicalHistoryActionStep2 />
<MedicalHistoryActionStep2 PiQuestions="@ViewModel.SelectedTemplateLDto.Questions.Where(q=>q.Part==MedicalHistoryPart.PresentIllness).ToList()"
@bind-PiDetail="@ViewModel.PageDto.PresentIllnessDetail"
PiAnswers="@ViewModel.PiAnswers" />
</div>
</MudCarouselItem>
<MudCarouselItem>
<div class="flex flex-col h-full">
<MedicalHistoryActionStep3 />
<MedicalHistoryActionStep3 PdhQuestions="@ViewModel.SelectedTemplateLDto.Questions.Where(q=>q.Part==MedicalHistoryPart.PastDiseasesHistory).ToList()"
PdhAnswers="@ViewModel.PdhAnswers"
@bind-PdhDetail="@ViewModel.PageDto.PastDiseasesHistoryDetail"
PshAnswers="@ViewModel.PshAnswers"
PshQuestions="@ViewModel.SelectedTemplateLDto.Questions.Where(q=>q.Part==MedicalHistoryPart.PastSurgeryHistory).ToList()"
@bind-PshDetail="@ViewModel.PageDto.PastSurgeryHistoryDetail" />
</div>
</MudCarouselItem>
<MudCarouselItem>
<div class="flex flex-col h-full">
<MedicalHistoryActionStep4 />
<MedicalHistoryActionStep4 DhQuestions="@ViewModel.SelectedTemplateLDto.Questions.Where(q=>q.Part==MedicalHistoryPart.DrugHistory).ToList()"
DhAnswers="@ViewModel.DhAnswers"
@bind-DhDetail="@ViewModel.PageDto.DrugHistoryDetail"
FhQuestions="@ViewModel.SelectedTemplateLDto.Questions.Where(q=>q.Part==MedicalHistoryPart.FamilyHistory).ToList()"
FhAnswers="@ViewModel.FhAnswers"
@bind-FhDetail="@ViewModel.PageDto.FamilyHistoryDetail"
HhQuestions="@ViewModel.SelectedTemplateLDto.Questions.Where(q=>q.Part==MedicalHistoryPart.AddictionHistory).ToList()"
HhAnswers="@ViewModel.HhAnswers"
@bind-HhDetail="@ViewModel.PageDto.AddictionHistoryDetail" />
</div>
</MudCarouselItem>
<MudCarouselItem>
<div class="flex flex-col h-full">
<MedicalHistoryActionStep5 />
<MedicalHistoryActionStep5 GaQuestions="@ViewModel.SelectedTemplateLDto.Questions.Where(q=>q.Part==MedicalHistoryPart.GeneralAppearance).ToList()"
@bind-DiastolicBloodPressure="@ViewModel.PageDto.DiastolicBloodPressure"
@bind-PulseRate="@ViewModel.PageDto.PulseRate"
@bind-SPO2="@ViewModel.PageDto.SPO2"
@bind-SystolicBloodPressure="@ViewModel.PageDto.SystolicBloodPressure"
@bind-Temperature="@ViewModel.PageDto.Temperature"
@bind-GaDetail="@ViewModel.PageDto.GeneralAppearanceDetail"
@bind-RosDetail="@ViewModel.PageDto.SystemReviewDetail"/>
</div>
</MudCarouselItem>
<MudCarouselItem>
<div class="flex flex-col h-full">
<MedicalHistoryActionStep6 SubmittedOnClick="CompleteCreateMedicalHistory" />
<MedicalHistoryActionStep6 SubmittedOnClick="@ViewModel.CompleteCreateMedicalHistory" />
</div>
</MudCarouselItem>
</MudCarousel>
@if(!medicalHistorySubmited){
<MudPaper class="bottom-0 left-0 fixed w-full bg-[--color-medicalhistory] px-3 pt-4 pb-3 rounded-t-xl flex flex-row">
@if (!@ViewModel.MedicalHistorySubmitted)
{
<MudPaper class="bottom-0 left-0 fixed w-full bg-[--color-medicalhistory] px-3 pt-4 pb-3 rounded-t-xl flex flex-row">
@if (_currentStep == 4)
{
<MudButton @onclick="CompleteStepClicked" Variant="Variant.Filled" Color="Color.Primary" IconSize="Size.Large" StartIcon="@Icons.Material.Filled.ChevronRight" class="font-extrabold rounded-full">تکمیل</MudButton>
}
else
{
<MudButton @onclick="CompleteStepClicked" Variant="Variant.Outlined" IconSize="Size.Large"
StartIcon="@Icons.Material.Filled.ChevronRight" class="font-extrabold rounded-full">مرحله بعد
</MudButton>
}
@if (@ViewModel.CurrentStep == 4)
{
<MudButton @onclick="@ViewModel.CompleteStepClicked" Variant="Variant.Filled" Color="Color.Primary" IconSize="Size.Large" StartIcon="@Icons.Material.Filled.ChevronRight" class="font-extrabold rounded-full">تکمیل</MudButton>
}
else
{
<MudButton @onclick="@ViewModel.CompleteStepClicked" Variant="Variant.Outlined" IconSize="Size.Large"
StartIcon="@Icons.Material.Filled.ChevronRight" class="font-extrabold rounded-full">
مرحله بعد
</MudButton>
}
<p class="my-auto text-lg font-extrabold text-center grow">@_stepCounter</p>
<MudButton @onclick="RollBackStepClicked" IconSize="Size.Large" EndIcon="@Icons.Material.Filled.ChevronLeft"
class="font-extrabold rounded-full">مرحله قبل</MudButton>
</MudPaper>
<p class="my-auto text-lg font-extrabold text-center grow">@ViewModel.StepCounter</p>
<MudButton @onclick="@ViewModel.RollBackStepClicked" IconSize="Size.Large" EndIcon="@Icons.Material.Filled.ChevronLeft"
class="font-extrabold rounded-full">مرحله قبل</MudButton>
</MudPaper>
}
</div>
</BasePageUi>
@code {
private MudCarousel<object>? _carousel;
private int _currentStep = 0;
private string _stepCounter = "1 / 5";
private bool medicalHistorySubmited = false;
private void CompleteStepClicked()
public MedicalHistoryActionPageViewModel ViewModel { get; set; }
protected override async Task OnInitializedAsync()
{
_carousel?.MoveTo(++_currentStep);
_stepCounter = string.Format("{0} / 5", _currentStep + 1);
if (_currentStep == 5)
medicalHistorySubmited = true;
}
private void RollBackStepClicked()
{
_carousel?.MoveTo(--_currentStep);
_stepCounter = string.Format("{0} / 5", _currentStep + 1);
ViewModel = new MedicalHistoryActionPageViewModel(RestWrapper, NavigationManager, Snackbar, UserUtility);
await ViewModel.InitializeAsync();
await base.OnInitializedAsync();
}
private void CompleteCreateMedicalHistory()
{
NavigationManager.NavigateTo("HomePage");
}
}

View File

@ -0,0 +1,138 @@
namespace DocuMed.PWA.Pages;
public class MedicalHistoryActionPageViewModel : BaseViewModel<MedicalHistoryLDto>
{
private readonly IRestWrapper _restWrapper;
private readonly NavigationManager _navigationManager;
private readonly ISnackbar _snackbar;
private readonly IUserUtility _userUtility;
public MedicalHistoryActionPageViewModel(IRestWrapper restWrapper,
NavigationManager navigationManager,
ISnackbar snackbar,
IUserUtility userUtility)
{
_restWrapper = restWrapper;
_navigationManager = navigationManager;
_snackbar = snackbar;
_userUtility = userUtility;
}
public MedicalHistoryTemplateSDto SelectedTemplate { get; set; } = new();
public MedicalHistoryTemplateLDto SelectedTemplateLDto { get; set; } = new();
public bool IsEditing { get; set; } = false;
public SectionSDto? SelectedSelection { get; set; }
public List<MedicalHistoryAnswerSDto> PiAnswers { get; set; } = new();
public List<MedicalHistoryAnswerSDto> PdhAnswers { get; set; } = new();
public List<MedicalHistoryAnswerSDto> PshAnswers { get; set; } = new();
public List<MedicalHistoryAnswerSDto> FhAnswers { get; set; } = new();
public List<MedicalHistoryAnswerSDto> DhAnswers { get; set; } = new();
public List<MedicalHistoryAnswerSDto> HhAnswers { get; set; } = new();
public List<MedicalHistoryAnswerSDto> GaAnswers { get; set; } = new();
public List<MedicalHistoryAnswerSDto> RosAnswers { get; set; } = new();
public MudCarousel<object>? Carousel { get; set; }
public int CurrentStep { get; set; } = 0;
public string StepCounter { get; set; } = "1 / 5";
public bool MedicalHistorySubmitted { get; set; } = false;
public async Task CompleteStepClicked()
{
CurrentStep++;
StepCounter = $"{CurrentStep + 1} / 5";
if (CurrentStep == 1)
await CheckMedicalHistoryAsync();
if (CurrentStep == 5)
{
//if (IsEditing)
// await EditTemplateAsync();
//else
await SubmitMedicalHistoryAsync();
MedicalHistorySubmitted = true;
}
Carousel?.MoveTo(CurrentStep);
}
private async Task CheckMedicalHistoryAsync()
{
try
{
if (SelectedTemplate.Id == Guid.Empty)
return;
IsProcessing = true;
var token = await _userUtility.GetBearerTokenAsync();
var dto = await _restWrapper.CrudDtoApiRest<MedicalHistoryTemplateSDto, MedicalHistoryTemplateLDto, Guid>(Address.MedicalHistoryTemplateController)
.ReadOne(SelectedTemplate.Id, token);
PageDto.Id = dto.Id;
SelectedTemplateLDto = dto;
}
catch (ApiException ex)
{
var exe = await ex.GetContentAsAsync<ApiResult>();
_snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error);
}
catch (Exception e)
{
_snackbar.Add(e.Message, Severity.Error);
}
finally
{
IsProcessing = false;
}
}
public async Task SubmitMedicalHistoryAsync()
{
try
{
IsProcessing = true;
if (SelectedSelection == null)
throw new Exception("لطفا بخش مورد نظر را انتخاب نمایید");
PageDto.SectionId = SelectedSelection.Id;
var token = await _userUtility.GetBearerTokenAsync();
PageDto.Answers.AddRange(PiAnswers);
PageDto.Answers.AddRange(PdhAnswers);
PageDto.Answers.AddRange(PshAnswers);
PageDto.Answers.AddRange(FhAnswers);
PageDto.Answers.AddRange(DhAnswers);
PageDto.Answers.AddRange(HhAnswers);
PageDto.Answers.AddRange(GaAnswers);
PageDto.Answers.AddRange(RosAnswers);
await _restWrapper.CrudDtoApiRest<MedicalHistoryLDto, MedicalHistorySDto, Guid>(Address.MedicalHistoryController)
.Create(PageDto, token);
}
catch (ApiException ex)
{
var exe = await ex.GetContentAsAsync<ApiResult>();
_snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error);
}
catch (Exception e)
{
_snackbar.Add(e.Message, Severity.Error);
}
finally
{
IsProcessing = false;
}
}
public void RollBackStepClicked()
{
Carousel?.MoveTo(--CurrentStep);
StepCounter = $"{CurrentStep + 1} / 5";
}
public void CompleteCreateMedicalHistory()
{
_navigationManager.NavigateTo("HomePage");
}
}

View File

@ -1,13 +1,148 @@
@inject IRestWrapper RestWrapper
@inject IUserUtility UserUtility
<MudStack class="my-auto text-center font-iranyekan">
<p class="text-lg font-extrabold">افزودن شرح حال جدید</p>
<p class="text-center text-md">لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از
<p class="text-center text-md">
لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از
طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی
مورد ده</p>
مورد ده
</p>
<BasePartDivider Index="1" Title="شکایت اصلی بیمار" />
<MudAutocomplete T="string" Label="شکایت اصلی بیمار ( CC )" Variant="Variant.Outlined" Margin="Margin.Normal" />
<MudAutocomplete T="string" Label="بخش بیمار" Variant="Variant.Outlined" />
<MudTextField Value="@PatientFirstName" ValueChanged="async detail => { PatientFirstName = detail; await PatientFirstNameChanged.InvokeAsync(detail); }"
T="string" Label="نام بیمار" Variant="Variant.Outlined" />
<MudTextField Value="@PatientLastName" ValueChanged="async detail => { PatientLastName = detail; await PatientLastNameChanged.InvokeAsync(detail); }"
T="string" Label="نام خانوادگی بیمار" Variant="Variant.Outlined" />
<MudTextField Value="@PatientAge" ValueChanged="async detail => { PatientAge = detail; await PatientAgeChanged.InvokeAsync(detail); }"
T="int" Label="سن بیمار" Variant="Variant.Outlined" />
<MudAutocomplete Value="@SelectedTemplate"
ToStringFunc="dto => dto.ChiefComplaint"
SearchFunc="@SearchTemplates"
TextChanged="async str => { ChiefComplaint = str;await ChiefComplaintChanged.InvokeAsync(str); }"
ValueChanged="async dto => { SelectedTemplate = dto; await SelectedTemplateChanged.InvokeAsync(SelectedTemplate); }"
T="MedicalHistoryTemplateSDto" Label="شکایت اصلی بیمار ( CC )" 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.ChiefComplaint</p>
</ItemTemplate>
</MudAutocomplete>
<MudAutocomplete Value="@SelectedSection" ToStringFunc="dto => dto.Name"
SearchFunc="@SearchSection"
ValueChanged="async dto => { SelectedSection = dto; await SelectedSectionChanged.InvokeAsync(SelectedSection); }"
T="SectionSDto" 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.Name</p>
</ItemTemplate>
</MudAutocomplete>
</MudStack>
@code {
@code
{
[Parameter]
public string PatientFirstName { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> PatientFirstNameChanged { get; set; }
[Parameter]
public string PatientLastName { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> PatientLastNameChanged { get; set; }
[Parameter]
public int PatientAge { get; set; }
[Parameter]
public EventCallback<int> PatientAgeChanged { get; set; }
[Parameter]
public string ChiefComplaint { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> ChiefComplaintChanged { get; set; }
[Parameter]
public SectionSDto SelectedSection { get; set; } = new();
[Parameter]
public EventCallback<SectionSDto> SelectedSectionChanged { get; set; }
[Parameter]
public MedicalHistoryTemplateSDto SelectedTemplate { get; set; } = new();
[Parameter]
public EventCallback<MedicalHistoryTemplateSDto> SelectedTemplateChanged { get; set; }
private MedicalHistoryTemplateLDto _editingTemplate = new();
public List<SectionSDto> Sections { get; private set; } = new List<SectionSDto>();
public List<MedicalHistoryTemplateSDto> Templates { get; private set; } = new List<MedicalHistoryTemplateSDto>();
public async Task<IEnumerable<MedicalHistoryTemplateSDto>> SearchTemplates(string template)
{
try
{
var token = await UserUtility.GetBearerTokenAsync();
var list = await RestWrapper
.CrudDtoApiRest<MedicalHistoryTemplateLDto, MedicalHistoryTemplateSDto, Guid>(Address.MedicalHistoryTemplateController)
.ReadAll(0, token);
Templates = list;
if (template.IsNullOrEmpty())
return Templates;
return Templates.Where(c => c.ChiefComplaint.Contains(template));
}
catch (ApiException ex)
{
var exe = await ex.GetContentAsAsync<ApiResult>();
return Templates;
}
catch (Exception e)
{
return Templates;
}
}
public async Task<IEnumerable<SectionSDto>> SearchSection(string section)
{
try
{
var token = await UserUtility.GetBearerTokenAsync();
var user = await UserUtility.GetUserAsync();
Sections = await RestWrapper.SectionRestApi.GetByUniversityAsync(user.UniversityId, token);
if (section.IsNullOrEmpty())
return Sections;
return Sections.Where(c => c.Name.Contains(section));
}
catch (ApiException ex)
{
var exe = await ex.GetContentAsAsync<ApiResult>();
return Sections;
}
catch (Exception e)
{
return Sections;
}
}
}

View File

@ -2,16 +2,38 @@
<MudStack class="font-iranyekan">
<BasePartDivider Index="2" Title="تاریخچه بیماری فعلی ( PI )" />
<HourQuestionTemplate/>
<div class="h-[1px] w-full bg-gray-400 bg-opacity-70 mt-2 mb-1"></div>
<MudTextField T="string" Label="چه علائمی همراه با سردرد دارید ؟" Variant="Variant.Outlined"/>
@foreach (var question in PiQuestions)
{
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="AnswerChanged" />
}
<MudTextField T="string" Label="توضیحاتـــ تکمیلی" Lines="5" Variant="Variant.Outlined"/>
<MudTextField T="string" Value="@PiDetail" ValueChanged="async piDetail => { PiDetail = piDetail; await PiDetailChanged.InvokeAsync(piDetail); }" Label="توضیحاتـــ تکمیلی" Lines="5" Variant="Variant.Outlined" />
</MudStack>
@code {
@code
{
[Parameter]
public List<MedicalHistoryAnswerSDto> PiAnswers { get; set; } = new();
[Parameter]
public List<MedicalHistoryQuestionSDto> PiQuestions { get; set; } = new();
[Parameter]
public string PiDetail { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> PiDetailChanged { get; set; }
private void AnswerChanged(MedicalHistoryAnswerSDto dto)
{
var findAnswer = PiAnswers.FirstOrDefault(pi => pi.Question == dto.Question && pi.Part == dto.Part);
if (findAnswer != null)
findAnswer.Answer = dto.Answer;
else
PiAnswers.Add(dto);
}
}

View File

@ -2,21 +2,71 @@
<MudStack class="pb-20 font-iranyekan">
<BasePartDivider Index="3" Title="تاریخچه بیماری های قبلی ( PMH )" />
<HourQuestionTemplate/>
<div class="h-[1px] w-full bg-gray-400 bg-opacity-70 mt-2 mb-1"></div>
<MudTextField T="string" Label="چه علائمی همراه با سردرد دارید ؟" Variant="Variant.Outlined"/>
@foreach (var question in PdhQuestions)
{
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="PdhAnswerChanged" />
}
<MudTextField Margin="Margin.Dense" T="string" Label="توضیحاتـــ تکمیلی" Lines="5" Variant="Variant.Outlined"/>
<MudTextField Margin="Margin.Dense" T="string"
Value="@PdhDetail" ValueChanged="async piDetail => { PdhDetail = piDetail; await PdhDetailChanged.InvokeAsync(piDetail); }"
Label="توضیحاتـــ تکمیلی" Lines="5" Variant="Variant.Outlined"/>
<BasePartDivider Index="4" Title="تاریخچه جراحی های قبلی ( PSH )" />
<MudTextField Margin="Margin.Dense" T="string" Label="توضیحاتـــ تکمیلی" Lines="5" Variant="Variant.Outlined"/>
@foreach (var question in PshQuestions)
{
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="PshAnswerChanged" />
}
<MudTextField Margin="Margin.Dense"
Value="@PshDetail" ValueChanged="async piDetail => { PshDetail = piDetail; await PshDetailChanged.InvokeAsync(piDetail); }"
T="string" Label="توضیحاتـــ تکمیلی" Lines="5" Variant="Variant.Outlined"/>
</MudStack>
@code {
@code
{
[Parameter]
public List<MedicalHistoryAnswerSDto> PdhAnswers { get; set; } = new();
[Parameter]
public List<MedicalHistoryQuestionSDto> PdhQuestions { get; set; } = new();
[Parameter]
public string PdhDetail { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> PdhDetailChanged { get; set; }
private void PdhAnswerChanged(MedicalHistoryAnswerSDto dto)
{
var findAnswer = PdhAnswers.FirstOrDefault(pi => pi.Question == dto.Question && pi.Part == dto.Part);
if (findAnswer != null)
findAnswer.Answer = dto.Answer;
else
PdhAnswers.Add(dto);
}
[Parameter]
public List<MedicalHistoryAnswerSDto> PshAnswers { get; set; } = new();
[Parameter]
public List<MedicalHistoryQuestionSDto> PshQuestions { get; set; } = new();
[Parameter]
public string PshDetail { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> PshDetailChanged { get; set; }
private void PshAnswerChanged(MedicalHistoryAnswerSDto dto)
{
var findAnswer = PdhAnswers.FirstOrDefault(pi => pi.Question == dto.Question && pi.Part == dto.Part);
if (findAnswer != null)
findAnswer.Answer = dto.Answer;
else
PdhAnswers.Add(dto);
}
}

View File

@ -1,36 +1,117 @@
<MudStack class="pb-20 font-iranyekan">
<BasePartDivider Index="5" Title="تاریخچه بیماری های خانوادگی ( FH )" />
<MudTextField Margin="Margin.Dense" T="string" Label="توضیحاتـــ تکمیلی" Lines="5" Variant="Variant.Outlined" />
@foreach (var question in FhQuestions)
{
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="FhAnswerChanged" />
}
<MudTextField T="string"
Value="@FhDetail" ValueChanged="async detail => { FhDetail = detail; await FhDetailChanged.InvokeAsync(detail); }"
Label="توضیحاتـــ تکمیلی" Lines="5" Variant="Variant.Outlined" />
<BasePartDivider Index="6" Title="داروهای مصرفی ( FH )" />
<BasePartDivider Index="6" Title="داروهای مصرفی ( DH )" />
<div class="grid grid-cols-2 gap-1 md:grid-cols-4 sm:grid-cols-2">
@for (int i = 0; i < 5; i++)
@foreach (var question in DhQuestions)
{
<MudCard class="text-center">
<MudCardContent>
<p class="font-extrabold text-gray-600 text-md">ادالت کولد 500</p>
</MudCardContent>
</MudCard>
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="DhAnswerChanged" />
}
</div>
<MudTextField T="string"
Value="@DhDetail" ValueChanged="async detail => { DhDetail = detail; await DhDetailChanged.InvokeAsync(detail); }"
Label="توضیحاتـــ تکمیلی" Lines="2" Variant="Variant.Outlined" />
<BasePartDivider Index="7" Title="مواد مصرفی ( HH )" />
<div class="grid grid-cols-2 gap-1 md:grid-cols-4 sm:grid-cols-2">
@for (int i = 0; i < 4; i++)
@foreach (var question in HhQuestions)
{
<MudCard class="text-center">
<MudCardContent>
<p class="font-extrabold text-gray-600 text-md">ادالت کولد 500</p>
</MudCardContent>
</MudCard>
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="HhAnswerChanged" />
}
</div>
<MudTextField T="string"
Value="@HhDetail" ValueChanged="async detail => { HhDetail = detail; await HhDetailChanged.InvokeAsync(detail); }"
Label="توضیحاتـــ تکمیلی" Lines="2" Variant="Variant.Outlined" />
<BasePartDivider Index="8" Title="آلرژی ( AH )" />
<MudTextField T="string"
Value="@AhDetail" ValueChanged="async ahDetail => { AhDetail = ahDetail; await AhDetailChanged.InvokeAsync(ahDetail); }"
Label="توضیحاتـــ تکمیلی" Lines="2" Variant="Variant.Outlined" />
</MudStack>
@code {
[Parameter]
public string AhDetail { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> AhDetailChanged { get; set; }
[Parameter]
public List<MedicalHistoryAnswerSDto> FhAnswers { get; set; } = new();
[Parameter]
public List<MedicalHistoryQuestionSDto> FhQuestions { get; set; } = new();
[Parameter]
public string FhDetail { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> FhDetailChanged { get; set; }
private void FhAnswerChanged(MedicalHistoryAnswerSDto dto)
{
var findAnswer = FhAnswers.FirstOrDefault(pi => pi.Question == dto.Question && pi.Part == dto.Part);
if (findAnswer != null)
findAnswer.Answer = dto.Answer;
else
FhAnswers.Add(dto);
}
[Parameter]
public List<MedicalHistoryAnswerSDto> DhAnswers { get; set; } = new();
[Parameter]
public List<MedicalHistoryQuestionSDto> DhQuestions { get; set; } = new();
[Parameter]
public string DhDetail { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> DhDetailChanged { get; set; }
private void DhAnswerChanged(MedicalHistoryAnswerSDto dto)
{
var findAnswer = DhAnswers.FirstOrDefault(pi => pi.Question == dto.Question && pi.Part == dto.Part);
if (findAnswer != null)
findAnswer.Answer = dto.Answer;
else
DhAnswers.Add(dto);
}
[Parameter]
public List<MedicalHistoryAnswerSDto> HhAnswers { get; set; } = new();
[Parameter]
public List<MedicalHistoryQuestionSDto> HhQuestions { get; set; } = new();
[Parameter]
public string HhDetail { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> HhDetailChanged { get; set; }
private void HhAnswerChanged(MedicalHistoryAnswerSDto dto)
{
var findAnswer = DhAnswers.FirstOrDefault(pi => pi.Question == dto.Question && pi.Part == dto.Part);
if (findAnswer != null)
findAnswer.Answer = dto.Answer;
else
DhAnswers.Add(dto);
}
}

View File

@ -1,27 +1,23 @@
<MudStack class="pb-20 font-iranyekan">
<BasePartDivider Index="8" Title="ظاهر کلی بیمار ( FH )" />
<BasePartDivider Index="9" Title="ظاهر کلی بیمار ( GA )" />
<MudTextField Margin="Margin.Dense" T="string" Label="توضیحاتـــ تکمیلی" Lines="2" Variant="Variant.Outlined" />
<div class="grid grid-cols-2 gap-1 md:grid-cols-4 sm:grid-cols-2">
<MudCard class="text-center">
<MudCardContent>
<p class="font-bold text-gray-600 text-md">بیمار هوشیار است</p>
</MudCardContent>
</MudCard>
<MudCard class="text-center">
<MudCardContent>
<p class="font-bold text-gray-600 text-md">بیمار ILL است</p>
</MudCardContent>
</MudCard>
@foreach (var question in GaQuestions)
{
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="GaAnswerChanged" />
}
</div>
<MudTextField T="string"
Value="@GaDetail" ValueChanged="async detail => { GaDetail = detail; await GaDetailChanged.InvokeAsync(detail); }"
Label="توضیحاتـــ تکمیلی" Lines="2" Variant="Variant.Outlined" />
<BasePartDivider Index="9" Title="علائم حیاتی ( FH )" />
<BasePartDivider Index="10" Title="علائم حیاتی ( VS )" />
<div class="flex flex-row">
<p class="my-auto mr-5 font-extrabold text-md grow">فشــــار خون</p>
<MudTextField InputType="InputType.Number" Margin="Margin.Dense" class="mx-3 my-auto basis-1/12" T="string" Variant="Variant.Outlined" />
<MudTextField InputType="InputType.Number" Margin="Margin.Dense" class="my-auto basis-1/12" T="string" Variant="Variant.Outlined" />
<MudTextField InputType="InputType.Number" Label="سیستولیک" Margin="Margin.Dense" class="mx-3 my-auto basis-1/12" T="string" Variant="Variant.Outlined" />
<MudTextField InputType="InputType.Number" Label="دیاستولیک" Margin="Margin.Dense" class="my-auto basis-1/12" T="string" Variant="Variant.Outlined" />
</div>
@ -35,8 +31,82 @@
</div>
<BasePartDivider Index="11" Title="بررسی سیستماتیک ( ROS )" />
<div class="grid grid-cols-2 gap-1 md:grid-cols-4 sm:grid-cols-2">
@foreach (var question in GaQuestions)
{
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="GaAnswerChanged" />
}
</div>
<MudTextField T="string"
Value="@RosDetail" ValueChanged="async detail => { RosDetail = detail; await RosDetailChanged.InvokeAsync(detail); }"
Label="توضیحاتـــ تکمیلی" Lines="2" Variant="Variant.Outlined" />
</MudStack>
@code {
[Parameter]
public string RosDetail { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> RosDetailChanged { get; set; }
[Parameter]
public List<MedicalHistoryAnswerSDto> GaAnswers { get; set; } = new();
[Parameter]
public List<MedicalHistoryQuestionSDto> GaQuestions { get; set; } = new();
[Parameter]
public string GaDetail { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> GaDetailChanged { get; set; }
private void GaAnswerChanged(MedicalHistoryAnswerSDto dto)
{
var findAnswer = GaAnswers.FirstOrDefault(pi => pi.Question == dto.Question && pi.Part == dto.Part);
if (findAnswer != null)
findAnswer.Answer = dto.Answer;
else
GaAnswers.Add(dto);
}
[Parameter]
public int SystolicBloodPressure { get; set; }
[Parameter]
public EventCallback<int> SystolicBloodPressureChanged { get; set; }
[Parameter]
public int DiastolicBloodPressure { get; set; }
[Parameter]
public EventCallback<int> DiastolicBloodPressureChanged { get; set; }
[Parameter]
public int PulseRate { get; set; }
[Parameter]
public EventCallback<int> PulseRateChanged { get; set; }
[Parameter]
public int SPO2 { get; set; }
[Parameter]
public EventCallback<int> SPO2Changed { get; set; }
[Parameter]
public int Temperature { get; set; }
[Parameter]
public EventCallback<int> TemperatureChanged { get; set; }
}

View File

@ -35,7 +35,7 @@
</MudCarouselItem>
<MudCarouselItem>
<div class="flex flex-col h-full">
<MedicalHistoryTemplateActionStep5 VitalSigns="@ViewModel.VsQuestions" />
<MedicalHistoryTemplateActionStep5 ReviewOfSystems="@ViewModel.RosQuestions" GeneralAppearance="@ViewModel.GaQuestions" />
</div>
</MudCarouselItem>
<MudCarouselItem>

View File

@ -19,7 +19,8 @@ public class MedicalHistoryTemplateActionPageViewModel : BaseViewModel<MedicalHi
public List<MedicalHistoryQuestionSDto> FhQuestions { get; set; } = new();
public List<MedicalHistoryQuestionSDto> DhQuestions { get; set; } = new();
public List<MedicalHistoryQuestionSDto> AhQuestions { get; set; } = new();
public List<MedicalHistoryQuestionSDto> VsQuestions { get; set; } = new();
public List<MedicalHistoryQuestionSDto> GaQuestions { get; set; } = new();
public List<MedicalHistoryQuestionSDto> RosQuestions { get; set; } = new();
public SectionSDto? SelectedSelection { get; set; }
@ -73,7 +74,8 @@ public class MedicalHistoryTemplateActionPageViewModel : BaseViewModel<MedicalHi
FhQuestions.AddRange(dto.Questions.Where(q => q.Part == MedicalHistoryPart.FamilyHistory));
DhQuestions.AddRange(dto.Questions.Where(q => q.Part == MedicalHistoryPart.DrugHistory));
AhQuestions.AddRange(dto.Questions.Where(q => q.Part == MedicalHistoryPart.AddictionHistory));
VsQuestions.AddRange(dto.Questions.Where(q => q.Part == MedicalHistoryPart.VitalSign));
GaQuestions.AddRange(dto.Questions.Where(q => q.Part == MedicalHistoryPart.GeneralAppearance));
RosQuestions.AddRange(dto.Questions.Where(q => q.Part == MedicalHistoryPart.ReviewOfSystem));
}
catch (ApiException ex)
{
@ -120,12 +122,12 @@ public class MedicalHistoryTemplateActionPageViewModel : BaseViewModel<MedicalHi
PageDto.SectionId = SelectedSelection.Id;
PageDto.Questions.AddRange(PiQuestions);
PageDto.Questions.AddRange(PdhQuestions);
PageDto.Questions.AddRange(PiQuestions);
PageDto.Questions.AddRange(PshQuestions);
PageDto.Questions.AddRange(FhQuestions);
PageDto.Questions.AddRange(DhQuestions);
PageDto.Questions.AddRange(AhQuestions);
PageDto.Questions.AddRange(VsQuestions);
PageDto.Questions.AddRange(GaQuestions);
PageDto.Questions.AddRange(RosQuestions);
await _restWrapper.CrudDtoApiRest<MedicalHistoryTemplateLDto, MedicalHistoryTemplateSDto, Guid>(Address.MedicalHistoryTemplateController)
.Create(PageDto, token);
@ -163,7 +165,8 @@ public class MedicalHistoryTemplateActionPageViewModel : BaseViewModel<MedicalHi
PageDto.Questions.AddRange(FhQuestions);
PageDto.Questions.AddRange(DhQuestions);
PageDto.Questions.AddRange(AhQuestions);
PageDto.Questions.AddRange(VsQuestions);
PageDto.Questions.AddRange(GaQuestions);
PageDto.Questions.AddRange(RosQuestions);
await _restWrapper.CrudDtoApiRest<MedicalHistoryTemplateLDto, MedicalHistoryTemplateSDto, Guid>(Address.MedicalHistoryTemplateController)
.Update(PageDto, token);

View File

@ -8,7 +8,8 @@
مورد ده
</p>
<BasePartDivider Index="1" Title="شکایت اصلی بیمار" />
<MudTextField T="string" Value="@ChiefComplaint" ValueChanged="async cc => {ChiefComplaint=cc; await ChiefComplaintChanged.InvokeAsync(ChiefComplaint); }" Label="شکایت اصلی بیمار ( CC )" Variant="Variant.Outlined" Margin="Margin.Normal" />
<MudTextField T="string" Value="@ChiefComplaint" ValueChanged="async cc => {ChiefComplaint=cc; await ChiefComplaintChanged.InvokeAsync(ChiefComplaint); }"
Label="شکایت اصلی بیمار ( CC )" Variant="Variant.Outlined" Margin="Margin.Normal" />
<MudAutocomplete Value="@SelectedSection" T="SectionSDto" Label="بخش بیمار" Variant="Variant.Outlined"
ToStringFunc="dto => dto.Name"
SearchFunc="@SearchSection"

View File

@ -1,7 +1,7 @@
<MudStack class="pb-20 font-iranyekan">
<BasePartDivider Index="8" Title="ظاهر کلی بیمار ( GA )" />
<div class="grid mx-1 gap-2 grid-cols-1 md:grid-cols-2">
@foreach (var item in VitalSigns)
@foreach (var item in GeneralAppearance)
{
<MudCard @onclick="()=>RemoveGeneralAppearance(item)" class="text-center">
<MudCardContent>
@ -30,15 +30,15 @@
<p>@item.Question</p>
<div class="flex flex-row">
<MudPaper Elevation="0" Class="mx-1 mt-1 bg-gray-200 w-fit text-center rounded-full py-0.5 px-3 text-gray-800 text-xs">
معده
@item.BodySystem.ToDisplay()
</MudPaper>
@if(true)
@if(@item.IsSign)
{
<MudPaper Elevation="0" Class="mx-1 mt-1 bg-gray-200 w-fit text-center rounded-full py-0.5 px-3 text-gray-800 text-xs">
Sign
</MudPaper>
}
@if (true)
@if (@item.IsSymptom)
{
<MudPaper Elevation="0" Class="mx-1 mt-1 bg-gray-200 w-fit text-center rounded-full py-0.5 px-3 text-gray-800 text-xs">
Symptom
@ -52,7 +52,32 @@
}
<MudTextField @bind-Value="@_reviewOfSystemTitle" class="grow" T="string" Label="علامت مورد نظر" Variant="Variant.Outlined" />
<MudTextField @bind-Value="@_reviewOfSystemSystem" class="grow" T="string" Label="سیستم مورد نظر" Variant="Variant.Outlined" />
<MudSelect @bind-Value="@_reviewOfSystemName" T="BodySystem" ToStringFunc="(e=>e.ToDisplay())" Label="سیستم مورد نظر" Variant="Variant.Outlined">
<MudSelectItem Value="@BodySystem.Chest" />
<MudSelectItem Value="@BodySystem.Ear" />
<MudSelectItem Value="@BodySystem.Extremities" />
<MudSelectItem Value="@BodySystem.Eyes" />
<MudSelectItem Value="@BodySystem.GenitalOrganFemale" />
<MudSelectItem Value="@BodySystem.GenitalOrganMale" />
<MudSelectItem Value="@BodySystem.Heart" />
<MudSelectItem Value="@BodySystem.Lung" />
<MudSelectItem Value="@BodySystem.LymphaticGlands" />
<MudSelectItem Value="@BodySystem.Mouth" />
<MudSelectItem Value="@BodySystem.Neck" />
<MudSelectItem Value="@BodySystem.Nose" />
<MudSelectItem Value="@BodySystem.Extremities" />
<MudSelectItem Value="@BodySystem.NervousSystem" />
<MudSelectItem Value="@BodySystem.Rectum" />
<MudSelectItem Value="@BodySystem.Skin" />
<MudSelectItem Value="@BodySystem.Skull" />
<MudSelectItem Value="@BodySystem.Throat" />
<MudSelectItem Value="@BodySystem.Vessels" />
<MudSelectItem Value="@BodySystem.Abdomen" />
<MudSelectItem Value="@BodySystem.BoneJointsMuscles" />
</MudSelect>
<div class="flex flex-row">
<MudCheckBox @bind-Checked="@_reviewOfSystemIsSign" Color="Color.Primary" UnCheckedColor="Color.Default" Size="Size.Large" T="bool"
@ -73,14 +98,14 @@
private string _vitalSign = string.Empty;
[Parameter]
public List<MedicalHistoryQuestionSDto> VitalSigns { get; set; } = new();
public List<MedicalHistoryQuestionSDto> GeneralAppearance { get; set; } = new();
private void RemoveGeneralAppearance(MedicalHistoryQuestionSDto generalAppearance)
{
VitalSigns.Remove(generalAppearance);
GeneralAppearance.Remove(generalAppearance);
}
private void AddGeneralAppearance()
{
VitalSigns.Add(new MedicalHistoryQuestionSDto
GeneralAppearance.Add(new MedicalHistoryQuestionSDto
{
Question = _vitalSign,
QuestionType = MedicalHistoryQuestionType.Selective,
@ -89,10 +114,13 @@
_vitalSign = string.Empty;
}
private string _reviewOfSystemTitle = string.Empty;
private string _reviewOfSystemSystem = string.Empty;
private BodySystem _reviewOfSystemName;
private bool _reviewOfSystemIsSign;
private bool _reviewOfSystemIsSymptom;
[Parameter]
public List<MedicalHistoryQuestionSDto> ReviewOfSystems { get; set; } = new();
private void RemoveReviewOfSystems(MedicalHistoryQuestionSDto review)
{
@ -100,13 +128,15 @@
}
private void AddReviewOfSystems()
{
// ReviewOfSystems.Add(new MedicalHistorySystemReview
// {
// Title = _reviewOfSystemTitle,
// IsSign = _reviewOfSystemIsSign,
// IsSymptom = _reviewOfSystemIsSymptom,
// System = _reviewOfSystemSystem
// });
ReviewOfSystems.Add(new MedicalHistoryQuestionSDto
{
Question = _reviewOfSystemTitle,
IsSign = _reviewOfSystemIsSign,
IsSymptom = _reviewOfSystemIsSymptom,
BodySystem = _reviewOfSystemName,
QuestionType = MedicalHistoryQuestionType.RosSelective,
Part = MedicalHistoryPart.ReviewOfSystem
});
_reviewOfSystemTitle = string.Empty;
}
}

View File

@ -3,7 +3,7 @@
public interface ICrudApiRest<T, in TKey> where T : class
{
[Post("")]
Task<T> Create([Body] T payload, [Header("Authorization")] string authorization);
Task Create([Body] T payload, [Header("Authorization")] string authorization);
[Get("")]
Task<List<T>> ReadAll([Query] int page,[Header("Authorization")] string authorization);
@ -21,9 +21,9 @@ public interface ICrudApiRest<T, in TKey> where T : class
public interface ICrudDtoApiRest<T, TDto, in TKey> where T : class where TDto : class
{
[Post("")]
Task<T> Create([Body] T payload, [Header("Authorization")] string authorization);
Task Create([Body] T payload, [Header("Authorization")] string authorization);
[Post("")]
Task<T> Create([Body] TDto payload, [Header("Authorization")] string authorization);
Task Create([Body] TDto payload, [Header("Authorization")] string authorization);
[Get("")]
Task<List<TDto>> ReadAll([Query]int page,[Header("Authorization")] string authorization);

View File

@ -5,27 +5,21 @@
<MudStack class="grow mx-3.5 my-4">
<div class="flex flex-row">
<p class="font-extrabold font-iranyekan text-base my-auto text-[#37966F]">@MedicalHistory.FullName</p>
<MudPaper Elevation="0"
class="bg-[#FFDACF] text-[#D03405] rounded-full py-0.5 px-3 my-auto mr-auto text-xs font-iranyekan">
<p>@MedicalHistory.ChiefComplaint در بخش @MedicalHistory.Section</p>
<MudPaper Elevation="0" Class="bg-gray-200 text-center rounded-full mr-auto py-0.5 px-3 text-gray-700 text-xs">
سن : @MedicalHistory.Age ساله
</MudPaper>
</div>
<MudGrid Row="true" Class="items-center justify-stretch">
<MudItem xs="4">
<MudPaper Elevation="0" Class="bg-gray-200 text-center rounded-full py-0.5 px-3 text-gray-700 text-xs">
@MedicalHistory.Age ساله
<MudItem xs="6">
<MudPaper Elevation="0"
class="bg-[#FFDACF] text-[#D03405] rounded-full text-center py-0.5 px-3 text-xs font-iranyekan">
<p>شکایت اصلی : @MedicalHistory.ChiefComplaint</p>
</MudPaper>
</MudItem>
<MudItem xs="4">
<MudItem xs="6">
<MudPaper Elevation="0" Class="bg-gray-200 text-center rounded-full py-0.5 px-3 text-gray-700 text-xs">
مرد
</MudPaper>
</MudItem>
<MudItem xs="4">
<MudPaper Elevation="0" Class="bg-gray-200 text-center rounded-full py-0.5 px-3 text-gray-700 text-xs">
@MedicalHistory.Section
بخش @MedicalHistory.SectionName
</MudPaper>
</MudItem>
</MudGrid>

View File

@ -4,7 +4,7 @@
<MudPaper Elevation="0"
class="bg-[#FFDACF] text-center text-[#D03405] rounded-full py-0.5 mt-3 mr-auto text-xs font-iranyekan">
<p>بخش @MedicalHistoryTemplate.ChiefComplaint</p>
<p>بخش @MedicalHistoryTemplate.SectionName</p>
</MudPaper>
</MudCardContent>
</MudCard>

View File

@ -0,0 +1,43 @@
@switch (Question.QuestionType)
{
case MedicalHistoryQuestionType.Selective:
<SelectiveMedicalQuestionTemplate Question="@Question.Question" AnswerChanged="async answer => await AnswerChanging(answer) " />
break;
case MedicalHistoryQuestionType.Hourly:
<HourMedicalQuestionTemplate Question="@Question.Question" AnswerChanged="async answer => await AnswerChanging(answer) " />
break;
case MedicalHistoryQuestionType.Interrogatively:
<InterrogativelyMedicalQuestionTemplate Question="@Question.Question" AnswerChanged="async answer => await AnswerChanging(answer) " />
break;
case MedicalHistoryQuestionType.YesOrNo:
<YesOrNoMedicalQuestionTemplate Question="@Question.Question" AnswerChanged="async answer => await AnswerChanging(answer) " />
break;
default:
<InterrogativelyMedicalQuestionTemplate Question="@Question.Question" AnswerChanged="async answer => await AnswerChanging(answer) " />
break;
}
@code {
[Parameter]
public MedicalHistoryQuestionSDto Question { get; set; } = new();
[Parameter]
public MedicalHistoryAnswerSDto Answer { get; set; } = new();
[Parameter]
public EventCallback<MedicalHistoryAnswerSDto> AnswerChanged { get; set; }
private async Task AnswerChanging(string answer)
{
Answer = new MedicalHistoryAnswerSDto
{
Question = Question.Question,
QuestionType = Question.QuestionType,
Answer = answer,
Part = Question.Part
};
await AnswerChanged.InvokeAsync(Answer);
}
}

View File

@ -0,0 +1,40 @@
<div class="flex flex-row mt-2">
<p class="ml-3 font-bold text-justify my-auto grow">@Question</p>
<div class="flex flex-row">
<MudIconButton @onclick="async () => await IncreaseHour()" DisableElevation="true" Class="bg-white rounded-full"
Icon="@Icons.Material.Filled.KeyboardArrowUp" Variant="Variant.Filled" />
<p class="my-auto ml-1 mr-2 text-xl font-extrabold">@Answer</p>
<p class="my-auto ml-2 font-extrabold">ساعت</p>
<MudIconButton @onclick="async () => await DecreaseHour()" DisableElevation="true" Class="bg-white rounded-full"
Icon="@Icons.Material.Filled.KeyboardArrowDown" Variant="Variant.Filled" />
</div>
</div>
@code
{
private int _hourCounter;
[Parameter]
public string Answer { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> AnswerChanged { get; set; }
[Parameter]
public string Question { get; set; } = string.Empty;
private async Task IncreaseHour()
{
_hourCounter++;
Answer = _hourCounter.ToString();
await AnswerChanged.InvokeAsync(Answer);
}
private async Task DecreaseHour()
{
_hourCounter--;
Answer = _hourCounter.ToString();
await AnswerChanged.InvokeAsync(Answer);
}
}

View File

@ -1,18 +0,0 @@
<div class="flex flex-row mt-2">
<p class="ml-3 font-bold text-justify grow">علائم از چند ساعت پیش شروع شده است ؟</p>
<div class="flex flex-row">
<MudIconButton @onclick="IncreaseHour" DisableElevation="true" Class="bg-white rounded-full"
Icon="@Icons.Material.Filled.KeyboardArrowUp" Variant="Variant.Filled" />
<p class="my-auto ml-1 mr-2 text-xl font-extrabold">@HourCounter</p>
<p class="my-auto ml-2 font-extrabold">ساعت</p>
<MudIconButton @onclick="DecreaseHour" DisableElevation="true" Class="bg-white rounded-full"
Icon="@Icons.Material.Filled.KeyboardArrowDown" Variant="Variant.Filled" />
</div>
</div>
@code {
public int HourCounter { get; set; }
private void IncreaseHour() => HourCounter++;
private void DecreaseHour() => HourCounter--;
}

View File

@ -0,0 +1,20 @@

<MudTextField T="string"
ValueChanged="async answer => { Answer = answer; await AnswerChanged.InvokeAsync(Answer); }"
Label="@Question"
Value="@Answer"
Variant="Variant.Outlined" />
@code {
[Parameter]
public string Answer { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> AnswerChanged { get; set; }
[Parameter]
public string Question { get; set; } = string.Empty;
}

View File

@ -0,0 +1,37 @@
@if (_isSelected)
{
<MudCard @onclick="SelectChanged" class="text-center bg-[--color-medicalhistory] border-2">
<MudCardContent>
<p class="font-extrabold text-gray-600 text-md">@Question</p>
</MudCardContent>
</MudCard>
}
else
{
<MudCard @onclick="SelectChanged" class="text-center">
<MudCardContent>
<p class="font-extrabold text-gray-600 text-md">@Question</p>
</MudCardContent>
</MudCard>
}
@code
{
[Parameter]
public string Answer { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> AnswerChanged { get; set; }
[Parameter]
public string Question { get; set; } = string.Empty;
private bool _isSelected = false;
private void SelectChanged()
{
Answer = _isSelected ? Question : string.Empty;
_isSelected = !_isSelected;
}
}

View File

@ -0,0 +1,73 @@
<div class="flex flex-row mt-2">
<p class="ml-3 font-bold text-justify my-auto grow">@Question</p>
<div class="flex flex-row">
@if (_isYesSelected)
{
<MudIconButton @onclick="async () => await Yes()"
DisableElevation="true"
Class="bg-[--color-medicalhistory] rounded-full mx-3"
Icon="@Icons.Material.Filled.Check"
Variant="Variant.Filled"/>
}
else
{
<MudIconButton @onclick="async () => await Yes()"
DisableElevation="true"
Class="bg-white rounded-full mx-3"
Icon="@Icons.Material.Filled.Check"
Variant="Variant.Filled"/>
}
@if (_isNoSelected)
{
<MudIconButton @onclick="async () => await No()"
DisableElevation="true"
class="bg-[--color-medicalhistory] rounded-full"
Icon="@Icons.Material.Filled.Close"
Variant="Variant.Filled"/>
}
else
{
<MudIconButton @onclick="async () => await No()"
DisableElevation="true"
class="bg-white rounded-full"
Icon="@Icons.Material.Filled.Close"
Variant="Variant.Filled"/>
}
</div>
</div>
@code
{
[Parameter]
public string Answer { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> AnswerChanged { get; set; }
[Parameter]
public string Question { get; set; } = string.Empty;
private bool _isYesSelected = false;
private bool _isNoSelected = false;
private async Task Yes()
{
Answer = "بله";
_isNoSelected = false;
_isYesSelected = true;
await AnswerChanged.InvokeAsync(Answer);
}
private async Task No()
{
Answer = "خیر";
_isNoSelected = true;
_isYesSelected = false;
await AnswerChanged.InvokeAsync(Answer);
}
}

View File

@ -533,6 +533,10 @@ video {
margin-left: 0.875rem;
margin-right: 0.875rem;
}
.mx-4 {
margin-left: 1rem;
margin-right: 1rem;
}
.mx-5 {
margin-left: 1.25rem;
margin-right: 1.25rem;
@ -608,9 +612,6 @@ video {
.mb-0\.5 {
margin-bottom: 0.125rem;
}
.mb-1 {
margin-bottom: 0.25rem;
}
.mb-2 {
margin-bottom: 0.5rem;
}
@ -695,6 +696,9 @@ video {
.h-12 {
height: 3rem;
}
.h-2 {
height: 0.5rem;
}
.h-5 {
height: 1.25rem;
}
@ -771,6 +775,12 @@ video {
.basis-1\/12 {
flex-basis: 8.333333%;
}
.basis-1\/3 {
flex-basis: 33.333333%;
}
.basis-1\/4 {
flex-basis: 25%;
}
.basis-2\/4 {
flex-basis: 50%;
}
@ -840,6 +850,9 @@ video {
border-top-left-radius: 0.75rem;
border-top-right-radius: 0.75rem;
}
.border-2 {
border-width: 2px;
}
.border-\[--color-medicalhistory\] {
border-color: var(--color-medicalhistory);
}
@ -895,9 +908,6 @@ video {
.bg-opacity-20 {
--tw-bg-opacity: 0.2;
}
.bg-opacity-70 {
--tw-bg-opacity: 0.7;
}
.p-4 {
padding: 1rem;
}

View File

@ -594,6 +594,11 @@ video {
margin-right: 0.875rem;
}
.mx-4 {
margin-left: 1rem;
margin-right: 1rem;
}
.mx-5 {
margin-left: 1.25rem;
margin-right: 1.25rem;
@ -691,10 +696,6 @@ video {
margin-bottom: 0.125rem;
}
.mb-1 {
margin-bottom: 0.25rem;
}
.mb-2 {
margin-bottom: 0.5rem;
}
@ -807,6 +808,10 @@ video {
height: 3rem;
}
.h-2 {
height: 0.5rem;
}
.h-5 {
height: 1.25rem;
}
@ -908,6 +913,14 @@ video {
flex-basis: 8.333333%;
}
.basis-1\/3 {
flex-basis: 33.333333%;
}
.basis-1\/4 {
flex-basis: 25%;
}
.basis-2\/4 {
flex-basis: 50%;
}
@ -999,6 +1012,10 @@ video {
border-top-right-radius: 0.75rem;
}
.border-2 {
border-width: 2px;
}
.border-\[--color-medicalhistory\] {
border-color: var(--color-medicalhistory);
}
@ -1069,10 +1086,6 @@ video {
--tw-bg-opacity: 0.2;
}
.bg-opacity-70 {
--tw-bg-opacity: 0.7;
}
.p-4 {
padding: 1rem;
}

View File

@ -37,6 +37,7 @@
<Using Include="DocuMed.Common.Models.Exception" />
<Using Include="DocuMed.Domain.Dtos.LargDtos" />
<Using Include="DocuMed.Domain.Dtos.SmallDtos" />
<Using Include="DocuMed.Domain.Entities.MedicalHistory" />
<Using Include="DocuMed.Domain.Entities.MedicalHistoryTemplate" />
<Using Include="DocuMed.Domain.Entities.User" />
<Using Include="DocuMed.Domain.Enums" />

View File

@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace DocuMed.Repository.Migrations
{
[DbContext(typeof(ApplicationContext))]
[Migration("20231022193344_init")]
[Migration("20231028152226_init")]
partial class init
{
/// <inheritdoc />
@ -257,9 +257,8 @@ namespace DocuMed.Repository.Migrations
b.Property<int>("SPO2")
.HasColumnType("integer");
b.Property<string>("Section")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("SectionId")
.HasColumnType("uuid");
b.Property<string>("SystemReviewDetail")
.IsRequired()
@ -342,6 +341,9 @@ namespace DocuMed.Repository.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("BodySystem")
.HasColumnType("integer");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
@ -352,6 +354,12 @@ namespace DocuMed.Repository.Migrations
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<bool>("IsSign")
.HasColumnType("boolean");
b.Property<bool>("IsSymptom")
.HasColumnType("boolean");
b.Property<Guid>("MedicalHistoryTemplateId")
.HasColumnType("uuid");
@ -430,6 +438,8 @@ namespace DocuMed.Repository.Migrations
b.HasIndex("ApplicationUserId");
b.HasIndex("SectionId");
b.ToTable("MedicalHistoryTemplates", "public");
});
@ -738,7 +748,15 @@ namespace DocuMed.Repository.Migrations
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("DocuMed.Domain.Entities.City.Section", "Section")
.WithMany()
.HasForeignKey("SectionId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("ApplicationUser");
b.Navigation("Section");
});
modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationUser", b =>

View File

@ -233,7 +233,7 @@ namespace DocuMed.Repository.Migrations
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ChiefComplaint = table.Column<string>(type: "text", nullable: false),
Section = table.Column<string>(type: "text", nullable: false),
SectionId = table.Column<Guid>(type: "uuid", nullable: false),
FirstName = table.Column<string>(type: "text", nullable: false),
LastName = table.Column<string>(type: "text", nullable: false),
FatherName = table.Column<string>(type: "text", nullable: false),
@ -295,6 +295,13 @@ namespace DocuMed.Repository.Migrations
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_Users_ApplicationUserId",
column: x => x.ApplicationUserId,
@ -393,6 +400,9 @@ namespace DocuMed.Repository.Migrations
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),
@ -450,6 +460,12 @@ namespace DocuMed.Repository.Migrations
table: "MedicalHistoryTemplates",
column: "ApplicationUserId");
migrationBuilder.CreateIndex(
name: "IX_MedicalHistoryTemplates_SectionId",
schema: "public",
table: "MedicalHistoryTemplates",
column: "SectionId");
migrationBuilder.CreateIndex(
name: "IX_RoleClaims_RoleId",
schema: "public",

View File

@ -0,0 +1,860 @@
// <auto-generated />
using System;
using DocuMed.Repository.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace DocuMed.Repository.Migrations
{
[DbContext(typeof(ApplicationContext))]
[Migration("20231028181623_editMH")]
partial class editMH
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("public")
.HasAnnotation("ProductVersion", "7.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("DocuMed.Domain.Entities.City.City", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Cities", "public");
});
modelBuilder.Entity("DocuMed.Domain.Entities.City.Section", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Detail")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("UniversityId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UniversityId");
b.ToTable("Sections", "public");
});
modelBuilder.Entity("DocuMed.Domain.Entities.City.University", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Address")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("CityId")
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CityId");
b.ToTable("Universities", "public");
});
modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("AddictionHistoryDetail")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Age")
.HasColumnType("integer");
b.Property<string>("AllergyDetail")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("ApplicationUserId")
.HasColumnType("uuid");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("ChiefComplaint")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<int>("DiastolicBloodPressure")
.HasColumnType("integer");
b.Property<string>("DrugHistoryDetail")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FamilyHistoryDetail")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FatherName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("NationalId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PastDiseasesHistoryDetail")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PastSurgeryHistoryDetail")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PresentIllnessDetail")
.IsRequired()
.HasColumnType("text");
b.Property<int>("PulseRate")
.HasColumnType("integer");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<int>("SPO2")
.HasColumnType("integer");
b.Property<Guid>("SectionId")
.HasColumnType("uuid");
b.Property<string>("SystemReviewDetail")
.IsRequired()
.HasColumnType("text");
b.Property<int>("SystolicBloodPressure")
.HasColumnType("integer");
b.Property<int>("Temperature")
.HasColumnType("integer");
b.Property<string>("VitalSignDetail")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ApplicationUserId");
b.HasIndex("SectionId");
b.ToTable("MedicalHistories", "public");
});
modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistoryAnswer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Answer")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<Guid>("MedicalHistoryId")
.HasColumnType("uuid");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Part")
.HasColumnType("integer");
b.Property<string>("Question")
.IsRequired()
.HasColumnType("text");
b.Property<int>("QuestionType")
.HasColumnType("integer");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("MedicalHistoryId");
b.ToTable("MedicalHistoryAnswers", "public");
});
modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryQuestion", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("BodySystem")
.HasColumnType("integer");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<bool>("IsSign")
.HasColumnType("boolean");
b.Property<bool>("IsSymptom")
.HasColumnType("boolean");
b.Property<Guid>("MedicalHistoryTemplateId")
.HasColumnType("uuid");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Part")
.HasColumnType("integer");
b.Property<string>("Question")
.IsRequired()
.HasColumnType("text");
b.Property<int>("QuestionType")
.HasColumnType("integer");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("MedicalHistoryTemplateId");
b.ToTable("MedicalHistoryQuestions", "public");
});
modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationUserId")
.HasColumnType("uuid");
b.Property<string>("ChiefComplaint")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("SectionId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApplicationUserId");
b.HasIndex("SectionId");
b.ToTable("MedicalHistoryTemplates", "public");
});
modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("EnglishName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PersianName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("Roles", "public");
});
modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Gender")
.HasColumnType("integer");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NationalId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<Guid?>("SectionId")
.HasColumnType("uuid");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<int>("SignUpStatus")
.HasColumnType("integer");
b.Property<string>("StudentId")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<Guid?>("UniversityId")
.HasColumnType("uuid");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.HasIndex("SectionId");
b.HasIndex("UniversityId");
b.ToTable("Users", "public");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<Guid>("RoleId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("RoleClaims", "public");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Claims", "public");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("Logins", "public");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<Guid>("RoleId")
.HasColumnType("uuid");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("UserRoles", "public");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("Tokens", "public");
});
modelBuilder.Entity("DocuMed.Domain.Entities.City.Section", b =>
{
b.HasOne("DocuMed.Domain.Entities.City.University", "University")
.WithMany("Sections")
.HasForeignKey("UniversityId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("University");
});
modelBuilder.Entity("DocuMed.Domain.Entities.City.University", b =>
{
b.HasOne("DocuMed.Domain.Entities.City.City", "City")
.WithMany("Universities")
.HasForeignKey("CityId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("City");
});
modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", b =>
{
b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", "ApplicationUser")
.WithMany()
.HasForeignKey("ApplicationUserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("DocuMed.Domain.Entities.City.Section", "Section")
.WithMany()
.HasForeignKey("SectionId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("ApplicationUser");
b.Navigation("Section");
});
modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistoryAnswer", b =>
{
b.HasOne("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", "MedicalHistory")
.WithMany("Answers")
.HasForeignKey("MedicalHistoryId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("MedicalHistory");
});
modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryQuestion", b =>
{
b.HasOne("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", "MedicalHistoryTemplate")
.WithMany("Questions")
.HasForeignKey("MedicalHistoryTemplateId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("MedicalHistoryTemplate");
});
modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", b =>
{
b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", "ApplicationUser")
.WithMany()
.HasForeignKey("ApplicationUserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("DocuMed.Domain.Entities.City.Section", "Section")
.WithMany()
.HasForeignKey("SectionId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("ApplicationUser");
b.Navigation("Section");
});
modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationUser", b =>
{
b.HasOne("DocuMed.Domain.Entities.City.Section", "Section")
.WithMany()
.HasForeignKey("SectionId");
b.HasOne("DocuMed.Domain.Entities.City.University", "University")
.WithMany()
.HasForeignKey("UniversityId");
b.Navigation("Section");
b.Navigation("University");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.HasOne("DocuMed.Domain.Entities.User.ApplicationRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
{
b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
{
b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
{
b.HasOne("DocuMed.Domain.Entities.User.ApplicationRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
{
b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
});
modelBuilder.Entity("DocuMed.Domain.Entities.City.City", b =>
{
b.Navigation("Universities");
});
modelBuilder.Entity("DocuMed.Domain.Entities.City.University", b =>
{
b.Navigation("Sections");
});
modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", b =>
{
b.Navigation("Answers");
});
modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", b =>
{
b.Navigation("Questions");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,44 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DocuMed.Repository.Migrations
{
/// <inheritdoc />
public partial class editMH : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_MedicalHistories_SectionId",
schema: "public",
table: "MedicalHistories",
column: "SectionId");
migrationBuilder.AddForeignKey(
name: "FK_MedicalHistories_Sections_SectionId",
schema: "public",
table: "MedicalHistories",
column: "SectionId",
principalSchema: "public",
principalTable: "Sections",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_MedicalHistories_Sections_SectionId",
schema: "public",
table: "MedicalHistories");
migrationBuilder.DropIndex(
name: "IX_MedicalHistories_SectionId",
schema: "public",
table: "MedicalHistories");
}
}
}

View File

@ -254,9 +254,8 @@ namespace DocuMed.Repository.Migrations
b.Property<int>("SPO2")
.HasColumnType("integer");
b.Property<string>("Section")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("SectionId")
.HasColumnType("uuid");
b.Property<string>("SystemReviewDetail")
.IsRequired()
@ -276,6 +275,8 @@ namespace DocuMed.Repository.Migrations
b.HasIndex("ApplicationUserId");
b.HasIndex("SectionId");
b.ToTable("MedicalHistories", "public");
});
@ -339,6 +340,9 @@ namespace DocuMed.Repository.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("BodySystem")
.HasColumnType("integer");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
@ -349,6 +353,12 @@ namespace DocuMed.Repository.Migrations
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
b.Property<bool>("IsSign")
.HasColumnType("boolean");
b.Property<bool>("IsSymptom")
.HasColumnType("boolean");
b.Property<Guid>("MedicalHistoryTemplateId")
.HasColumnType("uuid");
@ -427,6 +437,8 @@ namespace DocuMed.Repository.Migrations
b.HasIndex("ApplicationUserId");
b.HasIndex("SectionId");
b.ToTable("MedicalHistoryTemplates", "public");
});
@ -702,7 +714,15 @@ namespace DocuMed.Repository.Migrations
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("DocuMed.Domain.Entities.City.Section", "Section")
.WithMany()
.HasForeignKey("SectionId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("ApplicationUser");
b.Navigation("Section");
});
modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistoryAnswer", b =>
@ -735,7 +755,15 @@ namespace DocuMed.Repository.Migrations
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("DocuMed.Domain.Entities.City.Section", "Section")
.WithMany()
.HasForeignKey("SectionId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("ApplicationUser");
b.Navigation("Section");
});
modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationUser", b =>

View File

@ -0,0 +1,7 @@
namespace DocuMed.Repository.Repositories.Entities.Abstracts;
public interface IMedicalHistoryRepository : IBaseRepository<MedicalHistory>, IScopedDependency
{
public Task<List<MedicalHistorySDto>> GetMedicalHistoriesAsync(int page = 0, CancellationToken cancellationToken = default);
public Task<MedicalHistoryLDto> GetMedicalHistoryAsync(Guid id, CancellationToken cancellationToken = default);
}

View File

@ -0,0 +1,32 @@
namespace DocuMed.Repository.Repositories.Entities;
public class MedicalHistoryRepository : BaseRepository<MedicalHistory>,IMedicalHistoryRepository
{
public MedicalHistoryRepository(ApplicationContext dbContext, ICurrentUserService currentUserService) : base(dbContext, currentUserService)
{
}
public async Task<List<MedicalHistorySDto>> GetMedicalHistoriesAsync(int page = 0, CancellationToken cancellationToken = default)
{
if (!Guid.TryParse(CurrentUserService.UserId, out Guid userId))
throw new AppException("توکن غیرمجاز", ApiResultStatusCode.UnAuthorized);
var list = await TableNoTracking
.Where(t => t.ApplicationUserId == userId)
.OrderByDescending(t => t.CreatedAt)
.Skip(page * 15)
.Take(15)
.Select(MedicalHistoryMapper.ProjectToSDto)
.ToListAsync(cancellationToken);
return list;
}
public async Task<MedicalHistoryLDto> GetMedicalHistoryAsync(Guid id, CancellationToken cancellationToken = default)
{
var dto = await TableNoTracking.Where(t => t.Id == id)
.Select(MedicalHistoryMapper.ProjectToLDto)
.FirstOrDefaultAsync(cancellationToken);
if (dto == null)
throw new AppException("شرح حال پیدا نشد", ApiResultStatusCode.NotFound);
return dto;
}
}

View File

@ -19,6 +19,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocuMed.Infrastructure", "D
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{AE900A14-3A2E-4792-B7EF-641A1E60D345}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PublishFiles", "PublishFiles", "{29C90283-527F-431F-8AAC-001CFDDA8D8E}"
ProjectSection(SolutionItems) = preProject
.version = .version
Dockerfile = Dockerfile
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU