PatientSearchPopup.cs 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Windows.Forms;
  4. using CLIP.eForm.Consent.UI.HospitalSvcRef;
  5. namespace CLIP.eForm.Consent.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. private string dutinstcd = "";
  25. private string m_ServerName = string.Empty;
  26. //선택된 환자 등록번호
  27. public string PatientID
  28. {
  29. get { return strSearchText; }
  30. set { strSearchText = value; }
  31. }
  32. /// <summary>
  33. /// 환자검색 팝업 생성자.
  34. /// 경북대학교병원에서는 근무지기관코드가 필요하므로
  35. /// 경북대학교병원에서 사용할 경우 PatientSearchPopup(string, string)
  36. /// 타입의 생성자를 사용하십시요
  37. /// </summary>
  38. [Obsolete("이 생성자는 근무지기관코드가 추가되지 않았으므로 경북대학교병원에서는 사용하지 마십시요.")]
  39. public PatientSearchPopup()
  40. {
  41. InitializeComponent();
  42. }
  43. /// <summary>
  44. /// 환자검색 팝업 생성자.
  45. /// 경북대학교병원에서는 근무지기관코드가 필요하므로
  46. /// 경북대학교병원에서 사용할 경우 PatientSearchPopup(string, string)
  47. /// 타입의 생성자를 사용하십시요
  48. /// </summary>
  49. /// <param name="searchText"></param>
  50. [Obsolete("이 생성자는 근무지기관코드가 추가되지 않았으므로 경북대학교병원에서는 사용하지 마십시요.")]
  51. public PatientSearchPopup(string searchText)
  52. {
  53. InitializeComponent();
  54. strSearchText = searchText;
  55. }
  56. public PatientSearchPopup(string searchText, string dutinstcd, string p_ServerName) {
  57. InitializeComponent();
  58. strSearchText = searchText;
  59. this.dutinstcd = dutinstcd;
  60. m_ServerName = p_ServerName;
  61. }
  62. private void PatientSearchPopup_Load(object sender, EventArgs e)
  63. {
  64. if (this.DesignMode)
  65. {
  66. return;
  67. }
  68. Dictionary<string, string> configDic = ConsentMainControl.GetConfigDictionary(m_ServerName);
  69. hospitalWebService = WebMethodCommon.GetHospitalWebService(configDic["hospitalSvcUrl"]);
  70. InitDataGrid();
  71. InitSearchCondition();
  72. }
  73. private void InitSearchCondition()
  74. {
  75. Dictionary<string, string> comboItems = new Dictionary<string, string>();
  76. comboItems.Add("등록번호", "1");
  77. comboItems.Add("환자명", "2");
  78. comboItems.Add("주민번호", "3");
  79. comboSearchType.DataSource = new BindingSource(comboItems, null);
  80. comboSearchType.DisplayMember = "Key";
  81. comboSearchType.ValueMember = "Value";
  82. this.textboxSearchText.Text = strSearchText;
  83. if (strSearchText.Length > 0)
  84. {
  85. int iResult = 0;
  86. if (int.TryParse(strSearchText, out iResult))
  87. this.comboSearchType.SelectedIndex = 0;
  88. else
  89. this.comboSearchType.SelectedIndex = 1;
  90. this.buttonPatientSelect.PerformClick();
  91. }
  92. }
  93. private void InitDataGrid()
  94. {
  95. this.dataGridViewPatientSelectResult.AutoGenerateColumns = false;
  96. this.dataGridViewPatientSelectResult.AllowUserToAddRows = false;
  97. this.dataGridViewPatientSelectResult.CellClick += new DataGridViewCellEventHandler(dataGridViewPatientSelectResult_CellClick);
  98. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "등록번호", "pid", true, 100);
  99. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "합번", "Gubun", true, 80);
  100. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "환자성명", "hngnm", true, 100);
  101. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "나이", "age", true, 80);
  102. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "주민등록번호", "rrgstno1", true, 100);
  103. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "주민등록번호", "rrgstno2", true, 100);
  104. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "주소", "addr", true, 100);
  105. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "휴대전화번호", "mpphontel", true, 120);
  106. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "최근보험유형", "lastinsukind", true, 100);
  107. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "최근내원일", "lastorddd", true, 100);
  108. //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "spcendcnt", "ClnDoctor", true, 100);
  109. }
  110. /// <summary>
  111. /// 환자목록을 조회하여 그리드에 매핑
  112. /// </summary>
  113. private void BindDataGridRows()
  114. {
  115. string srchcond = this.comboSearchType.SelectedValue.ToString();
  116. string pid = "";
  117. string hngnm = "";
  118. string rrgstno1 = "";
  119. string rrgstno2 = "";
  120. if (srchcond == "1")
  121. {
  122. pid = this.textboxSearchText.Text.Trim();
  123. }
  124. else if (srchcond == "2")
  125. {
  126. hngnm = this.textboxSearchText.Text.Trim();
  127. }
  128. else if (srchcond == "3")
  129. {
  130. string temp = this.textboxSearchText.Text.Trim();
  131. rrgstno1 = (temp.Length > 6) ? temp.Substring(0, 6) : temp;
  132. rrgstno2 = (temp.Length > 6) ? temp.Substring(6) : "";
  133. }
  134. PatInfoListVO [] resultData = hospitalWebService.GetSrchPatInfo(srchcond, pid, hngnm, rrgstno1, rrgstno2, this.dutinstcd);
  135. if (resultData == null)
  136. {
  137. return;
  138. }
  139. this.dataGridViewPatientSelectResult.DataSource = new SortableBindingList<PatInfoListVO>(resultData);
  140. }
  141. private void comboSearchType_SelectedIndexChanged(object sender, EventArgs e)
  142. {
  143. this.textboxSearchText.Focus();
  144. }
  145. /// <summary>
  146. /// 검색조건 입력 컨트롤 키보드 입력 이벤트
  147. /// </summary>
  148. /// <param name="sender">The source of the event.</param>
  149. /// <param name="e">The <see cref="KeyEventArgs"/> instance containing the event data.</param>
  150. private void textboxSearchText_KeyDown(object sender, KeyEventArgs e)
  151. {
  152. // 엔터키 입력 시 조회
  153. if (e.KeyCode == Keys.Enter)
  154. this.buttonPatientSelect.PerformClick();
  155. }
  156. /// <summary>
  157. /// 조회 버튼 클릭 이벤트
  158. /// </summary>
  159. /// <param name="sender">The source of the event.</param>
  160. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  161. private void buttonPatientSelect_Click(object sender, EventArgs e)
  162. {
  163. // 조회 조건이 있을경우
  164. if (this.textboxSearchText.Text.Trim().Length > 0) {
  165. BindDataGridRows();
  166. }
  167. // 조회 조건이 없을 경우
  168. else {
  169. MessageBox.Show(string.Format(Properties.Resources.msg_error_search_args)
  170. , string.Format(Properties.Resources.msg_caption_confirm),
  171. MessageBoxButtons.OK, MessageBoxIcon.Information);
  172. }
  173. }
  174. private void dataGridViewPatientSelectResult_CellClick(object sender, DataGridViewCellEventArgs e)
  175. {
  176. if(e.RowIndex < 0)
  177. {
  178. return;
  179. }
  180. PatInfoListVO vo = this.dataGridViewPatientSelectResult.Rows[e.RowIndex].DataBoundItem as PatInfoListVO;
  181. if (vo != null)
  182. {
  183. strSearchText = vo.pid;
  184. // 오버라이딩 메서드가 없기 때문에 클릭 이벤트 시 기본 동작만 수행
  185. this.buttonOK.PerformClick();
  186. }
  187. }
  188. }
  189. }