public static string UpdateUser(DoctorManage _updateUser, Guid _pkey) { string msg = "Error"; try { GuruETCEntities _etc = new GuruETCEntities(); DoctorProfile _profile = _etc.DoctorProfiles.Where(d => d.UserGuid == _pkey).FirstOrDefault(); if (_profile != null) { _profile.Name = _updateUser.Name; _profile.Practice = _updateUser.Practice; _profile.PhoneNumber = _updateUser.PhoneNumber; _profile.Address1 = _updateUser.Address1; _profile.Address2 = _updateUser.Address2; _profile.DOB = Convert.ToDateTime(_updateUser.DDOB); _etc.SaveChanges(); msg = "Success"; } } catch (Exception ex) { msg = "Error"; } return(msg); }
public static string UpdateUser(Registeruser _updateUser, Guid _pkey) { string msg = "Error"; try { GuruETCEntities _etc = new GuruETCEntities(); PatientProfile _profile = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).FirstOrDefault(); if (_profile != null) { _profile.Name = _updateUser.Name; _profile.MedicalHistory = _updateUser.MedicalHistory; _profile.PersonalHistorical = _updateUser.PatientHistorical; _profile.PersonalMotivator = _updateUser.PersonalMotivator; _profile.PhoneNumber = _updateUser.PhoneNumber; _profile.Address1 = _updateUser.Address1; _profile.Address2 = _updateUser.Address2; _profile.DOB = Convert.ToDateTime(_updateUser.DOB); _etc.SaveChanges(); msg = "Success"; } } catch (Exception ex) { msg = "Error"; } return(msg); }
/*Save Patient Meditation, supplement, hospitalization etc.. info*/ public static string SavePatientInfo(string key, string title, Guid _pkey) { GuruETCEntities _etc = new GuruETCEntities(); long? ParentId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.Id).FirstOrDefault(); long? ExamId = _etc.PatientExams.Where(d => d.PatientId == ParentId).OrderByDescending(d => d.ExamId).Select(d => d.ExamId).FirstOrDefault(); long? PhealthId = _etc.PatientResultQuestions.Where(d => d.ExamId == ExamId).Select(d => d.PHealthId).FirstOrDefault(); string Result = string.Empty; switch (key) { case "1": PatientMedication _pmedi = new PatientMedication(); _pmedi.Title = title; _pmedi.PHealthId = PhealthId; //By default 1 change it dynamically _pmedi.DateAdded = DateTime.Now; _etc.AddToPatientMedications(_pmedi); _etc.SaveChanges(); Result = _pmedi.MedicationId.ToString(); break; case "2": PatientSupplement _psup = new PatientSupplement(); _psup.Title = title; _psup.PHealthId = PhealthId; //By default 1 change it dynamically _psup.DateAdded = DateTime.Now; _etc.AddToPatientSupplements(_psup); _etc.SaveChanges(); Result = _psup.SupplementId.ToString(); break; case "3": PatientHospitalized _phos = new PatientHospitalized(); _phos.Title = title; _phos.PHealthId = PhealthId; //By default 1 change it dynamically _phos.DateAdded = DateTime.Now; _etc.AddToPatientHospitalizeds(_phos); _etc.SaveChanges(); Result = _phos.HospitalizationId.ToString(); break; } return(Result); }
public static string DeletePatientInfo(string key, string delId) { GuruETCEntities _etc = new GuruETCEntities(); long GetId = int.Parse(delId); string Result = string.Empty; switch (key) { case "1": PatientMedication _pmedi = _etc.PatientMedications.Where(d => d.MedicationId == GetId).FirstOrDefault(); if (_pmedi != null) { _etc.DeleteObject(_pmedi); _etc.SaveChanges(); } Result = "Success"; break; case "2": PatientSupplement _psup = _etc.PatientSupplements.Where(d => d.SupplementId == GetId).FirstOrDefault(); if (_psup != null) { _etc.DeleteObject(_psup); _etc.SaveChanges(); } Result = "Success"; break; case "3": PatientHospitalized _phos = _etc.PatientHospitalizeds.Where(d => d.HospitalizationId == GetId).FirstOrDefault(); if (_phos != null) { _etc.DeleteObject(_phos); _etc.SaveChanges(); } Result = "Success"; break; } return(Result); }
public static GeneralNutr SavePatientMedicationInfo(string hxMedication, string hxCategories, Guid _pkey) { GuruETCEntities _etc = new GuruETCEntities(); long? ParentId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.Id).FirstOrDefault(); long? DoctorId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.DoctorId).FirstOrDefault(); GeneralNutr _gNutri = new GeneralNutr(); PatientResultQuestion _Presult = _etc.PatientResultQuestions.Where(p => p.DoctorId == DoctorId && p.PatientId == ParentId).FirstOrDefault(); if (_Presult != null) { string[] medAlegy = hxMedication.Split('|'); string[] catMedAlegy = hxCategories.Split('|'); string AllMedication = string.Empty; string AllAllergy = string.Empty; int index = 0; foreach (var item in catMedAlegy) { if (item == "Medications") { AllMedication += medAlegy[index] + "|"; } else { AllAllergy += medAlegy[index] + "|"; } index++; } if (AllMedication.Length > 1) { AllMedication = AllMedication.Substring(0, AllMedication.Length - 1); } if (AllAllergy.Length > 1) { AllAllergy = AllAllergy.Substring(0, AllAllergy.Length - 1); } _Presult.hx_medications = AllMedication; _Presult.hx_allergies = AllAllergy; _etc.SaveChanges(); string Result = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}", _Presult.Weight, _Presult.Height, _Presult.feet, _Presult.Packs, _Presult.Cans, _Presult.FormerSmoker, _Presult.FormerChewer, _Presult.dietrating); _gNutri.GHealth = _Presult.hx_general; _gNutri.Nutri = _Presult.hx_nutrition_activity; _gNutri.Tbc = _Presult.hx_tobacco_alcohol; _gNutri.Vital = _Presult.hx_vitals_labs; _gNutri.Extra = Result; } return(_gNutri); }
public static string SaveDental(string hxDental, Guid _pkey) { GuruETCEntities _etc = new GuruETCEntities(); long? ParentId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.Id).FirstOrDefault(); long? DoctorId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.DoctorId).FirstOrDefault(); PatientResultQuestion _Presult = _etc.PatientResultQuestions.Where(p => p.DoctorId == DoctorId && p.PatientId == ParentId).FirstOrDefault(); if (_Presult != null) { _Presult.hx_dental = hxDental; _etc.SaveChanges(); } return(string.Empty); }
public static medical SavePatientGeneralLifestyle(string hxGeneral, string hxutrition, string hxVitalsLabs, string hxTobacco, string wet, string hgfeet, string hginc, string fsmoke, string fchewer, string drate, Guid _pkey) { GuruETCEntities _etc = new GuruETCEntities(); long? ParentId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.Id).FirstOrDefault(); long? DoctorId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.DoctorId).FirstOrDefault(); medical _med = new medical(); PatientResultQuestion _Presult = _etc.PatientResultQuestions.Where(p => p.DoctorId == DoctorId && p.PatientId == ParentId).FirstOrDefault(); if (_Presult != null) { _Presult.hx_general = hxGeneral; _Presult.hx_nutrition_activity = hxutrition; _Presult.hx_vitals_labs = hxVitalsLabs; _Presult.hx_tobacco_alcohol = hxTobacco; if (!string.IsNullOrEmpty(wet)) { _Presult.Weight = double.Parse(wet); } if (!string.IsNullOrEmpty(hgfeet)) { _Presult.Height = double.Parse(hgfeet); } if (!string.IsNullOrEmpty(hginc)) { _Presult.feet = double.Parse(hginc); } _Presult.FormerSmoker = fsmoke; _Presult.FormerChewer = fchewer; _Presult.dietrating = drate; _etc.SaveChanges(); _med.cardio = _Presult.hx_medical_cardiovascular; _med.Cancer = _Presult.hx_medical_cancer; _med.DIS = _Presult.hx_medical_other_diseases; _med.ENT = _Presult.hx_medical_ent; _med.sleep = _Presult.hx_medical_sleep; _med.GHealth = _Presult.hx_medical_gender_health; _med.Endo = _Presult.hx_medical_endocrine_disorders; } return(_med); }
public static string SaveCardio(string hxCardiovascular, string hxEndocrine, string hxCancer, string hxEnt, string hxSleep, string hxOther, string hxGender, string diab, Guid _pkey) { GuruETCEntities _etc = new GuruETCEntities(); long? ParentId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.Id).FirstOrDefault(); long? DoctorId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.DoctorId).FirstOrDefault(); PatientResultQuestion _Presult = _etc.PatientResultQuestions.Where(p => p.DoctorId == DoctorId && p.PatientId == ParentId).FirstOrDefault(); if (_Presult != null) { _Presult.hx_medical_cardiovascular = hxCardiovascular; _Presult.hx_medical_endocrine_disorders = hxEndocrine; _Presult.hx_medical_cancer = hxCancer; _Presult.hx_medical_ent = hxEnt; _Presult.hx_medical_sleep = hxSleep; _Presult.hx_medical_other_diseases = hxOther; _Presult.hx_medical_gender_health = hxGender; _Presult.Diabetes = diab; _etc.SaveChanges(); return(_Presult.hx_dental); } return(string.Empty); }
public static string SavePatienthx_Detail(string hxConcerns, string duplicateDental, string duplicateENT, string duplicateSleep, Guid _pkey) { GuruETCEntities _etc = new GuruETCEntities(); long? ParentId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.Id).FirstOrDefault(); long? DoctorId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.DoctorId).FirstOrDefault(); long? ExamId = _etc.PatientExams.Where(d => d.DoctorId == DoctorId && d.PatientId == ParentId).OrderByDescending(d => d.ExamId).Select(d => d.ExamId).FirstOrDefault(); if (ExamId == 0) { PatientExam _newexam = new PatientExam(); _newexam.PatientId = ParentId; _newexam.DoctorId = DoctorId; _newexam.Date = DateTime.Now; _etc.AddToPatientExams(_newexam); _etc.SaveChanges(); ExamId = _newexam.ExamId; } PatientResultQuestion _Presult = _etc.PatientResultQuestions.Where(p => p.DoctorId == DoctorId && p.PatientId == ParentId).FirstOrDefault(); if (_Presult != null) { //Duplicate Dental items string dentalCheckedItems = string.Empty; string[] findingitems = duplicateDental.Split('|'); string[] MatchArray = { "16", "12", "17", "19", "5" }; foreach (var finding in findingitems) { if (finding == "15") { dentalCheckedItems += "16|"; } if (finding == "16") { dentalCheckedItems += "12|"; } if (finding == "36") { dentalCheckedItems += "17|"; } if (finding == "18") { dentalCheckedItems += "19|"; } if (finding == "19") { dentalCheckedItems += "19|"; } if (finding == "20") { dentalCheckedItems += "5|"; } } IEnumerable <string> intersectDental; string[] alreadyitems = (!string.IsNullOrEmpty(_Presult.hx_dental)) ? _Presult.hx_dental.Split('|') : null; if (alreadyitems != null) { // string[] arry1 = alreadyitems.Except(MatchArray).ToArray(); // string[] arry2 = MatchArray.Except(alreadyitems).ToArray(); //Removes duplicate values intersectDental = alreadyitems.Concat(MatchArray); } else { intersectDental = MatchArray; } dentalCheckedItems = string.Join("|", intersectDental); //Duplicate ENT items string entCheckedItems = string.Empty; string[] entfindingitems = duplicateENT.Split('|'); string[] entMatchArray = { "2", "4", "1", "5", "8" }; foreach (var finding in entfindingitems) { if (finding == "27") { entCheckedItems += "2|"; } if (finding == "28") { entCheckedItems += "4|"; } if (finding == "29") { entCheckedItems += "1|"; } if (finding == "30") { entCheckedItems += "5|"; } if (finding == "45") { entCheckedItems += "8|"; } } IEnumerable <string> intersectENT; string[] entitems = (!string.IsNullOrEmpty(_Presult.hx_medical_ent)) ? _Presult.hx_medical_ent.Split('|') : null; if (entitems != null) { // string[] arry1 = entitems.Except(entMatchArray).ToArray(); // string[] arry2 = entMatchArray.Except(entitems).ToArray(); //Removes duplicate values intersectENT = entitems.Union(entMatchArray); } else { intersectENT = entMatchArray; } entCheckedItems = string.Join("|", intersectENT); //Duplicate Sleep items string SleepCheckedItems = string.Empty; string[] Sleepfindingitems = duplicateSleep.Split('|'); string[] SleepMatchArray = { "4", "4.1", "1", "2" }; foreach (var finding in Sleepfindingitems) { if (finding == "44") { SleepCheckedItems += "4|4.1|"; } if (finding == "45") { SleepCheckedItems += "1|"; } if (finding == "46") { SleepCheckedItems += "2|"; } } IEnumerable <string> intersectSleep; string[] sleepitems = (!string.IsNullOrEmpty(_Presult.hx_medical_sleep)) ? _Presult.hx_medical_sleep.Split('|') : null; if (sleepitems != null) { // string[] arry1 = sleepitems.Except(SleepMatchArray).ToArray(); // string[] arry2 = SleepMatchArray.Except(sleepitems).ToArray(); //Removes duplicate values intersectSleep = sleepitems.Concat(SleepMatchArray); } else { intersectSleep = SleepMatchArray; } SleepCheckedItems = string.Join("|", intersectSleep); _Presult.hx_medical_sleep = SleepCheckedItems; _Presult.hx_medical_ent = entCheckedItems; _Presult.hx_dental = dentalCheckedItems; _Presult.patient_concerns = hxConcerns; _etc.SaveChanges(); if (!string.IsNullOrEmpty(_Presult.hx_medications) && !string.IsNullOrEmpty(_Presult.hx_allergies)) { return(_Presult.hx_medications + "|" + _Presult.hx_allergies); } else if (!string.IsNullOrEmpty(_Presult.hx_medications) && string.IsNullOrEmpty(_Presult.hx_allergies)) { return(_Presult.hx_medications); } else { return(_Presult.hx_allergies); } } else { PatientResultQuestion _addPResult = new PatientResultQuestion(); _addPResult.PatientId = ParentId; _addPResult.DoctorId = DoctorId; _addPResult.ExamId = ExamId; //Change it dynamically for testing its taking 1 _addPResult.patient_concerns = hxConcerns; _addPResult.hx_dental = duplicateDental; _addPResult.hx_medical_ent = duplicateENT; _addPResult.hx_medical_sleep = duplicateSleep; _etc.AddToPatientResultQuestions(_addPResult); _etc.SaveChanges(); return(string.Empty); } }