ConsentSelectTabConsentSearch.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. #region Copyright © 2015 CLIPSOFT Co.,Ltd. All Rights Reserved.
  2. //
  3. // All rights are reserved. Reproduction or transmission in whole or in part,
  4. // in any form or by any means, electronic, mechanical or otherwise, is
  5. // prohibited without the prior written consent of the copyright owner.
  6. //
  7. // Filename:ConsentSelectTabConsentSearch.cs
  8. //
  9. #endregion
  10. using System;
  11. using System.ComponentModel;
  12. using System.Windows.Forms;
  13. using CLIP.eForm.Consent.Dfh.UI.ConsentSvcRef;
  14. using CLIP.eForm.Consent.Dfh.UI.HospitalSvcRef;
  15. namespace CLIP.eForm.Consent.Dfh.UI
  16. {
  17. /// <summary>
  18. /// 동의서 찾기 탭 클래스
  19. /// </summary>
  20. /// <remarks>
  21. /// <p>[설계자]</p>
  22. /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
  23. /// <p>[원본 작성자]</p>
  24. /// <p> 클립소프트 기술부 4팀 이창훈 (chlee@clipsoft.co.kr)</p>
  25. /// <p>[수정 작성자]</p>
  26. /// <p> 클립소프트 기술부 이인희</p>
  27. /// <p>----------------------------------------------------------------------------------------</p>
  28. /// <p>[HISTORY]</p>
  29. /// <p> 2015-07-30 : 최초작성</p>
  30. /// <p>----------------------------------------------------------------------------------------</p>
  31. /// </remarks>
  32. public partial class ConsentSelectTabConsentSearch : UserControl
  33. {
  34. private ConsentSvcRef.ConsentSvcSoapClient consentWebService = null;
  35. private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null;
  36. private IConsentMain consentMain = null;
  37. private ConsentCommandCtrl commandControl = null;
  38. public ConsentSelectTabConsentSearch()
  39. {
  40. InitializeComponent();
  41. }
  42. private void ConsentSelectTabConsentSearch_Load(object sender, EventArgs e)
  43. {
  44. if (this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime)
  45. {
  46. return;
  47. }
  48. consentMain = ConsentMainControl.GetConsentMainInterface(this);
  49. commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  50. consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]);
  51. hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]);
  52. InitComboBoxConsentType();
  53. InitDataGrid();
  54. }
  55. private void InitDataGrid()
  56. {
  57. this.dataGridViewConsentSelectResult.AllowUserToAddRows = false;
  58. this.dataGridViewConsentSelectResult.CellDoubleClick += new DataGridViewCellEventHandler(dataGridViewConsentSelectResult_CellDoubleClick);
  59. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서명", "FormName", true, 250);
  60. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 코드", "FormCd", true, 100);
  61. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 종류", "FullCategoryName", true, 150);
  62. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 고유코드", "FormGuid", false);
  63. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 고유RID", "FormRid", false);
  64. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "전자서명 여부", "EsignYn", false);
  65. }
  66. #region 동의서 카테고리 바인딩
  67. private void InitComboBoxConsentType()
  68. {
  69. CategoryForDropdownVO[] arrayData = consentWebService.GetCategoryForDropdown("1");
  70. this.comboBoxConsentType.DisplayMember = "CategoryName";
  71. this.comboBoxConsentType.ValueMember = "CategoryId";
  72. this.comboBoxConsentType.DataSource = arrayData;
  73. }
  74. private void comboBoxConsentType_SelectedIndexChanged(object sender, EventArgs e)
  75. {
  76. SetSubConentTypeDataToComboBox();
  77. }
  78. private void SetSubConentTypeDataToComboBox()
  79. {
  80. string comboBoxConsentTypeValue = comboBoxConsentType.SelectedValue.ToString();
  81. if (comboBoxConsentTypeValue.Equals("CATE_ALL"))
  82. {
  83. this.comboBoxConsentSubType.DataSource = null;
  84. this.comboBoxConsentSubType.Enabled = false;
  85. }
  86. else
  87. {
  88. this.comboBoxConsentSubType.Enabled = true;
  89. InitComboBoxConsentSubType(comboBoxConsentTypeValue);
  90. }
  91. }
  92. private void InitComboBoxConsentSubType(string parentValue)
  93. {
  94. CategoryForDropdownVO[] arrayData = consentWebService.GetCategoryForDropdown(parentValue);
  95. this.comboBoxConsentSubType.DisplayMember = "CategoryName";
  96. this.comboBoxConsentSubType.ValueMember = "CategoryId";
  97. this.comboBoxConsentSubType.DataSource = arrayData;
  98. }
  99. #endregion
  100. #region 동의서 조회하고 그리드 바인딩
  101. private void textBoxConsentSearchKeyWord_KeyDown(object sender, KeyEventArgs e)
  102. {
  103. if (e.KeyCode == Keys.Enter)
  104. {
  105. this.buttonConsentSelect.PerformClick();
  106. }
  107. }
  108. private void buttonConsentSelect_Click(object sender, EventArgs e)
  109. {
  110. IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this);
  111. ConsentCommandCtrl commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  112. consentMain.preParamClean();
  113. GetConsentBySearch();
  114. }
  115. private void GetConsentBySearch()
  116. {
  117. Cursor currentCursor = this.Cursor;
  118. try
  119. {
  120. this.Cursor = Cursors.WaitCursor;
  121. string consentType = string.Empty;
  122. if (this.comboBoxConsentSubType.SelectedValue == null)
  123. {
  124. consentType = this.comboBoxConsentType.SelectedValue.ToString();
  125. }
  126. else
  127. {
  128. consentType = this.comboBoxConsentSubType.SelectedValue.ToString();
  129. }
  130. string keyWord = string.Empty;
  131. keyWord = "%" + this.textBoxConsentSearchKeyWord.Text + "%";
  132. ConsentBySearchVO[] arrayData = consentWebService.GetConsentBySearch(consentType, keyWord);
  133. if (arrayData == null)
  134. {
  135. return;
  136. }
  137. this.dataGridViewConsentSelectResult.DataSource = new SortableBindingList<ConsentBySearchVO>(arrayData);
  138. }
  139. catch (Exception ex)
  140. {
  141. throw ex;
  142. }
  143. finally
  144. {
  145. this.Cursor = currentCursor;
  146. }
  147. }
  148. #endregion
  149. #region 그리드 이벤트
  150. private void dataGridViewConsentSelectResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  151. {
  152. ConsentBySearchVO vo = GetCurrentConsentSearchVO(e.RowIndex);
  153. if (vo != null)
  154. {
  155. ExecutePreviewWithSelectedConsent(vo);
  156. RunConsentDualView();
  157. }
  158. }
  159. private void RunConsentDualView()
  160. {
  161. if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  162. if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  163. commandControl.RunConsentDualView();
  164. }
  165. private void dataGridViewConsentSelectResult_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e)
  166. {
  167. if (e.RowIndex >= 0 && this.dataGridViewConsentSelectResult.Rows[e.RowIndex].Selected == true)
  168. {
  169. ContextMenuStrip strip = new ContextMenuStrip();
  170. ToolStripMenuItem setItemAdd = new ToolStripMenuItem();
  171. setItemAdd.Text = "즐겨찾기 추가";
  172. strip.Items.Add(setItemAdd);
  173. setItemAdd.Click += new EventHandler(setItemAdd_Click);
  174. e.ContextMenuStrip = strip;
  175. }
  176. }
  177. // 선택된 동의서를 개인SET에 등록
  178. private void setItemAdd_Click(object sender, EventArgs e)
  179. {
  180. IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this);
  181. ConsentCommandCtrl commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  182. if (this.dataGridViewConsentSelectResult.SelectedRows.Count != 0)
  183. {
  184. Cursor currentCursor = this.Cursor;
  185. try
  186. {
  187. this.Cursor = Cursors.WaitCursor;
  188. ConsentBySearchVO vo = GetCurrentConsentSearchVO(this.dataGridViewConsentSelectResult.SelectedRows[0].Index);
  189. // 동의서 SET에 추가하는 웹서비스 콜
  190. hospitalWebService.SetUserFormSetList(commandControl.CurrentEndUser.UserNo, vo.FormCd);
  191. this.Cursor = currentCursor;
  192. MessageBox.Show(string.Format(Properties.Resources.msg_consent_set_added)
  193. , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information);
  194. }
  195. catch
  196. {
  197. this.Cursor = currentCursor;
  198. }
  199. }
  200. }
  201. #endregion
  202. #region 동의서 미리보기
  203. private ConsentBySearchVO GetCurrentConsentSearchVO(int rowIndex)
  204. {
  205. ConsentBySearchVO vo = null;
  206. if (rowIndex < 0)
  207. {
  208. return vo;
  209. }
  210. vo = this.dataGridViewConsentSelectResult.Rows[rowIndex].DataBoundItem as ConsentBySearchVO;
  211. return vo;
  212. }
  213. private void ExecutePreviewWithSelectedConsent(ConsentBySearchVO vo)
  214. {
  215. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  216. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  217. Cursor currentCursor = this.Cursor;
  218. try
  219. {
  220. this.Cursor = Cursors.WaitCursor;
  221. commandControl.CurrentPreviewConsent = new PreviewConsent();
  222. commandControl.CurrentPreviewConsent.FormRid = vo.FormRid.ToString();
  223. commandControl.CurrentPreviewConsent.FormGuid = vo.FormGuid;
  224. commandControl.CurrentPreviewConsent.FormCd = vo.FormCd.ToString();
  225. commandControl.CurrentPreviewConsent.FormName = vo.FormName;
  226. commandControl.CurrentPreviewConsent.PrntCnt = vo.PrntCnt;
  227. commandControl.CurrentPreviewConsent.ConsentMstRid = "-1";
  228. commandControl.CurrentPreviewConsent.ConsentState = string.Empty;
  229. if (commandControl.CurrentTargetPatient.VisitType.Equals("I") || commandControl.CurrentTargetPatient.VisitType.Equals("E"))
  230. {
  231. commandControl.CurrentPreviewConsent.InputId = commandControl.CurrentTargetPatient.MainDrId;
  232. commandControl.CurrentPreviewConsent.InputNm = commandControl.CurrentTargetPatient.MainDrNm;
  233. }
  234. else
  235. {
  236. commandControl.CurrentPreviewConsent.InputId = commandControl.CurrentTargetPatient.MainDrId = commandControl.CurrentEndUser.UserNo;
  237. commandControl.CurrentPreviewConsent.InputNm = commandControl.CurrentTargetPatient.MainDrNm = commandControl.CurrentEndUser.UserName;
  238. }
  239. commandControl.CurrentPreviewConsent.ReissueConsentMstRid = 0;
  240. commandControl.CurrentPreviewConsent.RewriteConsentMstRid = 0;
  241. commandControl.CurrentPreviewConsent.Ocrtagprntyn = vo.OcrTagYN;
  242. commandControl.CurrentPreviewConsent.PrintOnly = vo.PrntOnly;
  243. //동의서 맵핑 정보를 상단의 선택된 진료일과 작성자 정보로 한다.
  244. //consentMain.PatientInfoCtrl.SetBasicPatientInfo();
  245. consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.FormName);
  246. commandControl.PreviewConsent(consentMain);
  247. this.Cursor = currentCursor;
  248. }
  249. catch
  250. {
  251. this.Cursor = currentCursor;
  252. }
  253. }
  254. #endregion
  255. }
  256. }