PatientSearchPopup.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Windows.Forms;
  4. using CLIP.eForm.Consent.Dfh.UI.HospitalSvcRef;
  5. namespace CLIP.eForm.Consent.Dfh.UI
  6. {
  7. /// <summary>
  8. /// 환자목록 > 환자검색 팝업창 클래스
  9. /// </summary>
  10. /// <remarks>
  11. /// <p>[설계자]</p>
  12. /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
  13. /// <p>[수정 작성자]</p>
  14. /// <p> 클립소프트 기술부 이인희</p>
  15. /// <p>----------------------------------------------------------------------------------------</p>
  16. /// <p>[HISTORY]</p>
  17. /// <p> 2016-07-11 : 최초작성</p>
  18. /// <p>----------------------------------------------------------------------------------------</p>
  19. /// </remarks>
  20. public partial class PatientSearchPopup : Form
  21. {
  22. private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null;
  23. private string strSearchText = ""; //검색어
  24. //선택된 환자 등록번호
  25. public string PatientID
  26. {
  27. get { return strSearchText; }
  28. set { strSearchText = value; }
  29. }
  30. public PatientSearchPopup()
  31. {
  32. InitializeComponent();
  33. }
  34. public PatientSearchPopup(string searchText)
  35. {
  36. InitializeComponent();
  37. strSearchText = searchText;
  38. }
  39. private void PatientSearchPopup_Load(object sender, EventArgs e)
  40. {
  41. if (this.DesignMode)
  42. {
  43. return;
  44. }
  45. Dictionary<string, string> configDic = ConsentMainControl.GetConfigDictionary();
  46. hospitalWebService = WebMethodCommon.GetHospitalWebService(configDic["hospitalSvcUrl"]);
  47. InitDataGrid();
  48. InitSearchCondition();
  49. }
  50. private void InitSearchCondition()
  51. {
  52. Dictionary<string, string> comboItems = new Dictionary<string, string>();
  53. comboItems.Add("등록번호", "1");
  54. comboItems.Add("환자명", "2");
  55. comboItems.Add("주민번호", "3");
  56. comboSearchType.DataSource = new BindingSource(comboItems, null);
  57. comboSearchType.DisplayMember = "Key";
  58. comboSearchType.ValueMember = "Value";
  59. this.textboxSearchText.Text = strSearchText;
  60. if (strSearchText.Length > 0)
  61. {
  62. int iResult = 0;
  63. if (int.TryParse(strSearchText, out iResult))
  64. this.comboSearchType.SelectedIndex = 0;
  65. else
  66. this.comboSearchType.SelectedIndex = 1;
  67. this.buttonPatientSelect.PerformClick();
  68. }
  69. }
  70. private void InitDataGrid()
  71. {
  72. this.dataGridViewPatientSelectResult.AutoGenerateColumns = false;
  73. this.dataGridViewPatientSelectResult.AllowUserToAddRows = false;
  74. this.dataGridViewPatientSelectResult.CellClick += new DataGridViewCellEventHandler(dataGridViewPatientSelectResult_CellClick);
  75. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "등록번호", "pid", true, 100);
  76. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "합번", "Gubun", true, 80);
  77. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "환자성명", "hngnm", true, 100);
  78. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "나이", "age", true, 80);
  79. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "주민등록번호", "rrgstno1", true, 100);
  80. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "주민등록번호", "rrgstno2", true, 100);
  81. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "주소", "addr", true, 100);
  82. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "휴대전화번호", "mpphontel", true, 120);
  83. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "최근보험유형", "lastinsukind", true, 100);
  84. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "최근내원일", "lastorddd", true, 100);
  85. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "spcendcnt", "ClnDoctor", true, 100);
  86. }
  87. private void BindDataGridRows()
  88. {
  89. string srchcond = this.comboSearchType.SelectedValue.ToString();
  90. string pid = "";
  91. string hngnm = "";
  92. string rrgstno1 = "";
  93. string rrgstno2 = "";
  94. if (srchcond == "1")
  95. {
  96. pid = this.textboxSearchText.Text.Trim();
  97. }
  98. else if (srchcond == "2")
  99. {
  100. hngnm = this.textboxSearchText.Text.Trim();
  101. }
  102. else if (srchcond == "3")
  103. {
  104. string temp = this.textboxSearchText.Text.Trim();
  105. rrgstno1 = (temp.Length > 6) ? temp.Substring(0, 6) : temp;
  106. rrgstno2 = (temp.Length > 6) ? temp.Substring(6) : "";
  107. }
  108. PatInfoListVO[] resultData = hospitalWebService.GetSrchPatInfo(srchcond, pid, hngnm, rrgstno1, rrgstno2);
  109. if (resultData == null)
  110. {
  111. return;
  112. }
  113. this.dataGridViewPatientSelectResult.DataSource = new SortableBindingList<PatInfoListVO>(resultData);
  114. }
  115. private void comboSearchType_SelectedIndexChanged(object sender, EventArgs e)
  116. {
  117. this.textboxSearchText.Focus();
  118. }
  119. private void textboxSearchText_KeyDown(object sender, KeyEventArgs e)
  120. {
  121. if (e.KeyCode == Keys.Enter)
  122. this.buttonPatientSelect.PerformClick();
  123. }
  124. private void buttonPatientSelect_Click(object sender, EventArgs e)
  125. {
  126. if (this.textboxSearchText.Text.Trim().Length > 0)
  127. {
  128. BindDataGridRows();
  129. }
  130. else
  131. {
  132. MessageBox.Show(string.Format(Properties.Resources.msg_error_search_args)
  133. , string.Format(Properties.Resources.msg_caption_confirm),
  134. MessageBoxButtons.OK, MessageBoxIcon.Information);
  135. }
  136. }
  137. private void dataGridViewPatientSelectResult_CellClick(object sender, DataGridViewCellEventArgs e)
  138. {
  139. PatInfoListVO vo = this.dataGridViewPatientSelectResult.Rows[e.RowIndex].DataBoundItem as PatInfoListVO;
  140. if (vo != null)
  141. {
  142. strSearchText = vo.pid;
  143. this.buttonOK.PerformClick();
  144. }
  145. }
  146. }
  147. }