ConsentSelectTabPageConsentSet.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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:ConsentSelectTabPageConsentSet.cs
  8. //
  9. #endregion
  10. using System;
  11. using System.ComponentModel;
  12. using System.Windows.Forms;
  13. using CLIP.eForm.Consent.Dfh.UI.HospitalSvcRef;
  14. namespace CLIP.eForm.Consent.Dfh.UI
  15. {
  16. /// <summary>
  17. /// 동의서 SET 탭 클래스
  18. /// </summary>
  19. /// <remarks>
  20. /// <p>[설계자]</p>
  21. /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
  22. /// <p>[원본 작성자]</p>
  23. /// <p> 클립소프트 기술부 4팀 이창훈 (chlee@clipsoft.co.kr)</p>
  24. /// <p>[수정 작성자]</p>
  25. /// <p> 클립소프트 기술부 이인희</p>
  26. /// <p>----------------------------------------------------------------------------------------</p>
  27. /// <p>[HISTORY]</p>
  28. /// <p> 2016-06-28 : 최초작성</p>
  29. /// <p>----------------------------------------------------------------------------------------</p>
  30. /// </remarks>
  31. public partial class ConsentSelectTabPageConsentSet : UserControl
  32. {
  33. private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null;
  34. private IConsentMain consentMain = null;
  35. private ConsentCommandCtrl commandControl = null;
  36. public ConsentSelectTabPageConsentSet()
  37. {
  38. InitializeComponent();
  39. }
  40. private void ConsentSelectTabPageConsentSet_Load(object sender, EventArgs e)
  41. {
  42. if (this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime)
  43. {
  44. return;
  45. }
  46. consentMain = ConsentMainControl.GetConsentMainInterface(this);
  47. commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  48. hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]);
  49. if (commandControl.CurrentEndUser != null)
  50. {
  51. InitConsentSetTreeView();
  52. }
  53. }
  54. // 트리 노드 생성 (개인 SET)
  55. public void InitConsentSetTreeView()
  56. {
  57. //개인SET과 진료과SET인 경우
  58. //ConsentSetVO[] arrayData = this.hospitalWebService.GetConsentSetList(commandControl.CurrentEndUser.UserNo,
  59. // commandControl.CurrentEndUser.DeptCode);
  60. ConsentSetVO[] arrayData = this.hospitalWebService.GetConsentSetList(commandControl.CurrentEndUser.UserNo);
  61. this.treeViewConsentSet.Nodes.Clear();
  62. TreeNode personalTreeNode = AddFirstChildNodeOfTreeView("PERS", "개인 SET", 1);
  63. //TreeNode deptTreeNode = AddFirstChildNodeOfTreeView("DEPT", "진료과 SET", 2);
  64. if (arrayData != null)
  65. {
  66. foreach (ConsentSetVO vo in arrayData)
  67. {
  68. if (vo.SetAuth.Equals("PERS_SET"))
  69. {
  70. AddConsentNode(personalTreeNode, vo);
  71. }
  72. //else if (vo.SetAuth.Equals("DEPT_SET"))
  73. //{
  74. // AddDeptsConsentSet(vo);
  75. //}
  76. }
  77. }
  78. this.treeViewConsentSet.Nodes["PERS"].ExpandAll();
  79. //this.treeViewConsentSet.Nodes["DEPT"].Expand();
  80. //사용자의 부서에 해당하는 동의서들만 펼친다.
  81. //if (this.treeViewConsentSet.Nodes["DEPT"].Nodes.ContainsKey(commandControl.CurrentEndUser.DeptCode))
  82. //{
  83. // this.treeViewConsentSet.Nodes["DEPT"].Nodes[commandControl.CurrentEndUser.DeptCode].ExpandAll();
  84. //}
  85. }
  86. // 동의서 미리보기
  87. private void ExecutePreviewWithSelectedConsent()
  88. {
  89. ConsentSetVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentSetVO;
  90. if (vo == null)
  91. {
  92. return;
  93. }
  94. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  95. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  96. consentMain.preParamClean();
  97. PatientInfoCtrl patient = consentMain.PatientInfoCtrl as PatientInfoCtrl;
  98. Cursor currentCursor = this.Cursor;
  99. this.Cursor = Cursors.WaitCursor;
  100. commandControl.CurrentPreviewConsent = new PreviewConsent();
  101. commandControl.CurrentPreviewConsent.FormRid = vo.FormRid.ToString();
  102. commandControl.CurrentPreviewConsent.FormGuid = vo.FormGuid;
  103. commandControl.CurrentPreviewConsent.FormCd = vo.FormCd.ToString();
  104. commandControl.CurrentPreviewConsent.FormName = vo.FormName;
  105. commandControl.CurrentPreviewConsent.PrntCnt = vo.PrntCnt;
  106. commandControl.CurrentPreviewConsent.ConsentMstRid = "-1";
  107. commandControl.CurrentPreviewConsent.ConsentState = string.Empty;
  108. if (commandControl.CurrentTargetPatient.VisitType.Equals("I") || commandControl.CurrentTargetPatient.VisitType.Equals("E"))
  109. {
  110. commandControl.CurrentPreviewConsent.InputId = commandControl.CurrentTargetPatient.MainDrId;
  111. commandControl.CurrentPreviewConsent.InputNm = commandControl.CurrentTargetPatient.MainDrNm;
  112. }
  113. else
  114. {
  115. commandControl.CurrentPreviewConsent.InputId = commandControl.CurrentTargetPatient.MainDrId = commandControl.CurrentEndUser.UserNo;
  116. commandControl.CurrentPreviewConsent.InputNm = commandControl.CurrentTargetPatient.MainDrNm = commandControl.CurrentEndUser.UserName;
  117. }
  118. commandControl.CurrentPreviewConsent.ReissueConsentMstRid = 0;
  119. commandControl.CurrentPreviewConsent.RewriteConsentMstRid = 0;
  120. commandControl.CurrentPreviewConsent.Ocrtagprntyn = vo.OcrTagYN;
  121. commandControl.CurrentPreviewConsent.PrintOnly = vo.PrintOnly;
  122. //동의서 맵핑 정보를 상단의 선택된 진료일과 작성자 정보로 한다.
  123. consentMain.PatientInfoCtrl.SetBasicPatientInfo();
  124. consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.FormName);
  125. commandControl.PreviewConsent(consentMain);
  126. this.Cursor = currentCursor;
  127. }
  128. #region 트리 노드 추가
  129. private TreeNode AddFirstChildNodeOfTreeView(string treeNodeName, string treeNodeLabel, int imageIndex)
  130. {
  131. TreeNode parentNode = new TreeNode(treeNodeLabel);
  132. parentNode.Name = treeNodeName;
  133. parentNode.ImageIndex = imageIndex;
  134. parentNode.SelectedImageIndex = imageIndex;
  135. this.treeViewConsentSet.Nodes.Add(parentNode);
  136. return parentNode;
  137. }
  138. private void AddConsentNode(TreeNode parentTreeNode, ConsentSetVO consentSet)
  139. {
  140. TreeNode childTreeNode = new TreeNode();
  141. childTreeNode.Text = consentSet.FormName; // + "[" + consentSet.FormCd + "]";
  142. childTreeNode.ImageIndex = 0;
  143. childTreeNode.SelectedImageIndex = 0;
  144. childTreeNode.Tag = consentSet;
  145. parentTreeNode.Nodes.Add(childTreeNode);
  146. ContextMenuStrip strip = new ContextMenuStrip();
  147. ToolStripMenuItem setItemDelete = new ToolStripMenuItem();
  148. setItemDelete.Text = "즐겨찾기 삭제";
  149. strip.Items.Add(setItemDelete);
  150. setItemDelete.Click += new EventHandler(setItemDelete_Click);
  151. childTreeNode.ContextMenuStrip = strip;
  152. }
  153. /*
  154. private void AddDeptsConsentSet(ConsentSetVO vo)
  155. {
  156. TreeNode deptNode = this.treeViewConsentSet.Nodes["DEPT"];
  157. if (deptNode.Nodes.ContainsKey(vo.DeptCd))
  158. {
  159. AddConsentNode(deptNode.Nodes[vo.DeptCd], vo);
  160. }
  161. else
  162. {
  163. //해당 부서코드 노드를 생성 한다.
  164. TreeNode deptSubNode = new TreeNode(vo.DeptNm);
  165. deptSubNode.Name = vo.DeptCd;
  166. deptSubNode.ImageIndex = 3;
  167. deptSubNode.SelectedImageIndex = 3;
  168. deptNode.Nodes.Add(deptSubNode);
  169. //부서코드 노드에 동의서들을 추가한다.
  170. AddConsentNode(deptSubNode, vo);
  171. }
  172. }
  173. */
  174. #endregion
  175. #region 트리 컨트롤 이벤트
  176. private void treeViewConsentSet_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
  177. {
  178. if (this.treeViewConsentSet.SelectedNode.Tag != null)
  179. {
  180. IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this);
  181. if (consentMain.ConsentExecuteInfo["patientNo"].Equals(""))
  182. {
  183. MessageBox.Show(this, "환자를 먼저 선택하세요.", string.Format(Properties.Resources.msg_caption_confirm),MessageBoxButtons.OK, MessageBoxIcon.Information);
  184. }
  185. else
  186. {
  187. ExecutePreviewWithSelectedConsent();
  188. RunConsentDualView();
  189. }
  190. /*
  191. ConsentSetVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentSetVO;
  192. if (vo != null)
  193. {
  194. RunConsentDualView();
  195. }
  196. */
  197. }
  198. }
  199. // 트리 노드 선택해서 SET 삭제
  200. private void setItemDelete_Click(object sender, EventArgs e)
  201. {
  202. ConsentSetVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentSetVO;
  203. if (vo == null)
  204. {
  205. return;
  206. }
  207. IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this);
  208. Cursor currentCursor = this.Cursor;
  209. try
  210. {
  211. this.Cursor = Cursors.WaitCursor;
  212. // 동의서 SET에 추가하는 웹서비스 콜
  213. hospitalWebService.DelUserFormSetList(commandControl.CurrentEndUser.UserNo, vo.FormCd);
  214. this.Cursor = currentCursor;
  215. MessageBox.Show(string.Format(Properties.Resources.msg_consent_set_deleted)
  216. , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information);
  217. }
  218. catch (Exception ex)
  219. {
  220. this.Cursor = currentCursor;
  221. throw ex;
  222. }
  223. finally
  224. {
  225. InitConsentSetTreeView();
  226. }
  227. }
  228. private void RunConsentDualView()
  229. {
  230. if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  231. if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  232. commandControl.RunConsentDualView();
  233. }
  234. #endregion
  235. }
  236. }