#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; // dbs227, 발행리스트 시작일자를 한달전으로 설정 //this.dateTimePickerStartDate.Value = DateTime.Now.AddMonths(-1); this.dateTimePickerStartDate.Value = DateTime.Now.AddDays(-7); InitDataGrid(); BindDataGridRows(); } private void InitDataGrid() { this.dataGridViewConsentSelectResult.DataSource = null; this.dataGridViewConsentSelectResult.Columns.Clear(); //this.dataGridViewConsentSelectResult.ColumnHeaderMouseClick -= dataGridViewConsentSelectResult_ColumnHeaderMouseClick; //this.dataGridViewConsentSelectResult.CellMouseClick -= dataGridViewConsentSelectResult_CellClick; // 이벤트 추가 //this.dataGridViewConsentSelectResult.ColumnHeaderMouseClick += new DataGridViewCellMouseEventHandler(this.dataGridViewConsentSelectResult_ColumnHeaderMouseClick); // 그리드에 표시할 컬럼 CommonUtil.insertColumnToDataGridView(0, this.dataGridViewConsentSelectResult, "등록번호", "pid", true, 60, DataGridViewContentAlignment.MiddleCenter); CommonUtil.insertColumnToDataGridView(1, this.dataGridViewConsentSelectResult, "성명", "patientName", true, 60, DataGridViewContentAlignment.MiddleCenter); CommonUtil.insertColumnToDataGridView(2, this.dataGridViewConsentSelectResult, "OCRTAG", "ocrTag", true, 80); CommonUtil.insertColumnToDataGridView(3, this.dataGridViewConsentSelectResult, "동의서명", "formName", true, 180); CommonUtil.insertColumnToDataGridView(4, this.dataGridViewConsentSelectResult, "진료/\n입원일", "clnDate", true, 80, DataGridViewContentAlignment.MiddleCenter); CommonUtil.insertColumnToDataGridView(5, this.dataGridViewConsentSelectResult, "진료과명", "clnDeptNm", true); CommonUtil.insertColumnToDataGridView(6, this.dataGridViewConsentSelectResult, "병동코드", "wardCd", true); CommonUtil.insertColumnToDataGridView(7, this.dataGridViewConsentSelectResult, "병실코드", "roomCd", true); CommonUtil.insertColumnToDataGridView(8, this.dataGridViewConsentSelectResult, "상태", "consentStateDisp", true, 60, DataGridViewContentAlignment.MiddleCenter); CommonUtil.insertColumnToDataGridView(9, this.dataGridViewConsentSelectResult, "작성자\n아이디", "createUserId", true); CommonUtil.insertColumnToDataGridView(10, this.dataGridViewConsentSelectResult, "작성자", "createUserName", true); CommonUtil.insertColumnToDataGridView(11, this.dataGridViewConsentSelectResult, "수정자\n아이디", "modifyUserId", false); CommonUtil.insertColumnToDataGridView(12, this.dataGridViewConsentSelectResult, "수정자", "modifyUserName", true, 70, DataGridViewContentAlignment.MiddleCenter); CommonUtil.insertColumnToDataGridView(13, this.dataGridViewConsentSelectResult, "작성일시", "createDatetime", true, 120, DataGridViewContentAlignment.MiddleCenter); // 그리드에 표시하지 않을 컬럼 CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "서식 코드", "formCd", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "출력 매수", "prntCnt", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "울력전용", "prntOnly", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "서식 출력명", "formPrintName", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "의사 전용 서식 여부", "DrOnly", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "기관번호", "instCd", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료과코드", "clnDeptCd", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "주치의", "mainDrId", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수술진단명", "opDiagName", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수술명", "opName", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수술예약번호", "opRsrvNo", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 고유코드", "consentMstRid", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "OCRTAG 출력여부", "ocrTagYN", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "서식 ID", "formId", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "consentState", "consentState", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "ordtype", "ordType", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "cretNo", "cretNo", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "certUseYn", "certUseYn", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "userDrFlag", "userDrFlag", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "linkFormCd", "linkFormCd", false); CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "jinjeongCd", "jinjeongCd", 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.PatientCode)) { patientCode = commandControl.CurrentTargetPatient.PatientCode; } string userId = string.Empty; if (rdoUser.Checked) { userId = consentMain.ConsentExecuteInfo["loginUserNo"]; } if (!patientCode.Equals(string.Empty) || !userId.Equals(string.Empty)) { // 프린터 모드가 아닐 경우 if (!consentMain.ConsentExecuteInfo["printYN"].Equals("Y")) { if (this.dateTimePickerStartDate.Value > this.dateTimePickerEndDate.Value) { this.dateTimePickerStartDate.Value = DateTime.Today - TimeSpan.FromDays(30); // this.dateTimePickerStartDate.Value = DateTime.Today - TimeSpan.FromDays(1); 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 = Convert.ToDateTime(searchStartDate); // dbs227, 발행리스트 시작일자를 한달전으로 설정 //this.dateTimePickerStartDate.Value = DateTime.Now.AddMonths(-1); string sDate = this.dateTimePickerStartDate.Value.ToShortDateString().Replace("-", ""); string eDate = this.dateTimePickerEndDate.Value.ToShortDateString().Replace("-", ""); string consentState = GetCheckConsentState(); ConsentVO[] resultData = null; // 환자별 검색 if (rdoUser.Checked == false) { resultData = consentWebService.GetConsentList(patientCode , sDate , eDate , consentState , consentMain.ConsentExecuteInfo["dutinstcd"] , userId); } // 사용자 별 검색 else { var searchString = searchName.Text?.Trim(); // 검색할 사용자 이름이 없다면 메시지박스를 보여준다 if (searchString == null || searchString.Equals(String.Empty)) { MessageBox.Show("검색할 사용자 이름을 입력하세요", "경고", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } resultData = consentWebService.GetConsentList(patientCode , sDate , eDate , consentState , consentMain.ConsentExecuteInfo["dutinstcd"] , searchString); // 검색할 사용자 ID 를 넣는다 } //ConsentVO[] resultData = consentWebService.GetConsentList(patientCode // , sDateF // , eDate // , consentState // , string.Empty // , consentMain.ConsentExecuteInfo["dutinstcd"] // , userId); 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); /* ConsentFormListVO 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 + "'"; consentState += ((consentState.Length > 0) ? "," : "") + "'TEMP', 'UNFINISHED', 'ELECTR_CMP'"; 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(string.Format(Properties.Resources.msg_unfinished_check) , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information); } 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["patientNo"] = vo.pid; consentMain.ConsentExecuteInfo["clnDate"] = vo.clnDate.Replace("-", ""); consentMain.ConsentExecuteInfo["visitType"] = vo.ordtype; consentMain.ConsentExecuteInfo["clnDept"] = vo.clnDeptCd; consentMain.ConsentExecuteInfo["cretno"] = vo.cretno.ToString(); consentMain.ConsentExecuteInfo["opRsrvNo"] = vo.opRsrvNo; consentMain.SetPatientInfo(); } commandControl.CurrentPreviewConsent = new PreviewConsent { formId = vo.formId.ToString(), formCd = vo.formCd.ToString(), formName = vo.formName, formPrintName = vo.formPrintName, prntCnt = vo.prntCnt, consentMstRid = vo.consentMstRid.ToString(), consentState = vo.consentStateDisp, consentStateEng = vo.consentState, orderNo = 0, ocrCode = vo.ocrTag, inputId = vo.createUserId, inputNm = vo.createUserName, ReissueConsentMstRid = IsConsentStatePrintOut(vo) ? vo.consentMstRid : 0, RewriteConsentMstRid = !IsConsentStateUnfinished(vo) ? vo.consentMstRid : 0, ordType = vo.ordtype, ocrtagPrntyn = vo.ocrTagYN, userDrFlag = vo.userDrFlag, printOnly = vo.prntOnly, opDiagName = vo.opDiagName, drOnly = vo.DrOnly, opName = vo.opName }; try { consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.formName); 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")) { //재출력 하는 경우 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 { } 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) { ConsentFormListVO 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("TEMP") || vo.consentState.Equals("PAPER_OUT")) { ContextMenuStrip strip = new ContextMenuStrip(); // 임시, 확인 저장의 경우 삭제메뉴를 보여준다 if (vo.consentState.Equals("TEMP") || vo.consentState.Equals("ELECTR_CMP")) { // 사용자와 생성자가 동일해야 삭제 가능 if(commandControl.CurrentEndUser.UserNo.Equals(vo.createUserId)) { ToolStripMenuItem deleteRecord = new ToolStripMenuItem { Text = "삭제" }; strip.Items.Add(deleteRecord); deleteRecord.Click += new EventHandler(deleteRecord_Click); } // 출력의 경우 재출력 메뉴를 보여준다 } else if (vo.consentState.Equals("PAPER_OUT")) { 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); string electrVisble = ConsentMainControl.SETTING_DATA["ELECTR_CMP"]; if (commandControl.CurrentTargetPatient.VisitType.Equals("O")) { if (electrVisble.Equals("Y")) { commandControl.setCompleteSaveButton(true); } } else { if (electrVisble.Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) { commandControl.setCompleteSaveButton(true); } else { commandControl.setCompleteSaveButton(false); } } //if (commandControl.CurrentTargetPatient.VisitType.Equals("O")) { // commandControl.setCompleteSaveButton(true); //} else { // if (ConsentMainControl.SETTING_DATA["ELECTR_CMP"].Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) { // commandControl.setCompleteSaveButton(true); // } else { // commandControl.setCompleteSaveButton(false); // } //} //의사가 아니면 확인저장 비활성화 //if (!commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03")) { // commandControl.setCompleteSaveButton(false); //} // dbs227, 출력된 동의서는 미리보기를 하지 않는다 if (vo.consentState.Equals("PAPER_OUT")) { MessageBox.Show(String.Format(Properties.Resources.msg_printed_consent), String.Format(Properties.Resources.title_printed_consent)); return; } if (vo != null) { if (!consentMain.checkOperationDocument(vo.formCd)) { return; } // 선택된 동의서가 현재 보여지고 있는 동의서와 다른 경우, 임시 저장 여부 확인 if (!consentMain.ConsentExecuteInfo["readOnly"].Equals("Y") && !string.IsNullOrEmpty(commandControl.CurrentTargetPatient.PatientCode) && commandControl.CurrentPreviewConsent != null && !commandControl.CurrentPreviewConsent.formId.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(); //} } // startFormCd 를 초기화 한다 consentMain.preParamClean(); // 동의서 미리보기 ExecutePreviewWithSelectedConsent(vo); if (!vo.consentState.Equals("PAPER_OUT") && !vo.consentState.Equals("ELECTR_CMP") && !vo.consentState.Equals("CERTIFY_CMP")) { // 동의서 뷰어에 동의서 로드 RunConsentDualView(); } } /* ConsentFormListVO 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(); 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 { formId = vo.formId.ToString(), formCd = vo.formCd.ToString(), formName = vo.formName, formPrintName = vo.formPrintName, prntCnt = vo.prntCnt, consentMstRid = vo.consentMstRid.ToString(), consentStateEng = vo.consentState, orderNo = 0, ocrCode = vo.ocrTag, inputId = vo.createUserId, inputNm = vo.createUserName, ReissueConsentMstRid = IsConsentStatePrintOut(vo) ? vo.consentMstRid : 0, RewriteConsentMstRid = !IsConsentStateUnfinished(vo) ? vo.consentMstRid : 0, ordType = vo.ordtype, ocrtagPrntyn = vo.ocrTagYN, userDrFlag = vo.userDrFlag, printOnly = vo.prntOnly, opDiagName = vo.opDiagName, drOnly = vo.DrOnly, opName = vo.opName }; } commandControl.CurrentPreviewConsent.ReissueConsentMstRid = vo.consentMstRid; // 미작성 동의서 삭제 consentMain.ConsentCommandCtrl.DeleteRecordOfDeleteConsent(reason); // 동의서 목록 재조회 (미작성 동의서 삭제, 임시저장용 재조회, 인쇄출력용 재조회, 저장용(저장후 닫힘이 아닌 경우)) consentMain.ConsentListCtrl.InquiryConsentData(-1); } catch (Exception ex) { throw ex; } finally { this.Cursor = currentCursor; } 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) { if (vo.consentState.Equals("반납확인")) { MessageBox.Show("반납확인 서식은 재출력이 불가능 합니다."); return; } 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; // 출력 로그 저장을 위한 버튼 클릭 설정 this.consentMain.setPrintButton(true); // 재출력 시 OCRTAG 중복확인 제외 commandControl.reprintStatus = true; commandControl.PrintConsentDocument(); commandControl.reprintStatus = false; } } #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["consentStateEng"].Value.ToString())) { // if (row.Cells["consentStateEng"].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 += ","; } mstRids += "'" + consent.consentMstRid + "'"; ocrTags += "'" + consent.ocrTag + "'"; 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; searchName.Visible = false; } // 현재 로그인 한 사용자가 의사라면 일괄저장 버튼을 활성화 하여 준다. else if (rdoUser.Checked/* && commandControl.CurrentEndUser.JobKindCd.Equals("0330")*/) { // saveAllCertify 버튼 보이도록 //saveAllCertify.Visible = true; searchName.Visible = true; } } } }