complete editing medical history and add ga

master
Amir Hossein Khademi 2023-11-05 16:14:13 +03:30
parent 99648676b3
commit 52b3a9ec89
38 changed files with 871 additions and 321 deletions

View File

@ -1,4 +1,6 @@
namespace DocuMed.Core.CoreServices;
using DocuMed.Domain.Entities.City;
namespace DocuMed.Core.CoreServices;
public class AccountService : IAccountService
@ -10,6 +12,7 @@ public class AccountService : IAccountService
private readonly ICurrentUserService _currentUserService;
private readonly IUserService _userService;
private readonly ISmsService _smsService;
private readonly IRepositoryWrapper _repositoryWrapper;
public AccountService(
UserManager<ApplicationUser> userManager,
@ -17,7 +20,8 @@ public class AccountService : IAccountService
IJwtService jwtService,
ICurrentUserService currentUserService,
IUserService userService,
ISmsService smsService)
ISmsService smsService,
IRepositoryWrapper repositoryWrapper)
{
_userManager = userManager;
_userSignInManager = userSignInManager;
@ -25,6 +29,7 @@ public class AccountService : IAccountService
_currentUserService = currentUserService;
_userService = userService;
_smsService = smsService;
_repositoryWrapper = repositoryWrapper;
}
@ -134,8 +139,22 @@ public class AccountService : IAccountService
}
private async Task<AccessToken<ApplicationUserSDto>> CompleteLogin(ApplicationUser user, CancellationToken cancellationToken)
=> await _jwtService.Generate<ApplicationUserSDto, ApplicationUser>(user);
private async Task<AccessToken<ApplicationUserSDto>> CompleteLogin(ApplicationUser user, CancellationToken cancellationToken)
{
var token = await _jwtService.Generate<ApplicationUserSDto, ApplicationUser>(user);
if (token.User.SectionId != Guid.Empty)
{
var section = await _repositoryWrapper.SetRepository<Section>().TableNoTracking
.FirstOrDefaultAsync(s => s.Id == user.SectionId, cancellationToken);
if (section != null)
{
token.User.SectionName = section.Name;
}
}
return token;
}

View File

@ -21,14 +21,36 @@ public class MedicalHistoryService : IMedicalHistoryService
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.LastName, template.FatherName, template.NationalId, template.Age, template.BirthDate,
template.PresentIllnessDetail, template.PastDiseasesHistoryDetail, template.PastSurgeryHistoryDetail,
template.FamilyHistoryDetail, template.AllergyDetail, template.DrugHistoryDetail,
template.AddictionHistoryDetail, template.SystemReviewDetail, template.VitalSignDetail,
template.AddictionHistoryDetail, template.SystemReviewDetail, template.VitalSignDetail, template.GeneralAppearanceDetail,
template.SystolicBloodPressure, template.DiastolicBloodPressure, template.PulseRate, template.SPO2,
template.Temperature, template.ApplicationUserId);
template.Temperature, template.ApplicationUserId, template.MedicalHistoryTemplateId);
ent.Id = template.Id;
foreach (var answer in template.Answers.Where(a=>a.Id == Guid.Empty))
ent.AddAnswer(answer.Answer, answer.Question, answer.Part, answer.QuestionType);
foreach (var answer in template.Answers.Where(a => a.Id != Guid.Empty))
{
var dbAnswer = await _repositoryWrapper.SetRepository<MedicalHistoryAnswer>().TableNoTracking
.FirstOrDefaultAsync(a => a.Id == answer.Id, cancellationToken);
if (dbAnswer != null && dbAnswer.Answer != answer.Answer)
{
dbAnswer = MedicalHistoryAnswer.Create(answer.Answer, answer.Question, answer.Part, answer.QuestionType,
dbAnswer.MedicalHistoryId);
dbAnswer.Id = answer.Id;
_repositoryWrapper.SetRepository<MedicalHistoryAnswer>().Update(dbAnswer);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
}
}
_medicalHistoryRepository.Update(ent);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return true;
}
@ -37,12 +59,12 @@ public class MedicalHistoryService : IMedicalHistoryService
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.LastName, template.FatherName, template.NationalId, template.Age, template.BirthDate,
template.PresentIllnessDetail, template.PastDiseasesHistoryDetail, template.PastSurgeryHistoryDetail,
template.FamilyHistoryDetail, template.AllergyDetail, template.DrugHistoryDetail,
template.AddictionHistoryDetail, template.SystemReviewDetail, template.VitalSignDetail,
template.AddictionHistoryDetail, template.SystemReviewDetail, template.VitalSignDetail, template.GeneralAppearanceDetail,
template.SystolicBloodPressure, template.DiastolicBloodPressure, template.PulseRate, template.SPO2,
template.Temperature, userId);
template.Temperature, userId,template.MedicalHistoryTemplateId);
foreach (var answer in template.Answers)
ent.AddAnswer(answer.Answer, answer.Question, answer.Part, answer.QuestionType);

View File

@ -12,6 +12,8 @@ public class MedicalHistoryLDto : BaseDto<MedicalHistoryLDto,MedicalHistory>
public int Age { get; set; }
public DateTime BirthDate { get; set; }
public SectionSDto Section { get; set; } = new();
public string PresentIllnessDetail { get; set; } = string.Empty;
public string PastDiseasesHistoryDetail { get; set; } = string.Empty;
public string PastSurgeryHistoryDetail { get; set; } = string.Empty;
@ -23,7 +25,7 @@ public class MedicalHistoryLDto : BaseDto<MedicalHistoryLDto,MedicalHistory>
public string VitalSignDetail { get; set; } = string.Empty;
public string GeneralAppearanceDetail { get; set; } = string.Empty;
public Guid MedicalHistoryTemplateId { get; set; }
public int SystolicBloodPressure { get; set; }
public int DiastolicBloodPressure { get; set; }
public int PulseRate { get; set; }

View File

@ -10,4 +10,6 @@ public class MedicalHistoryQuestionSDto : BaseDto<MedicalHistoryQuestionSDto,Med
public BodySystem BodySystem { get; set; }
public bool IsSign { get; set; }
public bool IsSymptom { get; set; }
public MedicalHistoryAnswerSDto Answer { get; set; } = new();
}

View File

@ -10,6 +10,7 @@ public class MedicalHistorySDto : BaseDto<MedicalHistorySDto,MedicalHistory>
public string LastName { get; set; } = string.Empty;
public string FatherName { get; set; } = string.Empty;
public string NationalId { get; set; } = string.Empty;
public Guid MedicalHistoryTemplateId { get; set; }
public int Age { get; set; }
public DateTime BirthDate { get; set; }
@ -22,6 +23,7 @@ public class MedicalHistorySDto : BaseDto<MedicalHistorySDto,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

@ -39,12 +39,14 @@ public partial class MedicalHistory
string addictionHistoryDetail,
string systemReviewDetail,
string vitalSignDetail,
string generalAppearanceDetail,
int systolicBloodPressure,
int diastolicBloodPressure,
int pulseRate,
int sPO2,
int temperature,
Guid applicationUserId)
Guid applicationUserId,
Guid medicalHistoryTemplateId)
{
return new MedicalHistory(presentIllnessDetail,
pastDiseasesHistoryDetail,
@ -55,6 +57,7 @@ public partial class MedicalHistory
addictionHistoryDetail,
systemReviewDetail,
vitalSignDetail,
generalAppearanceDetail,
chiefComplaint,
sectionId,
firstName,
@ -68,7 +71,8 @@ public partial class MedicalHistory
pulseRate,
sPO2,
temperature,
applicationUserId);
applicationUserId,
medicalHistoryTemplateId);
}
}

View File

@ -20,6 +20,7 @@ public partial class MedicalHistory : ApiEntity
string addictionHistoryDetail,
string systemReviewDetail,
string vitalSignDetail,
string generalAppearanceDetail,
string chiefComplaint,
Guid sectionId,
string firstName,
@ -33,7 +34,8 @@ public partial class MedicalHistory : ApiEntity
int pulseRate,
int spo2,
int temperature,
Guid applicationUserId)
Guid applicationUserId,
Guid medicalHistoryTemplateId)
{
PresentIllnessDetail = presentIllnessDetail;
PastDiseasesHistoryDetail = pastDiseasesHistoryDetail;
@ -44,6 +46,7 @@ public partial class MedicalHistory : ApiEntity
AddictionHistoryDetail = addictionHistoryDetail;
SystemReviewDetail = systemReviewDetail;
VitalSignDetail = vitalSignDetail;
GeneralAppearanceDetail = generalAppearanceDetail;
ChiefComplaint = chiefComplaint;
SectionId = sectionId;
FirstName = firstName;
@ -58,6 +61,7 @@ public partial class MedicalHistory : ApiEntity
SPO2 = spo2;
Temperature = temperature;
ApplicationUserId = applicationUserId;
MedicalHistoryTemplateId = medicalHistoryTemplateId;
}
public string ChiefComplaint { get; internal set; } = string.Empty;
public Guid SectionId { get; internal set; }
@ -79,6 +83,7 @@ public partial class MedicalHistory : ApiEntity
public string AddictionHistoryDetail { get; internal set; } = string.Empty;
public string SystemReviewDetail { get; internal set; } = string.Empty;
public string VitalSignDetail { get; internal set; } = string.Empty;
public string GeneralAppearanceDetail { get; internal set; } = string.Empty;
public int SystolicBloodPressure { get; internal set; }
@ -87,6 +92,7 @@ public partial class MedicalHistory : ApiEntity
public int SPO2 { get; internal set; }
public int Temperature { get; internal set; }
public Guid MedicalHistoryTemplateId { get; internal set; }
public Guid ApplicationUserId { get; internal set; }
public ApplicationUser? ApplicationUser { get; internal set; }

View File

@ -39,11 +39,13 @@ namespace DocuMed.Domain.Mappers
AddictionHistoryDetail = p1.AddictionHistoryDetail,
SystemReviewDetail = p1.SystemReviewDetail,
VitalSignDetail = p1.VitalSignDetail,
GeneralAppearanceDetail = p1.GeneralAppearanceDetail,
SystolicBloodPressure = p1.SystolicBloodPressure,
DiastolicBloodPressure = p1.DiastolicBloodPressure,
PulseRate = p1.PulseRate,
SPO2 = p1.SPO2,
Temperature = p1.Temperature,
MedicalHistoryTemplateId = p1.MedicalHistoryTemplateId,
ApplicationUserId = p1.ApplicationUserId,
ApplicationUser = new ApplicationUser() {Id = p1.ApplicationUserId},
Id = p1.Id
@ -75,11 +77,13 @@ namespace DocuMed.Domain.Mappers
result.AddictionHistoryDetail = p2.AddictionHistoryDetail;
result.SystemReviewDetail = p2.SystemReviewDetail;
result.VitalSignDetail = p2.VitalSignDetail;
result.GeneralAppearanceDetail = p2.GeneralAppearanceDetail;
result.SystolicBloodPressure = p2.SystolicBloodPressure;
result.DiastolicBloodPressure = p2.DiastolicBloodPressure;
result.PulseRate = p2.PulseRate;
result.SPO2 = p2.SPO2;
result.Temperature = p2.Temperature;
result.MedicalHistoryTemplateId = p2.MedicalHistoryTemplateId;
result.ApplicationUserId = p2.ApplicationUserId;
result.ApplicationUser = funcMain2(new Never(), result.ApplicationUser, p2);
result.Id = p2.Id;
@ -110,11 +114,13 @@ namespace DocuMed.Domain.Mappers
AddictionHistoryDetail = p8.AddictionHistoryDetail,
SystemReviewDetail = p8.SystemReviewDetail,
VitalSignDetail = p8.VitalSignDetail,
GeneralAppearanceDetail = p8.GeneralAppearanceDetail,
SystolicBloodPressure = p8.SystolicBloodPressure,
DiastolicBloodPressure = p8.DiastolicBloodPressure,
PulseRate = p8.PulseRate,
SPO2 = p8.SPO2,
Temperature = p8.Temperature,
MedicalHistoryTemplateId = p8.MedicalHistoryTemplateId,
ApplicationUserId = p8.ApplicationUserId,
ApplicationUser = new ApplicationUser() {Id = p8.ApplicationUserId},
Id = p8.Id
@ -130,6 +136,7 @@ namespace DocuMed.Domain.Mappers
LastName = p9.LastName,
FatherName = p9.FatherName,
NationalId = p9.NationalId,
MedicalHistoryTemplateId = p9.MedicalHistoryTemplateId,
Age = p9.Age,
BirthDate = p9.BirthDate,
PresentIllnessDetail = p9.PresentIllnessDetail,
@ -141,6 +148,7 @@ namespace DocuMed.Domain.Mappers
AddictionHistoryDetail = p9.AddictionHistoryDetail,
SystemReviewDetail = p9.SystemReviewDetail,
VitalSignDetail = p9.VitalSignDetail,
GeneralAppearanceDetail = p9.GeneralAppearanceDetail,
SystolicBloodPressure = p9.SystolicBloodPressure,
DiastolicBloodPressure = p9.DiastolicBloodPressure,
PulseRate = p9.PulseRate,
@ -165,6 +173,7 @@ namespace DocuMed.Domain.Mappers
result.LastName = p10.LastName;
result.FatherName = p10.FatherName;
result.NationalId = p10.NationalId;
result.MedicalHistoryTemplateId = p10.MedicalHistoryTemplateId;
result.Age = p10.Age;
result.BirthDate = p10.BirthDate;
result.PresentIllnessDetail = p10.PresentIllnessDetail;
@ -176,6 +185,7 @@ namespace DocuMed.Domain.Mappers
result.AddictionHistoryDetail = p10.AddictionHistoryDetail;
result.SystemReviewDetail = p10.SystemReviewDetail;
result.VitalSignDetail = p10.VitalSignDetail;
result.GeneralAppearanceDetail = p10.GeneralAppearanceDetail;
result.SystolicBloodPressure = p10.SystolicBloodPressure;
result.DiastolicBloodPressure = p10.DiastolicBloodPressure;
result.PulseRate = p10.PulseRate;
@ -195,6 +205,7 @@ namespace DocuMed.Domain.Mappers
LastName = p12.LastName,
FatherName = p12.FatherName,
NationalId = p12.NationalId,
MedicalHistoryTemplateId = p12.MedicalHistoryTemplateId,
Age = p12.Age,
BirthDate = p12.BirthDate,
PresentIllnessDetail = p12.PresentIllnessDetail,
@ -206,6 +217,7 @@ namespace DocuMed.Domain.Mappers
AddictionHistoryDetail = p12.AddictionHistoryDetail,
SystemReviewDetail = p12.SystemReviewDetail,
VitalSignDetail = p12.VitalSignDetail,
GeneralAppearanceDetail = p12.GeneralAppearanceDetail,
SystolicBloodPressure = p12.SystolicBloodPressure,
DiastolicBloodPressure = p12.DiastolicBloodPressure,
PulseRate = p12.PulseRate,
@ -220,6 +232,13 @@ namespace DocuMed.Domain.Mappers
{
ChiefComplaint = p13.ChiefComplaint,
SectionId = p13.SectionId,
Section = p13.Section == null ? null : new Section()
{
Name = p13.Section.Name,
Detail = p13.Section.Detail,
UniversityId = p13.Section.UniversityId,
Id = p13.Section.Id
},
FirstName = p13.FirstName,
LastName = p13.LastName,
FatherName = p13.FatherName,
@ -235,11 +254,13 @@ namespace DocuMed.Domain.Mappers
AddictionHistoryDetail = p13.AddictionHistoryDetail,
SystemReviewDetail = p13.SystemReviewDetail,
VitalSignDetail = p13.VitalSignDetail,
GeneralAppearanceDetail = p13.GeneralAppearanceDetail,
SystolicBloodPressure = p13.SystolicBloodPressure,
DiastolicBloodPressure = p13.DiastolicBloodPressure,
PulseRate = p13.PulseRate,
SPO2 = p13.SPO2,
Temperature = p13.Temperature,
MedicalHistoryTemplateId = p13.MedicalHistoryTemplateId,
ApplicationUserId = p13.ApplicationUserId,
Answers = funcMain3(p13.Answers),
Id = p13.Id
@ -255,6 +276,7 @@ namespace DocuMed.Domain.Mappers
result.ChiefComplaint = p15.ChiefComplaint;
result.SectionId = p15.SectionId;
result.Section = funcMain4(p15.Section, result.Section);
result.FirstName = p15.FirstName;
result.LastName = p15.LastName;
result.FatherName = p15.FatherName;
@ -270,155 +292,187 @@ namespace DocuMed.Domain.Mappers
result.AddictionHistoryDetail = p15.AddictionHistoryDetail;
result.SystemReviewDetail = p15.SystemReviewDetail;
result.VitalSignDetail = p15.VitalSignDetail;
result.GeneralAppearanceDetail = p15.GeneralAppearanceDetail;
result.SystolicBloodPressure = p15.SystolicBloodPressure;
result.DiastolicBloodPressure = p15.DiastolicBloodPressure;
result.PulseRate = p15.PulseRate;
result.SPO2 = p15.SPO2;
result.Temperature = p15.Temperature;
result.MedicalHistoryTemplateId = p15.MedicalHistoryTemplateId;
result.ApplicationUserId = p15.ApplicationUserId;
result.Answers = funcMain4(p15.Answers, result.Answers);
result.Answers = funcMain5(p15.Answers, result.Answers);
result.Id = p15.Id;
return result;
}
public static Expression<Func<MedicalHistoryLDto, MedicalHistory>> ProjectLDtoToMedicalHistory => p19 => new MedicalHistory()
public static Expression<Func<MedicalHistoryLDto, MedicalHistory>> ProjectLDtoToMedicalHistory => p21 => 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()
ChiefComplaint = p21.ChiefComplaint,
SectionId = p21.SectionId,
Section = p21.Section == null ? null : new Section()
{
Answer = p20.Answer,
Question = p20.Question,
Part = p20.Part,
QuestionType = p20.QuestionType,
MedicalHistoryId = p20.MedicalHistoryId,
Id = p20.Id
Name = p21.Section.Name,
Detail = p21.Section.Detail,
UniversityId = p21.Section.UniversityId,
Id = p21.Section.Id
},
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,
GeneralAppearanceDetail = p21.GeneralAppearanceDetail,
SystolicBloodPressure = p21.SystolicBloodPressure,
DiastolicBloodPressure = p21.DiastolicBloodPressure,
PulseRate = p21.PulseRate,
SPO2 = p21.SPO2,
Temperature = p21.Temperature,
MedicalHistoryTemplateId = p21.MedicalHistoryTemplateId,
ApplicationUserId = p21.ApplicationUserId,
Answers = p21.Answers.Select<MedicalHistoryAnswerSDto, MedicalHistoryAnswer>(p22 => new MedicalHistoryAnswer()
{
Answer = p22.Answer,
Question = p22.Question,
Part = p22.Part,
QuestionType = p22.QuestionType,
MedicalHistoryId = p22.MedicalHistoryId,
Id = p22.Id
}).ToList<MedicalHistoryAnswer>(),
Id = p19.Id
Id = p21.Id
};
public static MedicalHistoryLDto AdaptToLDto(this MedicalHistory p21)
public static MedicalHistoryLDto AdaptToLDto(this MedicalHistory p23)
{
return p21 == null ? null : new MedicalHistoryLDto()
return p23 == 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
ChiefComplaint = p23.ChiefComplaint,
SectionId = p23.SectionId,
FirstName = p23.FirstName,
LastName = p23.LastName,
FatherName = p23.FatherName,
NationalId = p23.NationalId,
Age = p23.Age,
BirthDate = p23.BirthDate,
Section = p23.Section == null ? null : new SectionSDto()
{
Name = p23.Section.Name,
Detail = p23.Section.Detail,
UniversityId = p23.Section.UniversityId,
Id = p23.Section.Id
},
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,
GeneralAppearanceDetail = p23.GeneralAppearanceDetail,
MedicalHistoryTemplateId = p23.MedicalHistoryTemplateId,
SystolicBloodPressure = p23.SystolicBloodPressure,
DiastolicBloodPressure = p23.DiastolicBloodPressure,
PulseRate = p23.PulseRate,
SPO2 = p23.SPO2,
Temperature = p23.Temperature,
ApplicationUserId = p23.ApplicationUserId,
Answers = funcMain6(p23.Answers),
Id = p23.Id
};
}
public static MedicalHistoryLDto AdaptTo(this MedicalHistory p23, MedicalHistoryLDto p24)
public static MedicalHistoryLDto AdaptTo(this MedicalHistory p25, MedicalHistoryLDto p26)
{
if (p23 == null)
if (p25 == null)
{
return null;
}
MedicalHistoryLDto result = p24 ?? new MedicalHistoryLDto();
MedicalHistoryLDto result = p26 ?? 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;
result.ChiefComplaint = p25.ChiefComplaint;
result.SectionId = p25.SectionId;
result.FirstName = p25.FirstName;
result.LastName = p25.LastName;
result.FatherName = p25.FatherName;
result.NationalId = p25.NationalId;
result.Age = p25.Age;
result.BirthDate = p25.BirthDate;
result.Section = funcMain7(p25.Section, result.Section);
result.PresentIllnessDetail = p25.PresentIllnessDetail;
result.PastDiseasesHistoryDetail = p25.PastDiseasesHistoryDetail;
result.PastSurgeryHistoryDetail = p25.PastSurgeryHistoryDetail;
result.FamilyHistoryDetail = p25.FamilyHistoryDetail;
result.AllergyDetail = p25.AllergyDetail;
result.DrugHistoryDetail = p25.DrugHistoryDetail;
result.AddictionHistoryDetail = p25.AddictionHistoryDetail;
result.SystemReviewDetail = p25.SystemReviewDetail;
result.VitalSignDetail = p25.VitalSignDetail;
result.GeneralAppearanceDetail = p25.GeneralAppearanceDetail;
result.MedicalHistoryTemplateId = p25.MedicalHistoryTemplateId;
result.SystolicBloodPressure = p25.SystolicBloodPressure;
result.DiastolicBloodPressure = p25.DiastolicBloodPressure;
result.PulseRate = p25.PulseRate;
result.SPO2 = p25.SPO2;
result.Temperature = p25.Temperature;
result.ApplicationUserId = p25.ApplicationUserId;
result.Answers = funcMain8(p25.Answers, result.Answers);
result.Id = p25.Id;
return result;
}
public static Expression<Func<MedicalHistory, MedicalHistoryLDto>> ProjectToLDto => p27 => new MedicalHistoryLDto()
public static Expression<Func<MedicalHistory, MedicalHistoryLDto>> ProjectToLDto => p31 => 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()
ChiefComplaint = p31.ChiefComplaint,
SectionId = p31.SectionId,
FirstName = p31.FirstName,
LastName = p31.LastName,
FatherName = p31.FatherName,
NationalId = p31.NationalId,
Age = p31.Age,
BirthDate = p31.BirthDate,
Section = p31.Section == null ? null : new SectionSDto()
{
Answer = p28.Answer,
Question = p28.Question,
Part = p28.Part,
QuestionType = p28.QuestionType,
MedicalHistoryId = p28.MedicalHistoryId,
Id = p28.Id
Name = p31.Section.Name,
Detail = p31.Section.Detail,
UniversityId = p31.Section.UniversityId,
Id = p31.Section.Id
},
PresentIllnessDetail = p31.PresentIllnessDetail,
PastDiseasesHistoryDetail = p31.PastDiseasesHistoryDetail,
PastSurgeryHistoryDetail = p31.PastSurgeryHistoryDetail,
FamilyHistoryDetail = p31.FamilyHistoryDetail,
AllergyDetail = p31.AllergyDetail,
DrugHistoryDetail = p31.DrugHistoryDetail,
AddictionHistoryDetail = p31.AddictionHistoryDetail,
SystemReviewDetail = p31.SystemReviewDetail,
VitalSignDetail = p31.VitalSignDetail,
GeneralAppearanceDetail = p31.GeneralAppearanceDetail,
MedicalHistoryTemplateId = p31.MedicalHistoryTemplateId,
SystolicBloodPressure = p31.SystolicBloodPressure,
DiastolicBloodPressure = p31.DiastolicBloodPressure,
PulseRate = p31.PulseRate,
SPO2 = p31.SPO2,
Temperature = p31.Temperature,
ApplicationUserId = p31.ApplicationUserId,
Answers = p31.Answers.Select<MedicalHistoryAnswer, MedicalHistoryAnswerSDto>(p32 => new MedicalHistoryAnswerSDto()
{
Answer = p32.Answer,
Question = p32.Question,
Part = p32.Part,
QuestionType = p32.QuestionType,
MedicalHistoryId = p32.MedicalHistoryId,
Id = p32.Id
}).ToList<MedicalHistoryAnswerSDto>(),
Id = p27.Id
Id = p31.Id
};
private static Section funcMain1(Never p4, Section p5, MedicalHistorySDto p2)
@ -469,20 +523,36 @@ namespace DocuMed.Domain.Mappers
}
private static List<MedicalHistoryAnswer> funcMain4(List<MedicalHistoryAnswerSDto> p17, List<MedicalHistoryAnswer> p18)
private static Section funcMain4(SectionSDto p17, Section p18)
{
if (p17 == null)
{
return null;
}
List<MedicalHistoryAnswer> result = new List<MedicalHistoryAnswer>(p17.Count);
Section result = p18 ?? new Section();
result.Name = p17.Name;
result.Detail = p17.Detail;
result.UniversityId = p17.UniversityId;
result.Id = p17.Id;
return result;
}
private static List<MedicalHistoryAnswer> funcMain5(List<MedicalHistoryAnswerSDto> p19, List<MedicalHistoryAnswer> p20)
{
if (p19 == null)
{
return null;
}
List<MedicalHistoryAnswer> result = new List<MedicalHistoryAnswer>(p19.Count);
int i = 0;
int len = p17.Count;
int len = p19.Count;
while (i < len)
{
MedicalHistoryAnswerSDto item = p17[i];
MedicalHistoryAnswerSDto item = p19[i];
result.Add(item == null ? null : new MedicalHistoryAnswer()
{
Answer = item.Answer,
@ -498,20 +568,20 @@ namespace DocuMed.Domain.Mappers
}
private static List<MedicalHistoryAnswerSDto> funcMain5(List<MedicalHistoryAnswer> p22)
private static List<MedicalHistoryAnswerSDto> funcMain6(List<MedicalHistoryAnswer> p24)
{
if (p22 == null)
if (p24 == null)
{
return null;
}
List<MedicalHistoryAnswerSDto> result = new List<MedicalHistoryAnswerSDto>(p22.Count);
List<MedicalHistoryAnswerSDto> result = new List<MedicalHistoryAnswerSDto>(p24.Count);
int i = 0;
int len = p22.Count;
int len = p24.Count;
while (i < len)
{
MedicalHistoryAnswer item = p22[i];
MedicalHistoryAnswer item = p24[i];
result.Add(item == null ? null : new MedicalHistoryAnswerSDto()
{
Answer = item.Answer,
@ -527,20 +597,36 @@ namespace DocuMed.Domain.Mappers
}
private static List<MedicalHistoryAnswerSDto> funcMain6(List<MedicalHistoryAnswer> p25, List<MedicalHistoryAnswerSDto> p26)
private static SectionSDto funcMain7(Section p27, SectionSDto p28)
{
if (p25 == null)
if (p27 == null)
{
return null;
}
List<MedicalHistoryAnswerSDto> result = new List<MedicalHistoryAnswerSDto>(p25.Count);
SectionSDto result = p28 ?? new SectionSDto();
result.Name = p27.Name;
result.Detail = p27.Detail;
result.UniversityId = p27.UniversityId;
result.Id = p27.Id;
return result;
}
private static List<MedicalHistoryAnswerSDto> funcMain8(List<MedicalHistoryAnswer> p29, List<MedicalHistoryAnswerSDto> p30)
{
if (p29 == null)
{
return null;
}
List<MedicalHistoryAnswerSDto> result = new List<MedicalHistoryAnswerSDto>(p29.Count);
int i = 0;
int len = p25.Count;
int len = p29.Count;
while (i < len)
{
MedicalHistoryAnswer item = p25[i];
MedicalHistoryAnswer item = p29[i];
result.Add(item == null ? null : new MedicalHistoryAnswerSDto()
{
Answer = item.Answer,

View File

@ -2,12 +2,16 @@
public static class Address
{
#if DEBUG
public static string BaseAddress = "http://localhost:32770/api";
public static readonly string AuthController = $"{BaseAddress}/auth";
public static readonly string CityController = $"{BaseAddress}/city";
public static readonly string UniversityController = $"{BaseAddress}/university";
public static readonly string SectionController = $"{BaseAddress}/section";
public static readonly string UserController = $"{BaseAddress}/user";
public static readonly string MedicalHistoryTemplateController = $"{BaseAddress}/medicalhistory/template";
public static readonly string MedicalHistoryController = $"{BaseAddress}/medicalhistory";
#else
public static string BaseAddress = "https://api.documed.ir/api";
#endif
public static string AuthController = $"{BaseAddress}/auth";
public static string CityController = $"{BaseAddress}/city";
public static string UniversityController = $"{BaseAddress}/university";
public static string SectionController = $"{BaseAddress}/section";
public static string UserController = $"{BaseAddress}/user";
public static string MedicalHistoryTemplateController = $"{BaseAddress}/medicalhistory/template";
public static string MedicalHistoryController = $"{BaseAddress}/medicalhistory";
}

View File

@ -18,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">@ViewModel?.User.SectionName</MudButton>
<MudButton @onclick="ProfileClicked" 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">
@ -31,32 +31,34 @@
</div>
@if (@ViewModel.IsProcessing)
{
@for (int i = 0; i < 4; i++)
{
<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>
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-2">
@for (int i = 0; i < 4; i++)
{
<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>
<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 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 ">
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-2">
@foreach (var item in @ViewModel.PageDto)
{
<MedicalHistoryItemTemplate MedicalHistory="@item" />
<MedicalHistoryItemTemplate Clicked="MedicalHistoryClicked" MedicalHistory="@item" />
}
</div>
}
@ -108,6 +110,8 @@
public void CreateMedicalHistoryClicked() => NavigationManager.NavigateTo("MedicalHistoryActionPage");
public void MedicalHistoryClicked(MedicalHistorySDto medicalHistory) => NavigationManager.NavigateTo($"MedicalHistoryActionPage/{medicalHistory.Id}");
public void MedicalHistoryTemplatesClicked() => NavigationManager.NavigateTo("MedicalHistoryTemplatesPage");
public void MedicalOrdersClicked() => NavigationManager.NavigateTo("MedicalOrdersPage");

View File

@ -17,6 +17,8 @@ public class HomePageViewModel : BaseViewModel<List<MedicalHistorySDto>>
public ApplicationUserSDto User { get; private set; } = new ApplicationUserSDto();
public override async Task InitializeAsync()
{
@ -24,7 +26,6 @@ public class HomePageViewModel : BaseViewModel<List<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)

View File

@ -1,4 +1,5 @@
@page "/MedicalHistoryActionPage"
@page "/MedicalHistoryActionPage/{MedicalHistoryId}"
@inject NavigationManager NavigationManager
@inject IRestWrapper RestWrapper
@inject ISnackbar Snackbar
@ -6,32 +7,30 @@
<BasePageUi Title="افزودن یک شرحال جدید" Description="لطفا اطلاعات بیمار را با دقت کامل وارد کنید">
<div class="flex flex-col w-full h-full rounded-t-xl">
<div class="flex flex-col w-full h-full rounded-t-xl p-1">
<MudCarousel class="w-full h-full overflow-x-hidden overflow-y-scroll" @ref="@ViewModel.Carousel" ShowArrows="false"
<MudCarousel class="flex-grow 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
@bind-ChiefComplaint="@ViewModel.PageDto.ChiefComplaint"
<div class="flex flex-col w-full h-full p-4">
<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"
/>
@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">
<div class="flex flex-col h-full p-4">
<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">
<div class="flex flex-col h-full p-4">
<MedicalHistoryActionStep3 PdhQuestions="@ViewModel.SelectedTemplateLDto.Questions.Where(q=>q.Part==MedicalHistoryPart.PastDiseasesHistory).ToList()"
PdhAnswers="@ViewModel.PdhAnswers"
@bind-PdhDetail="@ViewModel.PageDto.PastDiseasesHistoryDetail"
@ -41,7 +40,7 @@
</div>
</MudCarouselItem>
<MudCarouselItem>
<div class="flex flex-col h-full">
<div class="flex flex-col h-full p-4">
<MedicalHistoryActionStep4 DhQuestions="@ViewModel.SelectedTemplateLDto.Questions.Where(q=>q.Part==MedicalHistoryPart.DrugHistory).ToList()"
DhAnswers="@ViewModel.DhAnswers"
@bind-DhDetail="@ViewModel.PageDto.DrugHistoryDetail"
@ -54,15 +53,18 @@
</div>
</MudCarouselItem>
<MudCarouselItem>
<div class="flex flex-col h-full">
<div class="flex flex-col h-full p-4">
<MedicalHistoryActionStep5 GaQuestions="@ViewModel.SelectedTemplateLDto.Questions.Where(q=>q.Part==MedicalHistoryPart.GeneralAppearance).ToList()"
GaAnswers="@ViewModel.GaAnswers"
RosQuestions="@ViewModel.SelectedTemplateLDto.Questions.Where(q=>q.Part==MedicalHistoryPart.ReviewOfSystem).ToList()"
RosAnswers="@ViewModel.RosAnswers"
@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"/>
@bind-RosDetail="@ViewModel.PageDto.SystemReviewDetail" />
</div>
</MudCarouselItem>
<MudCarouselItem>
@ -74,11 +76,22 @@
@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">
<MudPaper class="basis-auto bottom-0 left-0 fixed w-full bg-[--color-medicalhistory] px-3 pt-4 pb-3 rounded-t-xl flex flex-row">
@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>
@if (@ViewModel.IsEditing)
{
<MudButton @onclick="@ViewModel.CompleteStepClicked" Variant="Variant.Filled"
IconSize="Size.Large" StartIcon="@Icons.Material.Filled.ChevronRight"
class="font-extrabold rounded-full bg-[--color-primary]">ویرایش</MudButton>
}
else
{
<MudButton @onclick="@ViewModel.CompleteStepClicked" Variant="Variant.Filled"
IconSize="Size.Large" StartIcon="@Icons.Material.Filled.ChevronRight"
class="font-extrabold rounded-full bg-[--color-primary]">تـــکمیل</MudButton>
}
}
else
{
@ -97,10 +110,16 @@
</BasePageUi>
@code {
[Parameter]
public string MedicalHistoryId { get; set; } = string.Empty;
public MedicalHistoryActionPageViewModel ViewModel { get; set; }
protected override async Task OnInitializedAsync()
{
ViewModel = new MedicalHistoryActionPageViewModel(RestWrapper, NavigationManager, Snackbar, UserUtility);
ViewModel = Guid.TryParse(MedicalHistoryId, out Guid medicalHistoryId) ?
new MedicalHistoryActionPageViewModel(RestWrapper, NavigationManager, Snackbar, UserUtility, medicalHistoryId)
: new MedicalHistoryActionPageViewModel(RestWrapper, NavigationManager, Snackbar, UserUtility);
await ViewModel.InitializeAsync();
await base.OnInitializedAsync();
}

View File

@ -1,4 +1,6 @@
namespace DocuMed.PWA.Pages;
using Mapster;
namespace DocuMed.PWA.Pages;
public class MedicalHistoryActionPageViewModel : BaseViewModel<MedicalHistoryLDto>
{
@ -6,6 +8,7 @@ public class MedicalHistoryActionPageViewModel : BaseViewModel<MedicalHistoryLDt
private readonly NavigationManager _navigationManager;
private readonly ISnackbar _snackbar;
private readonly IUserUtility _userUtility;
private readonly Guid _medicalHistoryId;
public MedicalHistoryActionPageViewModel(IRestWrapper restWrapper,
NavigationManager navigationManager,
@ -18,6 +21,21 @@ public class MedicalHistoryActionPageViewModel : BaseViewModel<MedicalHistoryLDt
_userUtility = userUtility;
}
public MedicalHistoryActionPageViewModel(IRestWrapper restWrapper,
NavigationManager navigationManager,
ISnackbar snackbar,
IUserUtility userUtility,
Guid medicalHistoryId)
{
_restWrapper = restWrapper;
_navigationManager = navigationManager;
_snackbar = snackbar;
_userUtility = userUtility;
_medicalHistoryId = medicalHistoryId;
IsEditing = true;
}
public MedicalHistoryTemplateSDto SelectedTemplate { get; set; } = new();
public MedicalHistoryTemplateLDto SelectedTemplateLDto { get; set; } = new();
@ -37,24 +55,69 @@ public class MedicalHistoryActionPageViewModel : BaseViewModel<MedicalHistoryLDt
public int CurrentStep { get; set; } = 0;
public string StepCounter { get; set; } = "1 / 5";
public bool MedicalHistorySubmitted { get; set; } = false;
public override async Task InitializeAsync()
{
if (_medicalHistoryId != Guid.Empty && IsEditing)
{
try
{
IsProcessing = true;
var token = await _userUtility.GetBearerTokenAsync();
var dto = await _restWrapper.CrudDtoApiRest<MedicalHistorySDto, MedicalHistoryLDto, Guid>(Address.MedicalHistoryController)
.ReadOne(_medicalHistoryId, token);
PageDto = dto;
SelectedSelection = dto.Section;
PiAnswers.AddRange(dto.Answers.Where(q => q.Part == MedicalHistoryPart.PresentIllness));
PdhAnswers.AddRange(dto.Answers.Where(q => q.Part == MedicalHistoryPart.PastDiseasesHistory));
PshAnswers.AddRange(dto.Answers.Where(q => q.Part == MedicalHistoryPart.PastSurgeryHistory));
FhAnswers.AddRange(dto.Answers.Where(q => q.Part == MedicalHistoryPart.FamilyHistory));
DhAnswers.AddRange(dto.Answers.Where(q => q.Part == MedicalHistoryPart.DrugHistory));
HhAnswers.AddRange(dto.Answers.Where(q => q.Part == MedicalHistoryPart.AddictionHistory));
GaAnswers.AddRange(dto.Answers.Where(q => q.Part == MedicalHistoryPart.GeneralAppearance));
RosAnswers.AddRange(dto.Answers.Where(q => q.Part == MedicalHistoryPart.ReviewOfSystem));
if (dto.MedicalHistoryTemplateId != Guid.Empty)
{
SelectedTemplate = new MedicalHistoryTemplateSDto { Id = dto.MedicalHistoryTemplateId };
await SelectTemplateAsync();
}
}
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;
}
}
await base.InitializeAsync();
}
public async Task CompleteStepClicked()
{
CurrentStep++;
StepCounter = $"{CurrentStep + 1} / 5";
if (CurrentStep == 1)
await CheckMedicalHistoryAsync();
await SelectTemplateAsync();
if (CurrentStep == 5)
{
//if (IsEditing)
// await EditTemplateAsync();
//else
if (IsEditing)
await EditMedicalHistoryAsync();
else
await SubmitMedicalHistoryAsync();
MedicalHistorySubmitted = true;
}
Carousel?.MoveTo(CurrentStep);
}
private async Task CheckMedicalHistoryAsync()
private async Task SelectTemplateAsync()
{
try
{
@ -65,9 +128,9 @@ public class MedicalHistoryActionPageViewModel : BaseViewModel<MedicalHistoryLDt
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;
SelectedTemplate = dto.Adapt<MedicalHistoryTemplateSDto>();
}
catch (ApiException ex)
{
@ -83,7 +146,6 @@ public class MedicalHistoryActionPageViewModel : BaseViewModel<MedicalHistoryLDt
IsProcessing = false;
}
}
@ -124,6 +186,44 @@ public class MedicalHistoryActionPageViewModel : BaseViewModel<MedicalHistoryLDt
}
}
public async Task EditMedicalHistoryAsync()
{
try
{
IsProcessing = true;
if (SelectedSelection == null)
throw new Exception("لطفا بخش مورد نظر را انتخاب نمایید");
PageDto.SectionId = SelectedSelection.Id;
var token = await _userUtility.GetBearerTokenAsync();
PageDto.SectionId = SelectedSelection.Id;
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)
.Update(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);

View File

@ -18,7 +18,6 @@
<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>

View File

@ -1,10 +1,11 @@
@using System.Collections.ObjectModel
<MudStack class="font-iranyekan">
<BasePartDivider Index="2" Title="تاریخچه بیماری فعلی ( PI )" />
@foreach (var question in PiQuestions)
{
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="AnswerChanged" />
<BaseMedicalQuestionTemplate Question="@question" Answer="@question.Answer" AnswerChanged="AnswerChanged" />
}
@ -15,6 +16,20 @@
@code
{
protected override void OnParametersSet()
{
if (PiAnswers.Count > 0)
{
foreach (var question in PiQuestions)
{
var answer = PiAnswers.FirstOrDefault(a => a.Question == question.Question && a.Part == question.Part);
if (answer != null)
question.Answer = answer;
}
}
base.OnParametersSet();
}
[Parameter]
public List<MedicalHistoryAnswerSDto> PiAnswers { get; set; } = new();
@ -34,6 +49,6 @@
findAnswer.Answer = dto.Answer;
else
PiAnswers.Add(dto);
}
}

View File

@ -4,7 +4,7 @@
@foreach (var question in PdhQuestions)
{
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="PdhAnswerChanged" />
<BaseMedicalQuestionTemplate Question="@question" Answer="@question.Answer" AnswerChanged="PdhAnswerChanged" />
}
@ -17,7 +17,7 @@
@foreach (var question in PshQuestions)
{
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="PshAnswerChanged" />
<BaseMedicalQuestionTemplate Question="@question" Answer="@question.Answer" AnswerChanged="PshAnswerChanged" />
}
<MudTextField Margin="Margin.Dense"
@ -28,6 +28,28 @@
@code
{
protected override void OnParametersSet()
{
if (PdhAnswers.Count > 0)
{
foreach (var question in PdhQuestions)
{
var answer = PdhAnswers.FirstOrDefault(a => a.Question == question.Question && a.Part == question.Part);
if (answer != null)
question.Answer = answer;
}
}
if (PshAnswers.Count > 0)
{
foreach (var question in PshQuestions)
{
var answer = PshAnswers.FirstOrDefault(a => a.Question == question.Question && a.Part == question.Part);
if (answer != null)
question.Answer = answer;
}
}
base.OnParametersSet();
}
[Parameter]
public List<MedicalHistoryAnswerSDto> PdhAnswers { get; set; } = new();

View File

@ -2,7 +2,7 @@
<BasePartDivider Index="5" Title="تاریخچه بیماری های خانوادگی ( FH )" />
@foreach (var question in FhQuestions)
{
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="FhAnswerChanged" />
<BaseMedicalQuestionTemplate Question="@question" Answer="@question.Answer" AnswerChanged="FhAnswerChanged" />
}
<MudTextField T="string"
Value="@FhDetail" ValueChanged="async detail => { FhDetail = detail; await FhDetailChanged.InvokeAsync(detail); }"
@ -13,7 +13,7 @@
<div class="grid grid-cols-2 gap-1 md:grid-cols-4 sm:grid-cols-2">
@foreach (var question in DhQuestions)
{
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="DhAnswerChanged" />
<BaseMedicalQuestionTemplate Question="@question" Answer="@question.Answer" AnswerChanged="DhAnswerChanged" />
}
</div>
@ -25,7 +25,7 @@
<div class="grid grid-cols-2 gap-1 md:grid-cols-4 sm:grid-cols-2">
@foreach (var question in HhQuestions)
{
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="HhAnswerChanged" />
<BaseMedicalQuestionTemplate Question="@question" Answer="@question.Answer" AnswerChanged="HhAnswerChanged" />
}
</div>
@ -45,7 +45,37 @@
</MudStack>
@code {
protected override void OnParametersSet()
{
if (FhAnswers.Count > 0)
{
foreach (var question in FhQuestions)
{
var answer = FhAnswers.FirstOrDefault(a => a.Question == question.Question && a.Part == question.Part);
if (answer != null)
question.Answer = answer;
}
}
if (DhAnswers.Count > 0)
{
foreach (var question in DhQuestions)
{
var answer = DhAnswers.FirstOrDefault(a => a.Question == question.Question && a.Part == question.Part);
if (answer != null)
question.Answer = answer;
}
}
if (HhAnswers.Count > 0)
{
foreach (var question in HhQuestions)
{
var answer = HhAnswers.FirstOrDefault(a => a.Question == question.Question && a.Part == question.Part);
if (answer != null)
question.Answer = answer;
}
}
base.OnParametersSet();
}
[Parameter]
public string AhDetail { get; set; } = string.Empty;
@ -108,10 +138,10 @@
private void HhAnswerChanged(MedicalHistoryAnswerSDto dto)
{
var findAnswer = DhAnswers.FirstOrDefault(pi => pi.Question == dto.Question && pi.Part == dto.Part);
var findAnswer = HhAnswers.FirstOrDefault(pi => pi.Question == dto.Question && pi.Part == dto.Part);
if (findAnswer != null)
findAnswer.Answer = dto.Answer;
else
DhAnswers.Add(dto);
HhAnswers.Add(dto);
}
}

View File

@ -4,7 +4,7 @@
<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" />
<BaseMedicalQuestionTemplate Question="@question" Answer="@question.Answer" AnswerChanged="GaAnswerChanged" />
}
</div>
@ -16,26 +16,38 @@
<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" 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" />
<MudTextField InputType="InputType.Number"
Value="@SystolicBloodPressure" ValueChanged="async detail => { SystolicBloodPressure = detail; await SystolicBloodPressureChanged.InvokeAsync(detail); }"
Label="سیستولیک"
Margin="Margin.Dense"
class="mx-3 my-auto basis-1/12" T="int" Variant="Variant.Outlined" />
<MudTextField InputType="InputType.Number"
Value="@DiastolicBloodPressure" ValueChanged="async detail => { DiastolicBloodPressure = detail; await DiastolicBloodPressureChanged.InvokeAsync(detail); }"
Label="دیاستولیک"
Margin="Margin.Dense"
class="my-auto basis-1/12" T="int" Variant="Variant.Outlined" />
</div>
<div class="grid grid-cols-3">
<MudTextField InputType="InputType.Number" Margin="Margin.Dense" Label="نبض" T="string" Variant="Variant.Outlined" />
<MudTextField Value="@PulseRate" ValueChanged="async detail => { PulseRate = detail; await PulseRateChanged.InvokeAsync(detail); }"
InputType="InputType.Number" Margin="Margin.Dense" Label="نبض" T="int" Variant="Variant.Outlined" />
<MudTextField InputType="InputType.Number" class="mx-2" Margin="Margin.Dense" Label="اکسیژن" T="string" Variant="Variant.Outlined" />
<MudTextField Value="@SPO2" ValueChanged="async detail => { SPO2 = detail; await SPO2Changed.InvokeAsync(detail); }"
InputType="InputType.Number" class="mx-2" Margin="Margin.Dense" Label="اکسیژن" T="int" Variant="Variant.Outlined" />
<MudTextField InputType="InputType.Number" Margin="Margin.Dense" Label="دمای بدن" T="string" Variant="Variant.Outlined" />
<MudTextField Value="@Temperature" ValueChanged="async detail => { Temperature = detail; await TemperatureChanged.InvokeAsync(detail); }"
InputType="InputType.Number" Margin="Margin.Dense" Label="دمای بدن" T="int" Variant="Variant.Outlined" />
</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)
@foreach (var question in RosQuestions)
{
<BaseMedicalQuestionTemplate Question="@question" AnswerChanged="GaAnswerChanged" />
<BaseMedicalQuestionTemplate Question="@question" Answer="@question.Answer" AnswerChanged="RosAnswerChanged" />
}
</div>
@ -47,7 +59,28 @@
</MudStack>
@code {
protected override void OnParametersSet()
{
if (GaAnswers.Count > 0)
{
foreach (var question in GaQuestions)
{
var answer = GaAnswers.FirstOrDefault(a => a.Question == question.Question && a.Part == question.Part);
if (answer != null)
question.Answer = answer;
}
}
if (RosAnswers.Count > 0)
{
foreach (var question in RosQuestions)
{
var answer = RosAnswers.FirstOrDefault(a => a.Question == question.Question && a.Part == question.Part);
if (answer != null)
question.Answer = answer;
}
}
base.OnParametersSet();
}
[Parameter]
public string RosDetail { get; set; } = string.Empty;
@ -59,13 +92,6 @@
[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);
@ -75,6 +101,27 @@
GaAnswers.Add(dto);
}
[Parameter]
public List<MedicalHistoryAnswerSDto> RosAnswers { get; set; } = new();
[Parameter]
public List<MedicalHistoryQuestionSDto> RosQuestions { get; set; } = new();
[Parameter]
public string GaDetail { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> GaDetailChanged { get; set; }
private void RosAnswerChanged(MedicalHistoryAnswerSDto dto)
{
var findAnswer = RosAnswers.FirstOrDefault(pi => pi.Question == dto.Question && pi.Part == dto.Part);
if (findAnswer != null)
findAnswer.Answer = dto.Answer;
else
RosAnswers.Add(dto);
}
[Parameter]
public int SystolicBloodPressure { get; set; }

View File

@ -67,14 +67,14 @@
@if (@ViewModel.IsEditing)
{
<MudButton @onclick="@ViewModel.CompleteStepClicked" Variant="Variant.Filled"
IconSize="Size.Large" StartIcon="@Icons.Material.Filled.ChevronRight"
class="font-extrabold rounded-full bg-[--color-medicalhistory]">تـــکمیل</MudButton>
IconSize="Size.Large" StartIcon="@Icons.Material.Filled.ChevronRight"
class="font-extrabold rounded-full bg-[--color-medicalhistory]">ویرایش</MudButton>
}
else
{
<MudButton @onclick="@ViewModel.CompleteStepClicked" Variant="Variant.Filled"
IconSize="Size.Large" StartIcon="@Icons.Material.Filled.ChevronRight"
class="font-extrabold rounded-full bg-[--color-medicalhistory]">ویرایش</MudButton>
class="font-extrabold rounded-full bg-[--color-medicalhistory]">تـــکمیل</MudButton>
}
}
else

View File

@ -160,7 +160,6 @@ 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);

View File

@ -12,7 +12,7 @@
</div>
<div class="flex flex-row">
<MudTextField @bind-Value="@_vitalSign" class="grow" T="string" Label="نام دارو مورد نظر" Variant="Variant.Outlined" />
<MudTextField @bind-Value="@_generalAppearance" class="grow" T="string" Label="نام دارو مورد نظر" Variant="Variant.Outlined" />
<MudButton Variant="Variant.Outlined" @onclick="AddGeneralAppearance" Color="Color.Info" IconSize="Size.Large" DisableElevation="false" class="mx-2 mt-1.5 mb-0.5 pt-2 text-4xl rounded-md">
+
@ -96,9 +96,10 @@
</MudStack>
@code {
private string _vitalSign = string.Empty;
private string _generalAppearance = string.Empty;
[Parameter]
public List<MedicalHistoryQuestionSDto> GeneralAppearance { get; set; } = new();
private void RemoveGeneralAppearance(MedicalHistoryQuestionSDto generalAppearance)
{
GeneralAppearance.Remove(generalAppearance);
@ -107,11 +108,11 @@
{
GeneralAppearance.Add(new MedicalHistoryQuestionSDto
{
Question = _vitalSign,
Question = _generalAppearance,
QuestionType = MedicalHistoryQuestionType.Selective,
Part = MedicalHistoryPart.VitalSign
Part = MedicalHistoryPart.GeneralAppearance
});
_vitalSign = string.Empty;
_generalAppearance = string.Empty;
}

View File

@ -9,14 +9,6 @@ builder.Services.AddMudServices(config =>
config.SnackbarConfiguration.SnackbarVariant = Variant.Filled;
config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomRight;
});
if (builder.HostEnvironment.IsDevelopment())
{
Address.BaseAddress = "http://localhost:32770/api";
}
else if (builder.HostEnvironment.IsProduction())
{
Address.BaseAddress = "https://documed.ir/api";
}
builder.Services.AddScoped<IRestWrapper, RestWrapper>();
builder.Services.AddScoped<IUserUtility, UserUtility>();
builder.Services.AddBlazoredLocalStorage();

View File

@ -1,5 +1,5 @@
@using DocuMed.Domain.Dtos.SmallDtos
<MudCard Class="mx-3 my-1 rounded-md" Elevation="2">
<MudCard @onclick="async ()=> await Clicked.InvokeAsync(MedicalHistory)" Class="mx-3 my-1 rounded-md" Elevation="2">
<div class="flex flex-row">
<div class="bg-[--color-primary] rounded-r-lg w-2"></div>
<MudStack class="grow mx-3.5 my-4">
@ -35,4 +35,7 @@
[Parameter]
public MedicalHistorySDto MedicalHistory { get; set; } = new();
[Parameter]
public EventCallback<MedicalHistorySDto> Clicked { get; set; }
}

View File

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

View File

@ -13,6 +13,16 @@
@code
{
protected override void OnParametersSet()
{
base.OnParametersSet();
if (!Answer.IsNullOrEmpty() && int.TryParse(Answer, out int hCounter))
{
_hourCounter = hCounter;
}
}
private int _hourCounter;
[Parameter]

View File

@ -7,7 +7,6 @@
Variant="Variant.Outlined" />
@code {
[Parameter]
public string Answer { get; set; } = string.Empty;

View File

@ -0,0 +1,91 @@
@if (_isSelected)
{
<MudCard @onclick="SelectChanged" class="text-center bg-[--color-medicalhistory]">
<MudCardContent>
<div class="flex flex-row">
<p class="flex-grow font-extrabold text-gray-600 text-md">@Question</p>
<MudPaper Elevation="0" Class="mx-1 mt-1 w-fit text-center rounded-full py-0.5 px-3 text-gray-800 text-xs">
@BodySystem.ToDisplay()
</MudPaper>
@if (IsSign)
{
<MudPaper Elevation="0" Class="mx-1 mt-1 w-fit text-center rounded-full py-0.5 px-3 text-gray-800 text-xs">
Sign
</MudPaper>
}
@if (IsSymptom)
{
<MudPaper Elevation="0" Class="mx-1 mt-1 w-fit text-center rounded-full py-0.5 px-3 text-gray-800 text-xs">
Symptom
</MudPaper>
}
</div>
</MudCardContent>
</MudCard>
}
else
{
<MudCard @onclick="SelectChanged" class="text-center">
<MudCardContent>
<div class="flex flex-row">
<p class="flex-grow font-extrabold text-gray-600 text-md">@Question</p>
<MudPaper Elevation="0" Class="mx-1 mt-1 w-fit text-center rounded-full py-0.5 px-3 text-gray-800 text-xs">
@BodySystem.ToDisplay()
</MudPaper>
@if (IsSign)
{
<MudPaper Elevation="0" Class="mx-1 mt-1 w-fit text-center rounded-full py-0.5 px-3 text-gray-800 text-xs">
Sign
</MudPaper>
}
@if (IsSymptom)
{
<MudPaper Elevation="0" Class="mx-1 mt-1 w-fit text-center rounded-full py-0.5 px-3 text-gray-800 text-xs">
Symptom
</MudPaper>
}
</div>
</MudCardContent>
</MudCard>
}
@code
{
protected override void OnParametersSet()
{
base.OnParametersSet();
if (!Answer.IsNullOrEmpty())
{
_isSelected = Answer == Question;
}
}
[Parameter]
public string Answer { get; set; } = string.Empty;
[Parameter]
public EventCallback<string> AnswerChanged { get; set; }
[Parameter]
public string Question { get; set; } = string.Empty;
[Parameter]
public BodySystem BodySystem { get; set; }
[Parameter]
public bool IsSign { get; set; }
[Parameter]
public bool IsSymptom { get; set; }
private bool _isSelected = false;
private async Task SelectChanged()
{
_isSelected = !_isSelected;
Answer = _isSelected ? Question : string.Empty;
await AnswerChanged.InvokeAsync(Answer);
}
}

View File

@ -1,6 +1,6 @@
@if (_isSelected)
{
<MudCard @onclick="SelectChanged" class="text-center bg-[--color-medicalhistory] border-2">
<MudCard @onclick="SelectChanged" class="text-center bg-[--color-medicalhistory]">
<MudCardContent>
<p class="font-extrabold text-gray-600 text-md">@Question</p>
</MudCardContent>
@ -17,6 +17,15 @@ else
@code
{
protected override void OnParametersSet()
{
base.OnParametersSet();
if (!Answer.IsNullOrEmpty())
{
_isSelected = Answer == Question;
}
}
[Parameter]
public string Answer { get; set; } = string.Empty;
@ -28,10 +37,12 @@ else
private bool _isSelected = false;
private void SelectChanged()
private async Task SelectChanged()
{
_isSelected = !_isSelected;
Answer = _isSelected ? Question : string.Empty;
_isSelected = !_isSelected;
await AnswerChanged.InvokeAsync(Answer);
}
}

View File

@ -42,7 +42,23 @@
@code
{
protected override void OnParametersSet()
{
base.OnParametersSet();
if (!Answer.IsNullOrEmpty())
{
if (Answer == "بله")
{
_isNoSelected = false;
_isYesSelected = true;
}
else if (Answer == "خیر")
{
_isNoSelected = true;
_isYesSelected = false;
}
}
}
[Parameter]
public string Answer { get; set; } = string.Empty;

View File

@ -22,7 +22,7 @@
<MudIconButton @onclick="BackClicked" Icon="@Icons.Material.TwoTone.ChevronLeft" class="w-10 h-10 my-auto ml-4 mr-auto font-extrabold bg-white rounded-full" />
}
</div>
<div class="bg-[#EEEEEE] w-full h-full flex flex-col rounded-t-xl p-5">
<div class="bg-[#EEEEEE] w-full h-full flex flex-col rounded-t-xl">
@ChildContent
</div>
</MudStack>

View File

@ -769,6 +769,9 @@ video {
.flex-none {
flex: none;
}
.flex-grow {
flex-grow: 1;
}
.grow {
flex-grow: 1;
}
@ -784,6 +787,9 @@ video {
.basis-2\/4 {
flex-basis: 50%;
}
.basis-auto {
flex-basis: auto;
}
.grid-cols-1 {
grid-template-columns: repeat(1, minmax(0, 1fr));
}
@ -850,9 +856,6 @@ 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);
}
@ -908,6 +911,9 @@ video {
.bg-opacity-20 {
--tw-bg-opacity: 0.2;
}
.p-1 {
padding: 0.25rem;
}
.p-4 {
padding: 1rem;
}

View File

@ -905,6 +905,10 @@ video {
flex: none;
}
.flex-grow {
flex-grow: 1;
}
.grow {
flex-grow: 1;
}
@ -925,6 +929,10 @@ video {
flex-basis: 50%;
}
.basis-auto {
flex-basis: auto;
}
.grid-cols-1 {
grid-template-columns: repeat(1, minmax(0, 1fr));
}
@ -1012,10 +1020,6 @@ video {
border-top-right-radius: 0.75rem;
}
.border-2 {
border-width: 2px;
}
.border-\[--color-medicalhistory\] {
border-color: var(--color-medicalhistory);
}
@ -1086,6 +1090,10 @@ video {
--tw-bg-opacity: 0.2;
}
.p-1 {
padding: 0.25rem;
}
.p-4 {
padding: 1rem;
}

View File

@ -1,44 +0,0 @@
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

@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace DocuMed.Repository.Migrations
{
[DbContext(typeof(ApplicationContext))]
[Migration("20231028181623_editMH")]
partial class editMH
[Migration("20231031084330_init")]
partial class init
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -221,6 +221,9 @@ namespace DocuMed.Repository.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("MedicalHistoryTemplateId")
.HasColumnType("uuid");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");

View File

@ -254,6 +254,7 @@ namespace DocuMed.Repository.Migrations
PulseRate = table.Column<int>(type: "integer", nullable: false),
SPO2 = table.Column<int>(type: "integer", nullable: false),
Temperature = table.Column<int>(type: "integer", nullable: false),
MedicalHistoryTemplateId = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationUserId = 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),
@ -266,6 +267,13 @@ namespace DocuMed.Repository.Migrations
constraints: table =>
{
table.PrimaryKey("PK_MedicalHistories", x => x.Id);
table.ForeignKey(
name: "FK_MedicalHistories_Sections_SectionId",
column: x => x.SectionId,
principalSchema: "public",
principalTable: "Sections",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_MedicalHistories_Users_ApplicationUserId",
column: x => x.ApplicationUserId,
@ -442,6 +450,12 @@ namespace DocuMed.Repository.Migrations
table: "MedicalHistories",
column: "ApplicationUserId");
migrationBuilder.CreateIndex(
name: "IX_MedicalHistories_SectionId",
schema: "public",
table: "MedicalHistories",
column: "SectionId");
migrationBuilder.CreateIndex(
name: "IX_MedicalHistoryAnswers_MedicalHistoryId",
schema: "public",

View File

@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace DocuMed.Repository.Migrations
{
[DbContext(typeof(ApplicationContext))]
[Migration("20231028152226_init")]
partial class init
[Migration("20231105123131_editMhAddGa")]
partial class editMhAddGa
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -214,6 +214,10 @@ namespace DocuMed.Repository.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<string>("GeneralAppearanceDetail")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
@ -221,6 +225,9 @@ namespace DocuMed.Repository.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("MedicalHistoryTemplateId")
.HasColumnType("uuid");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");
@ -278,6 +285,8 @@ namespace DocuMed.Repository.Migrations
b.HasIndex("ApplicationUserId");
b.HasIndex("SectionId");
b.ToTable("MedicalHistories", "public");
});
@ -715,7 +724,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 =>

View File

@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DocuMed.Repository.Migrations
{
/// <inheritdoc />
public partial class editMhAddGa : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "GeneralAppearanceDetail",
schema: "public",
table: "MedicalHistories",
type: "text",
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "GeneralAppearanceDetail",
schema: "public",
table: "MedicalHistories");
}
}
}

View File

@ -211,6 +211,10 @@ namespace DocuMed.Repository.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<string>("GeneralAppearanceDetail")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsRemoved")
.HasColumnType("boolean");
@ -218,6 +222,9 @@ namespace DocuMed.Repository.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("MedicalHistoryTemplateId")
.HasColumnType("uuid");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("timestamp without time zone");