private void ShowProblems() { var toggle = PatientProblemsCheckBoxes.Children; List <int> currentProblems = new List <int>(); FCS_DBModel db = new FCS_DBModel(); PatientProblem patProb = new PatientProblem(); int patID = db.Patients.Where(x => x.PatientOQ == patientOQ).Select(x => x.PatientID).Distinct().First(); foreach (var item in db.PatientProblems.Where(x => x.PatientID == patID).Select(x => x.ProblemID)) { currentProblems.Add(item); } foreach (var item in toggle) { foreach (var curProb in currentProblems) { if (curProb == GetProblemID(((ContentControl)item).Content.ToString())) { ((ToggleButton)item).IsChecked = true; } } } }
public void Determine_Problems(string OQ) { FCS_DBModel db = new FCS_DBModel(); var toggle = PatientProblemsCheckBoxes.Children; var problemTable = db.Problems; foreach (var item in toggle) { string checkboxProblemName = (((ContentControl)item).Content).ToString(); if (((ToggleButton)item).IsChecked == true) { try { PatientProblem patProb = new PatientProblem(); int patID = db.Patients.Where(x => x.PatientOQ == OQ).Select(x => x.PatientID).Distinct().First(); patProb.PatientID = patID; patProb.ProblemID = GetProblemID(checkboxProblemName); db.PatientProblems.Add(patProb); db.SaveChanges(); //var problem = } catch (Exception error) { } } } }
public ActionResult DeleteConfirmed(int id) { PatientProblem patientProblem = db.PatientProblems.Find(id); db.PatientProblems.Remove(patientProblem); db.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult AddProblems(PatientProblem obj) // When button is clicked { if (patientAddViewModel.currentproblem is null) { patientAddViewModel.currentproblem = obj; } // patientAddViewModel.currentPatient.problems.Add(obj); return(View("PatientAdd", patientAddViewModel)); }
public ActionResult Edit([Bind(Include = "PatientProblemID,PatientID,ProblemID")] PatientProblem patientProblem) { if (ModelState.IsValid) { db.Entry(patientProblem).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PatientID = new SelectList(db.Patients, "PatientID", "FirstName", patientProblem.PatientID); ViewBag.ProblemID = new SelectList(db.Problems, "ProblemID", "ProblemsName", patientProblem.ProblemID); return(View(patientProblem)); }
// GET: PatientProblems/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PatientProblem patientProblem = db.PatientProblems.Find(id); if (patientProblem == null) { return(HttpNotFound()); } return(View(patientProblem)); }
// GET: PatientProblems/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PatientProblem patientProblem = db.PatientProblems.Find(id); if (patientProblem == null) { return(HttpNotFound()); } ViewBag.PatientID = new SelectList(db.Patients, "PatientID", "FirstName", patientProblem.PatientID); ViewBag.ProblemID = new SelectList(db.Problems, "ProblemID", "ProblemsName", patientProblem.ProblemID); return(View(patientProblem)); }
private void CreateComponent(PatientProblem ptProblem, ClinicalDocument clinicalDoc, III hl7III) { hl7Body = clinicalDoc.Component.AsStructuredBody; functionalStatus = hl7Body.Component.Append(); hl7III = functionalStatus.Section.TemplateId.Append(); if (ptProblem.root != null) { hl7III.Init(ptProblem.root); } //if (dictionary.ContainsKey(Root2)) //{ // hl7III = functionalStatus.Section.TemplateId.Append; // hl7III.Init(dictionary.Item(Root2)); //} if (ptProblem.code != null) { functionalStatus.Section.Code.Code = ptProblem.code; } if (ptProblem.codeSystem != null) { functionalStatus.Section.Code.CodeSystem = ptProblem.codeSystem; } if (ptProblem.codeSystemName != null) { functionalStatus.Section.Code.CodeSystemName = ptProblem.codeSystemName; } if (ptProblem.displayName != null) { functionalStatus.Section.Code.DisplayName = ptProblem.displayName; } if (ptProblem.title != null) { functionalStatus.Section.Title.Text = ptProblem.title; } }
public string FillPatientProblemes(ClinicalDocument clinicalDoc, Factory hl7factory, III hl7III, PatientClinicalInformation patientinfo) { string clinicdetais = string.Empty; ptProblem = new PatientProblem(); CreateComponent(ptProblem, clinicalDoc, hl7III);// Manage Problem Component FillProblemContent(patientinfo, hl7factory); int i = 0; if (patientinfo.ptProblemes.Count > 0) { foreach (PatientProblemes item in patientinfo.ptProblemes) { GenerateProblemEntry(item, "#Problem" + (i + 1), Convert.ToDateTime(patientinfo.ptDemographicDetail.DateofBirth), hl7III, hl7factory); i++; } } else { GenerateProblemEntryEmpty("#noproblems1", hl7III, hl7factory); } return(clinicalDoc.Xml); }
private void UpdateProblems() { FCS_DBModel db = new FCS_DBModel(); var toggle = PatientProblemsCheckBoxes.Children; var problemTable = db.Problems; foreach (var item in toggle) { string checkboxProblemName = (((ContentControl)item).Content).ToString(); if (((ToggleButton)item).IsChecked == true) { PatientProblem patProb = new PatientProblem(); patProb.PatientID = patientID; patProb.ProblemID = GetProblemID(checkboxProblemName); db.PatientProblems.Add(patProb); db.SaveChanges(); } else { var distinctPatProblems = new List <PatientProblem>().AsQueryable(); try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patientID && p.ProblemID == GetProblemID(checkboxProblemName) select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } } catch { } db.SaveChanges(); } } GC.Collect(); }
private void DetermineProblems() { var toggle = PatientProblemsCheckBoxes.Children; List <string> currentProblems = new List <string>(); FCS_DBModel db = new FCS_DBModel(); PatientProblem patProb = new PatientProblem(); int patID = db.Patients.Where(x => x.PatientOQ == patientOQ).Select(x => x.PatientID).Distinct().First(); foreach (var item in db.PatientProblems.Where(x => x.PatientID == patID).Select(x => x.ProblemID)) { switch (item) { case 1: currentProblems.Add("Depression"); break; case 2: currentProblems.Add("Bereavement/Loss"); break; case 3: currentProblems.Add("Communication"); break; case 4: currentProblems.Add("Domestic Violence"); break; case 5: currentProblems.Add("Hopelessness"); break; case 6: currentProblems.Add("Work Problems"); break; case 7: currentProblems.Add("Parent Problems"); break; case 8: currentProblems.Add("Substance Abuse"); break; case 9: currentProblems.Add("Problems w/ School"); break; case 10: currentProblems.Add("Marriage/Relationship/Family"); break; case 11: currentProblems.Add("Thoughts of Hurting Self"); break; case 12: currentProblems.Add("Angry Feelings"); break; case 13: currentProblems.Add("Sexual Abuse"); break; case 14: currentProblems.Add("Emotional Abuse"); break; case 15: currentProblems.Add("Physical Abuse"); break; case 16: currentProblems.Add("Problems with the Law"); break; case 17: currentProblems.Add("Unhappy with Life"); break; case 18: currentProblems.Add("Anxiety"); break; case 19: currentProblems.Add("Other"); break; } } foreach (var item in toggle) { foreach (var curProb in currentProblems) { if ((((ContentControl)item).Content).ToString() == curProb) { ((ToggleButton)item).IsChecked = true; } } } GC.Collect(); }
private void UpdateProblems() { FCS_DBModel db = new FCS_DBModel(); int patID = db.Patients.Where(x => x.PatientOQ == pOQ).Select(x => x.PatientID).Distinct().First(); var toggle = PatientProblemsCheckBoxes.Children; var patProblems = (from p in db.PatientProblems where p.PatientID == patID select p); //CreateNewPatient cnp = new CreateNewPatient(); PatientProblem patProb = new PatientProblem(); string checkBoxContent = ""; int probID = 0; var problemTable = db.Problems; foreach (var item in toggle) { checkBoxContent = ((((ContentControl)item).Content).ToString()); //var distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID select p); if (((ToggleButton)item).IsChecked == true) { switch (checkBoxContent) { case "Depression": probID = 1; break; case "Bereavement/Loss": probID = 2; break; case "Communication": probID = 3; break; case "Domestic Violence": probID = 4; break; case "Hopelessness": probID = 5; break; case "Work Problems": probID = 6; break; case "Parent Problems": probID = 7; break; case "Substance Abuse": probID = 8; break; case "Problems w/ School": probID = 9; break; case "Marriage/Relationship/Family": probID = 10; break; case "Thoughts of Hurting Self": probID = 11; break; case "Angry Feelings": probID = 12; break; case "Sexual Abuse": probID = 13; break; case "Emotional Abuse": probID = 14; break; case "Physical Abuse": probID = 15; break; case "Problems with the Law": probID = 16; break; case "Unhappy with Life": probID = 17; break; case "Anxiety": probID = 18; break; case "Other": probID = 19; break; } patProb.PatientID = patID; patProb.ProblemID = probID; db.PatientProblems.Add(patProb); db.SaveChanges(); patProb = new PatientProblem(); } else { var distinctPatProblems = new List <PatientProblem>().AsQueryable(); switch (checkBoxContent) { case "Depression": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 1 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Bereavement/Loss": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 2 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Communication": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 3 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Domestic Violence": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 4 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Hopelessness": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 5 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Work Problems": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 6 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Parent Problems": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 7 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Substance Abuse": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 8 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Problems w/ School": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 9 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Marriage/Relationship/Family": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 10 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Thoughts of Hurting Self": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 11 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Angry Feelings": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 12 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Sexual Abuse": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 13 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Emotional Abuse": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 14 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Physical Abuse": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 15 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Problems with the Law": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 16 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Unhappy with Life": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 17 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Anxiety": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 18 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; case "Other": try { distinctPatProblems = (from p in db.PatientProblems where p.PatientID == patID && p.ProblemID == 19 select p); foreach (var thing in distinctPatProblems) { db.PatientProblems.Remove(thing); } db.SaveChanges(); } catch { } distinctPatProblems = new List <PatientProblem>().AsQueryable(); break; } } } GC.Collect(); }
public void Determine_Problems(string OQ, UIElementCollection toggle) { PatientProblem patProb = new PatientProblem(); FCS_DBModel db = new FCS_DBModel(); string checkBoxContent = ""; int patID = 0; int probID = 0; var problemTable = db.Problems; foreach (var item in toggle) { if (((ToggleButton)item).IsChecked == true) { patID = db.Patients.Where(x => x.PatientOQ == OQ).Select(x => x.PatientID).Distinct().First(); checkBoxContent = ((((ContentControl)item).Content).ToString()); switch (checkBoxContent) { case "Depression": probID = 1; break; case "Bereavement/Loss": probID = 2; break; case "Communication": probID = 3; break; case "Domestic Violence": probID = 4; break; case "Hopelessness": probID = 5; break; case "Work Problems": probID = 6; break; case "Parent Problems": probID = 7; break; case "Substance Abuse": probID = 8; break; case "Problems w/ School": probID = 9; break; case "Marriage/Relationship/Family": probID = 10; break; case "Thoughts of Hurting Self": probID = 11; break; case "Angry Feelings": probID = 12; break; case "Sexual Abuse": probID = 13; break; case "Emotional Abuse": probID = 14; break; case "Physical Abuse": probID = 15; break; case "Problems with the Law": probID = 16; break; case "Unhappy with Life": probID = 17; break; case "Anxiety": probID = 18; break; case "Other": probID = 19; break; } patProb.PatientID = patID; patProb.ProblemID = probID; db.PatientProblems.Add(patProb); db.SaveChanges(); patProb = new PatientProblem(); } } }
/// <summary> /// Removes a PatientProblem from the Repository. /// </summary> /// <param name="entity">The PatientProblem to remove from the Repository.</param> public void Remove(PatientProblem entity) { Session.Delete(entity); }
/// <summary> /// Adds a PatientProblem to the Repository. /// </summary> /// <param name="entity">The PatientProblem to add to the Repository.</param> public void Add(PatientProblem entity) { Session.Save(entity); }