Пример #1
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            SqlQuery sqlQuery = new Select().From(SysManagementUnit.Schema)
                .Where(SysManagementUnit.Columns.PkSBranchID).IsEqualTo("LIS");

            if (sqlQuery.GetRecordCount() <= 0)
            {
                //LDonVi.Insert("LIS", txtDonViCapTren.Text, txtDonVi.Text, txtDiaChi.Text, txtDienThoai.Text);
                SysManagementUnit objSysManagementUnit = new SysManagementUnit();
                objSysManagementUnit.PkSBranchID = "LIS";
                objSysManagementUnit.SName = txtDonVi.Text;
                objSysManagementUnit.SParentBranchName = txtDonViCapTren.Text;
                objSysManagementUnit.SAddress = txtDiaChi.Text;
                objSysManagementUnit.SPhone = txtDienThoai.Text;
                objSysManagementUnit.IsNew = true;
                objSysManagementUnit.Save();
            }
            else
            {

                SysManagementUnit objSysManagementUnit = new SysManagementUnit();
                objSysManagementUnit.MarkOld();
                objSysManagementUnit.IsLoaded = true;
                objSysManagementUnit.PkSBranchID = "LIS";
                objSysManagementUnit.SName = txtDonVi.Text;
                objSysManagementUnit.SParentBranchName = txtDonViCapTren.Text;
                objSysManagementUnit.SAddress = txtDiaChi.Text;
                objSysManagementUnit.SPhone = txtDienThoai.Text;
               // objSysManagementUnit.IsNew = true;
                objSysManagementUnit.Save();
            }
            Utility.ShowMsg("Bạn thực hiện lưu thành công","Thông báo");
        }
        private void cmdSave_Click(object sender, EventArgs e)
        {
            SqlQuery q = new Select().From(SysUserPrinter.Schema)
                .Where(SysUserPrinter.Columns.SysUserName).IsEqualTo(globalVariables.UserName);
            if(q.GetRecordCount()<=0)
            {
                new SysUserPrinterController().Insert(globalVariables.UserName, txtQuantity.Value,
                                                      Utility.sDbnull(cboListPrint.Text, ""), txtKetoan.Text,
                                                      txtLapBangKe.Text, txtGiamdinhbaohiem.Text,
                                                      txtDaidienkhamchuabenh.Text);

            }else
            {
                new Update(SysUserPrinter.Schema)
                    .Set(SysUserPrinter.Columns.PrinterName).EqualTo(cboListPrint.Text)
                    .Set(SysUserPrinter.Columns.CreatedBy).EqualTo(txtLapBangKe.Text)
                    .Set(SysUserPrinter.Columns.AccountName).EqualTo(txtKetoan.Text)
                    .Set(SysUserPrinter.Columns.InsuranceBy).EqualTo(txtGiamdinhbaohiem.Text)
                    .Set(SysUserPrinter.Columns.HospitalBy).EqualTo(txtDaidienkhamchuabenh.Text)
                    .Set(SysUserPrinter.Columns.PagerCopy).EqualTo(Utility.Int32Dbnull(txtQuantity.Text, 1))
                    .Where(SysUserPrinter.Columns.SysUserName).IsEqualTo(globalVariables.UserName).Execute();
            }
            Utility.ShowMsg("Bạn cập nhập thông tin thành công","Thông báo");
            this.Close();
        }
Пример #3
0
 public bool CheckExistUserPass(string UserName,string Password)
 {
     SqlQuery sqlQuery = new Select().From(SysUser.Schema)
     .Where(SysUser.Columns.PkSuid).IsEqualTo(globalVariables.UserName)
     .And(SysUser.Columns.SPwd).IsEqualTo(objEncrypt.Mahoa(Password));
        if (sqlQuery.GetRecordCount() <= 0) return false;
        else return true;
 }
Пример #4
0
        private void BindData()
        {
            SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema)
                .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaLanKham.Text);
            if (sqlQuery.GetRecordCount() > 0)
            {
                objLuotkham = sqlQuery.ExecuteSingle<KcbLuotkham>();
                if (objLuotkham != null)
                {
                    txtMaLanKham.Text = Utility.sDbnull(objLuotkham.MaLuotkham);
                    txtSoBHYT.Text = Utility.sDbnull(objLuotkham.MatheBhyt);
                    DmucKhoaphong objLDepartment = DmucKhoaphong.FetchByID(objLuotkham.IdKhoanoitru);
                    if (objLDepartment != null)
                    {
                        txtDepartment_ID.Text = Utility.sDbnull(objLDepartment.IdKhoaphong);
                        txtDepartmentName.Tag = Utility.sDbnull(objLDepartment.IdKhoaphong);
                        txtDepartmentName.Text = Utility.sDbnull(objLDepartment.TenKhoaphong);
                    }
                    KcbDanhsachBenhnhan objPatientInfo = KcbDanhsachBenhnhan.FetchByID(objLuotkham.IdBenhnhan);
                    if (objPatientInfo != null)
                    {
                        txtPatient_Name.Text = Utility.sDbnull(objPatientInfo.TenBenhnhan);
                        txtPatient_ID.Text = Utility.sDbnull(objLuotkham.IdBenhnhan);
                        txtNamSinh.Text = Utility.sDbnull(objPatientInfo.NamSinh);
                        txtTuoi.Text = Utility.sDbnull(DateTime.Now.Year - objPatientInfo.NamSinh);
                        txtPatientSex.Text =objPatientInfo.GioiTinh;// Utility.Int32Dbnull(objPatientInfo.) == 0 ? "Nam" : "Nữ";
                    }
                    NoitruPhanbuonggiuong objPhanbuonggiuong = noitru_nhapvien.LaythongtinBuonggiuongHtai(objLuotkham);
                    if (objPhanbuonggiuong != null)
                    {
                        dtNgayvao.Value = objPhanbuonggiuong.NgayVaokhoa;
                        txtPatientDept_ID.Text = Utility.sDbnull(objPhanbuonggiuong.Id);
                        NoitruDmucBuong objRoom = NoitruDmucBuong.FetchByID(objPhanbuonggiuong.IdBuong);
                        if (objRoom != null)
                        {
                            txtSoPhong.Text = Utility.sDbnull(objRoom.TenBuong);
                            txtSoPhong.Tag = Utility.sDbnull(objPhanbuonggiuong.IdBuong);
                        }
                        NoitruDmucGiuongbenh objNoitruDmucGiuongbenh = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong);
                        if (objNoitruDmucGiuongbenh != null)
                        {
                            txtSoGiuong.Text = Utility.sDbnull(objNoitruDmucGiuongbenh.TenGiuong);
                            txtSoGiuong.Tag = Utility.sDbnull(objPhanbuonggiuong.IdGiuong);
                        }
                    }
                    DataTable dtGia = new dmucgiagiuong_busrule().dsGetList("-1").Tables[0];
                    dtGia.DefaultView.Sort = NoitruGiabuonggiuong.Columns.SttHthi + "," + NoitruGiabuonggiuong.Columns.TenGia;
                    txtGia.Init(dtGia, new System.Collections.Generic.List<string>() { NoitruGiabuonggiuong.Columns.IdGia, NoitruGiabuonggiuong.Columns.MaGia, NoitruGiabuonggiuong.Columns.TenGia });

                    m_dtDataRoom = THU_VIEN_CHUNG.NoitruTimkiembuongTheokhoa(Utility.Int32Dbnull(txtDepartment_ID.Text));
                    Utility.SetDataSourceForDataGridEx_Basic(grdBuong, m_dtDataRoom, true, true, "1=1", "sluong_giuong_trong desc,ten_buong");
                    if (grdBuong.DataSource != null)
                    {
                        grdBuong.MoveFirst();
                    }
                }
            }
        }
Пример #5
0
        public ActionResult AddNewPatientExam(KcbDanhsachBenhnhan objPatientInfo, KcbLuotkham objLuotkham, KcbDangkyKcb objRegExam, int KieuKham)
        {
            try
            {
                using (var scope = new TransactionScope())
                {
                    using (var dbscope = new SharedDbConnectionScope())
                    {
                        UpdatePatientInfo(objPatientInfo);
                        SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema)
                           .Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan)
                           .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham);
                        if (sqlQueryPatientExam.GetRecordCount() > 0)//Nếu BN khác đã lấy mã này
                        {

                            objLuotkham.MaLuotkham = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM();

                        }
                        objLuotkham.IsNew = true;
                        objLuotkham.Save();
                        if (objLuotkham.TrangthaiNoitru >= 1)
                        {
                            SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema).Where(
                                KcbLuotkham.Columns.MaLuotkham).IsNotEqualTo(objLuotkham.MaLuotkham)
                                .And(KcbLuotkham.Columns.SoBenhAn).IsEqualTo(objLuotkham.SoBenhAn)
                                .And(KcbLuotkham.Columns.TrangthaiNoitru).IsGreaterThanOrEqualTo(1);

                            if (sqlQuery.GetRecordCount() > 0)
                            {
                                var query = new Update(KcbLuotkham.Schema)
                                     .Set(KcbLuotkham.Columns.SoBenhAn).EqualTo(THU_VIEN_CHUNG.LaySoBenhAn())
                                     .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham).
                                     Execute();
                            }

                        }
                        if (objRegExam != null)
                        {
                            objRegExam.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham);
                            objRegExam.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan);
                            AddRegExam(objRegExam,objLuotkham, false, KieuKham);
                        }
                        scope.Complete();
                        return ActionResult.Success;
                    }
                }
            }
            catch (Exception ex)
            {
                return ActionResult.Error;
            }
        }
Пример #6
0
       /// <summary>
       /// ham thực hiện việc thêm mới thông tni bệnh nhân
       /// </summary>
       /// <param name="objBenhNhan"></param>
       /// <param name="objKhamBnhan"></param>
       /// <returns></returns>
       public ActionResult ThemMoiBenhNhan(RisBenhNhan objBenhNhan,ref int IDBenhNhan,ref string PID)
       {
           Query _Query = RisBenhNhan.CreateQuery();
           Query _QueryPhieu = RisPhieuCdinh.CreateQuery();
           try
           {
               using (var scope = new TransactionScope())
               {
                   using (var sh = new SharedDbConnectionScope())
                   {
                       objBenhNhan.IsNew = true;
                       objBenhNhan.Save();
                       objBenhNhan.IdBnhan = Utility.Int32Dbnull(_Query.GetMax(RisBenhNhan.Columns.IdBnhan), -1);
                       log.Info("Them thong tin benh nhan cua ris voi ID_BenhNhan=" + objBenhNhan.IdBnhan);
                       SqlQuery sqlQuery = new Select().From(RisBenhNhan.Schema)
                           .Where(RisBenhNhan.Columns.IdBnhan).IsNotEqualTo(objBenhNhan.IdBnhan)
                           .And(RisBenhNhan.Columns.Pid).IsEqualTo(objBenhNhan.Pid);
                       log.Info(
                           "Kiem tra thong tin xem benh nhan voi PID da co chua, neu chua co thi commit, neu co rui thi thuc hien sinh lai");

                       if(sqlQuery.GetRecordCount()>0)
                       {
                           objBenhNhan.Pid = VietBaIT.CommonLibrary.CommonBusiness.SinhPID();
                           log.Info("Neu ton tai PID thi cap nhap lai PID voi ma moi nhat PID=" + objBenhNhan.Pid);
                        
                           new Update(RisBenhNhan.Schema)
                               .Set(RisBenhNhan.Columns.Pid).EqualTo(objBenhNhan.Pid)
                               .Where(RisBenhNhan.Columns.IdBnhan).IsEqualTo(objBenhNhan.IdBnhan).Execute();

                       }
                   }
                   log.Info("Hoan thanh viec them moi benh nhan");
                   scope.Complete();
                   IDBenhNhan = objBenhNhan.IdBnhan;
                   PID = objBenhNhan.Pid;
                   return ActionResult.Success;
               }
           }
           catch (Exception exception)
           {
               log.Error("Loi trong qua trinh them moi benh nhan {0}", exception.ToString());
               VietBaIT.CommonLibrary.ErrorLog.InsertErrorlog(exception.ToString(),
                                                             Assembly.GetExecutingAssembly().GetName().Name,
                                                             Assembly.GetExecutingAssembly().FullName);
               return ActionResult.Error;

           }
           
       }
Пример #7
0
        /// <summary>
        /// xóa thông tin của ban ghi đang chọn
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if(grdInsClinic.CurrentRow!=null&&grdInsClinic.CurrentRow.RowType==RowType.Record)
            {
                 string sClinicCode = Utility.sDbnull(grdInsClinic.GetValue(DmucNoiKCBBD.Columns.MaKcbbd),"");
                 string sClinicName = Utility.sDbnull(grdInsClinic.GetValue(DmucNoiKCBBD.Columns.TenKcbbd), "");
                SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema).Where(KcbLuotkham.Columns.MaKcbbd)
                    .IsEqualTo(sClinicCode);
                if(sqlQuery.GetRecordCount()>0)
                {
                    string strQuestion =
                        string.Format("Hiện tại {0} đã được dùng trong phần thông tin bệnh nhân,Bạn không thể xóa",
                                      sClinicName);

                    Utility.ShowMsg(strQuestion,"Thông báo",MessageBoxIcon.Warning);
                    grdInsClinic.Focus();
                    return;
                }
            if (Utility.AcceptQuestion("Bạn có muốn xóa thông tin đang chọn hay không", "Thông báo", true))
            {
                int record = new Delete().From(DmucNoiKCBBD.Schema)
                    .Where(DmucNoiKCBBD.Columns.IdKcbbd).IsEqualTo(v_ClinicID).Execute();

                if (record > 0)
                {
                    grdInsClinic.CurrentRow.Delete();
                    grdInsClinic.UpdateData();
                    grdInsClinic.Refresh();
                    Utility.ShowMsg("Bạn xóa thông tin bệnh đang chọn thành công", "Thông báo");
                }
                else
                {
                    Utility.ShowMsg("Có lỗi trong khi xóa thông tin bệnh", "Thông báo");
                }
            }
            }
        }
Пример #8
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (grdPhongBan.RowCount <= 0)
            {
                Utility.ShowMsg("Hiện chưa có bản ghi nào chọn", "Thông báo");
                grdPhongBan.Focus();
                return;
            }
            v_Department_id = Utility.Int32Dbnull(grdPhongBan.CurrentRow.Cells[DmucKhoaphong.Columns.IdKhoaphong].Value, -1);
            SqlQuery q = new Select().From(KcbDangkyKcb.Schema)
                .Where(KcbDangkyKcb.Columns.IdKhoakcb).IsEqualTo(v_Department_id)
                .Or(KcbDangkyKcb.Columns.IdCha).IsEqualTo(v_Department_id)
                .Or(KcbDangkyKcb.Columns.IdPhongkham).IsEqualTo(v_Department_id);
            if (q.GetRecordCount() > 0)
            {

                Utility.ShowMsg("Khoa phòng này đã sử dụng nên không thể xóa", "Thông báo");
                grdPhongBan.Focus();
                return;

            }
            if (grdPhongBan.CurrentRow != null)
            {
                if (Utility.AcceptQuestion("Bạn có muốn xoá bản ghi này không", "Thông bảo", true))
                {
                    DmucKhoaphong.Delete(DmucKhoaphong.Columns.IdKhoaphong, v_Department_id);
                    DataRow[] array = dsTable.Select(DmucKhoaphong.Columns.IdKhoaphong+ "=" + v_Department_id);
                    if (array.GetLength(0) > 0)
                    {
                        array[0].Delete();
                        dsTable.AcceptChanges();
                    }
                }

                ModifyCommand();
            }
        }
 private bool IsValidDeleteData()
 {
     string v_MaLuotkham =
       Utility.sDbnull(
         grdList.GetValue(KcbLuotkham.Columns.MaLuotkham),
           "");
        int v_Patient_ID =
         Utility.Int32Dbnull(grdList.GetValue(KcbLuotkham.Columns.IdBenhnhan), -1);
        if (objLuotkham != null)
        {
        if (objLuotkham.TrangthaiNgoaitru > 0)
        {
            Utility.ShowMsg("Bệnh nhân đang chọn đã thực hiện khám ngoại trú nên bạn không được phép xóa");
            return false;
        }
        if (objLuotkham.TrangthaiNoitru > 0)
        {
            Utility.ShowMsg("Bệnh nhân đang chọn đã nhập viện nội trú nên bạn không được phép xóa");
            return false;
        }
        }
     SqlQuery sqlQuery = new Select().From(KcbDangkyKcb.Schema)
         .Where(KcbDangkyKcb.Columns.MaLuotkham).IsEqualTo(v_MaLuotkham)
         .And(KcbDangkyKcb.Columns.IdBenhnhan).IsEqualTo(v_Patient_ID)
         .And(KcbDangkyKcb.Columns.TrangthaiThanhtoan).IsEqualTo(1);
     if(sqlQuery.GetRecordCount()>0)
     {
         Utility.ShowMsg("Bản ghi trong đăng ký khám đã thanh toán, Bạn không xóa được");
         return false;
     }
     sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema)
         .Where(KcbChidinhclsChitiet.Columns.IdChidinh).In(
             new Select(KcbChidinhcl.Columns.IdChidinh).From(KcbChidinhcl.Schema).Where(
                 KcbChidinhcl.Columns.MaLuotkham).IsEqualTo(v_MaLuotkham).And(KcbChidinhcl.Columns.IdBenhnhan).
                 IsEqualTo(v_Patient_ID))
         .And(KcbChidinhclsChitiet.Columns.TrangthaiThanhtoan).IsEqualTo(1);
     if (sqlQuery.GetRecordCount() > 0)
     {
         Utility.ShowMsg("Bạn không thể xóa bệnh nhân trên vì bệnh nhân đã thanh toán một số dịch vụ cận lâm sàng", "Thông báo");
         return false;
     }
     sqlQuery = new Select().From(KcbDonthuoc.Schema)
         .Where(KcbDonthuoc.Columns.MaLuotkham).IsEqualTo(v_MaLuotkham).And(KcbDonthuoc.Columns.IdBenhnhan).
                 IsEqualTo(v_Patient_ID)
         .And(KcbDonthuoc.Columns.TrangthaiThanhtoan).IsEqualTo(1);
     if (sqlQuery.GetRecordCount() > 0)
     {
         Utility.ShowMsg("Bạn không thể xóa bệnh nhân trên vì bệnh nhân đã có đơn thuốc được thanh toán", "Thông báo");
         return false;
     }
     sqlQuery = new Select().From(KcbThanhtoan.Schema)
         .Where(KcbThanhtoan.Columns.MaLuotkham).IsEqualTo(v_MaLuotkham)
         .And(KcbThanhtoan.Columns.IdBenhnhan).IsEqualTo(v_Patient_ID);
     if(sqlQuery.GetRecordCount()>0)
     {
         Utility.ShowMsg("Bệnh nhân đã có hóa đơn. Mời bạn qua hủy hóa đơn trước khi thực hiện xóa bệnh nhân", "Thông báo");
         return false;
     }
     return true;
 }
Пример #10
0
        private bool InValiAssign()
        {
            bool b_Cancel = false;
            if (grdAssignDetail.GetCheckedRows().Length <= 0)
            {
                Utility.ShowMsg("Bạn phải chọn một bản ghi thực hiện xóa chỉ định CLS", "Thông báo",
                                MessageBoxIcon.Warning);
                grdAssignDetail.Focus();
                return false;
            }
            foreach (GridEXRow gridExRow in grdAssignDetail.GetCheckedRows())
            {
                int AssignDetail_ID =
                    Utility.Int32Dbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.IdChitietchidinh].Value, -1);
                SqlQuery sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema)
                    .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(AssignDetail_ID)
                    .And(KcbChidinhclsChitiet.Columns.NguoiTao).IsNotEqualTo(globalVariables.UserName);
                if (sqlQuery.GetRecordCount() > 0)
                {
                    Utility.ShowMsg("Trong các chỉ định bạn chọn xóa, có một số chỉ định được kê bởi Bác sĩ khác nên bạn không được phép xóa. Mời bạn chọn lại chỉ các chỉ định do chính bạn kê để thực hiện xóa");
                    return false;
                    break;
                }
            }
            foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdAssignDetail.GetCheckedRows())
            {
                int AssignDetail_ID = Utility.Int32Dbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.IdChitietchidinh].Value,
                                                          -1);
                SqlQuery sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema)
                    .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(AssignDetail_ID)
                    .And(KcbChidinhclsChitiet.Columns.TrangthaiThanhtoan).IsEqualTo(1);
                if (sqlQuery.GetRecordCount() > 0)
                {
                    b_Cancel = true;
                    break;
                }
            }
            if (b_Cancel)
            {
                Utility.ShowMsg("Chỉ định bạn chọn đã được thanh toán nên bạn không thể xóa. Đề nghị kiểm tra lại");
                return false;

            }
            foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdAssignDetail.GetCheckedRows())
            {
                int AssignDetail_ID = Utility.Int32Dbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.IdChitietchidinh].Value, -1);
                SqlQuery sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema)
                    .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(AssignDetail_ID)
                    .And(KcbChidinhclsChitiet.Columns.TrangThai).IsGreaterThanOrEqualTo(1);
                if (sqlQuery.GetRecordCount() > 0)
                {
                    b_Cancel = true;
                    break;
                }
            }
            if (b_Cancel)
            {
                Utility.ShowMsg("Chỉ định bạn chọn đã được chuyển làm cận lâm sàng hoặc đã có kết quả nên không thể xóa. Đề nghị kiểm tra lại");
                return false;
            }
            return true;
        }
Пример #11
0
 private bool InValiUpdateChiDinh()
 {
     int Assign_ID = Utility.Int32Dbnull(grdAssignDetail.GetValue(KcbChidinhclsChitiet.Columns.IdChidinh), "-1");
     SqlQuery sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema)
         .Where(KcbChidinhclsChitiet.Columns.IdChidinh).IsEqualTo(Assign_ID)
         .And(KcbChidinhclsChitiet.Columns.TrangthaiThanhtoan).IsGreaterThanOrEqualTo(1);
     if (sqlQuery.GetRecordCount() > 0)
     {
         Utility.ShowMsg("Phiếu chỉ định này đã thanh toán, Bạn không được phép sửa(Có thể liên hệ với Quầy thanh toán để hủy thanh toán trước khi sửa lại)", "Thông báo");
         cmdThemChiDinh.Focus();
         return false;
     }
     return true;
 }
        private void KiemTraDaInPhoiBHYT()
        {
            try
            {

                SqlQuery sqlQuery = new Select().From(KcbPhieuDct.Schema)
                    .Where(KcbPhieuDct.Columns.MaLuotkham).IsEqualTo(Utility.sDbnull(txtPatient_Code.Text))
                    .And(KcbPhieuDct.Columns.IdBenhnhan).IsEqualTo(Utility.Int32Dbnull(txtPatient_ID.Text))
                    .And(KcbPhieuDct.Columns.LoaiThanhtoan).IsEqualTo(Utility.Int32Dbnull(KieuThanhToan.NgoaiTru));
                if (sqlQuery.GetRecordCount() > 0)
                {
                    pnlSuangayinphoi.Visible = true;
                    var objPhieuDct = sqlQuery.ExecuteSingle<KcbPhieuDct>();
                    if (objPhieuDct != null)
                    {
                        dtNgayInPhoi.Value = Convert.ToDateTime(objPhieuDct.NgayTao);
                        cmdHuyInPhoiBHYT.Enabled = true;
                        cmdCapnhatngayinphoiBHYT.Enabled = true;
                        lblMessage.Visible = true;
                        lblMessage.BackColor = getColorMessage;
                        Utility.SetMsg(lblMessage,
                            string.Format("Đã in phôi bởi {0}, vào lúc: {1}", objPhieuDct.NguoiTao,
                                objPhieuDct.NgayTao), false);
                    }
                }
                else
                {
                    pnlSuangayinphoi.Visible = false;
                    dtNgayInPhoi.Value = globalVariables.SysDate;
                    cmdHuyInPhoiBHYT.Enabled = false;
                    dtNgayInPhoi.Enabled = true;
                    cmdCapnhatngayinphoiBHYT.Enabled = false;
                    if (Utility.sDbnull(txtObjectType_Code.Text) == "BHYT")
                    {
                        lblMessage.Visible = true;
                        Utility.SetMsg(lblMessage, string.Format("Bệnh nhân chưa in phôi bảo hiểm y tế"), true);
                        //lblMessage.BackColor = Color.Red;
                    }
                    else
                    {
                        lblMessage.Visible = false;
                    }
                }
            }
            catch
            {
            }
        }
        private void cmdCapnhatngayBHYT_Click(object sender, EventArgs e)
        {
            SqlQuery sqlQuery = new Select().From<KcbLuotkham>()
                .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(Utility.Int32Dbnull(txtPatient_ID.Text))
                .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtPatient_Code.Text)
                .And(KcbLuotkham.Columns.MaDoituongKcb).IsEqualTo("BHYT");
            if (sqlQuery.GetRecordCount() <= 0)
            {
                Utility.ShowMsg(
                    "Bệnh nhân không phải là bảo hiểm, Không thể chính sửa được ngày hết hạn thẻ bảo hiểm\n Mời bạn xem lại",
                    "Thông báo", MessageBoxIcon.Warning);

                return;
            }
            if (dtpBHYTFfromDate.Value > dtpBHYTToDate.Value)
            {
                Utility.ShowMsg("Ngày hết hạn nhỏ hơn ngày bắt đầu của thẻ BHYT\n Mời bạn xem lại", "Thông báo",
                    MessageBoxIcon.Warning);
                dtpBHYTFfromDate.Focus();
                return;
            }
            if (dtpBHYTToDate.Value < globalVariables.SysDate)
            {
                Utility.ShowMsg("Ngày hết hạn đã hết hạn, nhỏ hơn ngày hiện tại \n Mời bạn xem lại", "Thông báo",
                    MessageBoxIcon.Warning);
                dtpBHYTToDate.Focus();
                return;
            }
            if (Utility.AcceptQuestion("Bạn có muốn update thông tin ngày thẻ bảo hiểm y tế không", "Thông báo", true))
            {
                new Update(KcbLuotkham.Schema)
                    //.Set(KcbLuotkham.Columns.IpMacSua).EqualTo(globalVariables.IpMacAddress)
                    //.Set(KcbLuotkham.Columns.IpMaySua).EqualTo(globalVariables.IpAddress)
                    .Set(KcbLuotkham.Columns.NguoiSua).EqualTo(globalVariables.UserName)
                    .Set(KcbLuotkham.Columns.NgaySua).EqualTo(globalVariables.SysDate)
                    .Set(KcbLuotkham.Columns.NgaybatdauBhyt).EqualTo(dtpBHYTFfromDate.Value)
                    .Set(KcbLuotkham.Columns.NgayketthucBhyt).EqualTo(dtpBHYTToDate.Value)
                    .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtPatient_Code.Text)
                    .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(Utility.Int32Dbnull(txtPatient_ID.Text)).Execute();
            }
        }
 private bool InValiUpdateXoa()
 {
     int IdPhieu = Utility.Int32Dbnull(grdList.GetValue(TPhieuNhapxuatthuoc.Columns.IdPhieu), -1);
     SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuoc.Schema)
         .Where(TPhieuNhapxuatthuoc.Columns.TrangThai).IsEqualTo(1)
         .And(TPhieuNhapxuatthuoc.Columns.IdPhieu).IsEqualTo(IdPhieu);
     if (sqlQuery.GetRecordCount() > 0)
     {
         Utility.ShowMsg("Phiếu trả đã được xác nhận, Bạn không thể sửa hoặc xóa thông tin", "Thông báo", MessageBoxIcon.Warning);
         return false;
     }
     return true;
 }
        /// <summary>
        ///     hàm thực hiện hủy thông tin đã thanh toán
        /// </summary>
        /// <returns></returns>
        private bool InValiHuy()
        {
            if (grdThongTinDaThanhToan.GetCheckedRows().Length <= 0)
            {
                Utility.ShowMsg("Bạn chọn bản ghi thực hiện hủy thông tin ", "Thông báo", MessageBoxIcon.Warning);
                grdThongTinDaThanhToan.Focus();
                return false;
            }
            foreach (GridEXRow gridExRow in grdThongTinDaThanhToan.GetCheckedRows())
            {
                int ID_Detail = Utility.Int32Dbnull(gridExRow.Cells[KcbThanhtoanChitiet.Columns.IdPhieuChitiet].Value);
                switch (Utility.Int32Dbnull(gridExRow.Cells[KcbThanhtoanChitiet.Columns.IdLoaithanhtoan].Value))
                {
                    case 1:
                        SqlQuery sqlQuery = new Select().From(KcbDangkyKcb.Schema)
                            .Where(KcbDangkyKcb.Columns.IdKham).IsEqualTo(ID_Detail)
                            .And(KcbDangkyKcb.Columns.TrangThai).IsEqualTo(1);
                        if (sqlQuery.GetRecordCount() > 0)
                        {
                            Utility.ShowMsg(
                                "Bản ghi khám đã thực hiện,Bạn không thể hủy, Mời bạn xem lại\n Mời bạn chọn những bản ghi chưa thực hiện",
                                "Thông báo", MessageBoxIcon.Warning);
                            grdThongTinDaThanhToan.Focus();
                            return false;
                        }
                        sqlQuery = new Select().From(KcbDangkyKcb.Schema)
                            .Where(KcbDangkyKcb.Columns.IdKham).IsEqualTo(ID_Detail)
                            .And(KcbDangkyKcb.Columns.TrangthaiHuy).IsEqualTo(1);
                        if (sqlQuery.GetRecordCount() > 0)
                        {
                            Utility.ShowMsg(
                                "Bản ghi khám đã hủy,Bạn không thể hủy, Mời bạn xem lại\n Mời bạn chọn những bản ghi chưa hủy thông tin",
                                "Thông báo", MessageBoxIcon.Warning);
                            grdThongTinDaThanhToan.Focus();
                            return false;
                        }
                        break;
                    case 2:
                        sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema)
                            .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(ID_Detail)
                            .And(KcbChidinhclsChitiet.Columns.TrangThai).IsGreaterThanOrEqualTo(1);
                        if (sqlQuery.GetRecordCount() > 0)
                        {
                            Utility.ShowMsg(
                                "Bản ghi cận lâm sàng đã thực hiện,Bạn không thể hủy, Mời bạn xem lại \n  Mời bạn chọn những bản ghi chưa thực hiện",
                                "Thông báo", MessageBoxIcon.Warning);
                            grdThongTinDaThanhToan.Focus();
                            return false;
                        }
                        sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema)
                            .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(ID_Detail)
                            .And(KcbChidinhclsChitiet.Columns.TrangthaiHuy).IsEqualTo(1);
                        if (sqlQuery.GetRecordCount() > 0)
                        {
                            Utility.ShowMsg(
                                "Bản ghi cận lâm sàng đã hủy,Bạn không thể hủy, Mời bạn xem lại \n  Mời bạn chọn những bản ghi chưa hủy thông tin",
                                "Thông báo", MessageBoxIcon.Warning);
                            grdThongTinDaThanhToan.Focus();
                            return false;
                        }
                        break;
                    case 3:
                        sqlQuery = new Select().From(KcbDonthuocChitiet.Schema)
                            .Where(KcbDonthuocChitiet.Columns.IdChitietdonthuoc).IsEqualTo(ID_Detail)
                            .And(KcbDonthuocChitiet.Columns.TrangThai).IsGreaterThanOrEqualTo(1);
                        if (sqlQuery.GetRecordCount() > 0)
                        {
                            Utility.ShowMsg(
                                "Bản ghi thuốc đã thực hiện,Bạn không thể hủy, Mời bạn xem lại \n  Mời bạn chọn những bản ghi chưa thực hiện",
                                "Thông báo", MessageBoxIcon.Warning);
                            grdThongTinDaThanhToan.Focus();
                            return false;
                        }
                        sqlQuery = new Select().From(KcbDonthuocChitiet.Schema)
                            .Where(KcbDonthuocChitiet.Columns.IdChitietdonthuoc).IsEqualTo(ID_Detail)
                            .And(KcbDonthuocChitiet.Columns.TrangthaiHuy).IsEqualTo(1);
                        if (sqlQuery.GetRecordCount() > 0)
                        {
                            Utility.ShowMsg(
                                "Bản ghi thuốc đã hủy thông tin,Bạn không thể hủy, Mời bạn xem lại \n  Mời bạn chọn những bản ghi chưa hủy",
                                "Thông báo", MessageBoxIcon.Warning);
                            grdThongTinDaThanhToan.Focus();
                            return false;
                        }
                        break;
                }
            }

            return true;
        }
Пример #16
0
 private void grdDiease_UpdatingCell(object sender, UpdatingCellEventArgs e)
 {
     var objValue = new object();
     if (e.Column.Key == DmucBenh.Columns.MaBenh)
     {
         objValue = e.Value;
         SqlQuery q = new Select().From(DmucBenh.Schema)
         .Where(DmucBenh.Columns.MaBenh).IsEqualTo(Utility.sDbnull(objValue))
         .And(DmucBenh.Columns.IdBenh).IsNotEqualTo(Utility.Int32Dbnull(grdDiease.CurrentRow.Cells[DmucBenh.Columns.IdBenh].Value, -1));
         if (string.IsNullOrEmpty(objValue.ToString().Trim()))
         {
             e.Cancel = true;
             Utility.ShowMsg("Mã bệnh không được để trống", "Thông báo thiếu thông tin", MessageBoxIcon.Warning);
         }
         if (q.GetRecordCount() > 0)
         {
             e.Cancel = true;
             Utility.ShowMsg("Đã tồn tại mã bệnh", "Thông báo tồn tại", MessageBoxIcon.Warning);
         }
     }
     else if (e.Column.Key == DmucBenh.Columns.TenBenh)
     {
         objValue = e.Value;
         if (string.IsNullOrEmpty(objValue.ToString().Trim()))
         {
             e.Cancel = true;
             Utility.ShowMsg("Tên bệnh không được để trống", "Thông báo thiếu thông tin", MessageBoxIcon.Warning);
         }
     }
 }
Пример #17
0
        //thu tuc de ghi cau hinh cua file RPT len Database
        public void updateRPTtoDB()
        {
            SqlQuery sqlQuery = new Select().From("tbl_Trinhky")
                .Where("ReportName").IsEqualTo(mv_TEN_BIEUBC);
            //string strSQL="select * from tbl_Trinhky"
            string strSQL = "";
            if (sqlQuery.GetRecordCount()>0)
            {
                strSQL = "Update tbl_TRINHKY set";
                strSQL += " ObjectName = N'" + mv_TEN_DOITUONG + "'";
                strSQL += " ,Font_Name = N'" + mv_FONT_CHU + "'";
                strSQL += " ,Font_Size = " + mv_CO_CHU;
                strSQL += " ,Font_Stype = N'" + mv_KIEU_CHU + "'";
                strSQL += " ,ObjectContent = N'" + mv_NOI_DUNG + "'";
                strSQL += " Where ReportName = N'" + mv_TEN_BIEUBC + "'";
                new SubSonic.InlineQuery().Execute(strSQL);
            }
            else
            {
                strSQL = "Insert Into tbl_TRINHKY(ReportName, ObjectName,  Font_Name, Font_Size, Font_Stype, ObjectContent)";
                strSQL += " Values(";
                strSQL += " N'" + mv_TEN_BIEUBC + "'";
                strSQL += " ,N'" + mv_TEN_DOITUONG + "'";
                strSQL += " ,N'" + mv_FONT_CHU + "'";
                strSQL += " ," + mv_CO_CHU;
                strSQL += " ,N'" + mv_KIEU_CHU + "'";
                strSQL += " ,N'" + mv_NOI_DUNG + "')";

                    new SubSonic.InlineQuery().Execute(strSQL);

                exists = true;

            }
        }
Пример #18
0
        private bool IsValidTheBHYT()
        {
            if (!string.IsNullOrEmpty(txtMaDtuong_BHYT.Text))
            {
                SqlQuery sqlQuery = new Select().From(DmucDoituongbhyt.Schema)
                    .Where(DmucDoituongbhyt.Columns.MaDoituongbhyt).IsEqualTo(txtMaDtuong_BHYT.Text);
                if (sqlQuery.GetRecordCount() <= 0)
                {
                    Utility.ShowMsg(
                        "Mã đối tượng BHYT không tồn tại trong hệ thống. Mời bạn kiểm tra lại",
                        "Thông báo", MessageBoxIcon.Information);
                    txtMaDtuong_BHYT.Focus();
                    txtMaDtuong_BHYT.SelectAll();
                    return false;
                }
            }
            if (Utility.DoTrim(txtMaDtuong_BHYT.Text) != "" && Utility.DoTrim(txtMaQuyenloi_BHYT.Text) != "")
            {
                QheDautheQloiBhyt objQheDautheQloiBhyt = new Select().From(QheDautheQloiBhyt.Schema).Where(QheDautheQloiBhyt.Columns.MaDoituongbhyt).IsEqualTo(Utility.DoTrim(txtMaDtuong_BHYT.Text))
                    .And(QheDautheQloiBhyt.Columns.MaQloi).IsEqualTo(Utility.Int32Dbnull(txtMaQuyenloi_BHYT.Text, 0)).ExecuteSingle<QheDautheQloiBhyt>();
                if (objQheDautheQloiBhyt == null)
                {
                    Utility.ShowMsg(string.Format("Đầu thẻ BHYT: {0} chưa được cấu hình gắn với mã quyền lợi: {1}. Mời bạn kiểm tra lại", txtMaDtuong_BHYT.Text, txtMaQuyenloi_BHYT.Text));
                    txtMaQuyenloi_BHYT.Focus();
                    txtMaQuyenloi_BHYT.SelectAll();
                    return false;
                }
            }
            if (THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_KIEMTRAMATHE","1",true) == "1")
            {
                if (!string.IsNullOrEmpty(txtMaQuyenloi_BHYT.Text))
                {
                    if (Utility.Int32Dbnull(txtMaQuyenloi_BHYT.Text, 0) < 1 || Utility.Int32Dbnull(txtMaQuyenloi_BHYT.Text, 0) > 9)
                    {
                        Utility.ShowMsg("Số thứ tự 2 của mã bảo hiểm nằm trong khoảng từ 1->9", "Thông báo",
                                        MessageBoxIcon.Information);
                        txtMaQuyenloi_BHYT.Focus();
                        txtMaQuyenloi_BHYT.SelectAll();
                        return false;
                    }

                    QheDautheQloiBhytCollection lstqhe = new Select().From(QheDautheQloiBhyt.Schema).Where(QheDautheQloiBhyt.Columns.MaDoituongbhyt).IsEqualTo(txtMaDtuong_BHYT.Text).ExecuteAsCollection<QheDautheQloiBhytCollection>();
                    if (lstqhe.Count > 0)
                    {
                        var q = from p in lstqhe
                                where p.MaQloi == Utility.ByteDbnull(txtMaQuyenloi_BHYT.Text, -1)
                                select objDoituongKCB;

                        if (q.Count() <= 0)
                        {

                            Utility.ShowMsg(
                                string.Format(
                                    "Đầu thẻ :{0} chưa được tạo quan hệ với mã quyền lợi {1}\n Đề nghị bạn kiểm tra lại danh mục đối tượng tham gia BHYT",
                                    txtMaDtuong_BHYT.Text, txtMaQuyenloi_BHYT.Text));
                            txtMaQuyenloi_BHYT.Focus();
                            txtMaQuyenloi_BHYT.SelectAll();
                            return false;
                        }
                    }
                    else
                    {
                        Utility.ShowMsg(
                            string.Format(
                                "Đầu thẻ :{0} chưa được tạo quan hệ với mã quyền lợi {1}\n Đề nghị bạn kiểm tra lại danh mục đối tượng tham gia BHYT",
                                txtMaDtuong_BHYT.Text, txtMaQuyenloi_BHYT.Text));
                        txtMaQuyenloi_BHYT.Focus();
                        txtMaQuyenloi_BHYT.SelectAll();
                        return false;
                    }
                }
                if (!string.IsNullOrEmpty(txtNoiphattheBHYT.Text))
                {
                    if (txtNoiphattheBHYT.Text.Length <= 1)
                    {
                        Utility.ShowMsg("Mã nơi phát thẻ BHYT phải nằm trong khoảng từ 00->99", "Thông báo",
                                        MessageBoxIcon.Information);
                        txtNoiphattheBHYT.Focus();
                        txtNoiphattheBHYT.SelectAll();
                        return false;
                    }
                    if (Utility.Int32Dbnull(txtNoiphattheBHYT.Text, 0) <= 0)
                    {
                        Utility.ShowMsg("Mã nơi phát thẻ BHYT không được phép có chữ cái và phải nằm trong khoảng từ 00->99", "Thông báo",
                                        MessageBoxIcon.Information);
                        txtNoiphattheBHYT.Focus();
                        txtNoiphattheBHYT.SelectAll();
                        return false;
                    }
                }
                if (!string.IsNullOrEmpty(txtOthu4.Text))
                {
                    if (txtOthu4.Text.Length <= 1)
                    {
                        Utility.ShowMsg("Hai kí tự ô số 4 của mã bảo hiểm nằm trong khoảng từ 01->99", "Thông báo",
                                        MessageBoxIcon.Information);
                        txtOthu4.Focus();
                        txtOthu4.SelectAll();
                        return false;
                    }

                    if (Utility.Int32Dbnull(txtOthu4.Text, 0) <= 0)
                    {
                        Utility.ShowMsg("Hai kí tự ô số 4 của mã bảo hiểm không được phép có chữ cái và phải nằm trong khoảng từ 01->99", "Thông báo",
                                        MessageBoxIcon.Information);
                        txtOthu4.Focus();
                        txtOthu4.SelectAll();
                        return false;
                    }
                }
                if (!string.IsNullOrEmpty(txtOthu5.Text))
                {
                    if (txtOthu5.Text.Length <= 2)
                    {
                        Utility.ShowMsg("3 kí tự ô số 5 của mã bảo hiểm nằm trong khoảng từ 001->999", "Thông báo",
                                        MessageBoxIcon.Information);
                        txtOthu5.Focus();
                        txtOthu5.SelectAll();
                        return false;
                    }

                    if (Utility.Int32Dbnull(txtOthu5.Text, 0) <= 0)
                    {
                        Utility.ShowMsg("3 kí tự ô số 5 của mã bảo hiểm không được phép có chữ cái và phải nằm trong khoảng từ 001->999", "Thông báo",
                                        MessageBoxIcon.Information);
                        txtOthu5.Focus();
                        txtOthu5.SelectAll();
                        return false;
                    }
                }
                if (!string.IsNullOrEmpty(txtOthu6.Text))
                {
                    if (txtOthu6.Text.Length <= 4)
                    {
                        Utility.ShowMsg("5 kí tự ô số 6 của mã bảo hiểm nằm trong khoảng từ 00001->99999", "Thông báo",
                                        MessageBoxIcon.Information);
                        txtOthu6.Focus();
                        txtOthu6.SelectAll();
                        return false;
                    }

                    if (Utility.Int32Dbnull(txtOthu6.Text, 0) <= 0)
                    {
                        Utility.ShowMsg("5 kí tự ô số 6 của mã bảo hiểm không được phép có chữ cái và phải nằm trong khoảng từ 00001->99999", "Thông báo",
                                        MessageBoxIcon.Information);
                        txtOthu6.Focus();
                        txtOthu6.SelectAll();
                        return false;
                    }
                }
            }
            if (!string.IsNullOrEmpty(txtNoiDongtrusoKCBBD.Text))
            {
                if (txtNoiDongtrusoKCBBD.Text.Length <=1)
                {
                    Utility.ShowMsg("2 kí tự nơi đóng trụ sợ KCBBD phải nhập từ 01->99", "Thông báo",
                                    MessageBoxIcon.Information);
                    txtNoiDongtrusoKCBBD.Focus();
                    txtNoiDongtrusoKCBBD.SelectAll();
                    return false;
                }

                if (Utility.Int32Dbnull(txtNoiDongtrusoKCBBD.Text, 0) <= 0)
                {
                    Utility.ShowMsg("2 kí tự nơi đóng trụ sợ KCBBD không được phép có chữ cái và phải nằm trong khoảng từ 01->99", "Thông báo",
                                    MessageBoxIcon.Information);
                    txtNoiDongtrusoKCBBD.Focus();
                    txtNoiDongtrusoKCBBD.SelectAll();
                    return false;
                }

                SqlQuery sqlQuery = new Select().From(DmucDiachinh.Schema)
                    .Where(DmucDiachinh.Columns.MaDiachinh).IsEqualTo(txtNoiDongtrusoKCBBD.Text);
                if (sqlQuery.GetRecordCount() <= 0)
                {
                    Utility.ShowMsg(
                        "Mã thành phố nơi đăng ký khám hiện không tồn tại trong CSDL\n Mời bạn liên hệ với quản trị mạng để nhập thêm",
                        "Thông báo", MessageBoxIcon.Information);
                    txtNoiDongtrusoKCBBD.Focus();
                    txtNoiDongtrusoKCBBD.SelectAll();
                    return false;
                }
            }
            if (!string.IsNullOrEmpty( txtNoiDKKCBBD.Text))
            {

                SqlQuery sqlQuery = new Select().From(DmucNoiKCBBD.Schema)
                    .Where(DmucNoiKCBBD.Columns.MaKcbbd).IsEqualTo(txtNoiDKKCBBD.Text)
                    .And(DmucNoiKCBBD.Columns.MaDiachinh).IsEqualTo(txtNoiphattheBHYT.Text);
                if (sqlQuery.GetRecordCount() <= 0)
                {
                    Utility.ShowMsg(
                        "Mã  nơi đăng ký khám hiện không tồn tại trong CSDL\n Mời bạn liên hệ với quản trị mạng để nhập thêm",
                        "Thông báo", MessageBoxIcon.Information);
                    txtNoiDKKCBBD.Focus();
                    txtNoiDKKCBBD.SelectAll();
                    return false;
                }
            }
            return true;
        }
Пример #19
0
        void Thanhtoan(bool askbeforepayment)
        {
            try
            {
                if (!Utility.isValidGrid(grdRegExam)) return;
                int IdKham = Utility.Int32Dbnull(grdRegExam.GetValue(KcbDangkyKcb.Columns.IdKham));
                SqlQuery sqlQuery = new Select().From(KcbDangkyKcb.Schema)
                    .Where(KcbDangkyKcb.Columns.IdKham).IsEqualTo(IdKham)
                    .And(KcbDangkyKcb.Columns.TrangthaiThanhtoan).IsEqualTo(1);
                if (sqlQuery.GetRecordCount() > 0)
                {
                    Utility.ShowMsg("Bản ghi này đã thanh toán. Mời bạn xem lại", "Thông báo", MessageBoxIcon.Information);
                    return;
                }
                if (PropertyLib._KCBProperties.Hoitruockhithanhtoan)
                    if (askbeforepayment)
                        if (!Utility.AcceptQuestion("Bạn có muốn thực hiện việc thanh toán khám bệnh cho bệnh nhân không ?",
                                                   "Thông báo", true))
                            return;

                int Payment_Id = -1;
                if (objLuotkham == null)
                    objLuotkham = CreatePatientExam();
                if (Utility.Int32Dbnull(objLuotkham.TrangthaiNoitru, 0) >= Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_THANHTOAN_CHAN_THANHTOANNGOAITRU", "2", false), 2))
                {
                    Utility.ShowMsg("Bệnh nhân này đã ở trạng thái nội trú nên hệ thống không cho phép hủy thanh toán ngoại trú nữa");
                    return;
                }
                KcbThanhtoan objPayment = CreatePayment();
                List<int> lstRegID = new List<int>();
                decimal TTBN_Chitrathucsu = 0;
                ActionResult actionResult = new KCB_THANHTOAN().Payment4SelectedItems(objPayment, objLuotkham, CreatePaymmentDetail(ref lstRegID).ToList<KcbThanhtoanChitiet>(),
                                                   ref Payment_Id, -1, false, ref TTBN_Chitrathucsu);

                switch (actionResult)
                {
                    case ActionResult.Success:
                        if (objPayment.IdThanhtoan != Payment_Id)
                        {
                            Payment_Id = Utility.Int32Dbnull(objPayment.IdThanhtoan);
                        }

                        foreach (DataRow _row in m_dataDataRegExam.Rows)
                        {
                            if (lstRegID.Contains(Utility.Int32Dbnull(_row[KcbDangkyKcb.Columns.IdKham], -1)))
                            {
                                _row["ten_trangthai_thanhtoan"] = "Đã thanh toán";
                                _row[KcbDangkyKcb.Columns.IdThanhtoan] = Payment_Id;
                                _row[KcbDangkyKcb.Columns.TrangthaiThanhtoan] = 1;
                            }
                        }
                        m_dataDataRegExam.AcceptChanges();
                        Payment_Id = Utility.Int32Dbnull(objPayment.IdThanhtoan);
                        if (PropertyLib._MayInProperties.TudonginhoadonSaukhiThanhtoan && TTBN_Chitrathucsu>0)
                        {
                            int KCB_THANHTOAN_KIEUINHOADON = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_THANHTOAN_KIEUINHOADON", "1", false));
                            if (KCB_THANHTOAN_KIEUINHOADON == 1 || KCB_THANHTOAN_KIEUINHOADON == 3)
                                InHoadon(Payment_Id);
                            if (KCB_THANHTOAN_KIEUINHOADON == 2 || KCB_THANHTOAN_KIEUINHOADON == 3)
                                new INPHIEU_THANHTOAN_NGOAITRU().InBienlai(false, Payment_Id, objLuotkham);
                        }
                        break;
                    case ActionResult.Error:
                        Utility.ShowMsg("Lỗi trong quá trình lưu thông tin ", "Thông báo");
                        break;
                }
            }
            catch
            {
            }
            finally
            {
                ModifyButtonCommandRegExam();
            }
        }
Пример #20
0
        private bool CheckBeforeDelete()
        {
            if (!Utility.isValidGrid(grdRegExam)) return false;
            if (grdRegExam.CurrentRow == null) return false;
            int v_RegId = Utility.Int32Dbnull(grdRegExam.CurrentRow.Cells[KcbDangkyKcb.Columns.IdKham].Value, -1);
            KcbDangkyKcb objRegExam = KcbDangkyKcb.FetchByID(v_RegId);
            if (objRegExam != null)
            {
                SqlQuery sqlQuery = new Select().From(KcbDangkyKcb.Schema)
                    .Where(KcbDangkyKcb.Columns.IdKham).IsEqualTo(objRegExam.IdKham)
                    .And(KcbDangkyKcb.Columns.TrangthaiThanhtoan).IsEqualTo(1);
                if (sqlQuery.GetRecordCount() > 0)
                {
                    Utility.ShowMsg("Đăng ký khám đang chọn đã thanh toán, Bạn không thể xóa", "Thông báo");
                    grdRegExam.Focus();
                    return false;
                }
                if (objRegExam.IdKham <= 0) return true;

                if (PropertyLib._KCBProperties.FullDelete)
                {
                    SqlQuery q =
                        new Select().From(KcbChidinhclsChitiet.Schema).Where(KcbChidinhclsChitiet.Columns.IdKham).IsEqualTo(
                            objRegExam.IdKham).And(KcbChidinhclsChitiet.Columns.TrangthaiThanhtoan).IsEqualTo(1);
                    if (q.GetRecordCount() > 0)
                    {
                        Utility.ShowMsg("Đăng ký khám đang chọn đã được bác sĩ chỉ định CLS và đã được thanh toán. Yêu cầu Hủy thanh toán các chỉ định CLS trước khi hủy phòng khám", "Thông báo");
                        grdRegExam.Focus();
                        return false;
                    }
                    SqlQuery qPres =
                        new Select().From(KcbDonthuocChitiet.Schema).Where(KcbDonthuocChitiet.Columns.IdKham).IsEqualTo(
                            objRegExam.IdKham).And(KcbDonthuocChitiet.Columns.TrangthaiThanhtoan).IsEqualTo(1);
                    if (qPres.GetRecordCount() > 0)
                    {
                        Utility.ShowMsg("Đăng ký khám đang chọn đã được bác sĩ kê đơn thuốc và đã được thanh toán. Yêu cầu hủy thanh toán đơn thuốc trước khi hủy phòng khám", "Thông báo");
                        grdRegExam.Focus();
                        return false;
                    }
                }
                else//Nếu có chỉ định CLS hoặc thuốc thì không cho phép xóa
                {
                    SqlQuery q =
                        new Select().From(KcbChidinhcl.Schema).Where(KcbChidinhcl.Columns.IdKham).IsEqualTo(
                            objRegExam.IdKham);
                    if (q.GetRecordCount() > 0)
                    {
                        Utility.ShowMsg("Đăng ký khám đang chọn đã được bác sĩ chỉ định CLS. Yêu cầu xóa chỉ định CLS trước khi hủy phòng khám", "Thông báo");
                        grdRegExam.Focus();
                        return false;
                    }
                    SqlQuery qPres =
                        new Select().From(KcbDonthuoc.Schema).Where(KcbDonthuoc.Columns.IdKham).IsEqualTo(objRegExam.IdKham);
                    if (qPres.GetRecordCount() > 0)
                    {
                        Utility.ShowMsg("Đăng ký khám đang chọn đã được bác sĩ kê đơn thuốc. Yêu cầu xóa đơn thuốc trước khi hủy phòng khám", "Thông báo");
                        grdRegExam.Focus();
                        return false;
                    }
                }
            }
            return true;
        }
 private bool IsValid4UpdateDelete()
 {
     Utility.SetMsg(uiStatusBar2.Panels["MSG"], "", false);
     int IdPhieu = Utility.Int32Dbnull(grdList.GetValue(TPhieuNhapxuatthuoc.Columns.IdPhieu), -1);
     SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuoc.Schema)
         .Where(TPhieuNhapxuatthuoc.Columns.TrangThai).IsEqualTo(1)
         .And(TPhieuNhapxuatthuoc.Columns.IdPhieu).IsEqualTo(IdPhieu);
     if (sqlQuery.GetRecordCount() > 0)
     {
         Utility.SetMsg(uiStatusBar2.Panels["MSG"], "Phiếu thanh lý thuốc đã xác nhận, Bạn không thể sửa hoặc xóa thông tin", false);
         return false;
     }
     return true;
 }
Пример #22
0
 /// <summary>
 /// hàm thực hiện việc xóa thông tin trên lưới
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (!IsValidDataXoaCLS()) return;
         foreach (GridEXRow gridExRow in grdAssignDetail.GetCheckedRows())
         {
             long AssignDetail = Utility.Int64Dbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.IdChitietchidinh].Value, -1);
             CHIDINH_CANLAMSANG.XoaChiDinhCLSChitiet(AssignDetail);
             gridExRow.Delete();
             grdAssignDetail.UpdateData();
             grdAssignDetail.Refresh();
             m_dtAssignDetail.AcceptChanges();
         }
         SqlQuery sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema)
             .Where(KcbChidinhclsChitiet.Columns.IdChidinh).IsEqualTo(Utility.Int32Dbnull(txtAssign_ID.Text, -1));
         if (sqlQuery.GetRecordCount() <= 0)
         {
             if (
                 Utility.AcceptQuestion(
                     "Phiếu điều trị hiện tại không còn chi tiết nữa, Bạn có muốn xóa phiếu điều trị đi không?",
                     "Thông báo", true))
             {
                 new Delete().From(KcbChidinhcl.Schema)
                     .Where(KcbChidinhcl.Columns.IdChidinh).IsEqualTo(Utility.Int32Dbnull(txtAssign_ID.Text, -1)).
                     Execute();
                 m_eAction = action.Insert;
                 txtAssign_ID.Text = "(Tự sinh)";
                 txtAssignCode.Text = THU_VIEN_CHUNG.SinhMaChidinhCLS();
             }
         }
         b_Cancel = true;
         ModifyCommand();
         ModifyButtonCommand();
     }
     catch (Exception ex)
     { }
 }
Пример #23
0
        private bool IsValidDataXoaCLS_Selected()
        {
            if (grdAssignDetail.RowCount <= 0 || grdAssignDetail.CurrentRow.RowType != RowType.Record)
            {
                Utility.ShowMsg("Bạn phải thực hiện chọn một bản ghi thực hiện xóa thông tin dịch vụ cận lâm sàng",
                                "Thông báo", MessageBoxIcon.Warning);
                grdAssignDetail.Focus();
                return false;
            }
            int AssignDetail_ID = -1;
            SqlQuery sqlQuery = null;
            if (!globalVariables.IsAdmin)
            {

                AssignDetail_ID =
                    Utility.Int32Dbnull(
                        grdAssignDetail.CurrentRow.Cells[KcbChidinhclsChitiet.Columns.IdChitietchidinh].Value, -1);
                sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema)
                    .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(AssignDetail_ID)
                    .And(KcbChidinhclsChitiet.Columns.NguoiTao).IsNotEqualTo(globalVariables.UserName);
                if (sqlQuery.GetRecordCount() > 0)
                {
                    Utility.ShowMsg("Trong các chỉ định bạn chọn xóa, có một số chỉ định được kê bởi Bác sĩ khác nên bạn không được phép xóa. Mời bạn chọn lại chỉ các chỉ định do chính bạn kê để thực hiện xóa");
                    return false;
                }
            }
            AssignDetail_ID =
                   Utility.Int32Dbnull(grdAssignDetail.CurrentRow.Cells[KcbChidinhclsChitiet.Columns.IdChitietchidinh].Value,
                                       -1);
            sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema)
                .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(AssignDetail_ID)
                .And(KcbChidinhclsChitiet.Columns.TrangthaiThanhtoan).IsEqualTo(1);
            if (sqlQuery.GetRecordCount() > 0)
            {
                Utility.ShowMsg("Chỉ định bạn chọn đã được thanh toán nên bạn không thể xóa. Đề nghị kiểm tra lại");
                return false;
            }

            AssignDetail_ID =
                Utility.Int32Dbnull(grdAssignDetail.CurrentRow.Cells[KcbChidinhclsChitiet.Columns.IdChitietchidinh].Value, -1);
            sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema)
                .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(AssignDetail_ID)
                .And(KcbChidinhclsChitiet.Columns.TrangThai).IsGreaterThanOrEqualTo(1);
            if (sqlQuery.GetRecordCount() > 0)
            {
                Utility.ShowMsg("Chỉ định bạn chọn đã được chuyển làm cận lâm sàng hoặc đã có kết quả nên không thể xóa. Đề nghị kiểm tra lại");
                return false;
            }
            return true;
        }
Пример #24
0
        public ActionResult Nhapvien(NoitruPhanbuonggiuong objBuongGiuong, KcbLuotkham objLuotkham,
            NoitruGoinhapvien objThongtinGoiDvu)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        if (objBuongGiuong != null)
                        {
                            NoitruPhanbuonggiuongCollection _NoitruPhanbuonggiuong = new Select().From(NoitruPhanbuonggiuong.Schema)
                                        .Where(NoitruPhanbuonggiuong.Columns.NoiTru).IsEqualTo(1)
                                        .And(NoitruPhanbuonggiuong.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
                                        .And(NoitruPhanbuonggiuong.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan).ExecuteAsCollection<NoitruPhanbuonggiuongCollection>();
                            if (_NoitruPhanbuonggiuong!=null && _NoitruPhanbuonggiuong.Count == 1)
                            {
                                if (Utility.Int32Dbnull(_NoitruPhanbuonggiuong[0].IdBuong, -1) == -1)
                                {
                                    //Chỉ việc cập nhật lại thông tin khoa
                                    new Update(NoitruPhanbuonggiuong.Schema)
                                    .Set(NoitruPhanbuonggiuong.Columns.IdKhoanoitru).EqualTo(objBuongGiuong.IdKhoanoitru)
                                    .Set(NoitruPhanbuonggiuong.Columns.NguoiSua).EqualTo(objBuongGiuong.NguoiSua)
                                    .Set(NoitruPhanbuonggiuong.Columns.NgaySua).EqualTo(objBuongGiuong.NgaySua)
                                    .Set(NoitruPhanbuonggiuong.Columns.NgayVaokhoa).EqualTo(objBuongGiuong.NgayVaokhoa)
                                    .Set(NoitruPhanbuonggiuong.Columns.IdBacsiChidinh).EqualTo(objBuongGiuong.IdBacsiChidinh)
                                    .Where(NoitruPhanbuonggiuong.Columns.Id).IsEqualTo(_NoitruPhanbuonggiuong[0].Id)
                                    .Execute();
                                    objBuongGiuong.Id = _NoitruPhanbuonggiuong[0].Id;

                                }
                            }
                            else
                            {
                                if (objBuongGiuong.NgayVaokhoa <= Convert.ToDateTime("01/01/1900"))
                                    objBuongGiuong.NgayVaokhoa = DateTime.Now;
                                if (objBuongGiuong.NgayTao <= Convert.ToDateTime("01/01/1900"))
                                    objBuongGiuong.NgayTao = DateTime.Now;
                                if (objLuotkham.NgayNhapvien <= Convert.ToDateTime("01/01/1900"))
                                    objLuotkham.NgayNhapvien = DateTime.Now;
                                new Delete().From(NoitruPhanbuonggiuong.Schema)
                                    .Where(NoitruPhanbuonggiuong.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
                                    .And(NoitruPhanbuonggiuong.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan)
                                    .And(NoitruPhanbuonggiuong.Columns.NoiTru).IsEqualTo(1)
                                    .AndExpression(NoitruPhanbuonggiuong.Columns.IdBuong)
                                    .IsEqualTo(-1)
                                    .Or(NoitruPhanbuonggiuong.Columns.IdBuong)
                                    .IsNull().CloseExpression().Execute();

                                objBuongGiuong.IdBacsiChidinh = globalVariables.gv_intIDNhanvien;
                                objBuongGiuong.IdBuong = -1;
                                objBuongGiuong.IdGiuong = -1;
                                objBuongGiuong.IdChuyen = -1;
                                objBuongGiuong.SoLuong = 1;
                                objBuongGiuong.TuTuc = 0;
                                objBuongGiuong.IdGoi = -1;
                                objBuongGiuong.TrongGoi = -1;
                                objBuongGiuong.IdNhanvienPhangiuong = -1;
                                objBuongGiuong.TrangthaiXacnhan = 0;
                                objBuongGiuong.TenHienthi = "Nhập viện nội trú";
                                objBuongGiuong.NguoiTao = globalVariables.UserName;
                                objBuongGiuong.NgayTao = globalVariables.SysDate;
                                objBuongGiuong.NoiTru = 1;
                                objBuongGiuong.IsNew = true;
                                objBuongGiuong.Save();
                            }
                           KcbLuotkham _tempt=new Select().From(KcbLuotkham.Schema)
                               .Where(KcbLuotkham.Columns.MaLuotkham).IsNotEqualTo(objLuotkham.MaLuotkham)
                                .And(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan)
                                .And(KcbLuotkham.Columns.SoBenhAn).IsEqualTo(objLuotkham.SoBenhAn)
                                .ExecuteSingle<KcbLuotkham>();
                           //Tạm bỏ -->Phải giữ nguyên số bệnh án nội trú chứ?
                            //if (_tempt != null)
                           //    objLuotkham.SoBenhAn = THU_VIEN_CHUNG.LaySoBenhAn();
                            new Update(KcbLuotkham.Schema)
                                .Set(KcbLuotkham.Columns.SoBenhAn).EqualTo(objLuotkham.SoBenhAn)
                                .Set(KcbLuotkham.Columns.IdKhoanoitru).EqualTo(objBuongGiuong.IdKhoanoitru)
                                .Set(KcbLuotkham.Columns.IdNhapvien).EqualTo(objBuongGiuong.Id)
                                .Set(KcbLuotkham.Columns.IdRavien).EqualTo(objBuongGiuong.Id)
                                .Set(KcbLuotkham.Columns.TrangthaiNoitru).EqualTo(1)
                                .Set(KcbLuotkham.Columns.NgayNhapvien).EqualTo(objBuongGiuong.NgayVaokhoa)
                                .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
                                .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan).Execute();
                            //Phần gói này sẽ thiết kế lại sau
                            if (objThongtinGoiDvu != null)
                            {
                                if (Utility.Int32Dbnull(objThongtinGoiDvu.TrangthaiHuy, -1) <= 0) objThongtinGoiDvu.TrangthaiHuy = 0;
                                if (Utility.Int32Dbnull(objThongtinGoiDvu.TrangthaiDattruoc, -1) <= 0)
                                    objThongtinGoiDvu.TrangthaiDattruoc = 0;
                                if (objThongtinGoiDvu.NgayTao <= Convert.ToDateTime("01/01/1900"))
                                    objThongtinGoiDvu.NgayTao = globalVariables.SysDate;
                                SqlQuery sqlQuery = new Select().From(NoitruGoinhapvien.Schema)
                                    .Where(NoitruGoinhapvien.Columns.MaLuotkham).IsEqualTo(
                                        objThongtinGoiDvu.MaLuotkham)
                                    .And(NoitruGoinhapvien.Columns.IdBenhnhan).IsEqualTo(objThongtinGoiDvu.IdBenhnhan)
                                    .And(NoitruGoinhapvien.Columns.NoiTru).IsEqualTo(objThongtinGoiDvu.NoiTru)
                                    .And(NoitruGoinhapvien.Columns.TrangthaiThanhtoan).IsEqualTo(1);
                                if (sqlQuery.GetRecordCount() > 0)
                                {
                                    return ActionResult.ExistedRecord;
                                }
                                sqlQuery = new Select().From(NoitruGoinhapvien.Schema)
                                    .Where(NoitruGoinhapvien.Columns.MaLuotkham).IsEqualTo(
                                        objThongtinGoiDvu.MaLuotkham)
                                    .And(NoitruGoinhapvien.Columns.IdBenhnhan).IsEqualTo(objThongtinGoiDvu.IdBenhnhan)
                                    .And(NoitruGoinhapvien.Columns.NoiTru).IsEqualTo(objThongtinGoiDvu.NoiTru);
                                if (sqlQuery.GetRecordCount() <= 0)
                                {
                                    //objThongtinGoiDvu.DatTruoc = 0;
                                    objThongtinGoiDvu.IdNhanvien = globalVariables.gv_intIDNhanvien;
                                    objThongtinGoiDvu.IsNew = true;
                                    objThongtinGoiDvu.Save();
                                }
                                else
                                {
                                    new Update(NoitruGoinhapvien.Schema)
                                        .Set(NoitruGoinhapvien.Columns.IdNhanvien)
                                        .EqualTo(globalVariables.gv_intIDNhanvien)
                                        .Set(NoitruGoinhapvien.Columns.NguoiSua).EqualTo(globalVariables.UserName)
                                        .Set(NoitruGoinhapvien.Columns.NgaySua).EqualTo(DateTime.Now)
                                        .Set(NoitruGoinhapvien.Columns.IdGoi).EqualTo(objThongtinGoiDvu.IdGoi)
                                        .Set(NoitruGoinhapvien.Columns.SoTien).EqualTo(objThongtinGoiDvu.SoTien)
                                        .Set(NoitruGoinhapvien.Columns.SoNgay).EqualTo(objThongtinGoiDvu.SoNgay)
                                        .Where(NoitruGoinhapvien.Columns.MaLuotkham).IsEqualTo(
                                            objThongtinGoiDvu.MaLuotkham)
                                        .And(NoitruGoinhapvien.Columns.IdBenhnhan).IsEqualTo(
                                            objThongtinGoiDvu.IdBenhnhan)
                                        .And(NoitruGoinhapvien.Columns.NoiTru).IsEqualTo(objThongtinGoiDvu.NoiTru).
                                        Execute();
                                }
                            }
                        }
                        else
                        {
                            return ActionResult.Error;
                        }
                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception ex)
            {
               Utility.CatchException( ex);
                return ActionResult.Error;
            }
        }
Пример #25
0
 private bool InValiExistsBN()
 {
     try
     {
         if (string.IsNullOrEmpty(txtMaLankham.Text))
         {
             Utility.ShowMsg("Mã lần khám không bỏ trống", "Thông báo", MessageBoxIcon.Error);
             txtMaLankham.Focus();
             txtMaLankham.SelectAll();
             return false;
         }
         SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema)
             .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(Utility.sDbnull(txtMaLankham.Text));
         if (sqlQuery.GetRecordCount() <= 0)
         {
             Utility.ShowMsg("Mã lần khám này không tồn tại trong CSDL,Mời bạn xem lại", "Thông báo",
                             MessageBoxIcon.Error);
             txtMaLankham.Focus();
             txtMaLankham.SelectAll();
             return false;
         }
         //Kiểm tra xem có thay đổi phần trăm BHYT
         if (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) != Utility.DecimaltoDbnull(txtPtramBHYT.Text))
         {
             KcbThanhtoanCollection _lstthanhtoan = new Select().From(KcbThanhtoan.Schema)
                 .Where(KcbThanhtoan.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan)
                 .And(KcbThanhtoan.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
                 .And(KcbThanhtoan.Columns.PtramBhyt).IsEqualTo(Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0))
                 .ExecuteAsCollection<KcbThanhtoanCollection>();
             if (_lstthanhtoan.Count > 0)
             {
                 Utility.ShowMsg(string.Format("Bệnh nhân này đã thanh toán với mức BHYT {0}. Do đó hệ thống không cho phép bạn thay đổi phần trăm BHYT.\nMuốn thay đổi đề nghị bạn hủy hết các thanh toán",Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0).ToString()));
                 return false;
             }
         }
         return true;
     }
     catch (Exception ex)
     {
         Utility.CatchException("Lỗi khi kiểm tra hợp lệ dữ liệu trước khi cập nhật Bệnh nhân",ex);
         return false;
     }
 }
Пример #26
0
        public ActionResult ThemLankhamMoi(KcbDanhsachBenhnhan objPatientInfo, KcbLuotkham objLuotkham, KcbDangkyKcb objRegExam, int KieuKham,ref long id_kham)
        {
            int v_IdBenhnhan = -1;
            try
            {
                using (var scope = new TransactionScope())
                {
                    using (var dbscope = new SharedDbConnectionScope())
                    {
                        objPatientInfo.IsNew = true;
                        objPatientInfo.Save();
                        //Thêm lần khám
                        objLuotkham.IdBenhnhan = objPatientInfo.IdBenhnhan;
                        objLuotkham.SoBenhAn = string.Empty;
                        //Tạm bỏ đoạn này
                        //decimal PtramBHYT = THU_VIEN_CHUNG.TinhPtramBHYT(objLuotkham);
                        //if (PtramBHYT != Utility.DecimaltoDbnull(objLuotkham.PtramBhyt))
                        //{
                        //    log.Info(string.Format("voi benh nhan :{0} va MaLuotkham:{1} ", objPatientInfo.TenBenhnhan, objLuotkham.MaLuotkham));
                        //    log.Info(
                        //        string.Format(
                        //            "truong hop phan tram tinh toan sai void ptramBHYT:{0} va truyen tu ngoai vao :{1} ",
                        //            PtramBHYT, objLuotkham.PtramBhyt));
                        //    objLuotkham.PtramBhyt = PtramBHYT;
                        //}
                        objLuotkham.SttKham = THU_VIEN_CHUNG.LaySTTKhamTheoDoituong(objLuotkham.IdDoituongKcb);
                        objLuotkham.NgayTao = globalVariables.SysDate;
                        objLuotkham.NguoiTao = globalVariables.UserName;
                        objLuotkham.IsNew = true;
                        objLuotkham.Save();
                        SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema)
                         .Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan)
                         .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham);
                        if (sqlQueryPatientExam.GetRecordCount() > 0)
                        {
                            string patientCode = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM();
                            new Update(KcbLuotkham.Schema)
                                .Set(KcbLuotkham.Columns.MaLuotkham).EqualTo(patientCode)
                                .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan)
                                .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham).Execute();
                            objLuotkham.MaLuotkham = patientCode;
                        }
                        //Đoạn này Rem lại vì ko có ý nghĩa ngoại trú
                        //if (objLuotkham.TrangThai >= 1)
                        //{
                        //    SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema).Where(
                        //        KcbLuotkham.Columns.MaLuotkham).IsNotEqualTo(objLuotkham.MaLuotkham)
                        //        .And(KcbLuotkham.Columns.SoBenhAn).IsEqualTo(objLuotkham.SoBenhAn)
                        //        .And(KcbLuotkham.Columns.TrangThai).IsGreaterThanOrEqualTo(1);

                        //    if (sqlQuery.GetRecordCount() > 0)
                        //    {
                        //        new Update(KcbLuotkham.Schema)
                        //            .Set(KcbLuotkham.Columns.SoBenhAn).EqualTo(THU_VIEN_CHUNG.LaySoBenhAn())
                        //            .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham).
                        //            Execute();
                        //    }

                        //}
                        if (objRegExam != null)//Đôi lúc người dùng không chọn phòng khám
                        {
                            objRegExam.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham);
                            objRegExam.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan);
                            id_kham = AddRegExam(objRegExam, objLuotkham, false, KieuKham);
                        }

                        scope.Complete();
                        return ActionResult.Success;
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error("loi trong qua trinh cap nhap thong tin them moi thong tin benh nhan tiep don {0}", ex);
                return ActionResult.Error;
            }
        }
Пример #27
0
        /// <summary>
        /// hàm thực hiện việc lấy số khám của bệnh nhân
        /// </summary>
        /// <param name="status"></param>
        private void LaySokham(int status)
        {
            try
            {
                if (PropertyLib._HISQMSProperties.TestMode || b_HasSecondScreen)
                {
                    int sokham = Utility.Int32Dbnull(txtSoKham.Text);
                    QMS_IdDichvuKcb = -1;
                    string sSoKham = Utility.sDbnull(sokham);
                    if (!globalVariables.b_QMS_Stop)
                    {
                        if (globalVariables.MA_KHOA_THIEN == "KYC")
                        {
                            _KCB_QMS.LaySoKhamQMS(PropertyLib._HISQMSProperties.MaQuay, globalVariables.MA_KHOA_THIEN, PropertyLib._HISQMSProperties.MaDoituongKCB, ref sokham, ref QMS_IdDichvuKcb, 0);
                        }
                        else//Các khoa khác
                        {
                            int isUuTien = 0;
                            if (PropertyLib._HISQMSProperties.Chopheplaysouutien)
                            {
                                SqlQuery sqlQuery1 = new Select().From(KcbQm.Schema)
                                    .Where(KcbQm.Columns.MaKhoakcb).IsEqualTo(globalVariables.MA_KHOA_THIEN)
                                    .And(KcbQm.Columns.TrangThai).IsEqualTo(0)
                                    .AndExpression(KcbQm.Columns.MaDoituongKcb).IsEqualTo("ALL").Or(KcbQm.Columns.MaDoituongKcb).IsEqualTo(PropertyLib._HISQMSProperties.MaDoituongKCB).CloseExpression()
                                    .And(KcbQm.Columns.LoaiQms).IsEqualTo(1);
                                isUuTien = sqlQuery1.GetRecordCount() > 0 ? 1 : 0;
                            }
                            if (PropertyLib._HISQMSProperties.Chilaysouutien)
                                isUuTien = 1;
                            if (!PropertyLib._HISQMSProperties.Chopheplaysouutien)
                                isUuTien = 0;
                            chkUuTien.Checked = isUuTien == 1;
                            Utility.SetMsg(lblThongbaouutien, isUuTien == 1 ? "ĐỐI TƯỢNG ƯU TIÊN" : "ĐỐI TƯỢNG THƯỜNG", isUuTien == 1);
                            _KCB_QMS.LaySoKhamQMS(PropertyLib._HISQMSProperties.MaQuay, globalVariables.MA_KHOA_THIEN, PropertyLib._HISQMSProperties.MaDoituongKCB, ref sokham, ref QMS_IdDichvuKcb, isUuTien);
                        }
                    }
                    if (sokham < 10)
                    {
                        sSoKham = Utility.FormatNumberToString(sokham, "00");
                    }
                    else
                    {
                        sSoKham = Utility.sDbnull(sokham);
                    }

                    int tongso = Utility.Int32Dbnull(txtTS.Text);
                    string sTongSo = Utility.sDbnull(tongso);
                    //Lấy tổng số QMS của khoa trong ngày
                    StoredProcedure sp = SPs.QmsGetQMSCount(globalVariables.MA_KHOA_THIEN, PropertyLib._HISQMSProperties.MaDoituongKCB, tongso,0);
                    sp.Execute();
                    tongso = Utility.Int32Dbnull(sp.OutputValues[0]);
                    int tongsoUuTien = 0;
                    //Lấy tổng số QMS ưu tiên của khoa trong ngày
                    sp = SPs.QmsGetQMSCount(globalVariables.MA_KHOA_THIEN, "ALL", tongsoUuTien, 1);
                    sp.Execute();
                    tongsoUuTien = Utility.Int32Dbnull(sp.OutputValues[0]);
                    if (!PropertyLib._HISQMSProperties.Chopheplaysouutien)
                        tongsoUuTien = 0;
                    int Total = tongso + tongsoUuTien;
                    if (PropertyLib._HISQMSProperties.Chilaysouutien)
                        Total = tongsoUuTien;
                    txtSoKham.Text = Utility.sDbnull(sSoKham);
                    if (Total < 10)
                    {
                        sSoKham = Utility.FormatNumberToString(Total, "00");
                    }
                    else
                    {
                        sSoKham = Utility.sDbnull(Total);
                    }

                    txtTS.Text = Utility.sDbnull(sSoKham);
                }
            }
            catch(Exception ex)
            {
            }
        }
Пример #28
0
        public void THEM_PHI_DVU_KYC(KcbLuotkham objLuotkham, KcbDangkyKcb objregexam)
        {
            using (var scope = new TransactionScope())
            {
                DmucPhikemtheoCollection lstPhikemtheo = new Select().From(DmucPhikemtheo.Schema).Where(DmucPhikemtheo.IdKhoakcbColumn).IsEqualTo(objregexam.IdKhoakcb).ExecuteAsCollection<DmucPhikemtheoCollection>();
                if (lstPhikemtheo != null && lstPhikemtheo.Count > 0)
                {
                    if (Utility.Int32Dbnull(lstPhikemtheo[0].IdPhikemtheo, -1) > 0)
                    {

                        SqlQuery sql = new Select().From(KcbDangkyKcb.Schema).Where(KcbDangkyKcb.Columns.MaLuotkham).
                            IsEqualTo(objLuotkham.MaLuotkham)
                            .And(KcbDangkyKcb.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan).And(
                                KcbDangkyKcb.Columns.LaPhidichvukemtheo).IsEqualTo(1)
                                .And(KcbDangkyKcb.Columns.IdCha).IsEqualTo(objregexam.IdKham);
                        if (sql.GetRecordCount() > 0)//Chỉ được 1 lần phí dịch vụ kèm theo
                        {
                            return;
                        }
                        int IdDv = -1;
                        //Mã ưu tiên của một số đối tượng BHYT ko cần trả phí dịch vụ kèm theo(hiện tại là có mã quyền lợi 1,2,3)
                        string[] maUuTienKkb = globalVariables.gv_strMaUutien.Split(',');

                        if (globalVariables.MA_KHOA_THIEN != "KYC")
                        {
                            if (THU_VIEN_CHUNG.IsNgoaiGio())
                            {
                                IdDv = Utility.Int32Dbnull(lstPhikemtheo[0].IdPhikemtheongoaigio, -1);
                            }
                            else//Khám trong giờ cần xét đối tượng ưu tiên
                            {
                                //var query= from loz in Ma_UuTien.
                                if (!maUuTienKkb.Contains(Utility.sDbnull(objLuotkham.MaQuyenloi, "0")))
                                {
                                    IdDv = Utility.Int32Dbnull(lstPhikemtheo[0].IdPhikemtheo, -1);
                                }
                                else
                                {
                                    IdDv = -1;
                                }
                            }
                        }
                        else//Khám yêu cầu thì luôn bị tính phí dịch vụ kèm theo
                        {
                            IdDv = Utility.Int32Dbnull(lstPhikemtheo[0].IdPhikemtheo, -1);
                        }
                        DmucDichvuclsChitiet lServiceDetail = DmucDichvuclsChitiet.FetchByID(IdDv);
                        long reg_id = objregexam.IdKham;
                        if (lServiceDetail != null)
                        {
                            objregexam.DonGia = lServiceDetail.DonGia.Value;
                            objregexam.PhuThu = 0;
                            objregexam.BhytChitra = 0;
                            objregexam.BnhanChitra = lServiceDetail.DonGia;
                            objregexam.IdCha = reg_id;
                            objregexam.TrangThai = 0;
                            objregexam.SttKham = -1;
                            objregexam.TenDichvuKcb = "Phí dịch vụ kèm theo";
                            objregexam.MaKhoaThuchien = globalVariables.MA_KHOA_THIEN;
                            objregexam.TuTuc = 0;
                            objregexam.KhamNgoaigio = 0;
                            objregexam.LaPhidichvukemtheo = 1;
                            objregexam.IsNew = true;
                            objregexam.Save();
                        }
                    }
                }
                scope.Complete();

            }
        }
Пример #29
0
        private bool IsValidChiphithem()
        {
            bool b_Cancel = false;
            if (grdChiphithem.GetCheckedRows().Length <= 0)
            {
                Utility.ShowMsg("Bạn phải chọn một bản ghi thực hiện xóa chi phí thêm", "Thông báo",
                                MessageBoxIcon.Warning);
                grdChiphithem.Focus();
                return false;
            }

            foreach (GridEXRow gridExRow in grdChiphithem.GetCheckedRows())
            {
                int AssignDetail_ID = Utility.Int32Dbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.IdChitietchidinh].Value,
                                                          -1);
                SqlQuery sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema)
                    .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(AssignDetail_ID)
                    .And(KcbChidinhclsChitiet.Columns.TrangthaiThanhtoan).IsEqualTo(1);
                if (sqlQuery.GetRecordCount() > 0)
                {
                    b_Cancel = true;
                    break;
                }
            }
            if (b_Cancel)
            {
                Utility.ShowMsg("Chi phí thêm bạn chọn đã thanh toán nên không thể xóa. Mời bạn chọn lại !", "Thông báo",
                                MessageBoxIcon.Warning);
                return false;
            }

            return true;
        }
Пример #30
0
        /// <summary>
        /// HAM THUC HIEN HIEN THEM LAN KHAM CUA BENH NHAN
        /// </summary>
        /// <param name="objPatientInfo"></param>
        /// <param name="objLuotkham"></param>
        /// <returns></returns>
        public ActionResult AddNewPatientExam(KcbDanhsachBenhnhan objPatientInfo, KcbLuotkham objLuotkham,  ref string MaLuotkham)
        {
            try
            {
                using (var scope = new TransactionScope())
                {
                    using (var dbscope = new SharedDbConnectionScope())
                    {
                        UpdatePatientInfo(objPatientInfo);
                        SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema)
                           .Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan)
                           .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham);
                        if (sqlQueryPatientExam.GetRecordCount() > 0)
                        {

                            objLuotkham.MaLuotkham = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM();

                        }
                        objLuotkham.IsNew = true;
                        objLuotkham.Save();
                        if (objLuotkham.TrangthaiNoitru >= 1)
                        {
                            SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema).Where(
                                KcbLuotkham.Columns.MaLuotkham).IsNotEqualTo(objLuotkham.MaLuotkham)
                                .And(KcbLuotkham.Columns.SoBenhAn).IsEqualTo(objLuotkham.SoBenhAn)
                                .And(KcbLuotkham.Columns.TrangthaiNoitru).IsGreaterThanOrEqualTo(1);

                            if (sqlQuery.GetRecordCount() > 0)
                            {
                                new Update(KcbLuotkham.Schema)
                                    .Set(KcbLuotkham.Columns.SoBenhAn).EqualTo(THU_VIEN_CHUNG.LaySoBenhAn())
                                    .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham).
                                    Execute();
                            }

                        }
                        log.Info("Them moi lan kham cho benh nhan Patient_Code=" + objLuotkham.MaLuotkham);
                        //if (!string.IsNullOrEmpty(patientDept.MaLuotkham))
                        //{
                        //    if (objLuotkham.DepartmentId != -1)
                        //    {
                        //        patientDept.MaLuotkham = objLuotkham.MaLuotkham;
                        //        patientDept.IdBenhnhan = objPatientInfo.IdBenhnhan;
                        //        SqlQuery q = new Select().From(TPatientDept.Schema)
                        //            .Where(TPatientDept.Columns.DepartmentId).IsEqualTo(objLuotkham.DepartmentId)
                        //            .And(TPatientDept.Columns.MaLuotkham).IsEqualTo(patientDept.MaLuotkham)
                        //            .And(TPatientDept.Columns.IdBenhnhan).IsEqualTo(patientDept.IdBenhnhan)
                        //            .And(TPatientDept.Columns.Noitru).IsEqualTo(1);

                        //        if (q.GetRecordCount() <= 0)
                        //        {
                        //            log.Info("them moi thong tin cua khoa phong Department_ID=" + patientDept.DepartmentId);
                        //            patientDept.TrangThai = 0;
                        //            patientDept.IsNew = true;
                        //            patientDept.Save();
                        //        }
                        //        else
                        //        {
                        //            new Update(TPatientDept.Schema)
                        //                .Set(TPatientDept.Columns.DepartmentId).EqualTo(patientDept.DepartmentId)
                        //                .Set(TPatientDept.Columns.NguoiSua).EqualTo(patientDept.NguoiSua)
                        //                .Set(TPatientDept.Columns.NgaySua).EqualTo(patientDept.NgaySua)
                        //                .Where(TPatientDept.Columns.MaLuotkham).IsEqualTo(patientDept.MaLuotkham)
                        //                .And(TPatientDept.Columns.IdBenhnhan).IsEqualTo(patientDept.IdBenhnhan)
                        //                .And(TPatientDept.Columns.DepartmentId).IsEqualTo(objLuotkham.DepartmentId)
                        //                .Execute();
                        //        }
                        //    }
                        //}
                        MaLuotkham = objLuotkham.MaLuotkham;
                        scope.Complete();
                        return ActionResult.Success;
                    }
                }
            }
            catch (Exception ex)
            {
                return ActionResult.Error;
            }
        }