#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:ConsentSelectTabConsentSearch.cs // #endregion using System; using System.ComponentModel; using System.Windows.Forms; using CLIP.eForm.Consent.Dfh.UI.ConsentSvcRef; using CLIP.eForm.Consent.Dfh.UI.HospitalSvcRef; namespace CLIP.eForm.Consent.Dfh.UI { /// /// 동의서 찾기 탭 클래스 /// /// ///

[설계자]

///

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

///

[원본 작성자]

///

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

///

[수정 작성자]

///

클립소프트 기술부 이인희

///

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

///

[HISTORY]

///

2015-07-30 : 최초작성

///

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

///
public partial class ConsentSelectTabConsentSearch : UserControl { private ConsentSvcRef.ConsentSvcSoapClient consentWebService = null; private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null; private IConsentMain consentMain = null; private ConsentCommandCtrl commandControl = null; public ConsentSelectTabConsentSearch() { InitializeComponent(); } private void ConsentSelectTabConsentSearch_Load(object sender, EventArgs e) { if (this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) { return; } consentMain = ConsentMainControl.GetConsentMainInterface(this); commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]); hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]); InitComboBoxConsentType(); InitDataGrid(); } private void InitDataGrid() { this.dataGridViewConsentSelectResult.AllowUserToAddRows = false; this.dataGridViewConsentSelectResult.CellDoubleClick += new DataGridViewCellEventHandler(dataGridViewConsentSelectResult_CellDoubleClick); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서명", "FormName", true, 250); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 코드", "FormCd", true, 100); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 종류", "FullCategoryName", true, 150); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 고유코드", "FormGuid", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 고유RID", "FormRid", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "전자서명 여부", "EsignYn", false); } #region 동의서 카테고리 바인딩 private void InitComboBoxConsentType() { CategoryForDropdownVO[] arrayData = consentWebService.GetCategoryForDropdown("1"); this.comboBoxConsentType.DisplayMember = "CategoryName"; this.comboBoxConsentType.ValueMember = "CategoryId"; this.comboBoxConsentType.DataSource = arrayData; } private void comboBoxConsentType_SelectedIndexChanged(object sender, EventArgs e) { SetSubConentTypeDataToComboBox(); } private void SetSubConentTypeDataToComboBox() { string comboBoxConsentTypeValue = comboBoxConsentType.SelectedValue.ToString(); if (comboBoxConsentTypeValue.Equals("CATE_ALL")) { this.comboBoxConsentSubType.DataSource = null; this.comboBoxConsentSubType.Enabled = false; } else { this.comboBoxConsentSubType.Enabled = true; InitComboBoxConsentSubType(comboBoxConsentTypeValue); } } private void InitComboBoxConsentSubType(string parentValue) { CategoryForDropdownVO[] arrayData = consentWebService.GetCategoryForDropdown(parentValue); this.comboBoxConsentSubType.DisplayMember = "CategoryName"; this.comboBoxConsentSubType.ValueMember = "CategoryId"; this.comboBoxConsentSubType.DataSource = arrayData; } #endregion #region 동의서 조회하고 그리드 바인딩 private void textBoxConsentSearchKeyWord_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { this.buttonConsentSelect.PerformClick(); } } private void buttonConsentSelect_Click(object sender, EventArgs e) { IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this); ConsentCommandCtrl commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; consentMain.preParamClean(); GetConsentBySearch(); } private void GetConsentBySearch() { Cursor currentCursor = this.Cursor; try { this.Cursor = Cursors.WaitCursor; string consentType = string.Empty; if (this.comboBoxConsentSubType.SelectedValue == null) { consentType = this.comboBoxConsentType.SelectedValue.ToString(); } else { consentType = this.comboBoxConsentSubType.SelectedValue.ToString(); } string keyWord = string.Empty; keyWord = "%" + this.textBoxConsentSearchKeyWord.Text + "%"; ConsentBySearchVO[] arrayData = consentWebService.GetConsentBySearch(consentType, keyWord); if (arrayData == null) { return; } this.dataGridViewConsentSelectResult.DataSource = new SortableBindingList(arrayData); } catch (Exception ex) { throw ex; } finally { this.Cursor = currentCursor; } } #endregion #region 그리드 이벤트 private void dataGridViewConsentSelectResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { ConsentBySearchVO vo = GetCurrentConsentSearchVO(e.RowIndex); if (vo != null) { ExecutePreviewWithSelectedConsent(vo); RunConsentDualView(); } } private void RunConsentDualView() { if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this); if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; commandControl.RunConsentDualView(); } private void dataGridViewConsentSelectResult_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e) { if (e.RowIndex >= 0 && this.dataGridViewConsentSelectResult.Rows[e.RowIndex].Selected == true) { ContextMenuStrip strip = new ContextMenuStrip(); ToolStripMenuItem setItemAdd = new ToolStripMenuItem(); setItemAdd.Text = "즐겨찾기 추가"; strip.Items.Add(setItemAdd); setItemAdd.Click += new EventHandler(setItemAdd_Click); e.ContextMenuStrip = strip; } } // 선택된 동의서를 개인SET에 등록 private void setItemAdd_Click(object sender, EventArgs e) { IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this); ConsentCommandCtrl commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; if (this.dataGridViewConsentSelectResult.SelectedRows.Count != 0) { Cursor currentCursor = this.Cursor; try { this.Cursor = Cursors.WaitCursor; ConsentBySearchVO vo = GetCurrentConsentSearchVO(this.dataGridViewConsentSelectResult.SelectedRows[0].Index); // 동의서 SET에 추가하는 웹서비스 콜 hospitalWebService.SetUserFormSetList(commandControl.CurrentEndUser.UserNo, vo.FormCd); this.Cursor = currentCursor; MessageBox.Show(string.Format(Properties.Resources.msg_consent_set_added) , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { this.Cursor = currentCursor; } } } #endregion #region 동의서 미리보기 private ConsentBySearchVO GetCurrentConsentSearchVO(int rowIndex) { ConsentBySearchVO vo = null; if (rowIndex < 0) { return vo; } vo = this.dataGridViewConsentSelectResult.Rows[rowIndex].DataBoundItem as ConsentBySearchVO; return vo; } private void ExecutePreviewWithSelectedConsent(ConsentBySearchVO vo) { if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this); if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; Cursor currentCursor = this.Cursor; try { this.Cursor = Cursors.WaitCursor; commandControl.CurrentPreviewConsent = new PreviewConsent(); commandControl.CurrentPreviewConsent.FormRid = vo.FormRid.ToString(); commandControl.CurrentPreviewConsent.FormGuid = vo.FormGuid; commandControl.CurrentPreviewConsent.FormCd = vo.FormCd.ToString(); commandControl.CurrentPreviewConsent.FormName = vo.FormName; commandControl.CurrentPreviewConsent.PrntCnt = vo.PrntCnt; commandControl.CurrentPreviewConsent.ConsentMstRid = "-1"; commandControl.CurrentPreviewConsent.ConsentState = string.Empty; if (commandControl.CurrentTargetPatient.VisitType.Equals("I") || commandControl.CurrentTargetPatient.VisitType.Equals("E")) { commandControl.CurrentPreviewConsent.InputId = commandControl.CurrentTargetPatient.MainDrId; commandControl.CurrentPreviewConsent.InputNm = commandControl.CurrentTargetPatient.MainDrNm; } else { commandControl.CurrentPreviewConsent.InputId = commandControl.CurrentTargetPatient.MainDrId = commandControl.CurrentEndUser.UserNo; commandControl.CurrentPreviewConsent.InputNm = commandControl.CurrentTargetPatient.MainDrNm = commandControl.CurrentEndUser.UserName; } commandControl.CurrentPreviewConsent.ReissueConsentMstRid = 0; commandControl.CurrentPreviewConsent.RewriteConsentMstRid = 0; commandControl.CurrentPreviewConsent.Ocrtagprntyn = vo.OcrTagYN; commandControl.CurrentPreviewConsent.PrintOnly = vo.PrntOnly; //동의서 맵핑 정보를 상단의 선택된 진료일과 작성자 정보로 한다. //consentMain.PatientInfoCtrl.SetBasicPatientInfo(); consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.FormName); commandControl.PreviewConsent(consentMain); this.Cursor = currentCursor; } catch { this.Cursor = currentCursor; } } #endregion } }