ConsentSelectTabPageConsentSet.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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.UI.HospitalSvcRef;
  14. using ClipSoft.eForm.Base.Dialog;
  15. namespace CLIP.eForm.Consent.UI {
  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. private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null;
  33. private IConsentMain consentMain = null;
  34. private ConsentCommandCtrl commandControl = null;
  35. public ConsentSelectTabPageConsentSet() {
  36. InitializeComponent();
  37. }
  38. private void initResources() {
  39. consentMain = ConsentMainControl.GetConsentMainInterface(this);
  40. commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  41. hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]);
  42. }
  43. private void ConsentSelectTabPageConsentSet_Load(object sender, EventArgs e) {
  44. if (this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) {
  45. return;
  46. }
  47. consentMain = ConsentMainControl.GetConsentMainInterface(this);
  48. commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  49. hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]);
  50. if (commandControl.CurrentEndUser != null) {
  51. InitConsentSetTreeView();
  52. }
  53. }
  54. /// <summary>
  55. /// 즐겨찾기 트리 노드 생성 (개인 SET)
  56. /// </summary>
  57. public void InitConsentSetTreeView() {
  58. if (consentMain == null || commandControl == null || hospitalWebService == null) {
  59. initResources();
  60. }
  61. //개인SET과 진료과SET인 경우
  62. //ConsentSetVO[] arrayData = this.hospitalWebService.GetConsentSetList(commandControl.CurrentEndUser.UserNo,
  63. // commandControl.CurrentEndUser.DeptCode);
  64. // 동의서 SET 조회
  65. ConsentFormListVO[] arrayData = this.hospitalWebService.GetConsentSetList(commandControl.CurrentEndUser.UserNo, consentMain.ConsentExecuteInfo["dutinstcd"]);
  66. this.treeViewConsentSet.Nodes.Clear();
  67. TreeNode personalTreeNode = AddFirstChildNodeOfTreeView("PERS", "개인 SET", 1);
  68. //TreeNode deptTreeNode = AddFirstChildNodeOfTreeView("DEPT", "진료과 SET", 2);
  69. // 조회 결과를 동의서 node 에 추가
  70. if (arrayData != null) {
  71. foreach (ConsentFormListVO vo in arrayData) {
  72. //if (vo.SetAuth.Equals("PERS_SET"))
  73. {
  74. AddConsentNode(personalTreeNode, vo);
  75. }
  76. //else if (vo.SetAuth.Equals("DEPT_SET"))
  77. //{
  78. // AddDeptsConsentSet(vo);
  79. //}
  80. }
  81. }
  82. this.treeViewConsentSet.Nodes["PERS"].ExpandAll();
  83. //this.treeViewConsentSet.Nodes["DEPT"].Expand();
  84. //사용자의 부서에 해당하는 동의서들만 펼친다.
  85. //if (this.treeViewConsentSet.Nodes["DEPT"].Nodes.ContainsKey(commandControl.CurrentEndUser.DeptCode))
  86. //{
  87. // this.treeViewConsentSet.Nodes["DEPT"].Nodes[commandControl.CurrentEndUser.DeptCode].ExpandAll();
  88. //}
  89. }
  90. /// <summary>
  91. /// 동의서 미리보기
  92. /// </summary>
  93. private void ExecutePreviewWithSelectedConsent() {
  94. ConsentFormListVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentFormListVO;
  95. if (vo == null) {
  96. return;
  97. }
  98. if (!consentMain.checkOperationDocument(vo.formCd)) {
  99. return;
  100. }
  101. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  102. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  103. // 선택된 동의서가 현재 보여지고 있는 동의서와 다른 경우, 임시 저장 여부 확인
  104. if (!consentMain.ConsentExecuteInfo["readOnly"].Equals("Y") &&
  105. !string.IsNullOrEmpty(commandControl.CurrentTargetPatient.PatientCode) &&
  106. commandControl.CurrentPreviewConsent != null && !commandControl.CurrentPreviewConsent.formRid.Equals(vo.formRid.ToString()) &&
  107. (commandControl.CurrentPreviewConsent.consentState == string.Empty || commandControl.CurrentPreviewConsent.consentState == "TEMP")) {
  108. // dbs227, 임시저장 팝업 사용 안함
  109. //DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_confirm_tempsave)
  110. // , string.Format(Properties.Resources.msg_caption_confirm),
  111. // MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  112. //if (result == DialogResult.Yes) {
  113. // consentMain.TempSave();
  114. //}
  115. }
  116. consentMain.preParamClean();
  117. PatientInfoCtrl patient = consentMain.PatientInfoCtrl as PatientInfoCtrl;
  118. Cursor currentCursor = this.Cursor;
  119. this.Cursor = Cursors.WaitCursor;
  120. commandControl.CurrentPreviewConsent = new PreviewConsent {
  121. formRid = vo.formRid.ToString(),
  122. formGuid = vo.formGuid,
  123. formCd = vo.formCd.ToString(),
  124. FormName = vo.formName,
  125. formPrintName = vo.formPrntNm,
  126. prntCnt = vo.printCnt,
  127. consentMstRid = "-1",
  128. consentState = string.Empty,
  129. inputId = commandControl.CurrentEndUser.UserNo,
  130. inputNm = commandControl.CurrentEndUser.UserName,
  131. ReissueConsentMstRid = 0,
  132. RewriteConsentMstRid = 0,
  133. ocrtagPrntyn = vo.ocrTagPrntYn,
  134. userDrFlag = vo.userDrFlag,
  135. printOnly = vo.printOnly,
  136. opDiagName = vo.opDiagNm,
  137. ocrCode = "",
  138. opName = vo.opNm,
  139. drOnly = vo.DrOnly,
  140. // 즐겨찾기에서 Linkcd 호출 되지 않는 현상 수정
  141. linkFormCd = vo.linkFormCd
  142. };
  143. //동의서 맵핑 정보를 상단의 선택된 진료일과 작성자 정보로 한다.
  144. consentMain.PatientInfoCtrl.SetBasicPatientInfo();
  145. consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.formName);
  146. commandControl.PreviewConsent(consentMain);
  147. this.Cursor = currentCursor;
  148. }
  149. #region 트리 노드 추가
  150. /// <summary>
  151. /// parent node 를 생성하여 treeViewConsentSet 에 추가한다
  152. /// </summary>
  153. /// <param name="treeNodeName">Name of the tree node.</param>
  154. /// <param name="treeNodeLabel">The tree node label.</param>
  155. /// <param name="imageIndex">Index of the image.</param>
  156. /// <returns></returns>
  157. private TreeNode AddFirstChildNodeOfTreeView(string treeNodeName, string treeNodeLabel, int imageIndex) {
  158. TreeNode parentNode = new TreeNode(treeNodeLabel);
  159. parentNode.Name = treeNodeName;
  160. parentNode.ImageIndex = imageIndex;
  161. parentNode.SelectedImageIndex = imageIndex;
  162. this.treeViewConsentSet.Nodes.Add(parentNode);
  163. return parentNode;
  164. }
  165. /// <summary>
  166. /// 주어진 parentTreeNode에 자식노드를 추가한다
  167. /// </summary>
  168. /// <param name="parentTreeNode">부모 노드</param>
  169. /// <param name="consentSet">추가할 자식 노드</param>
  170. private void AddConsentNode(TreeNode parentTreeNode, ConsentFormListVO consentSet) {
  171. TreeNode childTreeNode = new TreeNode();
  172. childTreeNode.Text = consentSet.formName; // + "[" + consentSet.FormCd + "]";
  173. childTreeNode.ImageIndex = 0;
  174. childTreeNode.SelectedImageIndex = 0;
  175. childTreeNode.Tag = consentSet;
  176. parentTreeNode.Nodes.Add(childTreeNode);
  177. ContextMenuStrip strip = new ContextMenuStrip();
  178. ToolStripMenuItem setItemDelete = new ToolStripMenuItem();
  179. setItemDelete.Text = "즐겨찾기 삭제";
  180. strip.Items.Add(setItemDelete);
  181. setItemDelete.Click += new EventHandler(setItemDelete_Click);
  182. childTreeNode.ContextMenuStrip = strip;
  183. }
  184. /*
  185. private void AddDeptsConsentSet(ConsentSetVO vo)
  186. {
  187. TreeNode deptNode = this.treeViewConsentSet.Nodes["DEPT"];
  188. if (deptNode.Nodes.ContainsKey(vo.DeptCd))
  189. {
  190. AddConsentNode(deptNode.Nodes[vo.DeptCd], vo);
  191. }
  192. else
  193. {
  194. //해당 부서코드 노드를 생성 한다.
  195. TreeNode deptSubNode = new TreeNode(vo.DeptNm);
  196. deptSubNode.Name = vo.DeptCd;
  197. deptSubNode.ImageIndex = 3;
  198. deptSubNode.SelectedImageIndex = 3;
  199. deptNode.Nodes.Add(deptSubNode);
  200. //부서코드 노드에 동의서들을 추가한다.
  201. AddConsentNode(deptSubNode, vo);
  202. }
  203. }
  204. */
  205. #endregion
  206. #region 트리 컨트롤 이벤트
  207. /// <summary>
  208. /// treeViewConsentSet 더블 클릭 이벤트
  209. /// </summary>
  210. /// <param name="sender">The source of the event.</param>
  211. /// <param name="e">The <see cref="TreeNodeMouseClickEventArgs"/> instance containing the event data.</param>
  212. private void treeViewConsentSet_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) {
  213. if (this.treeViewConsentSet.SelectedNode.Tag != null) {
  214. // 환자정보 체크
  215. // 환자정보가 없을 때 서버 request 후 오류 발생 후 프로그램 종료 발생
  216. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  217. var visitType = commandControl.CurrentTargetPatient?.VisitType ?? null;
  218. // 방문 타입이 없다면 메시지 박스를 보여준다
  219. if (visitType == null) {
  220. MessageBoxDlg.Show(this, string.Format(Properties.Resources.msg_error_no_patient),
  221. string.Format(Properties.Resources.msg_caption_warn),
  222. MessageBoxButtons.OK,
  223. MessageBoxIcon.Information);
  224. return;
  225. }
  226. string electrVisble = ConsentMainControl.SETTING_DATA["ELECTR_CMP"];
  227. if (commandControl.CurrentTargetPatient.VisitType.Equals("O")) {
  228. if (electrVisble.Equals("Y")) {
  229. commandControl.setCompleteSaveButton(true);
  230. }
  231. } else {
  232. if (electrVisble.Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  233. commandControl.setCompleteSaveButton(true);
  234. } else {
  235. commandControl.setCompleteSaveButton(false);
  236. }
  237. }
  238. //if (commandControl.CurrentTargetPatient.VisitType.Equals("O")) {
  239. // commandControl.setCompleteSaveButton(true);
  240. //} else {
  241. // if (ConsentMainControl.SETTING_DATA["ELECTR_CMP"].Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  242. // commandControl.setCompleteSaveButton(true);
  243. // } else {
  244. // commandControl.setCompleteSaveButton(false);
  245. // }
  246. //}
  247. //의사가 아니면 확인저장 비활성화
  248. //if (!commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  249. // commandControl.setCompleteSaveButton(false);
  250. //}
  251. // 미리보기 수행
  252. ExecutePreviewWithSelectedConsent();
  253. RunConsentDualView();
  254. commandControl.SetEnableConsentIssueCommands(true);
  255. /*
  256. ConsentSetVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentSetVO;
  257. if (vo != null)
  258. {
  259. RunConsentDualView();
  260. }
  261. */
  262. }
  263. }
  264. /// <summary>
  265. /// 트리 노드 선택해서 SET 삭제
  266. /// </summary>
  267. /// <param name="sender">The source of the event.</param>
  268. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  269. private void setItemDelete_Click(object sender, EventArgs e) {
  270. ConsentFormListVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentFormListVO;
  271. if (vo == null) {
  272. return;
  273. }
  274. IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this);
  275. Cursor currentCursor = this.Cursor;
  276. try {
  277. this.Cursor = Cursors.WaitCursor;
  278. // 동의서 SET에 추가하는 웹서비스 콜
  279. hospitalWebService.DelUserFormSetList(commandControl.CurrentEndUser.UserNo, vo.formCd, consentMain.ConsentExecuteInfo["dutinstcd"]);
  280. this.Cursor = currentCursor;
  281. } catch (Exception ex) {
  282. throw ex;
  283. } finally {
  284. InitConsentSetTreeView();
  285. this.Cursor = currentCursor;
  286. }
  287. MessageBox.Show(string.Format(Properties.Resources.msg_consent_set_deleted)
  288. , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information);
  289. }
  290. private void RunConsentDualView() {
  291. if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  292. if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  293. commandControl.RunConsentDualView();
  294. }
  295. #endregion
  296. }
  297. }