private void PerformAction()
        {
            //if (Utility.AcceptQuestion("Bạn có muốn chuyển bệnh nhân vào Buồng và giường đang chọn không", "Thông báo",
            //    true))
            //{
            var ngaychuyenkhoa = new DateTime(dtNgayChuyen.Value.Year, dtNgayChuyen.Value.Month,
                                              dtNgayChuyen.Value.Day, Utility.Int32Dbnull(txtGio.Text),
                                              Utility.Int32Dbnull(txtPhut.Text), 00);
            objPatientExam =
                new Select().From<KcbLuotkham>()
                    .Where(KcbLuotkham.Columns.MaLuotkham)
                    .IsEqualTo(objPhanbuonggiuong.MaLuotkham)
                    .And(KcbLuotkham.Columns.IdBenhnhan)
                    .IsEqualTo(objPhanbuonggiuong.IdBenhnhan)
                    .ExecuteSingle<KcbLuotkham>();
            if (objPatientExam != null)
            {
                objPhanbuonggiuong.Id = Utility.Int32Dbnull(txtPatientDept_ID.Text);

                objPhanbuonggiuong.NgayVaokhoa = ngaychuyenkhoa;
                objPhanbuonggiuong.IdBuong = Utility.Int16Dbnull(grdBuong.GetValue(NoitruDmucBuong.Columns.IdBuong));
                objPhanbuonggiuong.IdGiuong = Utility.Int16Dbnull(grdGiuong.GetValue(NoitruDmucGiuongbenh.Columns.IdGiuong));
                objPhanbuonggiuong.IdGia = Utility.Int32Dbnull(txtGia.MyID, -1);
                ActionResult actionResult = new noitru_nhapvien().PhanGiuongDieuTri(objPhanbuonggiuong,
                                                                                        objPatientExam,
                                                                                        ngaychuyenkhoa,
                                                                                        Utility.Int16Dbnull(
                                                                                            grdBuong.GetValue(
                                                                                                NoitruDmucBuong.Columns.IdBuong)),
                                                                                        Utility.Int16Dbnull(
                                                                                            grdGiuong.GetValue(
                                                                                                NoitruDmucGiuongbenh.Columns.IdGiuong)));
                switch (actionResult)
                {
                    case ActionResult.Success:
                        txtPatientDept_ID.Text = Utility.sDbnull(objPhanbuonggiuong.Id);
                        Utility.SetMsg(lblMsg, "Bạn chuyển bênh nhân vào giường thành công", true);
                        ProcessChuyenKhoa();
                        b_Cancel = false;
                        Close();

                        break;
                    case ActionResult.Error:
                        Utility.ShowMsg("Lỗi trong quá trình phân buồng giường", "Thông báo", MessageBoxIcon.Error);
                        break;
                }
            }
            //  }
        }
        /// <summary>
        /// hàm thực hiện việc xóa thông tin phần buồng giường
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdHuyphangiuong_Click(object sender, EventArgs e)
        {
            if (!isValidData_Huygiuong()) return;
            if (Utility.AcceptQuestion("Bạn có muốn hủy phần buồng giường cho bệnh nhân đang chọn không?","Thông báo", true))
            {
                int id = Utility.Int32Dbnull(grdList.GetValue(NoitruPhanbuonggiuong.Columns.Id));
                NoitruPhanbuonggiuong objPhanbuonggiuong = NoitruPhanbuonggiuong.FetchByID(id);
                if (objPhanbuonggiuong != null)
                {
                    objPhanbuonggiuong.IdBuong = -1;
                    int IdChuyen = -1;
                    objPhanbuonggiuong.IdGiuong = -1;
                    ActionResult actionResult = new noitru_nhapvien().HuyBenhNhanVaoBuongGuong(objPhanbuonggiuong, ref IdChuyen);
                    switch (actionResult)
                    {
                        case ActionResult.Success:
                            if (IdChuyen > 0)
                            {
                                DataTable dtTemp = SPs.NoitruTimkiembenhnhanTheoid(IdChuyen).GetDataSet().Tables[0];
                                if (dtTemp.Rows.Count > 0)
                                {
                                    DataRow dr = ((DataRowView)grdList.CurrentRow.DataRow).Row;
                                    Utility.CopyData(dtTemp.Rows[0], ref dr);
                                    m_dtTimKiembenhNhan.AcceptChanges();
                                }
                            }
                            else//Xóa dòng hiện tại
                            {
                                ProcessChuyenKhoa(id);
                            }

                            break;
                        case ActionResult.Error:
                            Utility.ShowMsg("Lỗi trong quá trình chuyển khoa", "Thông báo", MessageBoxIcon.Error);
                            break;
                    }
                }
            }
            ModifyCommand();
        }
        private bool IsValidData()
        {
            KcbLuotkham objKcbLuotkham = Utility.getKcbLuotkham(objPhanbuonggiuong.IdBenhnhan,objPhanbuonggiuong.MaLuotkham);
            if (objKcbLuotkham != null && objKcbLuotkham.TrangthaiNoitru<1)
            {
                Utility.ShowMsg("Bệnh nhân này chưa nhập viện nên không được phép phân buồng giường", "Thông báo",
                                MessageBoxIcon.Warning);
                return false;
            }

               if(!Utility.isValidGrid(grdBuong))
            {
                Utility.SetMsg(lblMsg, "Bạn phải chọn Buồng cần chuyển", true);
                txtRoom_code.Focus();
                txtRoom_code.SelectAll();
                return false;
            }

               if (!Utility.isValidGrid(grdGiuong))
               {
               Utility.SetMsg(lblMsg, "Bạn phải chọn giường cần chuyển", true);
               txtBedCode.Focus();
               txtBedCode.SelectAll();
               return false;
               }
               if (lblGiaBG.Visible && Utility.Int32Dbnull(txtGia.MyID, -1) == -1)
               {
               Utility.SetMsg(lblMsg, "Bạn phải chọn giá buồng giường", true);
               txtGia.Focus();
               txtGia.SelectAll();
               return false;
               }
               DataTable dt = new noitru_nhapvien().NoitruKiemtraBuongGiuong(objPhanbuonggiuong.IdKhoanoitru, Utility.Int16Dbnull(grdBuong.GetValue(NoitruDmucGiuongbenh.Columns.IdBuong)), Utility.Int16Dbnull(grdGiuong.GetValue(NoitruDmucGiuongbenh.Columns.IdGiuong)));
               if (dt != null && dt.Rows.Count > 0)
               {
               Utility.SetMsg(lblMsg, string.Format("Giường này đang được nằm bởi bệnh nhân: {0}. Mời bạn chọn giường khác", Utility.sDbnull(dt.Rows[0][KcbDanhsachBenhnhan.Columns.TenBenhnhan])), true);
               txtBedCode.Focus();
               txtBedCode.SelectAll();
               return false;
               }
            return true;
        }
예제 #4
0
 /// <summary>
 /// hàm thực hiện việc hoạt động lưu lại thông tin 
 /// </summary>
 private void PerformAction()
 {
     NoitruPhanbuonggiuong objPhanbuonggiuong = NoitruPhanbuonggiuong.FetchByID(Utility.Int32Dbnull(txtPatientDept_ID.Text));
     if (objPhanbuonggiuong != null)
     {
         if (Utility.AcceptQuestion("Bạn có muốn chuyển Buồng và giường không", "Thông báo", true))
         {
             var ngaychuyenkhoa = new DateTime(dtNgayChuyen.Value.Year, dtNgayChuyen.Value.Month,
                                               dtNgayChuyen.Value.Day, Utility.Int32Dbnull(txtGio.Text),
                                               Utility.Int32Dbnull(txtPhut.Text), 00);
             objPhanbuonggiuong.SoLuong = Utility.Int32Dbnull(Utility.DecimaltoDbnull(txtSoluong.Text));
             objPhanbuonggiuong.SoluongGio = Utility.Int32Dbnull(txtTotalHour.Text);
             objPhanbuonggiuong.CachtinhSoluong = (byte)(chkAutoCal.Checked ? 0 : 1);
             ActionResult actionResult = new noitru_nhapvien().ChuyenGiuongDieuTri(objPhanbuonggiuong,
                                                                                       objLuotkham,
                                                                                       ngaychuyenkhoa,
                                                                                       Utility.Int16Dbnull(
                                                                                           grdBuong.GetValue(NoitruDmucBuong.Columns.IdBuong)),
                                                                                       Utility.Int16Dbnull(
                                                                                           grdGiuong.GetValue(NoitruDmucGiuongbenh.Columns.IdGiuong)), Utility.Int32Dbnull(txtGia.MyID, -1));
             switch (actionResult)
             {
                 case ActionResult.Success:
                     txtPatientDept_ID.Text = Utility.sDbnull(objPhanbuonggiuong.Id);
                     Utility.SetMsg(lblMsg, "Bạn chuyển Buồng thành công", true);
                     // Utility.ShowMsg("Bạn chuyển Buồng thành công", "Thông báo", MessageBoxIcon.Information);
                     if (b_CallParent)
                     {
                         ProcessChuyenKhoa();
                         b_Cancel = false;
                         Close();
                     }
                     else
                     {
                         ClearControl();
                     }
                     break;
                 case ActionResult.Error:
                     Utility.ShowMsg("Lỗi trong quá trình chuyển khoa", "Thông báo", MessageBoxIcon.Error);
                     break;
             }
         }
     }
 }
예제 #5
0
        private bool IsValidData()
        {
            KcbLuotkham objKcbLuotkham = Utility.getKcbLuotkham(Utility.Int64Dbnull(txtPatient_ID.Text), txtMaLanKham.Text);
            if (objKcbLuotkham != null && objKcbLuotkham.TrangthaiNoitru < 1)
            {
                Utility.ShowMsg("Bệnh nhân này chưa nhập viện nên không được phép phân buồng giường", "Thông báo",
                                MessageBoxIcon.Warning);
                txtMaLanKham.Focus();
                txtMaLanKham.SelectAll();
                return false;
            }

            if (!Utility.isValidGrid(grdBuong))
            {
                Utility.ShowMsg("Bạn phải chọn Buồng cần chuyển", "Thông báo", MessageBoxIcon.Warning);
                // cboPhong.Focus();
                txtRoom_code.Focus();
                txtRoom_code.SelectAll();
                return false;
            }

            if (!Utility.isValidGrid(grdGiuong))
            {
                Utility.ShowMsg("Bạn phải chọn giường cần chuyển", "Thông báo", MessageBoxIcon.Warning);
                txtBedCode.Focus();
                txtBedCode.SelectAll();
                // cboGiuong.Focus();
                return false;
            }
            if (Utility.Int32Dbnull(txtGia.MyID, -1) == -1)
            {
                Utility.SetMsg(lblMsg, "Bạn phải chọn giá buồng giường", true);
                txtGia.Focus();
                txtGia.SelectAll();
                return false;
            }
            DataTable dt = new noitru_nhapvien().NoitruKiemtraBuongGiuong((int)objLuotkham.IdKhoanoitru, Utility.Int16Dbnull(grdBuong.GetValue(NoitruDmucGiuongbenh.Columns.IdBuong)), Utility.Int16Dbnull(grdGiuong.GetValue(NoitruDmucGiuongbenh.Columns.IdGiuong)));
            if (dt != null && dt.Rows.Count > 0)
            {
                Utility.SetMsg(lblMsg, string.Format("Giường này đang được nằm bởi bệnh nhân\n{0}\nMời bạn chọn giường khác", Utility.sDbnull(dt.Rows[0][KcbDanhsachBenhnhan.Columns.TenBenhnhan])), true);
                txtBedCode.Focus();
                txtBedCode.SelectAll();
            }
            if (Utility.Int32Dbnull(Utility.DecimaltoDbnull(txtSoluong.Text)) != THU_VIEN_CHUNG.Songay(dtNgayvao.Value, dtNgayChuyen.Value))
            {
                if (!Utility.AcceptQuestion(string.Format("Bạn có chắc chắn số ngày nằm viện trước khi chuyển là {0} thay vì {1}(Hệ thống tự động tính toán) hay không?", txtSoluong.Text, THU_VIEN_CHUNG.Songay(dtNgayvao.Value, dtNgayChuyen.Value).ToString()), "Cảnh báo", true))
                    txtSoluong.Focus();
                txtSoluong.SelectAll();
                return false;
            }

            return true;
        }
예제 #6
0
        private void IN_PHIEU_KHAM_VAO_VIEN()
        {
            DataTable dsTable =
               new noitru_nhapvien().NoitruLaythongtinInphieunhapvien(objLuotkham.MaLuotkham, Utility.Int32Dbnull(objLuotkham.IdBenhnhan));
            if (dsTable.Rows.Count <= 0)
            {
                Utility.ShowMsg("Không tìm thấy bản ghi nào\n Mời bạn xem lại", "Thông báo",MessageBoxIcon.Error);
                return;
            }

            SqlQuery sqlQuery = new Select().From(KcbChandoanKetluan.Schema)
                .Where(KcbChandoanKetluan.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
                .And(KcbChandoanKetluan.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan).OrderAsc(
                    KcbChandoanKetluan.Columns.NgayChandoan);
            var objInfoCollection = sqlQuery.ExecuteAsCollection<KcbChandoanKetluanCollection>();
            string chandoan = "";
            string mabenh = "";
            string phongkhamvaovien = "";
            string khoanoitru = "";
            foreach (KcbChandoanKetluan objDiagInfo in objInfoCollection)
            {
                string ICD_Name = "";
                string ICD_Code = "";
                GetChanDoan(Utility.sDbnull(objDiagInfo.MabenhChinh, ""),
                            Utility.sDbnull(objDiagInfo.MabenhPhu, ""), ref ICD_Name, ref ICD_Code);
                chandoan += string.IsNullOrEmpty(objDiagInfo.Chandoan)
                                ? ICD_Name
                                : Utility.sDbnull(objDiagInfo.Chandoan);
                mabenh += ICD_Code;
            }

            //txtkbMa.Text = Utility.sDbnull(mabenh);

            DataSet ds = new noitru_nhapvien().KcbLaythongtinthuocKetquaCls(objLuotkham.MaLuotkham, Utility.Int32Dbnull(objLuotkham.IdBenhnhan));
            DataTable dtThuoc = ds.Tables[0];
            DataTable dtketqua = ds.Tables[1];

            string[] query = (from thuoc in dtThuoc.AsEnumerable()
                              let y = Utility.sDbnull(thuoc["ten_thuoc"])
                              select y).ToArray();
            string donthuoc = string.Join(";", query);
            string[] querykq = (from kq in dtketqua.AsEnumerable()
                                let y = Utility.sDbnull(kq["ketqua"])
                                select y).ToArray();
            string ketquaCLS = string.Join("; ", querykq);

            //foreach (DataRow dr in dsTable.Rows)
            //{
            DataRow dr = dsTable.Rows[0];
            if (dr != null)
            {
                dr["thuockedon"] = donthuoc;
                dr["CHANDOAN_VAOVIEN"] = chandoan;
                dr["KETQUA_CLS"] = ketquaCLS;
            }

            dsTable.AcceptChanges();
            VNS.HIS.UI.Baocao.noitru_baocao.Inphieunhapvien(dsTable, "PHIẾU NHẬP VIỆN", globalVariables.SysDate);
        }
예제 #7
0
 private void cmdHUY_VAO_VIEN_Click(object sender, EventArgs e)
 {
     try
     {
         Utility.SetMsg(lblMsg, "", false);
         if (!InValiHuyVaoVien()) return;
         if (Utility.AcceptQuestion("Bạn có muốn thực hiện việc hủy nhập viện cho bệnh nhân nội trú không,\n Nếu hủy thì bệnh nhân sẽ trở lại ngoại trú,Thông tin gói dịch vụ nội trú sẽ bị xóa theo ?", "Thông báo", true))
         {
             if (objLuotkham != null)
             {
                 ActionResult actionResult =
               new noitru_nhapvien().Huynhapvien(
              objLuotkham);
                 switch (actionResult)
                 {
                     case ActionResult.Success:
                         objLuotkham.TrangthaiNoitru = 0;
                         objLuotkham.SoBenhAn = string.Empty;
                         objLuotkham.NgayNhapvien = null;
                         objLuotkham.IdKhoanoitru = -1;
                         objLuotkham.MotaNhapvien = "";
                         objLuotkham.IdNhapvien = -1;
                         txtSoBenhAn.Clear();
                         ModifyCommand();
                         Utility.SetMsg(lblMsg, "Bạn hủy nội trú cho bệnh nhân thành công", false);
                         break;
                     case ActionResult.Error:
                         Utility.SetMsg(lblMsg, "Lỗi trong quá trình hủy nội trú cho bệnh nhân", true);
                         break;
                 }
             }
         }
     }
     catch
     { }
     finally
     {
         ModifyCommand();
     }
 }
예제 #8
0
        /// <summary>
        /// hàm thuwchj hiện việc nhập viện không có gói, gói sẽ là nulll cho bệnh nhân
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdAccept_Click(object sender, EventArgs e)
        {
            try
            {
                Utility.SetMsg(lblMsg, "", false);
            bool Question = true;
            if (!isValidData())return;
            if (string.IsNullOrEmpty(Utility.sDbnull(objLuotkham.SoBenhAn, "")))
            {
                txtSoBenhAn.Text = THU_VIEN_CHUNG.LaySoBenhAn();
            }
            else
            {
                txtSoBenhAn.Text = Utility.sDbnull(objLuotkham.SoBenhAn, "");
            }
            //if (Utility.AcceptQuestion("Bạn có muốn nhập viện cho bệnh nhân này không","Thông báo nhập viện",true))
            //{
                objLuotkham.SoBenhAn = Utility.sDbnull(txtSoBenhAn.Text);
                objLuotkham.MotaNhapvien =Utility.DoTrim( txtGhiChu.Text);
                ActionResult actionResult = new noitru_nhapvien().Nhapvien(TaoBuonggiuong(), objLuotkham, null);
                switch (actionResult)
                {
                    case ActionResult.Success:
                        txtSoBenhAn.Text = Utility.sDbnull(objLuotkham.SoBenhAn, "");
                        objLuotkham.IdKhoanoitru =Utility.Int16Dbnull( txtKhoanoitru.MyID,-1);
                        objLuotkham.TrangthaiNoitru = 1;
                        objLuotkham.SoBenhAn = Utility.sDbnull(txtSoBenhAn.Text);
                        objLuotkham.NgayNhapvien = dtNgayNhapVien.Value;
                        objLuotkham.MotaNhapvien =Utility.DoTrim( txtGhiChu.Text);

                        b_Cancel = true;
                        Utility.SetMsg(lblMsg, Utility.sDbnull(cmdAccept.Tag, "0") == "0" ? "Bạn thực hiện nhập viện cho bệnh nhân thành công" : "Bạn thực hiện cập nhật khoa nội trú cho bệnh nhân thành công", false);
                       // this.Close();
                        if (chkInNgaySauKhiNhapVien.Checked)
                        {
                            IN_PHIEU_KHAM_VAO_VIEN();
                        }
                        if (chkThoatngaysaukhinhapvien.Checked) this.Close();
                        break;
                    case ActionResult.Error:
                        Utility.SetMsg(lblMsg, "Lỗi trong quá trình nhập viện ", true);
                        break;
                    case ActionResult.ExistedRecord:
                        Utility.SetMsg(lblMsg, "Bệnh nhân đã thanh toán, Mời bạn xem lại ", true);
                        break;

                }
            //}

            }
            catch
            { }
            finally
            {
                ModifyCommand();
            }
        }