123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457 |
- #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.Drawing;
- using System.Windows.Forms;
- using CLIP.eForm.Consent.UI.ConsentSvcRef;
- using CLIP.eForm.Consent.UI.HospitalSvcRef;
- using System.Linq;
- using System.Diagnostics;
- namespace CLIP.eForm.Consent.UI {
- /// <summary>
- /// 동의서 찾기 탭 클래스
- /// </summary>
- /// <remarks>
- /// <p>[설계자]</p>
- /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
- /// <p>[원본 작성자]</p>
- /// <p> 클립소프트 기술부 4팀 이창훈 (chlee@clipsoft.co.kr)</p>
- /// <p>[수정 작성자]</p>
- /// <p> 클립소프트 기술부 이인희</p>
- /// <p>----------------------------------------------------------------------------------------</p>
- /// <p>[HISTORY]</p>
- /// <p> 2015-07-30 : 최초작성</p>
- /// <p>----------------------------------------------------------------------------------------</p>
- /// </remarks>
- 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();
- // 동의서 찾기에서 기본 카테고리를 해당 기관으로 기본적으로 설정되게끔 변경
- //comboBoxConsentType.SelectedValue = string.Format("EMA_{0}", consentMain.ConsentExecuteInfo["dutinstcd"]);
- InitComboBoxConsentSubType("");
- InitDataGrid();
- }
- /// <summary>
- /// 초기 DataGrid 항목 설정
- /// </summary>
- 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, "동의서 코드", "formCode", true, 100);
- //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 종류", "FullCategoryName", true, 150);
- //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 고유코드", "FormGuid", false);
- //CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "전자서명 여부", "EsignYn", false);
- // 화면에 표시하지 않을 컬럼
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "주치의", "mainDrId", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 고유ID", "formId", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 출력 이름", "formPrntNm", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "출력 매수", "printCnt", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "환자명", "pid", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "인덱스", "idx", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "부서 영문명", "deptEngName", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 상태", "consentState", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 마스터 RID", "consentMstRid", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "OCRTAG", "ocrTag", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "환자이름", "patientName", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수정자ID", "modifyUserId", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수정자 이름", "modifyUserNm", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수정일자", "modifyDatetime", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "certPass", "certPass", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "생성일자", "createDatetime", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료일자", "clnDate", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "cretNo", "cretNo", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "ordType", "ordType", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "부서코드", "deptCd", false);
- //dataGridViewConsentSelectResult.Columns["idx"].Visible = false;
- //dataGridViewConsentSelectResult.Columns["formId"].Visible = false;
- //dataGridViewConsentSelectResult.Columns["formPrntNm"].Visible = false;
- //dataGridViewConsentSelectResult.Columns["printCnt"].Visible = false;
- //dataGridViewConsentSelectResult.Columns["pid"].Visible = false;
- //dataGridViewConsentSelectResult.Columns["deptEngName"].Visible = false;
- //dataGridViewConsentSelectResult.Columns["consentState"].Visible = false;
- //dataGridViewConsentSelectResult.Columns["consentMstRid"].Visible = false;
- //dataGridViewConsentSelectResult.Columns["ocrTag"].Visible = false;
- //dataGridViewConsentSelectResult.Columns["patientName"].Visible = false;
- //dataGridViewConsentSelectResult.Columns["modifyUserId"].Visible = false;
- //dataGridViewConsentSelectResult.Columns["modifyUserNm"].Visible = false;
- //dataGridViewConsentSelectResult.Columns["modifyDatetime"].Visible = false;
- }
- #region 동의서 카테고리 바인딩
- /// <summary>
- /// 동의서 하위 분류 조회 및 바인딩
- /// </summary>
- /// <param name="parentValue">The parent value.</param>
- private void InitComboBoxConsentSubType(string parentValue) {
- // 주어진 parentValue 로 GetCategoryForDropdown API 호출
- CategoryForDropdownVO[] arrayData = consentWebService.GetCategoryForDropdown();
- this.comboBoxConsentSubType.DisplayMember = "CategoryName";
- this.comboBoxConsentSubType.ValueMember = "CategoryId";
- this.comboBoxConsentSubType.DataSource = arrayData;
- }
- #endregion
- #region 동의서 조회하고 그리드 바인딩
- /// <summary>
- /// textBoxConsentSearchKeyWord 키보드 입력 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="KeyEventArgs"/> instance containing the event data.</param>
- private void textBoxConsentSearchKeyWord_KeyDown(object sender, KeyEventArgs e) {
- // 엔터키 입력 시 조회 버튼 클릭 이벤트 수행
- if (e.KeyCode == Keys.Enter) {
- this.buttonConsentSelect.PerformClick();
- }
- }
- /// <summary>
- /// 조회 버튼 클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void buttonConsentSelect_Click(object sender, EventArgs e) {
- buttonConsentSelect.Enabled = false;
- Application.DoEvents();
- IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this);
- ConsentCommandCtrl commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
- consentMain.preParamClean();
- GetConsentBySearch();
- buttonConsentSelect.Enabled = true;
- }
- /// <summary>
- /// 동의서 검색
- /// </summary>
- private void GetConsentBySearch() {
- Cursor currentCursor = this.Cursor;
- try {
- this.Cursor = Cursors.WaitCursor;
- string keyWord = string.Empty;
- keyWord = this.textBoxConsentSearchKeyWord.Text;
- //var categoryCode = "";
- CategoryForDropdownVO selectedItem = (CategoryForDropdownVO)comboBoxConsentSubType.SelectedItem;
- var today = DateTime.Now.ToString("yyyyMMdd");
- var categoryId = selectedItem.categoryId.ToString();
- if(categoryId.Equals("1") && string.IsNullOrEmpty(keyWord)) {
- MessageBox.Show("동의서 분류 및 검색어를 입력해주세요.");
- return;
- }
- if (categoryId.Equals("1")) {
- categoryId = string.Empty;
- }
- //ConsentBySearchVO[] arrayData = consentWebService.GetConsentBySearch(consentType, keyWord, consentMain.ConsentExecuteInfo["dutinstcd"]);
- ConsentVO[] arrayData = consentWebService.GetConsentBySearch(categoryId, keyWord, consentMain.ConsentExecuteInfo["dutinstcd"], today);
- if (arrayData == null) {
- return;
- }
- this.dataGridViewConsentSelectResult.DataSource = new SortableBindingList<ConsentVO>(arrayData);
- } catch (Exception ex) {
- throw ex;
- } finally {
- this.Cursor = currentCursor;
- }
- }
- #endregion
- #region 그리드 이벤트
- /// <summary>
- /// dataGridViewConsentSelectResult 그리드 셀 더블클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="DataGridViewCellEventArgs"/> instance containing the event data.</param>
- private void dataGridViewConsentSelectResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) {
- if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
- if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
- // dbs227, 셀 클릭 시 더블클릭 인식되어 작동되는 경우 오류
- if (e.RowIndex < 0) {
- return;
- }
- ConsentVO vo = GetCurrentConsentSearchVO(e.RowIndex);
- if (vo != null) {
- // 선택된 동의서가 현재 보여지고 있는 동의서와 다른 경우, 임시 저장 여부 확인
- if (/*!consentMain.ConsentExecuteInfo["readOnly"].Equals("Y") &&*/ // 대가대 병원 readonly 기능 사용 안함
- !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();
- //}
- }
- Cursor currentCursor = this.Cursor;
- this.Cursor = Cursors.WaitCursor;
- ExecutePreviewWithSelectedConsent(vo);
- // 듀얼뷰어 상태일 때 동의서 로드
- 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();
- this.Cursor = currentCursor;
- }
- }
- private void RunConsentDualView() {
- if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
- if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
- commandControl.RunConsentDualView();
- }
- /// <summary>
- /// dataGridViewConsentSelectResult 그리드 셀 마우스 우클릭 이벤트
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="DataGridViewCellContextMenuStripNeededEventArgs"/> instance containing the event data.</param>
- 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;
- }
- }
- /// <summary>
- /// 선택된 동의서를 개인SET에 등록
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- 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) {
- HospitalSvcRef.SingleReturnData result = null;
- Cursor currentCursor = this.Cursor;
- this.Cursor = Cursors.WaitCursor;
- try {
- ConsentVO vo = GetCurrentConsentSearchVO(this.dataGridViewConsentSelectResult.SelectedRows[0].Index);
- var today = DateTime.Now.ToString("yyyyMMdd");
- // 동의서 SET에 추가하는 웹서비스 호출
- result = hospitalWebService.SetUserFormSetList(commandControl.CurrentEndUser.userId
- , vo.formCode
- , consentMain.ConsentExecuteInfo["dutinstcd"]
- , today);
- } catch (Exception ex){
- throw ex;
- } finally {
- this.Cursor = currentCursor;
- }
- // 즐겨찾기 추가 성공
- if (string.IsNullOrEmpty(result.responseData)) {
- MessageBox.Show(string.Format(Properties.Resources.msg_consent_set_add_success)
- , string.Format(Properties.Resources.msg_caption_confirm)
- , MessageBoxButtons.OK
- , MessageBoxIcon.Information);
- }
- // 즐겨찾기 추가 실패
- else {
- MessageBox.Show(string.Format(Properties.Resources.msg_consent_set_add_failed)
- , string.Format(Properties.Resources.msg_caption_confirm)
- , MessageBoxButtons.OK
- , MessageBoxIcon.Warning);
- }
- }
- }
- #endregion
- #region 동의서 미리보기
- private ConsentVO GetCurrentConsentSearchVO(int rowIndex) {
- ConsentVO vo = null;
- if (rowIndex < 0) {
- return vo;
- }
- vo = this.dataGridViewConsentSelectResult.Rows[rowIndex].DataBoundItem as ConsentVO;
- return vo;
- }
- private void ExecutePreviewWithSelectedConsent(ConsentVO 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 {
- FormRid = vo.formId.ToString(),
- FormCd = vo.formCode.ToString(),
- FormName = vo.formName,
- FormPrintName = vo.formPrntNm,
- PrntCnt = vo.printCnt,
- ConsentMstRid = "-1",
- ConsentState = vo.consentState,
- Ocrcode = vo.ocrTag,
- InputId = commandControl.CurrentEndUser.userId,
- InputNm = commandControl.CurrentEndUser.userName,
- ReissueConsentMstRid = 0,
- RewriteConsentMstRid = 0,
- OpDiagName = commandControl.CurrentTargetPatient.OpDiagName,
- VisitType = commandControl.CurrentTargetPatient.ordtype,
- OpName = commandControl.CurrentTargetPatient.OpName,
- certPass = vo.certPass
- };
- consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.formPrntNm);
- commandControl.PreviewConsent(consentMain);
- } catch (Exception e){
- throw e;
- } finally {
- this.Cursor = currentCursor;
- }
- }
- #endregion
- private void comboBoxConsentType_DrawItem(object sender, DrawItemEventArgs e) {
- ComboBox box = sender as ComboBox;
- if (box is null)
- return;
- e.DrawBackground();
- if (e.Index >= 0) {
- Graphics g = e.Graphics;
- using (Brush brush = ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
- ? new SolidBrush(SystemColors.Highlight)
- : new SolidBrush(e.BackColor)) {
- using (Brush textBrush = new SolidBrush(e.ForeColor)) {
- g.FillRectangle(brush, e.Bounds);
- g.DrawString(((CategoryForDropdownVO[]) box.DataSource)[e.Index].categoryName,
- e.Font,
- textBrush,
- (float) e.Bounds.X,
- (float) (e.Bounds.Y) + 2.34F);
- }
- }
- }
- e.DrawFocusRectangle();
- }
- private void comboBoxConsentType_MeasureItem(object sender, MeasureItemEventArgs e) {
- e.ItemHeight = 20;
- }
- private void comboBoxConsentSubType_DrawItem(object sender, DrawItemEventArgs e) {
- ComboBox box = sender as ComboBox;
- if (box is null)
- return;
- e.DrawBackground();
- if (e.Index >= 0) {
- Graphics g = e.Graphics;
- using (Brush brush = ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
- ? new SolidBrush(SystemColors.Highlight)
- : new SolidBrush(e.BackColor)) {
- using (Brush textBrush = new SolidBrush(e.ForeColor)) {
- g.FillRectangle(brush, e.Bounds);
- g.DrawString(((CategoryForDropdownVO[]) box.DataSource)[e.Index].categoryName,
- e.Font,
- textBrush,
- (float) e.Bounds.X,
- (float) (e.Bounds.Y) + 2.34F);
- }
- }
- }
- e.DrawFocusRectangle();
- }
- private void comboBoxConsentSubType_MeasureItem(object sender, MeasureItemEventArgs e) {
- e.ItemHeight = 20;
- }
- }
- }
|