#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:ConsentSelectTabPageAll.cs // #endregion using System; using System.Drawing; using System.Collections.Generic; using System.ComponentModel; using System.Windows.Forms; using System.Configuration; using CLIP.eForm.Consent.UI.ConsentSvcRef; using ClipSoft.eForm.Base.Dialog; namespace CLIP.eForm.Consent.UI { /// /// 동의서 전체목록 탭 클래스 /// /// ///

[설계자]

///

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

///

[원본 작성자]

///

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

///

[수정 작성자]

///

클립소프트 기술부 이인희

///

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

///

[HISTORY]

///

2016-07-01 : 최초작성

///

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

///
public partial class ConsentSelectTabPageAll : UserControl { private ConsentSvcRef.ConsentSvcSoapClient consentWebService = null; private IConsentMain consentMain = null; private ConsentCommandCtrl commandControl = null; private string searchStartDate = string.Empty; public ConsentSelectTabPageAll() { InitializeComponent(); } private void ConsentSelectTabPageAll_Load(object sender, EventArgs e) { Boolean isInWpfDesignerMode = (LicenseManager.UsageMode == LicenseUsageMode.Designtime); Boolean isInFormsDesignerMode = (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv"); if (isInWpfDesignerMode || isInFormsDesignerMode) { // is in any designer mode return; } if (this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) { return; } consentMain = ConsentMainControl.GetConsentMainInterface(this); commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]); this.dateTimePickerEndDate.Value = DateTime.Now; this.dateTimePickerStartDate.Value = DateTime.Now.AddMonths(-1); InitDataGrid(); BindDataGridRows(); } public void InitDataGrid() { this.dataGridViewConsentSelectResult.DataSource = null; this.dataGridViewConsentSelectResult.Columns.Clear(); // 사용자별 if (rdoUser.Checked) { // dbs227, 일괄저장 기능 // 이벤트 해재 this.dataGridViewConsentSelectResult.ColumnHeaderMouseClick -= dataGridViewConsentSelectResult_ColumnHeaderMouseClick; this.dataGridViewConsentSelectResult.CellMouseClick -= dataGridViewConsentSelectResult_CellClick; // 이벤트 추가 this.dataGridViewConsentSelectResult.ColumnHeaderMouseClick += new DataGridViewCellMouseEventHandler(this.dataGridViewConsentSelectResult_ColumnHeaderMouseClick); //this.dataGridViewConsentSelectResult.RowPostPaint += new DataGridViewRowPostPaintEventHandler(this.dataGridViewConsentSelectResult_RowPostPaint); // 체크박스 컬럼을 추가 CommonUtil.AddNewCheckBoxColumnToDataGridView(this.dataGridViewConsentSelectResult, "□", "colCheck", false, 30, DataGridViewContentAlignment.MiddleCenter); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "OCRTAG", "ocrTag", true, 100); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "등록번호", "pid", true); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서명", "formName", true, 180); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "상태", "consentState", true, 60, DataGridViewContentAlignment.MiddleCenter); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자", "modifyUserNm", true, 70, DataGridViewContentAlignment.MiddleCenter); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성일시", "modifyDatetime", true, 120, DataGridViewContentAlignment.MiddleCenter); // 사용자에게 표시하지 않을 컬럼 CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "성명", "PatientName", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "인덱스", "idx", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "서식번호", "formId", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "서식코드", "formCode", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "서식출력명", "formPrntNm", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "출력매수", "printCnt", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "마스터RID", "consentMstRid", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자 ID", "modifyUserId", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "부서 약어", "deptEngName", 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); } // 환자별 else { // debug // dbs227, 일괄저장 기능 // 이벤트 해재 this.dataGridViewConsentSelectResult.ColumnHeaderMouseClick -= dataGridViewConsentSelectResult_ColumnHeaderMouseClick; this.dataGridViewConsentSelectResult.CellMouseClick -= dataGridViewConsentSelectResult_CellClick; // 이벤트 추가 this.dataGridViewConsentSelectResult.ColumnHeaderMouseClick += new DataGridViewCellMouseEventHandler(this.dataGridViewConsentSelectResult_ColumnHeaderMouseClick); dataGridViewConsentSelectResult.CellMouseClick += new DataGridViewCellMouseEventHandler(this.dataGridViewConsentSelectResult_CellClick); // 체크박스 컬럼을 추가 CommonUtil.AddNewCheckBoxColumnToDataGridView(this.dataGridViewConsentSelectResult, "□", "colCheck", false, 30, DataGridViewContentAlignment.MiddleCenter); // 사용자에게 표시할 컬럼 CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "OCRTAG", "ocrTag", true, 100); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서명", "formName", true, 180); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "등록번호", "pid", true); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "상태", "consentState", true, 60, DataGridViewContentAlignment.MiddleCenter); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자", "modifyUserNm", true, 70, DataGridViewContentAlignment.MiddleCenter); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성일시", "modifyDatetime", true, 120, DataGridViewContentAlignment.MiddleCenter); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "담당교수", "mainDrId", true); // 사용자에게 표시하지 않을 컬럼 CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "성명", "patientName", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "인덱스", "idx", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "서식번호", "formId", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "서식코드", "formCode", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "서식출력명", "formPrntNm", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "출력매수", "printCnt", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "마스터RID", "consentMstRid", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자 ID", "modifyUserId", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "부서 약어", "deptEngName", 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); } } private void dataGridViewConsentSelectResult_CellClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } if (e.ColumnIndex == 0) { DataGridViewRow curRow = dataGridViewConsentSelectResult.Rows[e.RowIndex]; var value = curRow.Cells["colCheck"].Value; Boolean checkValue = false; if (value == null || !(Boolean) value) { checkValue = false; } else { checkValue = true; } curRow.Cells[e.ColumnIndex].Value = !checkValue; } } /// /// dbs227, 일괄저장 추가 /// 체크박스 이벤트 처리 /// /// /// private void dataGridViewConsentSelectResult_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.ColumnIndex == 0 && e.RowIndex == -1) { bool chkStatus = false; if (dataGridViewConsentSelectResult.Columns[0].HeaderText.Equals("□")) { dataGridViewConsentSelectResult.Columns[0].HeaderText = "☑"; chkStatus = true; } else { dataGridViewConsentSelectResult.Columns[0].HeaderText = "□"; } foreach (DataGridViewRow r in dataGridViewConsentSelectResult.Rows) { r.Cells["colCheck"].Value = chkStatus; } dataGridViewConsentSelectResult.RefreshEdit(); } } #region 검색 조건에 따른 환자의 동의서 조회 /// /// 동의서 목록 조회 /// public void BindDataGridRows() { try { if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this); if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; if (this.consentWebService == null) this.consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]); string patientCode = string.Empty; if (commandControl.CurrentTargetPatient != null && !string.IsNullOrEmpty(commandControl.CurrentTargetPatient.pid)) { patientCode = commandControl.CurrentTargetPatient.pid; } string userId = string.Empty; if (rdoUser.Checked) { userId = consentMain.ConsentExecuteInfo["loginUserId"]; } if (!patientCode.Equals(string.Empty) || !userId.Equals(string.Empty)) { if (this.dateTimePickerStartDate.Value > this.dateTimePickerEndDate.Value) { this.dateTimePickerStartDate.Value = DateTime.Today - TimeSpan.FromDays(30); this.dateTimePickerEndDate.Value = DateTime.Today; } // 이전 진료일로 검색일자 설정 if (string.IsNullOrEmpty(searchStartDate)) { if (commandControl.CurrentTargetPatient != null && !string.IsNullOrEmpty(commandControl.CurrentTargetPatient.clnDate)) { //searchStartDate = string.Format("{0}-{1}-{2}", commandControl.CurrentTargetPatient.clnDate.Substring(0, 4), commandControl.CurrentTargetPatient.clnDate.Substring(4, 2), commandControl.CurrentTargetPatient.clnDate.Substring(6, 2)); } else { //searchStartDate = consentMain.PluginExecuteInfo["ConsentSearchStartDate"]; } } this.dateTimePickerStartDate.Value = DateTime.Now.AddMonths(-1); string sDate = this.dateTimePickerStartDate.Value.ToShortDateString().Replace("-", ""); string eDate = this.dateTimePickerEndDate.Value.ToShortDateString().Replace("-", ""); string consentState = GetCheckConsentState(); // 조회조건이 불충분하면 조회하지 않는다. if (string.IsNullOrEmpty(consentState)) { return; } ConsentVO[] resultData = null; resultData = consentWebService.GetConsentList(patientCode , userId , sDate , eDate , consentState , consentMain.ConsentExecuteInfo["dutinstcd"]); if (resultData == null) { return; } // 진료일 표시 형식 변경 //foreach (ConsentVO v in resultData) { // if (v.ClnDate.Length == 8) { // v.ClnDate = v.ClnDate.Substring(0, 4) + "-" + v.ClnDate.Substring(4, 2) + "-" + v.ClnDate.Substring(6, 2); // } //} this.dataGridViewConsentSelectResult.DataSource = new SortableBindingList(resultData); // 목록 조회 후 자동 선택 기능 제외 consentMain.ClearPreviewConsent(true); /* ConsentVO vo = GetCurrentConsentVO(0); if (vo != null) { ExecutePreviewWithSelectedConsent(vo); } else { consentMain.ClearPreviewConsent(true); } */ } else { // dbs227, 발행리스트 시작일자를 한달전으로 설정 //this.dateTimePickerStartDate.Value = DateTime.Now.AddMonths(-1); } } catch (Exception ex) { MessageBox.Show(this, ex.Message); } } /// /// 검색할 동의서 상태의 값을 반환한다 /// /// 현재 체크박스에 선택된 값을 String 타입으로 반환, ex) "ALL" or "'UNFINISHED','TEMP'" private string GetCheckConsentState() { string consentState = ""; if (this.checkBoxAll.Checked) { consentState = "ALL"; } else { if (this.checkBoxUnfinished.Checked) consentState += ((consentState.Length > 0) ? "," : "") + "'" + this.checkBoxUnfinished.Tag + "'"; if (this.checkBoxTemp.Checked) consentState += ((consentState.Length > 0) ? "," : "") + "'" + this.checkBoxTemp.Tag + "'"; if (this.checkBoxElectronicCmp.Checked) consentState += ((consentState.Length > 0) ? "," : "") + "'" + this.checkBoxElectronicCmp.Tag + "'"; if (this.checkBoxCertifyCmp.Checked) consentState += ((consentState.Length > 0) ? "," : "") + "'" + this.checkBoxCertifyCmp.Tag + "'"; if (this.checkBoxPaperOut.Checked) consentState += ((consentState.Length > 0) ? "," : "") + "'" + this.checkBoxPaperOut.Tag + "'"; if (this.checkBoxVerbal.Checked) consentState += ((consentState.Length > 0) ? "," : "") + "'" + this.checkBoxVerbal.Tag + "'"; } return consentState; } #endregion #region ConsentState 확인 private static bool IsConsentStateTempSave(ConsentVO vo) { if (vo.consentState.ToUpper().Equals("TEMP") || vo.consentState.ToUpper().Equals("VERBAL")) { return true; } return false; } private static bool IsConsentStatePrintOut(ConsentVO vo) { return vo.consentState.ToUpper().Equals("PAPER_OUT"); } private static bool IsConsentStateElectronicComplete(ConsentVO vo) { return vo.consentState.ToUpper().Equals("ELECTR_CMP"); } private static bool IsConsentStateCertifyComplete(ConsentVO vo) { return vo.consentState.ToUpper().Equals("CERTIFY_CMP"); } private static bool IsConsentStateUnfinished(ConsentVO vo) { return vo.consentState.ToUpper().Equals("UNFINISHED"); } #endregion #region 체크박스 이벤트 private void checkBoxAll_CheckedChanged(object sender, EventArgs e) { if (this.checkBoxAll.Checked == true) { this.checkBoxUnfinished.Checked = false; this.checkBoxTemp.Checked = false; this.checkBoxElectronicCmp.Checked = false; this.checkBoxCertifyCmp.Checked = false; this.checkBoxPaperOut.Checked = false; } } private void checkBoxUnfinished_CheckedChanged(object sender, EventArgs e) { if (this.checkBoxUnfinished.Checked == true && this.checkBoxAll.Checked == true) { this.checkBoxAll.Checked = false; } } private void checkBoxTemp_CheckedChanged(object sender, EventArgs e) { if (this.checkBoxTemp.Checked == true && this.checkBoxAll.Checked == true) { this.checkBoxAll.Checked = false; } } private void checkBoxElectronicCmp_CheckedChanged(object sender, EventArgs e) { if (this.checkBoxElectronicCmp.Checked == true && this.checkBoxAll.Checked == true) { this.checkBoxAll.Checked = false; } } private void checkBoxCertifyCmp_CheckedChanged(object sender, EventArgs e) { if (this.checkBoxCertifyCmp.Checked == true && this.checkBoxAll.Checked == true) { this.checkBoxAll.Checked = false; } } private void checkBoxPaperOut_CheckedChanged(object sender, EventArgs e) { if (this.checkBoxPaperOut.Checked == true && this.checkBoxAll.Checked == true) { this.checkBoxAll.Checked = false; } } #endregion #region 조회버튼 클릭 이벤트 /// /// 동의서 목록 조회 /// /// The source of the event. /// The instance containing the event data. private void buttonConsentSelect_Click(object sender, EventArgs e) { buttonConsentSelect.Enabled = false; Application.DoEvents(); string checkState = GetCheckConsentState(); if (checkState.Length > 0) { if (!string.IsNullOrEmpty(searchStartDate)) { searchStartDate = this.dateTimePickerStartDate.Value.ToShortDateString(); } try { InitDataGrid(); BindDataGridRows(); } catch (Exception ex) { throw ex; } } else { MessageBox.Show("조회할 동의서 상태를 1개 이상 선택하세요"); } buttonConsentSelect.Enabled = true; } #endregion #region 동의서 미리보기 //선택된 Row의 ConsentVO 객체를 반환한다. private ConsentVO GetCurrentConsentVO(int rowIndex) { ConsentVO vo = null; if (rowIndex < 0) { return vo; } if (dataGridViewConsentSelectResult != null && dataGridViewConsentSelectResult.Rows.Count > 0) { this.dataGridViewConsentSelectResult.Rows[rowIndex].Selected = true; //this.dataGridViewConsentSelectResult.CurrentCell = this.dataGridViewConsentSelectResult.Rows[rowIndex].Cells[0]; vo = this.dataGridViewConsentSelectResult.Rows[rowIndex].DataBoundItem as ConsentVO; } return vo; } //선택된 ConsentVO 객체를 미리보기 실행한다. private void ExecutePreviewWithSelectedConsent(ConsentVO vo) { if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this); if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; Cursor currentCursor = this.Cursor; this.Cursor = Cursors.WaitCursor; if (rdoUser.Checked) { //consentMain.ConsentExecuteInfo["patientId"] = vo.PatientCode; //consentMain.ConsentExecuteInfo["patientOrdtype"] = vo.VisitType; //consentMain.ConsentExecuteInfo["patientClnDept"] = vo.ClnDate.Replace("-", ""); //consentMain.ConsentExecuteInfo["patientClnDept"] = vo.ClnDeptCd; //consentMain.ConsentExecuteInfo["cretno"] = vo.Cretno.ToString(); //consentMain.ConsentExecuteInfo["opRsrvNo"] = vo.OpRsrvNo; consentMain.SetPatientInfo(); } 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 }; try { consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.formName); // 임시저장 서식 호출 //if (commandControl.CurrentPreviewConsent.ConsentState.Equals("임시")) { // commandControl.ShowTempSaveConsent(consentMain); //} switch (commandControl.CurrentPreviewConsent.ConsentState) { case "임시": commandControl.ShowTempSaveConsent(consentMain); break; case "인증": string pid = commandControl.CurrentTargetPatient.pid; string ordDd = commandControl.CurrentTargetPatient.clnDate; string cretNo = commandControl.CurrentTargetPatient.cretno; string ordType = commandControl.CurrentTargetPatient.ordtype; string recDd = vo.createDatetime; string userId = commandControl.CurrentEndUser.userId; recDd = recDd.Split(' ')[0].Replace("-", ""); SingleReturnData srd = this.consentWebService.ReUseCertifyConsentFlag(pid, ordDd, cretNo, ordType, recDd, userId); string result = srd.responseData; if (result.Equals("OK")) { DialogResult dlr = MessageBox.Show("인증저장 된 서식입니다 수정하시겠습니까?", "", MessageBoxButtons.OKCancel); if (dlr == DialogResult.OK) { commandControl.ShowTempSaveConsent(consentMain); commandControl.setCompleteSaveTempButton(false); } else { commandControl.ShowCompleteConsent(consentMain);//이미지 호출하는 함수 } } else { commandControl.ShowCompleteConsent(consentMain);//이미지 호출하는 함수 } break; case "확인": commandControl.ShowTempSaveConsent(consentMain); break; default: break; } //if (IsConsentStateTempSave(vo) || IsConsentStateElectronicComplete(vo)) { // 임시저장 or 작성완료 // commandControl.ShowTempSaveConsent(consentMain); //} else if (IsConsentStatePrintOut(vo)) { // 출력 // if (this.dataGridViewConsentSelectResult.SelectedRows.Count > 0 && // this.dataGridViewConsentSelectResult.SelectedRows[0].Tag != null && // this.dataGridViewConsentSelectResult.SelectedRows[0].Tag.Equals("reissueTarget")) { // // TODO 재출력 기능 사용하지 않음. 요구사항 확인 필요 // //재출력 하는 경우 // //commandControl.CurrentPreviewConsent.ReissueConsentMstRid = vo.ConsentMstRid; // commandControl.CurrentPreviewConsent.RewriteConsentMstRid = 0; // //CheckClnDateInfo(vo); // commandControl.PreviewConsent(consentMain); // } else { // //CheckClnDateInfo(vo); // commandControl.PreviewConsent(consentMain); // } //} else if (IsConsentStateCertifyComplete(vo)) { // 인증저장 // commandControl.ShowCompleteConsent(consentMain);//이미지 호출하는 함수 //} else if (IsConsentStateUnfinished(vo)) { //미작성 // //CheckClnDateInfo(vo); // commandControl.PreviewConsent(consentMain); // consent_data에 데이터가 없을때 사용하는 함수 //} } catch (Exception e){ throw e; } finally { this.Cursor = currentCursor; } } //동의서의 처방일자와 생성번호 등의 정보가 현재 정보와 일치하지 않은 경우, 미리보기를 위해서 데이터를 재조회한다. private void CheckClnDateInfo(ConsentVO vo) { //bool bSame = true; //if (!vo.ClnDate.Replace("-", "").Equals(commandControl.CurrentTargetPatient.clnDate.Replace("-", ""))) // bSame = false; //if (!vo.Cretno.ToString().Equals(commandControl.CurrentTargetPatient.cretno)) // bSame = false; //if (!vo.ClnDeptCd.Equals(commandControl.CurrentTargetPatient.clnDeptCode)) // bSame = false; //if (!vo.VisitType.Equals(commandControl.CurrentTargetPatient.VisitType)) // bSame = false; //if (bSame == false) { // //동의서 맵핑 정보를 상단의 선택된 진료일과 작성자 정보로 한다. // consentMain.PatientInfoCtrl.SetPatientByConsentInfo(vo.ClnDate.Replace("-", ""), // vo.VisitType, // vo.ClnDeptCd, // vo.Cretno.ToString()); //} } #endregion #region 그리드 이벤트 /* private void dataGridViewConsentSelectResult_CellClick(object sender, DataGridViewCellEventArgs e) { ConsentVO vo = GetCurrentConsentVO(e.RowIndex); if (vo != null) { IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this); consentMain.preParamClean(); ExecutePreviewWithSelectedConsent(vo); } } */ /// /// dataGridViewConsentSelectResult 그리드 컨트롤의 셀 우클릭 메뉴 생성 /// /// The source of the event. /// The instance containing the event data. private void dataGridViewConsentSelectResult_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e) { // 대가대 병원 사용하지 않는 실행 옵션 //if (consentMain.ConsentExecuteInfo["readOnly"].Equals("Y")) { // return; //} if (e.RowIndex > -1 && this.dataGridViewConsentSelectResult.Rows[e.RowIndex].Selected == true) { ConsentVO vo = GetCurrentConsentVO(e.RowIndex); if (vo.consentState.Equals("임시")) { ContextMenuStrip strip = new ContextMenuStrip(); // 임시저장의 경우 삭제메뉴를 보여준다 if (vo.consentState.Equals("임시")) { // dbs227, 삭제 기능 제거 ToolStripMenuItem deleteRecord = new ToolStripMenuItem { Text = "삭제" }; strip.Items.Add(deleteRecord); deleteRecord.Click += new EventHandler(deleteRecord_Click); // 출력의 경우 재출력 메뉴를 보여준다 } //else if (vo.consentState.Equals("출력")) { // ToolStripMenuItem reprintRecord = new ToolStripMenuItem { // Text = "재출력" // }; // strip.Items.Add(reprintRecord); // reprintRecord.Click += new EventHandler(reprintRecord_Click); //} e.ContextMenuStrip = strip; } } } /// /// dataGridViewConsentSelectResult 그리드 컨트롤의 CellMouseDoubleClick 이벤트 핸들러 /// /// The source of the event. /// The instance containing the event data. private void dataGridViewConsentSelectResult_CellMouseDoubleClick(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 = GetCurrentConsentVO(e.RowIndex); // 현재 선택된 동의서를 가져온다 // dbs227, 출력된 동의서는 미리보기를 하지 않는다 if (vo.consentState.Equals("PAPER_OUT")) { MessageBox.Show(String.Format(Properties.Resources.msg_printed_consent), String.Format(Properties.Resources.title_printed_consent)); return; } //MessageBox.Show("asdfasdf"); if (vo != null) { // startFormCd 를 초기화 한다 consentMain.preParamClean(); // 동의서 미리보기 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); switch (vo.consentState) { case "임시": // 임시 case "확인": // 확인 // 듀얼뷰어 상태일 때 동의서 로드 RunConsentDualView(); break; } } /* ConsentVO vo = GetCurrentConsentVO(e.RowIndex); if (vo != null) { if (vo.ConsentState.ToLower().Equals("electr_cmp") || vo.ConsentState.ToLower().Equals("certify_cmp") || vo.ConsentState.ToLower().Equals("paper_out")) { } else { //미작성, 임서저장 상태일때 마우스 더블클릭을 하면 양면으로 동의서 보여줌 RunConsentDualView(); } } */ } /// /// 동의서 뷰어에 동의서 로드 /// private void RunConsentDualView() { if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this); if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; commandControl.RunConsentDualView(); } /// /// 동의서 삭제 이벤트 핸들러 /// /// The source of the event. /// The instance containing the event data. private void deleteRecord_Click(object sender, EventArgs e) { if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this); if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; bool bDel = true; ReasonForUseN reasonForUseN = new ReasonForUseN(bDel); if (reasonForUseN.ShowDialog() == DialogResult.OK) { string reason = reasonForUseN.GetReasonForUseN(); reasonForUseN.Close(); int updated = 0; if (this.dataGridViewConsentSelectResult.SelectedRows.Count != 0) { Cursor currentCursor = this.Cursor; try { this.Cursor = Cursors.WaitCursor; //동의서 삭제 처리를 위해서 재발행MstID에 값을 넣는다. ConsentVO vo = GetCurrentConsentVO(this.dataGridViewConsentSelectResult.SelectedRows[0].Index); // TODO dbs227 삭제 오류 if (commandControl.CurrentPreviewConsent == null) { 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 }; } //commandControl.CurrentPreviewConsent.ReissueConsentMstRid = vo.ConsentMstRid; // 미작성 동의서 삭제 updated = consentMain.ConsentCommandCtrl.DeleteRecordOfDeleteConsent(reason); // 동의서 목록 재조회 (미작성 동의서 삭제, 임시저장용 재조회, 인쇄출력용 재조회, 저장용(저장후 닫힘이 아닌 경우)) consentMain.ConsentListCtrl.InquiryConsentData(-1); } catch (Exception ex) { throw ex; } finally { this.Cursor = currentCursor; } if(updated > 0) { MessageBox.Show(string.Format(Properties.Resources.msg_consent_record_deleted) , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } /// /// 재출력 클릭 /// /// The source of the event. /// The instance containing the event data. private void reprintRecord_Click(object sender, EventArgs e) { ConsentVO vo = GetCurrentConsentVO(this.dataGridViewConsentSelectResult.SelectedRows[0].Index); if (vo != null) { this.dataGridViewConsentSelectResult.SelectedRows[0].Tag = "reissueTarget"; // 재출력 대상 마킹 ExecutePreviewWithSelectedConsent(vo); this.dataGridViewConsentSelectResult.SelectedRows[0].Tag = null; //재출력을 하는 경우, 바로 출력이 되도록 한다. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this); if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; commandControl.PrintConsentDocument(); } } #endregion public void clearSearchStartDate() { searchStartDate = string.Empty; } private void dataGridViewConsentSelectResult_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { foreach (DataGridViewRow row in dataGridViewConsentSelectResult.Rows) { if (!string.IsNullOrEmpty(row.Cells["ConsentState"].Value.ToString())) { if (row.Cells["ConsentState"].Value.ToString().ToUpper() == "UNFINISHED") { row.DefaultCellStyle.ForeColor = System.Drawing.Color.Red; } } } } private void dataGridViewConsentSelectResult_CellClick(object sender, DataGridViewCellEventArgs e) { } /// /// 선택된 동의서를 가져온다 /// /// 선택된 동의서 목록 public List getConfirmedCheckedConsentList() { List consents = new List(); foreach (DataGridViewRow row in dataGridViewConsentSelectResult.Rows) { if (Convert.ToBoolean(row.Cells["colCheck"].Value)) { ConsentVO consent = row.DataBoundItem as ConsentVO; if (!consent.consentState.Equals("ELECTR_CMP")) { return null; } consents.Add(consent); } } return consents; } /// /// 선택 초기화 /// private void ClearCheckBox() { bool chkStatus = false; dataGridViewConsentSelectResult.Columns[0].HeaderText = "□"; foreach (DataGridViewRow r in dataGridViewConsentSelectResult.Rows) { r.Cells["colCheck"].Value = chkStatus; } dataGridViewConsentSelectResult.RefreshEdit(); } /// /// dbs227, 일괄저장 /// 선택된 환자들의 저장 상태를 일괄저장으로 변경한다. /// /// /// private void saveAllCertify_Click(object sender, EventArgs e) { // 선택된 동의서 목록을 가져온다. List lists = getConfirmedCheckedConsentList(); if (lists == null || lists.Count < 1) { MessageBox.Show("동의서를 선택하거나 확인 저장 동의서만 선택해 주세요."); //ClearCheckBox(); return; } String mstRids = ""; String ocrTags = ""; int i = 0; foreach (ConsentVO consent in lists) { if (i != 0) { mstRids += ","; ocrTags += ","; } /// TODO 구현 필요 //mstRids += "'" + consent.ConsentMstRid + "'"; //ocrTags += "'" + consent.OcrNumber + "'"; i++; } // 선택된 동의서 상태값을 바꿔 준다. String result = consentWebService.updateCertifyComplete(mstRids, ocrTags, consentMain.ConsentExecuteInfo["dutinstcd"]); if (result.Equals("Y")) { MessageBox.Show("일괄저장 하였습니다."); ClearCheckBox(); try { this.checkBoxAll.Checked = true; InitDataGrid(); BindDataGridRows(); } catch (Exception ex) { throw ex; } } } /// /// 사용자 라디오 버튼 클릭 시 일괄저장을 보여준다 /// /// /// private void rdoUser_CheckedChanged(object sender, EventArgs e) { if (!rdoUser.Checked) { saveAllCertify.Visible = false; } // 현재 로그인 한 사용자가 의사라면 일괄저장 버튼을 활성화 하여 준다. else if (rdoUser.Checked && commandControl.CurrentEndUser.jobkindcd.Equals("0330")) { // saveAllCertify 버튼 보이도록 //saveAllCertify.Visible = true; } } } }