PatientSelectTabOperatePatient.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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 PatientSelectTabOperatePatient : UserControl
  25. {
  26. private IConsentMain consentMain = null;
  27. private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null;
  28. public PatientSelectTabOperatePatient()
  29. {
  30. InitializeComponent();
  31. }
  32. private void PatientSelectTabOperatePatient_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, "수술방", "oproomnm", true, 80);
  64. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "병실", "roomcd", true, 60);
  65. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "등록번호", "pid", true, 80);
  66. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "성명", "hngnm", true, 80);
  67. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "집도과", "deptnm", true, 80);
  68. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "집도의", "doctornm", true, 80);
  69. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "마취방법", "anstreqflag", true, 80);
  70. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewPatientSelectResult, "마취의", "anstdrnm", true, 80);
  71. }
  72. #region 환자 조회
  73. private void BindDataGridRows()
  74. {
  75. if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  76. if (this.hospitalWebService == null) this.hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]);
  77. string srchdd = this.dateTimePickerClnDate.Value.ToShortDateString().Replace("-", "");
  78. string orddeptcd = (this.comboDept.Items.Count > 0) ? this.comboDept.SelectedValue.ToString().Trim() : "";
  79. string doctorid = (this.comboDoctor.Items.Count > 0) ? this.comboDoctor.SelectedValue.ToString().Trim() : "";
  80. string pid = this.textBoxSearchText.Text.Trim();
  81. string patstat = GetSelectGubunValue();
  82. PatListVO[] resultData = hospitalWebService.GetOpPatList(srchdd, orddeptcd, doctorid, pid, patstat);
  83. if (resultData == null)
  84. {
  85. return;
  86. }
  87. this.dataGridViewPatientSelectResult.DataSource = new SortableBindingList<PatListVO>(resultData);
  88. }
  89. private string GetSelectGubunValue()
  90. {
  91. string strGubun = "";
  92. RadioButton rdoTemp = null;
  93. if (this.radioGubunAll.Checked)
  94. rdoTemp = radioGubunAll;
  95. else if (this.radioGubunStep1.Checked)
  96. rdoTemp = radioGubunStep1;
  97. else if (this.radioGubunStep2.Checked)
  98. rdoTemp = radioGubunStep2;
  99. else if (this.radioGubunStep3.Checked)
  100. rdoTemp = radioGubunStep3;
  101. else if (this.radioGubunStep4.Checked)
  102. rdoTemp = radioGubunStep4;
  103. strGubun = rdoTemp.Tag.ToString();
  104. return strGubun;
  105. }
  106. private void comboDept_SelectedIndexChanged(object sender, EventArgs e)
  107. {
  108. // 주치의
  109. DocListVO[] doctorList = this.hospitalWebService.GetDoctorList(DateTime.Now.ToShortDateString().Replace("-", ""),
  110. (this.comboDept.Items.Count > 0) ? this.comboDept.SelectedValue.ToString() : "");
  111. if (doctorList != null)
  112. {
  113. this.comboDoctor.DisplayMember = "doctornm";
  114. this.comboDoctor.ValueMember = "doctorid";
  115. this.comboDoctor.DataSource = doctorList;
  116. }
  117. }
  118. private void buttonPatientSelect_Click(object sender, EventArgs e)
  119. {
  120. Cursor currentCursor = this.Cursor;
  121. try
  122. {
  123. this.Cursor = Cursors.WaitCursor;
  124. BindDataGridRows();
  125. }
  126. catch (Exception ex)
  127. {
  128. throw ex;
  129. }
  130. finally
  131. {
  132. this.Cursor = currentCursor;
  133. }
  134. }
  135. #endregion
  136. #region 환자찾기 버튼 클릭 이벤트
  137. private void buttonSearchPop_Click(object sender, EventArgs e)
  138. {
  139. string strTemp = this.textBoxSearchText.Text.Trim();
  140. int iResult;
  141. if (int.TryParse(strTemp, out iResult) && strTemp.Length > 6)
  142. {
  143. this.buttonPatientSelect.PerformClick();
  144. }
  145. else
  146. {
  147. PatientSearchPopup popup = new PatientSearchPopup(textBoxSearchText.Text);
  148. DialogResult result = popup.ShowDialog();
  149. if (result == DialogResult.OK)
  150. {
  151. this.textBoxSearchText.Text = popup.PatientID;
  152. this.buttonPatientSelect.PerformClick();
  153. }
  154. popup.Close();
  155. }
  156. }
  157. private void textBoxSearchText_KeyDown(object sender, KeyEventArgs e)
  158. {
  159. if (e.KeyCode == Keys.Enter)
  160. {
  161. this.buttonSearchPop.PerformClick();
  162. }
  163. }
  164. #endregion
  165. #region 그리드 이벤트
  166. private void dataGridViewPatientSelectResult_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
  167. {
  168. if (e.ColumnIndex == 0 && e.RowIndex == -1)
  169. {
  170. Image InfoIcon;
  171. if (dataGridViewPatientSelectResult.Columns[0].HeaderText.Equals("□"))
  172. {
  173. InfoIcon = Image.FromFile(@"../../Resources/uncheck.png");
  174. }
  175. else
  176. {
  177. InfoIcon = Image.FromFile(@"../../Resources/check.png");
  178. }
  179. e.Paint(e.CellBounds, DataGridViewPaintParts.All);
  180. e.Graphics.DrawImage(InfoIcon, e.CellBounds);
  181. e.Handled = true;
  182. }
  183. }
  184. private void dataGridViewPatientSelectResult_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  185. {
  186. if (e.ColumnIndex == 0 && e.RowIndex == -1)
  187. {
  188. bool chkStatus = false;
  189. if (dataGridViewPatientSelectResult.Columns[0].HeaderText.Equals("□"))
  190. {
  191. dataGridViewPatientSelectResult.Columns[0].HeaderText = "☑";
  192. chkStatus = true;
  193. }
  194. else
  195. {
  196. dataGridViewPatientSelectResult.Columns[0].HeaderText = "□";
  197. }
  198. foreach (DataGridViewRow r in dataGridViewPatientSelectResult.Rows)
  199. {
  200. r.Cells["colCheck"].Value = chkStatus;
  201. }
  202. dataGridViewPatientSelectResult.RefreshEdit();
  203. }
  204. }
  205. private void dataGridViewPatientSelectResult_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
  206. {
  207. if (e.RowIndex >= 0)
  208. {
  209. string NumberingText = (e.RowIndex + 1).ToString();
  210. // 글자 사이즈 구하기.
  211. SizeF stringSize = e.Graphics.MeasureString(NumberingText, Font);
  212. // 글자에 맞춰 좌표계산.
  213. PointF StringPoint = new PointF
  214. (
  215. Convert.ToSingle(this.dataGridViewPatientSelectResult.RowHeadersWidth - 3 - stringSize.Width),
  216. Convert.ToSingle(e.RowBounds.Y) + this.dataGridViewPatientSelectResult[0, e.RowIndex].ContentBounds.Height * 0.3f
  217. );
  218. // 문자열 그리기.
  219. e.Graphics.DrawString
  220. (
  221. NumberingText,
  222. Font,
  223. Brushes.Black,
  224. StringPoint.X,
  225. StringPoint.Y
  226. );
  227. }
  228. }
  229. private void dataGridViewPatientSelectResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  230. {
  231. if (e.RowIndex > -1)
  232. {
  233. PatListVO vo = this.dataGridViewPatientSelectResult.Rows[e.RowIndex].DataBoundItem as PatListVO;
  234. consentMain.PatientListCtrl.SetChangePID(vo);
  235. }
  236. }
  237. #endregion
  238. public void ClearCheckBox()
  239. {
  240. bool chkStatus = false;
  241. dataGridViewPatientSelectResult.Columns[0].HeaderText = "□";
  242. foreach (DataGridViewRow r in dataGridViewPatientSelectResult.Rows)
  243. {
  244. r.Cells["colCheck"].Value = chkStatus;
  245. }
  246. dataGridViewPatientSelectResult.RefreshEdit();
  247. }
  248. public List<PatListVO> GetCheckPatList()
  249. {
  250. List<PatListVO> voList = new List<PatListVO>();
  251. foreach (DataGridViewRow r in dataGridViewPatientSelectResult.Rows)
  252. {
  253. if (Convert.ToBoolean(r.Cells["colCheck"].Value))
  254. {
  255. voList.Add(r.DataBoundItem as PatListVO);
  256. }
  257. }
  258. return voList;
  259. }
  260. }
  261. }