public void ThemPhieuXuatTH(DPhieuXuatBnhan objectPhieuxuatBN) { try { DPhieuXuatBnhan _phieuxuatBN = new DPhieuXuatBnhan(); _phieuxuatBN = objectPhieuxuatBN; _phieuxuatBN.IsNew = true; _phieuxuatBN.Save(); StoredProcedure sp = SPs.DPhieuXuatBnhanInsert(objectPhieuxuatBN.IdPhieuXuatBn, objectPhieuxuatBN.MaPhieuXuatBn, objectPhieuxuatBN.NgayXuatBn, objectPhieuxuatBN.NgayKeDon, objectPhieuxuatBN.TenBenhnhan, objectPhieuxuatBN.TenKhongDau, objectPhieuxuatBN.Gtinh, objectPhieuxuatBN.ChanDoan, objectPhieuxuatBN.MaBenh, objectPhieuxuatBN.DiaChi, objectPhieuxuatBN.NamSinh, objectPhieuxuatBN.SoThe, objectPhieuxuatBN.IdDoiTuong, objectPhieuxuatBN.IdNhanVien, objectPhieuxuatBN.IdDonThuoc, objectPhieuxuatBN.IdKhoaCd, objectPhieuxuatBN.IdBacsiKedon, objectPhieuxuatBN.IdKhoXuat, objectPhieuxuatBN.HienThi, objectPhieuxuatBN.NoiTru, objectPhieuxuatBN.LoaiDthuoc, objectPhieuxuatBN.TrangThai, objectPhieuxuatBN.Ngaytao, objectPhieuxuatBN.NguoiTao, objectPhieuxuatBN.LoaiPhieu); sp.Execute(); objectPhieuxuatBN.IdPhieuXuatBn = Utility.Int32Dbnull(sp.OutputValues[0]); // return ActionResult.Success; } catch (Exception) { } }
public ActionResult ThemDonKe(DPhieuXuatBnhan objPhieuXuatBnhan, TXuatthuocTheodon [] objArrPhieuDonThuocCts) { try { using (var Scope = new TransactionScope()) { using (var dbScope = new SharedDbConnectionScope()) { ThemPhieuXuatTH(objPhieuXuatBnhan); foreach (var objPhieuDonThuocCt in objArrPhieuDonThuocCts) { objPhieuDonThuocCt.IdPhieuXuatBn = Utility.Int32Dbnull(objPhieuXuatBnhan.IdPhieuXuatBn); objPhieuDonThuocCt.IsNew = true; objPhieuDonThuocCt.Save(); StoredProcedure sp = SPs.TXuatthuocTheodonInsert(objPhieuDonThuocCt.ITXuatthuocTheodon, objPhieuDonThuocCt.IdPhieuXuatBn, objPhieuDonThuocCt.IdThuoc, objPhieuDonThuocCt.SoLuong, objPhieuDonThuocCt.DonGia, objPhieuDonThuocCt.PhuThu, objPhieuDonThuocCt.Bnct, objPhieuDonThuocCt.Bhct, objPhieuDonThuocCt.PtramBhyt, objPhieuDonThuocCt.ChiDan, objPhieuDonThuocCt.CachDung, objPhieuDonThuocCt.ChiDanThem, objPhieuDonThuocCt.SoLanDung, objPhieuDonThuocCt.SoluongDung, objPhieuDonThuocCt.Ngaytao, objPhieuDonThuocCt.NguoiTao, objPhieuDonThuocCt.PresDetailId, objPhieuDonThuocCt.PresId); } } Scope.Complete(); return(ActionResult.Success); } } catch (Exception) { return(ActionResult.Error); throw; } }
/// <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; }