Пример #1
0
        public void txtMaluotkham_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter && Utility.DoTrim(txtMaluotkham.Text) != "")
                {
                    AllowTextChanged = false;
                    var dtPatient = new DataTable();

                        objLuotkham = null;
                        string _patient_Code = Utility.AutoFullPatientCode(txtMaluotkham.Text);
                        ClearControls();

                        dtPatient = new KCB_THAMKHAM().TimkiemBenhnhan(txtMaluotkham.Text,
                                                       -1,(byte)1, 0);

                        DataRow[] arrPatients = dtPatient.Select(KcbLuotkham.Columns.MaLuotkham + "='" + _patient_Code + "'");
                        if (arrPatients.GetLength(0) <= 0)
                        {
                            if (dtPatient.Rows.Count > 1)
                            {
                                var frm = new frm_DSACH_BN_TKIEM();
                                frm.MaLuotkham = txtMaluotkham.Text;
                                frm.dtPatient = dtPatient;
                                frm.ShowDialog();
                                if (!frm.has_Cancel)
                                {
                                    txtMaluotkham.Text = frm.MaLuotkham;
                                }
                            }
                        }
                        else
                        {
                            txtMaluotkham.Text = _patient_Code;
                        }
                        DataTable dt_Patient = new KCB_THAMKHAM().TimkiemThongtinBenhnhansaukhigoMaBN(txtMaluotkham.Text, -1,"ALL");
                        if (dt_Patient != null && dt_Patient.Rows.Count > 0)
                        {

                            txtIdBn.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.IdBenhnhan], "");
                            objLuotkham = new Select().From(KcbLuotkham.Schema).Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(txtIdBn.Text)
                                .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaluotkham.Text)
                                .ExecuteSingle<KcbLuotkham>();
                            dtpNgaynhapvien.Value = objLuotkham.NgayNhapvien.Value;
                            txtTenBN.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.TenBenhnhan], "");
                            txttuoi.Text = Utility.sDbnull(dt_Patient.Rows[0]["Tuoi"], "");
                            txtgioitinh.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.GioiTinh], "");
                            txtDiachi.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.DiaChi], "");
                            txtmatheBhyt.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.MatheBhyt], "");

                            txtKhoanoitru.Text = Utility.sDbnull(dt_Patient.Rows[0]["ten_khoaphong_noitru"], "");
                            txtBuong.Text = Utility.sDbnull(dt_Patient.Rows[0][NoitruDmucBuong.Columns.TenBuong], "");
                            txtGiuong.Text = Utility.sDbnull(dt_Patient.Rows[0][NoitruDmucGiuongbenh.Columns.TenGiuong], "");

                            txtIdkhoanoitru.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdKhoanoitru], "-1");
                            txtIdravien.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdRavien], "-1");
                            txtidBuong.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdBuong], "-1");
                            txtidgiuong.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdGiuong], "-1");
                            cmdChuyen.Enabled = true;
                            if (objLuotkham.TrangthaiNoitru == 0)
                            {
                                Utility.ShowMsg("Bệnh nhân chưa vào nội trú nên không thể lập phiếu ra viện. Đề nghị bạn kiểm tra lại");
                                cmdChuyen.Enabled = false;
                                return;
                            }
                            cmdChuyen.Enabled = objLuotkham != null && objLuotkham.TrangthaiNoitru <= 3;
                            LoadData();
                            dtpNgayravien.Focus();
                        }

                }
            }
            catch (Exception)
            {
                Utility.ShowMsg("Có lỗi trong quá trình lấy thông tin bệnh nhân");
            }
            finally
            {

                AllowTextChanged = true;
            }
        }
Пример #2
0
        void txtMaluotkham_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter && Utility.DoTrim(txtMaluotkham.Text) != "")
                {
                    var dtPatient = new DataTable();

                        objLuotkham = null;
                        string _patient_Code = Utility.AutoFullPatientCode(txtMaluotkham.Text);
                        ClearControls();

                        dtPatient = new KCB_THAMKHAM().TimkiemBenhnhan(txtMaluotkham.Text,
                                                       -1,0, 0);

                        DataRow[] arrPatients = dtPatient.Select(KcbLuotkham.Columns.MaLuotkham + "='" + _patient_Code + "'");
                        if (arrPatients.GetLength(0) <= 0)
                        {
                            if (dtPatient.Rows.Count > 1)
                            {
                                var frm = new frm_DSACH_BN_TKIEM();
                                frm.MaLuotkham = txtMaluotkham.Text;
                                frm.dtPatient = dtPatient;
                                frm.ShowDialog();
                                if (!frm.has_Cancel)
                                {
                                    txtMaluotkham.Text = frm.MaLuotkham;
                                }
                            }
                        }
                        else
                        {
                            txtMaluotkham.Text = _patient_Code;
                        }
                        DataTable dt_Patient = new KCB_THAMKHAM().TimkiemThongtinBenhnhansaukhigoMaBN(txtMaluotkham.Text, -1, globalVariables.MA_KHOA_THIEN);
                        if (dt_Patient != null && dt_Patient.Rows.Count > 0)
                        {

                            txtIdBn.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.IdBenhnhan], "");
                            objLuotkham = new Select().From(KcbLuotkham.Schema).Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(txtIdBn.Text)
                                .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaluotkham.Text)
                                .ExecuteSingle<KcbLuotkham>();
                            txtTenBN.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.TenBenhnhan], "");
                            txttuoi.Text = Utility.sDbnull(dt_Patient.Rows[0]["Tuoi"], "");
                            txtgioitinh.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.GioiTinh], "");
                            txtDiaChi.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.DiaChi], "");
                            txtmatheBhyt.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.MatheBhyt], "");

                            txtKhoanoitru.Text = Utility.sDbnull(dt_Patient.Rows[0]["ten_khoaphong_noitru"], "");
                            txtBuong.Text = Utility.sDbnull(dt_Patient.Rows[0][NoitruDmucBuong.Columns.TenBuong], "");
                            txtGiuong.Text = Utility.sDbnull(dt_Patient.Rows[0][NoitruDmucGiuongbenh.Columns.TenGiuong], "");

                            txtIdkhoanoitru.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdKhoanoitru], "-1");
                            txtIdravien.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdRavien], "-1");
                            txtidBuong.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdBuong], "-1");
                            txtidgiuong.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdGiuong], "-1");

                            objPhieuchuyenvien = new Select().From(KcbPhieuchuyenvien.Schema)
                               .Where(KcbPhieuchuyenvien.Columns.IdBenhnhan).IsEqualTo(txtIdBn.Text)
                               .And(KcbPhieuchuyenvien.Columns.MaLuotkham).IsEqualTo(txtMaluotkham.Text)
                               .ExecuteSingle<KcbPhieuchuyenvien>();
                            if (objPhieuchuyenvien != null)
                            {
                                txtId.Text = objPhieuchuyenvien.IdPhieu.ToString();
                                txtNoichuyenden.SetId(objPhieuchuyenvien.IdBenhvienChuyenden);
                                txtdauhieucls._Text = objPhieuchuyenvien.DauhieuCls;
                                txtketquaCls.Text = objPhieuchuyenvien.KetquaXnCls;
                                txtChandoan.Text = objPhieuchuyenvien.ChanDoan;
                                txtThuocsudung.Text = objPhieuchuyenvien.ThuocSudung;
                                txtTrangthainguoibenh._Text = objPhieuchuyenvien.TrangthaiBenhnhan;
                                txtHuongdieutri._Text = objPhieuchuyenvien.HuongDieutri;
                                txtphuongtienvc._Text = objPhieuchuyenvien.PhuongtienChuyen;
                                txtNguoivanchuyen.Text = objPhieuchuyenvien.TenNguoichuyen;
                                cboDoctorAssign.SelectedIndex = Utility.GetSelectedIndex(cboDoctorAssign,Utility.sDbnull( objPhieuchuyenvien.IdBacsiChuyenvien,"-1"));
                                cmdPrint.Enabled = true;
                                cmdHuy.Enabled = true;
                            }
                            else
                            {
                                cmdPrint.Enabled = false;
                                cmdHuy.Enabled = false;
                            }
                            m_enAct = objPhieuchuyenvien == null ? action.Insert : action.Update;
                            if (m_enAct == action.Insert)
                                cmdPrint.Enabled = false;
                            else
                                cmdPrint.Enabled = true;
                            dtNgaychuyenvien.Focus();
                        }

                }
            }
            catch (Exception)
            {
                Utility.ShowMsg("Có lỗi trong quá trình lấy thông tin bệnh nhân");
            }
            finally
            {

                AllowTextChanged = true;
            }
        }