Exemplo n.º 1
0
        // chỉ định các xét nghiệm
        public string AssignXetNghiem(List <KetQuaXetNghiemDTO> ketQuaXetNghiemDTOs)
        {
            if (ketQuaXetNghiemDTOs == null || ketQuaXetNghiemDTOs.Count == 0)
            {
                return(Constant.RES_FAI);
            }
            KetQuaXetNghiemBUS ketQuaXetNghiemBUS = new KetQuaXetNghiemBUS();
            LuonCongViecBUS    luonCongViecBUS    = new LuonCongViecBUS();

            using (QLPHONGKHAMEntities db = new QLPHONGKHAMEntities())
            {
                LuonCongViecDTO luonCongViec = null;
                luonCongViecBUS.GetInformationLuonCongViec(db, ketQuaXetNghiemDTOs.ElementAt(0).MaHoSo, out luonCongViec);
                if (luonCongViec == null)
                {
                    return(Constant.RES_FAI);
                }
                luonCongViec.NodeHienTai = BusConstant.NODE_THANH_TOAN_XET_NGHIEM;

                using (var trans = db.Database.BeginTransaction())
                {
                    foreach (var kq in ketQuaXetNghiemDTOs)
                    {
                        kq.ThanhToan = false;
                        if (ketQuaXetNghiemBUS.AddKetQuaXetNghiem(db, kq).Equals(Constant.RES_FAI))
                        {
                            trans.Rollback();
                            return(Constant.RES_FAI);
                        }
                    }
                    if (luonCongViecBUS.UpdateLuonCongViec(db, luonCongViec).Equals(Constant.RES_FAI))
                    {
                        trans.Rollback();
                        return(Constant.RES_FAI);
                    }
                    trans.Commit();
                }
                db.SaveChanges();
            }
            return(Constant.RES_SUC);
        }
Exemplo n.º 2
0
        // xử lý xét nghiệm
        public string XetNghiemProcessing(KetQuaXetNghiemDTO ketQuaXetNghiem)
        {
            KetQuaXetNghiemBUS ketQuaXetNghiemBUS = new KetQuaXetNghiemBUS();
            LuonCongViecBUS    luonCongViecBUS    = new LuonCongViecBUS();

            using (QLPHONGKHAMEntities db = new QLPHONGKHAMEntities())
            {
                LuonCongViecDTO luonCongViec = null;
                luonCongViecBUS.GetInformationLuonCongViec(db, ketQuaXetNghiem.MaHoSo, out luonCongViec);
                if (luonCongViec == null)
                {
                    return(Constant.RES_FAI);
                }
                using (var trans = db.Database.BeginTransaction())
                {
                    if (ketQuaXetNghiemBUS.UpdateKetQuaXetNghiem(db, ketQuaXetNghiem).Equals(Constant.RES_FAI))
                    {
                        trans.Rollback();
                        return(Constant.RES_FAI);
                    }

                    if (GetNumberXetNghiemActive(db, ketQuaXetNghiem.MaHoSo) == 0)
                    {
                        luonCongViec.NodeHienTai = BusConstant.NODE_KHAM_SAU_XN;
                        luonCongViec.XetNghiem   = true;
                        if (luonCongViecBUS.UpdateLuonCongViec(db, luonCongViec).Equals(Constant.RES_FAI))
                        {
                            trans.Rollback();
                            return(Constant.RES_FAI);
                        }
                    }
                    trans.Commit();
                }
                db.SaveChanges();
            }
            return(Constant.RES_SUC);
        }
Exemplo n.º 3
0
        // Lưu thông tin Khám
        public string KhamProcessing(HoSoBenhAnDTO hoSoBenhAn)
        {
            HoSoBenhAnBUS   hoSoBenhAnBUS   = new HoSoBenhAnBUS();
            LuonCongViecBUS luonCongViecBUS = new LuonCongViecBUS();

            using (QLPHONGKHAMEntities db = new QLPHONGKHAMEntities())
            {
                LuonCongViecDTO luonCongViec = new LuonCongViecDTO();
                try
                {
                    luonCongViecBUS.GetInformationLuonCongViec(db, hoSoBenhAn.MaHoSo, out luonCongViec);
                    luonCongViec.NodeHienTai = BusConstant.NODE_HOAN_TAT;
                    luonCongViec.KhamBenh    = true;
                }
                catch
                {
                    return(Constant.RES_FAI);
                }
                using (var trans = db.Database.BeginTransaction())
                {
                    if (hoSoBenhAnBUS.UpdateHoSoBenhAn(db, hoSoBenhAn).Equals(Constant.RES_FAI))
                    {
                        trans.Rollback();
                        return(Constant.RES_FAI);
                    }
                    if (luonCongViecBUS.UpdateLuonCongViec(db, luonCongViec).Equals(Constant.RES_FAI))
                    {
                        trans.Rollback();
                        return(Constant.RES_FAI);
                    }
                    trans.Commit();
                }
                db.SaveChanges();
            }
            return(Constant.RES_SUC);
        }
Exemplo n.º 4
0
        // xử lý thanh toán
        public string ThanhToanProcessing(List <KetQuaXetNghiemDTO> ketQuaXetNghiems)
        {
            if (ketQuaXetNghiems == null || ketQuaXetNghiems.Count == 0)
            {
                return(Constant.RES_FAI);
            }
            KetQuaXetNghiemBUS ketQuaXetNghiemBUS = new KetQuaXetNghiemBUS();
            ThanhToanBUS       thanhToanBUS       = new ThanhToanBUS();
            LuonCongViecBUS    luonCongViecBUS    = new LuonCongViecBUS();

            using (QLPHONGKHAMEntities db = new QLPHONGKHAMEntities())
            {
                ThanhToanDTO thanhToan = new ThanhToanDTO();
                if (thanhToanBUS.GetThanhToan(db, ketQuaXetNghiems.ElementAt(0).MaHoSo, out thanhToan) == Constant.RES_FAI)
                {
                    return(Constant.RES_FAI);
                }
                if (thanhToan == null)
                {
                    return(Constant.RES_FAI);
                }
                decimal tongtien = 0;
                foreach (var kq in ketQuaXetNghiems)
                {
                    tongtien += kq.TongChiPhi;
                }
                thanhToan.TongChiPhi     += tongtien;
                thanhToan.ChiPhiXetNghiem = tongtien;

                LuonCongViecDTO luonCongViec = new LuonCongViecDTO();
                if (luonCongViecBUS.GetInformationLuonCongViec(db, thanhToan.MaHoSo, out luonCongViec) == Constant.RES_FAI)
                {
                    return(Constant.RES_FAI);
                }

                luonCongViec.NodeHienTai = BusConstant.NODE_XET_NGHIEM;
                using (var trans = db.Database.BeginTransaction())
                {
                    foreach (var kq in ketQuaXetNghiems)
                    {
                        // yeu cau PRESENT phai update doi tuong
                        if (ketQuaXetNghiemBUS.UpdateKetQuaXetNghiem(db, kq).Equals(Constant.RES_FAI))
                        {
                            trans.Rollback();
                            return(Constant.RES_FAI);
                        }
                    }
                    if (thanhToanBUS.UpdateThanhToan(db, thanhToan).Equals(Constant.RES_FAI))
                    {
                        trans.Rollback();
                        return(Constant.RES_FAI);
                    }
                    if (luonCongViecBUS.UpdateLuonCongViec(db, luonCongViec).Equals(Constant.RES_FAI))
                    {
                        trans.Rollback();
                        return(Constant.RES_FAI);
                    }
                    trans.Commit();
                }
                db.SaveChanges();
            }
            return(Constant.RES_SUC);
        }