コード例 #1
0
        public string UpdateLuonCongViec(QLPHONGKHAMEntities db, LuonCongViecDTO LuonCongViec)
        {
            LUONCONGVIEC luonCongViecDAO = new LUONCONGVIEC();

            BUS.Com.Utils.CopyPropertiesFrom(LuonCongViec, luonCongViecDAO);
            return(luonCongViecService.Save(db, luonCongViecDAO));
        }
コード例 #2
0
        public void Update_TestCase4()
        {
            LuonCongViecDTO luonCongViecDTO = new LuonCongViecDTO
            {
                MaHoSo      = TestCommon.LEN_10,
                NodeHienTai = "12345",
                TiepNhan    = false,
                KhamBenh    = false,
                XetNghiem   = false
            };
            LuonCongViecBUS luonCongViecBUS = new LuonCongViecBUS();

            LuonCongViecDTO luonCongViecUpdate = new LuonCongViecDTO
            {
                MaHoSo      = "1234",
                NodeHienTai = "12345",
                TiepNhan    = false,
                KhamBenh    = true,
                XetNghiem   = true
            };

            string actual   = luonCongViecBUS.UpdateLuonCongViec(db, luonCongViecDTO);
            string expected = "1111";

            Assert.Equals(expected, actual);
        }
コード例 #3
0
        public void Add_TestCase2()
        {
            LuonCongViecDTO luonCongViecDTO = new LuonCongViecDTO
            {
                NodeHienTai = "12345",
                TiepNhan    = true,
                KhamBenh    = true,
                XetNghiem   = true
            };
            LuonCongViecBUS luonCongViecBUS = new LuonCongViecBUS();
            string          actual          = luonCongViecBUS.AddLuonCongViec(db, luonCongViecDTO);
            string          expected        = "1111";

            Assert.Equals(expected, actual);
        }
コード例 #4
0
        public string GetInformationLuonCongViec(QLPHONGKHAMEntities db, string MaHoSo, out LuonCongViecDTO LuonCongViecEntity)
        {
            LuonCongViecEntity = new LuonCongViecDTO();
            LUONCONGVIEC entity = null;

            object[] id = { MaHoSo };
            if (luonCongViecService.FindById(db, id, out entity) == Constant.RES_FAI)
            {
                return(Constant.RES_FAI);
            }
            if (entity == null)
            {
                return(Constant.RES_FAI);
            }
            BUS.Com.Utils.CopyPropertiesFrom(entity, LuonCongViecEntity);
            return(Constant.RES_SUC);
        }
コード例 #5
0
        public void Update_TestCase3()
        {
            LuonCongViecDTO luonCongViecDTO = new LuonCongViecDTO
            {
                MaHoSo      = TestCommon.LEN_10,
                NodeHienTai = "12345",
            };
            LuonCongViecBUS luonCongViecBUS = new LuonCongViecBUS();

            LuonCongViecDTO luonCongViecUpdate = new LuonCongViecDTO
            {
                MaHoSo      = TestCommon.LEN_10 + "1",
                NodeHienTai = "123456",
            };

            string actual   = luonCongViecBUS.UpdateLuonCongViec(db, luonCongViecDTO);
            string expected = "1111";

            Assert.Equals(expected, actual);
        }
コード例 #6
0
ファイル: XetNghiemModule.cs プロジェクト: thuantv1996/OOAD
        // 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);
        }
コード例 #7
0
ファイル: XetNghiemModule.cs プロジェクト: thuantv1996/OOAD
        // 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);
        }
コード例 #8
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);
        }
コード例 #9
0
        public string SaveHoSo(HoSoBenhAnDTO hoSoBenhAn,
                               ThanhToanDTO thanhToan)
        {
            TrangThaiPhongDTO trangThaiPhong = null;
            // get System date
            string SystemDate = DateTime.Now.ToString("yyyyMMdd");

            ThanhToanBUS      thanhToanBUS      = new ThanhToanBUS();
            HoSoBenhAnBUS     hoSoBenhAnBUS     = new HoSoBenhAnBUS();
            LuonCongViecBUS   luonCongViecBUS   = new LuonCongViecBUS();
            TrangThaiPhongBUS trangThaiPhongBUS = new TrangThaiPhongBUS();

            using (QLPHONGKHAMEntities db = new QLPHONGKHAMEntities())
            {
                // lấy trạng thái phòng
                trangThaiPhongBUS.GetTrangThaiPhong(db, hoSoBenhAn.MaPhongKham, SystemDate, out trangThaiPhong);
                trangThaiPhong.SttCaoNhat += 1;

                // setting ho so
                string maHoSo;
                hoSoBenhAnBUS.CreateIdHoSoBenhAn(db, out maHoSo);
                hoSoBenhAn.MaHoSo = maHoSo;
                // nếu là hồ sơ tái khám
                if (hoSoBenhAn.MaLoaiHoSo == BusConstant.HS_TAIKHAM)
                {
                    HoSoBenhAnDTO root = new HoSoBenhAnDTO();

                    // get MaHoSoGoc
                    hoSoBenhAnBUS.GetRootHoSoBenhAn(db, hoSoBenhAn.MaHoSoTruoc, out root);
                    hoSoBenhAn.MaHoSoGoc = root.MaHoSoGoc;
                }
                hoSoBenhAn.SoThuTu = trangThaiPhong.SttCaoNhat;

                // điền thông tin vào thanh toán
                string MaThanhToan = "";
                thanhToanBUS.CreateIdThanhToan(db, out MaThanhToan);
                thanhToan.MaThanhToan = MaThanhToan;
                thanhToan.TongChiPhi  = thanhToan.ChiPhiKham;
                thanhToan.MaHoSo      = hoSoBenhAn.MaHoSo;
                // điền thông tin Workflow
                LuonCongViecDTO luonCongViec = new LuonCongViecDTO();
                luonCongViec.MaHoSo      = hoSoBenhAn.MaHoSo;
                luonCongViec.NodeHienTai = BusConstant.NODE_KHAM;
                luonCongViec.TiepNhan    = true;
                luonCongViec.XetNghiem   = false;
                luonCongViec.KhamBenh    = false;

                // Tạo transaction
                using (var trans = db.Database.BeginTransaction())
                {
                    // save hồ sơ
                    if (hoSoBenhAnBUS.AddHoSoBenhAn(db, hoSoBenhAn) == Constant.RES_FAI)
                    {
                        trans.Rollback();
                        return(Constant.RES_FAI);
                    }
                    // save luồn công việc
                    if (luonCongViecBUS.AddLuonCongViec(db, luonCongViec) == Constant.RES_FAI)
                    {
                        trans.Rollback();
                        return(Constant.RES_FAI);
                    }
                    // save thanh toán
                    if (thanhToanBUS.InsertThanhToan(db, thanhToan) == Constant.RES_FAI)
                    {
                        trans.Rollback();
                        return(Constant.RES_FAI);
                    }
                    // update Trang thanh phong
                    if (trangThaiPhongBUS.UpdateTrangThaiPhong(db, trangThaiPhong) == Constant.RES_FAI)
                    {
                        trans.Rollback();
                        return(Constant.RES_FAI);
                    }
                    trans.Commit();
                }
                db.SaveChanges();
            }
            return(Constant.RES_SUC);
        }
コード例 #10
0
ファイル: ThanhToanModule.cs プロジェクト: thuantv1996/OOAD
        // 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);
        }