using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using DocuMed.Domain.Dtos.LargDtos; using DocuMed.Domain.Dtos.SmallDtos; using DocuMed.Domain.Entities.Hospitals; using DocuMed.Domain.Entities.MedicalHistory; using Mapster.Models; namespace DocuMed.Domain.Mappers { public static partial class MedicalHistoryMapper { public static MedicalHistory AdaptToMedicalHistory(this MedicalHistoryLDto p1) { return p1 == null ? null : new MedicalHistory() { ChiefComplaint = p1.ChiefComplaint, SectionId = p1.SectionId, Section = p1.Section == null ? null : new Section() { Name = p1.Section.Name, Detail = p1.Section.Detail, HospitalId = p1.Section.HospitalId, Id = p1.Section.Id }, PresentIllnessDetail = p1.PresentIllnessDetail, PastDiseasesHistoryDetail = p1.PastDiseasesHistoryDetail, PastSurgeryHistoryDetail = p1.PastSurgeryHistoryDetail, FamilyHistoryDetail = p1.FamilyHistoryDetail, AllergyDetail = p1.AllergyDetail, DrugHistoryDetail = p1.DrugHistoryDetail, AddictionHistoryDetail = p1.AddictionHistoryDetail, SystemReviewDetail = p1.SystemReviewDetail, VitalSignDetail = p1.VitalSignDetail, GeneralAppearanceDetail = p1.GeneralAppearanceDetail, Code = p1.Code, SystolicBloodPressure = p1.SystolicBloodPressure, DiastolicBloodPressure = p1.DiastolicBloodPressure, PulseRate = p1.PulseRate, SPO2 = p1.SPO2, Temperature = p1.Temperature, MedicalHistoryTemplateId = p1.MedicalHistoryTemplateId, Answers = funcMain1(p1.Answers), Id = p1.Id, CreatedAt = p1.CreatedAt }; } public static MedicalHistory AdaptTo(this MedicalHistoryLDto p3, MedicalHistory p4) { if (p3 == null) { return null; } MedicalHistory result = p4 ?? new MedicalHistory(); result.ChiefComplaint = p3.ChiefComplaint; result.SectionId = p3.SectionId; result.Section = funcMain2(p3.Section, result.Section); result.PresentIllnessDetail = p3.PresentIllnessDetail; result.PastDiseasesHistoryDetail = p3.PastDiseasesHistoryDetail; result.PastSurgeryHistoryDetail = p3.PastSurgeryHistoryDetail; result.FamilyHistoryDetail = p3.FamilyHistoryDetail; result.AllergyDetail = p3.AllergyDetail; result.DrugHistoryDetail = p3.DrugHistoryDetail; result.AddictionHistoryDetail = p3.AddictionHistoryDetail; result.SystemReviewDetail = p3.SystemReviewDetail; result.VitalSignDetail = p3.VitalSignDetail; result.GeneralAppearanceDetail = p3.GeneralAppearanceDetail; result.Code = p3.Code; result.SystolicBloodPressure = p3.SystolicBloodPressure; result.DiastolicBloodPressure = p3.DiastolicBloodPressure; result.PulseRate = p3.PulseRate; result.SPO2 = p3.SPO2; result.Temperature = p3.Temperature; result.MedicalHistoryTemplateId = p3.MedicalHistoryTemplateId; result.Answers = funcMain3(p3.Answers, result.Answers); result.Id = p3.Id; result.CreatedAt = p3.CreatedAt; return result; } public static Expression> ProjectToMedicalHistory => p9 => new MedicalHistory() { ChiefComplaint = p9.ChiefComplaint, SectionId = p9.SectionId, Section = p9.Section == null ? null : new Section() { Name = p9.Section.Name, Detail = p9.Section.Detail, HospitalId = p9.Section.HospitalId, Id = p9.Section.Id }, PresentIllnessDetail = p9.PresentIllnessDetail, PastDiseasesHistoryDetail = p9.PastDiseasesHistoryDetail, PastSurgeryHistoryDetail = p9.PastSurgeryHistoryDetail, FamilyHistoryDetail = p9.FamilyHistoryDetail, AllergyDetail = p9.AllergyDetail, DrugHistoryDetail = p9.DrugHistoryDetail, AddictionHistoryDetail = p9.AddictionHistoryDetail, SystemReviewDetail = p9.SystemReviewDetail, VitalSignDetail = p9.VitalSignDetail, GeneralAppearanceDetail = p9.GeneralAppearanceDetail, Code = p9.Code, SystolicBloodPressure = p9.SystolicBloodPressure, DiastolicBloodPressure = p9.DiastolicBloodPressure, PulseRate = p9.PulseRate, SPO2 = p9.SPO2, Temperature = p9.Temperature, MedicalHistoryTemplateId = p9.MedicalHistoryTemplateId, Answers = p9.Answers.Select(p10 => new MedicalHistoryAnswer() { Answer = p10.Answer, Question = p10.Question, Part = p10.Part, QuestionType = p10.QuestionType, MedicalHistoryId = p10.MedicalHistoryId, Id = p10.Id }).ToList(), Id = p9.Id, CreatedAt = p9.CreatedAt }; public static MedicalHistoryLDto AdaptToLDto(this MedicalHistory p11) { return p11 == null ? null : new MedicalHistoryLDto() { ChiefComplaint = p11.ChiefComplaint, SectionId = p11.SectionId, Code = p11.Code, Section = p11.Section == null ? null : new SectionSDto() { Name = p11.Section.Name, Detail = p11.Section.Detail, HospitalId = p11.Section.HospitalId, Id = p11.Section.Id }, PresentIllnessDetail = p11.PresentIllnessDetail, PastDiseasesHistoryDetail = p11.PastDiseasesHistoryDetail, PastSurgeryHistoryDetail = p11.PastSurgeryHistoryDetail, FamilyHistoryDetail = p11.FamilyHistoryDetail, AllergyDetail = p11.AllergyDetail, DrugHistoryDetail = p11.DrugHistoryDetail, AddictionHistoryDetail = p11.AddictionHistoryDetail, SystemReviewDetail = p11.SystemReviewDetail, VitalSignDetail = p11.VitalSignDetail, GeneralAppearanceDetail = p11.GeneralAppearanceDetail, MedicalHistoryTemplateId = p11.MedicalHistoryTemplateId, SystolicBloodPressure = p11.SystolicBloodPressure, DiastolicBloodPressure = p11.DiastolicBloodPressure, PulseRate = p11.PulseRate, SPO2 = p11.SPO2, Temperature = p11.Temperature, CreatedAt = p11.CreatedAt, Answers = funcMain4(p11.Answers), Id = p11.Id }; } public static MedicalHistoryLDto AdaptTo(this MedicalHistory p13, MedicalHistoryLDto p14) { if (p13 == null) { return null; } MedicalHistoryLDto result = p14 ?? new MedicalHistoryLDto(); result.ChiefComplaint = p13.ChiefComplaint; result.SectionId = p13.SectionId; result.Code = p13.Code; result.Section = funcMain5(p13.Section, result.Section); result.PresentIllnessDetail = p13.PresentIllnessDetail; result.PastDiseasesHistoryDetail = p13.PastDiseasesHistoryDetail; result.PastSurgeryHistoryDetail = p13.PastSurgeryHistoryDetail; result.FamilyHistoryDetail = p13.FamilyHistoryDetail; result.AllergyDetail = p13.AllergyDetail; result.DrugHistoryDetail = p13.DrugHistoryDetail; result.AddictionHistoryDetail = p13.AddictionHistoryDetail; result.SystemReviewDetail = p13.SystemReviewDetail; result.VitalSignDetail = p13.VitalSignDetail; result.GeneralAppearanceDetail = p13.GeneralAppearanceDetail; result.MedicalHistoryTemplateId = p13.MedicalHistoryTemplateId; result.SystolicBloodPressure = p13.SystolicBloodPressure; result.DiastolicBloodPressure = p13.DiastolicBloodPressure; result.PulseRate = p13.PulseRate; result.SPO2 = p13.SPO2; result.Temperature = p13.Temperature; result.CreatedAt = p13.CreatedAt; result.Answers = funcMain6(p13.Answers, result.Answers); result.Id = p13.Id; return result; } public static Expression> ProjectToLDto => p19 => new MedicalHistoryLDto() { ChiefComplaint = p19.ChiefComplaint, SectionId = p19.SectionId, Code = p19.Code, Section = p19.Section == null ? null : new SectionSDto() { Name = p19.Section.Name, Detail = p19.Section.Detail, HospitalId = p19.Section.HospitalId, Id = p19.Section.Id }, 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, GeneralAppearanceDetail = p19.GeneralAppearanceDetail, MedicalHistoryTemplateId = p19.MedicalHistoryTemplateId, SystolicBloodPressure = p19.SystolicBloodPressure, DiastolicBloodPressure = p19.DiastolicBloodPressure, PulseRate = p19.PulseRate, SPO2 = p19.SPO2, Temperature = p19.Temperature, CreatedAt = p19.CreatedAt, Answers = p19.Answers.Select(p20 => new MedicalHistoryAnswerSDto() { Answer = p20.Answer, Question = p20.Question, Part = p20.Part, QuestionType = p20.QuestionType, MedicalHistoryId = p20.MedicalHistoryId, Id = p20.Id }).ToList(), Id = p19.Id }; public static MedicalHistory AdaptToMedicalHistory(this MedicalHistorySDto p21) { return p21 == null ? null : new MedicalHistory() { ChiefComplaint = p21.ChiefComplaint, SectionId = p21.SectionId, Section = new Section() { Name = p21.SectionName, Id = p21.SectionId }, 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, Code = p21.Code, SystolicBloodPressure = p21.SystolicBloodPressure, DiastolicBloodPressure = p21.DiastolicBloodPressure, PulseRate = p21.PulseRate, SPO2 = p21.SPO2, Temperature = p21.Temperature, MedicalHistoryTemplateId = p21.MedicalHistoryTemplateId, Id = p21.Id, CreatedAt = p21.CreatedAt }; } public static MedicalHistory AdaptTo(this MedicalHistorySDto p22, MedicalHistory p23) { if (p22 == null) { return null; } MedicalHistory result = p23 ?? new MedicalHistory(); result.ChiefComplaint = p22.ChiefComplaint; result.SectionId = p22.SectionId; result.Section = funcMain7(new Never(), result.Section, p22); result.PresentIllnessDetail = p22.PresentIllnessDetail; result.PastDiseasesHistoryDetail = p22.PastDiseasesHistoryDetail; result.PastSurgeryHistoryDetail = p22.PastSurgeryHistoryDetail; result.FamilyHistoryDetail = p22.FamilyHistoryDetail; result.AllergyDetail = p22.AllergyDetail; result.DrugHistoryDetail = p22.DrugHistoryDetail; result.AddictionHistoryDetail = p22.AddictionHistoryDetail; result.SystemReviewDetail = p22.SystemReviewDetail; result.VitalSignDetail = p22.VitalSignDetail; result.GeneralAppearanceDetail = p22.GeneralAppearanceDetail; result.Code = p22.Code; result.SystolicBloodPressure = p22.SystolicBloodPressure; result.DiastolicBloodPressure = p22.DiastolicBloodPressure; result.PulseRate = p22.PulseRate; result.SPO2 = p22.SPO2; result.Temperature = p22.Temperature; result.MedicalHistoryTemplateId = p22.MedicalHistoryTemplateId; result.Id = p22.Id; result.CreatedAt = p22.CreatedAt; return result; } public static MedicalHistorySDto AdaptToSDto(this MedicalHistory p26) { return p26 == null ? null : new MedicalHistorySDto() { ChiefComplaint = p26.ChiefComplaint, SectionId = p26.SectionId, SectionName = p26.Section != null ? p26.Section.Name : string.Empty, MedicalHistoryTemplateId = p26.MedicalHistoryTemplateId, Code = p26.Code, PresentIllnessDetail = p26.PresentIllnessDetail, PastDiseasesHistoryDetail = p26.PastDiseasesHistoryDetail, PastSurgeryHistoryDetail = p26.PastSurgeryHistoryDetail, FamilyHistoryDetail = p26.FamilyHistoryDetail, AllergyDetail = p26.AllergyDetail, DrugHistoryDetail = p26.DrugHistoryDetail, AddictionHistoryDetail = p26.AddictionHistoryDetail, SystemReviewDetail = p26.SystemReviewDetail, VitalSignDetail = p26.VitalSignDetail, GeneralAppearanceDetail = p26.GeneralAppearanceDetail, SystolicBloodPressure = p26.SystolicBloodPressure, DiastolicBloodPressure = p26.DiastolicBloodPressure, PulseRate = p26.PulseRate, SPO2 = p26.SPO2, Temperature = p26.Temperature, CreatedAt = p26.CreatedAt, Id = p26.Id }; } public static MedicalHistorySDto AdaptTo(this MedicalHistory p27, MedicalHistorySDto p28) { if (p27 == null) { return null; } MedicalHistorySDto result = p28 ?? new MedicalHistorySDto(); result.ChiefComplaint = p27.ChiefComplaint; result.SectionId = p27.SectionId; result.SectionName = p27.Section != null ? p27.Section.Name : string.Empty; result.MedicalHistoryTemplateId = p27.MedicalHistoryTemplateId; result.Code = p27.Code; result.PresentIllnessDetail = p27.PresentIllnessDetail; result.PastDiseasesHistoryDetail = p27.PastDiseasesHistoryDetail; result.PastSurgeryHistoryDetail = p27.PastSurgeryHistoryDetail; result.FamilyHistoryDetail = p27.FamilyHistoryDetail; result.AllergyDetail = p27.AllergyDetail; result.DrugHistoryDetail = p27.DrugHistoryDetail; result.AddictionHistoryDetail = p27.AddictionHistoryDetail; result.SystemReviewDetail = p27.SystemReviewDetail; result.VitalSignDetail = p27.VitalSignDetail; result.GeneralAppearanceDetail = p27.GeneralAppearanceDetail; result.SystolicBloodPressure = p27.SystolicBloodPressure; result.DiastolicBloodPressure = p27.DiastolicBloodPressure; result.PulseRate = p27.PulseRate; result.SPO2 = p27.SPO2; result.Temperature = p27.Temperature; result.CreatedAt = p27.CreatedAt; result.Id = p27.Id; return result; } public static Expression> ProjectToSDto => p29 => new MedicalHistorySDto() { ChiefComplaint = p29.ChiefComplaint, SectionId = p29.SectionId, SectionName = p29.Section != null ? p29.Section.Name : string.Empty, MedicalHistoryTemplateId = p29.MedicalHistoryTemplateId, Code = p29.Code, PresentIllnessDetail = p29.PresentIllnessDetail, PastDiseasesHistoryDetail = p29.PastDiseasesHistoryDetail, PastSurgeryHistoryDetail = p29.PastSurgeryHistoryDetail, FamilyHistoryDetail = p29.FamilyHistoryDetail, AllergyDetail = p29.AllergyDetail, DrugHistoryDetail = p29.DrugHistoryDetail, AddictionHistoryDetail = p29.AddictionHistoryDetail, SystemReviewDetail = p29.SystemReviewDetail, VitalSignDetail = p29.VitalSignDetail, GeneralAppearanceDetail = p29.GeneralAppearanceDetail, SystolicBloodPressure = p29.SystolicBloodPressure, DiastolicBloodPressure = p29.DiastolicBloodPressure, PulseRate = p29.PulseRate, SPO2 = p29.SPO2, Temperature = p29.Temperature, CreatedAt = p29.CreatedAt, Id = p29.Id }; private static List funcMain1(List p2) { if (p2 == null) { return null; } List result = new List(p2.Count); int i = 0; int len = p2.Count; while (i < len) { MedicalHistoryAnswerSDto item = p2[i]; result.Add(item == null ? null : new MedicalHistoryAnswer() { Answer = item.Answer, Question = item.Question, Part = item.Part, QuestionType = item.QuestionType, MedicalHistoryId = item.MedicalHistoryId, Id = item.Id }); i++; } return result; } private static Section funcMain2(SectionSDto p5, Section p6) { if (p5 == null) { return null; } Section result = p6 ?? new Section(); result.Name = p5.Name; result.Detail = p5.Detail; result.HospitalId = p5.HospitalId; result.Id = p5.Id; return result; } private static List funcMain3(List p7, List p8) { if (p7 == null) { return null; } List result = new List(p7.Count); int i = 0; int len = p7.Count; while (i < len) { MedicalHistoryAnswerSDto item = p7[i]; result.Add(item == null ? null : new MedicalHistoryAnswer() { Answer = item.Answer, Question = item.Question, Part = item.Part, QuestionType = item.QuestionType, MedicalHistoryId = item.MedicalHistoryId, Id = item.Id }); i++; } return result; } private static List funcMain4(List p12) { if (p12 == null) { return null; } List result = new List(p12.Count); int i = 0; int len = p12.Count; while (i < len) { MedicalHistoryAnswer item = p12[i]; result.Add(item == null ? null : new MedicalHistoryAnswerSDto() { Answer = item.Answer, Question = item.Question, Part = item.Part, QuestionType = item.QuestionType, MedicalHistoryId = item.MedicalHistoryId, Id = item.Id }); i++; } return result; } private static SectionSDto funcMain5(Section p15, SectionSDto p16) { if (p15 == null) { return null; } SectionSDto result = p16 ?? new SectionSDto(); result.Name = p15.Name; result.Detail = p15.Detail; result.HospitalId = p15.HospitalId; result.Id = p15.Id; return result; } private static List funcMain6(List p17, List p18) { if (p17 == null) { return null; } List result = new List(p17.Count); int i = 0; int len = p17.Count; while (i < len) { MedicalHistoryAnswer item = p17[i]; result.Add(item == null ? null : new MedicalHistoryAnswerSDto() { Answer = item.Answer, Question = item.Question, Part = item.Part, QuestionType = item.QuestionType, MedicalHistoryId = item.MedicalHistoryId, Id = item.Id }); i++; } return result; } private static Section funcMain7(Never p24, Section p25, MedicalHistorySDto p22) { Section result = p25 ?? new Section(); result.Name = p22.SectionName; result.Id = p22.SectionId; return result; } } }