Пример #1
0
        // GET: Comments/Edit
        public ActionResult Edit(int?pcaID, int?typeID)
        {
            if (pcaID == null || typeID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            // get the comment with matching typeID and pcaID and the most recent date
            var commentQ = from c in db.nursing_pca_comment
                           where c.pca_comment_type_id == typeID && c.pca_id == pcaID
                           group c by c.pca_comment_type_id into g
                           select g.OrderByDescending(t => t.date_comment_added).FirstOrDefault();

            ViewBag.CommentTypeName = db.nursing_pca_comment_type.FirstOrDefault(t => t.pca_comment_type_id == typeID).pca_comment_type_name;
            ViewBag.CareSystems     = db.nursing_care_system_assessment_type;
            ViewBag.PCAComments     = db.nursing_pca_comment_type;

            if (commentQ.FirstOrDefault() == null)
            {
                var emptyComment = new nursing_pca_comment();
                emptyComment.pca_id = (int)pcaID;
                emptyComment.pca_comment_type_id = (int)typeID;
                return(View(emptyComment));
            }
            return(View(commentQ.FirstOrDefault()));
        }
Пример #2
0
        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));
        }
Пример #3
0
        public ActionResult Create([Bind(Include = "pca_comment_id, pca_id, pca_comment, date_comment_added")] nursing_pca_comment npcac, 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)
            {
                npcac.pca_id = pca.pca_id;
                npcac.pca_comment_type_id = int.Parse(form["pca_comment_type_id"]);
                npcac.pca_comment         = form["commentData"];
                npcac.date_comment_added  = DateTime.Now;
                db.nursing_pca_comment.Add(npcac);
                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("IndividualEncounter", "Encounter", new { id = pca.encounter_id }));
                    }

                default:
                    return(View(npcac));
                }
            }

            ViewBag.pcaID       = pcaID;
            ViewBag.CareSystems = db.nursing_care_system_assessment_type;
            ViewBag.PCAComments = db.nursing_pca_comment_type;
            return(View(db.nursing_pca_comment_type.Find(npcac.pca_comment_type_id)));
        }
Пример #4
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));
        }
Пример #5
0
        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());
        }