/// <summary>
        /// /hàm thực hiện việc khởi tạo thông tin của phiếu xuất cho bệnh nhân
        /// </summary>
        /// <param name="objPrescription"></param>
        /// <returns></returns>
        private DPhieuXuatBnhan CreatePhieuXuatBenhNhan(TPrescription objPrescription)
        {
            TPatientInfo objPatientInfo = TPatientInfo.FetchByID(objPrescription.PatientId);
            TPatientExam objPatientExam = new Select().From(TPatientExam.Schema)
                .Where(TPatientExam.Columns.PatientCode).IsEqualTo(objPrescription.PatientCode)
                .And(TPatientExam.Columns.PatientId).IsEqualTo(objPrescription.PatientId).ExecuteSingle<TPatientExam>();

            DPhieuXuatBnhan objPhieuXuatBnhan=new DPhieuXuatBnhan();
            objPhieuXuatBnhan.NgayXuatBn =BusinessHelper.GetSysDateTime();
            objPhieuXuatBnhan.IdKhoaCd = Utility.Int16Dbnull(objPrescription.DepartmentId);
            objPhieuXuatBnhan.IdBsyCd = Utility.Int16Dbnull(objPrescription.AssignId);
            objPhieuXuatBnhan.IdDonThuoc = Utility.Int32Dbnull(objPrescription.PresId);
            objPhieuXuatBnhan.IdNhanVien = globalVariables.gv_StaffID;
            objPhieuXuatBnhan.HienThi = 1;
            objPhieuXuatBnhan.ChanDoan = Utility.sDbnull(objPatientExam.ChanDoanChinh);
            objPhieuXuatBnhan.MaBenh = Utility.sDbnull(objPatientExam.MBenhChinh);
            objPhieuXuatBnhan.IdDoiTuong = Utility.Int16Dbnull(objPatientExam.ObjectTypeId);
            objPhieuXuatBnhan.Gtinh = Utility.ByteDbnull(objPatientInfo.PatientSex);
            objPhieuXuatBnhan.TenBnhan = Utility.sDbnull(objPatientInfo.PatientName);
            objPhieuXuatBnhan.TenKhongDau = Utility.sDbnull(Utility.UnSignedCharacter(objPatientInfo.PatientName));
            objPhieuXuatBnhan.DiaChi = Utility.sDbnull(objPatientInfo.PatientAddr);
            objPhieuXuatBnhan.NamSinh = Utility.Int32Dbnull(objPatientInfo.YearOfBirth);
            objPhieuXuatBnhan.SoThe = Utility.sDbnull(objPatientExam.InsuranceNum);
            objPhieuXuatBnhan.NgayKeDon = objPrescription.PresDate;
            objPhieuXuatBnhan.NgayTao = DateTime.Now;
            objPhieuXuatBnhan.NguoiTao = globalVariables.UserName;
            objPhieuXuatBnhan.LoaiDthuoc = 1;
            objPhieuXuatBnhan.TrangThai = 1;
            objPhieuXuatBnhan.LoaiPhieu = (byte?) LoaiPhieu.PhieuXuatKhoBenhNhan;
               // objPhieuXuatBnhan. = (byte?) LoaiPhieu.PhieuXuatKhoBenhNhan;
            switch (HisDuocProperties.KieuDuyetDonThuoc)
            {
                case "DONTHUOC":
                    objPhieuXuatBnhan.IdKhoXuat = Utility.Int16Dbnull(objPrescription.StockId);
                    break;
                case "CHITIET":
                    objPhieuXuatBnhan.IdKhoXuat = Utility.Int16Dbnull(cboKho.SelectedValue);
                    break;
                default:
                    objPhieuXuatBnhan.IdKhoXuat = Utility.Int16Dbnull(objPrescription.StockId);
                    break;
            }

            return objPhieuXuatBnhan;
        }
 private TPatientExam createPatientExam(TPrescription objPrescription)
 {
     SqlQuery sqlQuery = new Select().From(TPatientExam.Schema).Where(
                 TPatientExam.Columns.PatientCode).IsEqualTo(objPrescription.PatientCode)
                 .And(TPatientExam.Columns.PatientId).IsEqualTo(objPrescription.PatientId);
     TPatientExam objPatientExam = sqlQuery.ExecuteSingle<TPatientExam>();
     return objPatientExam;
 }