private void OnDisplayPatientList() { lock (ThisLock) { Result result = PatientBus.GetBenhNhanThanThuocList(_name, _type); if (result.IsOK) { dgPatient.Invoke(new MethodInvoker(delegate() { ClearData(); DataTable dt = result.QueryResult as DataTable; if (_dtTemp == null) { _dtTemp = dt.Clone(); } UpdateChecked(dt); dgPatient.DataSource = dt; lbKetQuaTimDuoc.Text = string.Format("Kết quả tìm được: {0}", dt.Rows.Count); })); } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("PatientBus.GetBenhNhanThanThuocList"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PatientBus.GetBenhNhanThanThuocList")); } } }
private void btnMerge_Click(object sender, EventArgs e) { if (dgMergePatient.SelectedRows == null || dgMergePatient.SelectedRows.Count <= 0) { MsgBox.Show(Application.ProductName, "Vui lòng chọn bệnh nhân cần giữ lại.", IconType.Information); return; } string keepPatientGUID = (dgMergePatient.SelectedRows[0].DataBoundItem as DataRowView).Row["PatientGUID"].ToString(); foreach (DataGridViewRow row in dgMergePatient.Rows) { DataRow dr = (row.DataBoundItem as DataRowView).Row; if (dr["PatientGUID"].ToString() != keepPatientGUID) { string mergePatientGUID = dr["PatientGUID"].ToString(); Result result = PatientBus.Merge2Patients(keepPatientGUID, mergePatientGUID); if (!result.IsOK) { MsgBox.Show(this.Text, result.GetErrorAsString("PatientBus.Merge2Patients"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PatientBus.Merge2Patients")); return; } } } MsgBox.Show("Merge benh nhan", "Merge kết thúc", IconType.Information); if (Form.ActiveForm != null) { Form.ActiveForm.Close(); } }
private void InitData() { try { Cursor.Current = Cursors.WaitCursor; dtpkNgaySieuAm.Value = DateTime.Now; DisplayDSBacSiChiDinh(); DisplayDSBasSiSieuAm(); DisplayLoaiSieuAm(); btnHinh1.Enabled = _allowEdit; btnHinh2.Enabled = _allowEdit; if (_allowEdit) { //if (!Global.TVHomeConfig.SuDungSieuAm) //{ // PlayCapFactory.RunPlayCapProcess(false); // PlayCapFactory.OnCaptureCompletedEvent += new CaptureCompletedHandler(PlayCapFactory_OnCaptureCompletedEvent); //} //else { btnHinh1.Visible = false; btnHinh2.Visible = false; _watchingFolder = new WatchingFolder(); _watchingFolder.OnCreatedFileEvent += new CreatedFileEventHandler(_watchingFolder_OnCreatedFileEvent); _watchingFolder.StartMoritoring(Global.HinhChupPath); if (!Utility.CheckRunningProcess(Const.TVHomeProcessName)) { Utility.ExecuteFile(Global.TVHomeConfig.Path); } } } Result result = PatientBus.GetPatient2(_patientGUID); if (result.IsOK) { PatientView patient = result.QueryResult as PatientView; _maBenhNhan = patient.FileNum; } else { MsgBox.Show(this.Text, result.GetErrorAsString("PatientBus.GetPatient"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PatientBus.GetPatient")); } } catch (Exception ex) { MsgBox.Show(this.Text, ex.Message, IconType.Error); Utility.WriteToTraceLog(ex.Message); } }
private void OnDisplayPatientList() { lock (ThisLock) { Result result = null; if (_patientSearchType == Common.PatientSearchType.BenhNhan) { result = PatientBus.GetPatientList(_name, _type); } else if (_patientSearchType == Common.PatientSearchType.BenhNhanThanThuoc) { result = PatientBus.GetBenhNhanThanThuocList(_name, _type); } else if (_patientSearchType == Common.PatientSearchType.BenhNhanKhongThanThuoc) { result = PatientBus.GetBenhNhanKhongThanThuocList(_name, _type); } else if (_patientSearchType == Common.PatientSearchType.NhanVienHopDong) { result = CompanyContractBus.GetContractMemberList(_hopDongGUID, _serviceGUID, _patientGUID, _name, _type); } if (result.IsOK) { dgPatient.Invoke(new MethodInvoker(delegate() { ClearDataSource(); DataTable dt = result.QueryResult as DataTable; if (_dtTemp == null) { _dtTemp = dt.Clone(); } if (_isMulti) { UpdateChecked(dt); } dgPatient.DataSource = dt; lbKetQuaTimDuoc.Text = string.Format("Kết quả tìm được: {0}", dt.Rows.Count); })); } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("PatientBus.GetPatientList"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PatientBus.GetPatientList")); } } }
private void OnDeleteBenhNhanThanThuoc() { List <string> deletedPatientList = new List <string>(); List <DataRow> deletedRows = _dictPatient.Values.ToList(); foreach (DataRow row in deletedRows) { string patientGUID = row["PatientGUID"].ToString(); deletedPatientList.Add(patientGUID); } if (deletedPatientList.Count > 0) { if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những bệnh nhân thân thuộc mà bạn đã đánh dấu ?") == DialogResult.Yes) { Result result = PatientBus.DeleteBenhNhanThanThuoc(deletedPatientList); if (result.IsOK) { DataTable dt = dgPatient.DataSource as DataTable; if (dt == null || dt.Rows.Count <= 0) { return; } foreach (string key in deletedPatientList) { DataRow[] rows = dt.Select(string.Format("PatientGUID='{0}'", key)); if (rows != null && rows.Length > 0) { dt.Rows.Remove(rows[0]); } } _dictPatient.Clear(); _dtTemp.Rows.Clear(); } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("PatientBus.DeletePatient"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PatientBus.DeletePatient")); } } } else { MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những bệnh nhân thân thuộc cần xóa.", IconType.Information); } }
private void GenerateCode() { Cursor.Current = Cursors.WaitCursor; Result result = PatientBus.GetPatientCount(); if (result.IsOK) { int count = Convert.ToInt32(result.QueryResult); txtFileNum.Text = "VGH"; txtNo.Text = Utility.GetCode(string.Empty, count + 1, 5); } else { MsgBox.Show(this.Text, result.GetErrorAsString("PatientBus.GetPatientCount"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PatientBus.GetPatientCount")); } }
private void OnDisplayPatientList() { lock (ThisLock) { Result result; if (!_isContractMember) { result = PatientBus.GetPatientListNotInCompany(_name, _type, _doiTuong); } else { result = CompanyBus.GetCompanyMemberListNotInContractMember(_companyGUID, _contractGUID, _name, _type, _doiTuong); } if (result.IsOK) { dgMembers.Invoke(new MethodInvoker(delegate() { ClearData(); DataTable dt = result.QueryResult as DataTable; dt = GetDataSource(dt); if (_dtTemp == null) { _dtTemp = dt.Clone(); } UpdateChecked(dt); dgMembers.DataSource = dt; })); } else { if (!_isContractMember) { MsgBox.Show(Application.ProductName, result.GetErrorAsString("PatientBus.GetPatientListNotInCompany"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PatientBus.GetPatientListNotInCompany")); } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("CompanyBus.GetCompanyMemberListNotInContractMember"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("CompanyBus.GetCompanyMemberListNotInContractMember")); } } } }
private bool CheckInfo() { if (txtFullName.Text.Trim() == string.Empty) { MsgBox.Show(this.Text, "Vui lòng nhập họ.", IconType.Information); txtFullName.Focus(); return(false); } if (txtDOB.Text.Trim() == string.Empty) { MsgBox.Show(this.Text, "Vui lòng ngày sinh hoặc năm sinh.", IconType.Information); txtDOB.Focus(); return(false); } if (!Utility.IsValidDOB(txtDOB.Text)) { MsgBox.Show(this.Text, "Ngày sinh hoặc năm sinh chưa đúng. Vui lòng nhập lại", IconType.Information); txtDOB.Focus(); return(false); } string patientGUID = _isNew ? string.Empty : _patient.PatientGUID.ToString(); Result result = PatientBus.CheckPatientExistFileNum(patientGUID, txtFileNum.Text + txtNo.Text); if (result.Error.Code == ErrorCode.EXIST || result.Error.Code == ErrorCode.NOT_EXIST) { if (result.Error.Code == ErrorCode.EXIST) { MsgBox.Show(this.Text, "Mã bệnh nhân này đã tồn tại rồi. Vui lòng nhập mã khác.", IconType.Information); txtFileNum.Focus(); return(false); } } else { MsgBox.Show(this.Text, result.GetErrorAsString("PatientBus.CheckPatientExistFileNum"), IconType.Error); return(false); } return(true); }
private void InitData() { Cursor.Current = Cursors.WaitCursor; cboLanDauTaiKham.SelectedIndex = 0; Result result = PatientBus.GetPatientList(); if (result.IsOK) { DataTable dtPatient = result.QueryResult as DataTable; DataRow row = dtPatient.NewRow(); row["PatientGUID"] = Guid.Empty.ToString(); row["FullName"] = string.Empty; dtPatient.Rows.InsertAt(row, 0); cboBenhNhan.DataSource = dtPatient; } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("PatientBus.GetPatientList"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PatientBus.GetPatientList")); } result = ServicesBus.GetServicesList(); if (result.IsOK) { DataTable dtService = result.QueryResult as DataTable; DataRow row = dtService.NewRow(); row["ServiceGUID"] = Guid.Empty.ToString(); row["Name"] = " "; dtService.Rows.InsertAt(row, 0); cboService.DataSource = dtService; } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("ServicesBus.GetServicesList"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("ServicesBus.GetServicesList")); } }
private void OnDisplayPatientList() { lock (ThisLock) { Result result = PatientBus.GetPatientList(_name, _type); if (result.IsOK) { dgMembers.Invoke(new MethodInvoker(delegate() { ClearData(); DataTable dt = result.QueryResult as DataTable; dgMembers.DataSource = GetDataSource(dt); })); } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("PatientBus.GetPatientList"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PatientBus.GetPatientList")); } } }
private void OnAddBenhNhanThanThuoc() { dlgSelectPatient dlg = new dlgSelectPatient(PatientSearchType.BenhNhanKhongThanThuoc); if (dlg.ShowDialog(this) == DialogResult.OK) { List <DataRow> patientRows = dlg.CheckedPatientRows; if (patientRows == null || patientRows.Count <= 0) { return; } Result result = PatientBus.InsertBenhNhanThanThuoc(patientRows); if (result.IsOK) { SearchAsThread(); } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("PatientBus.DeletePatient"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PatientBus.DeletePatient")); } } }
private void StartFTPUploadThread() { while (_isStartFTPUpload) { LoadConfig(); string[] fileNames = Directory.GetFiles(Global.FTPUploadPath); foreach (var fileName in fileNames) { if (!_isStartFTPUpload) { return; } string fn = Path.GetFileName(fileName); string maBenhNhan = GetMaBenhNhan(fn); if (maBenhNhan == string.Empty) { continue; } Result result = PatientBus.GetPatient(maBenhNhan); if (!result.IsOK) { Utility.WriteToTraceLog(result.GetErrorAsString("PatientBus.GetPatient")); continue; } PatientView patient = result.QueryResult as PatientView; if (patient == null) { continue; } string tenBenhNhan = patient.FullName; string password = Utility.GeneratePassword(5); result = MySQLHelper.CheckUserExist(maBenhNhan); if (result.Error.Code != ErrorCode.EXIST && result.Error.Code != ErrorCode.NOT_EXIST) { Utility.WriteToTraceLog(result.GetErrorAsString("MySQLHelper.CheckUserExist")); continue; } if (result.Error.Code == ErrorCode.NOT_EXIST) { result = MySQLHelper.InsertUser(maBenhNhan, password, tenBenhNhan); if (!result.IsOK) { Utility.WriteToTraceLog(result.GetErrorAsString("MySQLHelper.InsertUser")); continue; } else { if (!AddUserToTextFile(maBenhNhan, password, tenBenhNhan)) { continue; } } } fn = fn.Replace("@", "_"); string remoteFileName = string.Format("{0}/{1}/{2}", Global.FTPFolder, maBenhNhan, fn); result = FTP.UploadFile(Global.FTPConnectionInfo, fileName, remoteFileName); if (!result.IsOK) { Utility.WriteToTraceLog(result.GetErrorAsString("FTP.UploadFile")); } else { File.Delete(fileName); } if (!_isStartFTPUpload) { return; } } if (!_isStartFTPUpload) { return; } Thread.Sleep(1000 * 60 * 5); //Thread.Sleep(1000 * 10); if (!_isStartFTPUpload) { return; } } }
private void OnSaveInfo() { try { _contact.FullName = txtFullName.Text; string surName = string.Empty; string firstName = string.Empty; Utility.GetSurNameFirstNameFromFullName(txtFullName.Text, ref surName, ref firstName); _contact.SurName = surName; _contact.FirstName = firstName; _contact.KnownAs = txtKnownAs.Text; _contact.PreferredName = txtPreferredName.Text; _contact.Archived = false; _contact.DobStr = txtDOB.Text; _contact.IdentityCard = txtIdentityCard.Text; _contact.Occupation = txtOccupation.Text; _contact.CompanyName = txtTenCongTy.Text.Trim() == string.Empty ? "Tự túc" : txtTenCongTy.Text; _contact.HomePhone = txtHomePhone.Text; _contact.WorkPhone = txtWorkPhone.Text; _contact.Mobile = txtMobile.Text; _contact.Email = txtEmail.Text; _contact.FAX = txtFax.Text; _contact.Address = txtAddress.Text; _patient.FileNum = txtFileNum.Text + txtNo.Text; if (_isNew) { _contact.CreatedBy = Guid.Parse(Global.UserGUID); _contact.CreatedDate = DateTime.Now; } else { _contact.UpdatedBy = Guid.Parse(Global.UserGUID); _contact.UpdatedDate = DateTime.Now; } MethodInvoker method = delegate { _contact.Gender = (byte)cboGender.SelectedIndex; if (chkNgayKham.Checked) { _patient.NgayKham = dtpkNgayKham.Value; } else { _patient.NgayKham = null; } //Patient History _patientHistory.Dot_Quy = chkDotQuy.Checked; _patientHistory.Benh_Tim_Mach = chkBenhTimMach.Checked; _patientHistory.Benh_Lao = chkBenhLao.Checked; _patientHistory.Dai_Thao_Duong = chkDaiThaoDuong.Checked; _patientHistory.Dai_Duong_Dang_Dieu_Tri = chkDaiDuongDangDieuTri.Checked; _patientHistory.Viem_Gan_B = chkViemGanB.Checked; _patientHistory.Viem_Gan_C = chkViemGanC.Checked; _patientHistory.Viem_Gan_Dang_Dieu_Tri = chkViemGanDangDieuTri.Checked; _patientHistory.Dong_Kinh = chkDongKinh.Checked; _patientHistory.Hen_Suyen = chkHenSuyen.Checked; _patientHistory.Hut_Thuoc = chkHutThuoc.Checked; _patientHistory.Uong_Ruou = chkUongRuou.Checked; _patientHistory.Chich_Ngua_Viem_Gan_B = chkChichNguaViemGanB.Checked; _patientHistory.Chich_Ngua_Uon_Van = chkChichNguaUonVan.Checked; _patientHistory.Chich_Ngua_Cum = chkChichNguaCum.Checked; _patientHistory.Dang_Co_Thai = chkDangCoThai.Checked; _patientHistory.Di_Ung_Thuoc = chkDiUngThuoc.Checked; if (chkDiUngThuoc.Checked) { _patientHistory.Thuoc_Di_Ung = txtThuocDiUng.Text; } else { _patientHistory.Thuoc_Di_Ung = string.Empty; } _patientHistory.Ung_Thu = chkUngThu.Checked; if (chkUngThu.Checked) { _patientHistory.Co_Quan_Ung_Thu = txtCoQuanUngThu.Text; } else { _patientHistory.Co_Quan_Ung_Thu = string.Empty; } _patientHistory.Benh_Khac = chkBenhKhac.Checked; if (chkBenhKhac.Checked) { _patientHistory.Benh_Gi = txtBenhGi.Text; _patientHistory.Thuoc_Dang_Dung = txtThuocDangDung.Text; } else { _patientHistory.Benh_Gi = string.Empty; _patientHistory.Thuoc_Dang_Dung = string.Empty; } _patientHistory.Tinh_Trang_Gia_Dinh = string.Empty; if (raDocThan.Checked) { _patientHistory.Tinh_Trang_Gia_Dinh = "Độc thân"; } else if (raCoGiaDinh.Checked) { _patientHistory.Tinh_Trang_Gia_Dinh = "Có gia đình"; } else if (raKhac.Checked) { _patientHistory.Tinh_Trang_Gia_Dinh = "Khác"; } Result result = PatientBus.InsertPatient(_contact, _patient, _patientHistory); if (!result.IsOK) { MsgBox.Show(this.Text, result.GetErrorAsString("PatientBus.InsertPatient"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PatientBus.InsertPatient")); this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } }; if (InvokeRequired) { BeginInvoke(method); } else { method.Invoke(); } } catch (Exception e) { MsgBox.Show(this.Text, e.Message, IconType.Error); Utility.WriteToTraceLog(e.Message); } }