ConsentSelectTabPageConsentSet.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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. ConsentVO[] 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 (ConsentVO 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. ConsentVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentVO;
  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.formId.Equals(vo.formId.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. formId = vo.formId.ToString(),
  122. formCd = vo.formCd.ToString(),
  123. formName = vo.formName,
  124. formPrintName = vo.formPrintName,
  125. prntCnt = vo.prntCnt,
  126. consentMstRid = "-1",
  127. consentState = string.Empty,
  128. inputId = commandControl.CurrentEndUser.UserNo,
  129. inputNm = commandControl.CurrentEndUser.UserName,
  130. ReissueConsentMstRid = 0,
  131. RewriteConsentMstRid = 0,
  132. ocrtagPrntyn = vo.ocrTagYN,
  133. userDrFlag = vo.userDrFlag,
  134. printOnly = vo.prntOnly,
  135. opDiagName = vo.opDiagName,
  136. ocrCode = "",
  137. opName = vo.opName,
  138. drOnly = vo.DrOnly,
  139. // 즐겨찾기에서 Linkcd 호출 되지 않는 현상 수정
  140. linkFormCd = vo.linkFormCd
  141. };
  142. //동의서 맵핑 정보를 상단의 선택된 진료일과 작성자 정보로 한다.
  143. consentMain.PatientInfoCtrl.SetBasicPatientInfo();
  144. consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.formName);
  145. commandControl.PreviewConsent(consentMain);
  146. this.Cursor = currentCursor;
  147. }
  148. #region 트리 노드 추가
  149. /// <summary>
  150. /// parent node 를 생성하여 treeViewConsentSet 에 추가한다
  151. /// </summary>
  152. /// <param name="treeNodeName">Name of the tree node.</param>
  153. /// <param name="treeNodeLabel">The tree node label.</param>
  154. /// <param name="imageIndex">Index of the image.</param>
  155. /// <returns></returns>
  156. private TreeNode AddFirstChildNodeOfTreeView(string treeNodeName, string treeNodeLabel, int imageIndex) {
  157. TreeNode parentNode = new TreeNode(treeNodeLabel);
  158. parentNode.Name = treeNodeName;
  159. parentNode.ImageIndex = imageIndex;
  160. parentNode.SelectedImageIndex = imageIndex;
  161. this.treeViewConsentSet.Nodes.Add(parentNode);
  162. return parentNode;
  163. }
  164. /// <summary>
  165. /// 주어진 parentTreeNode에 자식노드를 추가한다
  166. /// </summary>
  167. /// <param name="parentTreeNode">부모 노드</param>
  168. /// <param name="consentSet">추가할 자식 노드</param>
  169. private void AddConsentNode(TreeNode parentTreeNode, ConsentVO consentSet) {
  170. TreeNode childTreeNode = new TreeNode();
  171. childTreeNode.Text = consentSet.formName; // + "[" + consentSet.FormCd + "]";
  172. childTreeNode.ImageIndex = 0;
  173. childTreeNode.SelectedImageIndex = 0;
  174. childTreeNode.Tag = consentSet;
  175. parentTreeNode.Nodes.Add(childTreeNode);
  176. ContextMenuStrip strip = new ContextMenuStrip();
  177. ToolStripMenuItem setItemDelete = new ToolStripMenuItem();
  178. setItemDelete.Text = "즐겨찾기 삭제";
  179. strip.Items.Add(setItemDelete);
  180. setItemDelete.Click += new EventHandler(setItemDelete_Click);
  181. childTreeNode.ContextMenuStrip = strip;
  182. }
  183. /*
  184. private void AddDeptsConsentSet(ConsentSetVO vo)
  185. {
  186. TreeNode deptNode = this.treeViewConsentSet.Nodes["DEPT"];
  187. if (deptNode.Nodes.ContainsKey(vo.DeptCd))
  188. {
  189. AddConsentNode(deptNode.Nodes[vo.DeptCd], vo);
  190. }
  191. else
  192. {
  193. //해당 부서코드 노드를 생성 한다.
  194. TreeNode deptSubNode = new TreeNode(vo.DeptNm);
  195. deptSubNode.Name = vo.DeptCd;
  196. deptSubNode.ImageIndex = 3;
  197. deptSubNode.SelectedImageIndex = 3;
  198. deptNode.Nodes.Add(deptSubNode);
  199. //부서코드 노드에 동의서들을 추가한다.
  200. AddConsentNode(deptSubNode, vo);
  201. }
  202. }
  203. */
  204. #endregion
  205. #region 트리 컨트롤 이벤트
  206. /// <summary>
  207. /// treeViewConsentSet 더블 클릭 이벤트
  208. /// </summary>
  209. /// <param name="sender">The source of the event.</param>
  210. /// <param name="e">The <see cref="TreeNodeMouseClickEventArgs"/> instance containing the event data.</param>
  211. private void treeViewConsentSet_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) {
  212. if (this.treeViewConsentSet.SelectedNode.Tag != null) {
  213. // 환자정보 체크
  214. // 환자정보가 없을 때 서버 request 후 오류 발생 후 프로그램 종료 발생
  215. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  216. var visitType = commandControl.CurrentTargetPatient?.VisitType ?? null;
  217. // 방문 타입이 없다면 메시지 박스를 보여준다
  218. if (visitType == null) {
  219. MessageBoxDlg.Show(this, string.Format(Properties.Resources.msg_error_no_patient),
  220. string.Format(Properties.Resources.msg_caption_warn),
  221. MessageBoxButtons.OK,
  222. MessageBoxIcon.Information);
  223. return;
  224. }
  225. string electrVisble = ConsentMainControl.SETTING_DATA["ELECTR_CMP"];
  226. if (commandControl.CurrentTargetPatient.VisitType.Equals("O")) {
  227. if (electrVisble.Equals("Y")) {
  228. commandControl.setCompleteSaveButton(true);
  229. }
  230. } else {
  231. if (electrVisble.Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  232. commandControl.setCompleteSaveButton(true);
  233. } else {
  234. commandControl.setCompleteSaveButton(false);
  235. }
  236. }
  237. //if (commandControl.CurrentTargetPatient.VisitType.Equals("O")) {
  238. // commandControl.setCompleteSaveButton(true);
  239. //} else {
  240. // if (ConsentMainControl.SETTING_DATA["ELECTR_CMP"].Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  241. // commandControl.setCompleteSaveButton(true);
  242. // } else {
  243. // commandControl.setCompleteSaveButton(false);
  244. // }
  245. //}
  246. //의사가 아니면 확인저장 비활성화
  247. //if (!commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) {
  248. // commandControl.setCompleteSaveButton(false);
  249. //}
  250. // 미리보기 수행
  251. ExecutePreviewWithSelectedConsent();
  252. RunConsentDualView();
  253. commandControl.SetEnableConsentIssueCommands(true);
  254. /*
  255. ConsentSetVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentSetVO;
  256. if (vo != null)
  257. {
  258. RunConsentDualView();
  259. }
  260. */
  261. }
  262. }
  263. /// <summary>
  264. /// 트리 노드 선택해서 SET 삭제
  265. /// </summary>
  266. /// <param name="sender">The source of the event.</param>
  267. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  268. private void setItemDelete_Click(object sender, EventArgs e) {
  269. ConsentVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentVO;
  270. if (vo == null) {
  271. return;
  272. }
  273. IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this);
  274. Cursor currentCursor = this.Cursor;
  275. try {
  276. this.Cursor = Cursors.WaitCursor;
  277. // 동의서 SET에 추가하는 웹서비스 콜
  278. hospitalWebService.DelUserFormSetList(commandControl.CurrentEndUser.UserNo, vo.formCd, consentMain.ConsentExecuteInfo["dutinstcd"]);
  279. this.Cursor = currentCursor;
  280. } catch (Exception ex) {
  281. throw ex;
  282. } finally {
  283. InitConsentSetTreeView();
  284. this.Cursor = currentCursor;
  285. }
  286. MessageBox.Show(string.Format(Properties.Resources.msg_consent_set_deleted)
  287. , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information);
  288. }
  289. private void RunConsentDualView() {
  290. if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  291. if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  292. commandControl.RunConsentDualView();
  293. }
  294. #endregion
  295. }
  296. }