コード例 #1
0
        public ActionResult ThemDonThuoc(KcbDanhsachBenhnhan objBenhnhan, KcbDonthuoc objDonthuoc, KcbDonthuocChitiet[] arrDonthuocChitiet, ref int p_intIdDonthuoc, ref Dictionary <long, long> lstChitietDonthuoc)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (SharedDbConnectionScope sh = new SharedDbConnectionScope())
                    {
                        objBenhnhan.Save();
                        if (objBenhnhan != null)
                        {
                            if (objDonthuoc.NgayKedon <= Convert.ToDateTime("01/01/1900"))
                            {
                                objDonthuoc.NgayKedon = globalVariables.SysDate;
                            }
                            objDonthuoc.IdBenhnhan  = objBenhnhan.IdBenhnhan;
                            objDonthuoc.MaLuotkham  = "";
                            objDonthuoc.IdKham      = -1;
                            objDonthuoc.IsNew       = true;
                            objDonthuoc.TenDonthuoc = "";

                            objDonthuoc.Save();
                            p_intIdDonthuoc = objDonthuoc.IdDonthuoc;
                            decimal PtramBH = 0;

                            foreach (KcbDonthuocChitiet objDonthuocChitiet in arrDonthuocChitiet)
                            {
                                objDonthuocChitiet.IdKham     = objDonthuoc.IdKham;
                                objDonthuocChitiet.MaLuotkham = objDonthuoc.MaLuotkham;
                                objDonthuocChitiet.IdBenhnhan = objDonthuoc.IdBenhnhan;
                                objDonthuocChitiet.IdDonthuoc = objDonthuoc.IdDonthuoc;
                                objDonthuocChitiet.IsNew      = true;
                                objDonthuocChitiet.Save();
                                if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value))
                                {
                                    lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc);
                                }
                            }
                        }
                    }
                    scope.Complete();
                    return(ActionResult.Success);
                }
            }
            catch (Exception exception)
            {
                Utility.CatchException(exception);
                log.Error("Loi trong qua trinh luu don thuoc {0}", exception);
                return(ActionResult.Error);
            }
        }
コード例 #2
0
        public void Insert(string TenBenhnhan,string DiaChi,string MaTinhThanhpho,string MaQuanhuyen,DateTime? NgaySinh,short? NamSinh,byte? IdGioitinh,string GioiTinh,string NgheNghiep,string CoQuan,string Cmt,short? MaQuocgia,string DienThoai,string NguoiLienhe,string DienthoaiLienhe,string DiachiLienhe,string Fax,string Email,DateTime NgayTiepdon,string NguoiTiepdon,string DanToc,string TonGiao,DateTime? NgaySua,DateTime? NgayTao,string NguoiSua,string NguoiTao,string DiachiBhyt,string NguonGoc,byte? KieuBenhnhan,byte? MacDinh,string SoTiemchungQg,string IpMaytao,string IpMaysua,string TenMaytao,string TenMaysua,string LastActionName)
        {
            KcbDanhsachBenhnhan item = new KcbDanhsachBenhnhan();

            item.TenBenhnhan = TenBenhnhan;

            item.DiaChi = DiaChi;

            item.MaTinhThanhpho = MaTinhThanhpho;

            item.MaQuanhuyen = MaQuanhuyen;

            item.NgaySinh = NgaySinh;

            item.NamSinh = NamSinh;

            item.IdGioitinh = IdGioitinh;

            item.GioiTinh = GioiTinh;

            item.NgheNghiep = NgheNghiep;

            item.CoQuan = CoQuan;

            item.Cmt = Cmt;

            item.MaQuocgia = MaQuocgia;

            item.DienThoai = DienThoai;

            item.NguoiLienhe = NguoiLienhe;

            item.DienthoaiLienhe = DienthoaiLienhe;

            item.DiachiLienhe = DiachiLienhe;

            item.Fax = Fax;

            item.Email = Email;

            item.NgayTiepdon = NgayTiepdon;

            item.NguoiTiepdon = NguoiTiepdon;

            item.DanToc = DanToc;

            item.TonGiao = TonGiao;

            item.NgaySua = NgaySua;

            item.NgayTao = NgayTao;

            item.NguoiSua = NguoiSua;

            item.NguoiTao = NguoiTao;

            item.DiachiBhyt = DiachiBhyt;

            item.NguonGoc = NguonGoc;

            item.KieuBenhnhan = KieuBenhnhan;

            item.MacDinh = MacDinh;

            item.SoTiemchungQg = SoTiemchungQg;

            item.IpMaytao = IpMaytao;

            item.IpMaysua = IpMaysua;

            item.TenMaytao = TenMaytao;

            item.TenMaysua = TenMaysua;

            item.LastActionName = LastActionName;

            item.Save(UserName);
        }
コード例 #3
0
ファイル: KCB_DANGKY.cs プロジェクト: khaha2210/VXIS
        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;
            }
        }
コード例 #4
0
ファイル: KCB_KEDONTHUOC.cs プロジェクト: khaha2210/VXIS
        public ActionResult ThemDonThuoc(KcbDanhsachBenhnhan objBenhnhan,  KcbDonthuoc objDonthuoc, KcbDonthuocChitiet[] arrDonthuocChitiet, ref int p_intIdDonthuoc, ref Dictionary<long, long> lstChitietDonthuoc)
        {
            try
             {
                 using (TransactionScope scope = new TransactionScope())
                 {
                     using (SharedDbConnectionScope sh = new SharedDbConnectionScope())
                     {
                         objBenhnhan.Save();
                         if (objBenhnhan != null)
                         {
                             if (objDonthuoc.NgayKedon <= Convert.ToDateTime("01/01/1900"))
                                 objDonthuoc.NgayKedon = globalVariables.SysDate;
                             objDonthuoc.IdBenhnhan = objBenhnhan.IdBenhnhan;
                             objDonthuoc.MaLuotkham = "";
                             objDonthuoc.IdKham = -1;
                             objDonthuoc.IsNew = true;
                             objDonthuoc.TenDonthuoc = "";

                             objDonthuoc.Save();
                             p_intIdDonthuoc = objDonthuoc.IdDonthuoc;
                             decimal PtramBH = 0;

                             foreach (KcbDonthuocChitiet objDonthuocChitiet in arrDonthuocChitiet)
                             {
                                 objDonthuocChitiet.IdKham = objDonthuoc.IdKham;
                                 objDonthuocChitiet.MaLuotkham = objDonthuoc.MaLuotkham;
                                 objDonthuocChitiet.IdBenhnhan = objDonthuoc.IdBenhnhan;
                                 objDonthuocChitiet.IdDonthuoc = objDonthuoc.IdDonthuoc;
                                 objDonthuocChitiet.IsNew = true;
                                 objDonthuocChitiet.Save();
                                 if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value))
                                     lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc);
                             }

                         }

                     }
                     scope.Complete();
                     return ActionResult.Success;
                 }
             }
             catch (Exception exception)
             {
                 Utility.CatchException(exception);
                 log.Error("Loi trong qua trinh luu don thuoc {0}", exception);
                 return ActionResult.Error;
             }
        }
コード例 #5
0
ファイル: KCB_KEDONTHUOC.cs プロジェクト: khaha2210/VXIS
        public ActionResult CapnhatDonthuoc(KcbDanhsachBenhnhan objBenhnhan, KcbDonthuoc objDonthuoc, KcbDonthuocChitiet[] arrDonthuocChitiet,  ref int p_intIdDonthuoc, ref Dictionary<long, long> lstChitietDonthuoc)
        {
            try
             {
                 using (TransactionScope scope = new TransactionScope())
                 {
                     using (SharedDbConnectionScope sh = new SharedDbConnectionScope())
                     {
                         objBenhnhan.Save();
                         p_intIdDonthuoc = objDonthuoc.IdDonthuoc;
                         new Update(KcbDonthuoc.Schema)
                             .Set(KcbDonthuoc.Columns.NgayKedon).EqualTo(objDonthuoc.NgayKedon)
                             .Set(KcbDonthuoc.Columns.NgaySua).EqualTo(globalVariables.SysDate)
                             .Set(KcbDonthuoc.Columns.NguoiSua).EqualTo(globalVariables.UserName)
                             .Where(KcbDonthuoc.Columns.IdDonthuoc).IsEqualTo(objDonthuoc.IdDonthuoc).Execute();

                         foreach (KcbDonthuocChitiet objDonthuocChitiet in arrDonthuocChitiet)
                         {
                             objDonthuocChitiet.IdDonthuoc = objDonthuoc.IdDonthuoc;
                             if (objDonthuocChitiet.IdChitietdonthuoc == -1)//Moi bo sung
                             {
                                 objDonthuocChitiet.IdKham = objDonthuoc.IdKham;
                                 objDonthuocChitiet.IsNew = true;
                                 objDonthuocChitiet.SluongLinh = 0;
                                 objDonthuocChitiet.SluongSua = 0;
                                 objDonthuocChitiet.TrangThai = 0;

                                 objDonthuocChitiet.IdThanhtoan = -1;
                                 objDonthuocChitiet.MaLuotkham = objDonthuoc.MaLuotkham;
                                 objDonthuocChitiet.IdBenhnhan = objDonthuoc.IdBenhnhan;
                                 objDonthuocChitiet.IdDonthuoc = objDonthuoc.IdDonthuoc;
                                 objDonthuocChitiet.CachDung = objDonthuocChitiet.MotaThem;
                                 objDonthuocChitiet.IsNew = true;
                                 objDonthuocChitiet.Save();
                                 if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value))
                                     lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc);
                             }
                             else
                             {
                                 if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value))
                                     lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc);
                                 new Update(KcbDonthuocChitiet.Schema)
                                     .Set(KcbDonthuocChitiet.SoLuongColumn).EqualTo(objDonthuocChitiet.SoLuong)
                                     .Set(KcbDonthuocChitiet.NgaySuaColumn).EqualTo(objDonthuocChitiet.NgaySua)
                                     .Set(KcbDonthuocChitiet.NguoiSuaColumn).EqualTo(objDonthuocChitiet.NguoiSua)
                                     .Where(KcbDonthuocChitiet.IdChitietdonthuocColumn).IsEqualTo(objDonthuocChitiet.IdChitietdonthuoc).Execute();
                             }
                         }
                     }
                     scope.Complete();
                     return ActionResult.Success;
                 }
             }
             catch (Exception exception)
             {
                 log.Error("Loi trong qua trinh luu don thuoc", exception);
                 return ActionResult.Error;
             }
        }
コード例 #6
0
        public void Insert(string TenBenhnhan, string DiaChi, string MaTinhThanhpho, string MaQuanhuyen, DateTime?NgaySinh, short?NamSinh, byte?IdGioitinh, string GioiTinh, string NgheNghiep, string CoQuan, string Cmt, short?MaQuocgia, string DienThoai, string Email, DateTime NgayTiepdon, string NguoiTiepdon, string DanToc, string TonGiao, DateTime?NgaySua, DateTime?NgayTao, string NguoiSua, string NguoiTao, string DiachiBhyt, string NguonGoc, byte?KieuBenhnhan, byte?MacDinh, string IpMaytao, string IpMaysua, string TenMaytao, string TenMaysua, string DiachiLienhe, string DienthoaiLienhe, string Fax, string NguoiLienhe, string SoTiemchungQg, string LastActionName, string ChucVu, string MaBenhnhan, string SoLo)
        {
            KcbDanhsachBenhnhan item = new KcbDanhsachBenhnhan();

            item.TenBenhnhan = TenBenhnhan;

            item.DiaChi = DiaChi;

            item.MaTinhThanhpho = MaTinhThanhpho;

            item.MaQuanhuyen = MaQuanhuyen;

            item.NgaySinh = NgaySinh;

            item.NamSinh = NamSinh;

            item.IdGioitinh = IdGioitinh;

            item.GioiTinh = GioiTinh;

            item.NgheNghiep = NgheNghiep;

            item.CoQuan = CoQuan;

            item.Cmt = Cmt;

            item.MaQuocgia = MaQuocgia;

            item.DienThoai = DienThoai;

            item.Email = Email;

            item.NgayTiepdon = NgayTiepdon;

            item.NguoiTiepdon = NguoiTiepdon;

            item.DanToc = DanToc;

            item.TonGiao = TonGiao;

            item.NgaySua = NgaySua;

            item.NgayTao = NgayTao;

            item.NguoiSua = NguoiSua;

            item.NguoiTao = NguoiTao;

            item.DiachiBhyt = DiachiBhyt;

            item.NguonGoc = NguonGoc;

            item.KieuBenhnhan = KieuBenhnhan;

            item.MacDinh = MacDinh;

            item.IpMaytao = IpMaytao;

            item.IpMaysua = IpMaysua;

            item.TenMaytao = TenMaytao;

            item.TenMaysua = TenMaysua;

            item.DiachiLienhe = DiachiLienhe;

            item.DienthoaiLienhe = DienthoaiLienhe;

            item.Fax = Fax;

            item.NguoiLienhe = NguoiLienhe;

            item.SoTiemchungQg = SoTiemchungQg;

            item.LastActionName = LastActionName;

            item.ChucVu = ChucVu;

            item.MaBenhnhan = MaBenhnhan;

            item.SoLo = SoLo;


            item.Save(UserName);
        }
コード例 #7
0
        public void Insert(string TenBenhnhan,string DiaChi,string MaTinhThanhpho,string MaQuanhuyen,DateTime? NgaySinh,short? NamSinh,byte? IdGioitinh,string GioiTinh,string NgheNghiep,string CoQuan,string Cmt,short? MaQuocgia,string DienThoai,string Email,DateTime NgayTiepdon,string NguoiTiepdon,string DanToc,string TonGiao,DateTime? NgaySua,DateTime? NgayTao,string NguoiSua,string NguoiTao,string DiachiBhyt,string NguonGoc,string IpMaytao,string IpMaysua,string TenMaytao,string TenMaysua,string HoTenBoMe)
        {
            KcbDanhsachBenhnhan item = new KcbDanhsachBenhnhan();

            item.TenBenhnhan = TenBenhnhan;

            item.DiaChi = DiaChi;

            item.MaTinhThanhpho = MaTinhThanhpho;

            item.MaQuanhuyen = MaQuanhuyen;

            item.NgaySinh = NgaySinh;

            item.NamSinh = NamSinh;

            item.IdGioitinh = IdGioitinh;

            item.GioiTinh = GioiTinh;

            item.NgheNghiep = NgheNghiep;

            item.CoQuan = CoQuan;

            item.Cmt = Cmt;

            item.MaQuocgia = MaQuocgia;

            item.DienThoai = DienThoai;

            item.Email = Email;

            item.NgayTiepdon = NgayTiepdon;

            item.NguoiTiepdon = NguoiTiepdon;

            item.DanToc = DanToc;

            item.TonGiao = TonGiao;

            item.NgaySua = NgaySua;

            item.NgayTao = NgayTao;

            item.NguoiSua = NguoiSua;

            item.NguoiTao = NguoiTao;

            item.DiachiBhyt = DiachiBhyt;

            item.NguonGoc = NguonGoc;

            item.IpMaytao = IpMaytao;

            item.IpMaysua = IpMaysua;

            item.TenMaytao = TenMaytao;

            item.TenMaysua = TenMaysua;

            item.HoTenBoMe = HoTenBoMe;

            item.Save(UserName);
        }
コード例 #8
0
        public void Insert(string TenBenhnhan,string DiaChi,string MaTinhThanhpho,string MaQuanhuyen,DateTime? NgaySinh,short? NamSinh,byte? IdGioitinh,string GioiTinh,string NgheNghiep,string CoQuan,string Cmt,short? MaQuocgia,string DienThoai,string Email,DateTime NgayTiepdon,string NguoiTiepdon,string DanToc,string TonGiao,DateTime? NgaySua,DateTime? NgayTao,string NguoiSua,string NguoiTao,string DiachiBhyt,string NguonGoc,string IpMaytao,string IpMaysua,string TenMaytao,string TenMaysua,string NguoiLienhe,short? IdKhoaphong,short? Guisms,short? IdDoituong,string Trieuchung,string SoNha,string Pid)
        {
            KcbDanhsachBenhnhan item = new KcbDanhsachBenhnhan();

            item.TenBenhnhan = TenBenhnhan;

            item.DiaChi = DiaChi;

            item.MaTinhThanhpho = MaTinhThanhpho;

            item.MaQuanhuyen = MaQuanhuyen;

            item.NgaySinh = NgaySinh;

            item.NamSinh = NamSinh;

            item.IdGioitinh = IdGioitinh;

            item.GioiTinh = GioiTinh;

            item.NgheNghiep = NgheNghiep;

            item.CoQuan = CoQuan;

            item.Cmt = Cmt;

            item.MaQuocgia = MaQuocgia;

            item.DienThoai = DienThoai;

            item.Email = Email;

            item.NgayTiepdon = NgayTiepdon;

            item.NguoiTiepdon = NguoiTiepdon;

            item.DanToc = DanToc;

            item.TonGiao = TonGiao;

            item.NgaySua = NgaySua;

            item.NgayTao = NgayTao;

            item.NguoiSua = NguoiSua;

            item.NguoiTao = NguoiTao;

            item.DiachiBhyt = DiachiBhyt;

            item.NguonGoc = NguonGoc;

            item.IpMaytao = IpMaytao;

            item.IpMaysua = IpMaysua;

            item.TenMaytao = TenMaytao;

            item.TenMaysua = TenMaysua;

            item.NguoiLienhe = NguoiLienhe;

            item.IdKhoaphong = IdKhoaphong;

            item.Guisms = Guisms;

            item.IdDoituong = IdDoituong;

            item.Trieuchung = Trieuchung;

            item.SoNha = SoNha;

            item.Pid = Pid;

            item.Save(UserName);
        }
コード例 #9
0
ファイル: KCB_DANGKY.cs プロジェクト: khaha2210/CodeNewHis
        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;
            }
        }
コード例 #10
0
        public ActionResult CapnhatDonthuoc(KcbDanhsachBenhnhan objBenhnhan, KcbDonthuoc objDonthuoc, KcbDonthuocChitiet[] arrDonthuocChitiet, ref int p_intIdDonthuoc, ref Dictionary <long, long> lstChitietDonthuoc)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (SharedDbConnectionScope sh = new SharedDbConnectionScope())
                    {
                        objBenhnhan.Save();
                        p_intIdDonthuoc = objDonthuoc.IdDonthuoc;
                        new Update(KcbDonthuoc.Schema)
                        .Set(KcbDonthuoc.Columns.NgayKedon).EqualTo(objDonthuoc.NgayKedon)
                        .Set(KcbDonthuoc.Columns.NgaySua).EqualTo(globalVariables.SysDate)
                        .Set(KcbDonthuoc.Columns.NguoiSua).EqualTo(globalVariables.UserName)
                        .Where(KcbDonthuoc.Columns.IdDonthuoc).IsEqualTo(objDonthuoc.IdDonthuoc).Execute();

                        foreach (KcbDonthuocChitiet objDonthuocChitiet in arrDonthuocChitiet)
                        {
                            objDonthuocChitiet.IdDonthuoc = objDonthuoc.IdDonthuoc;
                            if (objDonthuocChitiet.IdChitietdonthuoc == -1) //Moi bo sung
                            {
                                objDonthuocChitiet.IdKham     = objDonthuoc.IdKham;
                                objDonthuocChitiet.IsNew      = true;
                                objDonthuocChitiet.SluongLinh = 0;
                                objDonthuocChitiet.SluongSua  = 0;
                                objDonthuocChitiet.TrangThai  = 0;

                                objDonthuocChitiet.IdThanhtoan = -1;
                                objDonthuocChitiet.MaLuotkham  = objDonthuoc.MaLuotkham;
                                objDonthuocChitiet.IdBenhnhan  = objDonthuoc.IdBenhnhan;
                                objDonthuocChitiet.IdDonthuoc  = objDonthuoc.IdDonthuoc;
                                objDonthuocChitiet.CachDung    = objDonthuocChitiet.MotaThem;
                                objDonthuocChitiet.IsNew       = true;
                                objDonthuocChitiet.Save();
                                if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value))
                                {
                                    lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc);
                                }
                            }
                            else
                            {
                                if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value))
                                {
                                    lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc);
                                }
                                new Update(KcbDonthuocChitiet.Schema)
                                .Set(KcbDonthuocChitiet.SoLuongColumn).EqualTo(objDonthuocChitiet.SoLuong)
                                .Set(KcbDonthuocChitiet.NgaySuaColumn).EqualTo(objDonthuocChitiet.NgaySua)
                                .Set(KcbDonthuocChitiet.NguoiSuaColumn).EqualTo(objDonthuocChitiet.NguoiSua)
                                .Where(KcbDonthuocChitiet.IdChitietdonthuocColumn).IsEqualTo(objDonthuocChitiet.IdChitietdonthuoc).Execute();
                            }
                        }
                    }
                    scope.Complete();
                    return(ActionResult.Success);
                }
            }
            catch (Exception exception)
            {
                log.Error("Loi trong qua trinh luu don thuoc", exception);
                return(ActionResult.Error);
            }
        }
コード例 #11
0
ファイル: BussinessKSK.cs プロジェクト: vmshis2015/VMSHIS2017
        public static ActionResult Thembenhnhan(KcbDanhsachBenhnhan objdanhsachbenhnhan, KcbLuotkham objluotkham,
                                                KcbChidinhcl objchidinh, KcbDangkyKcb objDangkyKcb,
                                                KcbChidinhclsChitiet[] objchidinhchitiet,
                                                ref string errMsg)
        {
            Logger log = LogManager.GetCurrentClassLogger();

            try
            {
                var option = new TransactionOptions
                {
                    IsolationLevel = IsolationLevel.Snapshot, Timeout = TimeSpan.FromMinutes(5)
                };
                using (var trans = new TransactionScope())
                {
                    using (var shs = new SharedDbConnectionScope())
                    {
                        log.Trace("1.Bắt đầu thêm mới bệnh nhân " + objdanhsachbenhnhan.TenBenhnhan + "");
                        string PatientCode =
                            THU_VIEN_CHUNG.KCB_SINH_MALANKHAM(
                                (byte)(Utility.Int16Dbnull(objdanhsachbenhnhan.KieuBenhnhan, 1)));

                        // Them moi thong tin benh nhan
                        SqlQuery objdbenhnhan = new Select().From(KcbDanhsachBenhnhan.Schema)
                                                .Where(KcbDanhsachBenhnhan.Columns.IdBenhnhan).IsEqualTo(objdanhsachbenhnhan.IdBenhnhan);
                        if (objdbenhnhan.GetRecordCount() > 0)
                        {
                            objdanhsachbenhnhan.MarkOld();
                            objdanhsachbenhnhan.IsLoaded = true;
                        }
                        else
                        {
                            objdanhsachbenhnhan.IsNew = true;
                        }
                        objdanhsachbenhnhan.Save();
                        log.Trace("2. Đã thêm mới Bệnh nhân");
                        // them moi lan kham cho benh nhan
                        objluotkham.MaLuotkham = Utility.sDbnull(PatientCode, "");
                        SqlQuery sqlPatientExam = new Select().From(KcbLuotkham.Schema).Where(
                            KcbLuotkham.Columns.MaLuotkham)
                                                  .IsEqualTo(objluotkham.MaLuotkham);
                        if (sqlPatientExam.GetRecordCount() > 0)
                        {
                            objluotkham.MarkOld();
                            objluotkham.IsLoaded = true;
                        }
                        else
                        {
                            objluotkham.IsNew      = true;
                            objluotkham.MaLuotkham = PatientCode;
                            objluotkham.IdBenhnhan = objdanhsachbenhnhan.IdBenhnhan;
                        }

                        objluotkham.Save();

                        log.Trace("3. Đã thêm mới Lượt khám Bệnh nhân");
                        DataTable dtCheck =
                            SPs.SpKcbKiemtraTrungMaLuotkham(objluotkham.IdBenhnhan, objluotkham.MaLuotkham).
                            GetDataSet().Tables[0];
                        if (dtCheck != null && dtCheck.Rows.Count > 0)
                        {
                            log.Trace("3.1 Đã phát hiện trùng mã Bệnh nhân-->Lấy lại mã mới");
                            string patientCode =
                                THU_VIEN_CHUNG.KCB_SINH_MALANKHAM(
                                    (byte)(Utility.Int16Dbnull(objdanhsachbenhnhan.KieuBenhnhan, 1)));
                            SPs.SpKcbCapnhatLuotkhamMaluotkham(patientCode, objluotkham.MaLuotkham,
                                                               objluotkham.IdBenhnhan).Execute();
                            log.Trace("3.2 Cập  nhập mã lượt khám này được sử dụng rồi");
                            //  SPs.SpKcbCapnhatMaluotkhamLichsudoituongKcb(patientCode, objLichsuKcb.IdLichsuDoituongKcb).Execute();
                            //  log.Trace("3.2 Đã Cập nhật lại mã lượt khám mới");
                            objluotkham.MaLuotkham = patientCode;
                        }
                        SPs.SpKcbCapnhatDmucLuotkham(objluotkham.MaLuotkham,
                                                     (byte)(Utility.Int16Dbnull(objdanhsachbenhnhan.KieuBenhnhan, 1)), 1, 2,
                                                     globalVariables.UserName).Execute();

                        log.Trace("4. Đã đánh dấu mã lượt khám đã được sử dụng trong hệ thống");
                        // Them moi thong tin chi dinh cho benh nhan
                        if (objDangkyKcb != null)
                        {
                            SqlQuery sqldangkykcb = new Select().From(KcbDangkyKcb.Schema).Where(
                                KcbDangkyKcb.Columns.IdKham)
                                                    .IsEqualTo(Utility.Int64Dbnull(objDangkyKcb.IdKham, -1));
                            if (sqldangkykcb.GetRecordCount() > 0)
                            {
                                objDangkyKcb.MarkOld();
                                objDangkyKcb.IsLoaded = true;
                            }
                            else
                            {
                                objDangkyKcb.IsNew      = true;
                                objDangkyKcb.MaLuotkham = PatientCode;
                                objDangkyKcb.IdBenhnhan = objdanhsachbenhnhan.IdBenhnhan;
                            }
                            objDangkyKcb.Save();
                        }

                        SqlQuery sqlAssignInfo = new Select().From(KcbChidinhcl.Schema)
                                                 .Where(KcbChidinhcl.Columns.IdChidinh).IsEqualTo(objchidinh.IdChidinh);
                        if (objDangkyKcb != null)
                        {
                            objchidinh.IdKham = objDangkyKcb.IdKham;
                        }
                        objchidinh.IdDoituongKcb     = 3;
                        objchidinh.MaDoituongKcb     = "KSK";
                        objchidinh.IdLoaidoituongKcb = 2;
                        if (sqlAssignInfo.GetRecordCount() > 0)
                        {
                            objchidinh.MarkOld();
                            objchidinh.IsLoaded = true;
                        }
                        else
                        {
                            objchidinh.IsNew     = true;
                            objchidinh.MaChidinh = THU_VIEN_CHUNG.SinhMaChidinhCLSKSK();
                        }
                        objchidinh.IdBenhnhan = objluotkham.IdBenhnhan;
                        objchidinh.MaLuotkham = objluotkham.MaLuotkham;
                        objchidinh.NguoiSua   = globalVariables.UserName;
                        objchidinh.NgaySua    = DateTime.Now;
                        if (string.IsNullOrEmpty(objchidinh.MaKhoaChidinh))
                        {
                            objchidinh.MaKhoaChidinh = Utility.sDbnull(objluotkham.MaKhoaThuchien);
                        }
                        objchidinh.Save();
                        log.Trace("5. Đã thêm mới phiếu chỉ định cho bệnh nhân");
                        if (Utility.Int32Dbnull(objchidinh.IdChidinh) > 0)
                        {
                            foreach (KcbChidinhclsChitiet objAssignDetail in objchidinhchitiet)
                            {
                                // Them chi tiet chi dinh cho benh nhan
                                SqlQuery sqlAssignDetail = new Select().From(KcbChidinhclsChitiet.Schema)
                                                           .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(
                                    objAssignDetail.IdChitietchidinh);
                                if (sqlAssignDetail.GetRecordCount() > 0)
                                {
                                    objAssignDetail.MarkOld();
                                    objAssignDetail.IsLoaded = true;
                                }
                                else
                                {
                                    objAssignDetail.IsNew = true;
                                }

                                objAssignDetail.IdDoituongKcb = Utility.Int16Dbnull(objluotkham.IdDoituongKcb);
                                objAssignDetail.MaLuotkham    = objchidinh.MaLuotkham;
                                objAssignDetail.IdBenhnhan    = objchidinh.IdBenhnhan;
                                objAssignDetail.IdKham        = objchidinh.IdKham;
                                objAssignDetail.IdChidinh     = Utility.Int32Dbnull(objchidinh.IdChidinh);
                                //    objAssignDetail.IdKham = -1;
                                objAssignDetail.IpMaytao  = globalVariables.gv_strIPAddress;
                                objAssignDetail.PtramBhyt =
                                    Utility.DecimaltoDbnull(objluotkham.PtramBhyt);
                                objAssignDetail.IdBacsiThuchien = globalVariables.IdKhoaNhanvien;
                                // objAssignDetail.IsNew = true;
                                objAssignDetail.Save();
                                log.Info(
                                    "Them moi thong tin cua phieu chi dinh chi tiet voi ma phieu Assign_ID=" +
                                    objchidinh.IdChidinh);
                            }
                            log.Trace("6. Đã thêm mới chi tiết phiếu chỉ định cho bệnh nhân");
                        }
                        else
                        {
                            log.Trace("7. Lỗi thêm bệnh nhân vào hệ thống");
                            return(ActionResult.Error);
                        }
                    }

                    trans.Complete();
                    log.Trace("8. Thêm bệnh nhân có ID_Benhnhan " + objdanhsachbenhnhan.IdBenhnhan +
                              " vào hệ thống thành công");
                    errMsg = @"Thêm mới thành công bệnh nhân";
                    return(ActionResult.Success);
                }
            }
            catch (Exception ex)
            {
                errMsg = "Lỗi thêm mới bệnh nhân : " + ex.Message;
                log.Error(ex.Message);
                return(ActionResult.Error);
            }
        }
コード例 #12
0
ファイル: KCB_DANGKY.cs プロジェクト: vmshis2020/VMSHISServer
        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;
            }
        }
コード例 #13
0
ファイル: KCB_DANGKY.cs プロジェクト: vmshis2020/VMSHISServer
        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;
            }
        }
コード例 #14
0
ファイル: KCB_DANGKY.cs プロジェクト: vmshis2020/VMSHISServer
        public ActionResult UpdateBenhnhanCapcuu(SysTrace mytrace, KcbDanhsachBenhnhan objKcbDanhsachBenhnhan, KcbLuotkham objLuotkham, KcbDangkySokham objSoKCB, NoitruPhanbuonggiuong objBuonggiuong, DateTime ngaychuyenkhoa, decimal PtramBhytCu, decimal PtramBhytgoc, ref string Msg)
        {
            ActionResult _ActionResult = ActionResult.Success;
            try
            {
                using (var scope = new TransactionScope())
                {
                    using (var dbscope = new SharedDbConnectionScope())
                    {

                        objKcbDanhsachBenhnhan.IsNew = false;
                        objKcbDanhsachBenhnhan.IsLoaded = true;
                        objKcbDanhsachBenhnhan.MarkOld();
                        objKcbDanhsachBenhnhan.Save();

                        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 = objBuonggiuong.Id;
                        objLichsuKcb.IdBuong = objBuonggiuong.IdBuong;
                        objLichsuKcb.IdGiuong = objBuonggiuong.IdGiuong;
                        objLichsuKcb.IdKhoanoitru = objBuonggiuong.IdKhoanoitru;
                        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.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 thông tin sổ khám";
                                }
                                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();
                        }
                        //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;
                        }

                        //Nhập viện
                        if (objBuonggiuong != null)
                        {
                            if (objBuonggiuong.Id <= 0)
                            {
                                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("Cập nhật BN 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)
            {
                log.Error("Loi trong qua trinh update thong tin benh nhan {0}", ex);
                return ActionResult.Error;
            }
        }
コード例 #15
0
ファイル: KCB_DANGKY.cs プロジェクト: vmshis2020/VMSHISServer
        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;
            }
        }
コード例 #16
0
ファイル: Frm_TiepDonBN.cs プロジェクト: khaha2210/VXIS
        private bool AddPatient()
        {
            try
            {
                KcbDanhsachBenhnhan obj = new KcbDanhsachBenhnhan();
                obj.Pid = txtPID.Text;
                obj.TenBenhnhan = txtTenbenhnhan.Text;
                obj.DiaChi = txtdiachidaydu.Text;
                if (chkDOB.Checked)
                {
                    obj.NgaySinh = dtpngaysinh.Value;
                    obj.NamSinh = Utility.Int16Dbnull(dtpngaysinh.Value.Year);
                }
                else
                {
                    obj.NamSinh = Utility.Int16Dbnull(txtNamsinh.Text);
                }

                obj.IdDoituong = Utility.Int16Dbnull(cbodoituong.SelectedValue, -1);
                obj.IdKhoaphong = Utility.Int16Dbnull(cboTram.SelectedValue, -1);
                //obj.IdGioitinh = DBNull.Value == cboPatientSex.SelectedValue
                //    ? (bool?)null
                //    : Utility.Int16Dbnull(cboPatientSex.SelectedValue) == 1;
                obj.GioiTinh = Utility.sDbnull(cboPatientSex.SelectedValue);
                obj.NgheNghiep = txtNghe.Text;
                obj.NguoiLienhe = txtNguoiLienhe.Text;
                obj.Cmt = txtCMT.Text;
                obj.Trieuchung = txtTrieuChung.Text;
                obj.SoNha = txtSoNha.Text;
                obj.DienThoai = txtSodienthoai.Text;
                obj.NgayTao = DateTime.Now;
                obj.NgayTiepdon = dtpngaytiepdon.Value;
                obj.Email = txtEmail.Text;
                obj.NguoiTao = Utility.sDbnull(globalVariables.UserName);
                obj.NguoiTiepdon = Utility.sDbnull(globalVariables.UserName);
                obj.IsNew = true;
                obj.Save();
                // txtMaBN.Text = Utility.sDbnull(obj.IdBenhnhan);
                return true;
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
                return false;
            }
        }