private DocotorScreening LoadData(int TokenNumber, string ArogyaID) { ArogyaParivarEntities context = new ArogyaParivarEntities(); var query1 = (from screening in context.T_Screenings from pc in context.M_PComplaints .Where(x => x.ID == screening.ComplaintID).DefaultIfEmpty() //on screening.ComplaintID equals pc.ID from user in context.M_User .Where(x => x.User_ID == screening.UserID).DefaultIfEmpty() //on screening.UserID equals user.User_ID where screening.Token_Number == TokenNumber && EntityFunctions.TruncateTime(screening.CreateDate).Value == DateTime.Today && screening.ArogyaID == ArogyaID select new DocotorScreening { ChiefComplaintName = pc.M_PresentingComplainting, ChiefComplaintID = screening.ComplaintID.Value, HistoryPresentingComplaint = screening.PresentingComplaint, PastMedicalHistory = screening.PastMedicalHistory, PastSurgicalHistory = screening.PastSurgicalHistory, FamilyHistory = screening.FamilyHistory, CurrentMedication = screening.CurrentMedication, ECGOutcomeID = screening.ECGOutcomeID.Value, ScreenOutcomeID = screening.ScreenOutcomeID.Value //CreateDate = screening.CreateDate }).ToList(); doctormodel = query1[0]; var query = context.T_Vitals.Where(o => o.ArogyaID == ArogyaID && o.Token_Number == TokenNumber && EntityFunctions.TruncateTime(o.CreateDate) == DateTime.Today).ToList(); if (query.Count > 0) { doctormodel.Weight = query[0].Weight; doctormodel.Height = query[0].Height; doctormodel.BMI = query[0].BMI; doctormodel.DiaBP = query[0].DiaBP; doctormodel.SysBP = query[0].SysBP; doctormodel.Temparature = query[0].Temparature; doctormodel.Pulse = query[0].Pulse; doctormodel.Respiratory = query[0].Respiratory; var query2 = from allergy in context.T_Allergies from at in context.M_AllergyType .Where(x => x.ID == allergy.AllergenID).DefaultIfEmpty() //on allergy.AllergenID equals at.ID from ar in context.M_Reaction .Where(x => x.ID == allergy.ReactionID).DefaultIfEmpty() //on allergy.ReactionID equals ar.ID from asev in context.M_Severity .Where(x => x.ID == allergy.SeverityID).DefaultIfEmpty() //on allergy.SeverityID equals asev.ID from ast in context.M_Status .Where(x => x.ID == allergy.StatusID).DefaultIfEmpty() //on allergy.StatusID equals ast.ID where allergy.Token_Number == TokenNumber && EntityFunctions.TruncateTime(allergy.CreateDate).Value == DateTime.Today && allergy.ArogyaID == ArogyaID select new AllergyModel { AllergyTypeName = at.AllergyType, AllergenName = "", ReactionName = ar.Reaction, SeverityName = asev.Severity, StatusName = ast.M_StatusName, CreateDate = allergy.CreateDate, //CreateDateString=allergy.CreateDate.Value.ToString("dd/MM/yyyy") }; doctormodel.Allergies = query2.ToList(); } return(doctormodel); }
private DocotorScreening LoadData(int TokenNumber, string ArogyaID) { ArogyaParivarEntities context = new ArogyaParivarEntities(); var query1 = (from screening in context.T_Screenings from pc in context.M_PComplaints .Where(x => x.ID == screening.ComplaintID).DefaultIfEmpty() //on screening.ComplaintID equals pc.ID from user in context.M_User .Where(x => x.User_ID == screening.UserID).DefaultIfEmpty() //on screening.UserID equals user.User_ID where screening.Token_Number == TokenNumber && EntityFunctions.TruncateTime(screening.CreateDate).Value == DateTime.Today && screening.ArogyaID == ArogyaID select new DocotorScreening { ChiefComplaintName = pc.M_PresentingComplainting, ChiefComplaintID = screening.ComplaintID.Value, HistoryPresentingComplaint = screening.PresentingComplaint, PastMedicalHistory = screening.PastMedicalHistory, PastSurgicalHistory = screening.PastSurgicalHistory, FamilyHistory = screening.FamilyHistory, CurrentMedication = screening.CurrentMedication, ECGOutcomeID = screening.ECGOutcomeID.Value, ScreenOutcomeID = screening.ScreenOutcomeID.Value //CreateDate = screening.CreateDate }).ToList(); doctormodel = query1[0]; var query = context.T_Vitals.Where(o => o.ArogyaID == ArogyaID && o.Token_Number == TokenNumber && EntityFunctions.TruncateTime(o.CreateDate) == DateTime.Today).ToList(); if (query.Count > 0) { doctormodel.Weight = query[0].Weight; doctormodel.Height = query[0].Height; doctormodel.BMI = query[0].BMI; doctormodel.DiaBP = query[0].DiaBP; doctormodel.SysBP = query[0].SysBP; doctormodel.Temparature = query[0].Temparature; doctormodel.Pulse = query[0].Pulse; doctormodel.Respiratory = query[0].Respiratory; var query2 = from allergy in context.T_Allergies from at in context.M_AllergyType .Where(x => x.ID == allergy.AllergenID).DefaultIfEmpty() //on allergy.AllergenID equals at.ID from ar in context.M_Reaction .Where(x => x.ID == allergy.ReactionID).DefaultIfEmpty() //on allergy.ReactionID equals ar.ID from asev in context.M_Severity .Where(x => x.ID == allergy.SeverityID).DefaultIfEmpty() //on allergy.SeverityID equals asev.ID from ast in context.M_Status .Where(x => x.ID == allergy.StatusID).DefaultIfEmpty() //on allergy.StatusID equals ast.ID where allergy.Token_Number == TokenNumber && EntityFunctions.TruncateTime(allergy.CreateDate).Value == DateTime.Today && allergy.ArogyaID == ArogyaID select new AllergyModel { AllergyTypeName = at.AllergyType, AllergenName = "", ReactionName = ar.Reaction, SeverityName = asev.Severity, StatusName = ast.M_StatusName, CreateDate = allergy.CreateDate, //CreateDateString=allergy.CreateDate.Value.ToString("dd/MM/yyyy") }; doctormodel.Allergies = query2.ToList(); } return doctormodel; }