private void cmdXoaPhieuNhap_Click(object sender, EventArgs e) { if (!InValiXoaThongTin()) return; if (Utility.AcceptQuestion("Bạn có muốn xóa thông tin đơn thuốc đang chọn\n Nếu bạn chọn đơn thuốc sẽ xóa toàn bộ", "Thông báo", true)) { Pres_ID = Utility.Int32Dbnull(grdPres.GetValue(TPrescription.Columns.PresId)); ActionResult actionResult = new VietBaIT.HISLink.Business.Duoc.XuatThuoc.XuatThuoc().XoaThongTinThongTinDonThuoc(Pres_ID); switch (actionResult) { case ActionResult.Success: grdPres.CurrentRow.BeginEdit(); grdPres.CurrentRow.Delete(); grdPres.CurrentRow.EndEdit(); grdPres.UpdateData(); m_dtDataDonThuoc.AcceptChanges(); Utility.ShowMsg("Bạn xóa toàn bộ thông tin đơn thuốc thành công", "Thông báo", MessageBoxIcon.Information); ModifyCommnad(); break; case ActionResult.Error: Utility.ShowMsg("Có lỗi trong quá trình xóa thông tin đơn thuốc", "Thông báo", MessageBoxIcon.Error); break; } } }
/// <summary> /// hàm thực hiện việc cập nhập thông tin theo đơn thuốc /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdPhatThuoc_Click(object sender, EventArgs e) { Utility.SetMsg(lblmsg, "", false); if(HisDuocProperties.KieuDuyetDonThuoc=="DONTHUOC") { if (!InValiDonthuoc()) return; } try { if (!InValiKiemTraDonThuoc()) return; //if(Utility.AcceptQuestion("Bạn có muốn thực hiện việc xác nhận lĩnh thuốc cho bệnh nhân không\n Nếu bạn xác nhận thuốc sẽ trừ vào kho mà bạn đang chọn","thông báo",true)) //{ Utility.EnableButton(cmdPhatThuoc, false); HasXacNhap = true; if(!HasXacNhap)return; int Pres_ID = Utility.Int32Dbnull(grdPres.GetValue(TPrescription.Columns.PresId), -1); TPrescription objPrescription = TPrescription.FetchByID(Pres_ID); if(HisDuocProperties.PhatThuocTrongNgay) { if ((objPrescription.CreatedDate.Date != BusinessHelper.GetSysDateTime().Date)) { if(!Utility.AcceptQuestion("Đơn thuốc được kê khác ngày hiện tại, BẠN CÓ MUỐN PHÁT THUỐC(nhấn Yes)\n Nếu không phát thuốc: yêu cầu bệnh nhân hủy phơi và kê lại đơn thuốc khác(Nhấn No)!","Cảnh báo",true)) return; } } DPhieuXuatBnhan objXuatBnhan = CreatePhieuXuatBenhNhan(objPrescription); dtNgayPhatThuoc.Value = BusinessHelper.GetSysDateTime(); objXuatBnhan.NgayXuatBn = dtNgayPhatThuoc.Value; TPatientExam objPatientExam = createPatientExam(objPrescription); if (objPatientExam != null) { ActionResult actionResult = new VietBaIT.HISLink.Business.Duoc.XuatThuoc.XuatThuoc().LinhThuocBenhNhan(objPrescription, objPatientExam, CreatePresDetail(), objXuatBnhan); switch (actionResult) { case ActionResult.Success: UpdateHasConfirm(); HasXacNhap = false; Utility.SetMsg(lblmsg, "Bạn thực hiện việc phát thuốc thành công", true); Utility.EnableButton(cmdPhatThuoc, true); break; case ActionResult.Error: Utility.ShowMsg("Lỗi trong quá trình phát thuốc cho bệnh nhân", "Thông báo",MessageBoxIcon.Error); break; case ActionResult.PresIsConfirmed: Utility.ShowMsg("Đơn thuốc này đã được cấp phát,Mời bạn chọn đơn thuốc lại hoặc nhần F5 để lấy lại dữ liệu","Thông báo",MessageBoxIcon.Warning); break; } } //} } catch (Exception) { HasXacNhap = false; } finally { ModifyCommnad(); HasXacNhap = false; Utility.EnableButton(cmdPhatThuoc, true); } }
/// <summary> /// hàm thực hiện việc xóa thông tin đơn thuốc chi tiét /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdXoaChiTietThuoc_Click(object sender, EventArgs e) { if (!InValiXoaChiTiet())return; if(Utility.AcceptQuestion("Bạn có muốn thực hiện xóa thông tin chi tiết của đơn thuốc","Thông báo xóa",true)) { Pres_ID = Utility.Int32Dbnull(grdPres.GetValue(TPrescription.Columns.PresId)); var query = from donthuoc in grdPresDetail.GetDataRows() let y = donthuoc.Cells[TPrescriptionDetail.Columns.PresDetailId].Value select y; ArrayList arrayList=new ArrayList(); Array array = query.ToArray(); arrayList.AddRange(array); ActionResult actionResult = new VietBaIT.HISLink.Business.Duoc.XuatThuoc.XuatThuoc().XoaThongTinChiTietDonThuoc(arrayList, Pres_ID); switch (actionResult) { case ActionResult.Success: foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdPresDetail.GetCheckedRows()) { gridExRow.Delete(); grdPresDetail.UpdateData(); m_dtDataPresDetail.AcceptChanges(); } Utility.ShowMsg("Bạn xóa thông tin chi tiết đơn thuốc thành công","Thông báo",MessageBoxIcon.Information); ModifyCommnad(); break; case ActionResult.Error: Utility.ShowMsg("Có lỗi trong quá trình xóa thông tin chi tiết","Thông báo",MessageBoxIcon.Error); break; } } }
/// <summary> /// hàm thực hiện việc hủy thông tin đơn thuốc /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdHuyDonThuoc_Click(object sender, EventArgs e) { if (Utility.AcceptQuestion("Bạn có muốn thực hiện hủy phát thuốc cho bệnh nhân \n Dữ liệu hủy sẽ được trả lại kho phát thuốc", "Thông báo", true)) { if (HisDuocProperties.KieuDuyetDonThuoc == "DONTHUOC") { if (!InValiHuyDonthuoc()) return; } int Pres_ID = Utility.Int32Dbnull(grdPres.GetValue(TPrescription.Columns.PresId), -1); DPhieuXuatBnhan chot = new Select().From(DPhieuXuatBnhan.Schema).Where(DPhieuXuatBnhan.IdDonThuocColumn).IsEqualTo(Pres_ID).And(DPhieuXuatBnhan.IdChotColumn).IsGreaterThan(0).And (DPhieuXuatBnhan.NgayChotColumn).IsNotNull().ExecuteSingle<DPhieuXuatBnhan>(); if(chot != null) { Utility.ShowMsg("Đơn thuốc đã chốt bạn không thể hủy xác nhận", "thông báo", MessageBoxIcon.Information); return; } TPrescription objPrescription = TPrescription.FetchByID(Pres_ID); dtNgayPhatThuoc.Value = BusinessHelper.GetSysDateTime(); ActionResult actionResult = new VietBaIT.HISLink.Business.Duoc.XuatThuoc.XuatThuoc().HuyXacNhanDonThuocBN(objPrescription, CreatePresDetail()); switch (actionResult) { case ActionResult.Success: UpdateHuyHasConfirm(); Utility.ShowMsg("Bạn thực hiện việc hủy phát thuốc thành công", "thông báo", MessageBoxIcon.Information); break; case ActionResult.Error: Utility.ShowMsg("Lỗi trong quá trình hủy phát thuốc cho bệnh nhân", "Thông báo", MessageBoxIcon.Error); break; } } }