#region Copyright © 2015 CLIPSOFT Co.,Ltd. All Rights Reserved. // // All rights are reserved. Reproduction or transmission in whole or in part, // in any form or by any means, electronic, mechanical or otherwise, is // prohibited without the prior written consent of the copyright owner. // // Filename:ConsentSelectTabPageConsentSet.cs // #endregion using System; using System.ComponentModel; using System.Windows.Forms; using CLIP.eForm.Consent.UI.HospitalSvcRef; using CLIP.eForm.Consent.UI.ConsentSvcRef; using ClipSoft.eForm.Base.Dialog; using System.Linq; namespace CLIP.eForm.Consent.UI { /// /// 동의서 SET 탭 클래스 /// /// ///

[설계자]

///

클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)

///

[원본 작성자]

///

클립소프트 기술부 4팀 이창훈 (chlee@clipsoft.co.kr)

///

[수정 작성자]

///

클립소프트 기술부 이인희

///

----------------------------------------------------------------------------------------

///

[HISTORY]

///

2016-06-28 : 최초작성

///

----------------------------------------------------------------------------------------

///
public partial class ConsentSelectTabPageConsentSet : UserControl { private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null; private ConsentSvcRef.ConsentSvcSoapClient consentWebService = null; private IConsentMain consentMain = null; private ConsentCommandCtrl commandControl = null; public ConsentSelectTabPageConsentSet() { InitializeComponent(); } private void initResources() { consentMain = ConsentMainControl.GetConsentMainInterface(this); commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]); consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]); } private void ConsentSelectTabPageConsentSet_Load(object sender, EventArgs e) { if (this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) { return; } consentMain = ConsentMainControl.GetConsentMainInterface(this); commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]); consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]); if (commandControl.CurrentEndUser != null) { InitConsentSetTreeView(); } } /// /// 즐겨찾기 트리 노드 생성 (개인 SET) /// public void InitConsentSetTreeView() { if (consentMain == null || commandControl == null || hospitalWebService == null) { initResources(); } //개인SET과 진료과SET인 경우 //ConsentSetVO[] arrayData = this.hospitalWebService.GetConsentSetList(commandControl.CurrentEndUser.userId, // commandControl.CurrentEndUser.deptcd); // 동의서 SET 조회 //ConsentSetVO[] arrayData = this.consentWebService.GetConsentSetList(commandControl.CurrentEndUser.userId, consentMain.ConsentExecuteInfo["dutinstcd"]); var today = DateTime.Now.ToString("yyyyMMdd"); ConsentVO[] arrayData = consentWebService.GetConsentSetList(commandControl.CurrentEndUser.userId, consentMain.ConsentExecuteInfo["dutinstcd"], today); this.treeViewConsentSet.Nodes.Clear(); TreeNode personalTreeNode = AddFirstChildNodeOfTreeView("PERS", "개인 SET", 1); //TreeNode deptTreeNode = AddFirstChildNodeOfTreeView("DEPT", "진료과 SET", 2); // 조회 결과를 동의서 node 에 추가 if (arrayData != null) { foreach (ConsentVO vo in arrayData) { AddConsentNode(personalTreeNode, vo); //if (vo.SetAuth.Equals("PERS_SET")) { // AddConsentNode(personalTreeNode, vo); //} //else if (vo.SetAuth.Equals("DEPT_SET")) //{ // AddDeptsConsentSet(vo); //} } } this.treeViewConsentSet.Nodes["PERS"].ExpandAll(); //this.treeViewConsentSet.Nodes["DEPT"].Expand(); //사용자의 부서에 해당하는 동의서들만 펼친다. //if (this.treeViewConsentSet.Nodes["DEPT"].Nodes.ContainsKey(commandControl.CurrentEndUser.deptcd)) //{ // this.treeViewConsentSet.Nodes["DEPT"].Nodes[commandControl.CurrentEndUser.deptcd].ExpandAll(); //} } /// /// 동의서 미리보기 /// private void ExecutePreviewWithSelectedConsent() { ConsentVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentVO; if (vo == null) { return; } if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this); if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; // 선택된 동의서가 현재 보여지고 있는 동의서와 다른 경우, 임시 저장 여부 확인 if (!string.IsNullOrEmpty(commandControl.CurrentTargetPatient.pid) && commandControl.CurrentPreviewConsent != null && !commandControl.CurrentPreviewConsent.FormRid.Equals(vo.formId.ToString()) && (commandControl.CurrentPreviewConsent.ConsentState == string.Empty || commandControl.CurrentPreviewConsent.ConsentState == "TEMP")) { // dbs227, 임시저장 팝업 사용 안함 //DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_confirm_tempsave) // , string.Format(Properties.Resources.msg_caption_confirm), // MessageBoxButtons.YesNo, MessageBoxIcon.Information); //if (result == DialogResult.Yes) { // consentMain.TempSave(); //} } consentMain.preParamClean(); PatientInfoCtrl patient = consentMain.PatientInfoCtrl as PatientInfoCtrl; Cursor currentCursor = this.Cursor; this.Cursor = Cursors.WaitCursor; commandControl.CurrentPreviewConsent = new PreviewConsent { FormRid = vo.formId.ToString(), FormCd = vo.formCode.ToString(), FormName = vo.formName, FormPrintName = vo.formPrntNm, PrntCnt = vo.printCnt, ConsentMstRid = vo.consentMstRid.ToString(), ConsentState = vo.consentState, Ocrcode = vo.ocrTag, certPass = vo.certPass, InputId = commandControl.CurrentEndUser.userId, InputNm = commandControl.CurrentEndUser.userName, ReissueConsentMstRid = 0, RewriteConsentMstRid = 0, OpDiagName = commandControl.CurrentTargetPatient.OpDiagName, VisitType = commandControl.CurrentTargetPatient.ordtype, OpName = commandControl.CurrentTargetPatient.OpName }; //동의서 맵핑 정보를 상단의 선택된 진료일과 작성자 정보로 한다. consentMain.PatientInfoCtrl.SetBasicPatientInfo(); consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.formName); commandControl.PreviewConsent(consentMain); this.Cursor = currentCursor; } #region 트리 노드 추가 /// /// parent node 를 생성하여 treeViewConsentSet 에 추가한다 /// /// Name of the tree node. /// The tree node label. /// Index of the image. /// private TreeNode AddFirstChildNodeOfTreeView(string treeNodeName, string treeNodeLabel, int imageIndex) { TreeNode parentNode = new TreeNode(treeNodeLabel); parentNode.Name = treeNodeName; parentNode.ImageIndex = imageIndex; parentNode.SelectedImageIndex = imageIndex; this.treeViewConsentSet.Nodes.Add(parentNode); return parentNode; } /// /// 주어진 parentTreeNode에 자식노드를 추가한다 /// /// 부모 노드 /// 추가할 자식 노드 private void AddConsentNode(TreeNode parentTreeNode, ConsentVO vo) { TreeNode childTreeNode = new TreeNode(); childTreeNode.Text = vo.formName; // + "[" + consentSet.FormCd + "]"; childTreeNode.ImageIndex = 0; childTreeNode.SelectedImageIndex = 0; childTreeNode.Tag = vo; parentTreeNode.Nodes.Add(childTreeNode); ContextMenuStrip strip = new ContextMenuStrip(); ToolStripMenuItem setItemDelete = new ToolStripMenuItem(); setItemDelete.Text = "즐겨찾기 삭제"; strip.Items.Add(setItemDelete); setItemDelete.Click += new EventHandler(setItemDelete_Click); childTreeNode.ContextMenuStrip = strip; } /* private void AddDeptsConsentSet(ConsentSetVO vo) { TreeNode deptNode = this.treeViewConsentSet.Nodes["DEPT"]; if (deptNode.Nodes.ContainsKey(vo.DeptCd)) { AddConsentNode(deptNode.Nodes[vo.DeptCd], vo); } else { //해당 부서코드 노드를 생성 한다. TreeNode deptSubNode = new TreeNode(vo.DeptNm); deptSubNode.Name = vo.DeptCd; deptSubNode.ImageIndex = 3; deptSubNode.SelectedImageIndex = 3; deptNode.Nodes.Add(deptSubNode); //부서코드 노드에 동의서들을 추가한다. AddConsentNode(deptSubNode, vo); } } */ #endregion #region 트리 컨트롤 이벤트 /// /// treeViewConsentSet 더블 클릭 이벤트 /// /// The source of the event. /// The instance containing the event data. private void treeViewConsentSet_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (this.treeViewConsentSet.SelectedNode.Tag != null) { // 환자정보 체크 // 환자정보가 없을 때 서버 request 후 오류 발생 후 프로그램 종료 발생 if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; var visitType = commandControl.CurrentTargetPatient?.ordtype ?? null; // 방문 타입이 없다면 메시지 박스를 보여준다 if (visitType == null) { MessageBoxDlg.Show(this, string.Format(Properties.Resources.msg_error_no_patient), string.Format(Properties.Resources.msg_caption_warn), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } ConsentVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentVO; // 미리보기 수행 ExecutePreviewWithSelectedConsent(); string otps = ""; if (vo.consentState.Equals("임시") || vo.consentState.Equals("확인")) { otps += "FILE_SAVE=true"; if (vo.consentState.Equals("임시")) { otps += ";FILE_TEMP_SAVE=true;FILE_TEMP_SAVE2=true"; } else { otps += ";FILE_TEMP_SAVE=false;FILE_TEMP_SAVE2=false"; } } else if (vo.consentState.Equals("인증")) { otps += "FILE_SAVE=true;FILE_TEMP_SAVE=false;FILE_TEMP_SAVE2=false"; } else { otps += "FILE_SAVE=true;FILE_TEMP_SAVE=false;FILE_TEMP_SAVE2=false"; } consentMain.setDualViewerButtonOtps(otps); // 듀얼뷰어 상태일 때 동의서 로드 RunConsentDualView(); //switch (vo.consentState) { // case "임시": // 임시 // case "확인": // 확인 // // 듀얼뷰어 상태일 때 동의서 로드 // RunConsentDualView(); // break; //} /* ConsentSetVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentSetVO; if (vo != null) { RunConsentDualView(); } */ } } /// /// 트리 노드 선택해서 SET 삭제 /// /// The source of the event. /// The instance containing the event data. private void setItemDelete_Click(object sender, EventArgs e) { ConsentVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentVO; if (vo == null) { MessageBox.Show("마우스 좌클릭하여 선택 한 후 삭제하세요."); return; } IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this); Cursor currentCursor = this.Cursor; try { this.Cursor = Cursors.WaitCursor; // 동의서 SET에 추가하는 웹서비스 콜 hospitalWebService.DelUserFormSetList(vo.idx.ToString(), commandControl.CurrentEndUser.userId, vo.formCode, consentMain.ConsentExecuteInfo["dutinstcd"]); this.Cursor = currentCursor; } catch (Exception ex) { throw ex; } finally { InitConsentSetTreeView(); this.Cursor = currentCursor; } MessageBox.Show(string.Format(Properties.Resources.msg_consent_set_deleted) , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information); } private void RunConsentDualView() { if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this); if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; commandControl.RunConsentDualView(); } #endregion } }