Example #1
0
 private byte[] ComputeAuthenticodeSigHash(byte[] buffer, HashAlgorithm hash)
 {
     if (0L == this.sdIndex.ContentInfo)
     {
         ArgumentException argumentException = new ArgumentException("Invalid Buffer:  Couldn't find ContentInfo");
         SysTrace._WriteEvent(12583660U);
         throw argumentException;
     }
     if (0L == this.sdIndex.AuthAttributes)
     {
         hash.Initialize();
         hash.TransformBlock(buffer, (int)this.sdIndex.ContentData, (int)this.sdIndex.ContentLen, buffer, (int)this.sdIndex.ContentData);
         hash.TransformFinalBlock(buffer, 0, 0);
     }
     else
     {
         byte[] buffer1 = new byte[this.sdIndex.AuthAttributesLen];
         Buffer.BlockCopy((Array)buffer, (int)this.sdIndex.AuthAttributes, (Array)buffer1, 0, buffer1.Length);
         buffer1[0] = (byte)49;
         byte[] buffer2 = new byte[this.sdIndex.ContentLen];
         Buffer.BlockCopy((Array)buffer, (int)this.sdIndex.ContentData, (Array)buffer2, 0, buffer2.Length);
         hash.Initialize();
         hash.ComputeHash(buffer2);
         hash.Initialize();
         hash.ComputeHash(buffer1);
     }
     return(hash.Hash);
 }
Example #2
0
 /// <summary>
 /// 处理全局快捷键
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public static void AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args)
 {
     if ((args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown || args.EventType == CoreAcceleratorKeyEventType.KeyDown) &&
         (Window.Current.CoreWindow.GetKeyState(VirtualKey.Menu) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down &&
         args.VirtualKey == VirtualKey.Right)
     {
         // Alt + → 系统监控
         args.Handled = true;
         SysTrace.ShowBox();
     }
 }
Example #3
0
 /// <summary>
 /// Thiết lập các giá trị mặc định cho class
 /// </summary>
 public void InitTrace()
 {
     //Lấy về tên DLL. ManifestModule.Name ban đầu có dạng "DLLName.dll"-->Ta chỉ lấy phần "DLLName"
     AssName = this.GetType().Assembly.ManifestModule.Name;// System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name;
     //Tạo Trace cho chức năng này
     myTrace = new SysTrace()
     {
         BranchID      = globalVariables.Branch_ID,
         UserName      = globalVariables.UserName,
         CreatedDate   = System.DateTime.Now, IpAddress = Utility.GetIPAddress(), DLLName = AssName.Split('.')[0],
         SubSystemName = globalVariables.SubSystemName, FunctionID = globalVariables.FunctionID, FunctionName = globalVariables.FunctionName, ComputerName = Utility.GetComputerName(), AccountName = Utility.GetAccountName()
     };
 }
Example #4
0
 void ShowMenu(Point p_pos)
 {
     if (_menu == null)
     {
         _menu = new Menu {
             IsContextMenu = true
         };
         var item = new Mi {
             ID = "系统监控"
         };
         item.Click += (s, a) => SysTrace.ShowBox();
         _menu.Items.Add(item);
     }
     _ = _menu.OpenContextMenu(p_pos);
 }
Example #5
0
        /// <summary>
        /// Phone模式附加标题右键菜单
        /// </summary>
        /// <param name="p_elem">标题元素</param>
        /// <param name="p_win">所属窗口</param>
        public static void OnPhoneTitleTapped(FrameworkElement p_elem, Win p_win)
        {
            if (p_elem == null || p_win == null)
            {
                return;
            }

            p_elem.RightTapped += (s, e) =>
            {
                if (_menu == null)
                {
                    _menu = new Menu {
                        IsContextMenu = true, Placement = MenuPosition.BottomLeft
                    };
                    var item = new Mi {
                        ID = "取消自启动"
                    };
                    item.Click += (o, a) => Startup.DelAutoStart();
                    _menu.Items.Add(item);

                    item = new Mi {
                        ID = "设置自启动"
                    };
                    item.Click += SetAutoStart;
                    _menu.Items.Add(item);

                    item = new Mi {
                        ID = "系统监视"
                    };
                    item.Click += (o, a) => SysTrace.ShowBox();
                    _menu.Items.Add(item);
                }

                var autoStart = AtState.GetAutoStart();
                if (autoStart != null &&
                    autoStart.WinType == p_win.GetType().AssemblyQualifiedName &&
                    (p_win.Params == null || autoStart.Params == JsonSerializer.Serialize(p_win.Params, JsonOptions.UnsafeSerializer)))
                {
                    _menu.Items[0].Visibility = Visibility.Visible;
                    _menu.Items[1].Visibility = Visibility.Collapsed;
                }
                else
                {
                    _menu.Items[0].Visibility = Visibility.Collapsed;
                    _menu.Items[1].Visibility = Visibility.Visible;
                    _currentWin = p_win;
                }
                _ = _menu.OpenContextMenu(default, p_elem);
Example #6
0
 /// <summary>
 /// 显示监视窗口
 /// </summary>
 public void ShowTraceBox()
 {
     SysTrace.ShowBox();
 }
Example #7
0
 public SysTraceDemo()
 {
     InitializeComponent();
     _fv.FirstLoaded(() => SysTrace.ShowBox());
 }
Example #8
0
        public void Update(long Id,string BranchID,string UserName,DateTime CreatedDate,string IpAddress,string ComputerName,string AccountName,string DLLName,string SubSystemName,int FunctionID,string FunctionName,string TableName,string Desc,short Lot)
        {
            SysTrace item = new SysTrace();
            item.MarkOld();
            item.IsLoaded = true;

            item.Id = Id;

            item.BranchID = BranchID;

            item.UserName = UserName;

            item.CreatedDate = CreatedDate;

            item.IpAddress = IpAddress;

            item.ComputerName = ComputerName;

            item.AccountName = AccountName;

            item.DLLName = DLLName;

            item.SubSystemName = SubSystemName;

            item.FunctionID = FunctionID;

            item.FunctionName = FunctionName;

            item.TableName = TableName;

            item.Desc = Desc;

            item.Lot = Lot;

            item.Save(UserName);
        }
Example #9
0
        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";
                                }
                                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.Noitru = objSoKCB.Noitru;
                                    _temp.IdGoi = objSoKCB.IdGoi;
                                    _temp.TrongGoi = objSoKCB.TrongGoi;
                                    _temp.IdNhanvien = objSoKCB.IdNhanvien;
                                    _temp.NgaySua = globalVariables.SysDate;
                                    _temp.NguoiSua = globalVariables.UserName;
                                    _temp.IsNew = false;
                                    _temp.MarkOld();
                                    _temp.Save();
                                }
                            }
                        }
                        else
                        {
                            new Delete().From(KcbDangkySokham.Schema).Where(KcbDangkySokham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan)
                                                           .And(KcbDangkySokham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
                                                           .And(KcbDangkySokham.Columns.TrangthaiThanhtoan).IsEqualTo(0)
                                                           .Execute();
                        }
                        //Nhập viện
                        if (objBuonggiuong != null)
                        {
                            objBuonggiuong.IdBenhnhan = objLuotkham.IdBenhnhan;
                            objBuonggiuong.MaLuotkham = objLuotkham.MaLuotkham;
                            noitru_nhapvien.NhapvienCapcuu(objBuonggiuong, objLuotkham);
                            //Chuyển vào buồng giường
                            if (Utility.Int16Dbnull(objBuonggiuong.IdBuong) > -1 && Utility.Int16Dbnull(objBuonggiuong.IdGiuong) > -1)
                                noitru_nhapvien.PhanGiuongDieuTriCapcuu(objBuonggiuong, objLuotkham, ngaychuyenkhoa, Utility.Int16Dbnull(objBuonggiuong.IdBuong), Utility.Int16Dbnull(objBuonggiuong.IdGiuong));

                            objLuotkham.IdKhoanoitru = objBuonggiuong.IdKhoanoitru;
                            objLuotkham.IdBuong = objBuonggiuong.IdBuong;
                            objLuotkham.IdGiuong = objBuonggiuong.IdGiuong;
                            objLuotkham.IdRavien = objBuonggiuong.Id;
                            objLuotkham.IdNhapvien = objBuonggiuong.Id;
                        }
                        mytrace.Desc = string.Format("Thêm mới Bệnh nhân cấp cứu 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;
            }
        }
Example #10
0
        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;
            }
        }
Example #11
0
        public ActionResult PerformActionDeletePatientExam(SysTrace mytrace, string v_MaLuotkham, int v_Patient_ID, ref string ErrMsg)
        {
            int record = -1;
            try
            {
                using (var scope = new TransactionScope())
                {
                    using (var db = new SharedDbConnectionScope())
                    {
                        KcbChidinhclCollection objAssignInfo =
                            new KcbChidinhclController().FetchByQuery(
                                KcbChidinhcl.CreateQuery().AddWhere(KcbChidinhcl.Columns.MaLuotkham, Comparison.Equals,
                                                                   v_MaLuotkham));
                        if (objAssignInfo.Count > 0)
                        {
                            ErrMsg = "Bệnh nhân đã được chỉ định cận lâm sàng nên bạn không thể xóa thông tin. Đề nghị hủy các phiếu chỉ định CLS trước khi xóa";
                            return ActionResult.Exception;
                        }
                        KcbDonthuocCollection prescriptionCollection =
                            new KcbDonthuocController().FetchByQuery(
                                KcbDonthuoc.CreateQuery().AddWhere(KcbDonthuoc.Columns.MaLuotkham,
                                                                     Comparison.Equals, v_MaLuotkham));
                        if (prescriptionCollection.Count > 0)
                        {
                            ErrMsg = "Bệnh nhân đã được kê đơn thuốc nên bạn không thể xóa thông tin. Đề nghị hủy các đơn thuốc trước khi xóa";
                            return ActionResult.Exception;
                        }

                        NoitruTamungCollection LstNoitruTamung =
                           new NoitruTamungController().FetchByQuery(
                               NoitruTamung.CreateQuery().AddWhere(NoitruTamung.Columns.MaLuotkham,
                                                                    Comparison.Equals, v_MaLuotkham));
                        if (LstNoitruTamung.Count > 0)
                        {
                            ErrMsg = "Bệnh nhân đã nộp tiền tạm ứng nên bạn không thể xóa thông tin. Đề nghị hủy thông tin tạm ứng trước khi xóa";
                            return ActionResult.Exception;
                        }
                        // XÓA chi định tự động
                        new Delete().From(KcbChidinhcl.Schema).Where(KcbChidinhcl.Columns.MaLuotkham).IsEqualTo(
                            v_MaLuotkham)
                            .And(KcbChidinhcl.Columns.IdBenhnhan).IsEqualTo(v_Patient_ID).Execute();

                        //XÓA THÔNG TIN ĐĂNG KÝ KHÁM
                        new Delete().From(KcbDangkyKcb.Schema).Where(KcbDangkyKcb.Columns.MaLuotkham).IsEqualTo(v_MaLuotkham)
                            .And(KcbDangkyKcb.Columns.IdBenhnhan).IsEqualTo(v_Patient_ID)
                            .Execute();

                        //XÓA THÔNG TIN ĐĂNG KÝ KHÁM
                        new Delete().From(KcbDangkySokham.Schema).Where(KcbDangkySokham.Columns.MaLuotkham).IsEqualTo(v_MaLuotkham)
                            .And(KcbDangkySokham.Columns.IdBenhnhan).IsEqualTo(v_Patient_ID)
                            .Execute();

                        //XÓA THÔNG TIN ĐĂNG KÝ KHÁM
                        new Delete().From(KcbLichsuDoituongKcb.Schema).Where(KcbLichsuDoituongKcb.Columns.MaLuotkham).IsEqualTo(v_MaLuotkham)
                            .And(KcbLichsuDoituongKcb.Columns.IdBenhnhan).IsEqualTo(v_Patient_ID)
                            .Execute();

                        new Delete().From(NoitruPhanbuonggiuong.Schema).Where(NoitruPhanbuonggiuong.Columns.MaLuotkham).IsEqualTo(v_MaLuotkham)
                            .And(NoitruPhanbuonggiuong.Columns.IdBenhnhan).IsEqualTo(v_Patient_ID)
                            //.And(NoitruPhanbuonggiuong.Columns.NoiTru).IsEqualTo(0)
                           .Execute();

                        new Delete().From(NoitruPhieudieutri.Schema).Where(NoitruPhieudieutri.Columns.MaLuotkham).IsEqualTo(v_MaLuotkham)
                           .And(NoitruPhieudieutri.Columns.IdBenhnhan).IsEqualTo(v_Patient_ID)
                          .Execute();

                        new Delete().From(NoitruTamung.Schema).Where(NoitruTamung.Columns.MaLuotkham).IsEqualTo(v_MaLuotkham)
                            .And(NoitruTamung.Columns.IdBenhnhan).IsEqualTo(v_Patient_ID)
                           .Execute();
                        //LẤY VỀ CÁC THÔNG TIN LẦN KHÁM CỦA BỆNH NHÂN
                        KcbLuotkhamCollection tPatientExamCollection =
                            new KcbLuotkhamController().FetchByQuery(
                                KcbLuotkham.CreateQuery().AddWhere(KcbLuotkham.Columns.IdBenhnhan, Comparison.Equals,
                                                                    v_Patient_ID));

                        //XÓA LẦN ĐĂNG KÝ KHÁM CỦA BỆNH NHÂN
                        new Delete().From(KcbLuotkham.Schema).Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(
                            v_MaLuotkham).Execute();
                        if (THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_SUDUNGLAI_MALUOTKHAM_DAXOA", "0", false) == "1")
                        {
                            KcbDanhsachBenhnhan objBN = KcbDanhsachBenhnhan.FetchByID(v_Patient_ID);
                            //Cập nhật lại mã lượt khám để có thể dùng cho bệnh nhân khác
                            new Update(KcbDmucLuotkham.Schema)
                                      .Set(KcbDmucLuotkham.Columns.TrangThai).EqualTo(0)
                                      .Set(KcbDmucLuotkham.Columns.UsedBy).EqualTo(DBNull.Value)
                                      .Set(KcbDmucLuotkham.Columns.StartTime).EqualTo(DBNull.Value)
                                      .Set(KcbDmucLuotkham.Columns.EndTime).EqualTo(null)
                                      .Where(KcbDmucLuotkham.Columns.MaLuotkham).IsEqualTo(v_MaLuotkham)
                                      .And(KcbDmucLuotkham.Columns.Loai).IsEqualTo((byte)(objBN.KieuBenhnhan == 0 ? 0 : 1))
                                      .And(KcbDmucLuotkham.Columns.TrangThai).IsEqualTo(2)
                                      .Execute();
                            ;
                        }
                        //KIỂM TRA NẾU BỆNH NHÂN CÓ >1 LẦN KHÁM THÌ CHỈ XÓA LẦN ĐĂNG KÝ ĐANG CHỌN. NẾU <= 1 LẦN KHÁM THÌ XÓA LUÔN THÔNG TIN BỆNH NHÂN
                        if (tPatientExamCollection.Count < 2)
                        {
                            new Delete().From(KcbDanhsachBenhnhan.Schema).Where(KcbDanhsachBenhnhan.Columns.IdBenhnhan).IsEqualTo(
                               v_Patient_ID).Execute();
                        }
                        mytrace.Desc = string.Format("Xóa Bệnh nhân ID={0}, Code={1}, Name={2}", v_Patient_ID.ToString(), v_MaLuotkham, v_MaLuotkham);
                        mytrace.Lot = 0;
                        mytrace.IsNew = true;
                        mytrace.Save();
                    }
                    scope.Complete();
                    return ActionResult.Success;

                }
            }
            catch (Exception ex)
            {
                return ActionResult.Error;
            }
        }
Example #12
0
        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;
                                    _temp.IdGoi = objSoKCB.IdGoi;
                                    _temp.TrongGoi = objSoKCB.TrongGoi;
                                    _temp.IdNhanvien = objSoKCB.IdNhanvien;
                                    _temp.NgaySua = globalVariables.SysDate;
                                    _temp.NguoiSua = globalVariables.UserName;
                                    _temp.IsNew = false;
                                    _temp.MarkOld();
                                    _temp.Save();
                                }
                            }
                        }
                        else
                        {
                            new Delete().From(KcbDangkySokham.Schema).Where(KcbDangkySokham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan)
                                                           .And(KcbDangkySokham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
                                                           .And(KcbDangkySokham.Columns.TrangthaiThanhtoan).IsEqualTo(0)
                                                           .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 (objKcbDangkyKcb != null)
                        {
                            objKcbDangkyKcb.IdLichsuDoituongKcb = objLichsuKcb.IdLichsuDoituongKcb;
                            objKcbDangkyKcb.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham);
                            objKcbDangkyKcb.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan);
                            AddRegExam(objKcbDangkyKcb, objLuotkham, false, KieuKham);
                        }
                        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;
            }
        }
Example #13
0
        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;
            }
        }
Example #14
0
        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;
                                   _temp.NguonThanhtoan = objSoKCB.NguonThanhtoan;
                                   _temp.IdLoaidoituongkcb = objSoKCB.IdLoaidoituongkcb;
                                   _temp.IdDoituongkcb = objSoKCB.IdDoituongkcb;
                                   _temp.MaDoituongkcb = objSoKCB.MaDoituongkcb;
                                   _temp.IdLichsuDoituongKcb = objLichsuKcb.IdLichsuDoituongKcb;
                                   _temp.Noitru = objSoKCB.Noitru;
                                   _temp.IdGoi = objSoKCB.IdGoi;
                                   _temp.TrongGoi = objSoKCB.TrongGoi;
                                   _temp.IdNhanvien = objSoKCB.IdNhanvien;
                                   _temp.NgaySua = globalVariables.SysDate;
                                   _temp.NguoiSua = globalVariables.UserName;
                                   _temp.IsNew = false;
                                   _temp.MarkOld();
                                   _temp.Save();
                               }
                           }
                       }
                       else
                       {
                           new Delete().From(KcbDangkySokham.Schema).Where(KcbDangkySokham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan)
                                                          .And(KcbDangkySokham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
                                                          .And(KcbDangkySokham.Columns.TrangthaiThanhtoan).IsEqualTo(0)
                                                          .Execute();
                       }
                        if (objKcbDangkyKcb != null)
                        {
                            objKcbDangkyKcb.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham);
                            objKcbDangkyKcb.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan);
                            objKcbDangkyKcb.IdLichsuDoituongKcb = objLichsuKcb.IdLichsuDoituongKcb;
                           id_kham= AddRegExam(objKcbDangkyKcb,objLuotkham, false, KieuKham);
                        }
                        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;
            }
        }