//
        // GET: /Hypertension/Create
        public ActionResult Create()
        {
            TayBacDBContext dbContext = new TayBacDBContext();
            List <object>   ls        = new List <object>();
            HospitalModels  hp_model  = new HospitalModels();
            huyetap         ha        = new huyetap();
            benhnhan        pa        = new benhnhan();
            KhoaModels      kh_model  = new KhoaModels();
            GiuongModels    gi_model  = new GiuongModels();
            List <benhvien> lsbv      = hp_model.getAll();
            List <khoa>     lskhoa    = new List <khoa>();

            if (lsbv.Count() > 0)
            {
                lskhoa = kh_model.getListByIdBV(lsbv.First().idbv);
            }
            List <giuong> lsgiuong = new List <giuong>();

            if (lskhoa.Count() > 0)
            {
                lsgiuong = gi_model.getListByIdKhoa(lskhoa.First().idkhoa);
            }

            ls.Add(lsbv);
            ls.Add(ha);
            ls.Add(pa);
            ls.Add(lskhoa);
            ls.Add(lsgiuong);

            return(View(ls));
        }
        //
        //[Permission(Constants.G_ADMIN), Permission(Constants.G_MANAGER)]
        public ActionResult jsonStatHistory()
        {
            TayBacDBContext dbContext   = new TayBacDBContext();
            var             bn_huyetapp = from ha in dbContext.huyetaps
                                          join bs in dbContext.benhsus on ha.idbs equals bs.idbs
                                          join bn in dbContext.benhnhans on bs.idbn equals bn.idbn
                                          group bn.idbn by ha.HA_II_B_1 into g
                                          select new
            {
                HA_II_B_1 = g.Key,
                num       = g.Count()
            };

            return(Json(bn_huyetapp.ToList(), JsonRequestBehavior.AllowGet));
        }
        //
        // GET: /Bloodpressure/Edit/5
        public ActionResult Edit(string id)
        {
            TayBacDBContext dbContext = new TayBacDBContext();
            List <object>   ls        = new List <object>();
            HospitalModels  hp_model  = new HospitalModels();
            HuyetapModels   ha_model  = new HuyetapModels();
            huyetap         ha        = ha_model.getByID(id);



            benhnhan        pa       = new benhnhan();
            KhoaModels      kh_model = new KhoaModels();
            GiuongModels    gi_model = new GiuongModels();
            List <benhvien> lsbv     = hp_model.getAll();
            List <khoa>     lskhoa   = new List <khoa>();

            if (lsbv.Count() > 0)
            {
                lskhoa = kh_model.getListByIdBV(lsbv.First().idbv);
            }
            List <giuong> lsgiuong = new List <giuong>();

            if (lskhoa.Count() > 0)
            {
                lsgiuong = gi_model.getListByIdKhoa(lskhoa.First().idkhoa);
            }

            //
            BenhsuModels  bs_model = new BenhsuModels();
            benhsu        bs_data  = bs_model.getByID(ha.idbs);
            PatientModels pa_model = new PatientModels();
            benhnhan      pa_data  = pa_model.detail(bs_data.idbn);
            benhvien      bv_data  = hp_model.details(pa_data.idbv);

            pa_data.benhvien = bv_data;
            bs_data.benhnhan = pa_data;
            ha.benhsu        = bs_data;
            //

            ls.Add(lsbv);
            ls.Add(ha);
            ls.Add(pa);
            ls.Add(lskhoa);
            ls.Add(lsgiuong);

            return(View(ls));
        }
        //Apis

        //get json list huyet ap
        // GET: /Hypertension/lshuyetap
        public ActionResult lshuyetap()
        {
            TayBacDBContext dbContext   = new TayBacDBContext();
            var             bn_huyetapp = from ha in dbContext.huyetaps
                                          join bs in dbContext.benhsus on ha.idbs equals bs.idbs
                                          join bn in dbContext.benhnhans on bs.idbn equals bn.idbn
                                          select new
            {
                bn_ten        = bn.tenbn,
                bn_ns         = bn.ngaysinh,
                bn_gioitinh   = bn.gioitinh,
                bn_nghenghiep = bn.nghenghiep,
                HA_I          = ha.HA_I,
                HA_II_A       = ha.HA_II_A
            };

            return(Json(bn_huyetapp.ToList(), JsonRequestBehavior.AllowGet));
        }
        //
        // GET: /Hypertension/
        public ActionResult Index()
        {
            TayBacDBContext dbContext   = new TayBacDBContext();
            var             bn_huyetapp = (from ha in dbContext.huyetaps
                                           join bs in dbContext.benhsus on ha.idbs equals bs.idbs
                                           join bn in dbContext.benhnhans on bs.idbn equals bn.idbn
                                           select new HuyetapViewModel
            {
                idbn = bn.idbn,
                tenbn = bn.tenbn,
                idbs = bs.idbs,
                gioitinh = bn.gioitinh,
                ngaysinh = bn.ngaysinh,
                dantoc = bn.dantoc,
                idhuyetap = ha.idhuyetap,
                HA_I = ha.HA_I,
                HA_II_A = ha.HA_II_A
            }).ToList();

            return(View(bn_huyetapp));
        }
Beispiel #6
0
 public KhoaModels()
 {
     dbContext = new TayBacDBContext();
 }
Beispiel #7
0
 public HuyenModels()
 {
     dbContext = new TayBacDBContext();
 }
Beispiel #8
0
 public UserModels()
 {
     dbContext = new TayBacDBContext();
 }
Beispiel #9
0
 public GiuongModels()
 {
     dbContext = new TayBacDBContext();
 }
        //
        public ActionResult jsonStatIndexs()
        {
            TayBacDBContext dbContext   = new TayBacDBContext();
            var             bn_huyetapp = (from ha in dbContext.huyetaps
                                           join bs in dbContext.benhsus on ha.idbs equals bs.idbs
                                           join bn in dbContext.benhnhans on bs.idbn equals bn.idbn
                                           //group bn.idbn by ha.HA_III_1_1 into g
                                           select new
            {
                HA_III_1_1 = ha.HA_III_1_1,                   //mach
                HA_III_1_2 = ha.HA_III_1_2,                   //nhiet do
                HA_III_1_3_1 = ha.HA_III_1_3_1,               // huyet ap
                HA_III_1_3_2 = ha.HA_III_1_3_2,               // huyet ap
                HA_III_1_4 = ha.HA_III_1_4,                   // nhip tho
                HA_III_1_5 = ha.HA_III_1_5,                   // can nang
                HA_III_1_6 = ha.HA_III_1_6                    //chieu cao
            }).ToList();
            //mach
            int HA_III_1_1_nhanh      = 0;
            int HA_III_1_1_binhthuong = 0;
            int HA_III_1_1_cham       = 0;
            //nhiet  do
            //huyet ap
            //nhip tho
            int HA_III_1_4_cham       = 0;
            int HA_III_1_4_binhthuong = 0;
            int HA_III_1_4_nhanh      = 0;
            //BMI
            int BMI_gay        = 0;
            int BMI_binhthuong = 0;
            int BMI_thuacan    = 0;

            foreach (var item in bn_huyetapp)
            {
                //mach
                if (item.HA_III_1_1 > 100)//nhanh
                {
                    HA_III_1_1_nhanh++;
                }
                else if (item.HA_III_1_1 >= 60 && item.HA_III_1_1 <= 100) // binh thuong
                {
                    HA_III_1_1_binhthuong++;
                }
                else if (item.HA_III_1_1 < 60) //cham
                {
                    HA_III_1_1_cham++;
                }

                //nhip tho
                if (item.HA_III_1_4 < 15)
                {
                    HA_III_1_4_cham++;
                }
                else if (item.HA_III_1_4 >= 15 && item.HA_III_1_4 <= 18)
                {
                    HA_III_1_4_binhthuong++;
                }
                else if (item.HA_III_1_4 > 18)
                {
                    HA_III_1_4_nhanh++;
                }

                //BMI
                Double bmi = Convert.ToDouble(item.HA_III_1_5) / Math.Pow(Convert.ToDouble(item.HA_III_1_6), Convert.ToDouble(2));
                if (bmi < 18.5)
                {
                    BMI_gay++;
                }
                else if (bmi >= 18.5 && bmi <= 24.99)
                {
                    BMI_binhthuong++;
                }
                else if (bmi >= 25)
                {
                    BMI_thuacan++;
                }
            }
            List <Array> ls_indexs = new List <Array>();

            int[] mach = new int[3];
            mach[0] = HA_III_1_1_nhanh;
            mach[1] = HA_III_1_1_binhthuong;
            mach[2] = HA_III_1_1_cham;
            ls_indexs.Add(mach);
            //
            int[] nhiptho = new int[3];
            nhiptho[0] = HA_III_1_4_nhanh;
            nhiptho[1] = HA_III_1_4_binhthuong;
            nhiptho[2] = HA_III_1_4_cham;
            ls_indexs.Add(nhiptho);
            //BMI
            int[] arr_bmi = new int[3];
            arr_bmi[0] = BMI_thuacan;
            arr_bmi[1] = BMI_binhthuong;
            arr_bmi[2] = BMI_gay;
            ls_indexs.Add(arr_bmi);

            return(Json(ls_indexs, JsonRequestBehavior.AllowGet));
        }
Beispiel #11
0
 public HospitalModels()
 {
     dbContext = new TayBacDBContext();
 }
Beispiel #12
0
 public DoctorModels()
 {
     dbContext = new TayBacDBContext();
 }
Beispiel #13
0
 public BenhsuModels()
 {
     dbContext = new TayBacDBContext();
 }
Beispiel #14
0
 public LoginModels()
 {
     dbContext = new TayBacDBContext();
 }
Beispiel #15
0
 public TinhModels()
 {
     dbContext = new TayBacDBContext();
 }
Beispiel #16
0
 public PatientModels()
 {
     dbContext = new TayBacDBContext();
 }