123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395 |
- #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.ComponentModel;
- using System.Windows.Forms;
- using System.Configuration;
- using CLIP.eForm.Consent.Dfh.UI.ConsentSvcRef;
- namespace CLIP.eForm.Consent.Dfh.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> 2016-07-01 : 최초작성</p>
- /// <p>----------------------------------------------------------------------------------------</p>
- /// </remarks>
- public partial class ConsentSelectTabPageUnfinished : UserControl
- {
- private ConsentSvcRef.ConsentSvcSoapClient consentWebService = null;
- private IConsentMain consentMain = null;
- private ConsentCommandCtrl commandControl = null;
- public ConsentSelectTabPageUnfinished()
- {
- InitializeComponent();
- }
- private void ConsentSelectTabPageUnfinished_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"]);
- InitDataGrid();
- }
- public void SelectAllUnfinishedConsents(int consentMstRid)
- {
- InitDataGrid();
- BindDataGridRows(consentMstRid);
- }
- private void InitDataGrid()
- {
- this.dataGridViewConsentSelectResult.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
- this.dataGridViewConsentSelectResult.MultiSelect = false;
- this.dataGridViewConsentSelectResult.AutoGenerateColumns = false;
- this.dataGridViewConsentSelectResult.AllowUserToAddRows = false;
- this.dataGridViewConsentSelectResult.CellClick += new DataGridViewCellEventHandler(dataGridViewConsentSelectResult_CellClick);
- this.dataGridViewConsentSelectResult.Columns.Clear();
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서명", "ConsentName", true, 250);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "상태", "ConsentStateDisp", true, 60);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "처방명", "OrderNm", true, 100);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "내원/입원일", "ClnDate", true, 100);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료과", "ClnDeptNm", true, 100);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "처방의", "CosignDcName", true, 80);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "병동", "Ward", true, 100);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성일시", "CreateDateTime", true, 120);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자", "CreateUserName", true, 80);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "생성번호", "Cretno", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "상태코드", "ConsentState", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "처방구분코드", "OrderNo", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 고유코드", "FormGuid", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 고유RID", "FormRid", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서 작성 마스터 RID", "ConsentMstRid", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "처방코드", "OrderCd", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "OCR코드", "OcrNumber", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "병실", "RoomCd", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서코드", "FormCd", false);
- CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "내원구분", "VisitType", false);
- }
- #region 미작성, 임시저장 동의서 조회
- public void BindDataGridRows(int consentMstRid)
- {
- 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"]);
-
- try
- {
- if (commandControl.CurrentTargetPatient != null && !string.IsNullOrEmpty(commandControl.CurrentTargetPatient.PatientCode))
- {
- string patientCode = commandControl.CurrentTargetPatient.PatientCode;
- string sDate = consentMain.PluginExecuteInfo["ConsentSearchStartDate"].Replace("-", "");
- string eDate = DateTime.Now.ToShortDateString().Replace("-", "");
- string consentState = "'UNFINISHED','TEMP'";
-
- ConsentVO[] resultData = consentWebService.GetConsentList(patientCode, sDate, eDate, consentState, string.Empty);
- if (resultData == null)
- {
- return;
- }
- this.dataGridViewConsentSelectResult.DataSource = new SortableBindingList<ConsentVO>(resultData);
- //초기 전달받은 startFormCd 값이 있는 경우, 폼을 보여준다.
- if (consentMain.ConsentExecuteInfo != null
- && consentMain.ConsentExecuteInfo.ContainsKey("startFormCd")
- && !(string.IsNullOrEmpty(consentMain.ConsentExecuteInfo["startFormCd"])))
- {
- for (int i = 0; i < resultData.Length; i++)
- {
- if (((ConsentVO)resultData[i]).FormCd == consentMain.ConsentExecuteInfo["startFormCd"].ToString())
- {
- ConsentVO vo = GetCurrentConsentVO(i);
- if (vo != null)
- {
- ExecutePreviewWithSelectedConsent(vo);
- RunConsentDualView();
- }
- break;
- }
- }
- }
- else if (consentMstRid > 0)
- {
- for (int i = 0; i < resultData.Length; i++)
- {
- if (((ConsentVO)resultData[i]).ConsentMstRid == consentMstRid)
- {
- ConsentVO vo = GetCurrentConsentVO(i);
- if (vo != null)
- {
- ExecutePreviewWithSelectedConsent(vo);
- RunConsentDualView();
- }
- break;
- }
- }
- }
- else
- {
- ConsentVO vo = GetCurrentConsentVO(0);
- if (vo != null)
- {
- ExecutePreviewWithSelectedConsent(vo);
- }
- }
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- #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;
- 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.ConsentName;
- commandControl.CurrentPreviewConsent.PrntCnt = vo.PrntCnt;
- commandControl.CurrentPreviewConsent.ConsentMstRid = vo.ConsentMstRid.ToString();
- commandControl.CurrentPreviewConsent.ConsentState = vo.ConsentState;
- commandControl.CurrentPreviewConsent.OrderNo = vo.OrderNo;
- commandControl.CurrentPreviewConsent.Ocrcode = vo.OcrNumber;
- commandControl.CurrentPreviewConsent.InputId = vo.CreateUserId;
- commandControl.CurrentPreviewConsent.InputNm = vo.CreateUserName;
- commandControl.CurrentPreviewConsent.ReissueConsentMstRid = 0;
- commandControl.CurrentPreviewConsent.RewriteConsentMstRid = 0;
- commandControl.CurrentPreviewConsent.VisitType = vo.VisitType;
- commandControl.CurrentPreviewConsent.Ocrtagprntyn = vo.OcrTagYN;
- consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.ConsentName);
-
- if (vo.ConsentState.ToUpper().Equals("TEMP"))
- {
- commandControl.ShowTempSaveConsent(consentMain);
- }
- else if (vo.ConsentState.ToUpper().Equals("UNFINISHED"))
- {
- CheckClnDateInfo(vo);
- commandControl.PreviewConsent(consentMain);
- }
- this.Cursor = currentCursor;
- }
- //동의서의 처방일자와 생성번호 등의 정보가 현재 정보와 일치하지 않은 경우, 미리보기를 위해서 데이터를 재조회한다.
- private void CheckClnDateInfo(ConsentVO vo)
- {
- if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
- if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
- if (commandControl.CurrentTargetPatient == null) return;
- bool bSame = true;
- if (!string.IsNullOrEmpty(vo.ClnDate) && !vo.ClnDate.Replace("-", "").Equals(commandControl.CurrentTargetPatient.clnDate.Replace("-", "")))
- bSame = false;
- if (!vo.Cretno.ToString().Equals(commandControl.CurrentTargetPatient.cretno))
- bSame = false;
- if (!string.IsNullOrEmpty(vo.ClnDeptCd) && !vo.ClnDeptCd.Equals(commandControl.CurrentTargetPatient.clnDeptCode))
- bSame = false;
- if (!string.IsNullOrEmpty(vo.VisitType) && !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);
- RunConsentDualView();
- }
- }
- private void dataGridViewConsentSelectResult_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e)
- {
- //MessageBox.Show("dataGridViewConsentSelectResult_CellContextMenuStripNeeded");
- if (e.RowIndex >= 0 && this.dataGridViewConsentSelectResult.Rows[e.RowIndex].Selected == true)
- {
- ConsentVO vo = GetCurrentConsentVO(e.RowIndex);
- if (commandControl.CurrentPreviewConsent != null)// && commandControl.CurrentPreviewConsent.ConsentMstRid.Equals(this.dataGridViewConsentSelectResult.Rows[e.RowIndex].Index))
- {
- if (vo.ConsentState.Equals("UNFINISHED") || vo.ConsentState.Equals("TEMP"))
- {
- ContextMenuStrip strip = new ContextMenuStrip();
- if (vo.ConsentState.Equals("UNFINISHED") || vo.ConsentState.Equals("TEMP"))
- {
- ToolStripMenuItem deleteRecord = new ToolStripMenuItem();
- deleteRecord.Text = "삭제";
- strip.Items.Add(deleteRecord);
- deleteRecord.Click += new EventHandler(deleteRecord_Click);
- }
- // 임시저장 삭제로직 추가
- // 뷰어에 보여지는 동의서 상태가 임시저장일 경우에 보여질 메뉴명과 실행할 함수(deleteRecord_Click : 미작성 삭제하는 로직과 동일한 경우 동일한 함수를 사용하여 처리 가능함)
- //if (vo.ConsentState.Equals("TEMP"))
- //{
- // ToolStripMenuItem deleteRecord = new ToolStripMenuItem();
- // deleteRecord.Text = "삭제"; // 메뉴명
- // strip.Items.Add(deleteRecord); // 마우스 우클릭에 보여줄 메뉴에 추가
- // deleteRecord.Click += new EventHandler(deleteRecord_Click); // 마우스 우클릭 후 메뉴를 선택했을 경우 실행될 함수를 이벤트로 등록
- //}
- e.ContextMenuStrip = strip;
- }
- }
- }
- }
- private void dataGridViewConsentSelectResult_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
- {
- //MessageBox.Show("dataGridViewConsentSelectResult_CellMouseDoubleClick" + e.Button.ToString());
- ConsentVO vo = GetCurrentConsentVO(e.RowIndex);
-
- if (vo != null && !e.Button.ToString().Equals("Right"))
- {
- 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_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.Cells[0].Style.ForeColor = System.Drawing.Color.Red;
- row.Cells[1].Style.ForeColor = System.Drawing.Color.Red;
- }
- }
- }
- }
- 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;
- ConsentVO vo = GetCurrentConsentVO(this.dataGridViewConsentSelectResult.SelectedRows[0].Index);
- commandControl.CurrentPreviewConsent.ReissueConsentMstRid = vo.ConsentMstRid;
- consentMain.ConsentCommandCtrl.DeleteRecordOfDeleteConsent(reason);
- consentMain.ConsentListCtrl.InquiryConsentData(-1);
- this.Cursor = currentCursor;
- MessageBox.Show(string.Format(Properties.Resources.msg_consent_record_deleted)
- , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- catch (Exception ex)
- {
- this.Cursor = currentCursor;
- throw ex;
- }
- }
- }
- }
- #endregion
- }
- }
|