PatientSelectTabEmergencyPatient.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. using System;
  2. using System.Drawing;
  3. using System.ComponentModel;
  4. using System.Windows.Forms;
  5. using System.Collections.Generic;
  6. using CLIP.eForm.Consent.Dfh.UI.HospitalSvcRef;
  7. namespace CLIP.eForm.Consent.Dfh.UI
  8. {
  9. /// <summary>
  10. /// 환자목록 > 응급 탭 클래스
  11. /// </summary>
  12. /// <remarks>
  13. /// <p>[설계자]</p>
  14. /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
  15. /// <p>[원본 작성자]</p>
  16. /// <p> 클립소프트 기술부 이인희</p>
  17. /// <p>[수정 작성자]</p>
  18. /// <p> </p>
  19. /// <p>----------------------------------------------------------------------------------------</p>
  20. /// <p>[HISTORY]</p>
  21. /// <p> 2016-07-11 : 최초작성</p>
  22. /// <p>----------------------------------------------------------------------------------------</p>
  23. /// </remarks>
  24. public partial class PatientSelectTabEmergencyPatient : UserControl
  25. {
  26. private IConsentMain consentMain = null;
  27. private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null;
  28. public PatientSelectTabEmergencyPatient()
  29. {
  30. InitializeComponent();
  31. }
  32. private void PatientSelectTabEmergencyPatient_Load(object sender, EventArgs e)
  33. {
  34. if (this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime)
  35. {
  36. return;
  37. }
  38. consentMain = ConsentMainControl.GetConsentMainInterface(this);
  39. hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]);
  40. this.dateTimePickerClnDate.Value = DateTime.Now;
  41. InitComboBind();
  42. InitDataGrid();
  43. }
  44. private void InitComboBind()
  45. {
  46. // 진료과
  47. DeptListVO[] deptList = this.hospitalWebService.GetDeptList(GetSelectGubunValue());
  48. if (deptList != null)
  49. {
  50. this.comboDept.DisplayMember = "deptnm";
  51. this.comboDept.ValueMember = "deptcd";
  52. this.comboDept.DataSource = deptList;
  53. }
  54. }
  55. private void InitDataGrid()
  56. {
  57. this.dataGridViewPatientSelectResult.AutoGenerateColumns = false;
  58. this.dataGridViewPatientSelectResult.AllowUserToAddRows = false;
  59. //this.dataGridViewPatientSelectResult.CellPainting += new DataGridViewCellPaintingEventHandler(this.dataGridViewPatientSelectResult_CellPainting);
  60. this.dataGridViewPatientSelectResult.ColumnHeaderMouseClick += new DataGridViewCellMouseEventHandler(this.dataGridViewPatientSelectResult_ColumnHeaderMouseClick);
  61. this.dataGridViewPatientSelectResult.RowPostPaint += new DataGridViewRowPostPaintEventHandler(this.dataGridViewPatientSelectResult_RowPostPaint);
  62. CommonUtil.AddNewCheckBoxColumnToDataGridView(this.dataGridViewPatientSelectResult, "□", "colCheck", true, 30, DataGridViewContentAlignment.MiddleCenter);
  63. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "등록번호", "pid", true, 80);
  64. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "성명", "hngnm", true, 80);
  65. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "입원일자", "indd", true, 80);
  66. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "진료과", "deptnm", true, 100);
  67. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "진료의", "doctornm", true, 80);
  68. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "ER접수과", "erorddeptnm", true, 100);
  69. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "ER진료의", "ermedispclnm", true, 80);
  70. }
  71. #region 환자 조회
  72. private void BindDataGridRows()
  73. {
  74. if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  75. if (this.hospitalWebService == null) this.hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]);
  76. string srchdd = this.dateTimePickerClnDate.Value.ToShortDateString().Replace("-", "");
  77. string orddeptcd = (this.comboDept.Items.Count > 0) ? this.comboDept.SelectedValue.ToString().Trim() : "";
  78. string doctorid = (this.comboDoctor.Items.Count > 0) ? this.comboDoctor.SelectedValue.ToString().Trim() : "";
  79. string pid = this.textBoxSearchText.Text.Trim();
  80. string patstat = GetSelectGubunValue();
  81. PatListVO[] resultData = hospitalWebService.GetErPatList(srchdd, orddeptcd, doctorid, pid, patstat, "");
  82. if (resultData == null)
  83. {
  84. return;
  85. }
  86. this.dataGridViewPatientSelectResult.DataSource = new SortableBindingList<PatListVO>(resultData);
  87. }
  88. private string GetSelectGubunValue()
  89. {
  90. string strGubun = "";
  91. if (this.radioGubunAll.Checked)
  92. {
  93. strGubun = "-";
  94. }
  95. else
  96. {
  97. RadioButton rdoTemp = null;
  98. if (this.radioGubunOutIng.Checked)
  99. rdoTemp = radioGubunOutIng;
  100. else if (this.radioGubunIng.Checked)
  101. rdoTemp = radioGubunIng;
  102. else if (this.radioGubunOut.Checked)
  103. rdoTemp = radioGubunOut;
  104. strGubun = rdoTemp.Tag.ToString();
  105. }
  106. return strGubun;
  107. }
  108. private void comboDept_SelectedIndexChanged(object sender, EventArgs e)
  109. {
  110. // 주치의
  111. DocListVO[] doctorList = this.hospitalWebService.GetDoctorList(DateTime.Now.ToShortDateString().Replace("-", ""),
  112. (this.comboDept.Items.Count > 0) ? this.comboDept.SelectedValue.ToString() : "");
  113. if (doctorList != null)
  114. {
  115. this.comboDoctor.DisplayMember = "doctornm";
  116. this.comboDoctor.ValueMember = "doctorid";
  117. this.comboDoctor.DataSource = doctorList;
  118. }
  119. }
  120. private void buttonPatientSelect_Click(object sender, EventArgs e)
  121. {
  122. Cursor currentCursor = this.Cursor;
  123. try
  124. {
  125. this.Cursor = Cursors.WaitCursor;
  126. BindDataGridRows();
  127. }
  128. catch (Exception ex)
  129. {
  130. throw ex;
  131. }
  132. finally
  133. {
  134. this.Cursor = currentCursor;
  135. }
  136. }
  137. #endregion
  138. #region 환자찾기 버튼 클릭 이벤트
  139. private void textBoxSearchText_KeyDown(object sender, KeyEventArgs e)
  140. {
  141. if (e.KeyCode == Keys.Enter)
  142. {
  143. this.buttonSearchPop.PerformClick();
  144. }
  145. }
  146. private void buttonSearchPop_Click(object sender, EventArgs e)
  147. {
  148. string strTemp = this.textBoxSearchText.Text.Trim();
  149. int iResult;
  150. if (int.TryParse(strTemp, out iResult) && strTemp.Length > 6)
  151. {
  152. this.buttonPatientSelect.PerformClick();
  153. }
  154. else
  155. {
  156. PatientSearchPopup popup = new PatientSearchPopup(textBoxSearchText.Text);
  157. DialogResult result = popup.ShowDialog();
  158. if (result == DialogResult.OK)
  159. {
  160. this.textBoxSearchText.Text = popup.PatientID;
  161. this.buttonPatientSelect.PerformClick();
  162. }
  163. popup.Close();
  164. }
  165. }
  166. #endregion
  167. #region 그리드 이벤트
  168. private void dataGridViewPatientSelectResult_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
  169. {
  170. if (e.ColumnIndex == 0 && e.RowIndex == -1)
  171. {
  172. Image InfoIcon;
  173. if (dataGridViewPatientSelectResult.Columns[0].HeaderText.Equals("□"))
  174. {
  175. InfoIcon = Image.FromFile(@"../../Resources/uncheck.png");
  176. }
  177. else
  178. {
  179. InfoIcon = Image.FromFile(@"../../Resources/check.png");
  180. }
  181. e.Paint(e.CellBounds, DataGridViewPaintParts.All);
  182. e.Graphics.DrawImage(InfoIcon, e.CellBounds);
  183. e.Handled = true;
  184. }
  185. }
  186. private void dataGridViewPatientSelectResult_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  187. {
  188. if (e.ColumnIndex == 0 && e.RowIndex == -1)
  189. {
  190. bool chkStatus = false;
  191. if (dataGridViewPatientSelectResult.Columns[0].HeaderText.Equals("□"))
  192. {
  193. dataGridViewPatientSelectResult.Columns[0].HeaderText = "☑";
  194. chkStatus = true;
  195. }
  196. else
  197. {
  198. dataGridViewPatientSelectResult.Columns[0].HeaderText = "□";
  199. }
  200. foreach (DataGridViewRow r in dataGridViewPatientSelectResult.Rows)
  201. {
  202. r.Cells["colCheck"].Value = chkStatus;
  203. }
  204. dataGridViewPatientSelectResult.RefreshEdit();
  205. }
  206. }
  207. private void dataGridViewPatientSelectResult_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
  208. {
  209. if (e.RowIndex >= 0)
  210. {
  211. string NumberingText = (e.RowIndex + 1).ToString();
  212. // 글자 사이즈 구하기.
  213. SizeF stringSize = e.Graphics.MeasureString(NumberingText, Font);
  214. // 글자에 맞춰 좌표계산.
  215. PointF StringPoint = new PointF
  216. (
  217. Convert.ToSingle(this.dataGridViewPatientSelectResult.RowHeadersWidth - 3 - stringSize.Width),
  218. Convert.ToSingle(e.RowBounds.Y) + this.dataGridViewPatientSelectResult[0, e.RowIndex].ContentBounds.Height * 0.3f
  219. );
  220. // 문자열 그리기.
  221. e.Graphics.DrawString
  222. (
  223. NumberingText,
  224. Font,
  225. Brushes.Black,
  226. StringPoint.X,
  227. StringPoint.Y
  228. );
  229. }
  230. }
  231. private void dataGridViewPatientSelectResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  232. {
  233. if (e.RowIndex > -1)
  234. {
  235. PatListVO vo = this.dataGridViewPatientSelectResult.Rows[e.RowIndex].DataBoundItem as PatListVO;
  236. consentMain.PatientListCtrl.SetChangePID(vo);
  237. }
  238. }
  239. #endregion
  240. public void ClearCheckBox()
  241. {
  242. bool chkStatus = false;
  243. dataGridViewPatientSelectResult.Columns[0].HeaderText = "□";
  244. foreach (DataGridViewRow r in dataGridViewPatientSelectResult.Rows)
  245. {
  246. r.Cells["colCheck"].Value = chkStatus;
  247. }
  248. dataGridViewPatientSelectResult.RefreshEdit();
  249. }
  250. public List<PatListVO> GetCheckPatList()
  251. {
  252. List<PatListVO> voList = new List<PatListVO>();
  253. foreach (DataGridViewRow r in dataGridViewPatientSelectResult.Rows)
  254. {
  255. if (Convert.ToBoolean(r.Cells["colCheck"].Value))
  256. {
  257. voList.Add(r.DataBoundItem as PatListVO);
  258. }
  259. }
  260. return voList;
  261. }
  262. }
  263. }