using System; using System.Collections.Generic; using System.Windows.Forms; using CLIP.eForm.Consent.Dfh.UI.HospitalSvcRef; namespace CLIP.eForm.Consent.Dfh.UI { /// /// 환자목록 > 환자검색 팝업창 클래스 /// /// ///

[설계자]

///

클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)

///

[수정 작성자]

///

클립소프트 기술부 이인희

///

----------------------------------------------------------------------------------------

///

[HISTORY]

///

2016-07-11 : 최초작성

///

----------------------------------------------------------------------------------------

///
public partial class PatientSearchPopup : Form { private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null; private string strSearchText = ""; //검색어 //선택된 환자 등록번호 public string PatientID { get { return strSearchText; } set { strSearchText = value; } } public PatientSearchPopup() { InitializeComponent(); } public PatientSearchPopup(string searchText) { InitializeComponent(); strSearchText = searchText; } private void PatientSearchPopup_Load(object sender, EventArgs e) { if (this.DesignMode) { return; } Dictionary configDic = ConsentMainControl.GetConfigDictionary(); hospitalWebService = WebMethodCommon.GetHospitalWebService(configDic["hospitalSvcUrl"]); InitDataGrid(); InitSearchCondition(); } private void InitSearchCondition() { Dictionary comboItems = new Dictionary(); comboItems.Add("등록번호", "1"); comboItems.Add("환자명", "2"); comboItems.Add("주민번호", "3"); comboSearchType.DataSource = new BindingSource(comboItems, null); comboSearchType.DisplayMember = "Key"; comboSearchType.ValueMember = "Value"; this.textboxSearchText.Text = strSearchText; if (strSearchText.Length > 0) { int iResult = 0; if (int.TryParse(strSearchText, out iResult)) this.comboSearchType.SelectedIndex = 0; else this.comboSearchType.SelectedIndex = 1; this.buttonPatientSelect.PerformClick(); } } private void InitDataGrid() { this.dataGridViewPatientSelectResult.AutoGenerateColumns = false; this.dataGridViewPatientSelectResult.AllowUserToAddRows = false; this.dataGridViewPatientSelectResult.CellClick += new DataGridViewCellEventHandler(dataGridViewPatientSelectResult_CellClick); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "등록번호", "pid", true, 100); //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "합번", "Gubun", true, 80); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "환자성명", "hngnm", true, 100); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "나이", "age", true, 80); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "주민등록번호", "rrgstno1", true, 100); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "주민등록번호", "rrgstno2", true, 100); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "주소", "addr", true, 100); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "휴대전화번호", "mpphontel", true, 120); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "최근보험유형", "lastinsukind", true, 100); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "최근내원일", "lastorddd", true, 100); //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "spcendcnt", "ClnDoctor", true, 100); } private void BindDataGridRows() { string srchcond = this.comboSearchType.SelectedValue.ToString(); string pid = ""; string hngnm = ""; string rrgstno1 = ""; string rrgstno2 = ""; if (srchcond == "1") { pid = this.textboxSearchText.Text.Trim(); } else if (srchcond == "2") { hngnm = this.textboxSearchText.Text.Trim(); } else if (srchcond == "3") { string temp = this.textboxSearchText.Text.Trim(); rrgstno1 = (temp.Length > 6) ? temp.Substring(0, 6) : temp; rrgstno2 = (temp.Length > 6) ? temp.Substring(6) : ""; } PatInfoListVO[] resultData = hospitalWebService.GetSrchPatInfo(srchcond, pid, hngnm, rrgstno1, rrgstno2); if (resultData == null) { return; } this.dataGridViewPatientSelectResult.DataSource = new SortableBindingList(resultData); } private void comboSearchType_SelectedIndexChanged(object sender, EventArgs e) { this.textboxSearchText.Focus(); } private void textboxSearchText_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) this.buttonPatientSelect.PerformClick(); } private void buttonPatientSelect_Click(object sender, EventArgs e) { if (this.textboxSearchText.Text.Trim().Length > 0) { BindDataGridRows(); } else { MessageBox.Show(string.Format(Properties.Resources.msg_error_search_args) , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information); } } private void dataGridViewPatientSelectResult_CellClick(object sender, DataGridViewCellEventArgs e) { PatInfoListVO vo = this.dataGridViewPatientSelectResult.Rows[e.RowIndex].DataBoundItem as PatInfoListVO; if (vo != null) { strSearchText = vo.pid; this.buttonOK.PerformClick(); } } } }