public ActionResult Edit([Bind(Include = "commentData")] FormCollection form)
        {
            int npcacID = int.Parse(form["pca_comment_id"]);
            nursing_pca_comment npcac = db.nursing_pca_comment.FirstOrDefault(m => m.pca_comment_id == npcacID);
            nursing_pca_record  pca   = db.nursing_pca_record.FirstOrDefault(m => m.pca_id == npcac.pca_id);

            if (form["formButton"] == "Exit")
            {
                return(RedirectToAction("IndividualEncounter", "Encounter", new { id = pca.encounter_id }));
            }

            if (ModelState.IsValid)
            {
                nursing_pca_comment_history npcachistory = new nursing_pca_comment_history();
                npcachistory.pca_comment_id      = npcac.pca_comment_id;
                npcachistory.pca_comment_type_id = npcac.pca_comment_type_id;
                npcachistory.pca_id                = npcac.pca_id;
                npcachistory.pca_comment           = npcac.pca_comment;
                npcachistory.date_comment_original = npcac.date_comment_added;
                npcachistory.date_comment_modified = DateTime.Now;

                npcac.pca_comment = form["wdlExceptionInfo"];

                db.SaveChanges();

                switch (form["formButton"])
                {
                case "SaveList":
                    return(RedirectToAction("IndividualEncounter", "Encounter", new { id = pca.encounter_id }));

                case "SaveContinue":
                    int typeID = (int)npcac.pca_comment_type_id + 1;
                    if (typeID <= db.nursing_pca_comment_type.Count())
                    {
                        return(RedirectToAction("CreateOrEdit", "Comments", new { pcaID = npcac.pca_id, typeID = typeID }));
                    }
                    else
                    {
                        return(RedirectToAction("Edit", "Comments", new { pcaID = npcac.pca_id, typeID = typeID }));
                    }

                default:
                    return(View(npcac));
                }
            }
            return(View(npcac));
        }
Beispiel #2
0
        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));
        }