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(); } } } }
/// <summary> /// hàm thực hiện việc lấy màu của hệ thống /// </summary> /// <returns></returns> public static string GetSysColor() { SqlQuery q = new Select().From(SysFormColor.Schema) .Where(SysFormColor.Columns.SystemColorId).IsEqualTo(1); string SysColor = ""; SysFormColor objSystemParameter = q.ExecuteSingle<SysFormColor>(); if (objSystemParameter != null) { SysColor = Utility.sDbnull(objSystemParameter.ColorValue); } return SysColor; }
public static void CreateManagementUnit() { SqlQuery q = new Select().From(SysManagementUnit.Schema); var objManagementUnit = q.ExecuteSingle<SysManagementUnit>(); if (objManagementUnit != null) { globalVariables.ParentBranch_Name = objManagementUnit.SParentBranchName; globalVariables.Branch_Name = objManagementUnit.SName; globalVariables.Branch_Phone = objManagementUnit.SPhone; globalVariables.Branch_Address = objManagementUnit.SAddress; } }
public static void LayThongTinGia(NoitruPhanbuonggiuong objPhanbuonggiuong, KcbLuotkham objPatientExam) { objPhanbuonggiuong.TuTuc = 0; SqlQuery sqlQuery = new Select().From<NoitruQheDoituongBuonggiuong>() .Where(NoitruQheDoituongBuonggiuong.Columns.IdGiuong).IsEqualTo(objPhanbuonggiuong.IdGiuong) .And(NoitruQheDoituongBuonggiuong.Columns.MaDoituongKcb).IsEqualTo(objPatientExam.MaDoituongKcb); NoitruQheDoituongBuonggiuong objRoomBedObjectType = sqlQuery.ExecuteSingle<NoitruQheDoituongBuonggiuong>(); if (objRoomBedObjectType != null) { objPhanbuonggiuong.DonGia = Utility.DecimaltoDbnull(objRoomBedObjectType.DonGia); objPhanbuonggiuong.PhuThu = Utility.Byte2Bool(objPatientExam.DungTuyen) ? Utility.DecimaltoDbnull(objRoomBedObjectType.PhuthuDungtuyen) : Utility.DecimaltoDbnull(objRoomBedObjectType.PhuthuTraituyen); NoitruDmucGiuongbenh objLBed = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong); { objPhanbuonggiuong.TuTuc = objLBed.TthaiTunguyen; objPhanbuonggiuong.TenHienthi = Utility.sDbnull(objLBed.TenGiuong); objPhanbuonggiuong.GiaGoc = Utility.DecimaltoDbnull(objLBed.DonGia); objPhanbuonggiuong.KieuThue = "GIUONG"; } } else { NoitruDmucGiuongbenh objLBed = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong); if (objLBed != null) { objPhanbuonggiuong.TenHienthi = Utility.sDbnull(objLBed.TenGiuong); objPhanbuonggiuong.DonGia = Utility.DecimaltoDbnull(objLBed.DonGia); objPhanbuonggiuong.PhuThu = Utility.DecimaltoDbnull(0); objPhanbuonggiuong.TuTuc = objLBed.TthaiTunguyen; objPhanbuonggiuong.KieuThue = "GIUONG"; objPhanbuonggiuong.GiaGoc = Utility.DecimaltoDbnull(objLBed.DonGia); if (!THU_VIEN_CHUNG.IsBaoHiem( objPatientExam.IdLoaidoituongKcb)) { objPhanbuonggiuong.TuTuc = 0; } } } objPhanbuonggiuong.TrongGoi = 0;// Utility.ByteDbnull(objPhanbuonggiuong.TrongGoi); if (objPhanbuonggiuong.IdGiuong > 0 || objPhanbuonggiuong.IdBuong > 0)//Có giường thì mới tính TinhToanPtramBHYT.TinhPhanTramBHYT(objPhanbuonggiuong,objPatientExam, Utility.DecimaltoDbnull(objPatientExam.PtramBhytGoc)); }
public void XuLyChiKhauDacBietBHYT(KcbLuotkham objLuotkham, decimal v_DiscountRate) { KcbThanhtoanCollection paymentCollection = new KcbThanhtoanController().FetchByQuery( KcbThanhtoan.CreateQuery().AddWhere(KcbThanhtoan.Columns.MaLuotkham, Comparison.Equals, objLuotkham.MaLuotkham).AND(KcbThanhtoan.Columns.IdBenhnhan, Comparison.Equals, objLuotkham.IdBenhnhan)); foreach (KcbThanhtoan payment in paymentCollection) { KcbThanhtoanChitietCollection paymentDetailCollection = new KcbThanhtoanChitietController().FetchByQuery( KcbThanhtoanChitiet.CreateQuery().AddWhere(KcbThanhtoanChitiet.Columns.IdThanhtoan, Comparison.Equals, payment.IdThanhtoan).AND( KcbThanhtoanChitiet.Columns.TuTuc, Comparison.Equals, 0)); string IsDungTuyen = "DT"; DmucDoituongkcb objectType = DmucDoituongkcb.FetchByID(objLuotkham.IdDoituongKcb); if (objectType != null) { switch (objectType.MaDoituongKcb) { case "BHYT": if (Utility.Int32Dbnull(objLuotkham.DungTuyen, "0") == 1) IsDungTuyen = "DT"; else { IsDungTuyen = "TT"; } break; default: IsDungTuyen = "KHAC"; break; } } foreach (KcbThanhtoanChitiet PaymentDetail in paymentDetailCollection) { SqlQuery sqlQuery = new Select().From(DmucBhytChitraDacbiet.Schema) .Where(DmucBhytChitraDacbiet.Columns.IdDichvuChitiet).IsEqualTo(PaymentDetail.IdChitietdichvu) .And(DmucBhytChitraDacbiet.Columns.MaLoaithanhtoan).IsEqualTo(PaymentDetail.IdLoaithanhtoan) .And(DmucBhytChitraDacbiet.Columns.DungtuyenTraituyen).IsEqualTo(IsDungTuyen) .And(DmucBhytChitraDacbiet.Columns.MaDoituongKcb).IsEqualTo(objLuotkham.MaDoituongKcb); DmucBhytChitraDacbiet objDetailDiscountRate = sqlQuery.ExecuteSingle<DmucBhytChitraDacbiet>(); if (objDetailDiscountRate != null) { log.Info("Neu trong ton tai trong bang cau hinh chi tiet chiet khau void Id_Chitiet=" + PaymentDetail.IdChitiet); PaymentDetail.PtramBhyt = objDetailDiscountRate.TileGiam; PaymentDetail.BhytChitra = THU_VIEN_CHUNG.TinhBhytChitra(objDetailDiscountRate.TileGiam, Utility.DecimaltoDbnull( PaymentDetail.DonGia, 0)); PaymentDetail.BnhanChitra = THU_VIEN_CHUNG.TinhBnhanChitra(objDetailDiscountRate.TileGiam, Utility.DecimaltoDbnull( PaymentDetail.DonGia, 0)); } else { PaymentDetail.PtramBhyt = v_DiscountRate; PaymentDetail.BhytChitra = THU_VIEN_CHUNG.TinhBhytChitra(v_DiscountRate, Utility.DecimaltoDbnull( PaymentDetail.DonGia, 0)); PaymentDetail.BnhanChitra = THU_VIEN_CHUNG.TinhBnhanChitra(v_DiscountRate, Utility.DecimaltoDbnull( PaymentDetail.DonGia, 0)); } log.Info("Thuc hien viec cap nhap thong tin lai gia can phai xem lại gia truoc khi thanh toan"); } } }
public static void LayThongTinGia(NoitruPhanbuonggiuong objPhanbuonggiuong, KcbLuotkham objPatientExam) { objPhanbuonggiuong.TuTuc = 0; NoitruGiabuonggiuong objGia=NoitruGiabuonggiuong.FetchByID(objPhanbuonggiuong.IdGia); if (THU_VIEN_CHUNG.Laygiatrithamsohethong("NOITRU_APGIABUONGGIUONG_THEODANHMUCGIA", "0", true) == "0") objGia = null; NoitruDmucGiuongbenh objGiuong = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong); if(objGia!=null) { objPhanbuonggiuong.DonGia = (objPatientExam.MaDoituongKcb == "DV" ? Utility.DecimaltoDbnull(objGia.GiaDichvu) : (objPatientExam.MaDoituongKcb == "BHYT" ? Utility.DecimaltoDbnull(objGia.GiaBhyt) : Utility.DecimaltoDbnull(objGia.GiaKhac))); objPhanbuonggiuong.PhuThu = (objPatientExam.MaDoituongKcb == "BHYT" ? (Utility.Byte2Bool(objPatientExam.DungTuyen) ? Utility.DecimaltoDbnull(objGia.PhuthuDungtuyen) : Utility.DecimaltoDbnull(objGia.PhuthuTraituyen)) : 0); objPhanbuonggiuong.TuTuc = objGiuong.TthaiTunguyen; objPhanbuonggiuong.TenHienthi = Utility.sDbnull(objGiuong.TenGiuong); objPhanbuonggiuong.GiaGoc = objPhanbuonggiuong.DonGia; objPhanbuonggiuong.KieuThue = "GIUONG"; } else if (objGiuong != null) { objPhanbuonggiuong.DonGia = (objPatientExam.MaDoituongKcb == "DV" ? Utility.DecimaltoDbnull(objGiuong.GiaDichvu) : (objPatientExam.MaDoituongKcb == "BHYT" ? Utility.DecimaltoDbnull(objGiuong.GiaBhyt) : Utility.DecimaltoDbnull(objGiuong.GiaKhac))); objPhanbuonggiuong.PhuThu =(objPatientExam.MaDoituongKcb == "BHYT"? (Utility.Byte2Bool(objPatientExam.DungTuyen) ? Utility.DecimaltoDbnull(objGiuong.PhuthuDungtuyen) : Utility.DecimaltoDbnull(objGiuong.PhuthuTraituyen)):0); objPhanbuonggiuong.TuTuc = objGiuong.TthaiTunguyen; objPhanbuonggiuong.TenHienthi = Utility.sDbnull(objGiuong.TenGiuong); objPhanbuonggiuong.GiaGoc = objPhanbuonggiuong.DonGia; objPhanbuonggiuong.KieuThue = "GIUONG"; } else//Tìm vào các bảng quan hệ { SqlQuery sqlQuery = new Select().From<NoitruQheDoituongBuonggiuong>() .Where(NoitruQheDoituongBuonggiuong.Columns.IdGiuong).IsEqualTo(objPhanbuonggiuong.IdGiuong) .And(NoitruQheDoituongBuonggiuong.Columns.MaDoituongKcb).IsEqualTo(objPatientExam.MaDoituongKcb); NoitruQheDoituongBuonggiuong objQhe = sqlQuery.ExecuteSingle<NoitruQheDoituongBuonggiuong>(); if (objQhe != null) { objPhanbuonggiuong.DonGia = Utility.DecimaltoDbnull(objQhe.DonGia); objPhanbuonggiuong.PhuThu = Utility.Byte2Bool(objPatientExam.DungTuyen) ? Utility.DecimaltoDbnull(objQhe.PhuthuDungtuyen) : Utility.DecimaltoDbnull(objQhe.PhuthuTraituyen); NoitruDmucGiuongbenh objLBed = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong); { objPhanbuonggiuong.TuTuc = objLBed.TthaiTunguyen; objPhanbuonggiuong.TenHienthi = Utility.sDbnull(objLBed.TenGiuong); objPhanbuonggiuong.GiaGoc = Utility.DecimaltoDbnull(objLBed.GiaDichvu); objPhanbuonggiuong.KieuThue = "GIUONG"; } } else { NoitruDmucGiuongbenh objLBed = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong); if (objLBed != null) { objPhanbuonggiuong.TenHienthi = Utility.sDbnull(objLBed.TenGiuong); objPhanbuonggiuong.DonGia = Utility.DecimaltoDbnull(objLBed.GiaDichvu); objPhanbuonggiuong.PhuThu = Utility.DecimaltoDbnull(0); objPhanbuonggiuong.TuTuc = objLBed.TthaiTunguyen; objPhanbuonggiuong.KieuThue = "GIUONG"; objPhanbuonggiuong.GiaGoc = Utility.DecimaltoDbnull(objLBed.GiaDichvu); if (!THU_VIEN_CHUNG.IsBaoHiem(objPatientExam.IdLoaidoituongKcb)) { objPhanbuonggiuong.TuTuc = 0; } } } } if (!THU_VIEN_CHUNG.IsBaoHiem(objPatientExam.IdLoaidoituongKcb)) { objPhanbuonggiuong.TuTuc = 0; } objPhanbuonggiuong.TrongGoi = 0; if (objPhanbuonggiuong.IdGiuong > 0 || objPhanbuonggiuong.IdBuong > 0)//Có giường thì mới tính TinhToanPtramBHYT.TinhPhanTramBHYT(objPhanbuonggiuong,objPatientExam, Utility.DecimaltoDbnull(objPatientExam.PtramBhytGoc)); }
public ActionResult UpdateLanKham(KcbDanhsachBenhnhan objPatientInfo, KcbLuotkham objLuotkham, KcbDangkyKcb objRegExam, int KieuKham, decimal PtramBhytCu, decimal PtramBhytgoc ) { ActionResult _ActionResult = ActionResult.Success; try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { SqlQuery query = new Select().From(KcbLuotkham.Schema).Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo( objLuotkham.MaLuotkham).And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo( objLuotkham.IdBenhnhan); KcbLuotkham objExam = query.ExecuteSingle<KcbLuotkham>(); UpdatePatientInfo(objPatientInfo); //decimal PtramBHYT = THU_VIEN_CHUNG.TinhPtramBHYT(objLuotkham); //if (PtramBHYT != Utility.DecimaltoDbnull(objLuotkham.PtramBhyt)) //{ // objLuotkham.PtramBhyt = PtramBHYT; //} objLuotkham.MarkOld(); objLuotkham.IsNew = false; objLuotkham.Save(); //int recordExam = new Update(KcbLuotkham.Schema) // .Set(KcbLuotkham.Columns.NguoiLienhe).EqualTo(objLuotkham.NguoiLienhe) // .Set(KcbLuotkham.Columns.TrangthaiCapcuu).EqualTo(objLuotkham.TrangthaiCapcuu) // .Set(KcbLuotkham.Columns.LuongCoban).EqualTo(objLuotkham.LuongCoban) // .Set(KcbLuotkham.Columns.TthaiChuyendi).EqualTo(objLuotkham.TthaiChuyendi) // .Set(KcbLuotkham.Columns.DienthoaiLienhe).EqualTo(objLuotkham.DienthoaiLienhe) // .Set(KcbLuotkham.Columns.DiachiLienhe).EqualTo(objLuotkham.DiachiLienhe) // .Set(KcbLuotkham.Columns.TrieuChung).EqualTo(objLuotkham.TrieuChung) // .Set(KcbLuotkham.Columns.MatheBhyt).EqualTo(objLuotkham.MatheBhyt) // .Set(KcbLuotkham.Columns.MaNoicapBhyt).EqualTo(objLuotkham.MaNoicapBhyt) // .Set(KcbLuotkham.Columns.MaQuyenloi).EqualTo(objLuotkham.MaQuyenloi) // .Set(KcbLuotkham.Columns.NgaybatdauBhyt).EqualTo(objLuotkham.NgaybatdauBhyt) // .Set(KcbLuotkham.Columns.NgayketthucBhyt).EqualTo(objLuotkham.NgayketthucBhyt) // .Set(KcbLuotkham.Columns.NoicapBhyt).EqualTo(objLuotkham.NoicapBhyt) // .Set(KcbLuotkham.Columns.IdDoituongKcb).EqualTo(objLuotkham.IdDoituongKcb) // .Set(KcbLuotkham.Columns.IdLoaidoituongKcb).EqualTo(objLuotkham.IdLoaidoituongKcb) // .Set(KcbLuotkham.Columns.TrangthaiNgoaitru).EqualTo(objLuotkham.TrangthaiNgoaitru) // .Set(KcbLuotkham.Columns.MaKcbbd).EqualTo(objLuotkham.MaKcbbd) // .Set(KcbLuotkham.Columns.NoiDongtrusoKcbbd).EqualTo(objLuotkham.NoiDongtrusoKcbbd) // .Set(KcbLuotkham.Columns.MaDoituongBhyt).EqualTo(objLuotkham.MaDoituongBhyt) // .Set(KcbLuotkham.Columns.IdKhoatiepnhan).EqualTo(objLuotkham.IdKhoatiepnhan) // .Set(KcbLuotkham.Columns.DungTuyen).EqualTo(objLuotkham.DungTuyen) // .Set(KcbLuotkham.Columns.NgayTiepdon).EqualTo(objLuotkham.NgayTiepdon) // .Set(KcbLuotkham.Columns.MaDoituongKcb).EqualTo(objLuotkham.MaDoituongKcb) // .Set(KcbLuotkham.Columns.MaKhoaThuchien).EqualTo(objLuotkham.MaKhoaThuchien) // .Set(KcbLuotkham.Columns.NguoiSua).EqualTo(globalVariables.UserName) // .Set(KcbLuotkham.Columns.NgaySua).EqualTo(globalVariables.SysDate) // .Set(KcbLuotkham.Columns.PtramBhyt).EqualTo(objLuotkham.PtramBhyt) // .Set(KcbLuotkham.Columns.SoBenhAn).EqualTo(objLuotkham.SoBenhAn) // .Set(KcbLuotkham.Columns.DiaChi).EqualTo(objLuotkham.DiaChi) // .Set(KcbLuotkham.Columns.DiachiBhyt).EqualTo(objLuotkham.DiachiBhyt) // .Set(KcbLuotkham.Columns.Cmt).EqualTo(objLuotkham.Cmt) // .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham) // .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan) // .Execute(); //Kiểm tra nếu % bị thay đổi thì cập nhật lại tất cả các bảng if (PtramBhytCu != Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) || PtramBhytgoc != Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0)) _ActionResult= THU_VIEN_CHUNG.UpdatePtramBHYT(objLuotkham, -1); if (_ActionResult == ActionResult.Cancel)//Báo không cho phép thay đổi phần trăm BHYT do đã có dịch vụ đã thanh toán { return _ActionResult; } 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) { log.Error("Loi trong qua trinh update thong tin benh nhan {0}", ex); return ActionResult.Error; } }
public static short GetDepartmentID(string sUserName) { short vDepartment_Id = -1; try { SqlQuery sqlQuery = new Select().From(LStaff.Schema).Where(LStaff.Columns.Uid).IsEqualTo(sUserName); LStaff objStaff = sqlQuery.ExecuteSingle<LStaff>(); if (objStaff != null) { vDepartment_Id = objStaff.DepartmentId; } } catch (Exception ex) { vDepartment_Id = -1; } return vDepartment_Id; }
private void SaveQheDoituongDichvuCSL() { try { foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdList.GetRows()) { SqlQuery q = new Select().From(QheDoituongThuoc.Schema).Where(QheDoituongThuoc.Columns.IdThuoc). IsEqualTo(Utility.DecimaltoDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.IdThuoc].Value, -1)).And( QheDoituongThuoc.Columns.IdLoaidoituongKcb).IsEqualTo( Utility.Int32Dbnull(gridExRow.Cells[DmucDoituongkcb.Columns.IdLoaidoituongKcb].Value, -1)); if (q.GetRecordCount() > 0) { new Update(QheDoituongThuoc.Schema) .Set(QheDoituongThuoc.Columns.NgaySua).EqualTo(globalVariables.SysDate) .Set(QheDoituongThuoc.Columns.NguoiSua).EqualTo(globalVariables.UserName) .Set(QheDoituongThuoc.Columns.IdLoaithuoc).EqualTo( Utility.Int32Dbnull(gridExRow.Cells[QheDoituongThuoc.Columns.IdLoaithuoc].Value, -1)) .Set(QheDoituongThuoc.Columns.DonGia).EqualTo( Utility.DecimaltoDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.DonGia].Value, 0)) .Set(QheDoituongThuoc.Columns.PhuthuDungtuyen).EqualTo( Utility.DecimaltoDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.PhuthuDungtuyen].Value, 0)) .Set(QheDoituongThuoc.Columns.PhuthuTraituyen).EqualTo( Utility.DecimaltoDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.PhuthuTraituyen].Value, 0)) .Set(QheDoituongThuoc.Columns.MaKhoaThuchien).EqualTo(Utility.sDbnull(cboKhoaTH.SelectedValue, "")) .Where(QheDoituongThuoc.Columns.IdThuoc).IsEqualTo(id_thuoc) .And(QheDoituongThuoc.Columns.IdLoaidoituongKcb).IsEqualTo( Utility.Int32Dbnull(gridExRow.Cells[DmucDoituongkcb.Columns.IdLoaidoituongKcb].Value, -1)).Execute(); } else { new QheDoituongThuocController().Insert(-1, Utility.Int16Dbnull( gridExRow.Cells[QheDoituongThuoc.Columns.IdLoaithuoc].Value, -1), Utility.Int32Dbnull( gridExRow.Cells[QheDoituongThuoc.Columns.IdThuoc].Value, -1), 0,"%", Utility.DecimaltoDbnull( gridExRow.Cells[QheDoituongThuoc.Columns.DonGia].Value, 0), Utility.DecimaltoDbnull( gridExRow.Cells[QheDoituongThuoc.Columns.PhuthuDungtuyen].Value, 0), Utility.Int32Dbnull( gridExRow.Cells[DmucDoituongkcb.Columns.IdLoaidoituongKcb].Value, -1), Utility.DecimaltoDbnull( gridExRow.Cells[QheDoituongThuoc.Columns.PhuthuTraituyen].Value, 0), "", globalVariables.UserName, globalVariables.SysDate, null, null, Utility.sDbnull(cboKhoaTH.SelectedValue, "")); } SqlQuery sqlQuery = new Select().From(DmucDoituongkcb.Schema) .Where(DmucDoituongkcb.Columns.IdLoaidoituongKcb).IsEqualTo(1); DmucDoituongkcb objectType = sqlQuery.ExecuteSingle<DmucDoituongkcb>(); if (objectType != null && objectType.MaDoituongKcb == "DV") { new Update(DmucThuoc.Schema) .Set(DmucThuoc.Columns.DonGia) .EqualTo(Utility.DecimaltoDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.DonGia].Value, 0)) .Where(DmucThuoc.Columns.IdThuoc) .IsEqualTo(Utility.Int32Dbnull(gridExRow.Cells[QheDoituongThuoc.Columns.IdThuoc].Value, -1)).Execute(); } } Utility.ShowMsg("Bạn thực hiện cập nhập giá thành công", "Thông báo"); } catch (Exception exception) { Utility.ShowMsg("Lỗi trong quá trình cập nhập thông tin", "Thông báo lỗi", MessageBoxIcon.Error); } }
/// <summary> /// hàm thực hiện lấy tham số hệ thống /// </summary> /// <param name="sName"></param> /// <returns></returns> public static SysSystemParameter GetSysParamater(string sName) { SqlQuery sqlQuery = new Select().From(SysSystemParameter.Schema) .Where(SysSystemParameter.Columns.SName).IsEqualTo(sName); SysSystemParameter objParameter = sqlQuery.ExecuteSingle<SysSystemParameter>(); return objParameter; }
/// <summary> /// hàm thực hiện lấy thông tin của lương cơ bản /// </summary> /// <returns></returns> public static decimal GetLuongCoBan() { decimal BASICSALARY = 83000; SqlQuery q = new Select().From(SysSystemParameter.Schema) .Where(SysSystemParameter.Columns.SName).IsEqualTo("BASICSALARY"); SysSystemParameter objSysSystemParameter = q.ExecuteSingle<SysSystemParameter>(); if (objSysSystemParameter != null) { BASICSALARY = Utility.DecimaltoDbnull(objSysSystemParameter.SValue, 0); } return BASICSALARY; }
public static TThongtinGoiDvuBnhan LayThongTinGoiNgoaiTru(TPatientExam objPatientExam) { SqlQuery sqlQuery = new Select().From(TThongtinGoiDvuBnhan.Schema) .Where(TThongtinGoiDvuBnhan.Columns.PatientCode).IsEqualTo(objPatientExam.PatientCode) .And(TThongtinGoiDvuBnhan.Columns.PatientId).IsEqualTo(objPatientExam.PatientId) .And(TThongtinGoiDvuBnhan.Columns.NoiTru).IsEqualTo(0); TThongtinGoiDvuBnhan objThongtinGoiDvuBnhan = sqlQuery.ExecuteSingle<TThongtinGoiDvuBnhan>(); return objThongtinGoiDvuBnhan; }
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 { } }
public static string Laygiatrithamsohethong(string ParamName,string defaultval,bool fromDB) { try { string reval = defaultval; if (fromDB) { SqlQuery sqlQuery = new Select().From(SysSystemParameter.Schema).Where(SysSystemParameter.Columns.SName).IsEqualTo( ParamName); SysSystemParameter objSystemParameter = sqlQuery.ExecuteSingle<SysSystemParameter>(); if (objSystemParameter != null) reval = objSystemParameter.SValue; } else { DataRow[] arrDR = globalVariables.gv_dtSysparams.Select(SysSystemParameter.SNameColumn.ColumnName + " ='" + ParamName + "'"); if (arrDR.Length > 0) reval = Utility.sDbnull(arrDR[0][SysSystemParameter.SValueColumn.ColumnName]); } return reval; } catch { return defaultval; } }
/// <summary> /// HÀM THỰC HIỆN VIỆC KIỂM TRA XEM BÁO CÁO ĐƠN VỊ NÀO /// </summary> /// <returns></returns> public static string LayMaDviLamViec() { SqlQuery q = new Select().From(SysSystemParameter.Schema) .Where(SysSystemParameter.Columns.SName).IsEqualTo("ACCOUNTNAME"); SysSystemParameter objParameter = q.ExecuteSingle<SysSystemParameter>(); if (objParameter != null) return objParameter.SValue; else { return "DETMAY"; } }
public static string GetTieuDeBaoCao(string FormName, string Values) { string TieuDe = ""; SqlQuery sqlQuery = new Select().From(SysTieudeBaocao.Schema) .Where(SysTieudeBaocao.Columns.NguoiTao).IsEqualTo(globalVariables.UserName) .And(SysTieudeBaocao.Columns.TenForm).IsEqualTo(FormName); if (sqlQuery.GetRecordCount() <= 0) { SysTieudeBaocao.Insert(globalVariables.UserName, Values, "", FormName); } SysTieudeBaocao objSysUserPrinter = sqlQuery.ExecuteSingle<SysTieudeBaocao>(); if (objSysUserPrinter != null) TieuDe = Utility.sDbnull(objSysUserPrinter.TieuDe, ""); return TieuDe; }
public static string GetThanhToan_TraiTuyen() { string sPaymentFlow = ""; SqlQuery sqlQuery = new Select().From(SysSystemParameter.Schema) .Where(SysSystemParameter.Columns.SName).IsEqualTo("TRAITUYEN"); SysSystemParameter objSystemParameter = sqlQuery.ExecuteSingle<SysSystemParameter>(); if (objSystemParameter != null) sPaymentFlow = objSystemParameter.SValue; return sPaymentFlow; }
public static string GetThamSo_ThuTu() { string thamso = "MONTH"; SqlQuery sqlQuery = new Select().From(SysSystemParameter.Schema).Where(SysSystemParameter.Columns.SName).IsEqualTo( "ORDEROBJECT"); SysSystemParameter objSystemParameter = sqlQuery.ExecuteSingle<SysSystemParameter>(); if (objSystemParameter != null) thamso = objSystemParameter.SValue; return thamso; }
/// <summary> /// HÀM THỰC HIỆN VIỆC LẤY THÔNG TIN CHIÊT KHẤU /// </summary> /// <returns></returns> private string LayChiKhauChiTiet() { string PTramChiTiet = "KHONG"; SqlQuery sqlQuery = new Select().From(SysSystemParameter.Schema) .Where(SysSystemParameter.Columns.SName).IsEqualTo("PTRAM_CHITIET"); SysSystemParameter objSystemParameter = sqlQuery.ExecuteSingle<SysSystemParameter>(); if (objSystemParameter != null) PTramChiTiet = objSystemParameter.SValue; return PTramChiTiet; }
private void GetNoiDangKy() { SqlQuery sqlQuery = new Select().From(DmucDiachinh.Schema) .Where(DmucDiachinh.Columns.MaDiachinh).IsEqualTo(txtNoiphattheBHYT.Text); var objDiachinh = sqlQuery.ExecuteSingle<DmucDiachinh>(); if (objDiachinh != null) { Utility.SetMsg(lblNoiCapThe, Utility.sDbnull(objDiachinh.TenDiachinh), true); //LoadClinicCode(); } else { lblNoiCapThe.Visible = false; } }
public decimal LayThongPtramBHYT(decimal v_decTotalPrice, KcbLuotkham objLuotkham, ref decimal PtramBHYT) { decimal decDiscountTotalMoney = 0; SqlQuery q; if (!string.IsNullOrEmpty(objLuotkham.MaKcbbd) && THU_VIEN_CHUNG.IsBaoHiem(objLuotkham.IdLoaidoituongKcb.Value)) { ///Kiểm tra xem đối tượng BHYT là đúng tuyến? if (objLuotkham.DungTuyen == 1) { //Đối tượng mã quyền lợi 1,2 được hưởng 100% if (objLuotkham.MaQuyenloi.ToString() == "1" || objLuotkham.MaQuyenloi.ToString() == "2") { decDiscountTotalMoney = 0; PtramBHYT = 100; } else { switch (globalVariables.gv_strTuyenBHYT) { case "TUYEN1"://Kiểm tra so với >15% lương cơ bản if (v_decTotalPrice >= objLuotkham.LuongCoban * 15 / 100) { q = new Select().From(DmucDoituongbhyt.Schema) .Where(DmucDoituongbhyt.Columns.IdDoituongKcb).IsEqualTo(objLuotkham.IdDoituongKcb) .And(DmucDoituongbhyt.Columns.MaDoituongbhyt).IsEqualTo(objLuotkham.MaDoituongBhyt); DmucDoituongbhyt objInsuranceObject = q.ExecuteSingle<DmucDoituongbhyt>(); if (objInsuranceObject != null) { PtramBHYT = Utility.DecimaltoDbnull(objInsuranceObject.PhantramBhyt, 0); decDiscountTotalMoney = v_decTotalPrice * (100 - Utility.DecimaltoDbnull(objInsuranceObject.PhantramBhyt, 0)) / 100; } } else//<15% lương cơ bản-->BHYT trả hết { PtramBHYT = 100; decDiscountTotalMoney = 0; } break; case "TW"://Tuyến trung ương ko cần so sánh với lương cơ bản q = new Select().From(DmucDoituongbhyt.Schema) .Where(DmucDoituongbhyt.Columns.IdDoituongKcb).IsEqualTo(objLuotkham.IdDoituongKcb) .And(DmucDoituongbhyt.Columns.MaDoituongbhyt).IsEqualTo(objLuotkham.MaDoituongBhyt); DmucDoituongbhyt objInsuranceObjectTW = q.ExecuteSingle<DmucDoituongbhyt>(); if (objInsuranceObjectTW != null) { PtramBHYT = Utility.DecimaltoDbnull(objInsuranceObjectTW.PhantramBhyt, 0); decDiscountTotalMoney = v_decTotalPrice * (100 - Utility.DecimaltoDbnull(objInsuranceObjectTW.PhantramBhyt, 0)) / 100; } break; default://Các tuyến khác-->Mặc định giống tuyến 1 if (v_decTotalPrice >= objLuotkham.LuongCoban * 15 / 100) { q = new Select().From(DmucDoituongbhyt.Schema) .Where(DmucDoituongbhyt.Columns.IdDoituongKcb).IsEqualTo(objLuotkham.IdDoituongKcb) .And(DmucDoituongbhyt.Columns.MaDoituongbhyt).IsEqualTo(objLuotkham.MaDoituongBhyt); DmucDoituongbhyt objInsuranceObject = q.ExecuteSingle<DmucDoituongbhyt>(); if (objInsuranceObject != null) { PtramBHYT = Utility.DecimaltoDbnull(objInsuranceObject.PhantramBhyt, 0); decDiscountTotalMoney = v_decTotalPrice * (100 - Utility.DecimaltoDbnull(objInsuranceObject.PhantramBhyt, 0)) / 100; } } else { PtramBHYT = 100; decDiscountTotalMoney = 0; } break; } } } else { ///Nếu là đối tượng trái tuyến thực hiện lấy % của trái tuyến DmucDoituongkcb objObjectType = DmucDoituongkcb.FetchByID(objLuotkham.IdDoituongKcb); if (objObjectType != null) { decDiscountTotalMoney = v_decTotalPrice * (100 - Utility.DecimaltoDbnull(objObjectType.PhantramTraituyen)) / 100; PtramBHYT = Utility.DecimaltoDbnull(objObjectType.PhantramTraituyen, 0); } } } else//Đối tượng dịch vụ { //Có thể gán luôn PtramBHYT=0% và decDiscountTotalMoney=0 DmucDoituongkcb objObjectType = DmucDoituongkcb.FetchByID(objLuotkham.IdDoituongKcb); if (objObjectType != null) decDiscountTotalMoney = v_decTotalPrice * (100 - Utility.Int32Dbnull(objObjectType.PhantramDungtuyen, 0)) / 100; ; PtramBHYT = Utility.DecimaltoDbnull(objObjectType.PhantramDungtuyen, 0); } return decDiscountTotalMoney; }
private void AutoFindLastExamandFetchIntoControls(string patientID, string sobhyt) { try { if (!Utility.CheckLockObject(m_strMaluotkham, "Tiếp đón", "TD")) return; //Trả lại mã lượt khám nếu chưa được dùng đến new Update(KcbDmucLuotkham.Schema) .Set(KcbDmucLuotkham.Columns.TrangThai).EqualTo(0) .Set(KcbDmucLuotkham.Columns.UsedBy).EqualTo(DBNull.Value) .Set(KcbDmucLuotkham.Columns.StartTime).EqualTo(DBNull.Value) .Set(KcbDmucLuotkham.Columns.EndTime).EqualTo(null) .Where(KcbDmucLuotkham.Columns.MaLuotkham).IsEqualTo(Utility.Int32Dbnull(m_strMaluotkham, "-1")) .And(KcbDmucLuotkham.Columns.TrangThai).IsEqualTo(1) .And(KcbDmucLuotkham.Columns.UsedBy).IsEqualTo(globalVariables.UserName) .And(KcbDmucLuotkham.Columns.Nam).IsEqualTo(globalVariables.SysDate.Year).Execute(); ; SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(patientID); if (!string.IsNullOrEmpty(sobhyt)) { sqlQuery.And(KcbLuotkham.Columns.MatheBhyt).IsEqualTo(sobhyt); } sqlQuery.OrderDesc(KcbLuotkham.Columns.NgayTiepdon); var objLuotkham = sqlQuery.ExecuteSingle<KcbLuotkham>(); if (objLuotkham != null) { txtMaBN.Text = patientID; txtMaLankham.Text = Utility.sDbnull(objLuotkham.MaLuotkham); m_strMaluotkham = objLuotkham.MaLuotkham; m_enAction = action.Update; AllowTextChanged = false; LoadThongtinBenhnhan(); CanhbaoInphoi(); LaydanhsachdangkyKCB(); string ngay_kham = globalVariables.SysDate.ToString("dd/MM/yyyy"); if (!NotPayment(txtMaBN.Text.Trim(), ref ngay_kham))//Đã thanh toán-->Kiểm tra ngày hẹn xem có được phép khám tiếp { KcbChandoanKetluan _Info = new Select().From(KcbChandoanKetluan.Schema).Where(KcbChandoanKetluan.MaLuotkhamColumn).IsEqualTo(objLuotkham.MaLuotkham).ExecuteSingle<KcbChandoanKetluan>(); if (_Info != null && _Info.SongayDieutri != null) { int SoNgayDieuTri = 0; if (_Info.SongayDieutri.Value.ToString() == "") { SoNgayDieuTri = 0; } else { SoNgayDieuTri = _Info.SongayDieutri.Value; } DateTime ngaykhamcu = _Info.NgayTao.Value; ; DateTime ngaykhammoi = globalVariables.SysDate; TimeSpan songay = ngaykhammoi - ngaykhamcu; int kt = songay.Days; int kt1 = SoNgayDieuTri - kt; kt1 = Utility.Int32Dbnull(kt1); // nếu khoảng cách từ lần khám trước đến ngày hiện tại lớn hơn ngày điều trị. if (kt >= SoNgayDieuTri) { m_enAction = action.Add; SinhMaLanKham(); //txtTongChiPhiKham.Text = "0"; m_dataDataRegExam.Rows.Clear(); txtKieuKham.Select(); } else if (kt < SoNgayDieuTri) { DialogResult dialogResult = MessageBox.Show( "Bác Sỹ hẹn : " + SoNgayDieuTri + "ngày" + "\nNgày khám gần nhất: " + ngaykhamcu + "\nCòn: " + kt1 + " ngày nữa mới được tái khám" + "\nBạn có muốn tiếp tục thêm lần khám ", "Thông Báo", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { m_enAction = action.Add; SinhMaLanKham(); //Reset dịch vụ KCB //txtTongChiPhiKham.Text = "0"; m_dataDataRegExam.Rows.Clear(); txtKieuKham.Select(); } else if (dialogResult == DialogResult.No) { ClearControl(); return; } } } else//Chưa thăm khám-->Để nguyên trạng thái cập nhật { } } else//Còn lần khám chưa thanh toán-->Kiểm tra { //nếu là ngày hiện tại thì đặt về trạng thái sửa if (ngay_kham == "NOREG" || ngay_kham == globalVariables.SysDate.ToString("dd/MM/yyyy")) { //LoadThongtinBenhnhan(); if (ngay_kham == "NOREG")//Bn chưa đăng ký phòng khám nào cả. { //Nếu ngày hệ thống=Ngày đăng ký gần nhất-->Sửa if (globalVariables.SysDate.ToString("dd/MM/yyyy") == dtpInputDate.Value.ToString("dd/MM/yyyy")) { m_enAction = action.Update; Utility.ShowMsg( "Bệnh nhân vừa được đăng ký ngày hôm nay nên hệ thống sẽ chuyển về chế độ Sửa thông tin. Nhấn OK để bắt đầu sửa"); //LaydanhsachdangkyKCB(); txtTEN_BN.Select(); } else//Thêm lần khám cho ngày mới { m_enAction = action.Add; SinhMaLanKham(); //Reset dịch vụ KCB //txtTongChiPhiKham.Text = "0"; m_dataDataRegExam.Rows.Clear(); txtKieuKham.Select(); } } else//Quay về trạng thái sửa { m_enAction = action.Update; Utility.ShowMsg( "Bệnh nhân vừa được đăng ký ngày hôm nay nên hệ thống sẽ chuyển về chế độ Sửa thông tin. Nhấn OK để bắt đầu sửa"); //LaydanhsachdangkyKCB(); txtTEN_BN.Select(); } } else //Không cho phép thêm lần khám khác nếu chưa thanh toán lần khám của ngày hôm trước { Utility.ShowMsg( "Bệnh nhân đang có lần khám chưa được thanh toán. Cần thanh toán hết các lần đến khám bệnh của Bệnh nhân trước khi thêm lần khám mới. Nhấn OK để hệ thống chuyển về trạng thái thêm mới Bệnh nhân"); cmdThemMoiBN_Click(cmdThemMoiBN, new EventArgs()); } } StatusControl(); ModifyCommand(); txtKieuKham.SetCode("-1"); txtPhongkham.SetCode("-1"); if (PropertyLib._KCBProperties.GoMaDvu) { txtExamtypeCode.SelectAll(); txtExamtypeCode.Focus(); } else { txtKieuKham.SelectAll(); txtKieuKham.Focus(); } } else { Utility.ShowMsg( "Bệnh nhân này chưa có lần khám nào-->Có thể bị lỗi dữ liệu. Đề nghị liên hệ với VNS để được giải đáp"); } } catch (Exception ex) { Utility.ShowMsg("AutoFindLastExam().Exception-->" + ex.Message); } finally { SetActionStatus(); AllowTextChanged = true; } }
string LaygiatriTieudeBaocao(string Matieude, bool fromDB) { try { string reval = ""; if (fromDB) { SqlQuery sqlQuery = new Select().From(SysReport.Schema).Where(SysReport.Columns.MaBaocao).IsEqualTo( Matieude); SysReport objSystemParameter = sqlQuery.ExecuteSingle<SysReport>(); if (objSystemParameter != null) reval = objSystemParameter.TieuDe; } else { DataRow[] arrDR = globalVariables.gv_dtSysTieude.Select(SysTieude.MaTieudeColumn.ColumnName + " ='" + Matieude + "'"); if (arrDR.Length > 0) reval = Utility.sDbnull(arrDR[0][SysTieude.NoiDungColumn.ColumnName]); } return reval; } catch { return ""; } }
public static short GetDepartmentIDByCode(string Code) { short vDepartment_Id = -1; try { SqlQuery sqlQuery = new Select().From(LDepartment.Schema).Where(LDepartment.Columns.DepartmentCode).IsEqualTo(Code); LStaff objStaff = sqlQuery.ExecuteSingle<LStaff>(); if (objStaff != null) { vDepartment_Id = objStaff.DepartmentId; } } catch (Exception ex) { vDepartment_Id = globalVariables.DepartmentID; } return vDepartment_Id; }
private KcbLuotkham CreatePatientExam() { string MaLuotkham = Utility.sDbnull(grdList.GetValue(KcbLuotkham.Columns.MaLuotkham)); int Patient_ID = Utility.Int32Dbnull(grdList.GetValue(KcbLuotkham.Columns.IdBenhnhan)); KcbLuotkham objLuotkham = new KcbLuotkham(); SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(MaLuotkham) .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(Patient_ID); objLuotkham = sqlQuery.ExecuteSingle<KcbLuotkham>(); return objLuotkham; }
/// <summary> /// Thực hiện thêm mới thông tin không nhập qua phần tiếp đón /// </summary> /// <param name="TenBenhNhan">Tên bệnh nhân</param> /// <param name="GTinh"> </param> /// <param name="StudyInstanseUid">StudyInstanseUid</param> /// <param name="SERIES_INSTANCE_UID">SERIES_INSTANCE_UID</param> /// <param name="SOP_INSTANCE_UID">SOP_INSTANCE_UID</param> /// <param name="BodyPart"> </param> /// <param name="Position"> </param> /// <param name="PathImage">Đường dẫn ảnh</param> /// <param name="PathImage_thumb"> </param> /// <param name="IdDichVu">ID dịch vụ </param> /// <returns></returns> public static void ThemBenhNhan(string TenBenhNhan, string GTinh, string StudyInstanseUid, string SERIES_INSTANCE_UID, string SOP_INSTANCE_UID, string BodyPart, string Position, string PathImage, string PathImage_thumb, string sourcePatientId) { try { Query _QuerySoPhieu = RisPhieuCdinh.CreateQuery(); Query _QueryChiTiet = RisPhieuCdinhCtiet.CreateQuery(); using (var scope = new TransactionScope()) { using (var sp = new SharedDbConnectionScope()) { DateTime sysDateTime = BusinessHelper.GetSysDateTime(); var objBenhNhan = new RisBenhNhan(); SqlQuery sqlQuery = new Select().From(RisPhieuCdinh.Schema) .Where(RisPhieuCdinh.Columns.StudyInstanseUid).IsEqualTo(StudyInstanseUid); var objPhieuCdinh = new RisPhieuCdinh(); if (sqlQuery.GetRecordCount() <= 0) { objBenhNhan = ThemMoiBenhNhan(TenBenhNhan, GTinh); objPhieuCdinh.StudyInstanseUid = StudyInstanseUid; objPhieuCdinh.IdBnhan = objBenhNhan.IdBnhan; objPhieuCdinh.MaPhieu = BusinessHelper.LayMaPhieu(); objPhieuCdinh.Pid = objBenhNhan.Pid; objPhieuCdinh.LoaiPhieu = 1; // objPhieuCdinh.IdKhoaThien = -1; //objPhieuCdinh.MaTbi = String.Empty; objPhieuCdinh.NgayDky = sysDateTime; objPhieuCdinh.NgayTao = sysDateTime; objPhieuCdinh.NguoiTao = globalVariables.UserName; objPhieuCdinh.SourcePatientid = sourcePatientId; objPhieuCdinh.IsNew = true; objPhieuCdinh.Save(); objPhieuCdinh.IdPhieu = Utility.Int32Dbnull(_QuerySoPhieu.GetMax(RisPhieuCdinh.Columns.IdPhieu)); } else { objPhieuCdinh = sqlQuery.ExecuteSingle<RisPhieuCdinh>(); new Update(RisBenhNhan.Schema) .Set(RisBenhNhan.Columns.TenBnhan).EqualTo(TenBenhNhan) .Set(RisBenhNhan.Columns.TenBnhanKdau).EqualTo(Utility.UnSignedCharacter(TenBenhNhan)) .Set(RisBenhNhan.Columns.Gtinh).EqualTo(GTinh) .Where(RisBenhNhan.Columns.IdBnhan).IsEqualTo(objPhieuCdinh.IdBnhan).Execute(); } sqlQuery = new Select().From(RisPhieuCdinhCtiet.Schema) .Where(RisPhieuCdinhCtiet.Columns.IdPhieu).IsEqualTo(objPhieuCdinh.IdPhieu) .And(RisPhieuCdinhCtiet.Columns.SeriesInstanceUid).IsEqualTo(SERIES_INSTANCE_UID) .And(RisPhieuCdinhCtiet.Columns.StudyInstanceUid).IsEqualTo(StudyInstanseUid); //.And(RisPhieuCdinhCtiet.Columns.SopInstanceUid).IsEqualTo(SOP_INSTANCE_UID); var objRisPhieuCdinhCtiet = new RisPhieuCdinhCtiet(); if (sqlQuery.GetRecordCount() <= 0) { SqlQuery sqlQueryDV = new Select().From(DDichVu.Schema) .Where(DDichVu.Columns.MaDvu).IsEqualTo(Position) .And(DDichVu.Columns.IdLoaiDvu).In( new Select(DLoaiDvu.Columns.IdLoaiDvu).From(DLoaiDvu.Schema) .Where(DLoaiDvu.Columns.MaLoaiDvu). IsEqualTo(BodyPart)); var objDichVu = sqlQueryDV.ExecuteSingle<DDichVu>(); if (objDichVu != null) { objRisPhieuCdinhCtiet.IdDvu = Utility.Int32Dbnull(objDichVu.IdDvu, -1); if (objDichVu != null) { objRisPhieuCdinhCtiet.IdLoaiDvu = objDichVu.IdLoaiDvu; objRisPhieuCdinhCtiet.GhiChu = Utility.sDbnull(objDichVu.MoTa, ""); SqlQuery sqlQueryVungKS = new Select().From(DVungKsat.Schema) .Where(DVungKsat.Columns.IdVungKs).IsEqualTo(objDichVu.IdVungKs); var objDVungKsat = sqlQueryVungKS.ExecuteSingle<DVungKsat>(); if (objDVungKsat != null) { objRisPhieuCdinhCtiet.VungKs = Utility.sDbnull(objDVungKsat.TenVungKs, ""); objRisPhieuCdinhCtiet.KetLuan = Utility.sDbnull(objDVungKsat.KetLuan, ""); objRisPhieuCdinhCtiet.DeNghi = Utility.sDbnull(objDVungKsat.DeNghi, ""); objRisPhieuCdinhCtiet.KyThuat = Utility.sDbnull(objDVungKsat.KyThuat, ""); objRisPhieuCdinhCtiet.MoTa = Utility.sDbnull(objDVungKsat.MoTa, ""); } } } objRisPhieuCdinhCtiet.Sluong = 1; objRisPhieuCdinhCtiet.DaIn = 0; objRisPhieuCdinhCtiet.SeriesInstanceUid = SERIES_INSTANCE_UID; objRisPhieuCdinhCtiet.SopInstanceUid = SOP_INSTANCE_UID; objRisPhieuCdinhCtiet.StudyInstanceUid = objPhieuCdinh.StudyInstanseUid; objRisPhieuCdinhCtiet.MaKieuDvu = globalVariables.MaKieuDV; objRisPhieuCdinhCtiet.MaDvu = Position; objRisPhieuCdinhCtiet.MaLoaiDvu = BodyPart; objRisPhieuCdinhCtiet.MaTbi = string.Empty; objRisPhieuCdinhCtiet.IdKhoaThien = -1; objRisPhieuCdinhCtiet.TrangThaiImage = 1; // objRisPhieuCdinhCtiet.MaKieuDvu = globalVariables.; objRisPhieuCdinhCtiet.TrangThai = 0; objRisPhieuCdinhCtiet.IdPhieu = objPhieuCdinh.IdPhieu; objRisPhieuCdinhCtiet.IsNew = true; objRisPhieuCdinhCtiet.Save(); objRisPhieuCdinhCtiet.IdPhieuCtiet = Utility.Int32Dbnull(_QueryChiTiet.GetMax(RisPhieuCdinhCtiet.Columns.IdPhieuCtiet), -1); } else { objRisPhieuCdinhCtiet = sqlQuery.ExecuteSingle<RisPhieuCdinhCtiet>(); } sqlQuery = new Select().From(RisLuuAnh.Schema) .Where(RisLuuAnh.Columns.IdPhieuCtiet).IsEqualTo(objRisPhieuCdinhCtiet.IdPhieuCtiet) .And(RisLuuAnh.Columns.SeriesInstanceUid).IsEqualTo(objRisPhieuCdinhCtiet.SeriesInstanceUid) .And(RisLuuAnh.Columns.SopInstanceUid).IsEqualTo(SOP_INSTANCE_UID); if (sqlQuery.GetRecordCount() <= 0) { new Update(RisLuuAnh.Schema) .Set(RisLuuAnh.Columns.TrangThai).EqualTo(0) .Where(RisPhieuCdinhCtiet.Columns.IdPhieuCtiet).IsEqualTo( objRisPhieuCdinhCtiet.IdPhieuCtiet).Execute(); var objLuuAnh = new RisLuuAnh(); objLuuAnh.DdanAnh = PathImage; objLuuAnh.DdanAnhThumb = PathImage_thumb; objLuuAnh.IdPhieuCtiet = Utility.Int64Dbnull(objRisPhieuCdinhCtiet.IdPhieuCtiet, -1); objLuuAnh.SeriesInstanceUid = objRisPhieuCdinhCtiet.SeriesInstanceUid; objLuuAnh.SopInstanceUid = SOP_INSTANCE_UID; objLuuAnh.NgayTao = sysDateTime; objLuuAnh.TrangThai = 1; string[] strings = SOP_INSTANCE_UID.Split('.'); int loz; try { loz = Convert.ToInt32(strings[strings.Length - 1]); } catch (Exception) { loz = 0; } objLuuAnh.Stt = loz; objLuuAnh.IsNew = true; objLuuAnh.Save(); } else { new Update(RisLuuAnh.Schema) .Set(RisLuuAnh.Columns.DdanAnh).EqualTo(PathImage) .Set(RisLuuAnh.Columns.NgayTao).EqualTo(sysDateTime) .Where(RisLuuAnh.Columns.IdPhieuCtiet).IsEqualTo(objRisPhieuCdinhCtiet.IdPhieuCtiet) .And(RisLuuAnh.Columns.SeriesInstanceUid).IsEqualTo( objRisPhieuCdinhCtiet.SeriesInstanceUid) .And(RisLuuAnh.Columns.SopInstanceUid).IsEqualTo(SOP_INSTANCE_UID).Execute(); } } // OrderImage(SERIES_INSTANCE_UID); scope.Complete(); return; } } catch (Exception ex) { return; } }
private void TudongthemDiachinh_test(string value) { //Tạm thời khoa lại tìm giải pháp khác trực quan hơn return; bool success = false; bool added = false; string[] arrvalues = value.Split(','); if (arrvalues.Length != 3) return; string TenTP = arrvalues[2]; string TenQH = arrvalues[1]; string TenXP = arrvalues[0]; string CodeTP = ""; string CodeQH = ""; string CodeXP = ""; string SurveyCodeTP = Utility.GetYYMMDDHHMMSS(globalVariables.SysDate); string SurveyCodeQH = SurveyCodeTP + "1"; string SurveyCodeXP = SurveyCodeQH + "1"; DmucDiachinh _TP = null; var _newTP = new DmucDiachinh(); DmucDiachinh _QH = null; var _newQH = new DmucDiachinh(); DmucDiachinh _XP = null; var _newXP = new DmucDiachinh(); string ShortCutXP = "kx"; string ShortCutTP = "kx"; string ShortCutQH = "kx"; try { _TP = new Select().From(DmucDiachinh.Schema).Where(DmucDiachinh.TenDiachinhColumn).IsEqualTo(TenTP).ExecuteSingle <DmucDiachinh>(); if (_TP == null) { _newTP.MaDiachinh = SurveyCodeTP; _newTP.TenDiachinh = TenTP; _newTP.SttHthi = 1; _newTP.LoaiDiachinh = 0; _newTP.MotaThem = getshortcut(Utility.Bodau(BoTp(0, TenTP))); ShortCutTP = _newTP.MotaThem; } else { CodeTP = _TP.MaDiachinh; ShortCutTP = _TP.MotaThem; } SqlQuery sqlQueryQH = new Select().From(DmucDiachinh.Schema).Where(DmucDiachinh.TenDiachinhColumn).IsEqualTo(TenQH); if (_TP != null) { sqlQueryQH.And(DmucDiachinh.MaChaColumn).IsEqualTo(_TP.MaDiachinh); _QH = sqlQueryQH.ExecuteSingle<DmucDiachinh>(); } else _QH = null; if (_QH == null) { _newQH.MaDiachinh = SurveyCodeQH; _newQH.TenDiachinh = TenQH; _newQH.SttHthi = 1; _newQH.LoaiDiachinh = 1; _newQH.MotaThem = getshortcut(Utility.Bodau(BoTp(1, TenQH))); ShortCutQH = _newQH.MotaThem; } else { CodeQH = _QH.MaDiachinh; ShortCutQH = _QH.MotaThem; } SqlQuery sqlQueryXP = new Select().From(DmucDiachinh.Schema).Where(DmucDiachinh.TenDiachinhColumn).IsEqualTo(TenXP); if (_QH != null) { sqlQueryXP.And(DmucDiachinh.MaChaColumn).IsEqualTo(_QH.MaDiachinh); _XP = sqlQueryXP.ExecuteSingle<DmucDiachinh>(); } else _XP = null; if (_XP == null) { _newXP.MaDiachinh = SurveyCodeXP; _newXP.TenDiachinh = TenXP; _newXP.SttHthi = 1; _newXP.LoaiDiachinh = 2; _newXP.MotaThem = getshortcut(Utility.Bodau(BoTp(2, TenXP))); ShortCutXP = _newXP.MotaThem; } else { CodeXP = _XP.MaDiachinh; ShortCutXP = _XP.MotaThem; } using (var scope = new TransactionScope()) { using (var sh = new SharedDbConnectionScope()) { int maxCode = 0; QueryCommand cmd = DmucDiachinh.CreateQuery().BuildCommand(); cmd.CommandType = CommandType.Text; cmd.CommandSql = "select MAX(ma_diachinh) from dmuc_diachinh where ISNUMERIC(ma_diachinh)=1"; DataTable temdt = DataService.GetDataSet(cmd).Tables[0]; maxCode = Utility.Int32Dbnull(temdt.Rows[0][0], 0); if (_TP == null) { added = true; _newTP.MaDiachinh = (maxCode + 1).ToString(); _newTP.Save(); CodeTP = _newTP.MaDiachinh; } if (_QH == null) { added = true; _newQH.MaDiachinh = (maxCode + 2).ToString(); _newQH.MaCha = CodeTP; _newQH.Save(); CodeQH = _newQH.MaDiachinh; } if (_XP == null) { added = true; _newXP.MaDiachinh = (maxCode + 3).ToString(); _newXP.MaCha = CodeQH; _newXP.Save(); } } scope.Complete(); success = true; } } catch { } if (success && added) //Thêm vào Datatable để không có thể sử dụng luôn { DataRow drShortcut = m_DC.NewRow(); drShortcut["ShortCutXP"] = ShortCutXP; drShortcut["ShortCutQH"] = ShortCutQH; drShortcut["ShortCutTP"] = ShortCutTP; drShortcut["Value"] = value; m_DC.Rows.Add(drShortcut); } }
private void GetData() { string ReasonBy = ""; string sAccountName = THU_VIEN_CHUNG.LayMaDviLamViec(); LayThongTinPaymentDetail(sAccountName); //grdPaymentDetail.DataSource = m_dtPaymentDetail; SqlQuery sqlQuery = new Select().From(TPhieuthu.Schema) .Where(TPhieuthu.Columns.PaymentId).IsEqualTo(Utility.Int32Dbnull(txtPayment_ID.Text)).And( TPhieuthu.Columns.LoaiPhieu).IsEqualTo(status); if (sqlQuery.GetRecordCount() <= 0) { TPayment objPayment = TPayment.FetchByID(Utility.Int32Dbnull(txtPayment_ID.Text, -1)); if (objPayment != null) { dtCreateDate.Value = Convert.ToDateTime(objPayment.PaymentDate); txtPayment_ID.Text = Utility.sDbnull(objPayment.PaymentId, "-1"); txtMA_PTHU.Text = THU_VIEN_CHUNG.GetMaPhieuThu(dtCreateDate.Value,0); Janus.Windows.GridEX.GridEXColumn gridExColumn = grdPaymentDetail.RootTable.Columns["TONG"]; txtSO_TIEN.Text = Utility.sDbnull(grdPaymentDetail.GetTotal(gridExColumn, Janus.Windows.GridEX.AggregateFunction.Sum)); txtSLUONG_CTU_GOC.Text = "1"; TPatientInfo objPatientInfo = TPatientInfo.FetchByID(objPayment.PatientId); if (objPatientInfo != null) { txtNGUOI_NOP.Text = objPatientInfo.PatientName; label9.Text = "Người nhận"; } var query = (from loz in grdPaymentDetail.GetDataRows().AsEnumerable() let x=Utility.sDbnull(loz.Cells[TPaymentDetail.Columns.ServiceDetailName].Value) let y=loz.RowType where(x!="") &&(y==Janus.Windows.GridEX.RowType.Record) select x).ToArray(); txtLDO_NOP.Text = string.Join(";", query); } } else { var objPhieuthu = sqlQuery.ExecuteSingle<TPhieuthu>(); if (objPhieuthu != null) { txtSLUONG_CTU_GOC.Text = Utility.sDbnull(objPhieuthu.SluongCtuGoc, 1); txtMA_PTHU.Text = Utility.sDbnull(objPhieuthu.MaPthu, ""); txtNGUOI_NOP.Text = Utility.sDbnull(objPhieuthu.NguoiNop); txtSO_TIEN.Text = Utility.sDbnull(objPhieuthu.SoTien); txtTKHOAN_CO.Text = Utility.sDbnull(objPhieuthu.TkhoanCo, ""); txtTKHOAN_NO.Text = Utility.sDbnull(objPhieuthu.TkhoanNo, ""); txtLDO_NOP.Text = Utility.sDbnull(objPhieuthu.LdoNop); dtCreateDate.Value = Convert.ToDateTime(objPhieuthu.NgayThien); } } sqlQuery = new Select().From(TPaymentDetail.Schema) .Where(TPaymentDetail.Columns.PaymentId).IsEqualTo(Utility.Int32Dbnull(txtPayment_ID.Text)) .And(TPaymentDetail.Columns.IsCancel).IsEqualTo(0); TPaymentDetailCollection objPaymentDetailCollection = sqlQuery.ExecuteAsCollection<TPaymentDetailCollection>(); txtSoTienGoc.Text = Utility.sDbnull(objPaymentDetailCollection.Sum(c => c.Quantity * c.OriginPrice)); txtTienBHCT.Text = Utility.sDbnull(objPaymentDetailCollection.Sum(c => c.Quantity * c.DiscountRate)); txtTienBNCT.Text = Utility.sDbnull(objPaymentDetailCollection.Sum(c => c.Quantity * c.DiscountPrice)); txtTienPhuThu.Text = Utility.sDbnull(objPaymentDetailCollection.Sum(c => c.Quantity * c.SurchargePrice)); txtTienBNPhaiTra.Text = Utility.sDbnull(Utility.DecimaltoDbnull(txtTienPhuThu.Text) + Utility.DecimaltoDbnull(txtTienBNCT.Text)); Utility.SetMessage(lblMoneyLetter, new MoneyByLetter().sMoneyToLetter(txtTienBNPhaiTra.Text), true); }
private KcbLuotkham CreatePatientExam() { SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(malankham) .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(Utility.Int32Dbnull(txtPatient_ID.Text)); var objPatientExam = sqlQuery.ExecuteSingle<KcbLuotkham>(); return objPatientExam; }
private void SaveAll() { try { Utility.SetMsg(lblMsg, "", false); decimal GiaDV = LayGiaDV(); int idThuoc = -1; decimal GiaPhuThu = 0; decimal GiaBHYT = LayGiaBHYT(); string KTH = "ALL"; foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdQhe.GetRows()) { idThuoc = Utility.Int32Dbnull(gridExRow.Cells[QheDoituongThuoc.Columns.IdThuoc].Value, -1); KTH = Utility.sDbnull(cboKhoaTH.SelectedValue, "-1") == "-1" ? "ALL" : Utility.sDbnull(cboKhoaTH.SelectedValue, "-1"); SqlQuery q = new Select().From(QheDoituongThuoc.Schema).Where(QheDoituongThuoc.Columns.IdThuoc). IsEqualTo(Utility.DecimaltoDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.IdThuoc].Value, -1)).And( QheDoituongThuoc.Columns.MaDoituongKcb).IsEqualTo(Utility.sDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.MaDoituongKcb].Value, "-1")); //.And(QheDoituongThuoc.Columns.MaKhoaThuchien).IsEqualTo(KTH); //.Or(QheDoituongThuoc.Columns.MaDoituongKcb).IsEqualTo("BHYT"); GiaPhuThu = Utility.DecimaltoDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.PhuthuTraituyen].Value, 0); int v_IdLoaidoituongKcb = Utility.Int32Dbnull(gridExRow.Cells[QheDoituongThuoc.Columns.IdLoaidoituongKcb].Value, 0); //Nếu có lưu đối tượng BHYT và tồn tại giá DV thì tự động tính phụ thu trái tuyến cho đối tượng BHYT đó if (gridExRow.Cells[QheDoituongThuoc.Columns.IdLoaidoituongKcb].Value.ToString() == "0" && GiaDV > 0) { GiaBHYT = Utility.DecimaltoDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.DonGia].Value, 0); if (PropertyLib._QheGiaThuocProperties.TudongDieuChinhGiaPTTT) GiaPhuThu = GiaDV - GiaBHYT > 0 ? GiaDV - GiaBHYT : 0; } //Nếu đối tượng BHYT có tồn tại thì update lại thông tin trong đó có giá phụ thu trái tuyến if (q.GetRecordCount() > 0) { new Update(QheDoituongThuoc.Schema) .Set(QheDoituongThuoc.Columns.NgaySua).EqualTo(globalVariables.SysDate) .Set(QheDoituongThuoc.Columns.NguoiSua).EqualTo(globalVariables.UserName) .Set(QheDoituongThuoc.Columns.IdLoaithuoc).EqualTo( Utility.Int32Dbnull(gridExRow.Cells[QheDoituongThuoc.Columns.IdLoaithuoc].Value, -1)) .Set(QheDoituongThuoc.Columns.DonGia).EqualTo( Utility.DecimaltoDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.DonGia].Value, 0)) .Set(QheDoituongThuoc.Columns.PhuthuDungtuyen).EqualTo( Utility.DecimaltoDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.PhuthuDungtuyen].Value, 0)) .Set(QheDoituongThuoc.Columns.PhuthuTraituyen).EqualTo(GiaPhuThu) .Set(QheDoituongThuoc.Columns.MaKhoaThuchien).EqualTo(KTH) .Where(QheDoituongThuoc.Columns.IdQuanhe).IsEqualTo( Utility.Int32Dbnull(gridExRow.Cells[QheDoituongThuoc.Columns.IdQuanhe].Value, "-1")) .Execute(); } else { DmucDoituongkcbCollection objectTypeCollection = new DmucDoituongkcbController().FetchByQuery( DmucDoituongkcb.CreateQuery().AddWhere(DmucDoituongkcb.Columns.MaDoituongKcb, Comparison.Equals, Utility.sDbnull(gridExRow.Cells[DmucDoituongkcb.Columns.MaDoituongKcb].Value, "-1"))); foreach (DmucDoituongkcb lObjectType in objectTypeCollection) { QheDoituongThuoc _newItems = new QheDoituongThuoc(); _newItems.IdDoituongKcb = lObjectType.IdDoituongKcb; _newItems.IdLoaithuoc = Utility.Int16Dbnull(gridExRow.Cells[QheDoituongThuoc.Columns.IdLoaithuoc].Value, -1); _newItems.IdThuoc = Utility.Int32Dbnull(gridExRow.Cells[QheDoituongThuoc.Columns.IdThuoc].Value, -1); _newItems.TyleGiamgia = 0; _newItems.KieuGiamgia = "%"; _newItems.DonGia = Utility.DecimaltoDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.DonGia].Value, 0); _newItems.PhuthuDungtuyen = Utility.DecimaltoDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.PhuthuDungtuyen].Value, 0); _newItems.PhuthuTraituyen = GiaPhuThu; _newItems.IdLoaidoituongKcb = Utility.Int32Dbnull(gridExRow.Cells[QheDoituongThuoc.Columns.IdLoaidoituongKcb].Value, -1); _newItems.MaDoituongKcb = lObjectType.MaDoituongKcb; _newItems.NguoiTao = globalVariables.UserName; _newItems.NgayTao = globalVariables.SysDate; _newItems.MaKhoaThuchien = KTH; _newItems.IsNew = true; _newItems.Save(); gridExRow.BeginEdit(); gridExRow.Cells[QheDoituongThuoc.Columns.IdQuanhe].Value = _newItems.IdQuanhe; gridExRow.EndEdit(); } } gridExRow.BeginEdit(); gridExRow.Cells[QheDoituongThuoc.Columns.PhuthuTraituyen].Value = GiaPhuThu; gridExRow.EndEdit(); grdQhe.UpdateData(); //Nếu có chỉnh giá dịch vụ-->Tự động chỉnh giá danh mục thuốc if (PropertyLib._QheGiaThuocProperties.TudongDieuChinhGiaDichVu) { SqlQuery sqlQuery = new Select().From(DmucDoituongkcb.Schema) .Where(DmucDoituongkcb.Columns.IdLoaidoituongKcb).IsEqualTo(1) .And(DmucDoituongkcb.Columns.MaDoituongKcb).IsEqualTo(Utility.sDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.MaDoituongKcb].Value, "-1")); DmucDoituongkcb objectType = sqlQuery.ExecuteSingle<DmucDoituongkcb>(); if (objectType != null) { new Update(DmucThuoc.Schema) .Set(DmucThuoc.Columns.DonGia) .EqualTo(Utility.DecimaltoDbnull(gridExRow.Cells[QheDoituongThuoc.Columns.DonGia].Value, 0)) .Where(DmucThuoc.Columns.IdThuoc) .IsEqualTo(Utility.Int32Dbnull(gridExRow.Cells[QheDoituongThuoc.Columns.IdThuoc].Value, -1)).Execute(); } } } new Update(DmucThuoc.Schema).Set(DmucThuoc.Columns.DonGia).EqualTo(GiaDV) .Set(DmucThuoc.Columns.GiaBhyt).EqualTo(GiaBHYT) .Where(DmucThuoc.Columns.IdThuoc).IsEqualTo(Utility.Int32Dbnull(grdList.CurrentRow.Cells[DmucThuoc.Columns.IdThuoc].Value, -1)) .Execute(); //Cập nhật giá BHYT cho các khoa khác if (PropertyLib._QheGiaThuocProperties.TudongDieuChinhGiaBHYT) { if (GiaBHYT >= 0) { QheDoituongThuocCollection lstItems = new Select().From(QheDoituongThuoc.Schema). Where(QheDoituongThuoc.Columns.IdThuoc). IsEqualTo(idThuoc) .And(QheDoituongThuoc.MaKhoaThuchienColumn).IsNotEqualTo(KTH).ExecuteAsCollection<QheDoituongThuocCollection>(); foreach (QheDoituongThuoc item in lstItems) { int v_IdLoaidoituongKcb = item.IdLoaidoituongKcb; if (v_IdLoaidoituongKcb == 1) GiaDV = item.DonGia; } GiaPhuThu = 0; foreach (QheDoituongThuoc item in lstItems) { int v_IdLoaidoituongKcb = item.IdLoaidoituongKcb; if (v_IdLoaidoituongKcb.ToString() == "0" && GiaDV > 0)//Nếu là đối tượng BHYT { GiaPhuThu = GiaDV - GiaBHYT > 0 ? GiaDV - GiaBHYT : 0; Update _update = new Update(QheDoituongThuoc.Schema).Set(QheDoituongThuoc.DonGiaColumn).EqualTo(GiaBHYT); if (PropertyLib._QheGiaThuocProperties.TudongDieuChinhGiaPTTT) _update.Set(QheDoituongThuoc.PhuthuTraituyenColumn).EqualTo(GiaPhuThu); _update.Where(QheDoituongThuoc.IdLoaidoituongKcbColumn).IsEqualTo(0).And(QheDoituongThuoc.IdThuocColumn).IsEqualTo(idThuoc) .And(QheDoituongThuoc.MaKhoaThuchienColumn).IsNotEqualTo(KTH) .Execute(); } } } } Utility.SetMsg(lblMsg, "Bạn thực hiện cập nhập giá thành công",false); } catch (Exception exception) { Utility.SetMsg(lblMsg, "Lỗi trong quá trình cập nhập thông tin", false); } }