示例#1
0
        public ActionResult Edit(benhnhan patient)
        {
            ViewBag.getListHospitals = new HospitalModels().getListHospitals();
            ViewBag.getListTinhs     = new TinhModels().getListTinhs();
            ViewBag.getListXas       = new XaModels().getListXas();
            ViewBag.getListHuyens    = new HuyenModels().getListHuyens();

            if (
                ((Session[Constants.SESSION_GROUPID] as string) == Constants.G_MANAGER ||
                 (Session[Constants.SESSION_GROUPID] as string) == Constants.G_STAFF) &&
                patient.idbv.Trim() != (Session[Constants.SESSION_HOSPITAL_ID] as string).Trim())
            {
                return(RedirectToAction(actionName: "NotAuthorize", controllerName: "Login"));
            }
            if ((Session[Constants.SESSION_GROUPID] as string) == Constants.G_PATIENT &&
                patient.idbn.Trim() != (Session[Constants.SESSION_ID] as string).Trim())
            {
                return(RedirectToAction(actionName: "NotAuthorize", controllerName: "Login"));
            }
            if (new PatientModels().update(patient) == 1)
            {
                return(RedirectToAction("Details", new { @id = patient.idbn.Trim() }));
            }

            return(View());
        }
        //
        // 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));
        }
示例#3
0
        public int update(benhnhan patient)
        {
            var p = dbContext.benhnhans.Find(patient.idbn);

            if (p == null)
            {
                return(0);
            }
            if (String.IsNullOrEmpty(patient.idbv))
            {
                patient.idbv = p.idbv;
            }
            if (String.IsNullOrEmpty(patient.tenbn))
            {
                patient.tenbn = p.tenbn;
            }
            p.tenbn      = patient.tenbn;
            p.dienthoai  = patient.dienthoai;
            p.email      = patient.email;
            p.ngaysinh   = patient.ngaysinh;
            p.idxa       = patient.idxa;
            p.idtinh     = patient.idtinh;
            p.idhuyen    = patient.idhuyen;
            p.nghenghiep = patient.nghenghiep;
            p.noilamviec = patient.noilamviec;
            try
            {
                dbContext.SaveChanges();
                return(1);
            }
            catch (Exception)
            {
                return(0);
            }
        }
示例#4
0
        private void bt_load_Click(object sender, EventArgs e)
        {
            benhnhan bn = (benhnhan)listBox1.SelectedItem;

            if (bn != null)
            {
                tb_maso.Text   = bn.maso;
                tb_cmnd.Text   = bn.cmnd;
                tb_hoten.Text  = bn.hoten;
                tb_diachi.Text = bn.diachi;
            }
        }
示例#5
0
 public bool insert(benhnhan p)
 {
     try
     {
         dbContext.benhnhans.Add(p);
         dbContext.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#6
0
 public bool create(benhnhan patient)
 {
     dbContext.benhnhans.Add(patient);
     try
     {
         dbContext.SaveChanges();
     }
     catch
     {
         return(false);
     }
     return(true);
 }
示例#7
0
        private void bt_luu_Click(object sender, EventArgs e)
        {
            benhnhan bn = new benhnhan();

            bn.maso   = tb_maso.Text;
            bn.cmnd   = tb_cmnd.Text;
            bn.hoten  = tb_hoten.Text;
            bn.diachi = tb_diachi.Text;
            MessageQueueTransaction transaction = new MessageQueueTransaction();

            transaction.Begin();
            queue.Send(bn, transaction);
            transaction.Commit();
        }
示例#8
0
        public bool saveImg(string id, byte[] img)
        {
            benhnhan p = dbContext.benhnhans.Find(id);

            //  u.image = new byte[img.Length];
            p.image = img;
            try
            {
                dbContext.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
        //
        // 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));
        }
示例#10
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //kiem tra gia tri nhap vao truoc khi add vao database
            KTInput();
            //add thong tin benh nhan vao database
            IEnumerable <benhnhan> lstSV;

            if (objBenhNhan.getBNBietMa(txtMa.Text) != null)
            {
                MessageBox.Show("Da gui thong tin benh nhan tai kham cho bac si");
                //send message
                IMessageProducer producer = session.CreateProducer(destination);
                ITextMessage     mess     = new ActiveMQTextMessage(txtMa.Text);
                producer.Send(mess);
            }
            else
            if (objBenhNhan.getBNBietCMND(txtCMND.Text) != null)
            {
                MessageBox.Show("Da gui thong tin benh nhan tai kham cho bac si");
                IMessageProducer producer = session.CreateProducer(destination);
                ITextMessage     mess     = new ActiveMQTextMessage(txtMa.Text);
                producer.Send(mess);
            }
            else
            {
                benhnhan bn = new benhnhan();
                bn.msbn   = txtMa.Text;
                bn.socmnd = txtCMND.Text;
                bn.hoten  = txtHoTen.Text;
                bn.diachi = txtDiaChi.Text;
                objBenhNhan.themBN(bn);

                //
                khambenh kb = new khambenh();
                kb.msbn = txtMa.Text;

                kb.msbacsy = "002";
                objKhamBenh.themKB(kb);

                //send message
                IMessageProducer producer = session.CreateProducer(destination);
                ITextMessage     mess     = new ActiveMQTextMessage(txtMa.Text);
                producer.Send(mess);

                MessageBox.Show("Da luu thong tin!");
            }
        }
示例#11
0
        public ActionResult Create(benhnhan patient)
        {
            //patient.updatetime = DateTime.Today;
            ViewBag.getListHospitals = new HospitalModels().getListHospitals();
            ViewBag.getListTinhs     = new TinhModels().getListTinhs();
            ViewBag.getListXas       = new XaModels().getListXas();
            ViewBag.getListHuyens    = new HuyenModels().getListHuyens();
            ViewBag.id = new PatientModels().createPatienId();

            if (ModelState.IsValid)
            {
                if (new PatientModels().insert(patient))
                {
                    ViewBag.Susscess = "Thêm người dùng thành công";
                    return(View());
                }
                ModelState.AddModelError("", "Không thể thêm bản ghi");
                return(View());
            }

            return(View());
        }
 //public ActionResult Create(FormCollection collection)
 public ActionResult Create(benhnhan pa, huyetap ha)
 {
     try
     {
         PatientModels pa_model = new PatientModels();
         pa.idbn = StandString.generateBNID(8);
         pa_model.create(pa);
         benhsu bes = new benhsu();
         bes.idbn = pa.idbn;
         bes.idbs = StandString.generateBESID(8);
         BenhsuModels bes_model = new BenhsuModels();
         bes_model.insert(bes);
         HuyetapModels ha_model = new HuyetapModels();
         ha.idhuyetap = bes.idbs;
         ha.idbs      = bes.idbs;
         ha_model.insert(ha);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#13
0
 private void btnfindCMND_Click(object sender, EventArgs e)
 {
     if (txtCMND.Text == "" || txtCMND.Text == null)
     {
         MessageBox.Show("Vui long nhap CMND benh nhan can tim!");
         txtCMND.Focus();
         txtCMND.SelectAll();
     }
     else
     {
         string   strCMND = txtCMND.Text.Trim();
         benhnhan bn      = objBenhNhan.getBNTimTheoCMND(txtCMND.Text);
         if (bn != null)
         {
             txtMa.Text     = bn.socmnd;
             txtDiaChi.Text = bn.diachi;
             txtHoTen.Text  = bn.hoten;
         }
         else
         {
             MessageBox.Show("Tim khong thay!");
         }
     }
 }
示例#14
0
        public ActionResult Login(string username, string pass, string group)
        {
            if (ModelState.IsValid)
            {
                var account = new LoginModels().CheckAccount(username, pass, group);

                if (account != null)
                {
                    if (group == Constants.G_ADMIN)
                    {
                        user user = account as user;
                        Session[Constants.SESSION_ID]            = user.idnd;
                        Session[Constants.SESSION_GROUPID]       = Constants.G_ADMIN;
                        Session[Constants.SESSION_NAME]          = user.tennd;
                        Session[Constants.SESSION_HOSPITAL_ID]   = user.idbv;
                        Session[Constants.SESSION_HOSPITAL_NAME] = user.benhvien.tenbv;
                        return(RedirectToAction("Index", "Admin"));
                    }
                    if (group == Constants.G_MANAGER)
                    {
                        user user = account as user;
                        if (user.trangthai == false || user.trangthai == null)
                        {
                            ViewBag.Err1 = "Tài Khoản đang bị khóa";
                            return(View("Index"));
                        }
                        Session[Constants.SESSION_ID]            = user.idnd;
                        Session[Constants.SESSION_GROUPID]       = Constants.G_MANAGER;
                        Session[Constants.SESSION_NAME]          = user.tennd;
                        Session[Constants.SESSION_HOSPITAL_ID]   = user.idbv;
                        Session[Constants.SESSION_HOSPITAL_NAME] = user.benhvien.tenbv;
                        return(RedirectToAction("Index", "Manager"));
                    }
                    if (group == Constants.G_STAFF)
                    {
                        user user = account as user;
                        if (user.trangthai == false || user.trangthai == null)
                        {
                            ViewBag.Err1 = "Tài Khoản đang bị khóa";
                            return(View("Index"));
                        }
                        Session[Constants.SESSION_ID]            = user.idnd;
                        Session[Constants.SESSION_GROUPID]       = Constants.G_STAFF;
                        Session[Constants.SESSION_NAME]          = user.tennd;
                        Session[Constants.SESSION_HOSPITAL_ID]   = user.idbv;
                        Session[Constants.SESSION_HOSPITAL_NAME] = user.benhvien.tenbv;
                        return(RedirectToAction("Index", "Staff"));
                    }
                    if (group == Constants.G_PATIENT)
                    {
                        benhnhan patient = account as benhnhan;
                        if (patient.trangthai == false || patient.trangthai == null)
                        {
                            ViewBag.Err1 = "Tài Khoản đang bị khóa";
                            return(View("Index"));
                        }
                        Session[Constants.SESSION_ID]            = patient.idbn;
                        Session[Constants.SESSION_GROUPID]       = Constants.G_PATIENT;
                        Session[Constants.SESSION_NAME]          = patient.tenbn;
                        Session[Constants.SESSION_HOSPITAL_NAME] = patient.benhvien.tenbv;
                        return(RedirectToAction("Index", "Patient"));
                    }
                    if (group == Constants.G_DOCTOR)
                    {
                        bacsy doctor = account as bacsy;
                        if (doctor.trangthai == false || doctor.trangthai == null)
                        {
                            ViewBag.Err1 = "Tài Khoản đang bị khóa";
                            return(View("Index"));
                        }
                        Session[Constants.SESSION_ID]            = doctor.idbsy;
                        Session[Constants.SESSION_GROUPID]       = Constants.G_DOCTOR;
                        Session[Constants.SESSION_NAME]          = doctor.tenbs;
                        Session[Constants.SESSION_HOSPITAL_ID]   = doctor.idbv;
                        Session[Constants.SESSION_HOSPITAL_NAME] = doctor.benhvien.tenbv;
                        return(RedirectToAction("Index", "Doctor"));
                    }
                }
            }
            ViewBag.Err1 = "Sai mật khẩu hoặc tài khoản";
            ViewBag.Err2 = "Kiểm tra quyền người dùng";
            return(View("Index"));
        }
示例#15
0
 private void SetText(benhnhan bn)
 {
     listBox1.DisplayMember = "hoten";
     listBox1.ValueMember   = "cmnd";
     listBox1.Items.Add(bn);
 }
        public ActionResult Import(HttpPostedFileBase uploadFile)
        {
            StringBuilder strValidations = new StringBuilder(string.Empty);

            try
            {
                if (uploadFile.ContentLength > 0)
                {
                    //string filePath = Path.Combine(HttpContext.Server.MapPath("../Uploads"),
                    //Path.GetFileName(uploadFile.FileName));
                    //uploadFile.SaveAs(filePath);

                    //ExcelDataReader works on binary excel file
                    Stream stream = uploadFile.InputStream;
                    //We need to written the Interface.
                    IExcelDataReader reader = null;
                    if (uploadFile.FileName.EndsWith(".xls"))
                    {
                        //reads the excel file with .xls extension
                        reader = ExcelReaderFactory.CreateBinaryReader(stream);
                    }
                    else if (uploadFile.FileName.EndsWith(".xlsx"))
                    {
                        //reads excel file with .xlsx extension
                        reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
                    }
                    else
                    {
                        //Shows error if uploaded file is not Excel file
                        ModelState.AddModelError("File", "This file format is not supported");
                        //return View();
                    }
                    //treats the first row of excel file as Coluymn Names
                    //reader.IsFirstRowAsColumnNames = true;

                    //Adding reader data to DataSet()
                    DataSet result = reader.AsDataSet();
                    reader.Close();

                    //Standardized data

                    var table           = result.Tables[0];
                    var numrow          = table.Rows.Count;
                    var break_firstline = 0;
                    foreach (DataRow row in table.Rows)
                    {
                        if (row[table.Columns[0].ColumnName] != null && !string.IsNullOrEmpty(Convert.ToString(row[table.Columns[0].ColumnName])))
                        {
                            //break first row
                            if (break_firstline > 0)
                            {
                                //hospital
                                benhvien hp = new benhvien();
                                //patient
                                benhnhan pa = new benhnhan();
                                //benh su
                                benhsu bes = new benhsu();
                                //Huyetap
                                huyetap ha = new huyetap();
                                for (int i = 0; i < table.Columns.Count; i++)
                                {
                                    var col = row[table.Columns[i].ColumnName];
                                    if (i == 0)
                                    {
                                        //dau thoi gian
                                    }
                                    else if (i == 1)
                                    {
                                        //benh vien
                                        hp.tenbv = Convert.ToString(row[table.Columns[i].ColumnName]);
                                        hp.idbv  = StandHAModels.generateBVID(8);

                                        //check insert hospital at here
                                        //if exist

                                        //else
                                    }
                                    else if (i == 2)
                                    {
                                        //khoa
                                    }
                                    else if (i == 3)
                                    {
                                        //giuong
                                    }
                                    else if (i == 4)
                                    {
                                        //so luu tru
                                        pa.soluutru = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 5)
                                    {
                                        //ma y te
                                    }
                                    else if (i == 6)
                                    {
                                        //ma benh nhan
                                    }
                                    else if (i == 7)
                                    {
                                        //ho va ten
                                        pa.tenbn = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 8)
                                    {
                                        //sinh ngay
                                        try
                                        {
                                            DateTime d = new DateTime(int.Parse(Convert.ToString(row[table.Columns[i].ColumnName])), 1, 1);
                                            pa.ngaysinh = d;
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else if (i == 9)
                                    {
                                        //gioi tinh
                                        String gender = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        if (gender == "nam")
                                        {
                                            pa.gioitinh = true;
                                        }
                                        else if (gender == "nu")
                                        {
                                            pa.gioitinh = false;
                                        }
                                        else
                                        {
                                            pa.gioitinh = true;
                                        }
                                    }
                                    else if (i == 10)
                                    {
                                        //nghe nghiep
                                        pa.nghenghiep = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 11)
                                    {
                                        //dan toc
                                        pa.dantoc = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 12)
                                    {
                                        //dia chi
                                        pa.diachi = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 13)
                                    {
                                        //huyen
                                    }
                                    else if (i == 14)
                                    {
                                        //thanh pho
                                    }
                                    else if (i == 15)
                                    {
                                        //tinh
                                    }
                                    else if (i == 16)
                                    {
                                        //noi lam viec
                                        pa.noilamviec = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 17)
                                    {
                                        //ngay vao vien
                                    }
                                    else if (i == 18)
                                    {
                                        //dien thoai
                                        pa.dienthoai = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 19)
                                    {
                                        //ly do vao vien
                                        ha.HA_I = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 20)
                                    {
                                        //A.Benh su
                                        ha.HA_II_A = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 21)
                                    {
                                        //Bản thân có mắc bệnh đái tháo đường không, rối loạn lipit máu, bệnh mạch vành, bệnh thận, có hút thuốc lá không
                                        string HA_II_B_1 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        if (HA_II_B_1 == "co")
                                        {
                                            ha.HA_II_B_1 = true;
                                        }
                                        else if (HA_II_B_1 == "khong")
                                        {
                                            ha.HA_II_B_1 = false;
                                        }
                                    }
                                    else if (i == 22)
                                    {
                                        //* Diễn giải mục 1
                                        ha.HA_II_B_1_1 = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 23)
                                    {
                                        //2. Có dùng thuốc gì? Thuốc nội tiết, thuốc cường giao cảm, salbutamol, costisol
                                        string HA_II_B_2 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        if (HA_II_B_2 == "co")
                                        {
                                            ha.HA_II_B_2 = true;
                                        }
                                        else if (HA_II_B_2 == "khong")
                                        {
                                            ha.HA_II_B_2 = false;
                                        }
                                    }
                                    else if (i == 24)
                                    {
                                        //* Diễn giải mục 2
                                        ha.HA_II_B_2_1 = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 25)
                                    {
                                        //3. Có thừa cân, béo phì (chiều cao, cân nặng BMI), lối sống ít vận động, ăn uống có thể liên quan đến tăng huyết áp
                                        string HA_II_B_3 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        if (HA_II_B_3 == "co")
                                        {
                                            ha.HA_II_B_3 = true;
                                        }
                                        else if (HA_II_B_3 == "khong")
                                        {
                                            ha.HA_II_B_3 = false;
                                        }
                                    }
                                    else if (i == 26)
                                    {
                                        //* Diễn giải mục 3
                                        ha.HA_II_B_3_1 = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 27)
                                    {
                                        //4. Nếu là nữ có thai hay không?
                                        string HA_II_B_4 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        if (HA_II_B_4 == "co")
                                        {
                                            ha.HA_II_B_4 = true;
                                        }
                                        else if (HA_II_B_4 == "khong")
                                        {
                                            ha.HA_II_B_4 = false;
                                        }
                                    }
                                    else if (i == 28)
                                    {
                                        //* Diễn giải mục 4
                                        ha.HA_II_B_4_1 = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 29)
                                    {
                                        //5. Tuổi xuất hiện cao huyết áp
                                        ha.HA_II_B_5 = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 30)
                                    {
                                        //6. Gia đình có ai mắc bệnh mãn tính gì không?
                                        string HA_II_B6 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        if (HA_II_B6 == "co")
                                        {
                                            ha.HA_II_B_6 = true;
                                        }
                                        else if (HA_II_B6 == "khong")
                                        {
                                            ha.HA_II_B_6 = false;
                                        }
                                    }
                                    else if (i == 31)
                                    {
                                        //* Diễn giải mục 6
                                        ha.HA_II_B_6_1 = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 32)
                                    {
                                        //Mạch toàn thân (lần/phút)
                                        try
                                        {
                                            ha.HA_III_1_1 = float.Parse(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else if (i == 33)
                                    {
                                        //Nhiệt độ (độ C)
                                        try
                                        {
                                            ha.HA_III_1_2 = float.Parse(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else if (i == 34)
                                    {
                                        //Huyết áp ngưỡng thấp (mmHg)
                                        try
                                        {
                                            ha.HA_III_1_3_1 = int.Parse(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else if (i == 35)
                                    {
                                        //Huyết áp ngưỡng cao (mmHg)
                                        try
                                        {
                                            ha.HA_III_1_3_1 = int.Parse(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else if (i == 36)
                                    {
                                        //Nhịp thở (lần/phút)
                                        try
                                        {
                                            ha.HA_III_1_4 = int.Parse(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else if (i == 37)
                                    {
                                        //Cân nặng (Kg)
                                        try
                                        {
                                            ha.HA_III_1_5 = int.Parse(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else if (i == 38)
                                    {
                                        //Chiều cao (mét)
                                        try
                                        {
                                            ha.HA_III_1_6 = int.Parse(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else if (i == 39)
                                    {
                                        //2. Khám các bộ phận
                                        ha.HA_III_2 = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 40)
                                    {
                                        //- Công thức máu
                                        ha.HA_IV_1 = Convert.ToString(row[table.Columns[i].ColumnName]);
                                    }
                                    else if (i == 41)
                                    {
                                        //Glucose máu
                                        try
                                        {
                                            ha.HA_IV_2 = float.Parse(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else if (i == 42)
                                    {
                                        //Ure
                                        try
                                        {
                                            ha.HA_IV_3 = float.Parse(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else if (i == 43)
                                    {
                                        //CRP
                                        try
                                        {
                                            ha.HA_IV_4 = float.Parse(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else if (i == 44)
                                    {
                                        //Acid uric
                                        try
                                        {
                                            ha.HA_IV_5 = float.Parse(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else if (i == 45)
                                    {
                                        //Creatinin
                                        try
                                        {
                                            ha.HA_IV_6 = float.Parse(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        }
                                        catch
                                        {
                                        }
                                    }
                                    else if (i == 46)
                                    {
                                        //7. Cholesteol bao nhiêu
                                        string HA_IV_7 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        if (HA_IV_7 == "cao")
                                        {
                                            ha.HA_IV_7 = true;
                                        }
                                        else if (HA_IV_7 == "binhthuong")
                                        {
                                            ha.HA_IV_7 = false;
                                        }
                                    }
                                    else if (i == 47)
                                    {
                                        //* Diễn giải mục 7
                                    }
                                    else if (i == 48)
                                    {
                                        //8. Triglycerid bao nhiêu :
                                        string HA_IV_8 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        if (HA_IV_8 == "cao")
                                        {
                                            ha.HA_IV_8 = true;
                                        }
                                        else if (HA_IV_8 == "binhthuong")
                                        {
                                            ha.HA_IV_8 = false;
                                        }
                                    }
                                    else if (i == 50)
                                    {
                                        //* Diễn giải mục 8
                                    }
                                    else if (i == 51)
                                    {
                                        //9. HDL-C bao nhiêu
                                        string HA_IV_9 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        if (HA_IV_9 == "binhthuong")
                                        {
                                            ha.HA_IV_9 = true;
                                        }
                                        else if (HA_IV_9 == "khongbinhthuong")
                                        {
                                            ha.HA_IV_9 = false;
                                        }
                                    }
                                    else if (i == 52)
                                    {
                                        //* Diễn giải mục 9
                                    }
                                    else if (i == 53)
                                    {
                                        //10. LDL-C bao nhiêu
                                        string HA_IV_10 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        if (HA_IV_10 == "caohonbinhthuong")
                                        {
                                            ha.HA_IV_10 = true;
                                        }
                                        else if (HA_IV_10 == "binhthuong")
                                        {
                                            ha.HA_IV_10 = false;
                                        }
                                    }
                                    else if (i == 54)
                                    {
                                        //* Diễn giải mục 10
                                    }
                                    else if (i == 55)
                                    {
                                        //11 a. XN: Điện giải đồ Na
                                        string HA_IV_11 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        if (HA_IV_11 == "khonglam")
                                        {
                                            ha.HA_IV_11 = false;
                                        }
                                        else
                                        {
                                            ha.HA_IV_11 = true;
                                        }
                                    }
                                    else if (i == 56)
                                    {
                                        //11 b. XN: Điện giải đồ Kali
                                    }
                                    else if (i == 57)
                                    {
                                        //* Diễn giải mục 11b Kali bao nhiêu
                                    }
                                    else if (i == 58)
                                    {
                                        //12. X-quang tim phổi
                                        string HA_IV_12 = StandString.FinalStandString(Convert.ToString(row[table.Columns[i].ColumnName]));
                                        if (HA_IV_12 == "binhthuong")
                                        {
                                            ha.HA_IV_12 = true;
                                        }
                                        else if (HA_IV_12 == "khongbinhthuong")
                                        {
                                            ha.HA_IV_12 = false;
                                        }
                                    }
                                    else if (i == 59)
                                    {
                                        //* Diễn giải mục 12
                                    }
                                }
                                System.Diagnostics.Debug.WriteLine(hp.tenbv);

                                //Compare let insert data to db
                                HospitalModels  hphandler = new HospitalModels();
                                List <benhvien> lshp      = hphandler.getAll();
                                benhvien        check_hp  = null;
                                for (int i = 0; i < lshp.Count; i++)
                                {
                                    benhvien hp_in_db = lshp[i];
                                    //System.Diagnostics.Debug.WriteLine(StandString.FinalStandString(hp_in_db.tenbv));
                                    if (StandString.FinalStandString(hp_in_db.tenbv).Contains(StandString.FinalStandString(hp.tenbv)))
                                    {
                                        check_hp = hp_in_db;
                                    }
                                }
                                if (check_hp != null)
                                {
                                    pa.idbv = check_hp.idbv;
                                }
                                else
                                {
                                    HospitalModels hpm = new HospitalModels();
                                    hpm.insert(hp);
                                    pa.idbv = hp.idbv;
                                }
                                pa.idbn      = StandString.generateBNID(8);
                                bes.idbn     = pa.idbn;
                                bes.idbs     = StandString.generateBESID(8);
                                ha.idbs      = bes.idbs;
                                ha.idhuyetap = bes.idbs;
                                //insert to db
                                PatientModels pa_model = new PatientModels();
                                pa_model.create(pa);
                                BenhsuModels bes_model = new BenhsuModels();
                                bes_model.insert(bes);
                                HuyetapModels ha_model = new HuyetapModels();
                                ha_model.insert(ha);
                            }
                            break_firstline++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return(View());
        }