public ActionResult AddNewPatientExam(KcbDanhsachBenhnhan objPatientInfo, KcbLuotkham objLuotkham, KcbDangkyKcb objRegExam, int KieuKham) { try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { UpdatePatientInfo(objPatientInfo); SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham); if (sqlQueryPatientExam.GetRecordCount() > 0)//Nếu BN khác đã lấy mã này { objLuotkham.MaLuotkham = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM(); } objLuotkham.IsNew = true; objLuotkham.Save(); if (objLuotkham.TrangthaiNoitru >= 1) { SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema).Where( KcbLuotkham.Columns.MaLuotkham).IsNotEqualTo(objLuotkham.MaLuotkham) .And(KcbLuotkham.Columns.SoBenhAn).IsEqualTo(objLuotkham.SoBenhAn) .And(KcbLuotkham.Columns.TrangthaiNoitru).IsGreaterThanOrEqualTo(1); if (sqlQuery.GetRecordCount() > 0) { var query = new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.SoBenhAn).EqualTo(THU_VIEN_CHUNG.LaySoBenhAn()) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham). Execute(); } } if (objRegExam != null) { objRegExam.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham); objRegExam.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan); AddRegExam(objRegExam,objLuotkham, false, KieuKham); } scope.Complete(); return ActionResult.Success; } } } catch (Exception ex) { return ActionResult.Error; } }
public ActionResult ThemDonThuoc(KcbDanhsachBenhnhan objBenhnhan, KcbDonthuoc objDonthuoc, KcbDonthuocChitiet[] arrDonthuocChitiet, ref int p_intIdDonthuoc, ref Dictionary <long, long> lstChitietDonthuoc) { try { using (TransactionScope scope = new TransactionScope()) { using (SharedDbConnectionScope sh = new SharedDbConnectionScope()) { objBenhnhan.Save(); if (objBenhnhan != null) { if (objDonthuoc.NgayKedon <= Convert.ToDateTime("01/01/1900")) { objDonthuoc.NgayKedon = globalVariables.SysDate; } objDonthuoc.IdBenhnhan = objBenhnhan.IdBenhnhan; objDonthuoc.MaLuotkham = ""; objDonthuoc.IdKham = -1; objDonthuoc.IsNew = true; objDonthuoc.TenDonthuoc = ""; objDonthuoc.Save(); p_intIdDonthuoc = objDonthuoc.IdDonthuoc; decimal PtramBH = 0; foreach (KcbDonthuocChitiet objDonthuocChitiet in arrDonthuocChitiet) { objDonthuocChitiet.IdKham = objDonthuoc.IdKham; objDonthuocChitiet.MaLuotkham = objDonthuoc.MaLuotkham; objDonthuocChitiet.IdBenhnhan = objDonthuoc.IdBenhnhan; objDonthuocChitiet.IdDonthuoc = objDonthuoc.IdDonthuoc; objDonthuocChitiet.IsNew = true; objDonthuocChitiet.Save(); if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value)) { lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc); } } } } scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { Utility.CatchException(exception); log.Error("Loi trong qua trinh luu don thuoc {0}", exception); return(ActionResult.Error); } }
private void BindData() { SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaLanKham.Text); if (sqlQuery.GetRecordCount() > 0) { objLuotkham = sqlQuery.ExecuteSingle <KcbLuotkham>(); if (objLuotkham != null) { txtMaLanKham.Text = Utility.sDbnull(objLuotkham.MaLuotkham); txtSoBHYT.Text = Utility.sDbnull(objLuotkham.MatheBhyt); DmucKhoaphong objDmucKhoaphong = DmucKhoaphong.FetchByID(objLuotkham.IdKhoanoitru); if (objDmucKhoaphong != null) { txtDepartmentName.Tag = Utility.sDbnull(objDmucKhoaphong.IdKhoaphong); txtDepartment_ID.Text = Utility.sDbnull(objDmucKhoaphong.IdKhoaphong); txtDepartmentName.Text = Utility.sDbnull(objDmucKhoaphong.TenKhoaphong); } KcbDanhsachBenhnhan objPatientInfo = KcbDanhsachBenhnhan.FetchByID(objLuotkham.IdBenhnhan); if (objPatientInfo != null) { txtPatient_Name.Text = Utility.sDbnull(objPatientInfo.TenBenhnhan); txtPatient_ID.Text = Utility.sDbnull(objLuotkham.IdBenhnhan); txtNamSinh.Text = Utility.sDbnull(objPatientInfo.NamSinh); txtTuoi.Text = Utility.sDbnull(DateTime.Now.Year - objPatientInfo.NamSinh); txtPatientSex.Text = objPatientInfo.GioiTinh;// Utility.Int32Dbnull(objPatientInfo.PatientSex) == 0 ? "Nam" : "Nữ"; } objPhanbuonggiuong = NoitruPhanbuonggiuong.FetchByID(objLuotkham.IdRavien); dtNgayvao.Value = objPhanbuonggiuong.NgayVaokhoa; if (objPhanbuonggiuong != null) { txtPatientDept_ID.Text = Utility.sDbnull(objPhanbuonggiuong.Id); NoitruDmucBuong objRoom = NoitruDmucBuong.FetchByID(objPhanbuonggiuong.IdBuong); if (objRoom != null) { txtSoPhong.Text = Utility.sDbnull(objRoom.TenBuong); txtSoPhong.Tag = Utility.sDbnull(objPhanbuonggiuong.IdBuong); } NoitruDmucGiuongbenh objNoitruDmucGiuongbenh = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong); if (objNoitruDmucGiuongbenh != null) { txtSoGiuong.Text = Utility.sDbnull(objNoitruDmucGiuongbenh.TenGiuong); txtSoGiuong.Tag = Utility.sDbnull(objPhanbuonggiuong.IdGiuong); } } } } ModifyCommand(); }
private void SearchPatient() { try { ClearControl(); _malankham = ""; _objkcbdangky = null; ObjBenhnhan = null; ObjLuotkham = null; if (_dtIcdPhu != null) { _dtIcdPhu.Clear(); } if (_mDtAssignDetail != null) { _mDtAssignDetail.Clear(); } if (_mDtPresDetail != null) { _mDtPresDetail.Clear(); } _mDtDanhsachbenhnhanthamkham = _kcbThamkham.KcbLichsuKcbTimkiemBenhnhan(dtFromDate.Value, dtToDate.Value, Utility.DoTrim(txtmaluotkham.Text), Utility.Int32Dbnull(txtIdBenhnhan.Text, -1), Utility.DoTrim(txtTenBN.Text), Utility.DoTrim(txtTheBHYT.Text), Utility.Int32Dbnull(txtBacsikham.MyID, -1), _thamso); Utility.SetDataSourceForDataGridEx_Basic(grdList, _mDtDanhsachbenhnhanthamkham, true, true, "", KcbDanhsachBenhnhan.Columns.TenBenhnhan); if (_dtIcdPhu != null && !_dtIcdPhu.Columns.Contains(DmucBenh.Columns.MaBenh)) { _dtIcdPhu.Columns.Add(DmucBenh.Columns.MaBenh, typeof(string)); } if (_dtIcdPhu != null && !_dtIcdPhu.Columns.Contains(DmucBenh.Columns.TenBenh)) { _dtIcdPhu.Columns.Add(DmucBenh.Columns.TenBenh, typeof(string)); } grd_ICD.DataSource = _dtIcdPhu; grdList.MoveFirst(); } catch (Exception ex) { Utility.CatchException(ex); } }
public TPhieuXuatthuocBenhnhan CreatePhieuXuatBenhNhan(KcbDonthuoc objDonthuoc, KcbDanhsachBenhnhan objBenhnhan, KcbLuotkham objLuotkham) { TPhieuXuatthuocBenhnhan objPhieuXuatBnhan = new TPhieuXuatthuocBenhnhan(); objPhieuXuatBnhan.IdBenhnhan = objDonthuoc.IdBenhnhan; objPhieuXuatBnhan.MaLuotkham = objDonthuoc.MaLuotkham; objPhieuXuatBnhan.NgayXacnhan = globalVariables.SysDate; objPhieuXuatBnhan.IdPhongChidinh = Utility.Int16Dbnull(objDonthuoc.IdPhongkham); objPhieuXuatBnhan.IdKhoaChidinh = Utility.Int16Dbnull(objDonthuoc.IdKhoadieutri); objPhieuXuatBnhan.IdBacsiKedon = Utility.Int16Dbnull(objDonthuoc.IdBacsiChidinh); objPhieuXuatBnhan.IdDonthuoc = Utility.Int32Dbnull(objDonthuoc.IdDonthuoc); objPhieuXuatBnhan.IdNhanvien = globalVariables.gv_intIDNhanvien; //objPhieuXuatBnhan.HienThi = 1; if (objLuotkham != null) { objPhieuXuatBnhan.ChanDoan = Utility.sDbnull(objLuotkham.ChanDoan); objPhieuXuatBnhan.MabenhChinh = Utility.sDbnull(objLuotkham.MabenhChinh); objPhieuXuatBnhan.IdDoituongKcb = Utility.Int16Dbnull(objLuotkham.IdDoituongKcb); objPhieuXuatBnhan.MaDoituongKcb = objLuotkham.MaDoituongKcb; objPhieuXuatBnhan.MatheBhyt = Utility.sDbnull(objLuotkham.MatheBhyt); } else//Đơn thuốc tại quầy thì objLuotkham=null; { objPhieuXuatBnhan.ChanDoan = ""; objPhieuXuatBnhan.MabenhChinh = ""; objPhieuXuatBnhan.IdDoituongKcb = -1; objPhieuXuatBnhan.MaDoituongKcb = "DV"; objPhieuXuatBnhan.MatheBhyt = ""; } objPhieuXuatBnhan.GioiTinh = objBenhnhan.GioiTinh; objPhieuXuatBnhan.KieuThuocvattu = objDonthuoc.KieuThuocvattu; objPhieuXuatBnhan.TenBenhnhan = Utility.sDbnull(objBenhnhan.TenBenhnhan); objPhieuXuatBnhan.TenKhongdau = Utility.sDbnull(Utility.UnSignedCharacter(objBenhnhan.TenBenhnhan)); objPhieuXuatBnhan.DiaChi = Utility.sDbnull(objBenhnhan.DiaChi); objPhieuXuatBnhan.NamSinh = Utility.Int32Dbnull(objBenhnhan.NamSinh); objPhieuXuatBnhan.NgayKedon = objDonthuoc.NgayKedon; objPhieuXuatBnhan.NgayTao = globalVariables.SysDate; objPhieuXuatBnhan.NguoiTao = objDonthuoc.NguoiTao;//Dùng cho báo cáo kê đơn theo bác sĩ(trạng thái đã cấp phát để biết người tạo là Admin) objPhieuXuatBnhan.NguoiPhatthuoc = globalVariables.UserName; objPhieuXuatBnhan.QuayThuoc = (byte)(objDonthuoc.KieuDonthuoc == 2 ? 1 : 0);//0= Đơn thuốc thường;1= Đơn thuốc bổ sung;2=Đơn thuốc tại quầy;3=Đơn tiêm chủng objPhieuXuatBnhan.Noitru = objDonthuoc.Noitru; objPhieuXuatBnhan.LoaiPhieu = (byte?)LoaiPhieu.PhieuXuatKhoBenhNhan; return objPhieuXuatBnhan; }
/// <summary> /// HAM THUC HIEN HIEN THEM LAN KHAM CUA BENH NHAN /// </summary> /// <param name="objPatientInfo"></param> /// <param name="objLuotkham"></param> /// <returns></returns> public ActionResult AddNewPatientExam(KcbDanhsachBenhnhan objPatientInfo, KcbLuotkham objLuotkham, ref string MaLuotkham) { try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { UpdatePatientInfo(objPatientInfo); SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham); if (sqlQueryPatientExam.GetRecordCount() > 0) { objLuotkham.MaLuotkham = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM(); } objLuotkham.IsNew = true; objLuotkham.Save(); if (objLuotkham.TrangthaiNoitru >= 1) { SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema).Where( KcbLuotkham.Columns.MaLuotkham).IsNotEqualTo(objLuotkham.MaLuotkham) .And(KcbLuotkham.Columns.SoBenhAn).IsEqualTo(objLuotkham.SoBenhAn) .And(KcbLuotkham.Columns.TrangthaiNoitru).IsGreaterThanOrEqualTo(1); if (sqlQuery.GetRecordCount() > 0) { new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.SoBenhAn).EqualTo(THU_VIEN_CHUNG.LaySoBenhAn()) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham). Execute(); } } log.Info("Them moi lan kham cho benh nhan Patient_Code=" + objLuotkham.MaLuotkham); //if (!string.IsNullOrEmpty(patientDept.MaLuotkham)) //{ // if (objLuotkham.DepartmentId != -1) // { // patientDept.MaLuotkham = objLuotkham.MaLuotkham; // patientDept.IdBenhnhan = objPatientInfo.IdBenhnhan; // SqlQuery q = new Select().From(TPatientDept.Schema) // .Where(TPatientDept.Columns.DepartmentId).IsEqualTo(objLuotkham.DepartmentId) // .And(TPatientDept.Columns.MaLuotkham).IsEqualTo(patientDept.MaLuotkham) // .And(TPatientDept.Columns.IdBenhnhan).IsEqualTo(patientDept.IdBenhnhan) // .And(TPatientDept.Columns.Noitru).IsEqualTo(1); // if (q.GetRecordCount() <= 0) // { // log.Info("them moi thong tin cua khoa phong Department_ID=" + patientDept.DepartmentId); // patientDept.TrangThai = 0; // patientDept.IsNew = true; // patientDept.Save(); // } // else // { // new Update(TPatientDept.Schema) // .Set(TPatientDept.Columns.DepartmentId).EqualTo(patientDept.DepartmentId) // .Set(TPatientDept.Columns.NguoiSua).EqualTo(patientDept.NguoiSua) // .Set(TPatientDept.Columns.NgaySua).EqualTo(patientDept.NgaySua) // .Where(TPatientDept.Columns.MaLuotkham).IsEqualTo(patientDept.MaLuotkham) // .And(TPatientDept.Columns.IdBenhnhan).IsEqualTo(patientDept.IdBenhnhan) // .And(TPatientDept.Columns.DepartmentId).IsEqualTo(objLuotkham.DepartmentId) // .Execute(); // } // } //} MaLuotkham = objLuotkham.MaLuotkham; scope.Complete(); return ActionResult.Success; } } } catch (Exception ex) { return ActionResult.Error; } }
public static ActionResult Thembenhnhan(KcbDanhsachBenhnhan objdanhsachbenhnhan, KcbLuotkham objluotkham, KcbChidinhcl objchidinh, KcbDangkyKcb objDangkyKcb, KcbChidinhclsChitiet[] objchidinhchitiet, ref string errMsg) { Logger log = LogManager.GetCurrentClassLogger(); try { var option = new TransactionOptions { IsolationLevel = IsolationLevel.Snapshot, Timeout = TimeSpan.FromMinutes(5) }; using (var trans = new TransactionScope()) { using (var shs = new SharedDbConnectionScope()) { log.Trace("1.Bắt đầu thêm mới bệnh nhân " + objdanhsachbenhnhan.TenBenhnhan + ""); string PatientCode = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM( (byte)(Utility.Int16Dbnull(objdanhsachbenhnhan.KieuBenhnhan, 1))); // Them moi thong tin benh nhan SqlQuery objdbenhnhan = new Select().From(KcbDanhsachBenhnhan.Schema) .Where(KcbDanhsachBenhnhan.Columns.IdBenhnhan).IsEqualTo(objdanhsachbenhnhan.IdBenhnhan); if (objdbenhnhan.GetRecordCount() > 0) { objdanhsachbenhnhan.MarkOld(); objdanhsachbenhnhan.IsLoaded = true; } else { objdanhsachbenhnhan.IsNew = true; } objdanhsachbenhnhan.Save(); log.Trace("2. Đã thêm mới Bệnh nhân"); // them moi lan kham cho benh nhan objluotkham.MaLuotkham = Utility.sDbnull(PatientCode, ""); SqlQuery sqlPatientExam = new Select().From(KcbLuotkham.Schema).Where( KcbLuotkham.Columns.MaLuotkham) .IsEqualTo(objluotkham.MaLuotkham); if (sqlPatientExam.GetRecordCount() > 0) { objluotkham.MarkOld(); objluotkham.IsLoaded = true; } else { objluotkham.IsNew = true; objluotkham.MaLuotkham = PatientCode; objluotkham.IdBenhnhan = objdanhsachbenhnhan.IdBenhnhan; } objluotkham.Save(); log.Trace("3. Đã thêm mới Lượt khám Bệnh nhân"); DataTable dtCheck = SPs.SpKcbKiemtraTrungMaLuotkham(objluotkham.IdBenhnhan, objluotkham.MaLuotkham). GetDataSet().Tables[0]; if (dtCheck != null && dtCheck.Rows.Count > 0) { log.Trace("3.1 Đã phát hiện trùng mã Bệnh nhân-->Lấy lại mã mới"); string patientCode = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM( (byte)(Utility.Int16Dbnull(objdanhsachbenhnhan.KieuBenhnhan, 1))); SPs.SpKcbCapnhatLuotkhamMaluotkham(patientCode, objluotkham.MaLuotkham, objluotkham.IdBenhnhan).Execute(); log.Trace("3.2 Cập nhập mã lượt khám này được sử dụng rồi"); // SPs.SpKcbCapnhatMaluotkhamLichsudoituongKcb(patientCode, objLichsuKcb.IdLichsuDoituongKcb).Execute(); // log.Trace("3.2 Đã Cập nhật lại mã lượt khám mới"); objluotkham.MaLuotkham = patientCode; } SPs.SpKcbCapnhatDmucLuotkham(objluotkham.MaLuotkham, (byte)(Utility.Int16Dbnull(objdanhsachbenhnhan.KieuBenhnhan, 1)), 1, 2, globalVariables.UserName).Execute(); log.Trace("4. Đã đánh dấu mã lượt khám đã được sử dụng trong hệ thống"); // Them moi thong tin chi dinh cho benh nhan if (objDangkyKcb != null) { SqlQuery sqldangkykcb = new Select().From(KcbDangkyKcb.Schema).Where( KcbDangkyKcb.Columns.IdKham) .IsEqualTo(Utility.Int64Dbnull(objDangkyKcb.IdKham, -1)); if (sqldangkykcb.GetRecordCount() > 0) { objDangkyKcb.MarkOld(); objDangkyKcb.IsLoaded = true; } else { objDangkyKcb.IsNew = true; objDangkyKcb.MaLuotkham = PatientCode; objDangkyKcb.IdBenhnhan = objdanhsachbenhnhan.IdBenhnhan; } objDangkyKcb.Save(); } SqlQuery sqlAssignInfo = new Select().From(KcbChidinhcl.Schema) .Where(KcbChidinhcl.Columns.IdChidinh).IsEqualTo(objchidinh.IdChidinh); if (objDangkyKcb != null) { objchidinh.IdKham = objDangkyKcb.IdKham; } objchidinh.IdDoituongKcb = 3; objchidinh.MaDoituongKcb = "KSK"; objchidinh.IdLoaidoituongKcb = 2; if (sqlAssignInfo.GetRecordCount() > 0) { objchidinh.MarkOld(); objchidinh.IsLoaded = true; } else { objchidinh.IsNew = true; objchidinh.MaChidinh = THU_VIEN_CHUNG.SinhMaChidinhCLSKSK(); } objchidinh.IdBenhnhan = objluotkham.IdBenhnhan; objchidinh.MaLuotkham = objluotkham.MaLuotkham; objchidinh.NguoiSua = globalVariables.UserName; objchidinh.NgaySua = DateTime.Now; if (string.IsNullOrEmpty(objchidinh.MaKhoaChidinh)) { objchidinh.MaKhoaChidinh = Utility.sDbnull(objluotkham.MaKhoaThuchien); } objchidinh.Save(); log.Trace("5. Đã thêm mới phiếu chỉ định cho bệnh nhân"); if (Utility.Int32Dbnull(objchidinh.IdChidinh) > 0) { foreach (KcbChidinhclsChitiet objAssignDetail in objchidinhchitiet) { // Them chi tiet chi dinh cho benh nhan SqlQuery sqlAssignDetail = new Select().From(KcbChidinhclsChitiet.Schema) .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo( objAssignDetail.IdChitietchidinh); if (sqlAssignDetail.GetRecordCount() > 0) { objAssignDetail.MarkOld(); objAssignDetail.IsLoaded = true; } else { objAssignDetail.IsNew = true; } objAssignDetail.IdDoituongKcb = Utility.Int16Dbnull(objluotkham.IdDoituongKcb); objAssignDetail.MaLuotkham = objchidinh.MaLuotkham; objAssignDetail.IdBenhnhan = objchidinh.IdBenhnhan; objAssignDetail.IdKham = objchidinh.IdKham; objAssignDetail.IdChidinh = Utility.Int32Dbnull(objchidinh.IdChidinh); // objAssignDetail.IdKham = -1; objAssignDetail.IpMaytao = globalVariables.gv_strIPAddress; objAssignDetail.PtramBhyt = Utility.DecimaltoDbnull(objluotkham.PtramBhyt); objAssignDetail.IdBacsiThuchien = globalVariables.IdKhoaNhanvien; // objAssignDetail.IsNew = true; objAssignDetail.Save(); log.Info( "Them moi thong tin cua phieu chi dinh chi tiet voi ma phieu Assign_ID=" + objchidinh.IdChidinh); } log.Trace("6. Đã thêm mới chi tiết phiếu chỉ định cho bệnh nhân"); } else { log.Trace("7. Lỗi thêm bệnh nhân vào hệ thống"); return(ActionResult.Error); } } trans.Complete(); log.Trace("8. Thêm bệnh nhân có ID_Benhnhan " + objdanhsachbenhnhan.IdBenhnhan + " vào hệ thống thành công"); errMsg = @"Thêm mới thành công bệnh nhân"; return(ActionResult.Success); } } catch (Exception ex) { errMsg = "Lỗi thêm mới bệnh nhân : " + ex.Message; log.Error(ex.Message); return(ActionResult.Error); } }
public ActionResult UpdateLanKham(KcbDanhsachBenhnhan objPatientInfo, KcbLuotkham objLuotkham, KcbDangkyKcb objRegExam, int KieuKham, decimal PtramBhytCu, decimal PtramBhytgoc ) { ActionResult _ActionResult = ActionResult.Success; try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { SqlQuery query = new Select().From(KcbLuotkham.Schema).Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo( objLuotkham.MaLuotkham).And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo( objLuotkham.IdBenhnhan); KcbLuotkham objExam = query.ExecuteSingle<KcbLuotkham>(); UpdatePatientInfo(objPatientInfo); //decimal PtramBHYT = THU_VIEN_CHUNG.TinhPtramBHYT(objLuotkham); //if (PtramBHYT != Utility.DecimaltoDbnull(objLuotkham.PtramBhyt)) //{ // objLuotkham.PtramBhyt = PtramBHYT; //} objLuotkham.MarkOld(); objLuotkham.IsNew = false; objLuotkham.Save(); //int recordExam = new Update(KcbLuotkham.Schema) // .Set(KcbLuotkham.Columns.NguoiLienhe).EqualTo(objLuotkham.NguoiLienhe) // .Set(KcbLuotkham.Columns.TrangthaiCapcuu).EqualTo(objLuotkham.TrangthaiCapcuu) // .Set(KcbLuotkham.Columns.LuongCoban).EqualTo(objLuotkham.LuongCoban) // .Set(KcbLuotkham.Columns.TthaiChuyendi).EqualTo(objLuotkham.TthaiChuyendi) // .Set(KcbLuotkham.Columns.DienthoaiLienhe).EqualTo(objLuotkham.DienthoaiLienhe) // .Set(KcbLuotkham.Columns.DiachiLienhe).EqualTo(objLuotkham.DiachiLienhe) // .Set(KcbLuotkham.Columns.TrieuChung).EqualTo(objLuotkham.TrieuChung) // .Set(KcbLuotkham.Columns.MatheBhyt).EqualTo(objLuotkham.MatheBhyt) // .Set(KcbLuotkham.Columns.MaNoicapBhyt).EqualTo(objLuotkham.MaNoicapBhyt) // .Set(KcbLuotkham.Columns.MaQuyenloi).EqualTo(objLuotkham.MaQuyenloi) // .Set(KcbLuotkham.Columns.NgaybatdauBhyt).EqualTo(objLuotkham.NgaybatdauBhyt) // .Set(KcbLuotkham.Columns.NgayketthucBhyt).EqualTo(objLuotkham.NgayketthucBhyt) // .Set(KcbLuotkham.Columns.NoicapBhyt).EqualTo(objLuotkham.NoicapBhyt) // .Set(KcbLuotkham.Columns.IdDoituongKcb).EqualTo(objLuotkham.IdDoituongKcb) // .Set(KcbLuotkham.Columns.IdLoaidoituongKcb).EqualTo(objLuotkham.IdLoaidoituongKcb) // .Set(KcbLuotkham.Columns.TrangthaiNgoaitru).EqualTo(objLuotkham.TrangthaiNgoaitru) // .Set(KcbLuotkham.Columns.MaKcbbd).EqualTo(objLuotkham.MaKcbbd) // .Set(KcbLuotkham.Columns.NoiDongtrusoKcbbd).EqualTo(objLuotkham.NoiDongtrusoKcbbd) // .Set(KcbLuotkham.Columns.MaDoituongBhyt).EqualTo(objLuotkham.MaDoituongBhyt) // .Set(KcbLuotkham.Columns.IdKhoatiepnhan).EqualTo(objLuotkham.IdKhoatiepnhan) // .Set(KcbLuotkham.Columns.DungTuyen).EqualTo(objLuotkham.DungTuyen) // .Set(KcbLuotkham.Columns.NgayTiepdon).EqualTo(objLuotkham.NgayTiepdon) // .Set(KcbLuotkham.Columns.MaDoituongKcb).EqualTo(objLuotkham.MaDoituongKcb) // .Set(KcbLuotkham.Columns.MaKhoaThuchien).EqualTo(objLuotkham.MaKhoaThuchien) // .Set(KcbLuotkham.Columns.NguoiSua).EqualTo(globalVariables.UserName) // .Set(KcbLuotkham.Columns.NgaySua).EqualTo(globalVariables.SysDate) // .Set(KcbLuotkham.Columns.PtramBhyt).EqualTo(objLuotkham.PtramBhyt) // .Set(KcbLuotkham.Columns.SoBenhAn).EqualTo(objLuotkham.SoBenhAn) // .Set(KcbLuotkham.Columns.DiaChi).EqualTo(objLuotkham.DiaChi) // .Set(KcbLuotkham.Columns.DiachiBhyt).EqualTo(objLuotkham.DiachiBhyt) // .Set(KcbLuotkham.Columns.Cmt).EqualTo(objLuotkham.Cmt) // .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham) // .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan) // .Execute(); //Kiểm tra nếu % bị thay đổi thì cập nhật lại tất cả các bảng if (PtramBhytCu != Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) || PtramBhytgoc != Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0)) _ActionResult= THU_VIEN_CHUNG.UpdatePtramBHYT(objLuotkham, -1); if (_ActionResult == ActionResult.Cancel)//Báo không cho phép thay đổi phần trăm BHYT do đã có dịch vụ đã thanh toán { return _ActionResult; } if (objRegExam != null) { objRegExam.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham); objRegExam.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan); AddRegExam(objRegExam,objLuotkham, false, KieuKham); } scope.Complete(); return ActionResult.Success; } } } catch (Exception ex) { log.Error("Loi trong qua trinh update thong tin benh nhan {0}", ex); return ActionResult.Error; } }
public ActionResult CapnhatDonthuoc(KcbDanhsachBenhnhan objBenhnhan, KcbDonthuoc objDonthuoc, KcbDonthuocChitiet[] arrDonthuocChitiet, ref int p_intIdDonthuoc, ref Dictionary<long, long> lstChitietDonthuoc) { try { using (TransactionScope scope = new TransactionScope()) { using (SharedDbConnectionScope sh = new SharedDbConnectionScope()) { objBenhnhan.Save(); p_intIdDonthuoc = objDonthuoc.IdDonthuoc; new Update(KcbDonthuoc.Schema) .Set(KcbDonthuoc.Columns.NgayKedon).EqualTo(objDonthuoc.NgayKedon) .Set(KcbDonthuoc.Columns.NgaySua).EqualTo(globalVariables.SysDate) .Set(KcbDonthuoc.Columns.NguoiSua).EqualTo(globalVariables.UserName) .Where(KcbDonthuoc.Columns.IdDonthuoc).IsEqualTo(objDonthuoc.IdDonthuoc).Execute(); foreach (KcbDonthuocChitiet objDonthuocChitiet in arrDonthuocChitiet) { objDonthuocChitiet.IdDonthuoc = objDonthuoc.IdDonthuoc; if (objDonthuocChitiet.IdChitietdonthuoc == -1)//Moi bo sung { objDonthuocChitiet.IdKham = objDonthuoc.IdKham; objDonthuocChitiet.IsNew = true; objDonthuocChitiet.SluongLinh = 0; objDonthuocChitiet.SluongSua = 0; objDonthuocChitiet.TrangThai = 0; objDonthuocChitiet.IdThanhtoan = -1; objDonthuocChitiet.MaLuotkham = objDonthuoc.MaLuotkham; objDonthuocChitiet.IdBenhnhan = objDonthuoc.IdBenhnhan; objDonthuocChitiet.IdDonthuoc = objDonthuoc.IdDonthuoc; objDonthuocChitiet.CachDung = objDonthuocChitiet.MotaThem; objDonthuocChitiet.IsNew = true; objDonthuocChitiet.Save(); if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value)) lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc); } else { if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value)) lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc); new Update(KcbDonthuocChitiet.Schema) .Set(KcbDonthuocChitiet.SoLuongColumn).EqualTo(objDonthuocChitiet.SoLuong) .Set(KcbDonthuocChitiet.NgaySuaColumn).EqualTo(objDonthuocChitiet.NgaySua) .Set(KcbDonthuocChitiet.NguoiSuaColumn).EqualTo(objDonthuocChitiet.NguoiSua) .Where(KcbDonthuocChitiet.IdChitietdonthuocColumn).IsEqualTo(objDonthuocChitiet.IdChitietdonthuoc).Execute(); } } } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { log.Error("Loi trong qua trinh luu don thuoc", exception); return ActionResult.Error; } }
public bool Destroy(object IdBenhnhan) { return(KcbDanhsachBenhnhan.Destroy(IdBenhnhan) == 1); }
void Prepare4Insert() { m_enAct = action.Insert; objBenhnhan = null; txtMaBN.Clear(); txtMaLankham.Clear(); txtTEN_BN.Clear(); txtDiachi.Clear(); txtSoDT.Clear(); m_dtDonthuocChitiet.Rows.Clear(); ModifyButton(); txtTEN_BN.Focus(); }
public ActionResult CapnhatDonthuoc(KcbDanhsachBenhnhan objBenhnhan, KcbDonthuoc objDonthuoc, KcbDonthuocChitiet[] arrDonthuocChitiet, ref int p_intIdDonthuoc, ref Dictionary <long, long> lstChitietDonthuoc) { try { using (TransactionScope scope = new TransactionScope()) { using (SharedDbConnectionScope sh = new SharedDbConnectionScope()) { objBenhnhan.Save(); p_intIdDonthuoc = objDonthuoc.IdDonthuoc; new Update(KcbDonthuoc.Schema) .Set(KcbDonthuoc.Columns.NgayKedon).EqualTo(objDonthuoc.NgayKedon) .Set(KcbDonthuoc.Columns.NgaySua).EqualTo(globalVariables.SysDate) .Set(KcbDonthuoc.Columns.NguoiSua).EqualTo(globalVariables.UserName) .Where(KcbDonthuoc.Columns.IdDonthuoc).IsEqualTo(objDonthuoc.IdDonthuoc).Execute(); foreach (KcbDonthuocChitiet objDonthuocChitiet in arrDonthuocChitiet) { objDonthuocChitiet.IdDonthuoc = objDonthuoc.IdDonthuoc; if (objDonthuocChitiet.IdChitietdonthuoc == -1) //Moi bo sung { objDonthuocChitiet.IdKham = objDonthuoc.IdKham; objDonthuocChitiet.IsNew = true; objDonthuocChitiet.SluongLinh = 0; objDonthuocChitiet.SluongSua = 0; objDonthuocChitiet.TrangThai = 0; objDonthuocChitiet.IdThanhtoan = -1; objDonthuocChitiet.MaLuotkham = objDonthuoc.MaLuotkham; objDonthuocChitiet.IdBenhnhan = objDonthuoc.IdBenhnhan; objDonthuocChitiet.IdDonthuoc = objDonthuoc.IdDonthuoc; objDonthuocChitiet.CachDung = objDonthuocChitiet.MotaThem; objDonthuocChitiet.IsNew = true; objDonthuocChitiet.Save(); if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value)) { lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc); } } else { if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value)) { lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc); } new Update(KcbDonthuocChitiet.Schema) .Set(KcbDonthuocChitiet.SoLuongColumn).EqualTo(objDonthuocChitiet.SoLuong) .Set(KcbDonthuocChitiet.NgaySuaColumn).EqualTo(objDonthuocChitiet.NgaySua) .Set(KcbDonthuocChitiet.NguoiSuaColumn).EqualTo(objDonthuocChitiet.NguoiSua) .Where(KcbDonthuocChitiet.IdChitietdonthuocColumn).IsEqualTo(objDonthuocChitiet.IdChitietdonthuoc).Execute(); } } } scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { log.Error("Loi trong qua trinh luu don thuoc", exception); return(ActionResult.Error); } }
private void getData() { try { ClearControl(); if (!Utility.isValidGrid(grdList)) { return; } txtPatient_ID.Text = Utility.sDbnull(grdList.GetValue(KcbLuotkham.Columns.IdBenhnhan), -1); objBenhnhan = KcbDanhsachBenhnhan.FetchByID(Utility.Int32Dbnull(grdList.GetValue(KcbDanhsachBenhnhan.Columns.IdBenhnhan))); gridExRow = grdList.GetRow(); if (objBenhnhan!=null) { dtInput_Date.Value = objBenhnhan.NgayTiepdon; txtPatient_ID.Text = objBenhnhan.IdBenhnhan.ToString(); txtYear_Of_Birth.Text =Utility.sDbnull( objBenhnhan.NamSinh,""); txtPatientName.Text = objBenhnhan.TenBenhnhan; txtDiaChi.Text = objBenhnhan.DiaChi; GetDataChiTiet(); LaydanhsachLichsuthanhtoan(); } } catch { } finally { ModifyPresCommand(); ModifyCommand(); tabThongTinCanThanhToan.SelectedIndex = 0; } }
/// <summary> /// Lấy về thông tin bệnh nhâ nội trú /// </summary> private void GetData() { try { // Utility.SetMsg(lblMsg, "", false); string patientCode = Utility.sDbnull(grdLuotkham.GetValue(KcbLuotkham.Columns.MaLuotkham), ""); _malankham = patientCode; int patientId = Utility.Int32Dbnull(grdList.GetValue(KcbLuotkham.Columns.IdBenhnhan), -1); ObjLuotkham = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(patientCode) .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(patientId).ExecuteSingle <KcbLuotkham>(); ObjBenhnhan = KcbDanhsachBenhnhan.FetchByID(ObjLuotkham.IdBenhnhan); if (ObjLuotkham != null) { ClearControl(); txt_idchidinhphongkham.Text = Utility.sDbnull(grdRegExam.GetValue(KcbDangkyKcb.Columns.IdKham)); _objkcbdangky = KcbDangkyKcb.FetchByID(Utility.Int32Dbnull(txt_idchidinhphongkham.Text)); if (_objkcbdangky != null) { DataTable mDtThongTin = _kcbThamkham.LayThongtinBenhnhanKCB(ObjLuotkham.MaLuotkham, Utility.Int32Dbnull(ObjLuotkham.IdBenhnhan, -1), Utility.Int32Dbnull(txt_idchidinhphongkham.Text)); if (mDtThongTin.Rows.Count > 0) { DataRow dr = mDtThongTin.Rows[0]; if (dr != null) { dtInput_Date.Value = Convert.ToDateTime(dr[KcbLuotkham.Columns.NgayTiepdon]); txtExam_ID.Text = Utility.sDbnull(grdRegExam.GetValue(KcbDangkyKcb.Columns.IdKham)); txtKhoaDieuTri.Text = Utility.sDbnull(grdLuotkham.GetValue("ten_khoanoitru")); txtBuong.Text = Utility.sDbnull(grdLuotkham.GetValue("ten_buong")); txtGiuong.Text = Utility.sDbnull(grdLuotkham.GetValue("ten_giuong")); txtTrangthaiNgoaitru.Text = Utility.sDbnull(grdLuotkham.GetValue("trangthai_ngoaitru")) == "0" ? "Đang khám" : "Đã khám xong"; txtTrangthaiNoitru.Text = Utility.sDbnull(grdLuotkham.GetValue("ten_trangthai_noitru")); Utility.Int32Dbnull(txtExam_ID.Text, -1); txtGioitinh.Text = Utility.sDbnull(grdList.GetValue(KcbDanhsachBenhnhan.Columns.GioiTinh), ""); txt_idchidinhphongkham.Text = Utility.sDbnull(grdRegExam.GetValue(KcbDangkyKcb.Columns.IdKham)); lblSOkham.Text = Utility.sDbnull(grdRegExam.GetValue(KcbDangkyKcb.Columns.SttKham)); 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.PtramBhyt], "0"); txtNgheNghiep.Text = Utility.sDbnull(dr[KcbDanhsachBenhnhan.Columns.NgheNghiep], ""); txtHanTheBHYT.Text = Utility.sDbnull(dr[KcbLuotkham.Columns.NgayketthucBhyt], ""); dtpNgayhethanBHYT.Text = Utility.sDbnull(dr[KcbLuotkham.Columns.NgayketthucBhyt], globalVariables.SysDate.ToString("dd/MM/yyyy")); var sqlbenhan = new Select().From(KcbBenhAn.Schema) .Where(KcbBenhAn.Columns.IdBnhan) .IsEqualTo(ObjLuotkham.IdBenhnhan) .ExecuteSingle <KcbBenhAn>(); txtSoBa.Text = sqlbenhan != null?string.Format("{0}-{1}", sqlbenhan.LoaiBa, sqlbenhan.SoBenhAn) : ""; if (ObjBenhnhan.NgaySinh != null) { txtTuoi.Text = Utility.sDbnull(Utility.Int32Dbnull(globalVariables.SysDate.Year) - ObjBenhnhan.NgaySinh.Value.Year); } //ThongBaoBenhAn(txtPatient_ID.Text); if (_objkcbdangky != null) { txtReg_ID.Text = Utility.sDbnull(_objkcbdangky.IdKham); dtpCreatedDate.Value = Convert.ToDateTime(_objkcbdangky.NgayDangky); txtDepartment_ID.Text = Utility.sDbnull(_objkcbdangky.IdPhongkham); var department = (from p in globalVariables.gv_dtDmucPhongban.AsEnumerable() where p[DmucKhoaphong.Columns.IdKhoaphong].Equals(_objkcbdangky.IdPhongkham) select p).FirstOrDefault(); if (department != null) { txtPhongkham.Text = Utility.sDbnull(department["ten_khoaphong"], ""); } txtTenDvuKham.Text = Utility.sDbnull(_objkcbdangky.TenDichvuKcb); txtNguoiTiepNhan.Text = Utility.sDbnull(_objkcbdangky.NguoiTao); try { cboDoctorAssign.SelectedIndex = Utility.GetSelectedIndex(cboDoctorAssign, Utility.sDbnull( _objkcbdangky.IdBacsikham, -1)); } catch (Exception exception) { if (globalVariables.IsAdmin) { Utility.ShowMsg(exception.ToString()); } } } _kcbChandoanKetluan = new Select().From(KcbChandoanKetluan.Schema) .Where(KcbChandoanKetluan.Columns.IdKham) .IsEqualTo(_objkcbdangky.IdKham) .ExecuteSingle <KcbChandoanKetluan>(); if (_kcbChandoanKetluan != null) { txtKet_Luan._Text = Utility.sDbnull(_kcbChandoanKetluan.Ketluan); txtHuongdieutri._Text = _kcbChandoanKetluan.HuongDieutri; nmrSongayDT.Value = Utility.DecimaltoDbnull(_kcbChandoanKetluan.SongayDieutri, 0); txtHa.Text = Utility.sDbnull(_kcbChandoanKetluan.Huyetap); txtMach.Text = Utility.sDbnull(_kcbChandoanKetluan.Mach); txtNhipTim.Text = Utility.sDbnull(_kcbChandoanKetluan.Nhiptim); txtNhipTho.Text = Utility.sDbnull(_kcbChandoanKetluan.Nhiptho); txtNhietDo.Text = Utility.sDbnull(_kcbChandoanKetluan.Nhietdo); txtCannang.Text = Utility.sDbnull(_kcbChandoanKetluan.Cannang); txtSoNgayHen.Text = Utility.sDbnull(_kcbChandoanKetluan.SoNgayhen); txtChieucao.Text = Utility.sDbnull(_kcbChandoanKetluan.Chieucao); if (!string.IsNullOrEmpty(Utility.sDbnull(_kcbChandoanKetluan.Nhommau)) && Utility.sDbnull(_kcbChandoanKetluan.Nhommau) != "-1") { txtNhommau._Text = Utility.sDbnull(_kcbChandoanKetluan.Nhommau); } AllowTextChanged = true; _isLike = false; txtChanDoan._Text = Utility.sDbnull(_kcbChandoanKetluan.Chandoan); txtChanDoanKemTheo.Text = Utility.sDbnull(_kcbChandoanKetluan.ChandoanKemtheo); txtMaBenhChinh.Text = Utility.sDbnull(_kcbChandoanKetluan.MabenhChinh); string dataString = Utility.sDbnull(_kcbChandoanKetluan.MabenhPhu, ""); _isLike = true; AllowTextChanged = false; _dtIcdPhu.Clear(); if (!string.IsNullOrEmpty(dataString)) { string[] rows = dataString.Split(','); foreach (string row in rows) { if (!string.IsNullOrEmpty(row)) { DataRow newDr = _dtIcdPhu.NewRow(); newDr[DmucBenh.Columns.MaBenh] = row; newDr[DmucBenh.Columns.TenBenh] = GetTenBenh(row); _dtIcdPhu.Rows.Add(newDr); _dtIcdPhu.AcceptChanges(); } } grd_ICD.DataSource = _dtIcdPhu; } } GetDataChiDinh(); } } } else { ClearControl(); } } } catch (Exception ex) { Utility.ShowMsg("Lỗi: " + ex.Message); } finally { KiemTraDaInPhoiBhyt(); } }
private void BindData() { SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaLanKham.Text); if (sqlQuery.GetRecordCount() > 0) { _objPatientExam = sqlQuery.ExecuteSingle <KcbLuotkham>(); if (_objPatientExam != null) { if (ObjPhanbuonggiuong == null) { ObjPhanbuonggiuong = NoitruPhanbuonggiuong.FetchByID(Utility.Int32Dbnull(_objPatientExam.IdRavien, 0)); } txtMaLanKham.Text = Utility.sDbnull(_objPatientExam.MaLuotkham); txtSoBHYT.Text = string.Format("{0}-{1}{2}", Utility.sDbnull(_objPatientExam.MatheBhyt), Utility.sDbnull(_objPatientExam.MaNoicapBhyt), Utility.sDbnull(_objPatientExam.MaKcbbd)); txtphantramhuong.Text = Utility.sDbnull(_objPatientExam.PtramBhyt); DmucKhoaphong objLDepartment = DmucKhoaphong.FetchByID(_objPatientExam.IdKhoanoitru); if (objLDepartment != null) { txtDepartment_ID.Text = Utility.sDbnull(objLDepartment.IdKhoaphong); txtDepartmentName.Tag = Utility.sDbnull(objLDepartment.IdKhoaphong); txtDepartmentName.Text = Utility.sDbnull(objLDepartment.TenKhoaphong); txtKhoadieutri.Text = txtDepartmentName.Text; } KcbDanhsachBenhnhan objPatientInfo = KcbDanhsachBenhnhan.FetchByID(_objPatientExam.IdBenhnhan); if (objPatientInfo != null) { txtPatient_Name.Text = Utility.sDbnull(objPatientInfo.TenBenhnhan); txtPatient_ID.Text = Utility.sDbnull(_objPatientExam.IdBenhnhan); txtNamSinh.Text = Utility.sDbnull(objPatientInfo.NamSinh); txtTuoi.Text = Utility.sDbnull(DateTime.Now.Year - objPatientInfo.NamSinh); txtPatientSex.Text = objPatientInfo.GioiTinh; // Utility.Int32Dbnull(objPatientInfo.) == 0 ? "Nam" : "Nữ"; } if (ObjPhanbuonggiuong != null) { txtPatientDept_ID.Text = Utility.sDbnull(ObjPhanbuonggiuong.Id); txtsoluongghep.Text = Utility.sDbnull(ObjPhanbuonggiuong.SoLuongGhep); chkGhepgiuong.Checked = Utility.Byte2Bool(ObjPhanbuonggiuong.IsGhepGiuong); } DataTable dtGia = new dmucgiagiuong_busrule().dsGetList("-1").Tables[0]; dtGia.DefaultView.Sort = NoitruGiabuonggiuong.Columns.SttHthi + "," + NoitruGiabuonggiuong.Columns.TenGia; txtGia.Init(dtGia, new List <string> { NoitruGiabuonggiuong.Columns.IdGia, NoitruGiabuonggiuong.Columns.MaGia, NoitruGiabuonggiuong.Columns.TenGia }); cboGia.DataSource = dtGia; cboGia.DataMember = NoitruGiabuonggiuong.Columns.IdGia; cboGia.ValueMember = NoitruGiabuonggiuong.Columns.IdGia; cboGia.DisplayMember = NoitruGiabuonggiuong.Columns.TenGia; _mDtDataRoom = THU_VIEN_CHUNG.NoitruTimkiembuongTheokhoa(Utility.Int32Dbnull(txtDepartment_ID.Text)); Utility.SetDataSourceForDataGridEx_Basic(grdBuong, _mDtDataRoom, true, true, "1=1", "sluong_giuong_trong desc,ten_buong"); txtRoom_code.Init(_mDtDataRoom, new List <string> { NoitruDmucBuong.Columns.IdBuong, NoitruDmucBuong.Columns.MaBuong, NoitruDmucBuong.Columns.TenBuong }); if (grdBuong.DataSource != null) { grdBuong.MoveFirst(); } } else { string tempt = txtMaLanKham.Text; ClearControl(); if (_mDtDataRoom != null) { _mDtDataRoom.Clear(); } if (_mDtDatabed != null) { if (_mDtDataRoom != null) { _mDtDataRoom.Clear(); } } txtMaLanKham.Text = tempt; txtMaLanKham.SelectAll(); txtMaLanKham.Focus(); } } }
private void TimKiemBenhNhan() { try { string KieuTimKiem = "DANGKY"; //if (radDangKyCLS.Checked) KieuTimKiem = "CLS"; //if (radDangKyThuoc.Checked) KieuTimKiem = "THUOC"; m_dtDataTimKiem = _THANHTOAN.LayDsachBenhnhanThanhtoan(-1, Utility.sDbnull(txtMaLanKham.Text), Utility.sDbnull(txtTenBenhNhan.Text), chkCreateDate.Checked ? dtFromDate.Value : Convert.ToDateTime("01/01/1900"), chkCreateDate.Checked ? dtToDate.Value : globalVariables.SysDate, Utility.sDbnull(cboObjectType_ID.SelectedValue), 0, 0, KieuTimKiem, globalVariables.MA_KHOA_THIEN); Utility.AddColumToDataTable(ref m_dtDataTimKiem, "CHON", typeof(Int32)); Utility.SetDataSourceForDataGridEx(grdList, m_dtDataTimKiem, true, true, "1=1", ""); ClearControl(); //if (m_dtDataTimKiem.Rows.Count <= 0) //{ objLuotkham = null; objBenhnhan = null; mnuUpdatePrice.Enabled = objLuotkham != null; //} grdList.MoveFirst(); UpdateGroup(); Utility.GonewRowJanus(grdList, KcbLuotkham.Columns.MaLuotkham, txtPatient_Code.Text); ModifyCommand(); } catch { } finally { if (PropertyLib._ThanhtoanProperties.AutoSelectpatientAfterSearch && grdList.RowCount == 1) { grdList.MoveFirst(); grdList_DoubleClick(grdList, new EventArgs()); } } }
private void getData() { try { ClearControl(); Utility.FreeLockObject(txtPatient_Code.Text); txtPatient_Code.Text = Utility.sDbnull(grdList.GetValue(KcbLuotkham.Columns.MaLuotkham)); if (!Utility.CheckLockObject(txtPatient_Code.Text, "Thanh toán", "TT")) return; txtPatient_ID.Text = Utility.sDbnull(grdList.GetValue(KcbLuotkham.Columns.IdBenhnhan), -1); objBenhnhan = KcbDanhsachBenhnhan.FetchByID(txtPatient_ID.Text); objLuotkham = CreatePatientExam(); mnuUpdatePrice.Enabled = objLuotkham != null; DataTable m_dtThongTin = _THANHTOAN.LaythongtinBenhnhan(txtPatient_Code.Text, Utility.Int32Dbnull(txtPatient_ID.Text, -1)); gridExRow = grdList.GetRow(); if (!Utility.isValidGrid(grdList) ) { return; } if (m_dtThongTin.Rows.Count > 0) { DataRow dr = m_dtThongTin.Rows[0]; //if (dr != null) //{ dtInput_Date.Value = Convert.ToDateTime(dr[KcbLuotkham.Columns.NgayTiepdon]); txtPatient_ID.Text = Utility.sDbnull(dr[KcbDanhsachBenhnhan.Columns.IdBenhnhan], ""); txtPatient_Code.Text = Utility.sDbnull(dr[KcbLuotkham.Columns.MaLuotkham], ""); txtYear_Of_Birth.Text = Utility.sDbnull(dr[KcbDanhsachBenhnhan.Columns.NamSinh], globalVariables.SysDate.Year); txtPatientName.Text = Utility.sDbnull(dr[KcbDanhsachBenhnhan.Columns.TenBenhnhan], "") + ", " + Utility.sDbnull(dr[KcbDanhsachBenhnhan.Columns.GioiTinh], "") + ", " + Utility.sDbnull(globalVariables.SysDate.Year - Utility.Int32Dbnull(txtYear_Of_Birth.Text)) + " tuổi "; txtObjectType_Name.Text = Utility.sDbnull(dr[DmucDoituongkcb.Columns.TenDoituongKcb], ""); txtSoBHYT.Text = Utility.sDbnull(dr[KcbLuotkham.Columns.MatheBhyt], ""); switch (Utility.sDbnull(dr[KcbLuotkham.Columns.MaDoituongKcb], "DV")) { case "BHYT": if (Utility.Int32Dbnull(dr[KcbLuotkham.Columns.DungTuyen], 0) == 1) { txtDTTT.Text = "Đúng tuyến"; } else { txtDTTT.Text = "Trái tuyến"; } txtDTTT.Visible = true; dtpBHYTFfromDate.Value = Convert.ToDateTime(dr[KcbLuotkham.Columns.NgaybatdauBhyt]); dtpBHYTToDate.Value = Convert.ToDateTime(dr[KcbLuotkham.Columns.NgayketthucBhyt]); break; case "DV": txtDTTT.Visible = false; dtpBHYTFfromDate.Value = globalVariables.SysDate; dtpBHYTToDate.Value = globalVariables.SysDate; break; } cmdCapnhatngayBHYT.Visible = THU_VIEN_CHUNG.IsBaoHiem(objLuotkham.IdLoaidoituongKcb) && (globalVariables.IsAdmin || Utility.Byte2Bool(globalVariablesPrivate.objNhanvien.QuyenSuathongtintheBHYTKhithanhtoan)); txtICD.ReadOnly = !(globalVariables.IsAdmin || Utility.Byte2Bool(globalVariablesPrivate.objNhanvien.QuyenNhapICDKhithanhtoan)); cmdSaveICD.Visible = globalVariables.IsAdmin || Utility.Byte2Bool(globalVariablesPrivate.objNhanvien.QuyenNhapICDKhithanhtoan); txtObjectType_Code.Text = Utility.sDbnull(dr[KcbLuotkham.Columns.MaDoituongKcb], ""); txtPtramBHYT.Text =txtPtramBHChiTra.Text= Utility.sDbnull(dr[KcbLuotkham.Columns.PtramBhyt], "0")+"%"; //txtLuongCoBan.Text = Utility.sDbnull(dr[KcbLuotkham.Columns.SalaryBasic], "0"); txtICD._Text = Utility.sDbnull(dr[KcbLuotkham.Columns.MabenhChinh], ""); //cmdChuyenCLS.vi = Utility.sDbnull(txtObjectType_Code.Text) == "DV"; //cmdDungChuyenCLS.Enabled = Utility.sDbnull(txtObjectType_Code.Text) == "DV"; txtDiaChi.Text = Utility.sDbnull(dr[KcbDanhsachBenhnhan.Columns.DiaChi], ""); txtDiachiBHYT.Text = Utility.sDbnull(dr[KcbDanhsachBenhnhan.Columns.DiachiBhyt], ""); toolTip1.SetToolTip(lblBHYT, Utility.DoTrim(txtDiachiBHYT.Text)); //} KiemTraDaInPhoiBHYT(); GetDataChiTiet(); LaydanhsachLichsuthanhtoan_phieuchi(); } } catch { } finally { getThongtincanhbao(Utility.Int32Dbnull(txtPatient_ID.Text, -1)); ModifyCommand(); TuybiennutchuyenCLS(); if (PropertyLib._ThanhtoanProperties.AutoTab) tabThongTinCanThanhToan.SelectedIndex = 0; } }
private void txtPatient_Code_KeyDown(object sender, KeyEventArgs e) { try { var dtPatient = new DataTable(); if (e.KeyCode == Keys.Enter) { Utility.FreeLockObject(m_strMaLuotkham); string _patient_Code = Utility.AutoFullPatientCode(txtPatient_Code.Text); ClearControl(); txtPatient_Code.Text = _patient_Code; if (grdList.RowCount > 0 && PropertyLib._ThamKhamProperties.Timtrenluoi) { DataRow[] arrData_tempt = null; arrData_tempt = m_dtDanhsachbenhnhanthamkham.Select(KcbLuotkham.Columns.MaLuotkham + "='" + _patient_Code + "'"); if (arrData_tempt.Length > 0) { string _status = radChuaKham.Checked ? "0" : "1"; string regStatus = Utility.sDbnull(arrData_tempt[0][KcbDangkyKcb.Columns.TrangThai], "0"); if (_status != regStatus) { if (regStatus == "1") radDaKham.Checked = true; else radChuaKham.Checked = true; } Utility.GotoNewRowJanus(grdList, KcbLuotkham.Columns.MaLuotkham, _patient_Code); if (Utility.isValidGrid(grdList)) grdList_DoubleClick(grdList, new EventArgs()); return; } } dtPatient = _KCB_THAMKHAM.TimkiemBenhnhan(txtPatient_Code.Text, Utility.Int32Dbnull(cboPhongKhamNgoaiTru.SelectedValue, -1), 0, 0); DataRow[] arrPatients = dtPatient.Select(KcbLuotkham.Columns.MaLuotkham + "='" + _patient_Code + "'"); if (arrPatients.GetLength(0) <= 0) { if (dtPatient.Rows.Count > 1) { var frm = new frm_DSACH_BN_TKIEM(); frm.MaLuotkham = txtPatient_Code.Text; frm.dtPatient = dtPatient; frm.ShowDialog(); if (!frm.has_Cancel) { txtPatient_Code.Text = frm.MaLuotkham; } } } else { txtPatient_Code.Text = _patient_Code; } DataTable dt_Patient = _KCB_THAMKHAM.TimkiemThongtinBenhnhansaukhigoMaBN (txtPatient_Code.Text, Utility.Int32Dbnull(cboPhongKhamNgoaiTru.SelectedValue, -1), globalVariables.MA_KHOA_THIEN); grdList.DataSource = null; grdList.DataSource = dt_Patient; if (dt_Patient.Rows.Count > 0) { grdList.MoveToRowIndex(0); grdList.CurrentRow.BeginEdit(); grdList.CurrentRow.Cells["MAUSAC"].Value = 1; grdList.CurrentRow.EndEdit(); if (dt_ICD_PHU != null) dt_ICD_PHU.Rows.Clear(); GetData(); txtPatient_Code.SelectAll(); } else { string sPatientTemp = txtPatient_Code.Text; m_strMaLuotkham = ""; objLuotkham = null; objkcbdangky = null; objBenhnhan = null; ClearControl(); txtPatient_Code.Text = sPatientTemp; txtPatient_Code.SelectAll(); //Utility.SetMsg(lblMsg, "Không tìm thấy bệnh nhân có mã lần khám đang chọn",true); } txtMach.SelectAll(); } } catch (Exception) { Utility.ShowMsg("Có lỗi trong quá trình lấy thông tin bệnh nhân"); } finally { ModifyCommmands(); } }
/// <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 { } }
private void SearchPatient() { try { ClearControl(); malankham = ""; objkcbdangky = null; objBenhnhan = null; objLuotkham = null; if (dt_ICD_PHU != null) dt_ICD_PHU.Clear(); if (m_dtAssignDetail != null) m_dtAssignDetail.Clear(); if (m_dtPresDetail != null) m_dtPresDetail.Clear(); DateTime dt_FormDate = dtFromDate.Value; DateTime dt_ToDate = dtToDate.Value; m_dtDanhsachbenhnhanthamkham = _KCB_THAMKHAM.KcbLichsuKcbTimkiemBenhnhan(!chkByDate.Checked ? "01/01/1900" : dt_FormDate.ToString("dd/MM/yyyy"), !chkByDate.Checked ? "01/01/1900" : dt_ToDate.ToString("dd/MM/yyyy"), Utility.DoTrim(txtmaluotkham.Text), Utility.Int32Dbnull(txtIdBenhnhan.Text,-1), Utility.DoTrim(txtTenBN.Text),Utility.DoTrim(txtTheBHYT.Text),Utility.Int32Dbnull(txtBacsikham.MyID,-1)); Utility.SetDataSourceForDataGridEx_Basic(grdList, m_dtDanhsachbenhnhanthamkham, true, true, "", KcbDanhsachBenhnhan.Columns.TenBenhnhan); 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; grdList.MoveFirst(); } catch(Exception ex) { Utility.CatchException(ex); } }
public void Insert(string TenBenhnhan,string DiaChi,string MaTinhThanhpho,string MaQuanhuyen,DateTime? NgaySinh,short? NamSinh,byte? IdGioitinh,string GioiTinh,string NgheNghiep,string CoQuan,string Cmt,short? MaQuocgia,string DienThoai,string Email,DateTime NgayTiepdon,string NguoiTiepdon,string DanToc,string TonGiao,DateTime? NgaySua,DateTime? NgayTao,string NguoiSua,string NguoiTao,string DiachiBhyt,string NguonGoc,string IpMaytao,string IpMaysua,string TenMaytao,string TenMaysua,string HoTenBoMe) { KcbDanhsachBenhnhan item = new KcbDanhsachBenhnhan(); item.TenBenhnhan = TenBenhnhan; item.DiaChi = DiaChi; item.MaTinhThanhpho = MaTinhThanhpho; item.MaQuanhuyen = MaQuanhuyen; item.NgaySinh = NgaySinh; item.NamSinh = NamSinh; item.IdGioitinh = IdGioitinh; item.GioiTinh = GioiTinh; item.NgheNghiep = NgheNghiep; item.CoQuan = CoQuan; item.Cmt = Cmt; item.MaQuocgia = MaQuocgia; item.DienThoai = DienThoai; item.Email = Email; item.NgayTiepdon = NgayTiepdon; item.NguoiTiepdon = NguoiTiepdon; item.DanToc = DanToc; item.TonGiao = TonGiao; item.NgaySua = NgaySua; item.NgayTao = NgayTao; item.NguoiSua = NguoiSua; item.NguoiTao = NguoiTao; item.DiachiBhyt = DiachiBhyt; item.NguonGoc = NguonGoc; item.IpMaytao = IpMaytao; item.IpMaysua = IpMaysua; item.TenMaytao = TenMaytao; item.TenMaysua = TenMaysua; item.HoTenBoMe = HoTenBoMe; item.Save(UserName); }
void cmdUpdate_Click(object sender, EventArgs e) { try { if (!Utility.isValidGrid(grdList)) { Utility.ShowMsg("Bạn cần chọn ít nhất một Bệnh nhân để thực hiện xóa đơn thuốc"); return; } objBenhnhan = KcbDanhsachBenhnhan.FetchByID(Utility.Int32Dbnull(grdList.GetValue(KcbDanhsachBenhnhan.Columns.IdBenhnhan))); if (objBenhnhan != null) { int Pres_ID = Utility.Int32Dbnull(grdChitiet.GetValue("id_phieu")); if( !isValidPres( Pres_ID)) return; KcbDonthuoc objPrescription = KcbDonthuoc.FetchByID(Pres_ID); if (objPrescription != null) { frm_kedonthuoctaiquay frm = new frm_kedonthuoctaiquay(); frm.m_dtPatients = m_dtSearchdata; frm.m_enAct = action.Update; frm._OnPayment += new frm_kedonthuoctaiquay.OnPayment(frm__OnPayment); frm.Noi_tru = 0; frm.objBenhnhan = objBenhnhan; frm.id_kham = -1; frm.txtPres_ID.Text = Utility.sDbnull(objPrescription.IdDonthuoc); frm.CallActionKeDon = CallActionKieuKeDon.TheoDoiTuong; frm.ShowDialog(); if (!frm.m_blnCancel) { Utility.GotoNewRowJanus(grdList, KcbDanhsachBenhnhan.Columns.IdBenhnhan, Utility.sDbnull(frm.objBenhnhan.IdBenhnhan)); getData(); cmdThanhToan.Focus(); ModifyPresCommand(); } } } } catch(Exception ex) { Utility.CatchException(ex); } }
/// <summary> /// Lấy về thông tin bệnh nhâ nội trú /// </summary> private void GetData() { try { // Utility.SetMsg(lblMsg, "", false); string PatientCode = Utility.sDbnull(grdLuotkham.GetValue(KcbLuotkham.Columns.MaLuotkham), ""); malankham = PatientCode; int Patient_ID = Utility.Int32Dbnull(grdList.GetValue(KcbLuotkham.Columns.IdBenhnhan), -1); objLuotkham = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(PatientCode) .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(Patient_ID).ExecuteSingle<KcbLuotkham>(); objBenhnhan = KcbDanhsachBenhnhan.FetchByID(objLuotkham.IdBenhnhan); isRoom = false; if (objLuotkham != null) { ClearControl(); txt_idchidinhphongkham.Text = Utility.sDbnull(grdRegExam.GetValue(KcbDangkyKcb.Columns.IdKham)); objkcbdangky = KcbDangkyKcb.FetchByID(Utility.Int32Dbnull(txt_idchidinhphongkham.Text)); 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; if (objkcbdangky != null) { DataTable m_dtThongTin = _KCB_THAMKHAM.LayThongtinBenhnhanKCB(objLuotkham.MaLuotkham, Utility.Int32Dbnull(objLuotkham.IdBenhnhan, -1), Utility.Int32Dbnull(txt_idchidinhphongkham.Text)); if (m_dtThongTin.Rows.Count > 0) { DataRow dr = m_dtThongTin.Rows[0]; if (dr != null) { dtInput_Date.Value = Convert.ToDateTime(dr[KcbLuotkham.Columns.NgayTiepdon]); txtExam_ID.Text = Utility.sDbnull(grdRegExam.GetValue(KcbDangkyKcb.Columns.IdKham)); txtKhoaDieuTri.Text = Utility.sDbnull(grdLuotkham.GetValue("ten_khoanoitru")); txtBuong.Text = Utility.sDbnull(grdLuotkham.GetValue("ten_buong")); txtGiuong.Text = Utility.sDbnull(grdLuotkham.GetValue("ten_giuong")); txtTrangthaiNgoaitru.Text = Utility.sDbnull(grdLuotkham.GetValue("trangthai_ngoaitru"))=="0"?"Đang khám":"Đã khám xong"; txtTrangthaiNoitru.Text = Utility.sDbnull(grdLuotkham.GetValue("ten_trangthai_noitru")); Exam_ID = Utility.Int32Dbnull(txtExam_ID.Text, -1); txtGioitinh.Text = Utility.sDbnull(grdList.GetValue(KcbDanhsachBenhnhan.Columns.GioiTinh), ""); txt_idchidinhphongkham.Text = Utility.sDbnull(grdRegExam.GetValue(KcbDangkyKcb.Columns.IdKham)); lblSOkham.Text = Utility.sDbnull(grdRegExam.GetValue(KcbDangkyKcb.Columns.SttKham)); 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.PtramBhyt], "0"); txtNgheNghiep.Text = Utility.sDbnull(dr[KcbDanhsachBenhnhan.Columns.NgheNghiep], ""); txtHanTheBHYT.Text = Utility.sDbnull(dr[KcbLuotkham.Columns.NgayketthucBhyt], ""); 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); //ThongBaoBenhAn(txtPatient_ID.Text); if (objkcbdangky != null) { txtReg_ID.Text = Utility.sDbnull(objkcbdangky.IdKham); dtpCreatedDate.Value = Convert.ToDateTime(objkcbdangky.NgayDangky); txtDepartment_ID.Text = Utility.sDbnull(objkcbdangky.IdPhongkham); DmucKhoaphong _department = new Select().From(DmucKhoaphong.Schema).Where(DmucKhoaphong.IdKhoaphongColumn).IsEqualTo(objkcbdangky.IdPhongkham).ExecuteSingle<DmucKhoaphong>(); if (_department != null) { txtPhongkham.Text = Utility.sDbnull(_department.TenKhoaphong); } txtTenDvuKham.Text = Utility.sDbnull(objkcbdangky.TenDichvuKcb); txtNguoiTiepNhan.Text = Utility.sDbnull(objkcbdangky.NguoiTao); try { cboDoctorAssign.SelectedIndex = Utility.GetSelectedIndex(cboDoctorAssign, Utility.sDbnull( objkcbdangky.IdBacsikham, -1)); } catch (Exception) { } } _KcbChandoanKetluan = new Select().From(KcbChandoanKetluan.Schema) .Where(KcbChandoanKetluan.Columns.IdKham).IsEqualTo(objkcbdangky.IdKham).ExecuteSingle <KcbChandoanKetluan>(); if (_KcbChandoanKetluan != null) { txtKet_Luan._Text = Utility.sDbnull(_KcbChandoanKetluan.Ketluan); txtHuongdieutri._Text = _KcbChandoanKetluan.HuongDieutri; nmrSongayDT.Value = Utility.DecimaltoDbnull(_KcbChandoanKetluan.SongayDieutri, 0); txtHa.Text = Utility.sDbnull(_KcbChandoanKetluan.Huyetap); txtMach.Text = Utility.sDbnull(_KcbChandoanKetluan.Mach); txtNhipTim.Text = Utility.sDbnull(_KcbChandoanKetluan.Nhiptim); txtNhipTho.Text = Utility.sDbnull(_KcbChandoanKetluan.Nhiptho); txtNhietDo.Text = Utility.sDbnull(_KcbChandoanKetluan.Nhietdo); txtCannang.Text = Utility.sDbnull(_KcbChandoanKetluan.Cannang); txtChieucao.Text = Utility.sDbnull(_KcbChandoanKetluan.Chieucao); if (!string.IsNullOrEmpty(Utility.sDbnull(_KcbChandoanKetluan.Nhommau)) && Utility.sDbnull(_KcbChandoanKetluan.Nhommau) != "-1") txtNhommau._Text = Utility.sDbnull(_KcbChandoanKetluan.Nhommau); AllowTextChanged = true; isLike = false; txtChanDoan._Text = Utility.sDbnull(_KcbChandoanKetluan.Chandoan); txtChanDoanKemTheo.Text = Utility.sDbnull(_KcbChandoanKetluan.ChandoanKemtheo); txtMaBenhChinh.Text = Utility.sDbnull(_KcbChandoanKetluan.MabenhChinh); string dataString = Utility.sDbnull(_KcbChandoanKetluan.MabenhPhu, ""); isLike = true; AllowTextChanged = false; dt_ICD_PHU.Clear(); if (!string.IsNullOrEmpty(dataString)) { string[] rows = dataString.Split(','); foreach (string row in rows) { if (!string.IsNullOrEmpty(row)) { DataRow newDr = dt_ICD_PHU.NewRow(); newDr[DmucBenh.Columns.MaBenh] = row; newDr[DmucBenh.Columns.TenBenh] = GetTenBenh(row); dt_ICD_PHU.Rows.Add(newDr); dt_ICD_PHU.AcceptChanges(); } } grd_ICD.DataSource = dt_ICD_PHU; } } GetDataChiDinh(); } } } else { ClearControl(); } } } catch { } finally { KiemTraDaInPhoiBHYT(); getResult(); } }
public ActionResult ThanhtoanDonthuoctaiquay(KcbThanhtoan objThanhtoan, KcbDanhsachBenhnhan objBenhnhan,List< KcbThanhtoanChitiet> objArrPaymentDetail, ref int id_thanhtoan, long IdHdonLog, bool Layhoadondo) { decimal PtramBHYT = 0; ///tổng tiền hiện tại truyền vào của lần payment đang thực hiện decimal v_dblTongtienDCT = 0; ///tổng tiền đã thanh toán decimal v_TotalPaymentDetail = 0; try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { ///lấy tổng số Payment của mang truyền vào của pay ment hiện tại v_dblTongtienDCT = TongtienKhongTutuc(objArrPaymentDetail); KcbThanhtoanCollection paymentCollection = new KcbThanhtoanController() .FetchByQuery( KcbThanhtoan.CreateQuery() .AddWhere //(KcbThanhtoan.Columns.MaLuotkham, Comparison.Equals, objLuotkham.MaLuotkham).AND (KcbThanhtoan.Columns.IdBenhnhan, Comparison.Equals, objBenhnhan.IdBenhnhan) .AND(KcbThanhtoan.Columns.TrangThai, Comparison.Equals, 0) .AND(KcbThanhtoan.Columns.KieuThanhtoan, Comparison.Equals, 0) .AND(KcbThanhtoan.Columns.TrangThai, Comparison.Equals, 0)); //Lấy tổng tiền của các lần thanh toán trước int id_donthuoc = -1; foreach (KcbThanhtoan Payment in paymentCollection) { KcbThanhtoanChitietCollection paymentDetailCollection = new Select().From(KcbThanhtoanChitiet.Schema) .Where(KcbThanhtoanChitiet.Columns.IdThanhtoan).IsEqualTo(Payment.IdThanhtoan) .And(KcbThanhtoanChitiet.Columns.TrangthaiHuy).IsEqualTo(0).ExecuteAsCollection <KcbThanhtoanChitietCollection>(); foreach (KcbThanhtoanChitiet paymentDetail in paymentDetailCollection) { if (id_donthuoc == -1) id_donthuoc = paymentDetail.IdPhieu; if (paymentDetail.TuTuc == 0) v_TotalPaymentDetail += Utility.Int32Dbnull(paymentDetail.SoLuong) * Utility.DecimaltoDbnull(paymentDetail.DonGia); } } //LayThongtinPtramBHYT(v_dblTongtienDCT + v_TotalPaymentDetail, objLuotkham, ref PtramBHYT); objThanhtoan.MaThanhtoan = THU_VIEN_CHUNG.TaoMathanhtoan(Convert.ToDateTime(objThanhtoan.NgayThanhtoan)); objThanhtoan.IsNew = true; objThanhtoan.Save(); if (id_donthuoc == -1) id_donthuoc = objArrPaymentDetail[0].IdPhieu; KcbDonthuoc objDonthuoc = KcbDonthuoc.FetchByID(id_donthuoc); KcbDonthuocChitietCollection lstChitiet = new Select().From(KcbDonthuoc.Schema).Where(KcbDonthuoc.Columns.IdDonthuoc).IsEqualTo(id_donthuoc).ExecuteAsCollection<KcbDonthuocChitietCollection>(); ActionResult actionResult = ActionResult.Success; if (objDonthuoc != null && lstChitiet.Count>0) { if (!XuatThuoc.InValiKiemTraDonThuoc(lstChitiet,(byte)0)) return ActionResult.NotEnoughDrugInStock; actionResult = new XuatThuoc().LinhThuocBenhNhan(id_donthuoc, Utility.Int16Dbnull(lstChitiet[0].IdKho, 0), globalVariables.SysDate); switch (actionResult) { case ActionResult.Success: break; case ActionResult.Error: return actionResult; } } //Tính lại Bnhan chi trả và BHYT chi trả //objArrPaymentDetail = THU_VIEN_CHUNG.TinhPhamTramBHYT(objArrPaymentDetail, PtramBHYT); decimal TT_BN = 0m; decimal TT_BHYT = 0m; decimal TT_Chietkhau_Chitiet = 0m; foreach (KcbThanhtoanChitiet objThanhtoanDetail in objArrPaymentDetail) { TT_BN += (objThanhtoanDetail.BnhanChitra + objThanhtoanDetail.PhuThu) * objThanhtoanDetail.SoLuong; TT_BHYT += objThanhtoanDetail.BhytChitra * objThanhtoanDetail.SoLuong; TT_Chietkhau_Chitiet += Utility.DecimaltoDbnull(objThanhtoanDetail.TienChietkhau, 0); objThanhtoanDetail.IdThanhtoan = Utility.Int32Dbnull(objThanhtoan.IdThanhtoan, -1); objThanhtoanDetail.IsNew = true; objThanhtoanDetail.Save(); UpdatePaymentStatus(objThanhtoan, objThanhtoanDetail); } #region Hoadondo if (Layhoadondo) { int record = -1; if (IdHdonLog > 0) { record = new Delete().From(HoadonLog.Schema) .Where(HoadonLog.Columns.IdHdonLog) .IsEqualTo(IdHdonLog) .Execute(); if (record <= 0) { Utility.ShowMsg("Có lỗi trong quá trình xóa thông tin serie hóa đơn đã hủy để cấp lại cho lần thanh toán này."); return ActionResult.Error; } } var obj = new HoadonLog(); obj.IdThanhtoan = objThanhtoan.IdThanhtoan; obj.TongTien = objThanhtoan.TongTien - Utility.DecimaltoDbnull(objThanhtoan.TongtienChietkhau, 0); obj.IdBenhnhan = objThanhtoan.IdBenhnhan; obj.MaLuotkham = objThanhtoan.MaLuotkham; obj.MauHoadon = objThanhtoan.MauHoadon; obj.KiHieu = objThanhtoan.KiHieu; obj.IdCapphat = objThanhtoan.IdCapphat.Value; obj.MaQuyen = objThanhtoan.MaQuyen; obj.Serie = objThanhtoan.Serie; obj.MaNhanvien = globalVariables.UserName; obj.MaLydo = "0"; obj.NgayIn = globalVariables.SysDate; obj.TrangThai = 0; obj.IsNew = true; obj.Save(); IdHdonLog = obj.IdHdonLog;//Để update lại vào bảng thanh toán new Update(HoadonCapphat.Schema).Set(HoadonCapphat.Columns.SerieHientai) .EqualTo(objThanhtoan.Serie) .Set(HoadonCapphat.Columns.TrangThai).EqualTo(1) .Where(HoadonCapphat.Columns.IdCapphat).IsEqualTo(obj.IdCapphat) .Execute(); } #endregion KcbPhieuthu objPhieuthu = new KcbPhieuthu(); objPhieuthu.IdBenhnhan = objThanhtoan.IdBenhnhan; objPhieuthu.MaLuotkham = objThanhtoan.MaLuotkham; objPhieuthu.IdThanhtoan = objThanhtoan.IdThanhtoan; objPhieuthu.MaPhieuthu = THU_VIEN_CHUNG.GetMaPhieuThu(globalVariables.SysDate, 0); objPhieuthu.SoluongChungtugoc = 1; objPhieuthu.LoaiPhieuthu = Convert.ToByte(0); objPhieuthu.NgayThuchien = globalVariables.SysDate; objPhieuthu.SoTien = TT_BN - TT_Chietkhau_Chitiet; objPhieuthu.SotienGoc = TT_BN; objPhieuthu.MaLydoChietkhau = objThanhtoan.MaLydoChietkhau; objPhieuthu.TienChietkhauchitiet = TT_Chietkhau_Chitiet; objPhieuthu.TienChietkhau = objThanhtoan.TongtienChietkhau; objPhieuthu.TienChietkhauhoadon = objPhieuthu.TienChietkhau - objPhieuthu.TienChietkhauchitiet; objPhieuthu.NguoiNop = globalVariables.UserName; objPhieuthu.TaikhoanCo = ""; objPhieuthu.TaikhoanNo = ""; objPhieuthu.LydoNop = "Thu tiền bệnh nhân"; objPhieuthu.IdKhoaThuchien = globalVariables.idKhoatheoMay; objPhieuthu.IdNhanvien = globalVariables.gv_intIDNhanvien; objPhieuthu.IsNew = true; objPhieuthu.Save(); new Update(KcbThanhtoan.Schema) .Set(KcbThanhtoan.Columns.TongTien).EqualTo(TT_BHYT + TT_BN) .Set(KcbThanhtoan.Columns.BnhanChitra).EqualTo(TT_BN) .Set(KcbThanhtoan.Columns.BhytChitra).EqualTo(TT_BHYT) .Set(KcbThanhtoan.Columns.IdHdonLog).EqualTo(IdHdonLog) .Where(KcbThanhtoan.Columns.IdThanhtoan).IsEqualTo(objThanhtoan.IdThanhtoan).Execute(); } scope.Complete(); id_thanhtoan = Utility.Int32Dbnull(objThanhtoan.IdThanhtoan, -1); return ActionResult.Success; } } catch (Exception ex) { log.Error("Loi thuc hien thanh toan:" + ex.ToString()); return ActionResult.Error; } }
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 CreatePatientInfo() { if (m_enAct == action.Insert) { objBenhnhan = new KcbDanhsachBenhnhan(); objBenhnhan.IdBenhnhan = Utility.Int64Dbnull(txtMaBN.Text, -1); } if (m_enAct == action.Update) objBenhnhan.IdBenhnhan = Utility.Int64Dbnull(txtMaBN.Text, -1); objBenhnhan.TenBenhnhan = txtTEN_BN.Text; objBenhnhan.KieuBenhnhan = 1; objBenhnhan.DiaChi = txtDiachi.Text; objBenhnhan.DiachiBhyt = objBenhnhan.DiaChi; objBenhnhan.DienThoai = txtSoDT.Text; // objBenhnhan.Email = Utility.sDbnull(txtEmail.Text, ""); //objBenhnhan.Locked = 0; objBenhnhan.NgayTao = globalVariables.SysDate; objBenhnhan.NguoiTao = globalVariables.UserName; objBenhnhan.NguonGoc = "QUAYTHUOC"; //objBenhnhan.Cmt = Utility.sDbnull(txtCMT.Text, ""); objBenhnhan.CoQuan = string.Empty; //objBenhnhan.NgheNghiep = txtNgheNghiep.Text; objBenhnhan.GioiTinh = cboPatientSex.Text; objBenhnhan.IdGioitinh = Utility.ByteDbnull(cboPatientSex.SelectedValue, 0); objBenhnhan.NamSinh =(short) DateTime.Now.Year;// Utility.Int16Dbnull(txtNamSinh.Text, null); objBenhnhan.NgaySinh = new DateTime(DateTime.Now.Year, 1, 1); if (m_enAct == action.Insert) { objBenhnhan.IsNew = true; objBenhnhan.NgayTiepdon = dtpCreatedDate.Value; objBenhnhan.NguoiTao = globalVariables.UserName; } if (m_enAct == action.Update) { objBenhnhan.IsNew = false; objBenhnhan.MarkOld(); objBenhnhan.NgaySua = globalVariables.SysDate; objBenhnhan.NguoiSua = globalVariables.UserName; objBenhnhan.NgayTiepdon = dtpCreatedDate.Value; } }
private void LoadThongtinBenhnhan() { PtramBhytCu = 0m; PtramBhytGocCu = 0m; AllowTextChanged = false; LstNoitruPhanbuonggiuong = new NoitruPhanbuonggiuongCollection(); objBuonggiuong = null; objBenhnhan = KcbDanhsachBenhnhan.FetchByID(txtMaBN.Text); if (objBenhnhan != null) { txtTEN_BN.Text = Utility.sDbnull(objBenhnhan.TenBenhnhan); txtNamSinh.Text = Utility.sDbnull(objBenhnhan.NamSinh); txtSoDT.Text = Utility.sDbnull(objBenhnhan.DienThoai); txtDiachi_bhyt._Text = Utility.sDbnull(objBenhnhan.DiachiBhyt); txtDiachi._Text = Utility.sDbnull(objBenhnhan.DiaChi); if (objBenhnhan.NgaySinh != null) dtpBOD.Value = objBenhnhan.NgaySinh.Value; else dtpBOD.Value = new DateTime((int)objBenhnhan.NamSinh, 1, 1); txtNamSinh.Text = Utility.sDbnull(objBenhnhan.NamSinh); txtTuoi.Text = Utility.sDbnull(globalVariables.SysDate.Year - Utility.Int32Dbnull(objBenhnhan.NamSinh)); txtNgheNghiep._Text = Utility.sDbnull(objBenhnhan.NgheNghiep); cboPatientSex.SelectedIndex = Utility.GetSelectedIndex(cboPatientSex, Utility.sDbnull(objBenhnhan.IdGioitinh)); if (Utility.Int32Dbnull(objBenhnhan.DanToc) > 0) txtDantoc._Text = objBenhnhan.DanToc; txtCMT.Text = Utility.sDbnull(objBenhnhan.Cmt); objLuotkham = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaLankham.Text) .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(Utility.Int32Dbnull(txtMaBN.Text, -1)).ExecuteSingle <KcbLuotkham>(); if (objLuotkham != null) { LstNoitruPhanbuonggiuong = new Select().From(NoitruPhanbuonggiuong.Schema) .Where(NoitruPhanbuonggiuong.Columns.NoiTru).IsEqualTo(1) .And(NoitruPhanbuonggiuong.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan) .And(NoitruPhanbuonggiuong.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham).ExecuteAsCollection<NoitruPhanbuonggiuongCollection>(); if (LstNoitruPhanbuonggiuong.Count > 0) objBuonggiuong = LstNoitruPhanbuonggiuong[0]; ucTamung1.ChangePatients(objLuotkham,"LYDOTAMUNGCAPCUU"); KcbDangkySokham objSoKCB=new Select().From(KcbDangkySokham.Schema) .Where(KcbDangkySokham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan) .And(KcbDangkySokham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham) .ExecuteSingle<KcbDangkySokham>(); if (objSoKCB != null) { chkLaysokham.Checked = true; txtSoKcb.SetCode(objSoKCB.MaSokcb); } else { chkLaysokham.Checked = false; txtSoKcb.SetDefaultItem(); } if (string.IsNullOrEmpty(Utility.sDbnull(objLuotkham.SoBenhAn, ""))) { txtSoBenhAn.Text = THU_VIEN_CHUNG.LaySoBenhAn(); } else { txtSoBenhAn.Text = Utility.sDbnull(objLuotkham.SoBenhAn, ""); } m_strMaluotkham = objLuotkham.MaLuotkham; if (objBuonggiuong != null) { AllowGridSelecttionChanged = false; txtKhoanoitru.SetId(objBuonggiuong.IdKhoanoitru); txtKhoanoitru__OnEnterMe(); txtGia.SetId(objBuonggiuong.IdGia); txtRoom_code.SetId(objBuonggiuong.IdBuong); txtRoom_code__OnEnterMe(); ChonBuong(); txtBedCode.SetId(objBuonggiuong.IdGiuong); txtBedCode__OnEnterMe(); AllowGridSelecttionChanged = true; dtNgayChuyen.Value = Convert.ToDateTime(objBuonggiuong.NgayVaokhoa); txtGio.Text = Utility.sDbnull(dtNgayChuyen.Value.Hour); txtPhut.Text = Utility.sDbnull(dtNgayChuyen.Value.Minute); } txtSolankham.Text = Utility.sDbnull(objLuotkham.SolanKham); _IdDoituongKcb = objLuotkham.IdDoituongKcb; dtpInputDate.Value = objLuotkham.NgayTiepdon; dtCreateDate.Value = objLuotkham.NgayTiepdon; chkCapCuu.Checked = Utility.Int32Dbnull(objLuotkham.TrangthaiCapcuu, 0) == 1; chkTraiTuyen.Checked = Utility.Int32Dbnull(objLuotkham.DungTuyen, 0) == 0; lblTuyenBHYT.Text = chkTraiTuyen.Checked ? "TRÁI TUYẾN" : "ĐÚNG TUYẾN"; _MaDoituongKcb = Utility.sDbnull(objLuotkham.MaDoituongKcb); objDoituongKCB = new Select().From(DmucDoituongkcb.Schema).Where(DmucDoituongkcb.MaDoituongKcbColumn).IsEqualTo(_MaDoituongKcb).ExecuteSingle<DmucDoituongkcb>(); ChangeObjectRegion(); PtramBhytCu = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0); PtramBhytGocCu = Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0); _IdDoituongKcb = objDoituongKCB.IdDoituongKcb; _TenDoituongKcb = objDoituongKCB.TenDoituongKcb; cboDoituongKCB.SelectedIndex = Utility.GetSelectedIndex(cboDoituongKCB, _MaDoituongKcb); chkChuyenVien.Checked = Utility.Int32Dbnull(objLuotkham.TthaiChuyenden, 0) == 1; txtNoichuyenden.SetId(Utility.Int32Dbnull(objLuotkham.IdBenhvienDen, -1)); if (!string.IsNullOrEmpty(objLuotkham.MatheBhyt))//Thông tin BHYT { txtTrieuChungBD._Text = Utility.sDbnull(objLuotkham.TrieuChung); if (!string.IsNullOrEmpty(Utility.sDbnull(objLuotkham.NgaybatdauBhyt))) dtInsFromDate.Value = Convert.ToDateTime(objLuotkham.NgaybatdauBhyt); if (!string.IsNullOrEmpty(Utility.sDbnull(objLuotkham.NgayketthucBhyt))) dtInsToDate.Value = Convert.ToDateTime(objLuotkham.NgayketthucBhyt); txtPtramBHYT.Text = Utility.sDbnull(objLuotkham.PtramBhyt, "0"); txtptramDauthe.Text = Utility.sDbnull(objLuotkham.PtramBhytGoc, "0"); //HS7010340000005 txtMaDtuong_BHYT.Text = Utility.sDbnull(objLuotkham.MaDoituongBhyt); txtMaQuyenloi_BHYT.Text = Utility.sDbnull(objLuotkham.MaQuyenloi); txtNoiDongtrusoKCBBD.Text = Utility.sDbnull(objLuotkham.NoiDongtrusoKcbbd); txtOthu4.Text = Utility.sDbnull(objLuotkham.MatheBhyt).Substring(5, 2); txtOthu5.Text = Utility.sDbnull(objLuotkham.MatheBhyt).Substring(7, 3); txtOthu6.Text = Utility.sDbnull(objLuotkham.MatheBhyt).Substring(10, 5); txtMaDTsinhsong.SetCode(objLuotkham.MadtuongSinhsong); chkGiayBHYT.Checked = Utility.Byte2Bool(objLuotkham.GiayBhyt); txtNoiphattheBHYT.Text = Utility.sDbnull(objLuotkham.MaNoicapBhyt); txtNoiDKKCBBD.Text = Utility.sDbnull(objLuotkham.MaKcbbd); pnlBHYT.Enabled = true; } else { XoathongtinBHYT(true); } } else { } } chkChuyenVien_CheckedChanged(chkChuyenVien, new EventArgs()); }
public bool Delete(object IdBenhnhan) { return(KcbDanhsachBenhnhan.Delete(IdBenhnhan) == 1); }
private void ThemLanKham() { DateTime ngaychuyenkhoa = new DateTime(dtNgayChuyen.Value.Year, dtNgayChuyen.Value.Month, dtNgayChuyen.Value.Day, Utility.Int32Dbnull(txtGio.Text), Utility.Int32Dbnull(txtPhut.Text), 00); objBenhnhan = TaoBenhNhan(); objLuotkham = TaoLuotkham(); objBuonggiuong = TaodulieuBuonggiuong(); KcbDangkySokham objSokham = TaosoKCB(); long v_id_kham = -1; string msg = ""; errorProvider1.Clear(); ActionResult actionResult = _KCB_DANGKY.ThemmoiLuotkhamCapcuu(objBenhnhan, objLuotkham, objSokham, objBuonggiuong, ngaychuyenkhoa, ref msg); if (msg.Trim() != "") { errorProvider1.SetError(txtSoKcb, msg); } switch (actionResult) { case ActionResult.Success: if (objLuotkham.SoBenhAn!=null && objLuotkham.SoBenhAn != txtSoBenhAn.Text) { Utility.ShowMsg(string.Format( "Chú ý: Số bệnh án nội trú {0} đã được Bệnh nhân khác sử dụng nên số bệnh án nội trú mới của Bệnh nhân là {1}",txtSoBenhAn.Text,objLuotkham.SoBenhAn )); } txtSoBenhAn.Text = objLuotkham.SoBenhAn; PtramBhytCu = Utility.DecimaltoDbnull(txtPtramBHYT.Text, 0); PtramBhytGocCu = Utility.DecimaltoDbnull(txtptramDauthe.Text, 0); txtMaLankham.Text = Utility.sDbnull(objLuotkham.MaLuotkham); txtMaBN.Text = Utility.sDbnull(objLuotkham.IdBenhnhan); m_blnHasJustInsert = true; m_enAction = action.Update; Utility.SetMsg(lblMsg, "Bạn thêm mới lần khám bệnh nhân thành công", false); ThemMoiLanKhamVaoLuoi(); if (_OnActionSuccess != null) _OnActionSuccess(); Utility.GotoNewRowJanus(grdList, KcbLuotkham.Columns.MaLuotkham, txtMaLankham.Text); if (chkTudongthemmoi.Checked) cmdThemMoiBN_Click(cmdThemMoiBN, new EventArgs()); else { ucTamung1.ChangePatients(objLuotkham, "LYDOTAMUNGCAPCUU"); tabControl1.SelectedTab = tabControl1.TabPages[1]; ucTamung1.Themmoi(); } m_blnCancel = false; break; case ActionResult.Error: Utility.SetMsg(lblMsg, "Lỗi trong quá trình thêm lần khám !", true); cmdSave.Focus(); break; } }
public void Insert(string TenBenhnhan, string DiaChi, string MaTinhThanhpho, string MaQuanhuyen, DateTime?NgaySinh, short?NamSinh, byte?IdGioitinh, string GioiTinh, string NgheNghiep, string CoQuan, string Cmt, short?MaQuocgia, string DienThoai, string Email, DateTime NgayTiepdon, string NguoiTiepdon, string DanToc, string TonGiao, DateTime?NgaySua, DateTime?NgayTao, string NguoiSua, string NguoiTao, string DiachiBhyt, string NguonGoc, byte?KieuBenhnhan, byte?MacDinh, string IpMaytao, string IpMaysua, string TenMaytao, string TenMaysua, string DiachiLienhe, string DienthoaiLienhe, string Fax, string NguoiLienhe, string SoTiemchungQg, string LastActionName, string ChucVu, string MaBenhnhan, string SoLo) { KcbDanhsachBenhnhan item = new KcbDanhsachBenhnhan(); item.TenBenhnhan = TenBenhnhan; item.DiaChi = DiaChi; item.MaTinhThanhpho = MaTinhThanhpho; item.MaQuanhuyen = MaQuanhuyen; item.NgaySinh = NgaySinh; item.NamSinh = NamSinh; item.IdGioitinh = IdGioitinh; item.GioiTinh = GioiTinh; item.NgheNghiep = NgheNghiep; item.CoQuan = CoQuan; item.Cmt = Cmt; item.MaQuocgia = MaQuocgia; item.DienThoai = DienThoai; item.Email = Email; item.NgayTiepdon = NgayTiepdon; item.NguoiTiepdon = NguoiTiepdon; item.DanToc = DanToc; item.TonGiao = TonGiao; item.NgaySua = NgaySua; item.NgayTao = NgayTao; item.NguoiSua = NguoiSua; item.NguoiTao = NguoiTao; item.DiachiBhyt = DiachiBhyt; item.NguonGoc = NguonGoc; item.KieuBenhnhan = KieuBenhnhan; item.MacDinh = MacDinh; item.IpMaytao = IpMaytao; item.IpMaysua = IpMaysua; item.TenMaytao = TenMaytao; item.TenMaysua = TenMaysua; item.DiachiLienhe = DiachiLienhe; item.DienthoaiLienhe = DienthoaiLienhe; item.Fax = Fax; item.NguoiLienhe = NguoiLienhe; item.SoTiemchungQg = SoTiemchungQg; item.LastActionName = LastActionName; item.ChucVu = ChucVu; item.MaBenhnhan = MaBenhnhan; item.SoLo = SoLo; item.Save(UserName); }
private void CapnhatthongtinBenhnhan() { DateTime ngaychuyenkhoa = new DateTime(dtNgayChuyen.Value.Year, dtNgayChuyen.Value.Month, dtNgayChuyen.Value.Day, Utility.Int32Dbnull(txtGio.Text), Utility.Int32Dbnull(txtPhut.Text), 00); objBenhnhan = TaoBenhNhan(); objLuotkham = TaoLuotkham(); objBuonggiuong = TaodulieuBuonggiuong(); KcbDangkySokham objSokham = TaosoKCB(); string msg = ""; errorProvider1.Clear(); ActionResult actionResult = _KCB_DANGKY.UpdateBenhnhanCapcuu(objBenhnhan, objLuotkham, objSokham, objBuonggiuong, ngaychuyenkhoa, PtramBhytCu, PtramBhytGocCu, ref msg); // THEM_PHI_DVU_KYC(objLuotkham); if (msg.Trim() != "") { errorProvider1.SetError(txtSoKcb, msg); } switch (actionResult) { case ActionResult.Success: if (objLuotkham.SoBenhAn!=null && objLuotkham.SoBenhAn != txtSoBenhAn.Text) { Utility.ShowMsg(string.Format( "Chú ý: Số bệnh án nội trú {0} đã được Bệnh nhân khác sử dụng nên số bệnh án nội trú mới của Bệnh nhân là {1}",txtSoBenhAn.Text,objLuotkham.SoBenhAn )); } txtSoBenhAn.Text=objLuotkham.SoBenhAn; //gọi lại nếu thay đổi địa chỉ m_blnHasJustInsert = false; PtramBhytCu = Utility.DecimaltoDbnull(txtPtramBHYT.Text, 0); PtramBhytGocCu = Utility.DecimaltoDbnull(txtptramDauthe.Text, 0); Utility.SetMsg(lblMsg, "Bạn sửa thông tin Bệnh nhân thành công", false); UpdateBNVaoTrenLuoi(); if (_OnActionSuccess != null) _OnActionSuccess(); if (string.IsNullOrEmpty(objLuotkham.MatheBhyt)) { dtInsFromDate.Value = globalVariables.SysDate; dtInsToDate.Value = globalVariables.SysDate; txtPtramBHYT.Text = ""; txtptramDauthe.Text = ""; txtMaDtuong_BHYT.Clear(); txtMaQuyenloi_BHYT.Clear(); txtNoiDongtrusoKCBBD.Clear(); txtOthu4.Clear(); txtOthu5.Clear(); txtOthu6.Clear(); chkTraiTuyen.Checked = false; lblTuyenBHYT.Text = chkTraiTuyen.Checked ? "TRÁI TUYẾN" : "ĐÚNG TUYẾN"; chkChuyenVien.Checked = false; txtNoiphattheBHYT.Clear(); txtNoiDKKCBBD.Clear(); } Utility.GotoNewRowJanus(grdList, KcbLuotkham.Columns.MaLuotkham, txtMaLankham.Text); m_blnCancel = false; break; case ActionResult.Error: Utility.SetMsg(lblMsg, "Bạn thực hiện sửa thông tin không thành công !", true); break; case ActionResult.Cancel: Utility.ShowMsg(string.Format( "Bệnh nhân này đã thanh toán một số dịch vụ nên bạn không được phép chuyển đối tượng hoặc thay đổi phần trăm BHYT\nPhần trăm cũ {0} % - Phần trăm mới {1} %",PtramBhytCu.ToString(),txtPtramBHYT.Text),"Cảnh báo"); break; } }
public ActionResult ThemDonThuoc(KcbDanhsachBenhnhan objBenhnhan, KcbDonthuoc objDonthuoc, KcbDonthuocChitiet[] arrDonthuocChitiet, ref int p_intIdDonthuoc, ref Dictionary<long, long> lstChitietDonthuoc) { try { using (TransactionScope scope = new TransactionScope()) { using (SharedDbConnectionScope sh = new SharedDbConnectionScope()) { objBenhnhan.Save(); if (objBenhnhan != null) { if (objDonthuoc.NgayKedon <= Convert.ToDateTime("01/01/1900")) objDonthuoc.NgayKedon = globalVariables.SysDate; objDonthuoc.IdBenhnhan = objBenhnhan.IdBenhnhan; objDonthuoc.MaLuotkham = ""; objDonthuoc.IdKham = -1; objDonthuoc.IsNew = true; objDonthuoc.TenDonthuoc = ""; objDonthuoc.Save(); p_intIdDonthuoc = objDonthuoc.IdDonthuoc; decimal PtramBH = 0; foreach (KcbDonthuocChitiet objDonthuocChitiet in arrDonthuocChitiet) { objDonthuocChitiet.IdKham = objDonthuoc.IdKham; objDonthuocChitiet.MaLuotkham = objDonthuoc.MaLuotkham; objDonthuocChitiet.IdBenhnhan = objDonthuoc.IdBenhnhan; objDonthuocChitiet.IdDonthuoc = objDonthuoc.IdDonthuoc; objDonthuocChitiet.IsNew = true; objDonthuocChitiet.Save(); if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value)) lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc); } } } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { Utility.CatchException(exception); log.Error("Loi trong qua trinh luu don thuoc {0}", exception); return ActionResult.Error; } }
public ActionResult ThemmoiBenhnhan(KcbDanhsachBenhnhan objKcbDanhsachBenhnhan, KcbLuotkham objLuotkham, KcbDangkyKcb objKcbDangkyKcb, int KieuKham,ref long id_kham) { int v_IdBenhnhan = -1; try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { objKcbDanhsachBenhnhan.IsNew = true; objKcbDanhsachBenhnhan.Save(); //Thêm lần khám objLuotkham.IdBenhnhan = objKcbDanhsachBenhnhan.IdBenhnhan; objLuotkham.SoBenhAn = string.Empty; objLuotkham.SttKham = THU_VIEN_CHUNG.LaySTTKhamTheoDoituong(objLuotkham.IdDoituongKcb); objLuotkham.NgayTao = globalVariables.SysDate; objLuotkham.NguoiTao = globalVariables.UserName; objLuotkham.IsNew = true; objLuotkham.Save(); SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham); if (sqlQueryPatientExam.GetRecordCount() > 0) { string patientCode = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM(); new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.MaLuotkham).EqualTo(patientCode) .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham).Execute(); objLuotkham.MaLuotkham = patientCode; } new Update(KcbDmucLuotkham.Schema) .Set(KcbDmucLuotkham.Columns.TrangThai).EqualTo(2) .Set(KcbDmucLuotkham.Columns.EndTime).EqualTo(DateTime.Now) .Where(KcbDmucLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham) .And(KcbDmucLuotkham.Columns.TrangThai).IsLessThanOrEqualTo(1) .And(KcbDmucLuotkham.Columns.UsedBy).IsLessThanOrEqualTo(globalVariables.UserName) .Execute(); //.And(KcbDmucLuotkham.Columns.Nam).IsEqualTo(globalVariables.SysDate.Year)//Tạm bỏ tránh máy client cố tình điều chỉnh khác máy server ; if (objKcbDangkyKcb != null)//Đôi lúc người dùng không chọn phòng khám { objKcbDangkyKcb.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham); objKcbDangkyKcb.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan); id_kham = AddRegExam(objKcbDangkyKcb, objLuotkham, false, KieuKham); } scope.Complete(); return ActionResult.Success; } } } catch (Exception ex) { log.Error("loi trong qua trinh cap nhap thong tin them moi thong tin benh nhan tiep don {0}", ex); return ActionResult.Error; } }
private void UpdatePatientInfo(KcbDanhsachBenhnhan objPatientInfo) { using (var scope = new TransactionScope()) { new Update(KcbDanhsachBenhnhan.Schema) .Set(KcbDanhsachBenhnhan.Columns.TenBenhnhan).EqualTo(objPatientInfo.TenBenhnhan) .Set(KcbDanhsachBenhnhan.Columns.GioiTinh).EqualTo(objPatientInfo.GioiTinh) .Set(KcbDanhsachBenhnhan.Columns.IdGioitinh).EqualTo(objPatientInfo.IdGioitinh) .Set(KcbDanhsachBenhnhan.Columns.DiachiBhyt).EqualTo(objPatientInfo.DiachiBhyt) .Set(KcbDanhsachBenhnhan.Columns.DiaChi).EqualTo(objPatientInfo.DiaChi) .Set(KcbDanhsachBenhnhan.Columns.NamSinh).EqualTo(objPatientInfo.NamSinh) .Set(KcbDanhsachBenhnhan.Columns.NgheNghiep).EqualTo(objPatientInfo.NgheNghiep) .Set(KcbDanhsachBenhnhan.Columns.Email).EqualTo(objPatientInfo.Email) .Set(KcbDanhsachBenhnhan.Columns.MaQuocgia).EqualTo(objPatientInfo.MaQuocgia) .Set(KcbDanhsachBenhnhan.Columns.MaTinhThanhpho).EqualTo(objPatientInfo.MaTinhThanhpho) .Set(KcbDanhsachBenhnhan.Columns.MaQuanhuyen).EqualTo(objPatientInfo.MaQuanhuyen) .Set(KcbDanhsachBenhnhan.Columns.DienThoai).EqualTo(objPatientInfo.DienThoai) .Set(KcbDanhsachBenhnhan.Columns.CoQuan).EqualTo(objPatientInfo.CoQuan) .Set(KcbDanhsachBenhnhan.Columns.NgaySinh).EqualTo(objPatientInfo.NgaySinh) .Set(KcbDanhsachBenhnhan.Columns.Cmt).EqualTo(objPatientInfo.Cmt) .Set(KcbDanhsachBenhnhan.Columns.NgayTiepdon).EqualTo(objPatientInfo.NgayTiepdon) .Set(KcbDanhsachBenhnhan.Columns.NgaySua).EqualTo(objPatientInfo.NgaySua) .Set(KcbDanhsachBenhnhan.Columns.NguoiSua).EqualTo(objPatientInfo.NguoiSua) .Set(KcbDanhsachBenhnhan.Columns.DanToc).EqualTo(objPatientInfo.DanToc) //.Set(KcbDanhsachBenhnhan.Columns.IpMaySua).EqualTo(globalVariables.IpAddress) .Where(KcbDanhsachBenhnhan.Columns.IdBenhnhan).IsEqualTo(objPatientInfo.IdBenhnhan).Execute(); scope.Complete(); } }
/// <summary> /// HAM THUC HIEN HIEN THEM LAN KHAM CUA BENH NHAN /// </summary> /// <param name="objKcbDanhsachBenhnhan"></param> /// <param name="objLuotkham"></param> /// <returns></returns> public ActionResult ThemmoiLuotkham(KcbDanhsachBenhnhan objKcbDanhsachBenhnhan, KcbLuotkham objLuotkham, ref string MaLuotkham) { try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { UpdatePatientInfo(objKcbDanhsachBenhnhan); SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham); if (sqlQueryPatientExam.GetRecordCount() > 0) { objLuotkham.MaLuotkham = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM(); } objLuotkham.IsNew = true; objLuotkham.Save(); new Update(KcbDmucLuotkham.Schema) .Set(KcbDmucLuotkham.Columns.TrangThai).EqualTo(2) .Set(KcbDmucLuotkham.Columns.EndTime).EqualTo(DateTime.Now) .Where(KcbDmucLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham) .And(KcbDmucLuotkham.Columns.TrangThai).IsLessThanOrEqualTo(1) .And(KcbDmucLuotkham.Columns.Nam).IsEqualTo(globalVariables.SysDate.Year) .And(KcbDmucLuotkham.Columns.UsedBy).IsLessThanOrEqualTo(globalVariables.UserName) .Execute(); ; MaLuotkham = objLuotkham.MaLuotkham; scope.Complete(); return ActionResult.Success; } } } catch (Exception ex) { return ActionResult.Error; } }
public ActionResult ThemLankhamMoi(KcbDanhsachBenhnhan objPatientInfo, KcbLuotkham objLuotkham, KcbDangkyKcb objRegExam, int KieuKham,ref long id_kham) { int v_IdBenhnhan = -1; try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { objPatientInfo.IsNew = true; objPatientInfo.Save(); //Thêm lần khám objLuotkham.IdBenhnhan = objPatientInfo.IdBenhnhan; objLuotkham.SoBenhAn = string.Empty; //Tạm bỏ đoạn này //decimal PtramBHYT = THU_VIEN_CHUNG.TinhPtramBHYT(objLuotkham); //if (PtramBHYT != Utility.DecimaltoDbnull(objLuotkham.PtramBhyt)) //{ // log.Info(string.Format("voi benh nhan :{0} va MaLuotkham:{1} ", objPatientInfo.TenBenhnhan, objLuotkham.MaLuotkham)); // log.Info( // string.Format( // "truong hop phan tram tinh toan sai void ptramBHYT:{0} va truyen tu ngoai vao :{1} ", // PtramBHYT, objLuotkham.PtramBhyt)); // objLuotkham.PtramBhyt = PtramBHYT; //} objLuotkham.SttKham = THU_VIEN_CHUNG.LaySTTKhamTheoDoituong(objLuotkham.IdDoituongKcb); objLuotkham.NgayTao = globalVariables.SysDate; objLuotkham.NguoiTao = globalVariables.UserName; objLuotkham.IsNew = true; objLuotkham.Save(); SqlQuery sqlQueryPatientExam = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.IdBenhnhan).IsNotEqualTo(objLuotkham.IdBenhnhan) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham); if (sqlQueryPatientExam.GetRecordCount() > 0) { string patientCode = THU_VIEN_CHUNG.KCB_SINH_MALANKHAM(); new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.MaLuotkham).EqualTo(patientCode) .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham).Execute(); objLuotkham.MaLuotkham = patientCode; } //Đoạn này Rem lại vì ko có ý nghĩa ngoại trú //if (objLuotkham.TrangThai >= 1) //{ // SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema).Where( // KcbLuotkham.Columns.MaLuotkham).IsNotEqualTo(objLuotkham.MaLuotkham) // .And(KcbLuotkham.Columns.SoBenhAn).IsEqualTo(objLuotkham.SoBenhAn) // .And(KcbLuotkham.Columns.TrangThai).IsGreaterThanOrEqualTo(1); // if (sqlQuery.GetRecordCount() > 0) // { // new Update(KcbLuotkham.Schema) // .Set(KcbLuotkham.Columns.SoBenhAn).EqualTo(THU_VIEN_CHUNG.LaySoBenhAn()) // .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham). // Execute(); // } //} if (objRegExam != null)//Đôi lúc người dùng không chọn phòng khám { objRegExam.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham); objRegExam.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan); id_kham = AddRegExam(objRegExam, objLuotkham, false, KieuKham); } scope.Complete(); return ActionResult.Success; } } } catch (Exception ex) { log.Error("loi trong qua trinh cap nhap thong tin them moi thong tin benh nhan tiep don {0}", ex); return ActionResult.Error; } }
public void Insert(string TenBenhnhan,string DiaChi,string MaTinhThanhpho,string MaQuanhuyen,DateTime? NgaySinh,short? NamSinh,byte? IdGioitinh,string GioiTinh,string NgheNghiep,string CoQuan,string Cmt,short? MaQuocgia,string DienThoai,string Email,DateTime NgayTiepdon,string NguoiTiepdon,string DanToc,string TonGiao,DateTime? NgaySua,DateTime? NgayTao,string NguoiSua,string NguoiTao,string DiachiBhyt,string NguonGoc,string IpMaytao,string IpMaysua,string TenMaytao,string TenMaysua,string NguoiLienhe,short? IdKhoaphong,short? Guisms,short? IdDoituong,string Trieuchung,string SoNha,string Pid) { KcbDanhsachBenhnhan item = new KcbDanhsachBenhnhan(); item.TenBenhnhan = TenBenhnhan; item.DiaChi = DiaChi; item.MaTinhThanhpho = MaTinhThanhpho; item.MaQuanhuyen = MaQuanhuyen; item.NgaySinh = NgaySinh; item.NamSinh = NamSinh; item.IdGioitinh = IdGioitinh; item.GioiTinh = GioiTinh; item.NgheNghiep = NgheNghiep; item.CoQuan = CoQuan; item.Cmt = Cmt; item.MaQuocgia = MaQuocgia; item.DienThoai = DienThoai; item.Email = Email; item.NgayTiepdon = NgayTiepdon; item.NguoiTiepdon = NguoiTiepdon; item.DanToc = DanToc; item.TonGiao = TonGiao; item.NgaySua = NgaySua; item.NgayTao = NgayTao; item.NguoiSua = NguoiSua; item.NguoiTao = NguoiTao; item.DiachiBhyt = DiachiBhyt; item.NguonGoc = NguonGoc; item.IpMaytao = IpMaytao; item.IpMaysua = IpMaysua; item.TenMaytao = TenMaytao; item.TenMaysua = TenMaysua; item.NguoiLienhe = NguoiLienhe; item.IdKhoaphong = IdKhoaphong; item.Guisms = Guisms; item.IdDoituong = IdDoituong; item.Trieuchung = Trieuchung; item.SoNha = SoNha; item.Pid = Pid; item.Save(UserName); }
/// <summary> /// Insert dữ liệu khi thêm mới hoàn toàn /// </summary>hàm chen du lieu moi tin day, benhnhan kham benh moi tinh private KcbDanhsachBenhnhan CreatePatientInfo() { var objBenhnhan = new KcbDanhsachBenhnhan(); if (m_enAction == action.Add) objBenhnhan.IdBenhnhan = Utility.Int64Dbnull(txtMaBN.Text, -1); if (m_enAction == action.Update) objBenhnhan.IdBenhnhan = Utility.Int64Dbnull(txtMaBN.Text, -1); objBenhnhan.TenBenhnhan = txtTEN_BN.Text; objBenhnhan.DiaChi = txtDiachi.Text; //Tạm REM lại tìm hiểu tại sao lại gán ="" với đối tượng dịch vụ //if (_IdDoituongKcb == 1) //Đối tượng dịch vụ // objBenhnhan.DiaChi = ""; //else //Đối tượng BHYT objBenhnhan.DiachiBhyt = Utility.sDbnull(txtDiachi_bhyt.Text); objBenhnhan.DienThoai = txtSoDT.Text; objBenhnhan.Email = Utility.sDbnull(txtEmail.Text, ""); //objBenhnhan.Locked = 0; objBenhnhan.NgayTao = globalVariables.SysDate; objBenhnhan.NguoiTao = globalVariables.UserName; objBenhnhan.NguonGoc = "KCB"; objBenhnhan.Cmt = Utility.sDbnull(txtCMT.Text, ""); objBenhnhan.CoQuan = string.Empty; objBenhnhan.NgheNghiep = txtNgheNghiep.Text; objBenhnhan.GioiTinh = cboPatientSex.Text; objBenhnhan.IdGioitinh = Utility.ByteDbnull(cboPatientSex.SelectedValue, 0); objBenhnhan.NamSinh = txtNamSinh.Visible ? Utility.Int16Dbnull(txtNamSinh.Text, null) : Utility.Int16Dbnull(dtpBOD.Value.Year); string BirthDate = txtNamSinh.Visible ? string.Format("{0}/{1}/{2}", 1, 1, txtNamSinh.Text) : dtpBOD.Value.ToString("dd/MM/yyyy"); if (Dates.IsDate(BirthDate)) { objBenhnhan.NgaySinh = Convert.ToDateTime(BirthDate); } else { objBenhnhan.NgaySinh = null; } if (m_enAction == action.Insert) { objBenhnhan.NgayTiepdon = dtCreateDate.Value; objBenhnhan.NguoiTao = globalVariables.UserName; objBenhnhan.IpMaytao = globalVariables.gv_strIPAddress; objBenhnhan.TenMaytao = globalVariables.gv_strComputerName; } if (m_enAction == action.Update) { objBenhnhan.NgaySua = globalVariables.SysDate; objBenhnhan.NguoiSua = globalVariables.UserName; objBenhnhan.NgayTiepdon = dtCreateDate.Value; objBenhnhan.IpMaysua = globalVariables.gv_strIPAddress; objBenhnhan.TenMaysua = globalVariables.gv_strComputerName; } objBenhnhan.DanToc = txtDantoc.Text; return objBenhnhan; }
/// <summary> /// Insert dữ liệu khi thêm mới hoàn toàn /// </summary>hàm chen du lieu moi tin day, benhnhan kham benh moi tinh private KcbDanhsachBenhnhan TaoBenhnhan() { var objBenhnhan = new KcbDanhsachBenhnhan(); if (m_enAction == action.Add || m_enAction == action.Update) { objBenhnhan = KcbDanhsachBenhnhan.FetchByID(Utility.Int64Dbnull(txtMaBN.Text, -1)); if (objBenhnhan == null) return null; objBenhnhan.IsNew = false; objBenhnhan.MarkOld(); } objBenhnhan.TenBenhnhan = txtTEN_BN.Text; objBenhnhan.DiaChi = txtDiachi.Text; objBenhnhan.DienthoaiLienhe = txtSoDT.Text; objBenhnhan.DiachiBhyt = ""; objBenhnhan.DienThoai = txtSoDT.Text; objBenhnhan.Email = Utility.sDbnull(txtEmail.Text, ""); objBenhnhan.NguoiLienhe = Utility.sDbnull(txtNguoiLienhe.Text); objBenhnhan.Fax = Utility.sDbnull(txtFax.Text); objBenhnhan.NgayTao = globalVariables.SysDate; objBenhnhan.NguoiTao = globalVariables.UserName; objBenhnhan.NguonGoc = "KCB"; objBenhnhan.Cmt = ""; objBenhnhan.CoQuan = string.Empty; objBenhnhan.NgheNghiep = ""; objBenhnhan.GioiTinh ="NAM"; objBenhnhan.IdGioitinh = 0; objBenhnhan.NamSinh = Utility.Int16Dbnull(DateTime.Now.Year, 2000); objBenhnhan.KieuBenhnhan = 1;//0= Khách hàng thường đến khám chữa bệnh;1= Người gửi mẫu kiểm nghiệm cá nhân;2= Tổ chức gửi mẫu kiểm nghiệm objBenhnhan.NgaySinh = globalVariables.SysDate; if (m_enAction == action.Insert) { objBenhnhan.NgayTiepdon = dtCreateDate.Value; objBenhnhan.NguoiTao = globalVariables.UserName; objBenhnhan.IpMaytao = globalVariables.gv_strIPAddress; objBenhnhan.TenMaytao = globalVariables.gv_strComputerName; } if (m_enAction == action.Update) { objBenhnhan.NgaySua = globalVariables.SysDate; objBenhnhan.NguoiSua = globalVariables.UserName; objBenhnhan.NgayTiepdon = dtCreateDate.Value; objBenhnhan.IpMaysua = globalVariables.gv_strIPAddress; objBenhnhan.TenMaysua = globalVariables.gv_strComputerName; } return objBenhnhan; }
public void Insert(string TenBenhnhan,string DiaChi,string MaTinhThanhpho,string MaQuanhuyen,DateTime? NgaySinh,short? NamSinh,byte? IdGioitinh,string GioiTinh,string NgheNghiep,string CoQuan,string Cmt,short? MaQuocgia,string DienThoai,string NguoiLienhe,string DienthoaiLienhe,string DiachiLienhe,string Fax,string Email,DateTime NgayTiepdon,string NguoiTiepdon,string DanToc,string TonGiao,DateTime? NgaySua,DateTime? NgayTao,string NguoiSua,string NguoiTao,string DiachiBhyt,string NguonGoc,byte? KieuBenhnhan,byte? MacDinh,string SoTiemchungQg,string IpMaytao,string IpMaysua,string TenMaytao,string TenMaysua,string LastActionName) { KcbDanhsachBenhnhan item = new KcbDanhsachBenhnhan(); item.TenBenhnhan = TenBenhnhan; item.DiaChi = DiaChi; item.MaTinhThanhpho = MaTinhThanhpho; item.MaQuanhuyen = MaQuanhuyen; item.NgaySinh = NgaySinh; item.NamSinh = NamSinh; item.IdGioitinh = IdGioitinh; item.GioiTinh = GioiTinh; item.NgheNghiep = NgheNghiep; item.CoQuan = CoQuan; item.Cmt = Cmt; item.MaQuocgia = MaQuocgia; item.DienThoai = DienThoai; item.NguoiLienhe = NguoiLienhe; item.DienthoaiLienhe = DienthoaiLienhe; item.DiachiLienhe = DiachiLienhe; item.Fax = Fax; item.Email = Email; item.NgayTiepdon = NgayTiepdon; item.NguoiTiepdon = NguoiTiepdon; item.DanToc = DanToc; item.TonGiao = TonGiao; item.NgaySua = NgaySua; item.NgayTao = NgayTao; item.NguoiSua = NguoiSua; item.NguoiTao = NguoiTao; item.DiachiBhyt = DiachiBhyt; item.NguonGoc = NguonGoc; item.KieuBenhnhan = KieuBenhnhan; item.MacDinh = MacDinh; item.SoTiemchungQg = SoTiemchungQg; item.IpMaytao = IpMaytao; item.IpMaysua = IpMaysua; item.TenMaytao = TenMaytao; item.TenMaysua = TenMaysua; item.LastActionName = LastActionName; item.Save(UserName); }
private void BindData() { SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaLanKham.Text); if (sqlQuery.GetRecordCount() > 0) { objLuotkham = sqlQuery.ExecuteSingle <KcbLuotkham>(); if (objLuotkham != null) { txtMaLanKham.Text = Utility.sDbnull(objLuotkham.MaLuotkham); txtSoBHYT.Text = Utility.sDbnull(objLuotkham.MatheBhyt); DmucKhoaphong objLDepartment = DmucKhoaphong.FetchByID(objLuotkham.IdKhoanoitru); if (objLDepartment != null) { txtDepartment_ID.Text = Utility.sDbnull(objLDepartment.IdKhoaphong); txtDepartmentName.Tag = Utility.sDbnull(objLDepartment.IdKhoaphong); txtDepartmentName.Text = Utility.sDbnull(objLDepartment.TenKhoaphong); } KcbDanhsachBenhnhan objPatientInfo = KcbDanhsachBenhnhan.FetchByID(objLuotkham.IdBenhnhan); if (objPatientInfo != null) { txtPatient_Name.Text = Utility.sDbnull(objPatientInfo.TenBenhnhan); txtPatient_ID.Text = Utility.sDbnull(objLuotkham.IdBenhnhan); txtNamSinh.Text = Utility.sDbnull(objPatientInfo.NamSinh); txtTuoi.Text = Utility.sDbnull(DateTime.Now.Year - objPatientInfo.NamSinh); txtPatientSex.Text = objPatientInfo.GioiTinh; // Utility.Int32Dbnull(objPatientInfo.) == 0 ? "Nam" : "Nữ"; } NoitruPhanbuonggiuong objPhanbuonggiuong = NoitruPhanbuonggiuong.FetchByID(IDBuonggiuong); // noitru_nhapvien.LaythongtinBuonggiuongHtai(objLuotkham); if (objPhanbuonggiuong != null) { dtNgayvao.Value = objPhanbuonggiuong.NgayVaokhoa; txtPatientDept_ID.Text = Utility.sDbnull(objPhanbuonggiuong.Id); NoitruDmucBuong objRoom = NoitruDmucBuong.FetchByID(objPhanbuonggiuong.IdBuong); if (objRoom != null) { txtSoPhong.Text = Utility.sDbnull(objRoom.TenBuong); txtSoPhong.Tag = Utility.sDbnull(objPhanbuonggiuong.IdBuong); } NoitruDmucGiuongbenh objNoitruDmucGiuongbenh = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong); if (objNoitruDmucGiuongbenh != null) { txtSoGiuong.Text = Utility.sDbnull(objNoitruDmucGiuongbenh.TenGiuong); txtSoGiuong.Tag = Utility.sDbnull(objPhanbuonggiuong.IdGiuong); } } DataTable dtGia = new dmucgiagiuong_busrule().dsGetList("-1").Tables[0]; dtGia.DefaultView.Sort = NoitruGiabuonggiuong.Columns.SttHthi + "," + NoitruGiabuonggiuong.Columns.TenGia; txtGia.Init(dtGia, new List <string>() { NoitruGiabuonggiuong.Columns.IdGia, NoitruGiabuonggiuong.Columns.MaGia, NoitruGiabuonggiuong.Columns.TenGia }); cboGia.DataSource = dtGia; cboGia.DataMember = NoitruGiabuonggiuong.Columns.IdGia; cboGia.ValueMember = NoitruGiabuonggiuong.Columns.IdGia; cboGia.DisplayMember = NoitruGiabuonggiuong.Columns.TenGia; m_dtDataRoom = THU_VIEN_CHUNG.NoitruTimkiembuongTheokhoa(Utility.Int32Dbnull(txtDepartment_ID.Text)); Utility.SetDataSourceForDataGridEx_Basic(grdBuong, m_dtDataRoom, true, true, "1=1", "sluong_giuong_trong desc,ten_buong"); txtRoom_code.Init(m_dtDataRoom, new List <string>() { NoitruDmucBuong.Columns.IdBuong, NoitruDmucBuong.Columns.MaBuong, NoitruDmucBuong.Columns.TenBuong }); if (grdBuong.DataSource != null) { grdBuong.MoveFirst(); } } else { string tempt = txtMaLanKham.Text; ClearControl(); if (m_dtDataRoom != null) { m_dtDataRoom.Clear(); } if (m_dtDatabed != null) { m_dtDataRoom.Clear(); } txtMaLanKham.Text = tempt; txtMaLanKham.SelectAll(); txtMaLanKham.Focus(); } } }