public void Init(KcbLuotkham objLuotkham, NoitruPhieudieutri objPhieudieutri) { this.objLuotkham = objLuotkham; this.objPhieudieutri = objPhieudieutri; LaydanhsachbacsiChidinh(); LaydanhSachKhoaNoitru(); txtMaBenhChinh.Init(globalVariables.gv_dtDmucBenh, new List<string>() { DmucBenh.Columns.IdBenh, DmucBenh.Columns.MaBenh, DmucBenh.Columns.TenBenh }); txtMaBenhphu.Init(globalVariables.gv_dtDmucBenh, new List<string>() { DmucBenh.Columns.IdBenh, DmucBenh.Columns.MaBenh, DmucBenh.Columns.TenBenh }); }
/// <summary> /// Lấy về thông tin bệnh nhân nội trú /// </summary> private void GetData() { try { objPhieudieutri = null; // Utility.SetMsg(lblMsg, "", false); string PatientCode =objLuotkham.MaLuotkham; malankham = PatientCode; long Patient_ID = objLuotkham.IdBenhnhan; objBenhnhan = KcbDanhsachBenhnhan.FetchByID(objLuotkham.IdBenhnhan); if (objLuotkham != null) { ClearControl(); DmucNhanvien objStaff = new Select().From(DmucNhanvien.Schema).Where(DmucNhanvien.UserNameColumn).IsEqualTo(Utility.sDbnull(objLuotkham.NguoiKetthuc, "")).ExecuteSingle<DmucNhanvien>(); string TenNhanvien = objLuotkham.NguoiKetthuc; if (objStaff != null) TenNhanvien = objStaff.TenNhanvien; pnlGoiDV.Enabled = true; pnlVTTH.Enabled = true; DataTable m_dtThongTin = _KCB_THAMKHAM.NoitruLaythongtinBenhnhan(objLuotkham.MaLuotkham, Utility.Int32Dbnull(objLuotkham.IdBenhnhan,-1)); if (m_dtThongTin.Rows.Count > 0) { DataRow dr = m_dtThongTin.Rows[0]; if (dr != null) { dtInput_Date.Value = Convert.ToDateTime(dr[KcbLuotkham.Columns.NgayTiepdon]); dtpNgaynhapvien.Value = objLuotkham.NgayNhapvien.Value; txtGioitinh.Text =objBenhnhan.GioiTinh; txtPatient_Name.Text = Utility.sDbnull(dr[KcbDanhsachBenhnhan.Columns.TenBenhnhan], ""); txtPatient_ID.Text = Utility.sDbnull(dr[KcbDanhsachBenhnhan.Columns.IdBenhnhan], ""); txtPatient_Code.Text = Utility.sDbnull(dr[KcbLuotkham.Columns.MaLuotkham], ""); barcode.Data = malankham; txtDiaChi.Text = Utility.sDbnull(dr[KcbDanhsachBenhnhan.Columns.DiaChi], ""); txtDiachiBHYT.Text = Utility.sDbnull(dr[KcbDanhsachBenhnhan.Columns.DiachiBhyt], ""); txtObjectType_Name.Text = Utility.sDbnull(dr[DmucDoituongkcb.Columns.TenDoituongKcb], ""); txtSoBHYT.Text = Utility.sDbnull(dr[KcbLuotkham.Columns.MatheBhyt], ""); txtBHTT.Text = Utility.sDbnull(dr[KcbLuotkham.Columns.PtramBhytGoc], "0"); dtpNgayhethanBHYT.Text = Utility.sDbnull(dr[KcbLuotkham.Columns.NgayketthucBhyt], globalVariables.SysDate.ToString("dd/MM/yyyy")); txtTuoi.Text = Utility.sDbnull(Utility.Int32Dbnull(globalVariables.SysDate.Year) - objBenhnhan.NgaySinh.Value.Year); txtKhoanoitru.Text = Utility.sDbnull(dr["ten_khoanoitru"], ""); txtBuong.Text = Utility.sDbnull(dr["ten_buong"], ""); txtGiuong.Text = Utility.sDbnull(dr["ten_giuong"], ""); LaydanhsachPhieudieutri(); LayLichsuBuongGiuong(); LayLichsuTamung(); TinhtoanTongchiphi(); } } } ModifyCommmands(); } catch { } finally { } }
void Selectionchanged() { try { if (Utility.isValidGrid(grdPhieudieutri)) { _CurIdPhieudieutri = Utility.Int32Dbnull(Utility.sDbnull(grdPhieudieutri.GetValue(NoitruPhieudieutri.Columns.IdPhieudieutri), -1), -1); txtIdPhieudieutri.Text = _CurIdPhieudieutri.ToString(); objPhieudieutri = NoitruPhieudieutri.FetchByID(_CurIdPhieudieutri); if (objPhieudieutri != null) { LaythongtinPhieudieutri(); } else { txtIdPhieudieutri.Text = "-1"; grdPresDetail.DataSource = null; grdAssignDetail.DataSource = null; grdVTTH.DataSource = null; } } else { txtIdPhieudieutri.Text = "-1"; grdPresDetail.DataSource = null; grdAssignDetail.DataSource = null; grdVTTH.DataSource = null; } } catch (Exception ex) { Utility.CatchException(ex); return; } finally { ModifyCommmands(); } }
public void Insert(string MaLuotkham,int? IdBenhnhan,short? IdBacsi,int? IdBuongGiuong,long? IdBuong,long? IdGiuong,short? IdKhoanoitru,string Thu,string ThongtinTheodoi,string ThongtinDieutri,DateTime? NgayDieutri,string GioDieutri,byte? TthaiBosung,byte? TthaiIn,byte? TrangThai,int? IdGoi,byte? TrongGoi,DateTime? NgayTao,string NguoiTao,DateTime? NgaySua,string NguoiSua,string IpMaytao,string IpMaysua,string TenMaytao,string TenMaysua) { NoitruPhieudieutri item = new NoitruPhieudieutri(); item.MaLuotkham = MaLuotkham; item.IdBenhnhan = IdBenhnhan; item.IdBacsi = IdBacsi; item.IdBuongGiuong = IdBuongGiuong; item.IdBuong = IdBuong; item.IdGiuong = IdGiuong; item.IdKhoanoitru = IdKhoanoitru; item.Thu = Thu; item.ThongtinTheodoi = ThongtinTheodoi; item.ThongtinDieutri = ThongtinDieutri; item.NgayDieutri = NgayDieutri; item.GioDieutri = GioDieutri; item.TthaiBosung = TthaiBosung; item.TthaiIn = TthaiIn; item.TrangThai = TrangThai; item.IdGoi = IdGoi; item.TrongGoi = TrongGoi; item.NgayTao = NgayTao; item.NguoiTao = NguoiTao; item.NgaySua = NgaySua; item.NguoiSua = NguoiSua; item.IpMaytao = IpMaytao; item.IpMaysua = IpMaysua; item.TenMaytao = TenMaytao; item.TenMaysua = TenMaysua; item.Save(UserName); }
public ActionResult ThemPhieudieutri(NoitruPhieudieutri objTreatment) { try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { if (objTreatment.IdPhieudieutri<=0) { objTreatment.NgaySua = null; objTreatment.NguoiSua = string.Empty; objTreatment.IsNew = true; objTreatment.Save(); } else { objTreatment.MarkOld(); objTreatment.IsNew = false; objTreatment.IsLoaded = true; objTreatment.Save(); new Update(KcbChidinhcl.Schema) .Set(KcbChidinhcl.Columns.NgayChidinh).EqualTo(objTreatment.NgayDieutri) .Where(KcbChidinhcl.Columns.IdDieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute(); new Update(KcbDonthuoc.Schema) .Set(KcbDonthuoc.Columns.NgayKedon).EqualTo(objTreatment.NgayDieutri) .Where(KcbDonthuoc.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute(); } new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.TrangthaiNoitru).EqualTo(2) .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objTreatment.IdBenhnhan) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objTreatment.MaLuotkham).Execute(); } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { log.Error("loi trong qua trinh tao phieu dieu tri: {0}", exception.ToString()); return ActionResult.Error; } }
public ActionResult SaoChepPhieuDieuTri(NoitruPhieudieutri[] lstPhieudieutri, KcbLuotkham objLuotkham, KcbChidinhclsChitiet[] arrChidinhCLSChitiet, KcbDonthuocChitiet[] arrDonthuocChitiet) { try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { foreach (NoitruPhieudieutri objTreatment in lstPhieudieutri) { objTreatment.NguoiTao = globalVariables.UserName; objTreatment.NgayTao = DateTime.Now; objTreatment.TthaiBosung = 0; objTreatment.IdBacsi = globalVariables.gv_intIDNhanvien; objTreatment.IdKhoanoitru = objLuotkham.IdKhoanoitru; objTreatment.MaLuotkham = objLuotkham.MaLuotkham; objTreatment.IdBenhnhan = objTreatment.IdBenhnhan; objTreatment.IdBuongGiuong = objLuotkham.IdRavien; objTreatment.TrangThai = 0; objTreatment.TthaiIn = 0; objTreatment.IpMaytao = globalVariables.gv_strIPAddress; objTreatment.TenMaytao = globalVariables.gv_strComputerName; objTreatment.GioDieutri = Utility.GetFormatDateTime(globalVariables.SysDate, "hh:mm:ss"); objTreatment.IsNew = true; objTreatment.Save(); if (arrChidinhCLSChitiet.Length > 0) { KcbChidinhcl objAssignInfo = new KcbChidinhcl(); objAssignInfo.IdDieutri = objTreatment.IdPhieudieutri; objAssignInfo.IdBuongGiuong = objTreatment.IdBuongGiuong; objAssignInfo.MaLuotkham = objTreatment.MaLuotkham; objAssignInfo.IdBenhnhan = Utility.Int32Dbnull(objTreatment.IdBenhnhan); objAssignInfo.IdBacsiChidinh = globalVariables.gv_intIDNhanvien; objAssignInfo.Noitru = 1; objAssignInfo.IdKhoadieutri = objTreatment.IdKhoanoitru; objAssignInfo.IdKhoaChidinh = objTreatment.IdKhoanoitru; objAssignInfo.IdKham=-1; objAssignInfo.IdDoituongKcb = objLuotkham.IdDoituongKcb; objAssignInfo.IdPhongChidinh = objTreatment.IdKhoanoitru; objAssignInfo.Barcode = string.Empty; objAssignInfo.NgayChidinh = objTreatment.NgayDieutri.Value; objAssignInfo.NguoiTao = globalVariables.UserName; objAssignInfo.NgayTao = globalVariables.SysDate; objAssignInfo.IpMaytao = globalVariables.gv_strIPAddress; objAssignInfo.TenMaytao = globalVariables.gv_strComputerName; objAssignInfo.MaChidinh = THU_VIEN_CHUNG.SinhMaChidinhCLS(); objAssignInfo.IsNew = true; objAssignInfo.Save(); List<KcbChidinhclsChitiet> lstChidinhCLSChitiet=new List<KcbChidinhclsChitiet>(); foreach (KcbChidinhclsChitiet objAssignDetail in arrChidinhCLSChitiet) { KcbChidinhclsChitiet objDetail = KcbChidinhclsChitiet.FetchByID(objAssignDetail.IdChitietchidinh); if (objDetail != null) { objDetail.IdChitietchidinh = -1; objDetail.IdChidinh = objAssignInfo.IdChidinh; objDetail.IdKham = -1; objDetail.TrangthaiThanhtoan = 0; objDetail.NgayThanhtoan = null; objDetail.TrangthaiHuy = 0; objDetail.ImgPath1 = string.Empty; objDetail.ImgPath2 = string.Empty; objDetail.ImgPath3 = string.Empty; objDetail.ImgPath4 = string.Empty; objDetail.TrangThai =0; //objDetail.MotaThem = null; objDetail.TrangthaiBhyt = 0; objDetail.IdThanhtoan = -1; objDetail.IdKhoaThuchien =(short) objAssignInfo.IdKhoadieutri; objDetail.IdPhongThuchien = objDetail.IdKhoaThuchien; objDetail.IdGoi = -1; objDetail.IdBacsiThuchien = -1; objDetail.NgayThuchien = null; objDetail.NguoiThuchien = null; //objDetail.KetLuan = null; objDetail.KetQua = null; //objDetail.DeNghi = null; //objDetail.MaVungkhaosat = null; objDetail.NguoiTao = globalVariables.UserName; objDetail.NgayTao = globalVariables.SysDate; objDetail.IpMaytao = globalVariables.gv_strIPAddress; objDetail.TenMaytao = globalVariables.gv_strComputerName; objDetail.IsNew=true; lstChidinhCLSChitiet.Add(objDetail); } new KCB_CHIDINH_CANLAMSANG().InsertAssignDetail(objAssignInfo, objLuotkham, lstChidinhCLSChitiet.ToArray<KcbChidinhclsChitiet>()); } } if (arrDonthuocChitiet.Length > 0) { var query = (from donthuoc in arrDonthuocChitiet.AsEnumerable() let y = donthuoc.IdDonthuoc select y).Distinct(); foreach (var pres_id in query.ToList()) { KcbDonthuoc objPresInfo = KcbDonthuoc.FetchByID(Utility.Int32Dbnull(pres_id)); if (objPresInfo != null) { objPresInfo.Noitru = 1; List<KcbDonthuocChitiet> lstDonthuocchitiet = (from donthuoc in arrDonthuocChitiet.AsEnumerable() where donthuoc.IdDonthuoc == pres_id select donthuoc).ToList<KcbDonthuocChitiet>(); SaoChepDonThuocTheoPhieuDieuTri(objPresInfo, objTreatment, lstDonthuocchitiet.ToArray<KcbDonthuocChitiet>()); } } } } } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { return ActionResult.Error; } }
public ActionResult SaoChepDonThuocTheoPhieuDieuTriFullTransaction(KcbDonthuoc objDonthuoc, NoitruPhieudieutri objTreatment,KcbDonthuocChitiet[] arrChitietdonthuoc) { try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { objDonthuoc.IdPhieudieutri = objTreatment.IdPhieudieutri; objDonthuoc.IdDonthuocthaythe = -1; objDonthuoc.IdKham = objTreatment.IdPhieudieutri; objDonthuoc.IdBacsiChidinh = objTreatment.IdBacsi; objDonthuoc.NgaySua = null; objDonthuoc.NguoiSua = null; objDonthuoc.NgayKedon = Convert.ToDateTime(objTreatment.NgayDieutri); objDonthuoc.Noitru = 1; NoitruPhanbuonggiuong objPatientDept = NoitruPhanbuonggiuong.FetchByID(objTreatment.IdBuongGiuong); if (objPatientDept != null) { objDonthuoc.IdKhoadieutri = Utility.Int16Dbnull(objPatientDept.IdKhoanoitru); objDonthuoc.IdBuongNoitru = Utility.Int16Dbnull(objPatientDept.IdBuong); objDonthuoc.IdGiuongNoitru = Utility.Int16Dbnull(objPatientDept.IdGiuong); } objDonthuoc.NgayXacnhan = null; objDonthuoc.NgayCapphat = null; objDonthuoc.DonthuocTaiquay = 0; objDonthuoc.TrangThai = 0; objDonthuoc.TrangthaiThanhtoan = 0; objDonthuoc.MaKhoaThuchien = globalVariables.MA_KHOA_THIEN; //objDonthuoc.IdBacsiChidinh = globalVariables.gv_intIDNhanvien; objDonthuoc.MotaThem = "Sao chép"; objDonthuoc.NguoiTao = globalVariables.UserName; objDonthuoc.NgayTao = globalVariables.SysDate; objDonthuoc.IpMaytao = globalVariables.gv_strIPAddress; objDonthuoc.TenMaytao = globalVariables.gv_strComputerName; objDonthuoc.IsNew = true; objDonthuoc.Save(); foreach (var objChitietdonthuoc in arrChitietdonthuoc) { KcbDonthuocChitiet newItem = KcbDonthuocChitiet.FetchByID(objChitietdonthuoc.IdChitietdonthuoc); newItem.IdKham = objTreatment.IdPhieudieutri; newItem.SoluongHuy = 0; newItem.NgayHuy = null; newItem.TrangthaiHuy = 0; newItem.NguoiHuy = null; newItem.TrangThai = 0; newItem.SluongLinh = 0; newItem.SluongSua = 0; newItem.NgayXacnhan = null; newItem.IdThanhtoan = -1; newItem.TrangthaiThanhtoan = 0; newItem.TrangthaiTonghop = 0; newItem.NgayThanhtoan = null; newItem.TrangthaiChuyen = 0; newItem.NgaySua = null; newItem.NguoiSua = null; newItem.TileChietkhau = 0; newItem.TienChietkhau = 0; newItem.IdGoi = -1; newItem.TrongGoi = 0; newItem.IdDonthuoc = Utility.Int32Dbnull(objDonthuoc.IdDonthuoc); newItem.NguoiTao = globalVariables.UserName; newItem.NgayTao = globalVariables.SysDate; newItem.IpMaytao = globalVariables.gv_strIPAddress; newItem.TenMaytao = globalVariables.gv_strComputerName; newItem.IsNew = true; newItem.Save(); } } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { return ActionResult.Error; } }
private void XoaPhieuDieuTri(int IdPhieudieutri) { try { if (!IsValidBeforeDelete(IdPhieudieutri)) return; ActionResult act = new noitru_phieudieutri().Xoaphieudieutri(new List<int>() { IdPhieudieutri }); switch (act) { case ActionResult.Success: grdPhieudieutri.CurrentRow.Delete(); grdPhieudieutri.UpdateData(); grdPhieudieutri.Refresh(); m_dtPhieudieutri.AcceptChanges(); Utility.SetMsg(lblMsg, "Xóa phiếu điều trị thành công", false); if (!Utility.isValidGrid(grdPhieudieutri)) { _CurIdPhieudieutri = -1; objPhieudieutri = null; } break; case ActionResult.Error: Utility.ShowMsg("Lỗi trong quá trình xóa thông tin", "Thông báo", MessageBoxIcon.Error); break; } } catch (Exception exception) { if (globalVariables.IsAdmin) { Utility.CatchException(exception); } } finally { grdPhieudieutri_SelectionChanged(grdPhieudieutri, new EventArgs()); ModifyCommandPhieudieutri(); ModifyCommmands(); } }
void Selectionchanged() { try { if (Utility.isValidGrid(grdPhieudieutri)) { _CurIdPhieudieutri = Utility.Int32Dbnull(Utility.sDbnull(grdPhieudieutri.GetValue(NoitruPhieudieutri.Columns.IdPhieudieutri), -1), -1); txtIdPhieudieutri.Text = _CurIdPhieudieutri.ToString(); objPhieudieutri = NoitruPhieudieutri.FetchByID(_CurIdPhieudieutri); if (objPhieudieutri != null) { dtpNgaylapphieu.Value = objPhieudieutri.NgayDieutri.Value; cboBSDieutri.SelectedIndex = Utility.GetSelectedIndex(cboBSDieutri, Utility.sDbnull(objPhieudieutri.IdBacsi, "-1")); BuildContextMenu(); LaythongtinPhieudieutri(); } else { txtIdPhieudieutri.Text = "-1"; grdPresDetail.DataSource = null; grdAssignDetail.DataSource = null; grdVTTH.DataSource = null; } } else { txtIdPhieudieutri.Text = "-1"; grdPresDetail.DataSource = null; grdAssignDetail.DataSource = null; grdVTTH.DataSource = null; } } catch (Exception ex) { Utility.CatchException(ex); return; } finally { ModifyCommandPhieudieutri(); ModifyCommmands(); } }
private void SearchPatient() { try { ClearControl(); malankham = ""; objPhieudieutri = null; objBenhnhan = null; objLuotkham = null; if (dt_ICD_PHU != null) dt_ICD_PHU.Clear(); if (m_dtAssignDetail != null) m_dtAssignDetail.Clear(); if (m_dtDonthuoc != null) m_dtDonthuoc.Clear(); DateTime dt_FormDate = dtFromDate.Value; DateTime dt_ToDate = dtToDate.Value; int Status = -1; int SoKham = -1; m_dtPatients = _KCB_THAMKHAM.NoitruTimkiembenhnhan(!chkByDate.Checked ? "01/01/1900" : dt_FormDate.ToString("dd/MM/yyyy"), !chkByDate.Checked ? "01/01/1900" : dt_ToDate.ToString("dd/MM/yyyy"), txtTenBN.Text, Status, Utility.DoTrim(txtMaluotkham.Text), Utility.Int32Dbnull(cboKhoanoitru.SelectedValue, -1), -1,chkChuyenkhoa.Checked?1:0); if (!m_dtPatients.Columns.Contains("MAUSAC")) m_dtPatients.Columns.Add("MAUSAC", typeof(int)); Utility.SetDataSourceForDataGridEx_Basic(grdPatientList, m_dtPatients, true, true, "", KcbDanhsachBenhnhan.Columns.TenBenhnhan); //"locked=0", ""); if (grdPatientList.GetDataRows().Length == 1) { grdPatientList.MoveFirst(); } if (!dt_ICD_PHU.Columns.Contains(DmucBenh.Columns.MaBenh)) { dt_ICD_PHU.Columns.Add(DmucBenh.Columns.MaBenh, typeof(string)); } if (!dt_ICD_PHU.Columns.Contains(DmucBenh.Columns.TenBenh)) { dt_ICD_PHU.Columns.Add(DmucBenh.Columns.TenBenh, typeof(string)); } grd_ICD.DataSource = dt_ICD_PHU; } catch (Exception ex) { Utility.CatchException(ex); } finally { ModifyCommmands(); ModifyCommandPhieudieutri(); } }
private void ThemPhieuDieuTri() { if (objPhieudieutri == null) objPhieudieutri = new NoitruPhieudieutri(); if (em_Action == action.Update) { objPhieudieutri.MarkOld(); objPhieudieutri.IsLoaded = true; objPhieudieutri.IsNew = false; objPhieudieutri.IdPhieudieutri = Utility.Int32Dbnull(txtTreat_ID.Text, -1); objPhieudieutri.NguoiSua = globalVariables.UserName; objPhieudieutri.NgaySua =globalVariables.SysDate; objPhieudieutri.TenMaysua = globalVariables.gv_strComputerName; objPhieudieutri.IpMaysua = globalVariables.gv_strIPAddress; } else { objPhieudieutri.TrangThai = 0; objPhieudieutri.IsNew = true; objPhieudieutri.TenMaytao = globalVariables.gv_strComputerName; objPhieudieutri.IpMaytao = globalVariables.gv_strIPAddress; objPhieudieutri.NguoiTao = globalVariables.UserName; objPhieudieutri.NgayTao = globalVariables.SysDate; objPhieudieutri.TthaiIn = 0; } objPhieudieutri.TthaiBosung =Utility.Bool2byte( chkPhieuBoSung.Checked); objPhieudieutri.IdPhieudieutri = Utility.Int32Dbnull(txtTreat_ID.Text, -1); objPhieudieutri.ThongtinDieutri = Utility.DoTrim(txtBstheodoi.Text); objPhieudieutri.ThongtinTheodoi = Utility.DoTrim(txtDieuduongtheodoi.Text); objPhieudieutri.NgayDieutri = dtNgayLapPhieu.Value.Date; objPhieudieutri.GioDieutri = dtGioLapPhieu.Text; objPhieudieutri.Thu = Utility.ConvertDayVietnamese(dtNgayLapPhieu.Value.DayOfWeek.ToString()); objPhieudieutri.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham, ""); objPhieudieutri.IdKhoanoitru = objBuongGiuong.IdKhoanoitru; objPhieudieutri.IdBuongGiuong =objBuongGiuong!=null? Utility.Int32Dbnull(objBuongGiuong.Id):-1; objPhieudieutri.IdBuong = objBuongGiuong != null ? Utility.Int32Dbnull(objBuongGiuong.IdBuong) : -1; objPhieudieutri.IdGiuong = objBuongGiuong != null ? Utility.Int32Dbnull(objBuongGiuong.IdGiuong) : -1; objPhieudieutri.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan, -1); objPhieudieutri.IdBuong = objLuotkham.IdBuong; objPhieudieutri.IdGiuong = objLuotkham.IdGiuong; if (cboBacSy.SelectedIndex > 0) objPhieudieutri.IdBacsi = Utility.Int16Dbnull(cboBacSy.SelectedValue); else { objPhieudieutri.IdBacsi = globalVariables.gv_intIDNhanvien; } ActionResult actionResult = new noitru_phieudieutri().ThemPhieudieutri(objPhieudieutri); switch (actionResult) { case ActionResult.Success: txtTreat_ID.Text = Utility.sDbnull(objPhieudieutri.IdPhieudieutri, -1); DataRow drv = p_TreatMent.NewRow(); Utility.FromObjectToDatarow(objPhieudieutri, ref drv); drv["sngay_dieutri"] = dtNgayLapPhieu.Value.ToString("dd/MM/yyyy"); if (cboBacSy.SelectedIndex > 0) { drv["ten_bacsidieutri"] = cboBacSy.Text; } p_TreatMent.Rows.Add(drv); Utility.GotoNewRowJanus(grdList, NoitruPhieudieutri.Columns.IdPhieudieutri, objPhieudieutri.IdPhieudieutri.ToString()); b_Cancel = true; Close(); break; case ActionResult.Error: Utility.ShowMsg("Lỗi trong quá trình thêm phiếu điều trị", "Thông báo lỗi", MessageBoxIcon.Error); break; } }
public ActionResult ThemPhieudieutri(NoitruPhieudieutri objTreatment) { try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { //if(Convert.ToDateTime(objTreatment.NgayLapPhieu)) SqlQuery sqlQuery = new Select().From(NoitruPhieudieutri.Schema) .Where(NoitruPhieudieutri.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri); if (sqlQuery.GetRecordCount() <= 0) { objTreatment.NgaySua = null; objTreatment.NguoiSua = string.Empty; objTreatment.IsNew = true; objTreatment.Save(); } else { objTreatment.TenMaysua = globalVariables.gv_strComputerName; objTreatment.IpMaysua = globalVariables.gv_strIPAddress; objTreatment.NgaySua = DateTime.Now; objTreatment.NguoiSua = globalVariables.UserName; objTreatment.MarkOld(); objTreatment.IsNew = false; objTreatment.IsLoaded = true; objTreatment.Save(); new Update(KcbChidinhcl.Schema) .Set(KcbChidinhcl.Columns.NgayChidinh).EqualTo(objTreatment.NgayDieutri) .Where(KcbChidinhcl.Columns.IdDieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute(); new Update(KcbDonthuoc.Schema) .Set(KcbDonthuoc.Columns.NgayKedon).EqualTo(objTreatment.NgayDieutri) .Where(KcbDonthuoc.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute(); } new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.TrangthaiNoitru).EqualTo(2) .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objTreatment.IdBenhnhan) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objTreatment.MaLuotkham).Execute(); } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { log.Error("loi trong qua trinh tao phieu dieu tri: {0}", exception.ToString()); return ActionResult.Error; } }
private NoitruPhieudieutri[] TaoPhieudieutriNoitru() { int idx = 0; NoitruPhieudieutri[] objPhieudieutri = new NoitruPhieudieutri[grdNgaysaochep.GetDataRows().Length]; foreach (GridEXRow ngaythang in grdNgaysaochep.GetDataRows()) { objPhieudieutri[idx]=new NoitruPhieudieutri(); objPhieudieutri[idx].MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham); objPhieudieutri[idx].IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan); objPhieudieutri[idx].NgayDieutri = Convert.ToDateTime(ngaythang.Cells[NoitruPhieudieutri.Columns.NgayDieutri].Value); objPhieudieutri[idx].TenMaytao = globalVariables.gv_strComputerName; objPhieudieutri[idx].IpMaytao = globalVariables.gv_strIPAddress; objPhieudieutri[idx].IdKhoanoitru = Utility.Int16Dbnull(cboKhoaHientai.SelectedValue, globalVariables.idKhoatheoMay); objPhieudieutri[idx].GioDieutri = Utility.GetValueFromGridColumn(ngaythang,NoitruPhieudieutri.Columns.GioDieutri) ;//; objPhieudieutri[idx].TthaiIn = 0; objPhieudieutri[idx].IdBacsi = globalVariables.gv_intIDNhanvien; objPhieudieutri[idx].Thu = Utility.ConvertDayVietnamese(Convert.ToDateTime(ngaythang.Cells[NoitruPhieudieutri.Columns.NgayDieutri].Value).DayOfWeek.ToString()); if (chkYlenh.Checked) { objPhieudieutri[idx].ThongtinTheodoi = Utility.GetValueFromGridColumn(grdPhieudieutrigoc, NoitruPhieudieutri.Columns.ThongtinTheodoi); objPhieudieutri[idx].ThongtinDieutri = Utility.GetValueFromGridColumn(grdPhieudieutrigoc, NoitruPhieudieutri.Columns.ThongtinDieutri); } idx++; // objPhieudieutri[idx]=new NoitruPhieudieutri(); } return objPhieudieutri; }
/// <summary> /// hàm thực hiện viec khởi tạo thong tin dữ liệu khi load form /// </summary> /// <param name="objPhieudieutri"></param> private void LaythongtinDichvutheoPhieudieutri(NoitruPhieudieutri objPhieudieutri) { if (grdPhieudieutrigoc.CurrentRow != null) { m_dtDataPhieuDT = new noitru_phieudieutri().NoitruLaydulieuClsThuocVtthSaochep(Utility.Int32Dbnull(objPhieudieutri.IdPhieudieutri, -1), Utility.Int32Dbnull(objPhieudieutri.IdBenhnhan, -1), Utility.sDbnull(objPhieudieutri.MaLuotkham, "")); Utility.SetDataSourceForDataGridEx(grdDichvuSaochep, m_dtDataPhieuDT, true, false, "", ""); grdDichvuSaochep.CheckAllRecords(); } else { m_dtDataPhieuDT.Clear(); m_dtDataPhieuDT.AcceptChanges(); } }