// GET: BodySystems/Edit public ActionResult Edit(int?pcaID, int?typeID) { if (pcaID == null || typeID == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } // get the body system with matching typeID and pcaID and the most recent date var bodySystemQ = from c in db.nursing_care_system_assessment where c.care_system_assessment_type_id == typeID && c.pca_id == pcaID group c by c.care_system_assessment_type_id into g select g.OrderByDescending(t => t.date_care_system_added).FirstOrDefault(); ViewBag.CareSystemTypeName = db.nursing_care_system_assessment_type.FirstOrDefault(t => t.care_system_assessment_type_id == typeID).care_system_assessment_type_name; ViewBag.CareSystems = db.nursing_care_system_assessment_type; ViewBag.PCAComments = db.nursing_pca_comment_type; if (bodySystemQ.FirstOrDefault() == null) { var emptyCareSystem = new nursing_care_system_assessment(); emptyCareSystem.pca_id = (int)pcaID; emptyCareSystem.care_system_assessment_type_id = (int)typeID; return(View(emptyCareSystem)); } return(View(bodySystemQ.FirstOrDefault())); }
public ActionResult Edit([Bind(Include = "wdl_ex, care_system_comment, date_care_system_added")] FormCollection form) { int ncsaID = int.Parse(form["care_system_assessment_id"]); nursing_care_system_assessment ncsa = db.nursing_care_system_assessment.FirstOrDefault(m => m.care_system_assessment_id == ncsaID); nursing_pca_record pca = db.nursing_pca_record.FirstOrDefault(m => m.pca_id == ncsa.pca_id); if (form["formButton"] == "Exit") { return(RedirectToAction("IndividualEncounter", "Encounter", new { id = pca.encounter_id })); } if (ModelState.IsValid) { nursing_care_system_assessment_history ncsahistory = new nursing_care_system_assessment_history(); ncsahistory.care_system_assessment_id = ncsa.care_system_assessment_id; ncsahistory.care_system_assessment_type_id = ncsa.care_system_assessment_type_id; ncsahistory.pca_id = ncsa.pca_id; ncsahistory.date_pca_record_added = pca.date_vitals_added; ncsahistory.wdl_ex = ncsa.wdl_ex; ncsahistory.care_system_comment = ncsa.care_system_comment; ncsahistory.date_care_system_added = ncsa.date_care_system_added; ncsahistory.date_care_system_modified = DateTime.Now; ncsa.wdl_ex = form["wdlRadios"] == "wdlEx" ? true : false; ncsa.care_system_comment = form["wdlExceptionInfo"]; db.SaveChanges(); switch (form["formButton"]) { case "SaveList": return(RedirectToAction("IndividualEncounter", "Encounter", new { id = pca.encounter_id })); case "SaveContinue": int typeID = (int)ncsa.care_system_assessment_type_id + 1; if (typeID <= db.nursing_care_system_assessment_type.Count()) { return(RedirectToAction("CreateOrEdit", "BodySystems", new { pcaID = ncsa.pca_id, typeID = typeID })); } else { return(RedirectToAction("CreateOrEdit", "Comments", new { pcaID = ncsa.pca_id, typeID = 2 })); } default: return(View(ncsa)); } } return(View(ncsa)); }
public ActionResult Create([Bind(Include = "care_system_assessment_id, pca_id, wdl_ex, care_system_comment, date_care_system_added")] nursing_care_system_assessment ncsa, FormCollection form) { int pcaID = int.Parse(form["pcaID"]); nursing_pca_record pca = db.nursing_pca_record.FirstOrDefault(m => m.pca_id == pcaID); if (form["formButton"] == "Exit") { return(RedirectToAction("IndividualEncounter", "Encounter", new { id = pca.encounter_id })); } if (ModelState.IsValid) { ncsa.pca_id = pca.pca_id; ncsa.care_system_assessment_type_id = int.Parse(form["care_system_assessment_type_id"]); ncsa.wdl_ex = form["wdlRadios"] == "wdlEx" ? true : false; ncsa.care_system_comment = form["wdlExceptionInfo"]; ncsa.date_care_system_added = DateTime.Now; db.nursing_care_system_assessment.Add(ncsa); db.SaveChanges(); switch (form["formButton"]) { case "SaveList": return(RedirectToAction("IndividualEncounter", "Encounter", new { id = pca.encounter_id })); case "SaveContinue": int typeID = (int)ncsa.care_system_assessment_type_id + 1; if (typeID <= db.nursing_care_system_assessment_type.Count()) { return(RedirectToAction("CreateOrEdit", "BodySystems", new { pcaID = ncsa.pca_id, typeID = typeID })); } else { return(RedirectToAction("Create", "Comments", new { pcaID = ncsa.pca_id, typeID = typeID })); } default: return(View(ncsa)); } } ViewBag.pcaID = pcaID; ViewBag.CareSystems = db.nursing_care_system_assessment_type; return(View(db.nursing_care_system_assessment_type.Find(ncsa.care_system_assessment_type_id))); }
public ActionResult UpdateVital([Bind(Include = "datetime, temperature, temp_route_value, pulse, pulse_route_value, pulse_oximetry, " + "respirations, oxygen_flow, o2_dev_method, systolic_b_pressure, diastolic_b_pressure, " + "comment, wdl_ex, pain_scale_value, pain_level_actual, pain_level__goal, care_comment")] UpdateVitals update, int?id, string formButton) { if (ModelState.IsValid) { nursing_pca_record pca = db.nursing_pca_record.Where(x => x.pca_id == id).FirstOrDefault(); nursing_pca_comment com = db.nursing_pca_comment.Where(s => s.pca_id == pca.pca_id).FirstOrDefault(); nursing_care_system_assessment care = db.nursing_care_system_assessment.Where(h => h.pca_id == pca.pca_id).FirstOrDefault(); encounter path = db.encounters.Where(en => en.encounter_data_id == pca.encounter_id).FirstOrDefault(); ViewBag.encounterId = path.encounter_data_id; //care = db.nursing_care_system_assessment.Select(); care.care_system_assessment_type_id = 1; care.wdl_ex = Convert.ToBoolean(update.wdl_ex); care.care_system_comment = update.care_comment; care.date_care_system_added = update.datetime; //nursing_pca_comment com = new nursing_pca_comment(); com.pca_comment = update.comment; com.pca_comment_type_id = 1; com.date_comment_added = update.datetime; ViewBag.pca_id = pca.pca_id; pca.date_vitals_added = update.datetime; pca.temperature = update.temperature; pca.temp_route_type_id = update.temp_route_value; //update.temp_route_type = pca.temp_route_type_id.ToString(); pca.pulse = update.pulse; pca.pulse_route_type_id = update.pulse_route_value; pca.o_two_delivery_type_id = update.o2_dev_method; pca.respiration = update.respirations; pca.oxygen_flow = update.oxygen_flow; pca.pulse_oximetry = update.pulse_oximetry; pca.pain_scale_type_id = update.pain_scale_value; pca.pain_level_actual = update.pain_level_actual; pca.pain_level_goal = update.pain_level__goal; nursing_pca_record_history historyPca = new nursing_pca_record_history(); historyPca.pca_id = ViewBag.pca_id; historyPca.date_pca_record_orginal = pca.date_vitals_added; historyPca.date_pca_record_modified = update.datetime; historyPca.temperature = update.temperature; historyPca.temp_route_type_id = update.temp_route_value; historyPca.pulse = update.pulse; historyPca.pulse_route_type_id = update.pulse_route_value; historyPca.respiration = update.respirations; historyPca.pulse_oximetry = update.pulse_oximetry; historyPca.oxygen_flow = update.oxygen_flow; historyPca.pain_scale_type_id = update.pain_scale_value; historyPca.pain_level_actual = update.pain_level_actual; historyPca.pain_level_goal = update.pain_level__goal; db.nursing_pca_record_history.Add(historyPca); nursing_care_system_assessment_history historyCaresys = new nursing_care_system_assessment_history(); ViewBag.careSysId = care.care_system_assessment_id; historyCaresys.pca_id = ViewBag.pca_id; historyCaresys.care_system_assessment_id = ViewBag.careSysId; historyCaresys.care_system_assessment_type_id = 1; historyCaresys.date_care_system_added = pca.date_vitals_added; historyCaresys.date_care_system_modified = update.datetime; historyCaresys.care_system_comment = update.care_comment; historyCaresys.wdl_ex = Convert.ToBoolean(update.wdl_ex); db.nursing_care_system_assessment_history.Add(historyCaresys); nursing_pca_comment_history historyCom = new nursing_pca_comment_history(); ViewBag.commentId = com.pca_comment_id; historyCom.pca_id = ViewBag.pca_id; historyCom.pca_comment_id = ViewBag.commentId; historyCom.date_comment_original = pca.date_vitals_added; historyCom.date_comment_modified = update.datetime; historyCom.pca_comment = update.comment; historyCom.pca_comment_type_id = 1; db.nursing_pca_comment_history.Add(historyCom); db.SaveChanges(); switch (formButton) { case "SaveList": return(Redirect("../IndividualEncounter/" + path.encounter_id)); case "SaveContinue": return(RedirectToAction("Edit", "BodySystems", new { pcaID = pca.pca_id, typeID = 2 })); default: return(Redirect("../IndividualEncounter/" + path.encounter_id)); } } ViewBag.CareSystems = db.nursing_care_system_assessment_type; return(View(update)); }
public ActionResult CreateVital(CreateVitals cr, int?id, string formButton) { if (ModelState.IsValid) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } encounter indiviEncounter = db.encounters.Find(id); ViewBag.encounterdataid = indiviEncounter.encounter_data_id; //nursing_pca_record pca_Record = db.nursing_pca_record.Where(x => x.encounter_id == indiviEncounter.encounter_data_id).FirstOrDefault(); nursing_pca_record vi = new nursing_pca_record(); vi.encounter_id = ViewBag.encounterdataid; vi.date_vitals_added = cr.datetime; vi.temperature = cr.temperature; vi.temp_route_type_id = cr.temp_route_value; vi.pulse = cr.pulse; vi.pulse_route_type_id = cr.pulse_route_value; vi.pulse_oximetry = cr.pulse_oximetry; vi.respiration = cr.respirations; vi.oxygen_flow = cr.oxygen_flow; vi.systolic_blood_pressure = cr.systolic_b_pressure; vi.diastolic_blood_pressure = cr.diastolic_b_pressure; vi.o_two_delivery_type_id = cr.o2_dev_method; vi.pain_scale_type_id = cr.pain_scale_value; vi.pain_level_actual = cr.pain_level_actual; vi.pain_level_goal = cr.pain_level__goal; nursing_care_system_assessment care = new nursing_care_system_assessment(); care.care_system_assessment_type_id = 1; care.care_system_comment = cr.care_comment; care.wdl_ex = cr.wdl_ex; care.date_care_system_added = cr.datetime; vi.nursing_care_system_assessment = new List <nursing_care_system_assessment>(); vi.nursing_care_system_assessment.Add(care); nursing_pca_comment com = new nursing_pca_comment(); com.date_comment_added = cr.datetime; com.pca_comment = cr.comment; com.pca_comment_type_id = 1; vi.nursing_pca_comment = new List <nursing_pca_comment>(); vi.nursing_pca_comment.Add(com); indiviEncounter.nursing_pca_record = new List <nursing_pca_record>(); indiviEncounter.nursing_pca_record.Add(vi); db.nursing_pca_record.Add(vi); db.SaveChanges(); switch (formButton) { case "SaveList": return(Redirect("../IndividualEncounter/" + indiviEncounter.encounter_id)); case "SaveContinue": return(RedirectToAction("Create", "BodySystems", new { pcaID = vi.pca_id, typeID = 2 })); default: return(Redirect("../IndividualEncounter/" + indiviEncounter.encounter_id)); } } return(View()); }