From 52b3a9ec891d9c163342f337daf201193d2c831e Mon Sep 17 00:00:00 2001 From: "Amir.H Khademi" Date: Sun, 5 Nov 2023 16:14:13 +0330 Subject: [PATCH] complete editing medical history and add ga --- DocuMed.Core/CoreServices/AccountService.cs | 27 +- .../EntityServices/MedicalHistoryService.cs | 34 +- .../Dtos/LargDtos/MedicalHistoryLDto.cs | 4 +- .../SmallDtos/MedicalHistoryQuestionSDto.cs | 2 + .../Dtos/SmallDtos/MedicalHistorySDto.cs | 2 + .../MedicalHistory.Aggregate.cs | 8 +- .../Entities/MedicalHistory/MedicalHistory.cs | 8 +- .../Mappers/MedicalHistoryMapper.g.cs | 354 +++++++++++------- DocuMed.PWA/Models/Address.cs | 18 +- DocuMed.PWA/Pages/HomePage.razor | 44 ++- DocuMed.PWA/Pages/HomePage.razor.cs | 3 +- .../Pages/MedicalHistoryActionPage.razor | 55 ++- .../Pages/MedicalHistoryActionPage.razor.cs | 118 +++++- .../MedicalHistoryActionStep1.razor | 1 - .../MedicalHistoryActionStep2.razor | 19 +- .../MedicalHistoryActionStep3.razor | 26 +- .../MedicalHistoryActionStep4.razor | 42 ++- .../MedicalHistoryActionStep5.razor | 79 +++- .../MedicalHistoryTemplateActionPage.razor | 6 +- .../MedicalHistoryTemplateActionPage.razor.cs | 1 - .../MedicalHistoryTemplateActionStep5.razor | 11 +- DocuMed.PWA/Program.cs | 8 - .../MedicalHistoryItemTemplate.razor | 5 +- .../BaseMedicalQuestionTemplate.razor | 26 +- .../HourMedicalQuestionTemplate.razor | 10 + ...terrogativelyMedicalQuestionTemplate.razor | 1 - .../RosSelectiveMedicalQuestionTemplate.razor | 91 +++++ .../SelectiveMedicalQuestionTemplate.razor | 17 +- .../YesOrNoMedicalQuestionTemplate.razor | 18 +- DocuMed.PWA/Shared/Originals/BasePageUi.razor | 2 +- DocuMed.PWA/wwwroot/css/app.min.css | 12 +- DocuMed.PWA/wwwroot/css/app.output.css | 16 +- .../Migrations/20231028181623_editMH.cs | 44 --- ...ner.cs => 20231031084330_init.Designer.cs} | 7 +- ...8152226_init.cs => 20231031084330_init.cs} | 14 + ...=> 20231105123131_editMhAddGa.Designer.cs} | 21 +- .../Migrations/20231105123131_editMhAddGa.cs | 31 ++ .../ApplicationContextModelSnapshot.cs | 7 + 38 files changed, 871 insertions(+), 321 deletions(-) create mode 100644 DocuMed.PWA/Shared/MedicalTemplates/RosSelectiveMedicalQuestionTemplate.razor delete mode 100644 DocuMed.Repository/Migrations/20231028181623_editMH.cs rename DocuMed.Repository/Migrations/{20231028181623_editMH.Designer.cs => 20231031084330_init.Designer.cs} (99%) rename DocuMed.Repository/Migrations/{20231028152226_init.cs => 20231031084330_init.cs} (97%) rename DocuMed.Repository/Migrations/{20231028152226_init.Designer.cs => 20231105123131_editMhAddGa.Designer.cs} (97%) create mode 100644 DocuMed.Repository/Migrations/20231105123131_editMhAddGa.cs diff --git a/DocuMed.Core/CoreServices/AccountService.cs b/DocuMed.Core/CoreServices/AccountService.cs index 94ab56b..a15acff 100644 --- a/DocuMed.Core/CoreServices/AccountService.cs +++ b/DocuMed.Core/CoreServices/AccountService.cs @@ -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 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> CompleteLogin(ApplicationUser user, CancellationToken cancellationToken) - => await _jwtService.Generate(user); + private async Task> CompleteLogin(ApplicationUser user, CancellationToken cancellationToken) + { + var token = await _jwtService.Generate(user); + + if (token.User.SectionId != Guid.Empty) + { + var section = await _repositoryWrapper.SetRepository
().TableNoTracking + .FirstOrDefaultAsync(s => s.Id == user.SectionId, cancellationToken); + if (section != null) + { + token.User.SectionName = section.Name; + } + } + + return token; + } diff --git a/DocuMed.Core/EntityServices/MedicalHistoryService.cs b/DocuMed.Core/EntityServices/MedicalHistoryService.cs index 4c063fe..a519f1b 100644 --- a/DocuMed.Core/EntityServices/MedicalHistoryService.cs +++ b/DocuMed.Core/EntityServices/MedicalHistoryService.cs @@ -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().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().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); diff --git a/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryLDto.cs b/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryLDto.cs index 7a10de1..21c44a6 100644 --- a/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryLDto.cs +++ b/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryLDto.cs @@ -12,6 +12,8 @@ public class MedicalHistoryLDto : BaseDto 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 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; } diff --git a/DocuMed.Domain/Dtos/SmallDtos/MedicalHistoryQuestionSDto.cs b/DocuMed.Domain/Dtos/SmallDtos/MedicalHistoryQuestionSDto.cs index bbbe058..79a7a3e 100644 --- a/DocuMed.Domain/Dtos/SmallDtos/MedicalHistoryQuestionSDto.cs +++ b/DocuMed.Domain/Dtos/SmallDtos/MedicalHistoryQuestionSDto.cs @@ -10,4 +10,6 @@ public class MedicalHistoryQuestionSDto : BaseDto 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 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; } diff --git a/DocuMed.Domain/Entities/MedicalHistory/MedicalHistory.Aggregate.cs b/DocuMed.Domain/Entities/MedicalHistory/MedicalHistory.Aggregate.cs index af3f840..6389c0d 100644 --- a/DocuMed.Domain/Entities/MedicalHistory/MedicalHistory.Aggregate.cs +++ b/DocuMed.Domain/Entities/MedicalHistory/MedicalHistory.Aggregate.cs @@ -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); } } \ No newline at end of file diff --git a/DocuMed.Domain/Entities/MedicalHistory/MedicalHistory.cs b/DocuMed.Domain/Entities/MedicalHistory/MedicalHistory.cs index 5798365..c45eb09 100644 --- a/DocuMed.Domain/Entities/MedicalHistory/MedicalHistory.cs +++ b/DocuMed.Domain/Entities/MedicalHistory/MedicalHistory.cs @@ -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; } diff --git a/DocuMed.Domain/Mappers/MedicalHistoryMapper.g.cs b/DocuMed.Domain/Mappers/MedicalHistoryMapper.g.cs index c75e6f7..27daee6 100644 --- a/DocuMed.Domain/Mappers/MedicalHistoryMapper.g.cs +++ b/DocuMed.Domain/Mappers/MedicalHistoryMapper.g.cs @@ -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> ProjectLDtoToMedicalHistory => p19 => new MedicalHistory() + public static Expression> 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(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(p22 => new MedicalHistoryAnswer() + { + Answer = p22.Answer, + Question = p22.Question, + Part = p22.Part, + QuestionType = p22.QuestionType, + MedicalHistoryId = p22.MedicalHistoryId, + Id = p22.Id }).ToList(), - 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> ProjectToLDto => p27 => new MedicalHistoryLDto() + public static Expression> 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(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(p32 => new MedicalHistoryAnswerSDto() + { + Answer = p32.Answer, + Question = p32.Question, + Part = p32.Part, + QuestionType = p32.QuestionType, + MedicalHistoryId = p32.MedicalHistoryId, + Id = p32.Id }).ToList(), - 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 funcMain4(List p17, List p18) + private static Section funcMain4(SectionSDto p17, Section p18) { if (p17 == null) { return null; } - List result = new List(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 funcMain5(List p19, List p20) + { + if (p19 == null) + { + return null; + } + List result = new List(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 funcMain5(List p22) + private static List funcMain6(List p24) { - if (p22 == null) + if (p24 == null) { return null; } - List result = new List(p22.Count); + List result = new List(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 funcMain6(List p25, List p26) + private static SectionSDto funcMain7(Section p27, SectionSDto p28) { - if (p25 == null) + if (p27 == null) { return null; } - List result = new List(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 funcMain8(List p29, List p30) + { + if (p29 == null) + { + return null; + } + List result = new List(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, diff --git a/DocuMed.PWA/Models/Address.cs b/DocuMed.PWA/Models/Address.cs index 633543e..0c2f4af 100644 --- a/DocuMed.PWA/Models/Address.cs +++ b/DocuMed.PWA/Models/Address.cs @@ -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"; } \ No newline at end of file diff --git a/DocuMed.PWA/Pages/HomePage.razor b/DocuMed.PWA/Pages/HomePage.razor index e7b6097..c383541 100644 --- a/DocuMed.PWA/Pages/HomePage.razor +++ b/DocuMed.PWA/Pages/HomePage.razor @@ -18,7 +18,7 @@

@ViewModel?.User.PhoneNumber

- @ViewModel?.User.SectionName + @ViewModel?.User.SectionName
@@ -31,32 +31,34 @@
@if (@ViewModel.IsProcessing) { - @for (int i = 0; i < 4; i++) - { - -
-
- - -
+
+ @for (int i = 0; i < 4; i++) + { + +
+
+ + +
- -
+ +
-
- - - -
- - } +
+ + + +
+ + } +
} else { -
+
@foreach (var item in @ViewModel.PageDto) { - + }
} @@ -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"); diff --git a/DocuMed.PWA/Pages/HomePage.razor.cs b/DocuMed.PWA/Pages/HomePage.razor.cs index 277ae40..4a20b97 100644 --- a/DocuMed.PWA/Pages/HomePage.razor.cs +++ b/DocuMed.PWA/Pages/HomePage.razor.cs @@ -17,6 +17,8 @@ public class HomePageViewModel : BaseViewModel> public ApplicationUserSDto User { get; private set; } = new ApplicationUserSDto(); + + public override async Task InitializeAsync() { @@ -24,7 +26,6 @@ public class HomePageViewModel : BaseViewModel> { IsProcessing = true; User = await _userUtility.GetUserAsync(); - await Task.Delay(500); var token = await _userUtility.GetBearerTokenAsync(); var list = await _restWrapper .CrudDtoApiRest(Address.MedicalHistoryController) diff --git a/DocuMed.PWA/Pages/MedicalHistoryActionPage.razor b/DocuMed.PWA/Pages/MedicalHistoryActionPage.razor index 3516f37..ea9cce1 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryActionPage.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryActionPage.razor @@ -1,4 +1,5 @@ @page "/MedicalHistoryActionPage" +@page "/MedicalHistoryActionPage/{MedicalHistoryId}" @inject NavigationManager NavigationManager @inject IRestWrapper RestWrapper @inject ISnackbar Snackbar @@ -6,32 +7,30 @@ -
+
- -
- + + @bind-SelectedSection="@ViewModel.SelectedSelection" + @bind-PatientAge="@ViewModel.PageDto.Age" + @bind-PatientFirstName="@ViewModel.PageDto.FirstName" + @bind-PatientLastName="@ViewModel.PageDto.LastName" />
-
+
-
+
-
+
-
+
+ @bind-RosDetail="@ViewModel.PageDto.SystemReviewDetail" />
@@ -74,11 +76,22 @@ @if (!@ViewModel.MedicalHistorySubmitted) { - + @if (@ViewModel.CurrentStep == 4) { - تکمیل + @if (@ViewModel.IsEditing) + { + ویرایش + } + else + { + تـــکمیل + } } else { @@ -97,10 +110,16 @@ @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(); } diff --git a/DocuMed.PWA/Pages/MedicalHistoryActionPage.razor.cs b/DocuMed.PWA/Pages/MedicalHistoryActionPage.razor.cs index 9ee0600..d1dadf8 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryActionPage.razor.cs +++ b/DocuMed.PWA/Pages/MedicalHistoryActionPage.razor.cs @@ -1,4 +1,6 @@ -namespace DocuMed.PWA.Pages; +using Mapster; + +namespace DocuMed.PWA.Pages; public class MedicalHistoryActionPageViewModel : BaseViewModel { @@ -6,6 +8,7 @@ public class MedicalHistoryActionPageViewModel : BaseViewModel(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(); + _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(Address.MedicalHistoryTemplateController) .ReadOne(SelectedTemplate.Id, token); - - PageDto.Id = dto.Id; + SelectedTemplateLDto = dto; + SelectedTemplate = dto.Adapt(); } catch (ApiException ex) { @@ -83,7 +146,6 @@ public class MedicalHistoryActionPageViewModel : BaseViewModel(Address.MedicalHistoryController) + .Update(PageDto, token); + + } + catch (ApiException ex) + { + var exe = await ex.GetContentAsAsync(); + _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); diff --git a/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep1.razor b/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep1.razor index e4730e3..81313ab 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep1.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep1.razor @@ -18,7 +18,6 @@ diff --git a/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep2.razor b/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep2.razor index 49872d4..7bb79d2 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep2.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep2.razor @@ -1,10 +1,11 @@ +@using System.Collections.ObjectModel @foreach (var question in PiQuestions) { - + } @@ -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 PiAnswers { get; set; } = new(); @@ -34,6 +49,6 @@ findAnswer.Answer = dto.Answer; else PiAnswers.Add(dto); - + } } \ No newline at end of file diff --git a/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep3.razor b/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep3.razor index 619be21..2ca236c 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep3.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep3.razor @@ -4,7 +4,7 @@ @foreach (var question in PdhQuestions) { - + } @@ -17,7 +17,7 @@ @foreach (var question in PshQuestions) { - + } 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 PdhAnswers { get; set; } = new(); diff --git a/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep4.razor b/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep4.razor index 89bde3f..526817a 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep4.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep4.razor @@ -2,7 +2,7 @@ @foreach (var question in FhQuestions) { - + } @foreach (var question in DhQuestions) { - + }
@@ -25,7 +25,7 @@
@foreach (var question in HhQuestions) { - + }
@@ -45,7 +45,37 @@ @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); } } \ No newline at end of file diff --git a/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep5.razor b/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep5.razor index 0578155..288cbb2 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep5.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryActionParts/MedicalHistoryActionStep5.razor @@ -4,7 +4,7 @@
@foreach (var question in GaQuestions) { - + }
@@ -16,26 +16,38 @@

فشــــار خون

- - + +
- + + - + - +
- @foreach (var question in GaQuestions) + @foreach (var question in RosQuestions) { - + }
@@ -47,7 +59,28 @@ @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 GaQuestions { get; set; } = new(); - - [Parameter] - public string GaDetail { get; set; } = string.Empty; - - [Parameter] - public EventCallback 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 RosAnswers { get; set; } = new(); + + [Parameter] + public List RosQuestions { get; set; } = new(); + + [Parameter] + public string GaDetail { get; set; } = string.Empty; + + [Parameter] + public EventCallback 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; } diff --git a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor index 20124ff..3e2fe7e 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor @@ -67,14 +67,14 @@ @if (@ViewModel.IsEditing) { تـــکمیل + IconSize="Size.Large" StartIcon="@Icons.Material.Filled.ChevronRight" + class="font-extrabold rounded-full bg-[--color-medicalhistory]">ویرایش } else { ویرایش + class="font-extrabold rounded-full bg-[--color-medicalhistory]">تـــکمیل } } else diff --git a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor.cs b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor.cs index 037b446..52189fa 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor.cs +++ b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor.cs @@ -160,7 +160,6 @@ public class MedicalHistoryTemplateActionPageViewModel : BaseViewModel
- + + @@ -96,9 +96,10 @@ @code { - private string _vitalSign = string.Empty; + private string _generalAppearance = string.Empty; [Parameter] public List 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; } diff --git a/DocuMed.PWA/Program.cs b/DocuMed.PWA/Program.cs index e78939e..acfb30c 100644 --- a/DocuMed.PWA/Program.cs +++ b/DocuMed.PWA/Program.cs @@ -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(); builder.Services.AddScoped(); builder.Services.AddBlazoredLocalStorage(); diff --git a/DocuMed.PWA/Shared/ItemTemplates/MedicalHistoryItemTemplate.razor b/DocuMed.PWA/Shared/ItemTemplates/MedicalHistoryItemTemplate.razor index 4019a0b..267787c 100644 --- a/DocuMed.PWA/Shared/ItemTemplates/MedicalHistoryItemTemplate.razor +++ b/DocuMed.PWA/Shared/ItemTemplates/MedicalHistoryItemTemplate.razor @@ -1,5 +1,5 @@ @using DocuMed.Domain.Dtos.SmallDtos - +
@@ -35,4 +35,7 @@ [Parameter] public MedicalHistorySDto MedicalHistory { get; set; } = new(); + [Parameter] + public EventCallback Clicked { get; set; } + } \ No newline at end of file diff --git a/DocuMed.PWA/Shared/MedicalTemplates/BaseMedicalQuestionTemplate.razor b/DocuMed.PWA/Shared/MedicalTemplates/BaseMedicalQuestionTemplate.razor index a18ee47..7177001 100644 --- a/DocuMed.PWA/Shared/MedicalTemplates/BaseMedicalQuestionTemplate.razor +++ b/DocuMed.PWA/Shared/MedicalTemplates/BaseMedicalQuestionTemplate.razor @@ -1,24 +1,26 @@ @switch (Question.QuestionType) { case MedicalHistoryQuestionType.Selective: - + break; case MedicalHistoryQuestionType.Hourly: - + break; case MedicalHistoryQuestionType.Interrogatively: - + break; case MedicalHistoryQuestionType.YesOrNo: - + + break; + case MedicalHistoryQuestionType.RosSelective: + break; default: - + 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); } diff --git a/DocuMed.PWA/Shared/MedicalTemplates/HourMedicalQuestionTemplate.razor b/DocuMed.PWA/Shared/MedicalTemplates/HourMedicalQuestionTemplate.razor index 976d976..5dedd2c 100644 --- a/DocuMed.PWA/Shared/MedicalTemplates/HourMedicalQuestionTemplate.razor +++ b/DocuMed.PWA/Shared/MedicalTemplates/HourMedicalQuestionTemplate.razor @@ -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] diff --git a/DocuMed.PWA/Shared/MedicalTemplates/InterrogativelyMedicalQuestionTemplate.razor b/DocuMed.PWA/Shared/MedicalTemplates/InterrogativelyMedicalQuestionTemplate.razor index 60e5cd0..7196d32 100644 --- a/DocuMed.PWA/Shared/MedicalTemplates/InterrogativelyMedicalQuestionTemplate.razor +++ b/DocuMed.PWA/Shared/MedicalTemplates/InterrogativelyMedicalQuestionTemplate.razor @@ -7,7 +7,6 @@ Variant="Variant.Outlined" /> @code { - [Parameter] public string Answer { get; set; } = string.Empty; diff --git a/DocuMed.PWA/Shared/MedicalTemplates/RosSelectiveMedicalQuestionTemplate.razor b/DocuMed.PWA/Shared/MedicalTemplates/RosSelectiveMedicalQuestionTemplate.razor new file mode 100644 index 0000000..c26684a --- /dev/null +++ b/DocuMed.PWA/Shared/MedicalTemplates/RosSelectiveMedicalQuestionTemplate.razor @@ -0,0 +1,91 @@ +@if (_isSelected) +{ + + +
+

@Question

+ + @BodySystem.ToDisplay() + + @if (IsSign) + { + + Sign + + } + @if (IsSymptom) + { + + Symptom + + } +
+
+
+} +else +{ + + +
+

@Question

+ + @BodySystem.ToDisplay() + + @if (IsSign) + { + + Sign + + } + @if (IsSymptom) + { + + Symptom + + } +
+
+
+} + +@code +{ + protected override void OnParametersSet() + { + base.OnParametersSet(); + if (!Answer.IsNullOrEmpty()) + { + _isSelected = Answer == Question; + } + } + + [Parameter] + public string Answer { get; set; } = string.Empty; + + [Parameter] + public EventCallback 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); + } +} \ No newline at end of file diff --git a/DocuMed.PWA/Shared/MedicalTemplates/SelectiveMedicalQuestionTemplate.razor b/DocuMed.PWA/Shared/MedicalTemplates/SelectiveMedicalQuestionTemplate.razor index 872bbbb..e35d79e 100644 --- a/DocuMed.PWA/Shared/MedicalTemplates/SelectiveMedicalQuestionTemplate.razor +++ b/DocuMed.PWA/Shared/MedicalTemplates/SelectiveMedicalQuestionTemplate.razor @@ -1,6 +1,6 @@ @if (_isSelected) { - +

@Question

@@ -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); } } diff --git a/DocuMed.PWA/Shared/MedicalTemplates/YesOrNoMedicalQuestionTemplate.razor b/DocuMed.PWA/Shared/MedicalTemplates/YesOrNoMedicalQuestionTemplate.razor index 3643fe8..26bf458 100644 --- a/DocuMed.PWA/Shared/MedicalTemplates/YesOrNoMedicalQuestionTemplate.razor +++ b/DocuMed.PWA/Shared/MedicalTemplates/YesOrNoMedicalQuestionTemplate.razor @@ -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; diff --git a/DocuMed.PWA/Shared/Originals/BasePageUi.razor b/DocuMed.PWA/Shared/Originals/BasePageUi.razor index 9856381..3e6d53d 100644 --- a/DocuMed.PWA/Shared/Originals/BasePageUi.razor +++ b/DocuMed.PWA/Shared/Originals/BasePageUi.razor @@ -22,7 +22,7 @@ }
-
+
@ChildContent
diff --git a/DocuMed.PWA/wwwroot/css/app.min.css b/DocuMed.PWA/wwwroot/css/app.min.css index 0261d0b..4b7f4ba 100644 --- a/DocuMed.PWA/wwwroot/css/app.min.css +++ b/DocuMed.PWA/wwwroot/css/app.min.css @@ -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; } diff --git a/DocuMed.PWA/wwwroot/css/app.output.css b/DocuMed.PWA/wwwroot/css/app.output.css index 23e8fac..1cb6181 100644 --- a/DocuMed.PWA/wwwroot/css/app.output.css +++ b/DocuMed.PWA/wwwroot/css/app.output.css @@ -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; } diff --git a/DocuMed.Repository/Migrations/20231028181623_editMH.cs b/DocuMed.Repository/Migrations/20231028181623_editMH.cs deleted file mode 100644 index aeada11..0000000 --- a/DocuMed.Repository/Migrations/20231028181623_editMH.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DocuMed.Repository.Migrations -{ - /// - public partial class editMH : Migration - { - /// - 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); - } - - /// - 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"); - } - } -} diff --git a/DocuMed.Repository/Migrations/20231028181623_editMH.Designer.cs b/DocuMed.Repository/Migrations/20231031084330_init.Designer.cs similarity index 99% rename from DocuMed.Repository/Migrations/20231028181623_editMH.Designer.cs rename to DocuMed.Repository/Migrations/20231031084330_init.Designer.cs index f9f2e0d..b279313 100644 --- a/DocuMed.Repository/Migrations/20231028181623_editMH.Designer.cs +++ b/DocuMed.Repository/Migrations/20231031084330_init.Designer.cs @@ -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 { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -221,6 +221,9 @@ namespace DocuMed.Repository.Migrations .IsRequired() .HasColumnType("text"); + b.Property("MedicalHistoryTemplateId") + .HasColumnType("uuid"); + b.Property("ModifiedAt") .HasColumnType("timestamp without time zone"); diff --git a/DocuMed.Repository/Migrations/20231028152226_init.cs b/DocuMed.Repository/Migrations/20231031084330_init.cs similarity index 97% rename from DocuMed.Repository/Migrations/20231028152226_init.cs rename to DocuMed.Repository/Migrations/20231031084330_init.cs index 1c0009f..19bb292 100644 --- a/DocuMed.Repository/Migrations/20231028152226_init.cs +++ b/DocuMed.Repository/Migrations/20231031084330_init.cs @@ -254,6 +254,7 @@ namespace DocuMed.Repository.Migrations PulseRate = table.Column(type: "integer", nullable: false), SPO2 = table.Column(type: "integer", nullable: false), Temperature = table.Column(type: "integer", nullable: false), + MedicalHistoryTemplateId = table.Column(type: "uuid", nullable: false), ApplicationUserId = table.Column(type: "uuid", nullable: false), RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), CreatedAt = table.Column(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", diff --git a/DocuMed.Repository/Migrations/20231028152226_init.Designer.cs b/DocuMed.Repository/Migrations/20231105123131_editMhAddGa.Designer.cs similarity index 97% rename from DocuMed.Repository/Migrations/20231028152226_init.Designer.cs rename to DocuMed.Repository/Migrations/20231105123131_editMhAddGa.Designer.cs index 8cefa00..9944ad6 100644 --- a/DocuMed.Repository/Migrations/20231028152226_init.Designer.cs +++ b/DocuMed.Repository/Migrations/20231105123131_editMhAddGa.Designer.cs @@ -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 { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -214,6 +214,10 @@ namespace DocuMed.Repository.Migrations .IsRequired() .HasColumnType("text"); + b.Property("GeneralAppearanceDetail") + .IsRequired() + .HasColumnType("text"); + b.Property("IsRemoved") .HasColumnType("boolean"); @@ -221,6 +225,9 @@ namespace DocuMed.Repository.Migrations .IsRequired() .HasColumnType("text"); + b.Property("MedicalHistoryTemplateId") + .HasColumnType("uuid"); + b.Property("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 => diff --git a/DocuMed.Repository/Migrations/20231105123131_editMhAddGa.cs b/DocuMed.Repository/Migrations/20231105123131_editMhAddGa.cs new file mode 100644 index 0000000..5efd6e5 --- /dev/null +++ b/DocuMed.Repository/Migrations/20231105123131_editMhAddGa.cs @@ -0,0 +1,31 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace DocuMed.Repository.Migrations +{ + /// + public partial class editMhAddGa : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "GeneralAppearanceDetail", + schema: "public", + table: "MedicalHistories", + type: "text", + nullable: false, + defaultValue: ""); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "GeneralAppearanceDetail", + schema: "public", + table: "MedicalHistories"); + } + } +} diff --git a/DocuMed.Repository/Migrations/ApplicationContextModelSnapshot.cs b/DocuMed.Repository/Migrations/ApplicationContextModelSnapshot.cs index 44276a9..29eefdd 100644 --- a/DocuMed.Repository/Migrations/ApplicationContextModelSnapshot.cs +++ b/DocuMed.Repository/Migrations/ApplicationContextModelSnapshot.cs @@ -211,6 +211,10 @@ namespace DocuMed.Repository.Migrations .IsRequired() .HasColumnType("text"); + b.Property("GeneralAppearanceDetail") + .IsRequired() + .HasColumnType("text"); + b.Property("IsRemoved") .HasColumnType("boolean"); @@ -218,6 +222,9 @@ namespace DocuMed.Repository.Migrations .IsRequired() .HasColumnType("text"); + b.Property("MedicalHistoryTemplateId") + .HasColumnType("uuid"); + b.Property("ModifiedAt") .HasColumnType("timestamp without time zone");