public ActionResult UpdateVital(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } //find pca record using pcaId nursing_pca_record pcaRecord = db.nursing_pca_record.Find(id); if (pcaRecord == null) { return(HttpNotFound()); } ViewBag.CareSystems = db.nursing_care_system_assessment_type; UpdateVitals up = new UpdateVitals() { pcaId = pcaRecord.pca_id, encounterId = (int)pcaRecord.encounter_id, datetime = pcaRecord.date_vitals_added, temperature = Convert.ToDecimal(pcaRecord.temperature), temp_route_type = facade.GetNursingTempRouteName(pcaRecord.temp_route_type_id), pulse = Convert.ToByte(pcaRecord.pulse), pulse_route_type = facade.GetNursingPulseRouteName(pcaRecord.pulse_route_type_id), respirations = Convert.ToByte(pcaRecord.respiration), pulse_oximetry = Convert.ToByte(pcaRecord.pulse_oximetry), oxygen_flow = pcaRecord.oxygen_flow, o2_type = facade.GetO2DeliveryMethod(pcaRecord.o_two_delivery_type_id), systolic_b_pressure = Convert.ToByte(pcaRecord.systolic_blood_pressure), diastolic_b_pressure = Convert.ToByte(pcaRecord.diastolic_blood_pressure), comment = facade.GetVitalComment(pcaRecord.pca_id), wdl_ex = facade.GetWdlInfo(pcaRecord.pca_id), pain_scale_type = facade.GetPainScaleType(pcaRecord.pain_scale_type_id), pain_level_actual = Convert.ToByte(pcaRecord.pain_level_actual), pain_level__goal = Convert.ToByte(pcaRecord.pain_level_goal), care_comment = facade.GetPainComment(pcaRecord.pca_id) }; return(View(up)); }
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)); }