public void InsertAssignDetail(KcbChidinhcl objKcbChidinhcls, KcbLuotkham objLuotkham, KcbChidinhclsChitiet[] assignDetail) { using (var scope = new TransactionScope()) { if (objLuotkham == null) return; foreach (KcbChidinhclsChitiet objAssignDetail in assignDetail) { log.Info("Them moi thong tin cua phieu chi dinh chi tiet voi ma phieu Assign_ID=" + objKcbChidinhcls.IdChidinh); TinhCLS.TinhGiaChiDinhCLS(objLuotkham, objAssignDetail); objAssignDetail.IdDoituongKcb = Utility.Int16Dbnull(objLuotkham.IdDoituongKcb); objAssignDetail.IdChidinh = Utility.Int32Dbnull(objKcbChidinhcls.IdChidinh); objAssignDetail.IdKham = Utility.Int32Dbnull(objKcbChidinhcls.IdKham, -1); decimal PtramBHYT = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0); TinhCLS.GB_TinhPhtramBHYT(objAssignDetail, objLuotkham, PtramBHYT); objAssignDetail.MaLuotkham = objKcbChidinhcls.MaLuotkham; objAssignDetail.IdBenhnhan = objKcbChidinhcls.IdBenhnhan; if (Utility.Int32Dbnull(objAssignDetail.SoLuong) <= 0) objAssignDetail.SoLuong = 1; if (objAssignDetail.IdChitietchidinh <= 0) { objAssignDetail.IsNew = true; objAssignDetail.Save(); } else { objAssignDetail.MarkOld(); objAssignDetail.IsNew = false; objAssignDetail.Save(); } } scope.Complete(); } }
/// <summary> /// ham thực hiện việc cạp nhập thông tin của update /// </summary> /// <param name="objChidinhclsChitiet"></param> /// <param name="AceeptStatus"></param> /// <returns></returns> public ActionResult PerformActionUpdate(KcbChidinhclsChitiet objChidinhclsChitiet) { try { using (var scope = new TransactionScope()) { using (var sp = new SharedDbConnectionScope()) { new Update(KcbChidinhclsChitiet.Schema) .Set(KcbChidinhclsChitiet.Columns.TrangThai).EqualTo(objChidinhclsChitiet.TrangThai) .Set(KcbChidinhclsChitiet.Columns.KetQua).EqualTo(objChidinhclsChitiet.KetQua) .Set(KcbChidinhclsChitiet.Columns.ImgPath1).EqualTo(objChidinhclsChitiet.ImgPath1) .Set(KcbChidinhclsChitiet.Columns.ImgPath2).EqualTo(objChidinhclsChitiet.ImgPath2) .Set(KcbChidinhclsChitiet.Columns.ImgPath3).EqualTo(objChidinhclsChitiet.ImgPath3) .Set(KcbChidinhclsChitiet.Columns.ImgPath4).EqualTo(objChidinhclsChitiet.ImgPath4) .Set(KcbChidinhclsChitiet.Columns.FTPImage).EqualTo(objChidinhclsChitiet.FTPImage) .Set(KcbChidinhclsChitiet.Columns.IdKhoaThuchien).EqualTo(objChidinhclsChitiet.IdKhoaThuchien) .Set(KcbChidinhclsChitiet.Columns.IdPhongThuchien).EqualTo(objChidinhclsChitiet.IdPhongThuchien) .Set(KcbChidinhclsChitiet.Columns.NgayThuchien).EqualTo(objChidinhclsChitiet.NgayThuchien) .Set(KcbChidinhclsChitiet.Columns.NguoiThuchien).EqualTo(objChidinhclsChitiet.NguoiThuchien) .Set(KcbChidinhclsChitiet.Columns.NgaySua).EqualTo(objChidinhclsChitiet.NgayThuchien) .Set(KcbChidinhclsChitiet.Columns.NguoiSua).EqualTo(objChidinhclsChitiet.NguoiThuchien) .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(objChidinhclsChitiet.IdChitietchidinh). Execute(); } scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { return(ActionResult.Error); } }
/// <summary> /// ham thực hiện /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frm_KetLuan_Load(object sender, EventArgs e) { KcbChidinhclsChitiet assignDetail = KcbChidinhclsChitiet.FetchByID(AssignDetail_ID); if (assignDetail != null) { //txtKetLuan.Text = Utility.sDbnull(assignDetail.KetLuan, ""); } }
void frm_ViewImages_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { this.Close(); return; } if (e.KeyCode == Keys.F5) { objChitiet = KcbChidinhclsChitiet.FetchByID(objChitiet.IdChitietchidinh); LoadImages(); return; } }
/// <summary> /// ham thực hiện việc cạp nhập thông tin của update /// </summary> /// <param name="objChidinhclsChitiet"></param> /// <param name="AceeptStatus"></param> /// <returns></returns> public ActionResult PerformActionUpdate(KcbChidinhclsChitiet objChidinhclsChitiet, bool xacnhan) { try { using (var scope = new TransactionScope()) { using (var sp = new SharedDbConnectionScope()) { SqlQuery qAssignDetail = new Select().From(KcbChidinhclsChitiet.Schema).Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo (objChidinhclsChitiet.IdChitietchidinh); KcbChidinhclsChitiet objoldAssignDetail = qAssignDetail.ExecuteSingle <KcbChidinhclsChitiet>(); if (string.IsNullOrEmpty(objChidinhclsChitiet.ImgPath1)) { objChidinhclsChitiet.ImgPath1 = objoldAssignDetail.ImgPath1; } if (string.IsNullOrEmpty(objChidinhclsChitiet.ImgPath2)) { objChidinhclsChitiet.ImgPath2 = objoldAssignDetail.ImgPath2; } new Update(KcbChidinhclsChitiet.Schema) .Set(KcbChidinhclsChitiet.Columns.KetLuan).EqualTo(objChidinhclsChitiet.KetLuan) .Set(KcbChidinhclsChitiet.Columns.DeNghi).EqualTo(objChidinhclsChitiet.DeNghi) .Set(KcbChidinhclsChitiet.Columns.TrangThai).EqualTo(objChidinhclsChitiet.TrangThai) .Set(KcbChidinhclsChitiet.Columns.KetQua).EqualTo(objChidinhclsChitiet.KetQua) .Set(KcbChidinhclsChitiet.Columns.ImgPath1).EqualTo(objChidinhclsChitiet.ImgPath1) .Set(KcbChidinhclsChitiet.Columns.ImgPath2).EqualTo(objChidinhclsChitiet.ImgPath2) .Set(KcbChidinhclsChitiet.Columns.ImgPath3).EqualTo(objChidinhclsChitiet.ImgPath3) .Set(KcbChidinhclsChitiet.Columns.ImgPath4).EqualTo(objChidinhclsChitiet.ImgPath4) //.Set(KcbChidinhclsChitiet.Columns.VungKs).EqualTo(objChidinhclsChitiet.VungKs) .Set(KcbChidinhclsChitiet.Columns.NgayThuchien).EqualTo(objChidinhclsChitiet.NgayThuchien) .Set(KcbChidinhclsChitiet.Columns.NguoiThuchien).EqualTo(objChidinhclsChitiet.NguoiThuchien) .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(objChidinhclsChitiet.IdChitietchidinh). Execute(); //if (xacnhan) UpdateXacNhanDaThucHien((int)objChidinhclsChitiet.IdChitietchidinh, (int)objChidinhclsChitiet.TrangThai, (int)objChidinhclsChitiet.TrangthaiXacnhan); } scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { return(ActionResult.Error); } }
public frm_ViewImages(KcbChidinhclsChitiet objChitiet) { InitializeComponent(); this.objChitiet = objChitiet; this.Load += frm_ViewImages_Load; this.KeyDown += frm_ViewImages_KeyDown; imgBox1.ViewContextMenu(false); imgBox2.ViewContextMenu(false); imgBox3.ViewContextMenu(false); imgBox4.ViewContextMenu(false); imgBox1._OnViewImage += imgBox__OnViewImage; imgBox2._OnViewImage += imgBox__OnViewImage; imgBox3._OnViewImage += imgBox__OnViewImage; imgBox4._OnViewImage += imgBox__OnViewImage; CauHinh(); }
public frm_ViewImages(KcbChidinhclsChitiet objChitiet) { InitializeComponent(); this.objChitiet = objChitiet; this.Load += frm_ViewImages_Load; this.KeyDown += frm_ViewImages_KeyDown; imgBox1.ViewContextMenu(false); imgBox2.ViewContextMenu(false); imgBox3.ViewContextMenu(false); imgBox4.ViewContextMenu(false); imgBox1._OnViewImage += imgBox__OnViewImage; imgBox2._OnViewImage += imgBox__OnViewImage; imgBox3._OnViewImage += imgBox__OnViewImage; imgBox4._OnViewImage += imgBox__OnViewImage; CauHinh(); }
/// <summary> /// hàm thực hiện viec tính toán giá đặc biệt cho bệnh nhân /// </summary> /// <param name="objChidinhChitiet"></param> /// <param name="objLuotkham"></param> /// <param name="paymentTypeId"></param> public static void PtramBHYTDacBiet(KcbChidinhclsChitiet objChidinhChitiet, KcbLuotkham objLuotkham, int paymentTypeId, ref bool bExist) { bExist = false; 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; } } SqlQuery sqlQuery = new Select().From(DmucBhytChitraDacbiet.Schema) .Where(DmucBhytChitraDacbiet.Columns.IdDichvuChitiet).IsEqualTo(objChidinhChitiet.IdChitietchidinh) .And(DmucBhytChitraDacbiet.Columns.MaLoaithanhtoan).IsEqualTo(paymentTypeId) .And(DmucBhytChitraDacbiet.Columns.DungtuyenTraituyen).IsEqualTo(isDungTuyen) .And(DmucBhytChitraDacbiet.Columns.MaDoituongKcb).IsEqualTo(objLuotkham.MaDoituongKcb); DmucBhytChitraDacbiet objDetailPtramBhyt = sqlQuery.ExecuteSingle <DmucBhytChitraDacbiet>(); if (objDetailPtramBhyt != null) { objChidinhChitiet.IdLoaichidinh = 1; objChidinhChitiet.BhytChitra = Gia_BHYT(objDetailPtramBhyt.TileGiam, Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0)); objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - objChidinhChitiet.BhytChitra; objChidinhChitiet.PtramBhyt = Utility.DecimaltoDbnull(objDetailPtramBhyt.TileGiam, 0); objChidinhChitiet.LoaiChietkhau = 1; bExist = true; // objChidinhChitiet.DonGia = } }
/// <summary> /// ham /// </summary> /// <param name="objChidinhclsChitiet"></param> /// <returns></returns> public ActionResult PerformActionUpdate(KcbChidinhclsChitiet objChidinhclsChitiet) { try { using (var scope = new TransactionScope()) { using (var sp = new SharedDbConnectionScope()) { SqlQuery qAssignDetail = new Select().From(KcbChidinhclsChitiet.Schema).Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo (objChidinhclsChitiet.IdChitietchidinh); KcbChidinhclsChitiet objoldAssignDetail = qAssignDetail.ExecuteSingle <KcbChidinhclsChitiet>(); if (string.IsNullOrEmpty(objChidinhclsChitiet.ImgPath1)) { objChidinhclsChitiet.ImgPath1 = objoldAssignDetail.ImgPath1; } if (string.IsNullOrEmpty(objChidinhclsChitiet.ImgPath2)) { objChidinhclsChitiet.ImgPath2 = objoldAssignDetail.ImgPath2; } new Update(KcbChidinhclsChitiet.Schema) .Set(KcbChidinhclsChitiet.Columns.KetLuan).EqualTo(objChidinhclsChitiet.KetLuan) .Set(KcbChidinhclsChitiet.Columns.DeNghi).EqualTo(objChidinhclsChitiet.DeNghi) //.Set(KcbChidinhclsChitiet.Columns.TrangThaiXacNhanCLS).EqualTo(objChidinhclsChitiet.TrangThaiXacNhanCLS) .Set(KcbChidinhclsChitiet.Columns.KetQua).EqualTo(objChidinhclsChitiet.KetQua) .Set(KcbChidinhclsChitiet.Columns.ImgPath1).EqualTo(objChidinhclsChitiet.ImgPath1) .Set(KcbChidinhclsChitiet.Columns.ImgPath2).EqualTo(objChidinhclsChitiet.ImgPath2) .Set(KcbChidinhclsChitiet.Columns.ImgPath3).EqualTo(objChidinhclsChitiet.ImgPath3) .Set(KcbChidinhclsChitiet.Columns.ImgPath4).EqualTo(objChidinhclsChitiet.ImgPath4) //.Set(KcbChidinhclsChitiet.Columns.VungKs).EqualTo(objChidinhclsChitiet.VungKs) .Set(KcbChidinhclsChitiet.Columns.NgayThuchien).EqualTo(objChidinhclsChitiet.NgayThuchien) .Set(KcbChidinhclsChitiet.Columns.NguoiThuchien).EqualTo(objChidinhclsChitiet.NguoiThuchien) .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(objChidinhclsChitiet.IdChitietchidinh).Execute(); } scope.Complete(); log.Info("Luu thong tin cua hinh ah thanh cong"); return(ActionResult.Success); } }catch (Exception exception) { log.Error("loi luu hinh anh :" + exception.ToString()); return(ActionResult.Error); } }
private KcbChidinhclsChitiet[] CreateChiDinhCLS() { var query = from thuoc in grdDichvuSaochep.GetCheckedRows() where Utility.Int32Dbnull(thuoc.Cells["id_loaithanhtoan"].Value) == 2 select thuoc; var gridExRows = query as GridEXRow[] ?? query.ToArray(); var arrDetail = new KcbChidinhclsChitiet[gridExRows.Count()]; int idx = 0; foreach (Janus.Windows.GridEX.GridEXRow gridExRow in gridExRows.AsEnumerable()) { arrDetail[idx] = new KcbChidinhclsChitiet(); arrDetail[idx].IdChitietchidinh = Utility.Int32Dbnull(gridExRow.Cells["id_phieu_chitiet"].Value); arrDetail[idx].SoLuong = Utility.Int32Dbnull(gridExRow.Cells["so_luong"].Value); idx++; } return(arrDetail); }
public ActionResult InsertDataChiDinhCLS(KcbChidinhcl objKcbChidinhcls, KcbLuotkham objLuotkham, KcbChidinhclsChitiet[] arrAssignDetails) { try { using (var scope = new TransactionScope()) { using (var sh = new SharedDbConnectionScope()) { if (objKcbChidinhcls != null) { if (objLuotkham == null) { objLuotkham = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objKcbChidinhcls.MaLuotkham) .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo( Utility.Int32Dbnull(objKcbChidinhcls.IdBenhnhan)).ExecuteSingle<KcbLuotkham>(); } if (objLuotkham != null) { objKcbChidinhcls.MaChidinh = THU_VIEN_CHUNG.SinhMaChidinhCLS(); objKcbChidinhcls.MaDoituongKcb = objLuotkham.MaDoituongKcb; objKcbChidinhcls.IdLoaidoituongKcb = objLuotkham.IdLoaidoituongKcb; objKcbChidinhcls.IdDoituongKcb = objLuotkham.IdDoituongKcb; objKcbChidinhcls.MaKhoaChidinh = globalVariables.MA_KHOA_THIEN; objKcbChidinhcls.IsNew = true; objKcbChidinhcls.Save(); InsertAssignDetail(objKcbChidinhcls, objLuotkham, arrAssignDetails); } else { return ActionResult.Error; } } } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { log.InfoException("Loi thong tin {0}", exception); return ActionResult.Error; } }
private bool InValiAssign() { bool b_Cancel = false; if (grdDetail.GetCheckedRows().Length <= 0) { Utility.ShowMsg("Bạn phải chọn một bản ghi thực hiện xóa chỉ định kiểm nghiệm", "Thông báo", MessageBoxIcon.Warning); grdDetail.Focus(); return(false); } foreach (GridEXRow gridExRow in grdDetail.GetCheckedRows()) { int AssignDetail_ID = Utility.Int32Dbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.IdChitietchidinh].Value, -1); KcbChidinhclsChitiet objchitiet = KcbChidinhclsChitiet.FetchByID(AssignDetail_ID); if (!globalVariables.IsAdmin) { if (objchitiet != null && objchitiet.NguoiTao != globalVariables.UserName) { 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); } } if (objchitiet != null && Utility.ByteDbnull(objchitiet.TrangthaiThanhtoan, 0) > 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); } if (objchitiet != null && Utility.ByteDbnull(objchitiet.TrangThai, 0) >= 1) { Utility.ShowMsg("Chỉ định bạn chọn đã được chuyển làm kiểm nghiệm hoặc đã có kết quả nên không thể xóa. Đề nghị kiểm tra lại"); return(false); } } return(true); }
public static void GB_TinhPhtramBHYT(KcbChidinhclsChitiet objChidinhChitiet, KcbLichsuDoituongKcb objLichsu, bool noitru, decimal PTramBHYT) { byte TrangthaiBhyt = 1; decimal BHYT_PTRAM_TRAITUYENNOITRU = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_PTRAM_TRAITUYENNOITRU", "0", false), 0m); bool b_ExistPtramBHYT = false; if (!THU_VIEN_CHUNG.IsBaoHiem(objLichsu.IdLoaidoituongKcb.Value))//Đối tượng DV { TrangthaiBhyt = (byte)0; objChidinhChitiet.TuTuc = 0; } else { TrangthaiBhyt = (byte)(globalVariables.gv_blnApdungChedoDuyetBHYT ? 0 : 1); } if (Utility.Int32Dbnull(objChidinhChitiet.TrangthaiHuy, -1) == -1) { objChidinhChitiet.TrangthaiHuy = 0; } DmucDichvuclsChitiet obServiceDetail = DmucDichvuclsChitiet.FetchByID(Utility.Int32Dbnull(objChidinhChitiet.IdChitietdichvu)); if (obServiceDetail != null) { objChidinhChitiet.GiaDanhmuc = Utility.DecimaltoDbnull(obServiceDetail.DonGia); } objChidinhChitiet.PtramBhyt = PTramBHYT; objChidinhChitiet.PtramBhytGoc = objLichsu.PtramBhytGoc; objChidinhChitiet.LoaiChietkhau = 0; objChidinhChitiet.TrangthaiBhyt = TrangthaiBhyt; objChidinhChitiet.IdLoaichidinh = 0;//Chưa hiểu trường này-->Cần xem lại if (Utility.Int32Dbnull(objChidinhChitiet.TuTuc, 0) == 1) { objChidinhChitiet.BhytChitra = 0; objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0); objChidinhChitiet.PtramBhyt = 0; } else { //Mục tính BHYT đặc biệt để dành sử dụng trong tương lai PtramBHYTDacBiet(objChidinhChitiet, objLichsu, 2, ref b_ExistPtramBHYT); if (b_ExistPtramBHYT) { objChidinhChitiet.BhytChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia) * Utility.DecimaltoDbnull(objChidinhChitiet.PtramBhyt) / 100; objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - Utility.DecimaltoDbnull(objChidinhChitiet.BhytChitra); } else//99% rơi vào nhánh này { PTramBHYT = Utility.DecimaltoDbnull(objLichsu.PtramBhyt); decimal BHCT = 0m; if (objLichsu.DungTuyen == 1)//BHYT đúng tuyến rơi vào nhánh này dù nội trú ngay ngoại trú { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) * (Utility.DecimaltoDbnull(objLichsu.PtramBhyt, 0) / 100); } else//DV và BHYT trái tuyến { if (objLichsu.TrangthaiNoitru <= 0 || !noitru)//Đối tượng ngoại trú hoặc Chỉ định ngoại trú-->Lấy phần trăm ngoại trú { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) * (Utility.DecimaltoDbnull(objLichsu.PtramBhyt, 0) / 100); } else//Nội trú cần tính=đơn giá * % đầu thẻ * % tuyến { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia.Value, 0) * (Utility.DecimaltoDbnull(objLichsu.PtramBhytGoc, 0) / 100) * (BHYT_PTRAM_TRAITUYENNOITRU / 100); } } decimal BNCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - BHCT; objChidinhChitiet.BhytChitra = BHCT; objChidinhChitiet.BnhanChitra = BNCT; } } }
public bool Destroy(object IdChitietchidinh) { return(KcbChidinhclsChitiet.Destroy(IdChitietchidinh) == 1); }
public void Insert(long? IdKham,long IdChidinh,long? IdChidinhChuyengoi,short? IdDichvu,int IdChitietdichvu,decimal? PtramBhytGoc,decimal? PtramBhyt,decimal GiaDanhmuc,string MadoituongGia,decimal? DonGia,decimal? PhuThu,string NguoiTao,byte? IdLoaichidinh,DateTime? NgayTao,DateTime? NgaySua,string NguoiSua,byte? TrangthaiThanhtoan,DateTime? NgayThanhtoan,byte? TrangthaiHuy,byte? TuTuc,byte? LoaiChietkhau,short? IdDoituongKcb,long? IdBenhnhan,string MaLuotkham,int? SoLuong,byte? TrangThai,string MotaThem,byte? TrangthaiBhyt,byte HienthiBaocao,decimal? BhytChitra,decimal? BnhanChitra,int? IdThanhtoan,short? IdKhoaThuchien,short? IdPhongThuchien,byte? TrangthaiChuyencls,decimal? TileChietkhau,decimal? TienChietkhau,string KieuChietkhau,int? IdGoi,byte? TrongGoi,short? IdBacsiThuchien,string NguoiThuchien,DateTime? NgayThuchien,string ImgPath1,string ImgPath2,string ImgPath3,string ImgPath4,string KetLuan,string KetQua,string DeNghi,string MaVungkhaosat,byte? TrangthaiXacnhan,string KetquaXn,byte? ChidinhGoidichvu,short? SoLanTiem,short? Mui1,short? Mui2,short? Mui3,short? Mui4,short? Mui5,short? NhacLai,DateTime? NgayBatDauTiem,DateTime? NgayNhacLaiTiem,short? GuiSMS,string ChanDoan,string GhiChu,short? ThangThai,short? TuanThai,string MuiTiemTiepTheo,string Barcode,int? SoNgayNhac) { KcbChidinhclsChitiet item = new KcbChidinhclsChitiet(); item.IdKham = IdKham; item.IdChidinh = IdChidinh; item.IdChidinhChuyengoi = IdChidinhChuyengoi; item.IdDichvu = IdDichvu; item.IdChitietdichvu = IdChitietdichvu; item.PtramBhytGoc = PtramBhytGoc; item.PtramBhyt = PtramBhyt; item.GiaDanhmuc = GiaDanhmuc; item.MadoituongGia = MadoituongGia; item.DonGia = DonGia; item.PhuThu = PhuThu; item.NguoiTao = NguoiTao; item.IdLoaichidinh = IdLoaichidinh; item.NgayTao = NgayTao; item.NgaySua = NgaySua; item.NguoiSua = NguoiSua; item.TrangthaiThanhtoan = TrangthaiThanhtoan; item.NgayThanhtoan = NgayThanhtoan; item.TrangthaiHuy = TrangthaiHuy; item.TuTuc = TuTuc; item.LoaiChietkhau = LoaiChietkhau; item.IdDoituongKcb = IdDoituongKcb; item.IdBenhnhan = IdBenhnhan; item.MaLuotkham = MaLuotkham; item.SoLuong = SoLuong; item.TrangThai = TrangThai; item.MotaThem = MotaThem; item.TrangthaiBhyt = TrangthaiBhyt; item.HienthiBaocao = HienthiBaocao; item.BhytChitra = BhytChitra; item.BnhanChitra = BnhanChitra; item.IdThanhtoan = IdThanhtoan; item.IdKhoaThuchien = IdKhoaThuchien; item.IdPhongThuchien = IdPhongThuchien; item.TrangthaiChuyencls = TrangthaiChuyencls; item.TileChietkhau = TileChietkhau; item.TienChietkhau = TienChietkhau; item.KieuChietkhau = KieuChietkhau; item.IdGoi = IdGoi; item.TrongGoi = TrongGoi; item.IdBacsiThuchien = IdBacsiThuchien; item.NguoiThuchien = NguoiThuchien; item.NgayThuchien = NgayThuchien; item.ImgPath1 = ImgPath1; item.ImgPath2 = ImgPath2; item.ImgPath3 = ImgPath3; item.ImgPath4 = ImgPath4; item.KetLuan = KetLuan; item.KetQua = KetQua; item.DeNghi = DeNghi; item.MaVungkhaosat = MaVungkhaosat; item.TrangthaiXacnhan = TrangthaiXacnhan; item.KetquaXn = KetquaXn; item.ChidinhGoidichvu = ChidinhGoidichvu; item.SoLanTiem = SoLanTiem; item.Mui1 = Mui1; item.Mui2 = Mui2; item.Mui3 = Mui3; item.Mui4 = Mui4; item.Mui5 = Mui5; item.NhacLai = NhacLai; item.NgayBatDauTiem = NgayBatDauTiem; item.NgayNhacLaiTiem = NgayNhacLaiTiem; item.GuiSMS = GuiSMS; item.ChanDoan = ChanDoan; item.GhiChu = GhiChu; item.ThangThai = ThangThai; item.TuanThai = TuanThai; item.MuiTiemTiepTheo = MuiTiemTiepTheo; item.Barcode = Barcode; item.SoNgayNhac = SoNgayNhac; item.Save(UserName); }
/// <summary> /// hàm thực hiện việc tạo mảng thông tin của chỉ định chi tiết cận lâm sàng /// </summary> /// <returns></returns> private KcbChidinhclsChitiet[] CreateArrAssignDetail() { int i = 0; foreach (GridEXRow gridExRow in grdAssignDetail.GetDataRows()) { if (gridExRow.RowType == RowType.Record) i++; } int idx = 0; var arrAssignDetail = new KcbChidinhclsChitiet[i]; foreach (GridEXRow gridExRow in grdAssignDetail.GetDataRows()) { if (gridExRow.RowType == RowType.Record) { arrAssignDetail[idx] = new KcbChidinhclsChitiet(); if (Utility.Int64Dbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.IdChitietchidinh].Value, -1) > 0) { arrAssignDetail[idx].IsLoaded = true; arrAssignDetail[idx].IsNew = false; arrAssignDetail[idx].MarkOld(); arrAssignDetail[idx].IdChitietchidinh = Utility.Int64Dbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.IdChitietchidinh].Value, -1); } else { arrAssignDetail[idx].IsNew = true; } arrAssignDetail[idx].IdChidinh = Utility.Int32Dbnull(txtAssign_ID.Text, -1); arrAssignDetail[idx].NguoiTao = globalVariables.UserName; arrAssignDetail[idx].IdDichvu = Utility.Int16Dbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.IdDichvu].Value, -1); arrAssignDetail[idx].IdChitietdichvu = Utility.Int16Dbnull( gridExRow.Cells[KcbChidinhclsChitiet.Columns.IdChitietdichvu].Value, -1); arrAssignDetail[idx].SoLuong = Utility.Int16Dbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.SoLuong].Value, 1); arrAssignDetail[idx].DonGia = Utility.DecimaltoDbnull( gridExRow.Cells[KcbChidinhclsChitiet.Columns.DonGia].Value, 0); arrAssignDetail[idx].PhuThu = Utility.DecimaltoDbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.PhuThu].Value, 0); arrAssignDetail[idx].HienthiBaocao = 0; if (m_eAction == action.Insert) { arrAssignDetail[idx].TrangthaiBhyt = 0; arrAssignDetail[idx].TrangthaiHuy = 0; arrAssignDetail[idx].TrangThai = 0; } arrAssignDetail[idx].TrangthaiThanhtoan = Utility.ByteDbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.TrangthaiThanhtoan].Value, 0); //arrAssignDetail[idx].MotaThem = Utility.sDbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.MotaThem].Value, ""); arrAssignDetail[idx].NgayTao = globalVariables.SysDate; arrAssignDetail[idx].TuTuc = Utility.ByteDbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.TuTuc].Value, 0); arrAssignDetail[idx].IdThanhtoan = Utility.Int32Dbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.IdThanhtoan].Value, -1); if (Utility.Int32Dbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.TuTuc].Value, 0) == 0) { decimal BHCT = 0m; if (objLuotkham.DungTuyen == 1) { BHCT = Utility.DecimaltoDbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.DonGia].Value, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else { if (objLuotkham.TrangthaiNoitru <= 0) BHCT = Utility.DecimaltoDbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.DonGia].Value, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); else//Nội trú cần tính=đơn giá * % đầu thẻ * % tuyến BHCT = Utility.DecimaltoDbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.DonGia].Value, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0) / 100) * (BHYT_PTRAM_TRAITUYENNOITRU / 100); } decimal BNCT = Utility.DecimaltoDbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.DonGia].Value, 0) - BHCT; arrAssignDetail[idx].BhytChitra = BHCT; arrAssignDetail[idx].BnhanChitra = BNCT; arrAssignDetail[idx].PtramBhyt = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0); arrAssignDetail[idx].PtramBhytGoc = Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0); } else { arrAssignDetail[idx].PtramBhyt = 0; arrAssignDetail[idx].PtramBhytGoc = 0; arrAssignDetail[idx].BhytChitra = 0; arrAssignDetail[idx].BnhanChitra = Utility.DecimaltoDbnull(gridExRow.Cells[KcbChidinhclsChitiet.Columns.DonGia].Value, 0); } arrAssignDetail[idx].IpMaysua = globalVariables.gv_strIPAddress; arrAssignDetail[idx].TenMaysua = globalVariables.gv_strComputerName; arrAssignDetail[idx].IpMaytao = globalVariables.gv_strIPAddress; arrAssignDetail[idx].TenMaytao = globalVariables.gv_strComputerName; idx++; } } return arrAssignDetail; }
/// <summary> /// hàm thực hienj việc tính phâm trăm bảo hiểm /// </summary> /// <param name="objChidinhChitiet"></param> /// <param name="PTramBHYT"></param> public static void GB_TinhPhtramBHYT(KcbChidinhclsChitiet objChidinhChitiet, KcbLuotkham objLuotkham, bool noitru, decimal PTramBHYT) { byte trangthaiBhyt = 1; decimal bhytPtramTraituyennoitru = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_PTRAM_TRAITUYENNOITRU", "0", false), 0m); bool bExistPtramBHYT = false; if (objLuotkham.IdLoaidoituongKcb != null && !THU_VIEN_CHUNG.IsBaoHiem(objLuotkham.IdLoaidoituongKcb.Value))//Đối tượng DV { trangthaiBhyt = (byte)0; objChidinhChitiet.TuTuc = 0; } else { trangthaiBhyt = (byte)(globalVariables.gv_blnApdungChedoDuyetBHYT ? 0 : 1); } if (Utility.Int32Dbnull(objChidinhChitiet.TrangthaiHuy, -1) == -1) { objChidinhChitiet.TrangthaiHuy = 0; } //DataTable dtDichvu = SPs.SpKcbLaydoituongDichvuChitiet(objChidinhChitiet.IdChitietdichvu).GetDataSet().Tables[0]; //if (dtDichvu != null && dtDichvu.Rows.Count>0) //{ // objChidinhChitiet.GiaDanhmuc = Utility.DecimaltoDbnull(dtDichvu.Rows[0]["Don_Gia"]); //} objChidinhChitiet.GiaDanhmuc = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0); objChidinhChitiet.PtramBhyt = PTramBHYT; objChidinhChitiet.PtramBhytGoc = objLuotkham.PtramBhytGoc; objChidinhChitiet.LoaiChietkhau = 0; objChidinhChitiet.TrangthaiBhyt = trangthaiBhyt; objChidinhChitiet.IdLoaichidinh = 0;//Chưa hiểu trường này-->Cần xem lại if (Utility.Int32Dbnull(objChidinhChitiet.TuTuc, 0) == 1) { objChidinhChitiet.BhytChitra = 0; objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0); objChidinhChitiet.PtramBhyt = 0; } else { //Mục tính BHYT đặc biệt để dành sử dụng trong tương lai PtramBHYTDacBiet(objChidinhChitiet, objLuotkham, 2, ref bExistPtramBHYT); if (bExistPtramBHYT) { objChidinhChitiet.BhytChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia) * Utility.DecimaltoDbnull(objChidinhChitiet.PtramBhyt) / 100; objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - Utility.DecimaltoDbnull(objChidinhChitiet.BhytChitra); } else//99% rơi vào nhánh này { PTramBHYT = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt); decimal BHCT = 0m; if (objLuotkham.DungTuyen == 1)//BHYT đúng tuyến rơi vào nhánh này dù nội trú ngay ngoại trú { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else//DV và BHYT trái tuyến { if (objLuotkham.TrangthaiNoitru <= 0 || !noitru)//Đối tượng ngoại trú hoặc Chỉ định ngoại trú-->Lấy phần trăm ngoại trú { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else//Nội trú cần tính=đơn giá * % đầu thẻ * % tuyến if (objChidinhChitiet.DonGia != null) { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia.Value, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0) / 100) * (bhytPtramTraituyennoitru / 100); } } decimal bnct = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - BHCT; objChidinhChitiet.BhytChitra = BHCT; objChidinhChitiet.BnhanChitra = bnct; } } }
/// <summary> /// hàm thực hienj việc tính phâm trăm bảo hiểm /// </summary> /// <param name="objChidinhChitiet"></param> /// <param name="PTramBHYT"></param> public static void GB_TinhPhtramBHYT(KcbChidinhclsChitiet objChidinhChitiet, KcbLuotkham objLuotkham,bool noitru, decimal PTramBHYT) { byte TrangthaiBhyt = 1; decimal BHYT_PTRAM_TRAITUYENNOITRU = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_PTRAM_TRAITUYENNOITRU", "0", false), 0m); bool b_ExistPtramBHYT = false; if (!THU_VIEN_CHUNG.IsBaoHiem(objLuotkham.IdLoaidoituongKcb.Value))//Đối tượng DV { TrangthaiBhyt = (byte)0; objChidinhChitiet.TuTuc = 0; } else TrangthaiBhyt = (byte)(globalVariables.gv_blnApdungChedoDuyetBHYT ? 0 : 1); if (Utility.Int32Dbnull(objChidinhChitiet.TrangthaiHuy, -1) == -1) objChidinhChitiet.TrangthaiHuy = 0; DmucDichvuclsChitiet obServiceDetail = DmucDichvuclsChitiet.FetchByID(Utility.Int32Dbnull(objChidinhChitiet.IdChitietdichvu)); if (obServiceDetail != null) { objChidinhChitiet.GiaDanhmuc = Utility.DecimaltoDbnull(obServiceDetail.DonGia); } objChidinhChitiet.PtramBhyt = PTramBHYT; objChidinhChitiet.PtramBhytGoc = objLuotkham.PtramBhytGoc; objChidinhChitiet.LoaiChietkhau = 0; objChidinhChitiet.TrangthaiBhyt = TrangthaiBhyt; objChidinhChitiet.IdLoaichidinh = 0;//Chưa hiểu trường này-->Cần xem lại if (Utility.Int32Dbnull(objChidinhChitiet.TuTuc, 0) == 1) { objChidinhChitiet.BhytChitra = 0; objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0); objChidinhChitiet.PtramBhyt = 0; } else { //Mục tính BHYT đặc biệt để dành sử dụng trong tương lai PtramBHYTDacBiet(objChidinhChitiet, objLuotkham, 2, ref b_ExistPtramBHYT); if (b_ExistPtramBHYT) { objChidinhChitiet.BhytChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia) * Utility.DecimaltoDbnull(objChidinhChitiet.PtramBhyt) / 100; objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - Utility.DecimaltoDbnull(objChidinhChitiet.BhytChitra); } else//99% rơi vào nhánh này { PTramBHYT = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt); decimal BHCT = 0m; if (objLuotkham.DungTuyen == 1)//BHYT đúng tuyến rơi vào nhánh này dù nội trú ngay ngoại trú { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else//DV và BHYT trái tuyến { if (objLuotkham.TrangthaiNoitru <= 0 || !noitru)//Đối tượng ngoại trú hoặc Chỉ định ngoại trú-->Lấy phần trăm ngoại trú BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); else//Nội trú cần tính=đơn giá * % đầu thẻ * % tuyến BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia.Value, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0) / 100) * (BHYT_PTRAM_TRAITUYENNOITRU / 100); } decimal BNCT =Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) -BHCT; objChidinhChitiet.BhytChitra =BHCT; objChidinhChitiet.BnhanChitra = BNCT; } } }
/// <summary> /// hàm thực hienj việc tính phâm trăm bảo hiểm /// </summary> /// <param name="objAssignDetail"></param> /// <param name="PTramBHYT"></param> public static void GB_TinhPhtramBHYT(KcbChidinhclsChitiet objAssignDetail, KcbLuotkham objLuotkham, decimal PTramBHYT) { byte TrangthaiBhyt = 1; decimal BHYT_PTRAM_TRAITUYENNOITRU = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_PTRAM_TRAITUYENNOITRU", "0", false), 0m); bool b_ExistPtramBHYT = false; if (!THU_VIEN_CHUNG.IsBaoHiem(objLuotkham.IdLoaidoituongKcb.Value))//(objLuotkham.MaDoituongKcb == "DV")//Tự túc { TrangthaiBhyt = (byte)0; objAssignDetail.TuTuc = 0; } else TrangthaiBhyt = (byte)(globalVariables.gv_blnApdungChedoDuyetBHYT ? 0 : 1); if (Utility.Int32Dbnull(objAssignDetail.TrangthaiHuy, -1) == -1) objAssignDetail.TrangthaiHuy = 0; DmucDichvuclsChitiet obServiceDetail = DmucDichvuclsChitiet.FetchByID(Utility.Int32Dbnull(objAssignDetail.IdChitietchidinh)); if (obServiceDetail != null) { objAssignDetail.GiaDanhmuc = Utility.DecimaltoDbnull(obServiceDetail.DonGia); } objAssignDetail.PtramBhyt = PTramBHYT; objAssignDetail.PtramBhytGoc = objLuotkham.PtramBhytGoc; objAssignDetail.LoaiChietkhau = 0; objAssignDetail.TrangthaiBhyt = TrangthaiBhyt; objAssignDetail.IdLoaichidinh = 0; if (Utility.Int32Dbnull(objAssignDetail.TuTuc, 0) == 1) { objAssignDetail.BhytChitra = 0; objAssignDetail.BnhanChitra = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0); objAssignDetail.PtramBhyt = 0; } else { PtramBHYTDacBiet(objAssignDetail, objLuotkham, 2, ref b_ExistPtramBHYT); if (b_ExistPtramBHYT) { objAssignDetail.BhytChitra = Utility.DecimaltoDbnull(objAssignDetail.DonGia) * Utility.DecimaltoDbnull(objAssignDetail.PtramBhyt) / 100; objAssignDetail.BnhanChitra = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0) - Utility.DecimaltoDbnull(objAssignDetail.BhytChitra); } else { PTramBHYT = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt); decimal BHCT = 0m; if (objLuotkham.DungTuyen == 1) { BHCT = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else { if (objLuotkham.TrangthaiNoitru <= 0) BHCT = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); else//Nội trú cần tính=đơn giá * % đầu thẻ * % tuyến BHCT = Utility.DecimaltoDbnull(objAssignDetail.DonGia.Value, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0) / 100) * (BHYT_PTRAM_TRAITUYENNOITRU / 100); } decimal BNCT = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0) - BHCT; objAssignDetail.BhytChitra =BHCT; objAssignDetail.BnhanChitra = BNCT; //objAssignDetail.BhytChitra = Utility.DecimaltoDbnull(objAssignDetail.DonGia) * // Utility.DecimaltoDbnull(PTramBHYT) / 100; } } }
public static void TinhGiaChiDinhCLS(KcbLuotkham objLuotkham,KcbChidinhclsChitiet objAssignDetail) { GB_TinhPhtramBHYT(objAssignDetail, objLuotkham,Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0)); }
//KcbChidinhclsChitiet.Trang_thai:0=Mới chỉ định;1=Đã chuyển CLS;2=Đang thực hiện;3= Đã có kết quả CLS;4=Đã xác nhận kết quả void grdKetqua_UpdatingCell(object sender, UpdatingCellEventArgs e) { try { List <KcbKetquaCl> lstResult = new List <KcbKetquaCl>(); List <KcbChidinhclsChitiet> lstDetails = new List <KcbChidinhclsChitiet>(); int id_kq = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdKetqua, KcbKetquaCl.Columns.IdKq), -1); int IdChitietchidinh = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdKetqua, KcbChidinhclsChitiet.Columns.IdChitietchidinh), -1); int IdChitietchidinhcha = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdChidinh, KcbChidinhclsChitiet.Columns.IdChitietchidinh), -1); int CoChitiet = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdChidinh, DmucDichvuclsChitiet.Columns.CoChitiet), -1); int IdChitietdichvu = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdKetqua, DmucDichvuclsChitiet.Columns.IdChitietdichvu), -1); KcbKetquaCl _item = null; KcbChidinhclsChitiet _itemchitiet = KcbChidinhclsChitiet.FetchByID(IdChitietchidinh); KcbChidinhclsChitiet _itemchitietcha = null; if (CoChitiet == 1) { _itemchitietcha = KcbChidinhclsChitiet.FetchByID(IdChitietchidinhcha); if (_itemchitietcha != null) { _itemchitietcha.IsNew = false; _itemchitietcha.MarkOld(); } } _itemchitiet.IsNew = false; _itemchitiet.MarkOld(); if (id_kq > 0) { _item = KcbKetquaCl.FetchByID(id_kq); _item.IsNew = false; _item.NguoiSua = globalVariables.UserName; _item.NgaySua = globalVariables.SysDate; _item.IpMaysua = globalVariables.gv_strIPAddress; _item.TenMaysua = globalVariables.gv_strComputerName; _item.MarkOld(); } else { _item = new KcbKetquaCl(); _item.IsNew = true; _item.NguoiTao = globalVariables.UserName; _item.NgayTao = globalVariables.SysDate; _item.IpMaytao = globalVariables.gv_strIPAddress; _item.TenMaytao = globalVariables.gv_strComputerName; } DmucDichvuclsChitiet objcls = DmucDichvuclsChitiet.FetchByID(IdChitietdichvu); if (objcls != null) { _item.MaChidinh = Utility.GetValueFromGridColumn(grdChidinh, KcbChidinhcl.Columns.MaChidinh); _item.MaBenhpham = Utility.GetValueFromGridColumn(grdChidinh, KcbChidinhcl.Columns.MaBenhpham); _item.Barcode = Utility.GetValueFromGridColumn(grdChidinh, KcbChidinhcl.Columns.Barcode); _item.IdBenhnhan = id_benhnhan; _item.MaLuotkham = ma_luotkham; _item.IdChidinh = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdKetqua, KcbChidinhclsChitiet.Columns.IdChidinh), -1); _item.IdChitietchidinh = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdKetqua, KcbChidinhclsChitiet.Columns.IdChitietchidinh), -1); _item.IdDichvu = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdKetqua, KcbChidinhclsChitiet.Columns.IdDichvu), -1); _item.IdDichvuchitiet = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdKetqua, KcbChidinhclsChitiet.Columns.IdChitietdichvu), -1); _item.Barcode = Utility.GetValueFromGridColumn(grdChidinh, KcbChidinhcl.Columns.Barcode); _item.SttIn = objcls.SttHthi; _item.BtNam = objcls.BinhthuongNam; _item.BtNu = objcls.BinhthuongNu; _item.KetQua = Utility.sDbnull(e.Value, ""); if (_item.TrangThai < 3) { _item.TrangThai = 3; } if (chkSaveAndConfirm.Checked) { _item.TrangThai = 4;//Duyệt luôn để hiển thị trên form thăm khám của bác sĩ } if (Utility.DoTrim(_item.KetQua) == "") { _item.TrangThai = 2;//Quay ve trang thai chuyen đang thực hiện } //_item.TenDonvitinh = objcls.TenDonvitinh; _itemchitiet.KetQua = Utility.sDbnull(e.Value, ""); if (_itemchitiet.TrangThai < 3) { _itemchitiet.TrangThai = 3; } if (chkSaveAndConfirm.Checked) { _itemchitiet.TrangThai = 4;//Duyệt luôn để hiển thị trên form thăm khám của bác sĩ } if (Utility.DoTrim(_itemchitiet.KetQua) == "") { _itemchitiet.TrangThai = 1;//Quay ve trang thai chuyen can } if (_itemchitietcha != null && _itemchitietcha.TrangThai < 3) { _itemchitietcha.TrangThai = 3; } if (_itemchitietcha != null && chkSaveAndConfirm.Checked) { _itemchitietcha.TrangThai = 4;//Duyệt luôn để hiển thị trên form thăm khám của bác sĩ } if (_itemchitietcha != null && Utility.DoTrim(Utility.sDbnull(e.Value, "")) == "") { _itemchitietcha.TrangThai = 1;//Quay ve trang thai chuyen can } _item.TenThongso = ""; _item.TenKq = ""; _item.LoaiKq = 0; _item.ChophepHienthi = 1; _item.ChophepIn = 1; _item.MotaThem = objcls.MotaThem; lstResult.Add(_item); lstDetails.Add(_itemchitiet); if (_itemchitietcha != null) { lstDetails.Add(_itemchitietcha); } if (clsXN.UpdateResult(lstResult, lstDetails) != ActionResult.Success) { e.Cancel = true; } } } catch (Exception) { } }
void mnuCancelResult_Click(object sender, EventArgs e) { if (grdKetqua.SelectedItems.Count > 1) { if (!Utility.AcceptQuestion("Bạn có chắc chắn muốn hủy kết quả các xét nghiệm đang chọn", "Hủy kết quả", true)) { return; } } List <KcbKetquaCl> lstResult = new List <KcbKetquaCl>(); List <KcbChidinhclsChitiet> lstDetails = new List <KcbChidinhclsChitiet>(); foreach (GridEXRow row in grdKetqua.SelectedItems) { KcbKetquaCl _item = null; KcbChidinhclsChitiet _itemchitiet = null; try { int id_kq = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(row, KcbKetquaCl.Columns.IdKq), -1); int IdChitietchidinh = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(row, KcbChidinhclsChitiet.Columns.IdChitietchidinh), -1); int IdChitietdichvu = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(row, DmucDichvuclsChitiet.Columns.IdChitietdichvu), -1); _itemchitiet = KcbChidinhclsChitiet.FetchByID(IdChitietchidinh); _itemchitiet.IsNew = false; _itemchitiet.MarkOld(); if (id_kq > 0) { _item = KcbKetquaCl.FetchByID(id_kq); _item.IsNew = false; _item.NguoiSua = globalVariables.UserName; _item.NgaySua = globalVariables.SysDate; _item.IpMaysua = globalVariables.gv_strIPAddress; _item.TenMaysua = globalVariables.gv_strComputerName; _item.MarkOld(); } else { _item = new KcbKetquaCl(); _item.IsNew = true; _item.NguoiTao = globalVariables.UserName; _item.NgayTao = globalVariables.SysDate; _item.IpMaytao = globalVariables.gv_strIPAddress; _item.TenMaytao = globalVariables.gv_strComputerName; } DmucDichvuclsChitiet objcls = DmucDichvuclsChitiet.FetchByID(IdChitietdichvu); if (objcls != null) { _item.MaChidinh = Utility.GetValueFromGridColumn(grdChidinh, KcbChidinhcl.Columns.MaChidinh); _item.MaBenhpham = Utility.GetValueFromGridColumn(grdChidinh, KcbChidinhcl.Columns.MaBenhpham); _item.Barcode = Utility.GetValueFromGridColumn(grdChidinh, KcbChidinhcl.Columns.Barcode); _item.IdBenhnhan = id_benhnhan; _item.MaLuotkham = ma_luotkham; _item.IdChidinh = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(row, KcbChidinhclsChitiet.Columns.IdChidinh), -1); _item.IdChitietchidinh = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(row, KcbChidinhclsChitiet.Columns.IdChitietchidinh), -1); _item.IdDichvu = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(row, KcbChidinhclsChitiet.Columns.IdDichvu), -1); _item.IdDichvuchitiet = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(row, KcbChidinhclsChitiet.Columns.IdChitietdichvu), -1); _item.Barcode = Utility.GetValueFromGridColumn(grdChidinh, KcbChidinhcl.Columns.Barcode); _item.SttIn = objcls.SttHthi; _item.BtNam = objcls.BinhthuongNam; _item.BtNu = objcls.BinhthuongNu; _item.KetQua = Utility.sDbnull(Utility.GetValueFromGridColumn(row, KcbChidinhclsChitiet.Columns.KetQua), -1); if (_item.TrangThai < 3) { _item.TrangThai = 3; } if (chkSaveAndConfirm.Checked) { _item.TrangThai = 4;//Duyệt luôn để hiển thị trên form thăm khám của bác sĩ } if (Utility.DoTrim(_item.KetQua) == "") { _item.TrangThai = 2;//Quay ve trang thai chuyen đang thực hiện } //_item.TenDonvitinh = objcls.TenDonvitinh; _itemchitiet.KetQua = Utility.sDbnull(Utility.GetValueFromGridColumn(row, KcbChidinhclsChitiet.Columns.KetQua), -1); if (_itemchitiet.TrangThai < 3) { _itemchitiet.TrangThai = 3; } if (chkSaveAndConfirm.Checked) { _itemchitiet.TrangThai = 4;//Duyệt luôn để hiển thị trên form thăm khám của bác sĩ } if (Utility.DoTrim(_itemchitiet.KetQua) == "") { _itemchitiet.TrangThai = 1;//Quay ve trang thai chuyen can } _item.TenThongso = ""; _item.TenKq = ""; _item.LoaiKq = 0; _item.ChophepHienthi = 1; _item.ChophepIn = 1; _item.MotaThem = objcls.MotaThem; } lstResult.Add(_item); lstDetails.Add(_itemchitiet); } catch (Exception) { } } if (clsXN.UpdateResult(lstResult, lstDetails) == ActionResult.Success) { Utility.ShowMsg("Đã hủy kết quả các xét nghiệm đang chọn thành công"); } else { Utility.ShowMsg("Lỗi khi thực hiện hủy kết quả xét nghiệm"); } }
void UpdateDataTable(KcbChidinhclsChitiet objAssignDetail) { try { if (!Utility.isValidGrid(grdList)) return; DataRow dr = m_dKcbChidinhclsChitiet.Select(VKcbChidinhcl.Columns.IdChitietchidinh + "=" + txtidchidinhchitiet.Text)[0]; dr[VKcbChidinhcl.Columns.ImgPath1] = objAssignDetail.ImgPath1; dr[VKcbChidinhcl.Columns.ImgPath2] = objAssignDetail.ImgPath2; dr[VKcbChidinhcl.Columns.ImgPath3] = objAssignDetail.ImgPath3; dr[VKcbChidinhcl.Columns.ImgPath4] = objAssignDetail.ImgPath4; if (PropertyLib._FTPProperties.Push2FTP) { dr["Local1"] = localpath1; dr["Local2"] = localpath2; dr["Local3"] = localpath3; dr["Local4"] = localpath4; } else { dr["Local1"] = objAssignDetail.ImgPath1; dr["Local2"] = objAssignDetail.ImgPath2; dr["Local3"] = objAssignDetail.ImgPath3; dr["Local4"] = objAssignDetail.ImgPath4; } dr[KcbChidinhclsChitiet.Columns.TrangThai] = chkXacnhan.Checked ? 4 : 3; dr["ten_trangthai"] = GetAsssignDetailStatus(chkXacnhan.Checked ? 4 : 3); m_dKcbChidinhclsChitiet.AcceptChanges(); } catch { } }
void Confirm() { byte _result = 3; try { foreach (GridEXRow row in grdKetqua.GetDataRows()) { List <KcbKetquaCl> lstResult = new List <KcbKetquaCl>(); List <KcbChidinhclsChitiet> lstDetails = new List <KcbChidinhclsChitiet>(); int id_kq = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(row, KcbKetquaCl.Columns.IdKq), -1); int IdChitietchidinh = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(row, KcbChidinhclsChitiet.Columns.IdChitietchidinh), -1); int IdChitietchidinhcha = Utility.Int32Dbnull(dtChidinh.Rows[0][KcbChidinhclsChitiet.Columns.IdChitietchidinh], -1); int IdChitietdichvu = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(row, DmucDichvuclsChitiet.Columns.IdChitietdichvu), -1); DmucDichvuclsChitiet objcls = DmucDichvuclsChitiet.FetchByID(IdChitietdichvu); int CoChitiet = Utility.Int32Dbnull(objcls.CoChitiet, 0); KcbKetquaCl _item = null; KcbChidinhclsChitiet _itemchitiet = KcbChidinhclsChitiet.FetchByID(IdChitietchidinh); KcbChidinhclsChitiet _itemchitietcha = null; if (CoChitiet == 1) { _itemchitietcha = KcbChidinhclsChitiet.FetchByID(IdChitietchidinhcha); if (_itemchitietcha != null) { _itemchitietcha.IsNew = false; _itemchitietcha.MarkOld(); } } _itemchitiet.IsNew = false; _itemchitiet.MarkOld(); if (id_kq > 0) { _item = KcbKetquaCl.FetchByID(id_kq); _item.IsNew = false; _item.NguoiSua = globalVariables.UserName; _item.NgaySua = globalVariables.SysDate; _item.IpMaysua = globalVariables.gv_strIPAddress; _item.TenMaysua = globalVariables.gv_strComputerName; _item.MarkOld(); } else { _item = new KcbKetquaCl(); _item.IsNew = true; _item.NguoiTao = globalVariables.UserName; _item.NgayTao = globalVariables.SysDate; _item.IpMaytao = globalVariables.gv_strIPAddress; _item.TenMaytao = globalVariables.gv_strComputerName; } if (objcls != null) { _item.MaChidinh = objChidinh.MaChidinh; _item.MaBenhpham = objChidinh.MaChidinh; _item.Barcode = objChidinh.Barcode; _item.IdBenhnhan = id_benhnhan; _item.MaLuotkham = ma_luotkham; _item.IdChidinh = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdKetqua, KcbChidinhclsChitiet.Columns.IdChidinh), -1); _item.IdChitietchidinh = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdKetqua, KcbChidinhclsChitiet.Columns.IdChitietchidinh), -1); _item.IdDichvu = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdKetqua, KcbChidinhclsChitiet.Columns.IdDichvu), -1); _item.IdDichvuchitiet = Utility.Int32Dbnull(Utility.GetValueFromGridColumn(grdKetqua, KcbChidinhclsChitiet.Columns.IdChitietdichvu), -1); _item.SttIn = objcls.SttHthi; _item.BtNam = objcls.BinhthuongNam; _item.BtNu = objcls.BinhthuongNu; _item.KetQua = Utility.DoTrim(Utility.GetValueFromGridColumn(row, "Ket_qua")); if (_item.TrangThai < 3) { _item.TrangThai = 3; } if (chkSaveAndConfirm.Checked) { _item.TrangThai = 4;//Duyệt luôn để hiển thị trên form thăm khám của bác sĩ } if (Utility.DoTrim(_item.KetQua) == "") { _item.TrangThai = 2;//Quay ve trang thai chuyen đang thực hiện } //_item.TenDonvitinh = objcls.TenDonvitinh; _itemchitiet.KetQua = _item.KetQua; if (_itemchitiet.TrangThai < 3) { _itemchitiet.TrangThai = 3; } if (chkSaveAndConfirm.Checked) { _itemchitiet.TrangThai = 4;//Duyệt luôn để hiển thị trên form thăm khám của bác sĩ } if (Utility.DoTrim(_itemchitiet.KetQua) == "") { _itemchitiet.TrangThai = 2;//Quay ve trang thai chuyen can } if (_itemchitietcha != null && _itemchitietcha.TrangThai < 3) { _itemchitietcha.TrangThai = 3; } if (_itemchitietcha != null && chkSaveAndConfirm.Checked) { _itemchitietcha.TrangThai = 4;//Duyệt luôn để hiển thị trên form thăm khám của bác sĩ } if (_itemchitietcha != null && _itemchitiet.KetQua == "") { _itemchitietcha.TrangThai = 2;//Quay ve trang thai chuyen can } _item.TenThongso = ""; _item.TenKq = ""; _item.LoaiKq = 0; _item.ChophepHienthi = 1; _item.ChophepIn = 1; _item.MotaThem = objcls.MotaThem; lstResult.Add(_item); lstDetails.Add(_itemchitiet); if (_itemchitietcha != null) { lstDetails.Add(_itemchitietcha); } if (clsXN.UpdateResult(lstResult, lstDetails) != ActionResult.Success) { } else { if (_OnResult != null) { _OnResult(_itemchitiet.IdChitietchidinh, Utility.ByteDbnull(_itemchitiet.TrangThai, 2)); } this.Close(); } } } } catch (Exception ex) { Utility.CatchException(ex); } }
private void StartAnalysisFile(string fullpath) { MyLog.Trace(string.Format("------------------Begin Analysing file {0}------------------", fullpath)); var lstLines = new List <string>(); try { if (Utility.Laygiatrithamsohethong("ASTM_SECURITY", "0", false) == "1") { //using (new NetworkConnection(_watcherPathInfo, Utility.CreateCredentials(Utility.Laygiatrithamsohethong("ASTM_UID", "UserName", false), Utility.Laygiatrithamsohethong("ASTM_PWD", "PassWord", false)))) var theNetworkCredential = new NetworkCredential(Utility.Laygiatrithamsohethong("ASTM_UID", "UserName", false), Utility.Laygiatrithamsohethong("ASTM_PWD", "PassWord", false)); var theNetcache = new CredentialCache(); theNetcache.Add(new Uri(Path.GetDirectoryName(fullpath)), "Basic", theNetworkCredential); } using ( new NetworkConnection(Path.GetDirectoryName(fullpath), Utility.CreateCredentials(Utility.Laygiatrithamsohethong("ASTM_UID", "UserName", false), Utility.Laygiatrithamsohethong("ASTM_PWD", "PassWord", false)))) { using (var _reader = new StreamReader(fullpath)) { while (_reader.Peek() > -1) { lstLines.Add(_reader.ReadLine()); } _reader.BaseStream.Flush(); _reader.Close(); } MyLog.Trace(string.Format("Read All lines")); IEnumerable <string> patientinfor = from p in lstLines.AsEnumerable() where p.StartsWith("P") select p; IEnumerable <string> Orderinfor = from p in lstLines.AsEnumerable() where p.StartsWith("O") select p; var lstmachidinh = new List <string>(); foreach (string line in lstLines) { if (line.StartsWith("O")) //Chỉ định { if (!lstmachidinh.Contains(line.Split('|')[2])) { lstmachidinh.Add(line.Split('|')[2]); } } } bool isOK = false; if (patientinfor.Any() && Orderinfor.Any()) { MyLog.Trace(string.Format("File format is valid")); MyLog.Trace(string.Format("Number of AssignCode {0}", lstmachidinh.Count)); var lstKq = new KcbKetquaClCollection(); MyLog.Trace(string.Format("GetData base on PID {0} and AssignCode List {1} ", patientinfor.FirstOrDefault().Split('|')[2], string.Join(",", lstmachidinh.ToArray()))); DataTable dtData = SPs.HisLisLaydulieuCapnhatketquatuLis(patientinfor.FirstOrDefault().Split('|')[2], string.Join(",", lstmachidinh.ToArray())).GetDataSet().Tables[0]; if (dtData != null && dtData.Rows.Count > 0) { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { MyLog.Trace(string.Format("Number of DataRow:={0}", dtData.Rows.Count)); string ma_chidinh = ""; int idx = 0; foreach (string line in lstLines) { if (line.StartsWith("O")) //Order { ma_chidinh = line.Split('|')[2]; } if (line.StartsWith("R")) //Result { idx++; MyLog.Trace(string.Format("Begin Analysing Line {0}...", idx)); string[] arrValues = line.Split('|'); string ma_xetnghiem = arrValues[2].Replace("^", ""); string ketqua = arrValues[3]; string dvt = arrValues[4]; string ngaytraketqua = arrValues[12]; MyLog.Trace( string.Format( "Line Data-->ma_chidinh={0} ma_xetnghiem={1}, ketqua={2}, DVT={3},ngaytraketqua={4} ", ma_chidinh, ma_xetnghiem, ketqua, dvt, ngaytraketqua)); DataRow[] arrCt = dtData.Select("ma_xetnghiem='" + ma_xetnghiem + "' AND ma_chidinh='" + ma_chidinh + "'"); if (arrCt.Length > 0) { MyLog.Trace( string.Format( "Row Data-->ma_chidinh={0} ma_xetnghiem={1}, id_chidinh={2}, id_chitietchidinh={3},id_chitietdichvu={4} ", arrCt[0]["ma_chidinh"], arrCt[0]["ma_xetnghiem"], arrCt[0]["id_chidinh"], arrCt[0]["id_chitietchidinh"], arrCt[0]["id_chitietdichvu"])); //Nếu không có chi tiết thì update vào cả bảng chỉ định cận lâm sàng chi tiết KcbChidinhclsChitiet objChitiet = KcbChidinhclsChitiet.FetchByID( Utility.Int64Dbnull(arrCt[0]["id_chitietchidinh"])); if (objChitiet != null) { if ( !Utility.Byte2Bool(Utility.ByteDbnull(arrCt[0]["co_chitiet"], 0))) { objChitiet.KetQua = ketqua; } objChitiet.IsNew = false; objChitiet.TrangThai = 4; objChitiet.MarkOld(); objChitiet.Save(); } var kq = new KcbKetquaCl(); kq = new Select().From(KcbKetquaCl.Schema) .Where(KcbKetquaCl.Columns.IdChidinh) .IsEqualTo(Utility.Int64Dbnull(arrCt[0]["id_chidinh"])) .And(KcbKetquaCl.Columns.IdChitietchidinh) .IsEqualTo(Utility.Int64Dbnull(arrCt[0]["id_chitietchidinh"])) .And(KcbKetquaCl.Columns.IdDichvuchitiet) .IsEqualTo(Utility.Int64Dbnull(arrCt[0]["id_chitietdichvu"])) .ExecuteSingle <KcbKetquaCl>(); if (kq == null) { MyLog.Trace( string.Format("ma_xetnghiem={0}-->insert into KcbKetquaCl", ma_xetnghiem)); kq = new KcbKetquaCl(); kq.IsNew = true; } else { MyLog.Trace( string.Format("ma_xetnghiem={0}-->updated from KcbKetquaCl", ma_xetnghiem)); kq.IsNew = false; kq.MarkOld(); } DmucDichvuclsChitiet objDvuchitiet = DmucDichvuclsChitiet.FetchByID( Utility.Int64Dbnull(arrCt[0]["id_chitietdichvu"])); if (objDvuchitiet != null) { kq.TenThongso = objDvuchitiet.TenChitietdichvu; } kq.IdChidinh = Utility.Int64Dbnull(arrCt[0]["id_chidinh"]); kq.IdChitietchidinh = Utility.Int64Dbnull(arrCt[0]["id_chitietchidinh"]); kq.IdDichvu = Utility.Int32Dbnull(arrCt[0]["id_dichvu"]); kq.IdDichvuchitiet = Utility.Int32Dbnull(arrCt[0]["id_chitietdichvu"]); kq.IdBenhnhan = Utility.Int64Dbnull(arrCt[0]["id_benhnhan"]); kq.MaLuotkham = Utility.sDbnull(arrCt[0]["ma_luotkham"]); kq.MaChidinh = Utility.sDbnull(arrCt[0]["ma_chidinh"]); kq.MaBenhpham = Utility.sDbnull(arrCt[0]["ma_chidinh"]); kq.IdLab = -1; kq.IdChitietLab = -1; kq.Barcode = ""; kq.SttIn = 0; kq.KetQua = ketqua; kq.BtNam = ""; kq.BtNu = ""; kq.TenDonvitinh = ""; kq.TenThongso = ""; kq.TenKq = ""; kq.LoaiKq = 0; kq.ChophepHienthi = 1; kq.ChophepIn = 1; kq.MotaThem = ""; kq.NguoiTao = "WIN_SERVICE"; kq.NgayTao = DateTime.Now; kq.NguoiSua = "WIN_SERVICE"; kq.NgaySua = DateTime.Now; kq.TrangThai = 4; kq.NgayXacnhan = DateTime.Now; kq.NguoiXacnhan = "WIN_SERVICE"; kq.NguoiXacnhan = "WIN_SERVICE"; kq.Save(); //lstKq.Add(kq); } else { isOK = false; MyLog.Error( string.Format( "No data found with ma_xetnghiem={0}.Please check again", ma_xetnghiem)); } } } //lstKq.SaveAll(); isOK = true; } scope.Complete(); } } else { isOK = false; MyLog.Error(string.Format("Could not get Data from HIS with PID {0} and AssignCode {1}", patientinfor.FirstOrDefault().Split('|')[3], string.Join(",", lstmachidinh.ToArray()))); } } else //Invalid file structure { isOK = false; MyLog.Error( string.Format( "FileFormat is not valid(No Patient or Order tags found in this file). Pls check result file again!")); } if (isOK) { string newDestinationFolder = Utility.FixedFolder(Utility.Laygiatrithamsohethong("ASTM_BACKUP_FOLDER", @"\\192.168.1.254\Backup", false)); newDestinationFolder += Path.GetFileName(fullpath); string errMsg = Utility.MoveFile(fullpath, newDestinationFolder); if (Utility.DoTrim(errMsg) == "") { MyLog.Trace(string.Format("Move file from {0} to {1} succedded", fullpath, newDestinationFolder)); } else { MyLog.Error(string.Format("Move file from {0} to {1} error-->{2}", fullpath, newDestinationFolder, errMsg)); } } MyLog.Trace(string.Format("------------------Finish Analysing file {0}------------------", fullpath)); } } catch (Exception ex) { MyLog.Error(string.Format("StartAnalysisFile.Exception-->{0}", ex.Message)); } }
public static bool CapnhatTrangthaiTutuc(KcbChidinhclsChitiet objChidinhChitiet, KcbLuotkham objLuotkham, bool noitru, byte tu_tuc, decimal PTramBHYT) { try { byte TrangthaiBhyt = 1; decimal BHYT_PTRAM_TRAITUYENNOITRU = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_PTRAM_TRAITUYENNOITRU", "0", false), 0m); bool b_ExistPtramBHYT = false; objChidinhChitiet.TuTuc = tu_tuc; if (!THU_VIEN_CHUNG.IsBaoHiem(objLuotkham.IdLoaidoituongKcb.Value))//Đối tượng DV { TrangthaiBhyt = (byte)0; objChidinhChitiet.TuTuc = 0; } else { TrangthaiBhyt = (byte)(globalVariables.gv_blnApdungChedoDuyetBHYT ? 0 : 1); } if (Utility.Int32Dbnull(objChidinhChitiet.TrangthaiHuy, -1) == -1) { objChidinhChitiet.TrangthaiHuy = 0; } DmucDichvuclsChitiet obServiceDetail = DmucDichvuclsChitiet.FetchByID(Utility.Int32Dbnull(objChidinhChitiet.IdChitietdichvu)); QheDoituongDichvucl objqhedoituong = new QheDoituongDichvucl(); if (obServiceDetail != null) { if (Utility.Int32Dbnull(objChidinhChitiet.TuTuc, 0) == 1) { objqhedoituong = LayGiaTheoDoiTuong("DV", objChidinhChitiet.IdChitietdichvu, objLuotkham.MaKhoaThuchien); } else { objqhedoituong = LayGiaTheoDoiTuong(objLuotkham.MaDoituongKcb, objChidinhChitiet.IdChitietdichvu, objLuotkham.MaKhoaThuchien); } // objChidinhChitiet.GiaDanhmuc = Utility.DecimaltoDbnull(obServiceDetail.DonGia); if (objqhedoituong != null) { objChidinhChitiet.GiaDanhmuc = Utility.DecimaltoDbnull(objqhedoituong.DonGia, 0); objChidinhChitiet.DonGia = Utility.DecimaltoDbnull(objqhedoituong.DonGia, 0); objChidinhChitiet.MadoituongGia = Utility.sDbnull(objqhedoituong.MaDoituongKcb); } } objChidinhChitiet.PtramBhyt = PTramBHYT; objChidinhChitiet.PtramBhytGoc = objLuotkham.PtramBhytGoc; // objChidinhChitiet.LoaiChietkhau = 0; // objChidinhChitiet.TrangthaiBhyt = TrangthaiBhyt; //objChidinhChitiet.IdLoaichidinh = 0;//Chưa hiểu trường này-->Cần xem lại if (Utility.Int32Dbnull(objChidinhChitiet.TuTuc, 0) == 1) { objChidinhChitiet.BhytChitra = 0; if (objqhedoituong != null) { objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objqhedoituong.DonGia, 0); } objChidinhChitiet.PtramBhyt = 0; } else { //Mục tính BHYT đặc biệt để dành sử dụng trong tương lai PtramBHYTDacBiet(objChidinhChitiet, objLuotkham, 2, ref b_ExistPtramBHYT); if (b_ExistPtramBHYT) { objChidinhChitiet.BhytChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia) * Utility.DecimaltoDbnull(objChidinhChitiet.PtramBhyt) / 100; objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - Utility.DecimaltoDbnull(objChidinhChitiet.BhytChitra); } else//99% rơi vào nhánh này { PTramBHYT = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt); decimal BHCT = 0m; if (objLuotkham.DungTuyen == 1)//BHYT đúng tuyến rơi vào nhánh này dù nội trú ngay ngoại trú { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else//DV và BHYT trái tuyến { if (objLuotkham.TrangthaiNoitru <= 0 || !noitru)//Đối tượng ngoại trú hoặc Chỉ định ngoại trú-->Lấy phần trăm ngoại trú { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else//Nội trú cần tính=đơn giá * % đầu thẻ * % tuyến { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia.Value, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0) / 100) * (BHYT_PTRAM_TRAITUYENNOITRU / 100); } } decimal BNCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - BHCT; objChidinhChitiet.BhytChitra = BHCT; objChidinhChitiet.BnhanChitra = BNCT; } } objChidinhChitiet.MarkOld(); objChidinhChitiet.IsNew = false; objChidinhChitiet.Save(); return(true); } catch (Exception ex) { Utility.CatchException(ex); return(false); } }
private bool AddChidinh() { try { // DataTable dt=new Select().From(KcbChidinhclsChitiet.Schema.Name).Where(KcbChidinhclsChitiet.Columns.) //if() KcbChidinhclsChitiet obj = new KcbChidinhclsChitiet(); obj.IdBenhnhan = patientId; obj.IdDichvu = Utility.Int16Dbnull(grdTestInfo.GetValue("id_loaidichvu")); obj.IdChidinh = Utility.Int32Dbnull(grdTestInfo.GetValue("id_chidinh")); obj.IdChitietdichvu = Utility.Int32Dbnull(grdDichVuChiTiet.GetValue("id_chitietdichvu")); //obj.GiaDanhmuc = Utility.Int32Dbnull(grdDichVuChiTiet.GetValue("Don_Gia")); obj.DonGia = Utility.DecimaltoDbnull(grdDichVuChiTiet.GetValue("Don_Gia")); obj.NgayTao = DateTime.Now; obj.NgayThuchien = DateTime.Now; if (Utility.Int16Dbnull(cboSoMuiTiem.Text) == 1) { obj.Mui1 = 1; } if (Utility.Int16Dbnull(cboSoMuiTiem.Text) == 2) { obj.Mui2 = 2; } if (Utility.Int16Dbnull(cboSoMuiTiem.Text) == 3) { obj.Mui3 = 3; } if (Utility.Int16Dbnull(cboSoMuiTiem.Text) == 4) { obj.Mui4 = 4; } if (Utility.Int16Dbnull(cboSoMuiTiem.Text) == 5) { obj.Mui5 = 5; } obj.NgayBatDauTiem = dtpNgayTiem.Value; obj.NgayNhacLaiTiem = dtpNgayNhacTiem.Value; obj.SoNgayNhac = Utility.Int16Dbnull(txtSoNgayNhacTiem.Text); if (chkSms.Checked) { obj.GuiSMS = 1; } // obj.TrangThai = Utility.Int16Dbnull(cbotrangthai.SelectedValue,0); obj.GhiChu = txtGhiChu.Text; obj.TuanThai = Utility.Int16Dbnull(txtTuanThai.Text); obj.ThangThai = Utility.Int16Dbnull(txtThangThai.Text); obj.NgayTao = DateTime.Now; obj.SoLuong = 1; obj.MuiTiemTiepTheo = Utility.sDbnull(cboMuiTiemTiepTheo.SelectedValue); obj.MotaThem = txtmota.Text; obj.NguoiTao = Utility.sDbnull(globalVariables.UserName); obj.NguoiThuchien = Utility.sDbnull(globalVariables.UserName); obj.IsNew = true; obj.Save(); // txtMaBN.Text = Utility.sDbnull(obj.IdBenhnhan); lblMessage.Text = "Theem chi dinh thanh cong"; return true; } catch (Exception ex) { Utility.ShowMsg(ex.Message); return false; } }
/// <summary> /// hàm thực hienj việc tính phâm trăm bảo hiểm /// </summary> /// <param name="objAssignDetail"></param> /// <param name="PTramBHYT"></param> public static void GB_TinhPhtramBHYT(KcbChidinhclsChitiet objAssignDetail, KcbLuotkham objLuotkham, decimal PTramBHYT) { byte TrangthaiBhyt = 1; decimal BHYT_PTRAM_TRAITUYENNOITRU = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_PTRAM_TRAITUYENNOITRU", "0", false), 0m); bool b_ExistPtramBHYT = false; if (!THU_VIEN_CHUNG.IsBaoHiem(objLuotkham.IdLoaidoituongKcb.Value))//(objLuotkham.MaDoituongKcb == "DV")//Tự túc { TrangthaiBhyt = (byte)0; objAssignDetail.TuTuc = 0; } else { TrangthaiBhyt = (byte)(globalVariables.gv_blnApdungChedoDuyetBHYT ? 0 : 1); } if (Utility.Int32Dbnull(objAssignDetail.TrangthaiHuy, -1) == -1) { objAssignDetail.TrangthaiHuy = 0; } DmucDichvuclsChitiet obServiceDetail = DmucDichvuclsChitiet.FetchByID(Utility.Int32Dbnull(objAssignDetail.IdChitietchidinh)); if (obServiceDetail != null) { objAssignDetail.GiaDanhmuc = Utility.DecimaltoDbnull(obServiceDetail.DonGia); } objAssignDetail.PtramBhyt = PTramBHYT; objAssignDetail.PtramBhytGoc = objLuotkham.PtramBhytGoc; objAssignDetail.LoaiChietkhau = 0; objAssignDetail.TrangthaiBhyt = TrangthaiBhyt; objAssignDetail.IdLoaichidinh = 0; if (Utility.Int32Dbnull(objAssignDetail.TuTuc, 0) == 1) { objAssignDetail.BhytChitra = 0; objAssignDetail.BnhanChitra = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0); objAssignDetail.PtramBhyt = 0; } else { PtramBHYTDacBiet(objAssignDetail, objLuotkham, 2, ref b_ExistPtramBHYT); if (b_ExistPtramBHYT) { objAssignDetail.BhytChitra = Utility.DecimaltoDbnull(objAssignDetail.DonGia) * Utility.DecimaltoDbnull(objAssignDetail.PtramBhyt) / 100; objAssignDetail.BnhanChitra = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0) - Utility.DecimaltoDbnull(objAssignDetail.BhytChitra); } else { PTramBHYT = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt); decimal BHCT = 0m; if (objLuotkham.DungTuyen == 1) { BHCT = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else { if (objLuotkham.TrangthaiNoitru <= 0) { BHCT = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else//Nội trú cần tính=đơn giá * % đầu thẻ * % tuyến { BHCT = Utility.DecimaltoDbnull(objAssignDetail.DonGia.Value, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0) / 100) * (BHYT_PTRAM_TRAITUYENNOITRU / 100); } } decimal BNCT = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0) - BHCT; objAssignDetail.BhytChitra = BHCT; objAssignDetail.BnhanChitra = BNCT; //objAssignDetail.BhytChitra = Utility.DecimaltoDbnull(objAssignDetail.DonGia) * // Utility.DecimaltoDbnull(PTramBHYT) / 100; } } }
public ActionResult Tratien(KcbThanhtoan objThanhtoan, KcbLuotkham objLuotkham, List <Int64> lstIdChitiet) { decimal PtramBHYT = 0; ///tổng tiền hiện tại truyền vào của lần payment đang thực hiện decimal v_dblTongtienHuy = 0; ///tổng tiền đã thanh toán decimal v_TotalPaymentDetail = 0; try { using (var scope = new TransactionScope()) { using (var sh = new SharedDbConnectionScope()) { KcbThanhtoanChitiet[] ArrKcbThanhtoanChitiet_Huy = new Select().From(KcbThanhtoanChitiet.Schema) .Where(KcbThanhtoanChitiet.Columns.IdChitiet).In(lstIdChitiet) .ExecuteAsCollection <KcbThanhtoanChitietCollection>().ToArray <KcbThanhtoanChitiet>(); List <int> lstIdThanhtoanTinhtoanlai = (from q in ArrKcbThanhtoanChitiet_Huy select q.IdThanhtoan).ToList <int>(); v_dblTongtienHuy = TongtienKhongTutuc(ArrKcbThanhtoanChitiet_Huy); KcbThanhtoanCollection lstKcbThanhtoanCollection = new KcbThanhtoanController() .FetchByQuery( KcbThanhtoan.CreateQuery() .AddWhere(KcbThanhtoan.Columns.MaLuotkham, Comparison.Equals, objLuotkham.MaLuotkham) .AND(KcbThanhtoan.Columns.IdBenhnhan, Comparison.Equals, objLuotkham.IdBenhnhan) .AND(KcbThanhtoan.Columns.KieuThanhtoan, Comparison.Equals, objThanhtoan.KieuThanhtoan) .AND(KcbThanhtoan.Columns.TrangThai, Comparison.Equals, 0));//Chỉ lấy về các bản ghi thanh toán thường(0= thường;1= thanh toán hủy(trả lại tiền)) //Lấy tổng tiền của các lần thanh toán trước List <KcbThanhtoanChitiet> lstKcbThanhtoanChitiet = new List <KcbThanhtoanChitiet>(); foreach (KcbThanhtoan Payment in lstKcbThanhtoanCollection) { KcbThanhtoanChitietCollection lstKcbThanhtoanChitietCollection = new Select().From(KcbThanhtoanChitiet.Schema) .Where(KcbThanhtoanChitiet.Columns.IdThanhtoan).IsEqualTo(Payment.IdThanhtoan) .And(KcbThanhtoanChitiet.Columns.TrangthaiHuy).IsEqualTo(0).ExecuteAsCollection <KcbThanhtoanChitietCollection>(); foreach (KcbThanhtoanChitiet _KcbThanhtoanChitiet in lstKcbThanhtoanChitietCollection) { if (_KcbThanhtoanChitiet.TuTuc == 0) { //Lấy các chi tiết sẽ update lại toàn bộ thông tin bhyt,bn chi trả theo % BHYT mới sau khi đã hủy một số dịch vụ //Các bản ghi hủy sẽ giữ nguyên thông tin không cần cập nhật if (!lstIdChitiet.Contains(_KcbThanhtoanChitiet.IdChitiet)) { lstKcbThanhtoanChitiet.Add(_KcbThanhtoanChitiet); _KcbThanhtoanChitiet.IsNew = false; _KcbThanhtoanChitiet.MarkOld(); } v_TotalPaymentDetail += Utility.Int32Dbnull(_KcbThanhtoanChitiet.SoLuong) * Utility.DecimaltoDbnull(_KcbThanhtoanChitiet.DonGia); } } } List <int> lstIdThanhtoanCu = (from q in lstKcbThanhtoanChitiet select q.IdThanhtoan).Distinct().ToList <int>(); LayThongtinPtramBHYT(v_TotalPaymentDetail - v_dblTongtienHuy, objLuotkham, ref PtramBHYT); //Thêm mới dòng thanh toán hủy objThanhtoan.TrangThai = 1; objThanhtoan.IdNhanvienThanhtoan = globalVariables.gv_intIDNhanvien; objThanhtoan.NgayThanhtoan = globalVariables.SysDate; objThanhtoan.MaThanhtoan = THU_VIEN_CHUNG.TaoMathanhtoan(globalVariables.SysDate); objThanhtoan.IsNew = true; objThanhtoan.Save(); //Tính lại thông tin BHYT,BN chi trả cho toàn bộ các chi tiết của BN đã thanh toán mà không bị hủy KcbThanhtoanChitiet[] lsttemp = new List <KcbThanhtoanChitiet>().ToArray <KcbThanhtoanChitiet>(); THU_VIEN_CHUNG.TinhPhamTramBHYT(objLuotkham, ref lsttemp, ref lstKcbThanhtoanChitiet, PtramBHYT); decimal TT_BN = 0m; decimal TT_BHYT = 0m; decimal TT_Chietkhau_Chitiet = 0m; //99% đặt thông số này=1 if (THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_TINHLAI_TOANBODICHVU", "1", false) == "1") { foreach (int IdThanhtoan in lstIdThanhtoanCu) { TT_BN = 0m; TT_BHYT = 0m; TT_Chietkhau_Chitiet = 0m; List <KcbThanhtoanChitiet> _LstChitiet = (from q in lstKcbThanhtoanChitiet select q).ToList <KcbThanhtoanChitiet>(); if (_LstChitiet.Count > 0) { foreach (KcbThanhtoanChitiet objThanhtoanDetail in _LstChitiet) { TT_BN += (objThanhtoanDetail.BnhanChitra + objThanhtoanDetail.PhuThu) * objThanhtoanDetail.SoLuong; if (!Utility.Byte2Bool(objThanhtoanDetail.TuTuc)) { TT_BHYT += objThanhtoanDetail.BhytChitra * objThanhtoanDetail.SoLuong; } TT_Chietkhau_Chitiet += Utility.DecimaltoDbnull(objThanhtoanDetail.TienChietkhau, 0); //Lưu lại các thông tin tiền đã được tính toán lại ở thủ tục THU_VIEN_CHUNG.TinhPhamTramBHYT(...) objThanhtoanDetail.IsNew = false; objThanhtoanDetail.MarkOld(); objThanhtoanDetail.Save(); } //Update lại tiền thanh toán new Update(KcbThanhtoan.Schema) .Set(KcbThanhtoan.Columns.TongTien).EqualTo(TT_BHYT + TT_BN) .Set(KcbThanhtoan.Columns.BnhanChitra).EqualTo(TT_BN) .Set(KcbThanhtoan.Columns.BhytChitra).EqualTo(TT_BHYT) .Set(KcbThanhtoan.Columns.MaDoituongKcb).EqualTo(objLuotkham.MaDoituongKcb) .Set(KcbThanhtoan.Columns.IdDoituongKcb).EqualTo(objLuotkham.IdDoituongKcb) .Set(KcbThanhtoan.Columns.PtramBhyt).EqualTo(objLuotkham.PtramBhyt) .Where(KcbThanhtoan.Columns.IdThanhtoan).IsEqualTo(IdThanhtoan).Execute(); //Update phiếu thu new Update(KcbPhieuthu.Schema) .Set(KcbPhieuthu.Columns.SoTien).EqualTo(TT_BN - TT_Chietkhau_Chitiet) .Set(KcbPhieuthu.Columns.SotienGoc).EqualTo(TT_BN) .Where(KcbPhieuthu.Columns.IdThanhtoan).IsEqualTo(IdThanhtoan).Execute(); } } } //Reset và tính toán các số tiền liên quan đến các bản ghi hủy TT_BN = 0m; TT_BHYT = 0m; TT_Chietkhau_Chitiet = 0m; //Cập nhật các dòng chi tiết được chọn hủy về trạng thái hủy và các dịch vụ trong các bảng tương ứng theo id_loaithanhtoan foreach (KcbThanhtoanChitiet objKcbThanhtoanChitiet in ArrKcbThanhtoanChitiet_Huy) { TT_BN += (objKcbThanhtoanChitiet.BnhanChitra + objKcbThanhtoanChitiet.PhuThu) * objKcbThanhtoanChitiet.SoLuong; if (!Utility.Byte2Bool(objKcbThanhtoanChitiet.TuTuc)) { TT_BHYT += objKcbThanhtoanChitiet.BhytChitra * objKcbThanhtoanChitiet.SoLuong; } TT_Chietkhau_Chitiet += Utility.DecimaltoDbnull(objKcbThanhtoanChitiet.TienChietkhau, 0); new Update(KcbThanhtoanChitiet.Schema) .Set(KcbThanhtoanChitiet.Columns.TrangthaiHuy).EqualTo(1) .Set(KcbThanhtoanChitiet.Columns.NgayHuy).EqualTo(globalVariables.SysDate) .Set(KcbThanhtoanChitiet.Columns.NguoiHuy).EqualTo(globalVariables.UserName) .Where(KcbThanhtoanChitiet.Columns.IdChitiet).IsEqualTo(objKcbThanhtoanChitiet.IdChitiet). Execute(); ///thanh toán khám chữa bệnh)) if (objKcbThanhtoanChitiet.IdLoaithanhtoan == 1) { new Update(KcbDangkyKcb.Schema) .Set(KcbDangkyKcb.Columns.TrangthaiThanhtoan).EqualTo(1) .Set(KcbDangkyKcb.Columns.TrangthaiHuy).EqualTo(1) .Where(KcbDangkyKcb.Columns.IdKham).IsEqualTo(objKcbThanhtoanChitiet.IdPhieu).Execute(); } ///thah toán phần dịch vụ cận lâm sàng if (objKcbThanhtoanChitiet.IdLoaithanhtoan == 2) { KcbChidinhclsChitiet objKcbChidinhclsChitiet = KcbChidinhclsChitiet.FetchByID(objKcbThanhtoanChitiet.IdChitietdichvu); if (globalVariables.UserName != "ADMIN") { if (objKcbChidinhclsChitiet != null && objKcbChidinhclsChitiet.TrangThai >= 3)//Đã có kết quả { return(ActionResult.AssignIsConfirmed); } } new Update(KcbChidinhclsChitiet.Schema) .Set(KcbChidinhclsChitiet.Columns.TrangthaiThanhtoan).EqualTo(1) .Set(KcbChidinhclsChitiet.Columns.TrangthaiHuy).EqualTo(1) .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(objKcbThanhtoanChitiet.IdChitietdichvu) .Execute(); } ///thanh toán phần thuốc if (objKcbThanhtoanChitiet.IdLoaithanhtoan == 3) { KcbDonthuocChitiet objKcbDonthuocChitiet = KcbDonthuocChitiet.FetchByID(objKcbThanhtoanChitiet.IdPhieuChitiet); if (globalVariables.UserName != "ADMIN") { if (objKcbDonthuocChitiet != null && Utility.Byte2Bool(objKcbDonthuocChitiet.TrangThai)) { return(ActionResult.PresIsConfirmed); } } new Update(KcbDonthuoc.Schema) .Set(KcbDonthuoc.Columns.TrangThai).EqualTo(0) .Where(KcbDonthuoc.Columns.IdDonthuoc).IsEqualTo(objKcbThanhtoanChitiet.IdPhieu).Execute(); new Update(KcbDonthuocChitiet.Schema) .Set(KcbDonthuocChitiet.Columns.TrangthaiHuy).EqualTo(1) .Where(KcbDonthuocChitiet.Columns.IdChitietdonthuoc).IsEqualTo(objKcbThanhtoanChitiet.IdPhieuChitiet) .Execute(); } //Tạo dữ liệu hủy tiền objKcbThanhtoanChitiet.IdChitiethuy = objKcbThanhtoanChitiet.IdChitiet;//Để biết dòng hủy này hủy cho chi tiết thanh toán nào objKcbThanhtoanChitiet.TrangthaiHuy = 0; objKcbThanhtoanChitiet.NguoiHuy = null; objKcbThanhtoanChitiet.NgayHuy = null; objKcbThanhtoanChitiet.IdThanhtoan = Utility.Int32Dbnull(objThanhtoan.IdThanhtoan, -1); objKcbThanhtoanChitiet.IsNew = true; objKcbThanhtoanChitiet.Save(); } KcbPhieuthu objPhieuthu = new KcbPhieuthu(); objPhieuthu.IdThanhtoan = objThanhtoan.IdThanhtoan; objPhieuthu.SoluongChungtugoc = 1; objPhieuthu.LoaiPhieuthu = Convert.ToByte(1);//0= phiếu thu tiền;1= phiếu chi objPhieuthu.MaPhieuthu = THU_VIEN_CHUNG.GetMaPhieuThu(globalVariables.SysDate, 1); objPhieuthu.NgayThuchien = globalVariables.SysDate; objPhieuthu.SoTien = TT_BN - TT_Chietkhau_Chitiet; objPhieuthu.SotienGoc = TT_BN; objPhieuthu.MaLydoChietkhau = objThanhtoan.MaLydoChietkhau; objPhieuthu.TienChietkhauchitiet = TT_Chietkhau_Chitiet; objPhieuthu.TienChietkhau = objThanhtoan.TongtienChietkhau; objPhieuthu.TienChietkhauhoadon = objPhieuthu.TienChietkhau - objPhieuthu.TienChietkhauchitiet; objPhieuthu.NguoiNop = globalVariables.UserName; objPhieuthu.TaikhoanCo = ""; objPhieuthu.TaikhoanNo = ""; objPhieuthu.NoiTru = (byte)objThanhtoan.NoiTru; objPhieuthu.LydoNop = "Trả tiền bệnh nhân"; objPhieuthu.IdKhoaThuchien = globalVariables.idKhoatheoMay; objPhieuthu.IdNhanvien = globalVariables.gv_intIDNhanvien; objPhieuthu.IsNew = true; objPhieuthu.Save(); new Update(KcbThanhtoan.Schema) .Set(KcbThanhtoan.Columns.TongTien).EqualTo(TT_BHYT + TT_BN) .Set(KcbThanhtoan.Columns.BnhanChitra).EqualTo(TT_BN) .Set(KcbThanhtoan.Columns.BhytChitra).EqualTo(TT_BHYT) .Set(KcbThanhtoan.Columns.MaDoituongKcb).EqualTo(objLuotkham.MaDoituongKcb) .Set(KcbThanhtoan.Columns.IdDoituongKcb).EqualTo(objLuotkham.IdDoituongKcb) .Set(KcbThanhtoan.Columns.PtramBhyt).EqualTo(objLuotkham.PtramBhyt) .Where(KcbThanhtoan.Columns.IdThanhtoan).IsEqualTo(objThanhtoan.IdThanhtoan).Execute(); } scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { log.Error("Loi trong qua trinh tra tien lai:{0}", exception.ToString()); return(ActionResult.Error); } }
/// <summary> /// hàm thực hiện viec tính toán giá đặc biệt cho bệnh nhân /// </summary> /// <param name="objChidinhChitiet"></param> /// <param name="objLuotkham"></param> /// <param name="PaymentType_ID"></param> public static void PtramBHYTDacBiet(KcbChidinhclsChitiet objChidinhChitiet,KcbLuotkham objLuotkham,int PaymentType_ID,ref bool b_Exist) { b_Exist = false; 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; } } SqlQuery sqlQuery = new Select().From(DmucBhytChitraDacbiet.Schema) .Where(DmucBhytChitraDacbiet.Columns.IdDichvuChitiet).IsEqualTo(objChidinhChitiet.IdChitietchidinh) .And(DmucBhytChitraDacbiet.Columns.MaLoaithanhtoan).IsEqualTo(PaymentType_ID) .And(DmucBhytChitraDacbiet.Columns.DungtuyenTraituyen).IsEqualTo(IsDungTuyen) .And(DmucBhytChitraDacbiet.Columns.MaDoituongKcb).IsEqualTo(objLuotkham.MaDoituongKcb); DmucBhytChitraDacbiet objDetailPtramBhyt = sqlQuery.ExecuteSingle<DmucBhytChitraDacbiet>(); if(objDetailPtramBhyt!=null) { objChidinhChitiet.IdLoaichidinh = 1; objChidinhChitiet.BhytChitra = Gia_BHYT(objDetailPtramBhyt.TileGiam,Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0)); objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - objChidinhChitiet.BhytChitra; objChidinhChitiet.PtramBhyt = Utility.DecimaltoDbnull(objDetailPtramBhyt.TileGiam, 0); objChidinhChitiet.LoaiChietkhau = 1; b_Exist = true; // objChidinhChitiet.DonGia = } }
public ActionResult SaoChepPhieuDieuTri(NoitruPhieudieutri[] lstPhieudieutri, KcbLuotkham objLuotkham, KcbChidinhclsChitiet[] arrChidinhCLSChitiet, KcbDonthuocChitiet[] arrDonthuocChitiet) { try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { foreach (NoitruPhieudieutri objTreatment in lstPhieudieutri) { objTreatment.NguoiTao = globalVariables.UserName; objTreatment.NgayTao = DateTime.Now; objTreatment.TthaiBosung = 0; objTreatment.IdBacsi = globalVariables.gv_intIDNhanvien; objTreatment.IdKhoanoitru = objLuotkham.IdKhoanoitru; objTreatment.MaLuotkham = objLuotkham.MaLuotkham; objTreatment.IdBenhnhan = objTreatment.IdBenhnhan; objTreatment.IdBuongGiuong = objLuotkham.IdRavien; objTreatment.TrangThai = 0; objTreatment.TthaiIn = 0; objTreatment.IpMaytao = globalVariables.gv_strIPAddress; objTreatment.TenMaytao = globalVariables.gv_strComputerName; objTreatment.GioDieutri = Utility.GetFormatDateTime(globalVariables.SysDate, "hh:mm:ss"); objTreatment.IsNew = true; objTreatment.Save(); if (arrChidinhCLSChitiet.Length > 0) { KcbChidinhcl objAssignInfo = new KcbChidinhcl(); objAssignInfo.IdDieutri = objTreatment.IdPhieudieutri; objAssignInfo.IdBuongGiuong = objTreatment.IdBuongGiuong; objAssignInfo.MaLuotkham = objTreatment.MaLuotkham; objAssignInfo.IdBenhnhan = Utility.Int32Dbnull(objTreatment.IdBenhnhan); objAssignInfo.IdBacsiChidinh = globalVariables.gv_intIDNhanvien; objAssignInfo.Noitru = 1; objAssignInfo.IdKhoadieutri = objTreatment.IdKhoanoitru; objAssignInfo.IdKhoaChidinh = objTreatment.IdKhoanoitru; objAssignInfo.IdKham=-1; objAssignInfo.IdDoituongKcb = objLuotkham.IdDoituongKcb; objAssignInfo.IdPhongChidinh = objTreatment.IdKhoanoitru; objAssignInfo.Barcode = string.Empty; objAssignInfo.NgayChidinh = objTreatment.NgayDieutri.Value; objAssignInfo.NguoiTao = globalVariables.UserName; objAssignInfo.NgayTao = globalVariables.SysDate; objAssignInfo.IpMaytao = globalVariables.gv_strIPAddress; objAssignInfo.TenMaytao = globalVariables.gv_strComputerName; objAssignInfo.MaChidinh = THU_VIEN_CHUNG.SinhMaChidinhCLS(); objAssignInfo.IsNew = true; objAssignInfo.Save(); List<KcbChidinhclsChitiet> lstChidinhCLSChitiet=new List<KcbChidinhclsChitiet>(); foreach (KcbChidinhclsChitiet objAssignDetail in arrChidinhCLSChitiet) { KcbChidinhclsChitiet objDetail = KcbChidinhclsChitiet.FetchByID(objAssignDetail.IdChitietchidinh); if (objDetail != null) { objDetail.IdChitietchidinh = -1; objDetail.IdChidinh = objAssignInfo.IdChidinh; objDetail.IdKham = -1; objDetail.TrangthaiThanhtoan = 0; objDetail.NgayThanhtoan = null; objDetail.TrangthaiHuy = 0; objDetail.ImgPath1 = string.Empty; objDetail.ImgPath2 = string.Empty; objDetail.ImgPath3 = string.Empty; objDetail.ImgPath4 = string.Empty; objDetail.TrangThai =0; //objDetail.MotaThem = null; objDetail.TrangthaiBhyt = 0; objDetail.IdThanhtoan = -1; objDetail.IdKhoaThuchien =(short) objAssignInfo.IdKhoadieutri; objDetail.IdPhongThuchien = objDetail.IdKhoaThuchien; objDetail.IdGoi = -1; objDetail.IdBacsiThuchien = -1; objDetail.NgayThuchien = null; objDetail.NguoiThuchien = null; //objDetail.KetLuan = null; objDetail.KetQua = null; //objDetail.DeNghi = null; //objDetail.MaVungkhaosat = null; objDetail.NguoiTao = globalVariables.UserName; objDetail.NgayTao = globalVariables.SysDate; objDetail.IpMaytao = globalVariables.gv_strIPAddress; objDetail.TenMaytao = globalVariables.gv_strComputerName; objDetail.IsNew=true; lstChidinhCLSChitiet.Add(objDetail); } new KCB_CHIDINH_CANLAMSANG().InsertAssignDetail(objAssignInfo, objLuotkham, lstChidinhCLSChitiet.ToArray<KcbChidinhclsChitiet>()); } } if (arrDonthuocChitiet.Length > 0) { var query = (from donthuoc in arrDonthuocChitiet.AsEnumerable() let y = donthuoc.IdDonthuoc select y).Distinct(); foreach (var pres_id in query.ToList()) { KcbDonthuoc objPresInfo = KcbDonthuoc.FetchByID(Utility.Int32Dbnull(pres_id)); if (objPresInfo != null) { objPresInfo.Noitru = 1; List<KcbDonthuocChitiet> lstDonthuocchitiet = (from donthuoc in arrDonthuocChitiet.AsEnumerable() where donthuoc.IdDonthuoc == pres_id select donthuoc).ToList<KcbDonthuocChitiet>(); SaoChepDonThuocTheoPhieuDieuTri(objPresInfo, objTreatment, lstDonthuocchitiet.ToArray<KcbDonthuocChitiet>()); } } } } } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { return ActionResult.Error; } }
public static void TinhGiaChiDinhCLS(KcbLuotkham objLuotkham, KcbChidinhclsChitiet objAssignDetail) { GB_TinhPhtramBHYT(objAssignDetail, objLuotkham, Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0)); }
/// <summary> /// ham thực hiện việc cạp nhập thông tin của update /// </summary> /// <param name="objChidinhclsChitiet"></param> /// <param name="AceeptStatus"></param> /// <returns></returns> public ActionResult PerformActionUpdate(KcbChidinhclsChitiet objChidinhclsChitiet,bool xacnhan) { try { using (var scope = new TransactionScope()) { using (var sp = new SharedDbConnectionScope()) { SqlQuery qAssignDetail = new Select().From(KcbChidinhclsChitiet.Schema).Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo (objChidinhclsChitiet.IdChitietchidinh); KcbChidinhclsChitiet objoldAssignDetail = qAssignDetail.ExecuteSingle<KcbChidinhclsChitiet>(); if(string.IsNullOrEmpty( objChidinhclsChitiet.ImgPath1)) { objChidinhclsChitiet.ImgPath1 = objoldAssignDetail.ImgPath1; } if (string.IsNullOrEmpty(objChidinhclsChitiet.ImgPath2)) { objChidinhclsChitiet.ImgPath2 = objoldAssignDetail.ImgPath2; } new Update(KcbChidinhclsChitiet.Schema) .Set(KcbChidinhclsChitiet.Columns.KetLuan).EqualTo(objChidinhclsChitiet.KetLuan) .Set(KcbChidinhclsChitiet.Columns.DeNghi).EqualTo(objChidinhclsChitiet.DeNghi) .Set(KcbChidinhclsChitiet.Columns.TrangThai).EqualTo(objChidinhclsChitiet.TrangThai) .Set(KcbChidinhclsChitiet.Columns.KetQua).EqualTo(objChidinhclsChitiet.KetQua) .Set(KcbChidinhclsChitiet.Columns.ImgPath1).EqualTo(objChidinhclsChitiet.ImgPath1) .Set(KcbChidinhclsChitiet.Columns.ImgPath2).EqualTo(objChidinhclsChitiet.ImgPath2) .Set(KcbChidinhclsChitiet.Columns.ImgPath3).EqualTo(objChidinhclsChitiet.ImgPath3) .Set(KcbChidinhclsChitiet.Columns.ImgPath4).EqualTo(objChidinhclsChitiet.ImgPath4) //.Set(KcbChidinhclsChitiet.Columns.VungKs).EqualTo(objChidinhclsChitiet.VungKs) .Set(KcbChidinhclsChitiet.Columns.NgayThuchien).EqualTo(objChidinhclsChitiet.NgayThuchien) .Set(KcbChidinhclsChitiet.Columns.NguoiThuchien).EqualTo(objChidinhclsChitiet.NguoiThuchien) .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(objChidinhclsChitiet.IdChitietchidinh). Execute(); //if (xacnhan) UpdateXacNhanDaThucHien((int)objChidinhclsChitiet.IdChitietchidinh, (int)objChidinhclsChitiet.TrangThai, (int)objChidinhclsChitiet.TrangthaiXacnhan); } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { return ActionResult.Error; } }
/// <summary> /// ham thực hiện việc cạp nhập thông tin của update /// </summary> /// <param name="objChidinhclsChitiet"></param> /// <param name="AceeptStatus"></param> /// <returns></returns> public ActionResult PerformActionUpdate(KcbChidinhclsChitiet objChidinhclsChitiet) { try { using (var scope = new TransactionScope()) { using (var sp = new SharedDbConnectionScope()) { new Update(KcbChidinhclsChitiet.Schema) //.Set(KcbChidinhclsChitiet.Columns.KetLuan).EqualTo(objChidinhclsChitiet.KetLuan) //.Set(KcbChidinhclsChitiet.Columns.DeNghi).EqualTo(objChidinhclsChitiet.DeNghi) .Set(KcbChidinhclsChitiet.Columns.TrangThai).EqualTo(objChidinhclsChitiet.TrangThai) .Set(KcbChidinhclsChitiet.Columns.KetQua).EqualTo(objChidinhclsChitiet.KetQua) .Set(KcbChidinhclsChitiet.Columns.ImgPath1).EqualTo(objChidinhclsChitiet.ImgPath1) .Set(KcbChidinhclsChitiet.Columns.ImgPath2).EqualTo(objChidinhclsChitiet.ImgPath2) .Set(KcbChidinhclsChitiet.Columns.ImgPath3).EqualTo(objChidinhclsChitiet.ImgPath3) .Set(KcbChidinhclsChitiet.Columns.ImgPath4).EqualTo(objChidinhclsChitiet.ImgPath4) .Set(KcbChidinhclsChitiet.Columns.FTPImage).EqualTo(objChidinhclsChitiet.FTPImage) .Set(KcbChidinhclsChitiet.Columns.NgayThuchien).EqualTo(objChidinhclsChitiet.NgayThuchien) .Set(KcbChidinhclsChitiet.Columns.NguoiThuchien).EqualTo(objChidinhclsChitiet.NguoiThuchien) .Set(KcbChidinhclsChitiet.Columns.NgaySua).EqualTo(objChidinhclsChitiet.NgayThuchien) .Set(KcbChidinhclsChitiet.Columns.NguoiSua).EqualTo(objChidinhclsChitiet.NguoiThuchien) .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(objChidinhclsChitiet.IdChitietchidinh). Execute(); } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { return ActionResult.Error; } }
/// <summary> /// ham /// </summary> /// <param name="objChidinhclsChitiet"></param> /// <returns></returns> public ActionResult PerformActionUpdate(KcbChidinhclsChitiet objChidinhclsChitiet) { try { using (var scope = new TransactionScope()) { using (var sp = new SharedDbConnectionScope()) { SqlQuery qAssignDetail = new Select().From(KcbChidinhclsChitiet.Schema).Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo (objChidinhclsChitiet.IdChitietchidinh); KcbChidinhclsChitiet objoldAssignDetail = qAssignDetail.ExecuteSingle<KcbChidinhclsChitiet>(); if (string.IsNullOrEmpty(objChidinhclsChitiet.ImgPath1)) { objChidinhclsChitiet.ImgPath1 = objoldAssignDetail.ImgPath1; } if (string.IsNullOrEmpty(objChidinhclsChitiet.ImgPath2)) { objChidinhclsChitiet.ImgPath2 = objoldAssignDetail.ImgPath2; } new Update(KcbChidinhclsChitiet.Schema) .Set(KcbChidinhclsChitiet.Columns.KetLuan).EqualTo(objChidinhclsChitiet.KetLuan) .Set(KcbChidinhclsChitiet.Columns.DeNghi).EqualTo(objChidinhclsChitiet.DeNghi) //.Set(KcbChidinhclsChitiet.Columns.TrangThaiXacNhanCLS).EqualTo(objChidinhclsChitiet.TrangThaiXacNhanCLS) .Set(KcbChidinhclsChitiet.Columns.KetQua).EqualTo(objChidinhclsChitiet.KetQua) .Set(KcbChidinhclsChitiet.Columns.ImgPath1).EqualTo(objChidinhclsChitiet.ImgPath1) .Set(KcbChidinhclsChitiet.Columns.ImgPath2).EqualTo(objChidinhclsChitiet.ImgPath2) .Set(KcbChidinhclsChitiet.Columns.ImgPath3).EqualTo(objChidinhclsChitiet.ImgPath3) .Set(KcbChidinhclsChitiet.Columns.ImgPath4).EqualTo(objChidinhclsChitiet.ImgPath4) //.Set(KcbChidinhclsChitiet.Columns.VungKs).EqualTo(objChidinhclsChitiet.VungKs) .Set(KcbChidinhclsChitiet.Columns.NgayThuchien).EqualTo(objChidinhclsChitiet.NgayThuchien) .Set(KcbChidinhclsChitiet.Columns.NguoiThuchien).EqualTo(objChidinhclsChitiet.NguoiThuchien) .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(objChidinhclsChitiet.IdChitietchidinh).Execute(); } scope.Complete(); log.Info("Luu thong tin cua hinh ah thanh cong"); return ActionResult.Success; } }catch(Exception exception) { log.Error("loi luu hinh anh :"+exception.ToString()); return ActionResult.Error; } }
void frm_ViewImages_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { this.Close(); return; } if (e.KeyCode == Keys.F5) { objChitiet = KcbChidinhclsChitiet.FetchByID(objChitiet.IdChitietchidinh); LoadImages(); return; } }
public void Insert(long?IdKham, long IdChidinh, long?IdChidinhChuyengoi, short?IdDichvu, int IdChitietdichvu, decimal?PtramBhytGoc, decimal?PtramBhyt, decimal GiaDanhmuc, string MadoituongGia, decimal?DonGia, decimal?PhuThu, string NguoiTao, byte?IdLoaichidinh, DateTime?NgayTao, DateTime?NgaySua, string NguoiSua, byte?TrangthaiThanhtoan, DateTime?NgayThanhtoan, byte?TrangthaiHuy, byte?TuTuc, byte?LoaiChietkhau, short?IdDoituongKcb, long?IdBenhnhan, string MaLuotkham, decimal?SoLuong, byte?TrangThai, byte?TrangthaiBhyt, byte HienthiBaocao, decimal?BhytChitra, decimal?BnhanChitra, long?IdThanhtoan, short?IdKhoaThuchien, short?IdPhongThuchien, decimal?TileChietkhau, decimal?TienChietkhau, string KieuChietkhau, int?IdGoi, byte?TrongGoi, short?IdBacsiThuchien, string NguoiThuchien, DateTime?NgayThuchien, string ImgPath1, string ImgPath2, string ImgPath3, string ImgPath4, byte?FTPImage, string KetQua, byte?ChidinhGoidichvu, byte?NguonThanhtoan, string IpMaytao, string IpMaysua, string TenMaytao, string TenMaysua, short?ChitieuPhantich, string MahoaMau, byte?MauUutien, DateTime?NgayhenTrakq, short?ThetichkhoiluongMau, string TinhtrangMau) { KcbChidinhclsChitiet item = new KcbChidinhclsChitiet(); item.IdKham = IdKham; item.IdChidinh = IdChidinh; item.IdChidinhChuyengoi = IdChidinhChuyengoi; item.IdDichvu = IdDichvu; item.IdChitietdichvu = IdChitietdichvu; item.PtramBhytGoc = PtramBhytGoc; item.PtramBhyt = PtramBhyt; item.GiaDanhmuc = GiaDanhmuc; item.MadoituongGia = MadoituongGia; item.DonGia = DonGia; item.PhuThu = PhuThu; item.NguoiTao = NguoiTao; item.IdLoaichidinh = IdLoaichidinh; item.NgayTao = NgayTao; item.NgaySua = NgaySua; item.NguoiSua = NguoiSua; item.TrangthaiThanhtoan = TrangthaiThanhtoan; item.NgayThanhtoan = NgayThanhtoan; item.TrangthaiHuy = TrangthaiHuy; item.TuTuc = TuTuc; item.LoaiChietkhau = LoaiChietkhau; item.IdDoituongKcb = IdDoituongKcb; item.IdBenhnhan = IdBenhnhan; item.MaLuotkham = MaLuotkham; item.SoLuong = SoLuong; item.TrangThai = TrangThai; item.TrangthaiBhyt = TrangthaiBhyt; item.HienthiBaocao = HienthiBaocao; item.BhytChitra = BhytChitra; item.BnhanChitra = BnhanChitra; item.IdThanhtoan = IdThanhtoan; item.IdKhoaThuchien = IdKhoaThuchien; item.IdPhongThuchien = IdPhongThuchien; item.TileChietkhau = TileChietkhau; item.TienChietkhau = TienChietkhau; item.KieuChietkhau = KieuChietkhau; item.IdGoi = IdGoi; item.TrongGoi = TrongGoi; item.IdBacsiThuchien = IdBacsiThuchien; item.NguoiThuchien = NguoiThuchien; item.NgayThuchien = NgayThuchien; item.ImgPath1 = ImgPath1; item.ImgPath2 = ImgPath2; item.ImgPath3 = ImgPath3; item.ImgPath4 = ImgPath4; item.FTPImage = FTPImage; item.KetQua = KetQua; item.ChidinhGoidichvu = ChidinhGoidichvu; item.NguonThanhtoan = NguonThanhtoan; item.IpMaytao = IpMaytao; item.IpMaysua = IpMaysua; item.TenMaytao = TenMaytao; item.TenMaysua = TenMaysua; item.ChitieuPhantich = ChitieuPhantich; item.MahoaMau = MahoaMau; item.MauUutien = MauUutien; item.NgayhenTrakq = NgayhenTrakq; item.ThetichkhoiluongMau = ThetichkhoiluongMau; item.TinhtrangMau = TinhtrangMau; item.Save(UserName); }
public ActionResult UpdateDataChiDinhCLS(KcbChidinhcl objKcbChidinhcls, KcbLuotkham objLuotkham, KcbChidinhclsChitiet[] arrAssignDetails) { try { using (var scope = new TransactionScope()) { using (var sh = new SharedDbConnectionScope()) { if (objLuotkham == null) { objLuotkham = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objKcbChidinhcls.MaLuotkham) .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo( Utility.Int32Dbnull(objKcbChidinhcls.IdBenhnhan)).ExecuteSingle<KcbLuotkham>(); } new Update(KcbChidinhcl.Schema) .Set(KcbChidinhcl.Columns.IdBacsiChidinh).EqualTo(objKcbChidinhcls.IdBacsiChidinh) .Set(KcbChidinhcl.Columns.NgaySua).EqualTo(globalVariables.SysDate) .Set(KcbChidinhcl.Columns.NguoiSua).EqualTo(globalVariables.UserName) .Where(KcbChidinhcl.Columns.IdChidinh).IsEqualTo(Utility.Int32Dbnull(objKcbChidinhcls.IdChidinh)).Execute(); if (Utility.Int32Dbnull(objKcbChidinhcls.IdKham) > 0) { new Update(KcbDangkyKcb.Schema) .Set(KcbDangkyKcb.Columns.IdBacsikham).EqualTo(objKcbChidinhcls.IdBacsiChidinh) .Where(KcbDangkyKcb.IdKhamColumn).IsEqualTo(objKcbChidinhcls.IdKham).Execute(); } log.Info("Cap nhap lai thong tin cua phieu chi dinh voi Assign_ID=" + objKcbChidinhcls.IdChidinh); InsertAssignDetail(objKcbChidinhcls, objLuotkham, arrAssignDetails); } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { log.InfoException("Loi thong tin ", exception); return ActionResult.Error; } }
public ActionResult SaoChepPhieuDieuTri(NoitruPhieudieutri[] lstPhieudieutri, KcbLuotkham objLuotkham, KcbChidinhclsChitiet[] arrChidinhCLSChitiet, KcbDonthuocChitiet[] arrDonthuocChitiet) { try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { foreach (NoitruPhieudieutri objTreatment in lstPhieudieutri) { objTreatment.NguoiTao = globalVariables.UserName; objTreatment.NgayTao = DateTime.Now; objTreatment.TthaiBosung = 0; objTreatment.IdBacsi = globalVariables.gv_intIDNhanvien; objTreatment.IdKhoanoitru = objLuotkham.IdKhoanoitru; objTreatment.MaLuotkham = objLuotkham.MaLuotkham; objTreatment.IdBenhnhan = objTreatment.IdBenhnhan; objTreatment.IdBuongGiuong = objLuotkham.IdRavien; objTreatment.TrangThai = 0; objTreatment.TthaiIn = 0; objTreatment.IpMaytao = globalVariables.gv_strIPAddress; objTreatment.TenMaytao = globalVariables.gv_strComputerName; objTreatment.GioDieutri = Utility.GetFormatDateTime(globalVariables.SysDate, "hh:mm:ss"); objTreatment.IsNew = true; objTreatment.Save(); if (arrChidinhCLSChitiet.Length > 0) { KcbChidinhcl objAssignInfo = new KcbChidinhcl(); objAssignInfo.IdDieutri = objTreatment.IdPhieudieutri; objAssignInfo.IdBuongGiuong = objTreatment.IdBuongGiuong; objAssignInfo.MaLuotkham = objTreatment.MaLuotkham; objAssignInfo.IdBenhnhan = Utility.Int32Dbnull(objTreatment.IdBenhnhan); objAssignInfo.IdBacsiChidinh = globalVariables.gv_intIDNhanvien; objAssignInfo.Noitru = 1; objAssignInfo.IdKhoadieutri = objTreatment.IdKhoanoitru; objAssignInfo.IdKhoaChidinh = objTreatment.IdKhoanoitru; objAssignInfo.IdKham = -1; objAssignInfo.IdDoituongKcb = objLuotkham.IdDoituongKcb; objAssignInfo.IdPhongChidinh = objTreatment.IdKhoanoitru; objAssignInfo.Barcode = string.Empty; objAssignInfo.NgayChidinh = objTreatment.NgayDieutri.Value; objAssignInfo.NguoiTao = globalVariables.UserName; objAssignInfo.NgayTao = globalVariables.SysDate; objAssignInfo.IpMaytao = globalVariables.gv_strIPAddress; objAssignInfo.TenMaytao = globalVariables.gv_strComputerName; objAssignInfo.MaChidinh = THU_VIEN_CHUNG.SinhMaChidinhCLS(); objAssignInfo.IsNew = true; objAssignInfo.Save(); List <KcbChidinhclsChitiet> lstChidinhCLSChitiet = new List <KcbChidinhclsChitiet>(); foreach (KcbChidinhclsChitiet objAssignDetail in arrChidinhCLSChitiet) { KcbChidinhclsChitiet objDetail = KcbChidinhclsChitiet.FetchByID(objAssignDetail.IdChitietchidinh); if (objDetail != null) { objDetail.IdChitietchidinh = -1; objDetail.IdChidinh = objAssignInfo.IdChidinh; objDetail.IdKham = -1; objDetail.TrangthaiThanhtoan = 0; objDetail.NgayThanhtoan = null; objDetail.TrangthaiHuy = 0; objDetail.ImgPath1 = string.Empty; objDetail.ImgPath2 = string.Empty; objDetail.ImgPath3 = string.Empty; objDetail.ImgPath4 = string.Empty; objDetail.TrangThai = 0; //objDetail.MotaThem = null; objDetail.TrangthaiBhyt = 0; objDetail.IdThanhtoan = -1; objDetail.IdKhoaThuchien = (short)objAssignInfo.IdKhoadieutri; objDetail.IdPhongThuchien = objDetail.IdKhoaThuchien; objDetail.IdGoi = -1; objDetail.IdBacsiThuchien = -1; objDetail.NgayThuchien = null; objDetail.NguoiThuchien = null; //objDetail.KetLuan = null; objDetail.KetQua = null; //objDetail.DeNghi = null; //objDetail.MaVungkhaosat = null; objDetail.NguoiTao = globalVariables.UserName; objDetail.NgayTao = globalVariables.SysDate; objDetail.IpMaytao = globalVariables.gv_strIPAddress; objDetail.TenMaytao = globalVariables.gv_strComputerName; objDetail.IsNew = true; lstChidinhCLSChitiet.Add(objDetail); } new KCB_CHIDINH_CANLAMSANG().InsertAssignDetail(objAssignInfo, objLuotkham, lstChidinhCLSChitiet.ToArray <KcbChidinhclsChitiet>()); } } if (arrDonthuocChitiet.Length > 0) { var query = (from donthuoc in arrDonthuocChitiet.AsEnumerable() let y = donthuoc.IdDonthuoc select y).Distinct(); foreach (var pres_id in query.ToList()) { KcbDonthuoc objPresInfo = KcbDonthuoc.FetchByID(Utility.Int32Dbnull(pres_id)); if (objPresInfo != null) { objPresInfo.Noitru = 1; List <KcbDonthuocChitiet> lstDonthuocchitiet = (from donthuoc in arrDonthuocChitiet.AsEnumerable() where donthuoc.IdDonthuoc == pres_id select donthuoc).ToList <KcbDonthuocChitiet>(); SaoChepDonThuocTheoPhieuDieuTri(objPresInfo, objTreatment, lstDonthuocchitiet.ToArray <KcbDonthuocChitiet>()); } } } } } scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { return(ActionResult.Error); } }
public void Insert(long? IdKham,long IdChidinh,long? IdChidinhChuyengoi,short? IdDichvu,int IdChitietdichvu,decimal? PtramBhytGoc,decimal? PtramBhyt,decimal GiaDanhmuc,string MadoituongGia,decimal? DonGia,decimal? PhuThu,string NguoiTao,byte? IdLoaichidinh,DateTime? NgayTao,DateTime? NgaySua,string NguoiSua,byte? TrangthaiThanhtoan,DateTime? NgayThanhtoan,byte? TrangthaiHuy,byte? TuTuc,byte? LoaiChietkhau,short? IdDoituongKcb,long? IdBenhnhan,string MaLuotkham,int? SoLuong,byte? TrangThai,byte? TrangthaiBhyt,byte HienthiBaocao,decimal? BhytChitra,decimal? BnhanChitra,int? IdThanhtoan,short? IdKhoaThuchien,short? IdPhongThuchien,decimal? TileChietkhau,decimal? TienChietkhau,string KieuChietkhau,int? IdGoi,byte? TrongGoi,short? IdBacsiThuchien,string NguoiThuchien,DateTime? NgayThuchien,string ImgPath1,string ImgPath2,string ImgPath3,string ImgPath4,byte? FTPImage,string KetQua,byte? ChidinhGoidichvu,byte? NguonThanhtoan,string IpMaytao,string IpMaysua,string TenMaytao,string TenMaysua) { KcbChidinhclsChitiet item = new KcbChidinhclsChitiet(); item.IdKham = IdKham; item.IdChidinh = IdChidinh; item.IdChidinhChuyengoi = IdChidinhChuyengoi; item.IdDichvu = IdDichvu; item.IdChitietdichvu = IdChitietdichvu; item.PtramBhytGoc = PtramBhytGoc; item.PtramBhyt = PtramBhyt; item.GiaDanhmuc = GiaDanhmuc; item.MadoituongGia = MadoituongGia; item.DonGia = DonGia; item.PhuThu = PhuThu; item.NguoiTao = NguoiTao; item.IdLoaichidinh = IdLoaichidinh; item.NgayTao = NgayTao; item.NgaySua = NgaySua; item.NguoiSua = NguoiSua; item.TrangthaiThanhtoan = TrangthaiThanhtoan; item.NgayThanhtoan = NgayThanhtoan; item.TrangthaiHuy = TrangthaiHuy; item.TuTuc = TuTuc; item.LoaiChietkhau = LoaiChietkhau; item.IdDoituongKcb = IdDoituongKcb; item.IdBenhnhan = IdBenhnhan; item.MaLuotkham = MaLuotkham; item.SoLuong = SoLuong; item.TrangThai = TrangThai; item.TrangthaiBhyt = TrangthaiBhyt; item.HienthiBaocao = HienthiBaocao; item.BhytChitra = BhytChitra; item.BnhanChitra = BnhanChitra; item.IdThanhtoan = IdThanhtoan; item.IdKhoaThuchien = IdKhoaThuchien; item.IdPhongThuchien = IdPhongThuchien; item.TileChietkhau = TileChietkhau; item.TienChietkhau = TienChietkhau; item.KieuChietkhau = KieuChietkhau; item.IdGoi = IdGoi; item.TrongGoi = TrongGoi; item.IdBacsiThuchien = IdBacsiThuchien; item.NguoiThuchien = NguoiThuchien; item.NgayThuchien = NgayThuchien; item.ImgPath1 = ImgPath1; item.ImgPath2 = ImgPath2; item.ImgPath3 = ImgPath3; item.ImgPath4 = ImgPath4; item.FTPImage = FTPImage; item.KetQua = KetQua; item.ChidinhGoidichvu = ChidinhGoidichvu; item.NguonThanhtoan = NguonThanhtoan; item.IpMaytao = IpMaytao; item.IpMaysua = IpMaysua; item.TenMaytao = TenMaytao; item.TenMaysua = TenMaysua; item.Save(UserName); }
private KcbChidinhclsChitiet[] CreateChiDinhCLS() { var query = from thuoc in grdDichvuSaochep.GetCheckedRows() where Utility.Int32Dbnull(thuoc.Cells["id_loaithanhtoan"].Value) == 2 select thuoc; var gridExRows = query as GridEXRow[] ?? query.ToArray(); var arrDetail = new KcbChidinhclsChitiet[gridExRows.Count()]; int idx = 0; foreach (Janus.Windows.GridEX.GridEXRow gridExRow in gridExRows.AsEnumerable()) { arrDetail[idx] = new KcbChidinhclsChitiet(); arrDetail[idx].IdChitietchidinh = Utility.Int32Dbnull(gridExRow.Cells["id_phieu_chitiet"].Value); arrDetail[idx].SoLuong = Utility.Int32Dbnull(gridExRow.Cells["so_luong"].Value); idx++; } return arrDetail; }