本文整理汇总了C#中KcbLuotkham.Save方法的典型用法代码示例。如果您正苦于以下问题:C# KcbLuotkham.Save方法的具体用法?C# KcbLuotkham.Save怎么用?C# KcbLuotkham.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KcbLuotkham
的用法示例。
在下文中一共展示了KcbLuotkham.Save方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddNewPatientExam
public ActionResult AddNewPatientExam(KcbDanhsachBenhnhan objPatientInfo, KcbLuotkham objLuotkham, KcbDangkyKcb objRegExam, int KieuKham)
{
try
{
using (var scope = new TransactionScope())
{
using (var dbscope = new SharedDbConnectionScope())
{
UpdatePatientInfo(objPatientInfo);
SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema)
.Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan)
.And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham);
if (sqlQueryPatientExam.GetRecordCount() > 0)//Nếu BN khác đã lấy mã này
{
objLuotkham.MaLuotkham = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM();
}
objLuotkham.IsNew = true;
objLuotkham.Save();
if (objLuotkham.TrangthaiNoitru >= 1)
{
SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema).Where(
KcbLuotkham.Columns.MaLuotkham).IsNotEqualTo(objLuotkham.MaLuotkham)
.And(KcbLuotkham.Columns.SoBenhAn).IsEqualTo(objLuotkham.SoBenhAn)
.And(KcbLuotkham.Columns.TrangthaiNoitru).IsGreaterThanOrEqualTo(1);
if (sqlQuery.GetRecordCount() > 0)
{
var query = new Update(KcbLuotkham.Schema)
.Set(KcbLuotkham.Columns.SoBenhAn).EqualTo(THU_VIEN_CHUNG.LaySoBenhAn())
.Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham).
Execute();
}
}
if (objRegExam != null)
{
objRegExam.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham);
objRegExam.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan);
AddRegExam(objRegExam,objLuotkham, false, KieuKham);
}
scope.Complete();
return ActionResult.Success;
}
}
}
catch (Exception ex)
{
return ActionResult.Error;
}
}
示例2: ThemLankhamMoi
public ActionResult ThemLankhamMoi(KcbDanhsachBenhnhan objPatientInfo, KcbLuotkham objLuotkham, KcbDangkyKcb objRegExam, int KieuKham,ref long id_kham)
{
int v_IdBenhnhan = -1;
try
{
using (var scope = new TransactionScope())
{
using (var dbscope = new SharedDbConnectionScope())
{
objPatientInfo.IsNew = true;
objPatientInfo.Save();
//Thêm lần khám
objLuotkham.IdBenhnhan = objPatientInfo.IdBenhnhan;
objLuotkham.SoBenhAn = string.Empty;
//Tạm bỏ đoạn này
//decimal PtramBHYT = THU_VIEN_CHUNG.TinhPtramBHYT(objLuotkham);
//if (PtramBHYT != Utility.DecimaltoDbnull(objLuotkham.PtramBhyt))
//{
// log.Info(string.Format("voi benh nhan :{0} va MaLuotkham:{1} ", objPatientInfo.TenBenhnhan, objLuotkham.MaLuotkham));
// log.Info(
// string.Format(
// "truong hop phan tram tinh toan sai void ptramBHYT:{0} va truyen tu ngoai vao :{1} ",
// PtramBHYT, objLuotkham.PtramBhyt));
// objLuotkham.PtramBhyt = PtramBHYT;
//}
objLuotkham.SttKham = THU_VIEN_CHUNG.LaySTTKhamTheoDoituong(objLuotkham.IdDoituongKcb);
objLuotkham.NgayTao = globalVariables.SysDate;
objLuotkham.NguoiTao = globalVariables.UserName;
objLuotkham.IsNew = true;
objLuotkham.Save();
SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema)
.Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan)
.And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham);
if (sqlQueryPatientExam.GetRecordCount() > 0)
{
string patientCode = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM();
new Update(KcbLuotkham.Schema)
.Set(KcbLuotkham.Columns.MaLuotkham).EqualTo(patientCode)
.Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan)
.And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham).Execute();
objLuotkham.MaLuotkham = patientCode;
}
//Đoạn này Rem lại vì ko có ý nghĩa ngoại trú
//if (objLuotkham.TrangThai >= 1)
//{
// SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema).Where(
// KcbLuotkham.Columns.MaLuotkham).IsNotEqualTo(objLuotkham.MaLuotkham)
// .And(KcbLuotkham.Columns.SoBenhAn).IsEqualTo(objLuotkham.SoBenhAn)
// .And(KcbLuotkham.Columns.TrangThai).IsGreaterThanOrEqualTo(1);
// if (sqlQuery.GetRecordCount() > 0)
// {
// new Update(KcbLuotkham.Schema)
// .Set(KcbLuotkham.Columns.SoBenhAn).EqualTo(THU_VIEN_CHUNG.LaySoBenhAn())
// .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham).
// Execute();
// }
//}
if (objRegExam != null)//Đôi lúc người dùng không chọn phòng khám
{
objRegExam.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham);
objRegExam.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan);
id_kham = AddRegExam(objRegExam, objLuotkham, false, KieuKham);
}
scope.Complete();
return ActionResult.Success;
}
}
}
catch (Exception ex)
{
log.Error("loi trong qua trinh cap nhap thong tin them moi thong tin benh nhan tiep don {0}", ex);
return ActionResult.Error;
}
}
示例3: UpdateLanKham
public ActionResult UpdateLanKham(KcbDanhsachBenhnhan objPatientInfo, KcbLuotkham objLuotkham, KcbDangkyKcb objRegExam, int KieuKham, decimal PtramBhytCu, decimal PtramBhytgoc )
{
ActionResult _ActionResult = ActionResult.Success;
try
{
using (var scope = new TransactionScope())
{
using (var dbscope = new SharedDbConnectionScope())
{
SqlQuery query =
new Select().From(KcbLuotkham.Schema).Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(
objLuotkham.MaLuotkham).And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(
objLuotkham.IdBenhnhan);
KcbLuotkham objExam = query.ExecuteSingle<KcbLuotkham>();
UpdatePatientInfo(objPatientInfo);
//decimal PtramBHYT = THU_VIEN_CHUNG.TinhPtramBHYT(objLuotkham);
//if (PtramBHYT != Utility.DecimaltoDbnull(objLuotkham.PtramBhyt))
//{
// objLuotkham.PtramBhyt = PtramBHYT;
//}
objLuotkham.MarkOld();
objLuotkham.IsNew = false;
objLuotkham.Save();
//int recordExam = new Update(KcbLuotkham.Schema)
// .Set(KcbLuotkham.Columns.NguoiLienhe).EqualTo(objLuotkham.NguoiLienhe)
// .Set(KcbLuotkham.Columns.TrangthaiCapcuu).EqualTo(objLuotkham.TrangthaiCapcuu)
// .Set(KcbLuotkham.Columns.LuongCoban).EqualTo(objLuotkham.LuongCoban)
// .Set(KcbLuotkham.Columns.TthaiChuyendi).EqualTo(objLuotkham.TthaiChuyendi)
// .Set(KcbLuotkham.Columns.DienthoaiLienhe).EqualTo(objLuotkham.DienthoaiLienhe)
// .Set(KcbLuotkham.Columns.DiachiLienhe).EqualTo(objLuotkham.DiachiLienhe)
// .Set(KcbLuotkham.Columns.TrieuChung).EqualTo(objLuotkham.TrieuChung)
// .Set(KcbLuotkham.Columns.MatheBhyt).EqualTo(objLuotkham.MatheBhyt)
// .Set(KcbLuotkham.Columns.MaNoicapBhyt).EqualTo(objLuotkham.MaNoicapBhyt)
// .Set(KcbLuotkham.Columns.MaQuyenloi).EqualTo(objLuotkham.MaQuyenloi)
// .Set(KcbLuotkham.Columns.NgaybatdauBhyt).EqualTo(objLuotkham.NgaybatdauBhyt)
// .Set(KcbLuotkham.Columns.NgayketthucBhyt).EqualTo(objLuotkham.NgayketthucBhyt)
// .Set(KcbLuotkham.Columns.NoicapBhyt).EqualTo(objLuotkham.NoicapBhyt)
// .Set(KcbLuotkham.Columns.IdDoituongKcb).EqualTo(objLuotkham.IdDoituongKcb)
// .Set(KcbLuotkham.Columns.IdLoaidoituongKcb).EqualTo(objLuotkham.IdLoaidoituongKcb)
// .Set(KcbLuotkham.Columns.TrangthaiNgoaitru).EqualTo(objLuotkham.TrangthaiNgoaitru)
// .Set(KcbLuotkham.Columns.MaKcbbd).EqualTo(objLuotkham.MaKcbbd)
// .Set(KcbLuotkham.Columns.NoiDongtrusoKcbbd).EqualTo(objLuotkham.NoiDongtrusoKcbbd)
// .Set(KcbLuotkham.Columns.MaDoituongBhyt).EqualTo(objLuotkham.MaDoituongBhyt)
// .Set(KcbLuotkham.Columns.IdKhoatiepnhan).EqualTo(objLuotkham.IdKhoatiepnhan)
// .Set(KcbLuotkham.Columns.DungTuyen).EqualTo(objLuotkham.DungTuyen)
// .Set(KcbLuotkham.Columns.NgayTiepdon).EqualTo(objLuotkham.NgayTiepdon)
// .Set(KcbLuotkham.Columns.MaDoituongKcb).EqualTo(objLuotkham.MaDoituongKcb)
// .Set(KcbLuotkham.Columns.MaKhoaThuchien).EqualTo(objLuotkham.MaKhoaThuchien)
// .Set(KcbLuotkham.Columns.NguoiSua).EqualTo(globalVariables.UserName)
// .Set(KcbLuotkham.Columns.NgaySua).EqualTo(globalVariables.SysDate)
// .Set(KcbLuotkham.Columns.PtramBhyt).EqualTo(objLuotkham.PtramBhyt)
// .Set(KcbLuotkham.Columns.SoBenhAn).EqualTo(objLuotkham.SoBenhAn)
// .Set(KcbLuotkham.Columns.DiaChi).EqualTo(objLuotkham.DiaChi)
// .Set(KcbLuotkham.Columns.DiachiBhyt).EqualTo(objLuotkham.DiachiBhyt)
// .Set(KcbLuotkham.Columns.Cmt).EqualTo(objLuotkham.Cmt)
// .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
// .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan)
// .Execute();
//Kiểm tra nếu % bị thay đổi thì cập nhật lại tất cả các bảng
if (PtramBhytCu != Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) || PtramBhytgoc != Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0))
_ActionResult= THU_VIEN_CHUNG.UpdatePtramBHYT(objLuotkham, -1);
if (_ActionResult == ActionResult.Cancel)//Báo không cho phép thay đổi phần trăm BHYT do đã có dịch vụ đã thanh toán
{
return _ActionResult;
}
if (objRegExam != null)
{
objRegExam.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham);
objRegExam.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan);
AddRegExam(objRegExam,objLuotkham, false, KieuKham);
}
scope.Complete();
return ActionResult.Success;
}
}
}
catch (Exception ex)
{
log.Error("Loi trong qua trinh update thong tin benh nhan {0}", ex);
return ActionResult.Error;
}
}
示例4: ThemmoiLuotkham
/// <summary>
/// HAM THUC HIEN HIEN THEM LAN KHAM CUA BENH NHAN
/// </summary>
/// <param name="objKcbDanhsachBenhnhan"></param>
/// <param name="objLuotkham"></param>
/// <returns></returns>
public ActionResult ThemmoiLuotkham(KcbDanhsachBenhnhan objKcbDanhsachBenhnhan, KcbLuotkham objLuotkham, ref string MaLuotkham)
{
try
{
using (var scope = new TransactionScope())
{
using (var dbscope = new SharedDbConnectionScope())
{
UpdatePatientInfo(objKcbDanhsachBenhnhan);
SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema)
.Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan)
.And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham);
if (sqlQueryPatientExam.GetRecordCount() > 0)
{
objLuotkham.MaLuotkham = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM();
}
objLuotkham.IsNew = true;
objLuotkham.Save();
new Update(KcbDmucLuotkham.Schema)
.Set(KcbDmucLuotkham.Columns.TrangThai).EqualTo(2)
.Set(KcbDmucLuotkham.Columns.EndTime).EqualTo(DateTime.Now)
.Where(KcbDmucLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
.And(KcbDmucLuotkham.Columns.TrangThai).IsLessThanOrEqualTo(1)
.And(KcbDmucLuotkham.Columns.Nam).IsEqualTo(globalVariables.SysDate.Year)
.And(KcbDmucLuotkham.Columns.UsedBy).IsLessThanOrEqualTo(globalVariables.UserName)
.Execute();
;
MaLuotkham = objLuotkham.MaLuotkham;
scope.Complete();
return ActionResult.Success;
}
}
}
catch (Exception ex)
{
return ActionResult.Error;
}
}
示例5: Payment4SelectedItems_Ao
public ActionResult Payment4SelectedItems_Ao(KcbThanhtoan objThanhtoan, KcbLuotkham objLuotkham, List<KcbThanhtoanChitiet> objArrPaymentDetail, ref int id_thanhtoan, long IdHdonLog, bool Layhoadondo)
{
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_dblTongtienDCT = 0;
///tổng tiền đã thanh toán
decimal v_TotalPaymentDetail = 0;
try
{
using (var scope = new TransactionScope())
{
using (var dbscope = new SharedDbConnectionScope())
{
///lấy tổng số Payment của mang truyền vào của pay ment hiện tại
v_dblTongtienDCT = TongtienKhongTutuc(objArrPaymentDetail);
KcbThanhtoanCollection paymentCollection =
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));
//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 paymentCollection)
{
KcbThanhtoanChitietCollection paymentDetailCollection = new Select().From(KcbThanhtoanChitiet.Schema)
.Where(KcbThanhtoanChitiet.Columns.IdThanhtoan).IsEqualTo(Payment.IdThanhtoan)
.And(KcbThanhtoanChitiet.Columns.TrangthaiHuy).IsEqualTo(0).ExecuteAsCollection
<KcbThanhtoanChitietCollection>();
foreach (KcbThanhtoanChitiet paymentDetail in paymentDetailCollection)
{
if (paymentDetail.TuTuc == 0)
{
lstKcbThanhtoanChitiet.Add(paymentDetail);
v_TotalPaymentDetail += Utility.Int32Dbnull(paymentDetail.SoLuong) *
Utility.DecimaltoDbnull(paymentDetail.DonGia);
}
}
}
//Tính toán lại phần trăm BHYT chủ yếu liên quan đến phần lương cơ bản.
//Phần trăm này có thể bị biến đổi và khác với % trong bảng lượt khám
LayThongtinPtramBHYT(v_dblTongtienDCT + v_TotalPaymentDetail, objLuotkham, ref PtramBHYT);
objThanhtoan.MaThanhtoan = THU_VIEN_CHUNG.TaoMathanhtoan(Convert.ToDateTime(objThanhtoan.NgayThanhtoan));
objThanhtoan.IsNew = true;
objThanhtoan.Save();
//Tính lại Bnhan chi trả và BHYT chi trả
THU_VIEN_CHUNG.TinhPhamTramBHYT(objLuotkham, ref objArrPaymentDetail,ref lstKcbThanhtoanChitiet, PtramBHYT);
foreach (KcbThanhtoanChitiet objThanhtoanDetail in lstKcbThanhtoanChitiet)
{
objThanhtoanDetail.IsNew = false;
objThanhtoanDetail.MarkOld();
objThanhtoanDetail.Save();
}
decimal TT_BN = 0m;
decimal TT_BHYT = 0m;
decimal TT_Chietkhau_Chitiet = 0m;
foreach (KcbThanhtoanChitiet objThanhtoanDetail in objArrPaymentDetail)
{
TT_BN += (objThanhtoanDetail.BnhanChitra + objThanhtoanDetail.PhuThu) * objThanhtoanDetail.SoLuong;
TT_BHYT += objThanhtoanDetail.BhytChitra * objThanhtoanDetail.SoLuong;
TT_Chietkhau_Chitiet += Utility.DecimaltoDbnull(objThanhtoanDetail.TienChietkhau, 0);
objThanhtoanDetail.IdThanhtoan = Utility.Int32Dbnull(objThanhtoan.IdThanhtoan, -1);
objThanhtoanDetail.IsNew = true;
objThanhtoanDetail.Save();
UpdatePaymentStatus(objThanhtoan, objThanhtoanDetail);
}
#region Hoadondo
if (Layhoadondo)
{
int record = -1;
if (IdHdonLog > 0)
{
record =
new Delete().From(HoadonLog.Schema)
.Where(HoadonLog.Columns.IdHdonLog)
.IsEqualTo(IdHdonLog)
.Execute();
if (record <= 0)
{
Utility.ShowMsg("Có lỗi trong quá trình xóa thông tin serie hóa đơn đã hủy để cấp lại cho lần thanh toán này.");
return ActionResult.Error;
}
}
var obj = new HoadonLog();
obj.IdThanhtoan = objThanhtoan.IdThanhtoan;
obj.TongTien = objThanhtoan.TongTien - Utility.DecimaltoDbnull(objThanhtoan.TongtienChietkhau, 0);
obj.IdBenhnhan = objThanhtoan.IdBenhnhan;
obj.MaLuotkham = objThanhtoan.MaLuotkham;
obj.MauHoadon = objThanhtoan.MauHoadon;
obj.KiHieu = objThanhtoan.KiHieu;
obj.IdCapphat = objThanhtoan.IdCapphat.Value;
obj.MaQuyen = objThanhtoan.MaQuyen;
//.........这里部分代码省略.........
示例6: Update
//.........这里部分代码省略.........
item.SoBenhAn = SoBenhAn;
item.SongayDieutri = SongayDieutri;
item.IdKhoatiepnhan = IdKhoatiepnhan;
item.SolanKham = SolanKham;
item.SttKham = SttKham;
item.Noitru = Noitru;
item.MaKhoaThuchien = MaKhoaThuchien;
item.ChandoanKemtheo = ChandoanKemtheo;
item.NguoiKetthuc = NguoiKetthuc;
item.NgayKetthuc = NgayKetthuc;
item.LydoKetthuc = LydoKetthuc;
item.DiaChi = DiaChi;
item.DiachiBhyt = DiachiBhyt;
item.IdBenhvienDen = IdBenhvienDen;
item.IdBenhvienDi = IdBenhvienDi;
item.TthaiChuyenden = TthaiChuyenden;
item.TthaiChuyendi = TthaiChuyendi;
item.IdBacsiChuyenvien = IdBacsiChuyenvien;
item.TrangthaiNgoaitru = TrangthaiNgoaitru;
item.TrangthaiNoitru = TrangthaiNoitru;
item.Locked = Locked;
item.TthaiThopNoitru = TthaiThopNoitru;
item.TthaiThanhtoannoitru = TthaiThanhtoannoitru;
item.IdNhapvien = IdNhapvien;
item.NgayNhapvien = NgayNhapvien;
item.NgayRavien = NgayRavien;
item.SoRavien = SoRavien;
item.MotaNhapvien = MotaNhapvien;
item.IdRavien = IdRavien;
item.IdKhoanoitru = IdKhoanoitru;
item.IdBuong = IdBuong;
item.IdGiuong = IdGiuong;
item.NgayKedon = NgayKedon;
item.NgayNhanthuoc = NgayNhanthuoc;
item.NgayNhanketquaCls = NgayNhanketquaCls;
item.NoiGioithieu = NoiGioithieu;
item.BoVien = BoVien;
item.Email = Email;
item.NhomBenhnhan = NhomBenhnhan;
item.GiayBhyt = GiayBhyt;
item.MadtuongSinhsong = MadtuongSinhsong;
item.IpMaytao = IpMaytao;
item.IpMaysua = IpMaysua;
item.TenMaytao = TenMaytao;
item.TenMaysua = TenMaysua;
item.NgayTao = NgayTao;
item.NguoiTao = NguoiTao;
item.NgaySua = NgaySua;
item.NguoiSua = NguoiSua;
item.Save(UserName);
}
示例7: ThemmoiBenhnhan
public ActionResult ThemmoiBenhnhan(KcbDanhsachBenhnhan objKcbDanhsachBenhnhan, KcbLuotkham objLuotkham, KcbDangkyKcb objKcbDangkyKcb, int KieuKham,ref long id_kham)
{
int v_IdBenhnhan = -1;
try
{
using (var scope = new TransactionScope())
{
using (var dbscope = new SharedDbConnectionScope())
{
objKcbDanhsachBenhnhan.IsNew = true;
objKcbDanhsachBenhnhan.Save();
//Thêm lần khám
objLuotkham.IdBenhnhan = objKcbDanhsachBenhnhan.IdBenhnhan;
objLuotkham.SoBenhAn = string.Empty;
objLuotkham.SttKham = THU_VIEN_CHUNG.LaySTTKhamTheoDoituong(objLuotkham.IdDoituongKcb);
objLuotkham.NgayTao = globalVariables.SysDate;
objLuotkham.NguoiTao = globalVariables.UserName;
objLuotkham.IsNew = true;
objLuotkham.Save();
SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema)
.Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan)
.And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham);
if (sqlQueryPatientExam.GetRecordCount() > 0)
{
string patientCode = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM();
new Update(KcbLuotkham.Schema)
.Set(KcbLuotkham.Columns.MaLuotkham).EqualTo(patientCode)
.Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan)
.And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham).Execute();
objLuotkham.MaLuotkham = patientCode;
}
new Update(KcbDmucLuotkham.Schema)
.Set(KcbDmucLuotkham.Columns.TrangThai).EqualTo(2)
.Set(KcbDmucLuotkham.Columns.EndTime).EqualTo(DateTime.Now)
.Where(KcbDmucLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
.And(KcbDmucLuotkham.Columns.TrangThai).IsLessThanOrEqualTo(1)
.And(KcbDmucLuotkham.Columns.UsedBy).IsLessThanOrEqualTo(globalVariables.UserName)
.Execute();
//.And(KcbDmucLuotkham.Columns.Nam).IsEqualTo(globalVariables.SysDate.Year)//Tạm bỏ tránh máy client cố tình điều chỉnh khác máy server
;
if (objKcbDangkyKcb != null)//Đôi lúc người dùng không chọn phòng khám
{
objKcbDangkyKcb.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham);
objKcbDangkyKcb.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan);
id_kham = AddRegExam(objKcbDangkyKcb, objLuotkham, false, KieuKham);
}
scope.Complete();
return ActionResult.Success;
}
}
}
catch (Exception ex)
{
log.Error("loi trong qua trinh cap nhap thong tin them moi thong tin benh nhan tiep don {0}", ex);
return ActionResult.Error;
}
}
示例8: ThemmoiBenhnhanCapcuu
public ActionResult ThemmoiBenhnhanCapcuu(SysTrace mytrace, KcbDanhsachBenhnhan objKcbDanhsachBenhnhan, KcbLuotkham objLuotkham, KcbDangkySokham objSoKCB, NoitruPhanbuonggiuong objBuonggiuong, DateTime ngaychuyenkhoa, ref string Msg)
{
int v_IdBenhnhan = -1;
try
{
using (var scope = new TransactionScope())
{
using (var dbscope = new SharedDbConnectionScope())
{
objKcbDanhsachBenhnhan.IsNew = true;
objKcbDanhsachBenhnhan.Save();
KcbLichsuDoituongKcb objLichsuKcb = new KcbLichsuDoituongKcb();
objLichsuKcb.IdBenhnhan = objKcbDanhsachBenhnhan.IdBenhnhan;
objLichsuKcb.MaLuotkham = objLuotkham.MaLuotkham;
objLichsuKcb.NgayHieuluc = objLuotkham.NgayTiepdon;
objLichsuKcb.IdDoituongKcb = objLuotkham.IdDoituongKcb;
objLichsuKcb.MaDoituongKcb = objLuotkham.MaDoituongKcb;
objLichsuKcb.IdLoaidoituongKcb = objLuotkham.IdLoaidoituongKcb;
objLichsuKcb.MatheBhyt = objLuotkham.MatheBhyt;
objLichsuKcb.PtramBhyt = objLuotkham.PtramBhyt;
objLichsuKcb.PtramBhytGoc = objLuotkham.PtramBhytGoc;
objLichsuKcb.NgaybatdauBhyt = objLuotkham.NgaybatdauBhyt;
objLichsuKcb.NgayketthucBhyt = objLuotkham.NgayketthucBhyt;
objLichsuKcb.NoicapBhyt = objLuotkham.NoicapBhyt;
objLichsuKcb.MaNoicapBhyt = objLuotkham.MaNoicapBhyt;
objLichsuKcb.MaDoituongBhyt = objLuotkham.MaDoituongBhyt;
objLichsuKcb.MaQuyenloi = objLuotkham.MaQuyenloi;
objLichsuKcb.NoiDongtrusoKcbbd = objLuotkham.NoiDongtrusoKcbbd;
objLichsuKcb.MaKcbbd = objLuotkham.MaKcbbd;
objLichsuKcb.TrangthaiNoitru = 0;
objLichsuKcb.DungTuyen = objLuotkham.DungTuyen;
objLichsuKcb.Cmt = objLuotkham.Cmt;
objLichsuKcb.IdRavien = objLuotkham.IdRavien;
objLichsuKcb.IdBuong = objLuotkham.IdBuong;
objLichsuKcb.IdGiuong = objLuotkham.IdGiuong;
objLichsuKcb.IdKhoanoitru = objLuotkham.IdKhoanoitru;
objLichsuKcb.NguoiTao = globalVariables.UserName;
objLichsuKcb.NgayTao = globalVariables.SysDate;
objLichsuKcb.IsNew = true;
objLichsuKcb.Save();
//Thêm lần khám
objLuotkham.IdBenhnhan = objKcbDanhsachBenhnhan.IdBenhnhan;
objLuotkham.IdLichsuDoituongKcb = objLichsuKcb.IdLichsuDoituongKcb;
objLuotkham.SttKham = THU_VIEN_CHUNG.LaySTTKhamTheoDoituong(objLuotkham.IdDoituongKcb);
objLuotkham.NgayTao = globalVariables.SysDate;
objLuotkham.NguoiTao = globalVariables.UserName;
objLuotkham.IsNew = true;
objLuotkham.Save();
SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema)
.Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan)
.And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham);
if (sqlQueryPatientExam.GetRecordCount() > 0)
{
string patientCode = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM((byte)(objKcbDanhsachBenhnhan.KieuBenhnhan == 0 ? 0 : 1));
new Update(KcbLuotkham.Schema)
.Set(KcbLuotkham.Columns.MaLuotkham).EqualTo(patientCode)
.Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan)
.And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham).Execute();
new Update(KcbLichsuDoituongKcb.Schema)
.Set(KcbLichsuDoituongKcb.Columns.MaLuotkham).EqualTo(patientCode)
.Where(KcbLichsuDoituongKcb.Columns.IdLichsuDoituongKcb).IsEqualTo(objLichsuKcb.IdLichsuDoituongKcb).Execute();
objLuotkham.MaLuotkham = patientCode;
}
new Update(KcbDmucLuotkham.Schema)
.Set(KcbDmucLuotkham.Columns.TrangThai).EqualTo(2)
.Set(KcbDmucLuotkham.Columns.EndTime).EqualTo(DateTime.Now)
.Where(KcbDmucLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
.And(KcbDmucLuotkham.Columns.Loai).IsEqualTo((byte)(objKcbDanhsachBenhnhan.KieuBenhnhan == 0 ? 0 : 1))
.And(KcbDmucLuotkham.Columns.TrangThai).IsLessThanOrEqualTo(1)
.And(KcbDmucLuotkham.Columns.UsedBy).IsLessThanOrEqualTo(globalVariables.UserName)
.Execute();
//.And(KcbDmucLuotkham.Columns.Nam).IsEqualTo(globalVariables.SysDate.Year)//Tạm bỏ tránh máy client cố tình điều chỉnh khác máy server
;
if (objSoKCB != null)
{
//Kiểm tra xem có sổ KCB hay chưa
objSoKCB.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham);
objSoKCB.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan);
KcbDangkySokham _temp = new Select().From(KcbDangkySokham.Schema).Where(KcbDangkySokham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan)
.And(KcbDangkySokham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
.ExecuteSingle<KcbDangkySokham>();
if (_temp == null)
{
objSoKCB.NgayTao = globalVariables.SysDate;
objSoKCB.NguoiTao = globalVariables.UserName;
objSoKCB.IsNew = true;
objSoKCB.Save();
}
else
{
if (Utility.Int64Dbnull(_temp.IdThanhtoan, 0) > 0)//Ko làm gì cả
{
Msg = "Đã thu tiền sổ khám của Bệnh nhân nên không được phép xóa hoặc cập nhật lại";
//.........这里部分代码省略.........
示例9: ThemLuotDangkyKiemnghiem
public ActionResult ThemLuotDangkyKiemnghiem(SysTrace mytrace, KcbDanhsachBenhnhan objKcbDanhsachBenhnhan, KcbLuotkham objLuotkham,ref string Msg)
{
try
{
using (var scope = new TransactionScope())
{
using (var dbscope = new SharedDbConnectionScope())
{
objKcbDanhsachBenhnhan.Save();
KcbLichsuDoituongKcb objLichsuKcb = new KcbLichsuDoituongKcb();
objLichsuKcb.IdBenhnhan = objLuotkham.IdBenhnhan;
objLichsuKcb.MaLuotkham = objLuotkham.MaLuotkham;
objLichsuKcb.NgayHieuluc = objLuotkham.NgayTiepdon;
objLichsuKcb.IdDoituongKcb = objLuotkham.IdDoituongKcb;
objLichsuKcb.MaDoituongKcb = objLuotkham.MaDoituongKcb;
objLichsuKcb.IdLoaidoituongKcb = objLuotkham.IdLoaidoituongKcb;
objLichsuKcb.MatheBhyt = objLuotkham.MatheBhyt;
objLichsuKcb.PtramBhyt = objLuotkham.PtramBhyt;
objLichsuKcb.PtramBhytGoc = objLuotkham.PtramBhytGoc;
objLichsuKcb.NgaybatdauBhyt = objLuotkham.NgaybatdauBhyt;
objLichsuKcb.NgayketthucBhyt = objLuotkham.NgayketthucBhyt;
objLichsuKcb.NoicapBhyt = objLuotkham.NoicapBhyt;
objLichsuKcb.MaNoicapBhyt = objLuotkham.MaNoicapBhyt;
objLichsuKcb.MaDoituongBhyt = objLuotkham.MaDoituongBhyt;
objLichsuKcb.MaQuyenloi = objLuotkham.MaQuyenloi;
objLichsuKcb.NoiDongtrusoKcbbd = objLuotkham.NoiDongtrusoKcbbd;
objLichsuKcb.MaKcbbd = objLuotkham.MaKcbbd;
objLichsuKcb.TrangthaiNoitru = 0;
objLichsuKcb.DungTuyen = objLuotkham.DungTuyen;
objLichsuKcb.Cmt = objLuotkham.Cmt;
objLichsuKcb.IdRavien = -1;
objLichsuKcb.IdBuong = -1;
objLichsuKcb.IdGiuong = -1;
objLichsuKcb.IdKhoanoitru = -1;
objLichsuKcb.NguoiTao = globalVariables.UserName;
objLichsuKcb.NgayTao = globalVariables.SysDate;
objLichsuKcb.IsNew = true;
objLichsuKcb.Save();
SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema)
.Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan)
.And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham);
if (sqlQueryPatientExam.GetRecordCount() > 0)//Nếu BN khác đã lấy mã này
{
objLuotkham.MaLuotkham = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM((byte)(objKcbDanhsachBenhnhan.KieuBenhnhan == 0 ? 0 : 1));
new Update(KcbLichsuDoituongKcb.Schema)
.Set(KcbLichsuDoituongKcb.Columns.MaLuotkham).EqualTo(objLuotkham.MaLuotkham)
.Where(KcbLichsuDoituongKcb.Columns.IdLichsuDoituongKcb).IsEqualTo(objLichsuKcb.IdLichsuDoituongKcb).Execute();
}
objLuotkham.IdLichsuDoituongKcb = objLichsuKcb.IdLichsuDoituongKcb;
objLuotkham.IsNew = true;
objLuotkham.Save();
new Update(KcbDmucLuotkham.Schema)
.Set(KcbDmucLuotkham.Columns.TrangThai).EqualTo(2)
.Set(KcbDmucLuotkham.Columns.EndTime).EqualTo(DateTime.Now)
.Where(KcbDmucLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
.And(KcbDmucLuotkham.Columns.Loai).IsEqualTo((byte)(objKcbDanhsachBenhnhan.KieuBenhnhan == 0 ? 0 : 1))
.And(KcbDmucLuotkham.Columns.TrangThai).IsLessThanOrEqualTo(1)
.And(KcbDmucLuotkham.Columns.Nam).IsEqualTo(globalVariables.SysDate.Year)
.And(KcbDmucLuotkham.Columns.UsedBy).IsLessThanOrEqualTo(globalVariables.UserName)
.Execute();
mytrace.Desc = string.Format("Thêm mới lượt khám ID={0}, Code={1}, Name={2}", objKcbDanhsachBenhnhan.IdBenhnhan.ToString(), objLuotkham.MaLuotkham, objKcbDanhsachBenhnhan.TenBenhnhan);
mytrace.Lot = 0;
mytrace.IsNew = true;
mytrace.Save();
scope.Complete();
return ActionResult.Success;
}
}
}
catch (Exception ex)
{
return ActionResult.Error;
}
}
示例10: UpdateLanKham
public ActionResult UpdateLanKham(SysTrace mytrace, KcbDanhsachBenhnhan objKcbDanhsachBenhnhan, KcbLuotkham objLuotkham, KcbDangkyKcb objKcbDangkyKcb, KcbDangkySokham objSoKCB, int KieuKham, decimal PtramBhytCu, decimal PtramBhytgoc, ref string Msg)
{
ActionResult _ActionResult = ActionResult.Success;
try
{
using (var scope = new TransactionScope())
{
using (var dbscope = new SharedDbConnectionScope())
{
UpdatePatientInfo(objKcbDanhsachBenhnhan);
long IdLichsuDoituongKcb = KcbLayIdDoituongKCBHientai(objLuotkham.IdBenhnhan, objLuotkham.MaLuotkham);
KcbLichsuDoituongKcb objLichsuKcb = null;
if (IdLichsuDoituongKcb > 0)
{
objLichsuKcb = KcbLichsuDoituongKcb.FetchByID(IdLichsuDoituongKcb);
objLichsuKcb.MarkOld();
objLichsuKcb.IsNew = false;
}
else
{
objLichsuKcb = new KcbLichsuDoituongKcb();
objLichsuKcb.IsNew = true;
}
if (objLichsuKcb == null)
{
Msg = "NULL-->Không lấy được thông tin lịch sử đối tượng KCB của Bệnh nhân";
return ActionResult.Error;
}
objLichsuKcb.IdBenhnhan = objLuotkham.IdBenhnhan;
objLichsuKcb.MaLuotkham = objLuotkham.MaLuotkham;
objLichsuKcb.NgayHieuluc = objLuotkham.NgayTiepdon;
objLichsuKcb.IdDoituongKcb = objLuotkham.IdDoituongKcb;
objLichsuKcb.MaDoituongKcb = objLuotkham.MaDoituongKcb;
objLichsuKcb.IdLoaidoituongKcb = objLuotkham.IdLoaidoituongKcb;
objLichsuKcb.MatheBhyt = objLuotkham.MatheBhyt;
objLichsuKcb.PtramBhyt = objLuotkham.PtramBhyt;
objLichsuKcb.PtramBhytGoc = objLuotkham.PtramBhytGoc;
objLichsuKcb.NgaybatdauBhyt = objLuotkham.NgaybatdauBhyt;
objLichsuKcb.NgayketthucBhyt = objLuotkham.NgayketthucBhyt;
objLichsuKcb.NoicapBhyt = objLuotkham.NoicapBhyt;
objLichsuKcb.MaNoicapBhyt = objLuotkham.MaNoicapBhyt;
objLichsuKcb.MaDoituongBhyt = objLuotkham.MaDoituongBhyt;
objLichsuKcb.MaQuyenloi = objLuotkham.MaQuyenloi;
objLichsuKcb.NoiDongtrusoKcbbd = objLuotkham.NoiDongtrusoKcbbd;
objLichsuKcb.MaKcbbd = objLuotkham.MaKcbbd;
objLichsuKcb.TrangthaiNoitru = 0;
objLichsuKcb.DungTuyen = objLuotkham.DungTuyen;
objLichsuKcb.Cmt = objLuotkham.Cmt;
objLichsuKcb.IdRavien = -1;
objLichsuKcb.IdBuong = -1;
objLichsuKcb.IdGiuong = -1;
objLichsuKcb.IdKhoanoitru = -1;
objLichsuKcb.NguoiTao = globalVariables.UserName;
objLichsuKcb.NgayTao = globalVariables.SysDate;
objLichsuKcb.Save();
objLuotkham.IdLichsuDoituongKcb = objLichsuKcb.IdLichsuDoituongKcb;
objLuotkham.MarkOld();
objLuotkham.IsNew = false;
objLuotkham.Save();
if (objSoKCB != null)
{
//Kiểm tra xem có sổ KCB hay chưa
objSoKCB.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham);
objSoKCB.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan);
KcbDangkySokham _temp = new Select().From(KcbDangkySokham.Schema).Where(KcbDangkySokham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan)
.And(KcbDangkySokham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
.ExecuteSingle<KcbDangkySokham>();
if (_temp == null)
{
objSoKCB.IdLichsuDoituongKcb = objLichsuKcb.IdLichsuDoituongKcb;
objSoKCB.NgayTao = globalVariables.SysDate;
objSoKCB.NguoiTao = globalVariables.UserName;
objSoKCB.IsNew = true;
objSoKCB.Save();
}
else
{
if (Utility.Int64Dbnull(_temp.IdThanhtoan, 0) > 0)//Ko làm gì cả
{
Msg = "Đã thu tiền sổ khám của Bệnh nhân nên không được phép xóa hoặc cập nhật lại";
}
else//Update lại sổ KCB
{
_temp.DonGia = objSoKCB.DonGia;
_temp.BnhanChitra = objSoKCB.BnhanChitra;
_temp.BhytChitra = objSoKCB.BhytChitra;
_temp.PtramBhyt = objSoKCB.PtramBhyt;
_temp.PtramBhytGoc = objSoKCB.PtramBhytGoc;
_temp.PhuThu = objSoKCB.PhuThu;
_temp.TuTuc = objSoKCB.TuTuc;
_temp.NguonThanhtoan = objSoKCB.NguonThanhtoan;
_temp.IdLoaidoituongkcb = objSoKCB.IdLoaidoituongkcb;
_temp.IdDoituongkcb = objSoKCB.IdDoituongkcb;
_temp.MaDoituongkcb = objSoKCB.MaDoituongkcb;
_temp.IdLichsuDoituongKcb = objLichsuKcb.IdLichsuDoituongKcb;
_temp.Noitru = objSoKCB.Noitru;
//.........这里部分代码省略.........
示例11: CapnhatDangkymauKiemnghiem
public ActionResult CapnhatDangkymauKiemnghiem(SysTrace mytrace, KcbDanhsachBenhnhan objKcbDanhsachBenhnhan, KcbLuotkham objLuotkham, ref string Msg)
{
ActionResult _ActionResult = ActionResult.Success;
try
{
using (var scope = new TransactionScope())
{
using (var dbscope = new SharedDbConnectionScope())
{
objKcbDanhsachBenhnhan.Save();
objLuotkham.MarkOld();
objLuotkham.IsNew = false;
objLuotkham.Save();
mytrace.Desc = string.Format("Cập nhật Bệnh nhân ID={0}, Code={1}, Name={2}", objKcbDanhsachBenhnhan.IdBenhnhan.ToString(), objLuotkham.MaLuotkham, objKcbDanhsachBenhnhan.TenBenhnhan);
mytrace.Lot = 0;
mytrace.IsNew = true;
mytrace.Save();
scope.Complete();
return ActionResult.Success;
}
}
}
catch (Exception ex)
{
log.Error("Loi trong qua trinh update thong tin benh nhan {0}", ex);
return ActionResult.Error;
}
}
示例12: ThemmoiLuotkham
public ActionResult ThemmoiLuotkham(SysTrace mytrace, KcbDanhsachBenhnhan objKcbDanhsachBenhnhan, KcbLuotkham objLuotkham, KcbDangkyKcb objKcbDangkyKcb, KcbDangkySokham objSoKCB, int KieuKham, ref long id_kham, ref string Msg)
{
try
{
using (var scope = new TransactionScope())
{
using (var dbscope = new SharedDbConnectionScope())
{
UpdatePatientInfo(objKcbDanhsachBenhnhan);
KcbLichsuDoituongKcb objLichsuKcb = new KcbLichsuDoituongKcb();
objLichsuKcb.IdBenhnhan = objLuotkham.IdBenhnhan;
objLichsuKcb.MaLuotkham = objLuotkham.MaLuotkham;
objLichsuKcb.NgayHieuluc = objLuotkham.NgayTiepdon;
objLichsuKcb.IdDoituongKcb = objLuotkham.IdDoituongKcb;
objLichsuKcb.MaDoituongKcb = objLuotkham.MaDoituongKcb;
objLichsuKcb.IdLoaidoituongKcb = objLuotkham.IdLoaidoituongKcb;
objLichsuKcb.MatheBhyt = objLuotkham.MatheBhyt;
objLichsuKcb.PtramBhyt = objLuotkham.PtramBhyt;
objLichsuKcb.PtramBhytGoc = objLuotkham.PtramBhytGoc;
objLichsuKcb.NgaybatdauBhyt = objLuotkham.NgaybatdauBhyt;
objLichsuKcb.NgayketthucBhyt = objLuotkham.NgayketthucBhyt;
objLichsuKcb.NoicapBhyt = objLuotkham.NoicapBhyt;
objLichsuKcb.MaNoicapBhyt = objLuotkham.MaNoicapBhyt;
objLichsuKcb.MaDoituongBhyt = objLuotkham.MaDoituongBhyt;
objLichsuKcb.MaQuyenloi = objLuotkham.MaQuyenloi;
objLichsuKcb.NoiDongtrusoKcbbd = objLuotkham.NoiDongtrusoKcbbd;
objLichsuKcb.MaKcbbd = objLuotkham.MaKcbbd;
objLichsuKcb.TrangthaiNoitru = 0;
objLichsuKcb.DungTuyen = objLuotkham.DungTuyen;
objLichsuKcb.Cmt = objLuotkham.Cmt;
objLichsuKcb.IdRavien = -1;
objLichsuKcb.IdBuong = -1;
objLichsuKcb.IdGiuong = -1;
objLichsuKcb.IdKhoanoitru = -1;
objLichsuKcb.NguoiTao = globalVariables.UserName;
objLichsuKcb.NgayTao = globalVariables.SysDate;
objLichsuKcb.IsNew = true;
objLichsuKcb.Save();
SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema)
.Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan)
.And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham);
if (sqlQueryPatientExam.GetRecordCount() > 0)//Nếu BN khác đã lấy mã này
{
objLuotkham.MaLuotkham = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM((byte)(objKcbDanhsachBenhnhan.KieuBenhnhan == 0 ? 0 : 1));
new Update(KcbLichsuDoituongKcb.Schema)
.Set(KcbLichsuDoituongKcb.Columns.MaLuotkham).EqualTo(objLuotkham.MaLuotkham)
.Where(KcbLichsuDoituongKcb.Columns.IdLichsuDoituongKcb).IsEqualTo(objLichsuKcb.IdLichsuDoituongKcb).Execute();
}
objLuotkham.IdLichsuDoituongKcb = objLichsuKcb.IdLichsuDoituongKcb;
objLuotkham.IsNew = true;
objLuotkham.Save();
new Update(KcbDmucLuotkham.Schema)
.Set(KcbDmucLuotkham.Columns.TrangThai).EqualTo(2)
.Set(KcbDmucLuotkham.Columns.EndTime).EqualTo(DateTime.Now)
.Where(KcbDmucLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
.And(KcbDmucLuotkham.Columns.Loai).IsEqualTo((byte)(objKcbDanhsachBenhnhan.KieuBenhnhan == 0 ? 0 : 1))
.And(KcbDmucLuotkham.Columns.TrangThai).IsLessThanOrEqualTo(1)
.And(KcbDmucLuotkham.Columns.Nam).IsEqualTo(globalVariables.SysDate.Year)
.And(KcbDmucLuotkham.Columns.UsedBy).IsLessThanOrEqualTo(globalVariables.UserName)
.Execute();
;
if (objSoKCB != null)
{
//Kiểm tra xem có sổ KCB hay chưa
objSoKCB.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham);
objSoKCB.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan);
KcbDangkySokham _temp = new Select().From(KcbDangkySokham.Schema).Where(KcbDangkySokham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan)
.And(KcbDangkySokham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
.ExecuteSingle<KcbDangkySokham>();
if (_temp == null)
{
objSoKCB.IdLichsuDoituongKcb = objLichsuKcb.IdLichsuDoituongKcb;
objSoKCB.NgayTao = globalVariables.SysDate;
objSoKCB.NguoiTao = globalVariables.UserName;
objSoKCB.IsNew = true;
objSoKCB.Save();
}
else
{
if (Utility.Int64Dbnull(_temp.IdThanhtoan, 0) > 0)//Ko làm gì cả
{
Msg = "Đã thu tiền sổ khám của Bệnh nhân nên không được phép xóa hoặc cập nhật lại";
}
else//Update lại sổ KCB
{
_temp.DonGia = objSoKCB.DonGia;
_temp.BnhanChitra = objSoKCB.BnhanChitra;
_temp.BhytChitra = objSoKCB.BhytChitra;
_temp.PtramBhyt = objSoKCB.PtramBhyt;
_temp.PtramBhytGoc = objSoKCB.PtramBhytGoc;
_temp.PhuThu = objSoKCB.PhuThu;
_temp.TuTuc = objSoKCB.TuTuc;
//.........这里部分代码省略.........