コード例 #1
0
        public ActionResult Addprescription(Addprescriptionviewmodel model)
        {
            hospital_managementEntities db = new hospital_managementEntities();

            Register_patient R = db.Register_patient.Find(model.PatientId);

            if (R == null)
            {
                return(HttpNotFound());
            }
            else
            {
                Patient_Prescription p = new Patient_Prescription();
                p.Duration   = model.Duration;
                p.Evening    = model.Evening;
                p.Medicine   = model.Medicine;
                p.Morning    = model.Morning;
                p.Noon       = model.Noon;
                p.Registerid = model.PatientId;
                db.Patient_Prescription.Add(p);
                db.SaveChanges();

                return(RedirectToAction("AddHistory"));
            }
        }
コード例 #2
0
        public ActionResult Edit(int id, Addprescriptionviewmodel collection)
        {
            try
            {
                // TODO: Add update logic here
                hospital_managementEntities db = new hospital_managementEntities();
                Patient_Prescription        p  = db.Patient_Prescription.Find(id);
                if (p == null)
                {
                    return(HttpNotFound());
                }
                else
                {
                    p.Duration = collection.Duration;

                    p.Evening    = collection.Evening;
                    p.Medicine   = collection.Medicine;
                    p.Morning    = collection.Morning;
                    p.Noon       = collection.Noon;
                    p.Registerid = collection.PatientId;

                    db.SaveChanges();
                }

                return(RedirectToAction("checkdetails"));
            }
            catch (Exception e)
            {
                return(View());
            }
        }
コード例 #3
0
        // GET: Doctor/Delete/5
        public ActionResult Delete(int id)
        {
            hospital_managementEntities db = new hospital_managementEntities();
            Patient_Prescription        r  = db.Patient_Prescription.Find(id);

            if (r == null)
            {
                return(HttpNotFound());
            }
            else
            {
                Addprescriptionviewmodel p = new Addprescriptionviewmodel();
                p.Duration  = r.Duration;
                p.Evening   = r.Evening;
                p.Medicine  = r.Medicine;
                p.Morning   = r.Morning;
                p.Noon      = r.Noon;
                p.PatientId = id;
                return(View(p));
            }
        }
コード例 #4
0
        // GET: Doctor/Edit/5
        public ActionResult Edit(int id)
        {
            hospital_managementEntities db = new hospital_managementEntities();
            Patient_Prescription        p  = db.Patient_Prescription.Find(id);

            if (p == null)
            {
                return(HttpNotFound());
            }
            else
            {
                Addprescriptionviewmodel model = new Addprescriptionviewmodel();
                model.Duration  = p.Duration;
                model.Evening   = p.Evening;
                model.Medicine  = p.Medicine;
                model.Morning   = p.Morning;
                model.Noon      = p.Noon;
                model.PatientId = id;

                ViewBag.collection = model;
                return(View(model));
            }
        }
コード例 #5
0
        public ActionResult checkdetailslist(int id)
        {
            int r = 0;
            int k = 0;
            list_pat_details            list = new list_pat_details();
            hospital_managementEntities db   = new hospital_managementEntities();

            foreach (Patient_Prescription p in db.Patient_Prescription)
            {
                if (p.Registerid == id)
                {
                    r = 1;
                }
            }
            foreach (Patient_History p in db.Patient_History)
            {
                if (p.patient_id == id)
                {
                    k = 1;
                }
            }



            if (r == 0 && k == 0)
            {
                return(HttpNotFound());
            }
            else
            {
                Addprescriptionviewmodel S = new Addprescriptionviewmodel();
                Addhistoryviewmodel      Q = new Addhistoryviewmodel();



                foreach (Patient_Prescription p in db.Patient_Prescription)
                {
                    if (p.Registerid == id)
                    {
                        S.Duration  = p.Duration;
                        S.Evening   = p.Evening;
                        S.Medicine  = p.Medicine;
                        S.Morning   = p.Morning;
                        S.Noon      = p.Noon;
                        S.id        = p.SR;
                        S.PatientId = p.Registerid;
                    }
                }
                foreach (Patient_History p in db.Patient_History)
                {
                    if (p.patient_id == id)
                    {
                        Q.Age         = p.Age;
                        Q.BP          = p.BP;
                        Q.Gender      = p.Gender;
                        Q.indications = p.indications;
                        Q.PatientId   = p.patient_id;
                        Q.Pulse       = p.Pulse;
                        Q.id          = p.id;
                        Q.Weight      = p.Weight;
                    }
                }

                list.list_history.Add(Q);
                list.list_prescription.Add(S);
            }

            return(View(list));

            /*else
             * {
             *
             *  Addprescriptionviewmodel S = new Addprescriptionviewmodel();
             *  Addhistoryviewmodel Q = new Addhistoryviewmodel();
             *
             *
             *  S.PatientId = mod.PatientId;
             *  S.Medicine = R.Medicine;
             *  S.Duration = R.Duration;
             *  S.Morning = R.Noon;
             *  S.Evening = R.Evening;
             *  S.Morning = R.Morning;
             *  Q.Gender = K.Gender;
             *  Q.Age = K.Age;
             *  Q.BP = K.BP;
             *  Q.Weight = K.Weight;
             *  Q.Pulse = K.Pulse;
             *  Q.indications = K.indications;
             *  Q.PatientId = mod.PatientId;
             *  list.list_history.Add(Q);
             *
             *  list.list_prescription.Add(S);
             *
             * }*/
        }