#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:ConsentCommandCtrl.cs // #endregion using System; using System.ComponentModel; using System.Collections.Generic; using System.Windows.Forms; using System.IO; using System.Net; using System.Xml; using System.Drawing; using System.Security.Cryptography; using CLIP.eForm.Consent.Dfh.UI.ConsentSvcRef; using CLIP.eForm.Consent.Dfh.UI.HospitalSvcRef; using ClipSoft.eForm.Base.Dialog; namespace CLIP.eForm.Consent.Dfh.UI { /// /// 출력, 전자동의서 실행 버튼 클래스 /// /// ///

[설계자]

///

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

///

[원본 작성자]

///

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

///

[수정 작성자]

///

클립소프트 기술부 이인희

///

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

///

[HISTORY]

///

2016-06-21 : 최초작성

///

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

///
public partial class ConsentCommandCtrl : ConsentCommandCtrlBase { private PreviewConsent currentPreviewConsent = null; private TargetPatient currentTargetPatient = null; private EndUser currentEndUser = null; private IConsentMain consentMain = null; private ConsentSvcRef.ConsentSvcSoapClient consentWebService = null; private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null; private string exportedImageFiles = string.Empty; private string exportedImageFilesJson = string.Empty; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConsentCommandCtrl)); public ConsentCommandCtrl() { InitializeComponent(); } public override bool EnableRedo { get { return base.EnableRedo; } set { base.EnableRedo = value; this.toolStripButtonRedo.Enabled = base.EnableRedo; } } public override bool EnableUndo { get { return base.EnableUndo; } set { base.EnableUndo = value; this.toolStripButtonUndo.Enabled = base.EnableUndo; } } public override bool EnableRemoveAll { get { return base.EnableRemoveAll; } set { base.EnableRemoveAll = value; this.toolStripButtonDelAllDraw.Enabled = base.EnableRemoveAll; } } public override bool EnablePenDrawing { get { return base.EnableRemoveAll; } set { base.EnablePenDrawing = value; this.toolStripButtonPen.Enabled = base.EnablePenDrawing; } } public override bool EnablePenConfig { get { return base.EnablePenConfig; } set { base.EnablePenConfig = value; this.toolStripButtonPenConfig.Enabled = base.EnablePenConfig; } } public PreviewConsent CurrentPreviewConsent { get { return currentPreviewConsent; } set { currentPreviewConsent = value; } } public TargetPatient CurrentTargetPatient { get { return currentTargetPatient; } set { currentTargetPatient = value; } } public EndUser CurrentEndUser { get { return currentEndUser; } set { currentEndUser = value; } } public override bool getTempSaveButton() { return this.toolStripButtonTempSaveToServer.Enabled; } public override bool getSaveButton() { return this.toolStripButtonSaveToServer.Enabled; } public override void setTempSaveButton(bool enabled) { this.toolStripButtonTempSaveToServer.Enabled = enabled; } public override void setSaveButton(bool enabled) { this.toolStripButtonSaveToServer.Enabled = enabled; } protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) { return; } if (!ConsentMainControl.HasVerticalMonitor) { this.toolStripButtonExecute.Visible = false; } else { this.toolStripButtonExecute.Visible = true; } this.consentMain = ConsentMainControl.GetConsentMainInterface(this); this.consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]); this.hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]); InitZoomRateDropdownItems(); this.consentMain.OnLoadPartControls += ConsentMain_OnLoadPartControls; this.toolStripButtons.MouseEnter += ToolStripButtons_MouseEnter; } private void ConsentMain_OnLoadPartControls(object sender, EventArgs e) { this.consentMain.OnVisibleEFormControl += ConsentMain_OnVisibleEFormControl; this.consentMain.OnInvisibleEFormControl += ConsentMain_OnInvisibleEFormControl; } private void ConsentMain_OnInvisibleEFormControl(object sender, EventArgs e) { this.consentMain.ConsentCommandCtrl.Enabled = false; } private void ConsentMain_OnVisibleEFormControl(object sender, EventArgs e) { this.consentMain.ConsentCommandCtrl.Enabled = true; } private void InitZoomRateDropdownItems() { this.toolStripComboBoxZoom.Items.Add(new ZoomRateDropdownItem("50%", "50")); this.toolStripComboBoxZoom.Items.Add(new ZoomRateDropdownItem("75%", "75")); this.toolStripComboBoxZoom.Items.Add(new ZoomRateDropdownItem("100%", "100")); this.toolStripComboBoxZoom.Items.Add(new ZoomRateDropdownItem("200%", "200")); this.toolStripComboBoxZoom.Items.Add(new ZoomRateDropdownItem("창 너비에 맞춤", "pagewidth")); this.toolStripComboBoxZoom.Items.Add(new ZoomRateDropdownItem("창 크기에 맞춤", "wholepage")); } #region toolStripButton 이벤트 private void ToolStripButtons_MouseEnter(object sender, EventArgs e) { this.toolStripButtons.Focus(); } private void toolStripButtonFirstPage_Click(object sender, EventArgs e) { this.consentMain.MoveFirstPage(); } private void toolStripButtonPrevPage_Click(object sender, EventArgs e) { this.consentMain.MovePrevPage(); } private void toolStripButtonNextPage_Click(object sender, EventArgs e) { this.consentMain.MoveNextPage(); } private void toolStripButtonLastPage_Click(object sender, EventArgs e) { this.consentMain.MoveLastPage(); } private void toolStripTextBoxPageIndex_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.toolStripTextBoxPageIndex.Text)) { bool currentIndexParseResult; int currentIndex = 0; currentIndexParseResult = int.TryParse(this.toolStripTextBoxPageIndex.Text, out currentIndex); bool totalIndexParseResult; int totalIndex = 0; totalIndexParseResult = int.TryParse(this.toolStripTextBoxPageIndex.Text, out totalIndex); if (currentIndexParseResult == false || totalIndexParseResult == false) { return; } if (currentIndex > totalIndex) { } else { this.consentMain.MoveToPageIndex(currentIndex); } } } private void toolStripComboBoxZoom_SelectedIndexChanged(object sender, EventArgs e) { ZoomRateDropdownItem zoomRateItem = this.toolStripComboBoxZoom.SelectedItem as ZoomRateDropdownItem; if (zoomRateItem == null) { } else { this.consentMain.SetZoomRate(zoomRateItem.ItemValue); } } private void toolStripButtonPrint_Click(object sender, EventArgs e) { PrintConsent(); } private void toolStripButtonCloseDualViewer_Click(object sender, EventArgs e) { this.consentMain.CloseDualViewer(); } private void toolStripButtonTempSaveToServer_Click(object sender, EventArgs e) { this.consentMain.TempSave(); } private void toolStripButtonSaveToServer_Click(object sender, EventArgs e) { this.consentMain.saveClickPoint = true; this.consentMain.Save(); this.consentMain.saveClickPoint = false; } private void toolStripButtonExecute_Click(object sender, EventArgs e) { RunConsentDualView(); } private void toolStripButtonPen_Click(object sender, EventArgs e) { bool isDrawMode = this.consentMain.IsDrawMode(); this.consentMain.EnableDrawing(!isDrawMode); this.toolStripButtonPen.Checked = !isDrawMode; } private void toolStripButtonPenConfig_Click(object sender, EventArgs e) { this.consentMain.ConfigDrawingPen(); } private void toolStripButtonDelAllDraw_Click(object sender, EventArgs e) { this.consentMain.RemoveAllDrawing(); } private void toolStripButtonUndo_Click(object sender, EventArgs e) { this.consentMain.UndoDrawing(); } private void toolStripButtonRedo_Click(object sender, EventArgs e) { this.consentMain.RedoDrawing(); } #endregion public override void OnPaging(int currentPageIndex) { this.toolStripTextBoxPageIndex.Text = currentPageIndex.ToString(); } /// /// 동의서 종이 출력 /// /// public override void OnPrint(string value) { Cursor currentCursor = this.Cursor; try { this.Cursor = Cursors.WaitCursor; SaveDataForPrintedConsent(string.Empty); // 출력 카운트만큼 출력 된 후 처리 if (this.consentMain.printSaveStatus) { if (!string.IsNullOrEmpty(consentMain.ConsentExecuteInfo["printAct"]) && consentMain.ConsentExecuteInfo["printAct"].Equals("N")) { //MessageBox.Show(string.Format(Properties.Resources.msg_temp_print_confirm) // , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information); //출력후에는 전체목록 탭이 선택되게 한다. this.consentMain.ConsentListCtrl.InquiryConsentData(-2); } else { //agent 구동시 바로 출력을 하는 경우 미작성 탭이 선택되게 한다. this.consentMain.ConsentListCtrl.InquiryConsentData(9); } //Agent에서 출력요청한 내용이 모두 끝나면 창을 닫는다. if (this.consentMain.ConsentExecuteInfo.ContainsKey("printAct") && !string.IsNullOrEmpty(this.consentMain.ConsentExecuteInfo["printAct"]) && this.consentMain.ConsentExecuteInfo["printAct"].Equals("Y")) { this.consentMain.agentCallPrintCnt--; if (this.consentMain.agentCallPrintCnt == 0) { this.consentMain.Parent_Disposed(); } } } this.Cursor = currentCursor; } catch (Exception ex) { this.Cursor = currentCursor; throw ex; } finally { } base.OnPrint(value); } /// /// 동의서 동의서 미리보기 상태 활성화 처리 /// /// public override void SetEnableConsentIssueCommands(bool isIssuable) { this.toolStripButtonPrint.Enabled = isIssuable;//프린트 this.toolStripButtonExecute.Enabled = isIssuable;//아큐실행버튼 this.toolStripButtonFirstPage.Enabled = isIssuable;// this.toolStripButtonPrevPage.Enabled = isIssuable; this.toolStripButtonNextPage.Enabled = isIssuable; this.toolStripButtonLastPage.Enabled = isIssuable; this.toolStripTextBoxPageIndex.Enabled = isIssuable;//페이지번호 보여주는부분 total page this.toolStripLabelTotalPages.Enabled = isIssuable;// this.toolStripTextBoxPageIndex.Text = consentMain.GetCurrentPageIndex().ToString(); this.toolStripLabelTotalPages.Text = consentMain.GetTotalPageCount().ToString(); this.toolStripComboBoxZoom.Enabled = isIssuable;//넓이 맞춤 서식 폭 조정 //this.toolStripComboBoxZoom.SelectedItem = this.toolStripComboBoxZoom.Items[2]; this.toolStripButtonDeleteAllSignData.Enabled = isIssuable;//그림그린거 다없앤거 this.toolStripButtonInsertAttach.Enabled = isIssuable;//첨지 this.toolStripButtonDeleteAttach.Enabled = isIssuable;//첨지삭제 //if (!ConsentMainControl.HasVerticalMonitor) //{ this.toolStripButtonSaveToServer.Enabled = isIssuable;//저장완료 this.toolStripButtonTempSaveToServer.Enabled = isIssuable;//임시저장 //} } /// /// 동의서 상태에 따라 버튼들 활성화를 조절한다 /// public override void SetEnableButtonsByCurrentConsent() { string state = string.Empty; if (this.CurrentPreviewConsent != null) { state = this.CurrentPreviewConsent.ConsentState; } if (this.CurrentTargetPatient != null && !string.IsNullOrEmpty(this.CurrentTargetPatient.PatientCode)) { if (!ConsentMainControl.HasVerticalMonitor)//아큐체크 여기는 아큐가 없음.. { this.toolStripButtonTempSaveToServer.Enabled = true; this.toolStripButtonSaveToServer.Enabled = true; this.toolStripButtonPrint.Enabled = true; SetEnableButtonsByConsentStateForSingleView(state); this.EnablePenDrawing = true; this.EnablePenConfig = true; } else { this.toolStripButtonExecute.Enabled = true; this.toolStripButtonPrint.Enabled = true; SetEnableButtonsByConsentStateForDualView(state); this.toolStripButtonSaveToServer.Enabled = true; } } else { this.toolStripButtonPrint.Enabled = false; this.toolStripButtonTempSaveToServer.Enabled = false; this.toolStripButtonSaveToServer.Enabled = false; } } public override void SetEnablementExecuteWhenDualViewerActive(bool enabled) { this.toolStripButtonExecute.Enabled = enabled; this.toolStripButtonPrint.Enabled = enabled; //this.toolStripButtonTempSaveToServer.Enabled = !enabled; //this.toolStripButtonSaveToServer.Enabled = !enabled; if (enabled) { if(this.CurrentPreviewConsent != null) { if (this.CurrentPreviewConsent.OutputType != null) { if (this.CurrentPreviewConsent.OutputType.Equals("ELECTRONIC")) { this.toolStripButtonPrint.Enabled = !enabled; } } } } this.toolStripButtonCloseDualViewer.Visible = !enabled; SetEnableByUserType(); base.SetEnablementExecuteWhenDualViewerActive(enabled); } private void SetEnableButtonsByConsentStateForDualView(string state) { if (state.Equals("PAPER_OUT")) { this.toolStripButtonExecute.Enabled = false; } else if (state.Equals("FNU_PRINT")) { this.toolStripButtonExecute.Enabled = false; } else if (state.Equals("TEMP")) { this.toolStripButtonPrint.Enabled = false; } else if (state.Equals("ELECTR_CMP") || state.Equals("CERTIFY_CMP")) { this.toolStripButtonExecute.Enabled = false; this.toolStripButtonPrint.Enabled = false; } if (this.CurrentPreviewConsent.RewriteConsentMstRid > 0) { this.toolStripButtonExecute.Enabled = true; this.toolStripButtonPrint.Enabled = false; } } private void SetEnableButtonsByConsentStateForSingleView(string state) { if (state.Equals("PAPER_OUT")) { this.toolStripButtonSaveToServer.Enabled = false; this.toolStripButtonTempSaveToServer.Enabled = false; this.toolStripButtonExecute.Enabled = false; } else if (state.Equals("FNU_PRINT")) { this.toolStripButtonPrint.Enabled = false; this.toolStripButtonSaveToServer.Enabled = false; this.toolStripButtonTempSaveToServer.Enabled = false; this.toolStripButtonExecute.Enabled = false; } else if (state.Equals("TEMP")) { this.toolStripButtonPrint.Enabled = false; } else if (state.Equals("ELECTR_CMP") || state.Equals("CERTIFY_CMP")) { this.toolStripButtonSaveToServer.Enabled = false; this.toolStripButtonTempSaveToServer.Enabled = false; this.toolStripButtonPrint.Enabled = false; } if (this.CurrentPreviewConsent.RewriteConsentMstRid > 0) { this.toolStripButtonSaveToServer.Enabled = true; this.toolStripButtonTempSaveToServer.Enabled = true; this.toolStripButtonPrint.Enabled = false; } } /// /// 미작성 동의서 삭제 /// /// public override void DeleteRecordOfDeleteConsent(string reasonForUseN) { SaveDataForDeleteConsent(reasonForUseN); } private void SaveDataForPrintedConsent(string reasonForUseN) { string consentOutputType = this.CurrentPreviewConsent.OutputType; string consentState = this.CurrentPreviewConsent.ConsentState; //인쇄(바코드제외), FNU_PRINT인 경우 CONSENT_MST에 데이터를 입력하지 않는다. if (( !string.IsNullOrEmpty(consentOutputType) && consentOutputType.Equals("PAPER_EXCEPT_BARCODE") ) || (!string.IsNullOrEmpty(consentState) && consentState.Equals("FNU_PRINT")) ) { return; } if (consentOutputType != null && consentOutputType.Equals("MULTI")) { Cursor currentCursor = this.Cursor; try { this.Cursor = Cursors.WaitCursor; List volist = consentMain.PatientListCtrl.GetSelectedPatientList; string[] strOcrCd = null; if (this.CurrentPreviewConsent.MultiOcrcode.Length > 0) { strOcrCd = this.CurrentPreviewConsent.MultiOcrcode.Split('^'); } string[] strMainDrIdCd = null; if (this.CurrentPreviewConsent.MultiMainDrIdCd.Length > 0) { strMainDrIdCd = this.CurrentPreviewConsent.MultiMainDrIdCd.Split('^'); } for (int i=0; i 0 && !CurrentPreviewConsent.ConsentState.ToUpper().Equals("UNFINISHED")) reissueConsentMstRid = consentMstRidInt; string deviceIdentNo = System.Environment.MachineName; Cursor currentCursor = this.Cursor; try { this.Cursor = Cursors.WaitCursor; consentMstRidInt = this.consentWebService.SavePrintOut(userId, patientCode, clnDeptCode, formRidInt, formCd, consentMstRidInt, reissueConsentMstRid, null, null, "PRT", deviceIdentNo, vistType, hosType, clnDate, ward, roomcd, orderNo, orderName, orderCode, ocrCode, cretno, userName, userName, mainDrId); //첫번째 출력인 경우에만 LCtech 모듈 연동을 위한 웹메서드 호출 if (reissueConsentMstRid == 0) { if (this.CurrentPreviewConsent != null && !string.IsNullOrEmpty(this.CurrentPreviewConsent.Ocrtagprntyn) //&& this.CurrentPreviewConsent.Ocrtagprntyn.Equals("Y") ) { // 출력 카운트만큼 출력 된 후 처리 if (this.consentMain.multiPrintExecCnt < 1) { string fstprntdt = DateTime.Now.ToString("yyyyMMddHHmmss"); this.hospitalWebService.insertPrintData(ocrCode, patientCode, vistType, clnDate, CurrentTargetPatient.cretno, userId, clnDeptCode, formCd , fstprntdt, CurrentEndUser.DeptCode, userId, consentMain.GetTotalPageCount().ToString(),this.consentMain.checkAutoPrint, this.CurrentPreviewConsent.Ocrtagprntyn); } } } this.consentMain.multiPrintExecCnt++; this.Cursor = currentCursor; } catch (Exception ex) { this.Cursor = currentCursor; throw ex; } #endregion } } } private PatientVO GetPatientByPatList(PatListVO patvo) { string indd = string.Empty; if (!string.IsNullOrEmpty(patvo.indd)) indd = patvo.indd.Replace("/", "").Replace("-", ""); PatientVO[] patientVOList = this.hospitalWebService.GetPatientInfo(patvo.pid, indd, patvo.ordtype, patvo.orddeptcd, patvo.cretno.ToString() ); if (patientVOList == null || patientVOList.Length == 0) { return null; } else { return patientVOList[0]; } } private void SaveDataForDeleteConsent(string reasonForUseN) { string userId = CurrentEndUser.UserNo; string patientCode = CurrentTargetPatient.PatientCode; string clnDeptCd = CurrentTargetPatient.clnDeptCode; string ward = CurrentTargetPatient.Ward; string roomcd = CurrentTargetPatient.RoomNo; string formRid = CurrentPreviewConsent.FormRid; string consentMstRid = CurrentPreviewConsent.ConsentMstRid; string consentState = CurrentPreviewConsent.ConsentState; int rewriteConsentMstRid = CurrentPreviewConsent.RewriteConsentMstRid; int formRidInt; int consentMstRidInt; ConvertStringToInt(formRid, consentMstRid, out formRidInt, out consentMstRidInt); int reissueConsentMstRidInt = CurrentPreviewConsent.ReissueConsentMstRid; string deviceIdentNo = System.Environment.MachineName; this.consentWebService.SaveDelete(userId , consentMstRidInt , patientCode , clnDeptCd , ward , roomcd , formRidInt , rewriteConsentMstRid , reissueConsentMstRidInt , consentState , deviceIdentNo , reasonForUseN ); } private void SetHasMedicalHistoryInConsent(string patientCode) { this.CurrentPreviewConsent.HasMedicalHistory = false; } public void RunConsentDualView() { bool runDualView = true; if (this.CurrentEndUser != null && this.CurrentPreviewConsent != null && !string.IsNullOrEmpty(this.CurrentPreviewConsent.PrintOnly) && this.CurrentPreviewConsent.PrintOnly.Equals("Y") ) { runDualView = false; } // 출력 상태일 경우 재출력만 가능하도록 버튼 조정 if (this.CurrentEndUser != null && this.CurrentPreviewConsent != null && !string.IsNullOrEmpty(this.CurrentPreviewConsent.ConsentState) && ( this.CurrentPreviewConsent.ConsentState.ToUpper().Equals("PAPER_OUT") || this.CurrentPreviewConsent.ConsentState.ToUpper().Equals("FNU_PRINT") ) ) { runDualView = false; } // 일반의사의 경우 출력만 가능하도록. if (this.CurrentEndUser.UserNo.Substring(0,4).Equals("5000") && this.CurrentPreviewConsent != null) { runDualView = false; } int state = this.consentWebService.CheckConsentState(int.Parse(this.CurrentPreviewConsent.ConsentMstRid), this.CurrentPreviewConsent.ConsentState); if (state == 1) { return; } // 출력만 가능하거나 출력상태일 경우 듀얼뷰어 실행 못하도록 적용 if (runDualView) this.consentMain.RunConsentDualView(); } public void ShowCompleteConsent(IConsentMain consentMain) { //SetEnableButtonsByCurrentConsent(); consentMain.ReviewConsent(); ConsentImageVO[] cImage = this.consentWebService.GetConsentImage(this.CurrentPreviewConsent.ConsentMstRid); if (cImage != null && cImage.Length > 0) { CLIP.eForm.ImageView.ImageViewCtrl iViewer = consentMain.GetImageViewerCtrl(); List lStr = new List(); string sPath = this.consentMain.PluginExecuteInfo["imageUploadPath"] + "/DataTempImage/"; string sLocal = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Clipsoft\ClipSoft.eForm.Viewer\DataTemp\"; DirectoryInfo di = new DirectoryInfo(sLocal); if (di.Exists == false) { di.Create(); } foreach (ConsentImageVO img in cImage) { if (File.Exists(sLocal + img.ImageFilename)) { Image imgTemp = Image.FromFile(sLocal + img.ImageFilename); lStr.Add(ImageToBase64(imgTemp, System.Drawing.Imaging.ImageFormat.Jpeg)); imgTemp.Dispose(); } else { string orgFile = img.ImagePath + "\\" + img.ImageFilename; string tempImgNm = orgFile.Substring(orgFile.IndexOf("\\") + 1).Replace("\\", ""); using (WebClient myWebClient = new WebClient()) { myWebClient.DownloadFile(sPath + tempImgNm, sLocal + img.ImageFilename); if (File.Exists(sLocal + img.ImageFilename)) { Image imgTemp = Image.FromFile(sLocal + img.ImageFilename); lStr.Add(ImageToBase64(imgTemp, System.Drawing.Imaging.ImageFormat.Jpeg)); imgTemp.Dispose(); } else { break; } } } } if (lStr.Count > 0) iViewer.SetBase64Images(lStr); } else { // 검색된 이미지가 없습니다. } } public string ImageToBase64(Image image, System.Drawing.Imaging.ImageFormat format) { using (MemoryStream ms = new MemoryStream()) { // Convert Image to byte[] image.Save(ms, format); byte[] imageBytes = ms.ToArray(); // Convert byte[] to Base64 String string base64String = Convert.ToBase64String(imageBytes); return base64String; } } public void PreviewConsent(IConsentMain consentMain) { Dictionary globalParams = Common.CreateGlobalParamsDictionary(); List formGuids = new List(); formGuids.Add(this.CurrentPreviewConsent.FormGuid); if (this.CurrentPreviewConsent.ConsentState.ToLower().Equals("paper_out") || this.CurrentPreviewConsent.ConsentState.ToLower().Equals("fnu_print")) { SetPatientAndUser(globalParams, true); } else { SetPatientAndUser(globalParams, false); } globalParams["IO_ocr_cd"] = CurrentPreviewConsent.Ocrcode = GetOcrCode(); // OCR 코드 globalParams["IO_device"] = "C"; globalParams["IO_printtime"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); globalParams["IO_signdate"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); globalParams["IO_signtime"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string fos = Common.GetFosString(formGuids , consentMain.PluginExecuteInfo["formServiceUrl"] , globalParams , null); int state = this.consentWebService.CheckConsentState(int.Parse(this.CurrentPreviewConsent.ConsentMstRid), this.CurrentPreviewConsent.ConsentState); if (state == 1) { MessageBoxDlg.Show(this, "이미 저장된 서식 입니다." , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } consentMain.PreviewConsent(fos);//서식을 열도록 fos을 던짐 consentMain.ConsentCommandCtrl.SetEnableConsentIssueCommands(true);// consentMain.ConsentCommandCtrl.SetEnableButtonsByCurrentConsent(); SetEnableByUserType();//최종적 버튼 체크 //System.Diagnostics.Trace.WriteLine(fos); } private string GetOcrCode() { string strOcrCode = ""; if (this.CurrentPreviewConsent != null && !string.IsNullOrEmpty(this.CurrentPreviewConsent.Ocrcode)) { strOcrCode = this.CurrentPreviewConsent.Ocrcode; } else { if (this.CurrentPreviewConsent != null && !string.IsNullOrEmpty(this.CurrentPreviewConsent.Ocrtagprntyn) && this.CurrentPreviewConsent.Ocrtagprntyn.Equals("Y")) { strOcrCode = hospitalWebService.GetOcrTag(); } } return strOcrCode; } private void SetPatientAndUser(Dictionary globalParams, bool isPrint) { Dictionary changingGlobalParams = new Dictionary(); if (this.CurrentPreviewConsent != null) { changingGlobalParams["IO_formname"] = this.CurrentPreviewConsent.FormName; if (!isPrint) { // changingGlobalParams["IO_INPUTNM"] = (this.CurrentPreviewConsent.InputNm.Length > 0) ? this.CurrentPreviewConsent.InputNm : this.CurrentEndUser.UserName; changingGlobalParams["IO_INPUTNM"] = this.CurrentEndUser.UserName; } } if (this.CurrentTargetPatient != null && !string.IsNullOrEmpty(this.CurrentTargetPatient.PatientCode)) { changingGlobalParams["UrlParam"] = this.consentMain.PluginExecuteInfo["imageUploadPath"] + "/"; changingGlobalParams["IO_Pt_ID"] = this.CurrentTargetPatient.PatientCode; changingGlobalParams["IO_sex_age_y_m"] = this.CurrentTargetPatient.PatientSexAge; changingGlobalParams["IO_Pt_name"] = this.CurrentTargetPatient.PatientName; changingGlobalParams["IO_JuminNo"] = this.CurrentTargetPatient.PatientJuminNo; changingGlobalParams["IO_roomNo"] = this.CurrentTargetPatient.Ward + "/" + this.CurrentTargetPatient.RoomNo; changingGlobalParams["IO_ADdate"] = SetDateFormatting(this.CurrentTargetPatient.clnDate.Replace("-", "")); changingGlobalParams["IO_Dept"] = this.CurrentTargetPatient.clnDeptName; changingGlobalParams["IO_Dept2"] = this.CurrentTargetPatient.clnDeptNameKO; changingGlobalParams["IO_maindr"] = this.CurrentTargetPatient.MainDrNm; changingGlobalParams["IO_Pt_address"] = this.CurrentTargetPatient.PatientAddr; changingGlobalParams["IO_Pt_tel"] = this.CurrentTargetPatient.PatientTelNo; changingGlobalParams["IO_Insukind"] = this.CurrentTargetPatient.Insukind; if (!isPrint) { changingGlobalParams["IO_OPdept"] = this.CurrentTargetPatient.OPdeptName; changingGlobalParams["IO_OPdept"] = this.CurrentTargetPatient.OPdeptName; changingGlobalParams["IO_OPdr"] = this.CurrentTargetPatient.OPdrNm; changingGlobalParams["IO_Dx"] = this.CurrentTargetPatient.clnDxNm; if (!string.IsNullOrEmpty(this.CurrentTargetPatient.PatientJuminNo) && this.CurrentTargetPatient.PatientJuminNo.Length > 6) { changingGlobalParams["IO_PT_birthday"] = this.CurrentTargetPatient.PatientJuminNo.Substring(0, 6); } if (string.IsNullOrEmpty(changingGlobalParams["IO_Dx"])) { if (consentMain.ConsentExecuteInfo.ContainsKey("clnDxNm")) { changingGlobalParams["IO_Dx"] = consentMain.ConsentExecuteInfo["clnDxNm"]; } consentMain.ConsentExecuteInfo["clnDxNm"] = string.Empty; } changingGlobalParams["IO_bp"] = this.CurrentTargetPatient.Ex_bp; changingGlobalParams["IO_dm"] = this.CurrentTargetPatient.Ex_dm; changingGlobalParams["IO_heart"] = this.CurrentTargetPatient.Ex_heart; changingGlobalParams["IO_kidney"] = this.CurrentTargetPatient.Ex_kidney; changingGlobalParams["IO_respiration"] = this.CurrentTargetPatient.Ex_respiration; changingGlobalParams["IO_hx"] = this.CurrentTargetPatient.Ex_hx; changingGlobalParams["IO_allergy"] = this.CurrentTargetPatient.Ex_allergy; changingGlobalParams["IO_drug"] = this.CurrentTargetPatient.Ex_drug; changingGlobalParams["IO_smoking"] = this.CurrentTargetPatient.Ex_smoking; changingGlobalParams["IO_idio"] = this.CurrentTargetPatient.Ex_idio; changingGlobalParams["IO_nacrotics"] = this.CurrentTargetPatient.Ex_nacrotics; changingGlobalParams["IO_airway"] = this.CurrentTargetPatient.Ex_airway; changingGlobalParams["IO_hemorrhage"] = this.CurrentTargetPatient.Ex_hemorrhage; changingGlobalParams["IO_status_etc"] = this.CurrentTargetPatient.Ex_status_etc; if (this.CurrentTargetPatient.clnDeptCode.Equals("2010300000") && this.CurrentTargetPatient.VisitType.Equals("O"))//소화기내과일 경우에만 진료의를 셋팅 { changingGlobalParams["IO_OPdr"] = this.CurrentTargetPatient.MainDrNm; } } } if (this.CurrentEndUser != null && !isPrint) { UserSignImageVO vo = this.hospitalWebService.GetSignImage(this.CurrentEndUser.UserNo); if (vo != null) { changingGlobalParams["IO_SIGNIMG"] = ImageToBase64(byteArrayToImage(vo.SignImage), System.Drawing.Imaging.ImageFormat.Png); } } ChangeGlobalParametersToNew(globalParams, changingGlobalParams); } public void ShowTempSaveConsent(IConsentMain consentMain) { if (string.IsNullOrEmpty(this.CurrentPreviewConsent.ConsentMstRid) || this.CurrentPreviewConsent.ConsentMstRid.Equals("-1")) { return; } List formGuids = new List(); formGuids.Add(this.CurrentPreviewConsent.FormGuid); Dictionary actionParams = new Dictionary(); actionParams.Add("rid", this.CurrentPreviewConsent.ConsentMstRid);//선택한 리스트의 rid, state Dictionary globalParams = new Dictionary(); // changingGlobalParams["IO_INPUTNM"] = (this.CurrentPreviewConsent.InputNm.Length > 0) ? this.CurrentPreviewConsent.InputNm : this.CurrentEndUser.UserName; if(!string.IsNullOrEmpty(this.CurrentPreviewConsent.VisitType)) { if (!this.CurrentPreviewConsent.VisitType.Equals("O")) { if (consentMain.ConsentExecuteInfo.ContainsKey("loginUserName")) { globalParams["IO_INPUTNM"] = consentMain.ConsentExecuteInfo["loginUserName"]; } } } string fos = Common.GetFosStringForEpt(actionParams, consentMain.PluginExecuteInfo["formServiceUrl"], globalParams); int state = this.consentWebService.CheckConsentState(int.Parse(this.CurrentPreviewConsent.ConsentMstRid), this.CurrentPreviewConsent.ConsentState); if (state == 1) { MessageBoxDlg.Show(this, "이미 저장된 서식 입니다." , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } consentMain.PreviewConsent(fos); consentMain.ConsentCommandCtrl.SetEnableConsentIssueCommands(true); consentMain.ConsentCommandCtrl.SetEnableButtonsByCurrentConsent(); SetEnableByUserType(); } private Image byteArrayToImage(byte[] byteArrayIn) { MemoryStream ms = new MemoryStream(byteArrayIn); Image returnImage = Image.FromStream(ms); return returnImage; } /// /// 동의서 임시 데이터 저장 /// /// /// public override void SaveTempConsentData(string eptXmlValue, string dataValue) { /////// int state = this.consentWebService.CheckConsentState(int.Parse(this.CurrentPreviewConsent.ConsentMstRid), this.CurrentPreviewConsent.ConsentState); if (state == 1) { MessageBoxDlg.Show(this, "이미 저장된 서식 입니다." , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information); return ; } ///// string userId = CurrentEndUser.UserNo; string hosType = CurrentEndUser.HosType; string userName = CurrentEndUser.UserName; string patientCode = CurrentTargetPatient.PatientCode; string clnDeptCode = CurrentTargetPatient.clnDeptCode; string vistType = CurrentTargetPatient.VisitType; string clnDate = CurrentTargetPatient.clnDate.Replace("-",""); int rewriteConsentMstRid = 0; string ward = CurrentTargetPatient.Ward; string roomcd = CurrentTargetPatient.RoomNo; string formRid = CurrentPreviewConsent.FormRid; string formCd = CurrentPreviewConsent.FormCd; string consentMstRid = CurrentPreviewConsent.ConsentMstRid; int orderNo = CurrentTargetPatient.OrderNo; string orderCode = CurrentTargetPatient.clnDxCd; string orderName = CurrentTargetPatient.clnDxNm; string mainDrId = this.CurrentTargetPatient.MainDrId; string ocrCode = CurrentPreviewConsent.Ocrcode; if (string.IsNullOrEmpty(ocrCode)) { ocrCode = CurrentPreviewConsent.Ocrcode = GetOcrCode(); } int cretno = 0; int.TryParse(CurrentTargetPatient.cretno, out cretno); int formRidInt, consentMstRidInt; ConvertStringToInt(formRid, consentMstRid, out formRidInt, out consentMstRidInt); string deviceIdentNo = System.Environment.MachineName; Cursor currentCursor = this.Cursor; try { this.Cursor = Cursors.WaitCursor; consentMstRidInt = this.consentWebService.SaveTempData(userId, patientCode, clnDeptCode, formRidInt, formCd, consentMstRidInt, rewriteConsentMstRid, eptXmlValue, dataValue, "WIN", deviceIdentNo, vistType, hosType, clnDate, ward, roomcd, orderNo, orderName, orderCode, ocrCode, cretno, userName, userName, mainDrId ); //기왕력 데이터 저장 SetNewMedicalHistory(dataValue); //string sPID = this.consentWebService.SaveMedicalHistory( // patientCode, // clnDate.Replace("-", ""), // this.CurrentTargetPatient.Ex_bp, // this.CurrentTargetPatient.Ex_dm, // this.CurrentTargetPatient.Ex_heart, // this.CurrentTargetPatient.Ex_kidney, // this.CurrentTargetPatient.Ex_respiration, // this.CurrentTargetPatient.Ex_hx, // this.CurrentTargetPatient.Ex_allergy, // this.CurrentTargetPatient.Ex_drug, // this.CurrentTargetPatient.Ex_smoking, // this.CurrentTargetPatient.Ex_idio, // this.CurrentTargetPatient.Ex_nacrotics, // this.CurrentTargetPatient.Ex_airway, // this.CurrentTargetPatient.Ex_hemorrhage, // this.CurrentTargetPatient.Ex_status_etc, // userId // ); //if (string.IsNullOrEmpty(consentMain.ConsentExecuteInfo["startFormCd"])) //{ // this.consentMain.ConsentListCtrl.InquiryConsentData(consentMstRidInt); //} this.consentMain.ConsentListCtrl.InquiryConsentData(consentMstRidInt); MessageBoxDlg.Show(this, string.Format(Properties.Resources.msg_temp_save_confirm) , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information); this.Cursor = currentCursor; } catch (Exception ex) { this.Cursor = currentCursor; throw ex; } } private void SetNewMedicalHistory(string dataXml) { Dictionary outputDataDic = DataXmlToDictionary(dataXml); if (outputDataDic.ContainsKey("IO_bp")) this.CurrentTargetPatient.Ex_bp = outputDataDic["IO_bp"]; if (outputDataDic.ContainsKey("IO_dm")) this.CurrentTargetPatient.Ex_dm = outputDataDic["IO_dm"]; if (outputDataDic.ContainsKey("IO_heart")) this.CurrentTargetPatient.Ex_heart = outputDataDic["IO_heart"]; if (outputDataDic.ContainsKey("IO_kidney")) this.CurrentTargetPatient.Ex_kidney = outputDataDic["IO_kidney"]; if (outputDataDic.ContainsKey("IO_respiration")) this.CurrentTargetPatient.Ex_respiration = outputDataDic["IO_respiration"]; if (outputDataDic.ContainsKey("IO_hx")) this.CurrentTargetPatient.Ex_hx = outputDataDic["IO_hx"]; if (outputDataDic.ContainsKey("IO_allergy")) this.CurrentTargetPatient.Ex_allergy = outputDataDic["IO_allergy"]; if (outputDataDic.ContainsKey("IO_drug")) this.CurrentTargetPatient.Ex_drug = outputDataDic["IO_drug"]; if (outputDataDic.ContainsKey("IO_smoking")) this.CurrentTargetPatient.Ex_smoking = outputDataDic["IO_smoking"]; if (outputDataDic.ContainsKey("IO_idio")) this.CurrentTargetPatient.Ex_idio = outputDataDic["IO_idio"]; if (outputDataDic.ContainsKey("IO_nacrotics")) this.CurrentTargetPatient.Ex_nacrotics = outputDataDic["IO_nacrotics"]; if (outputDataDic.ContainsKey("IO_airway")) this.CurrentTargetPatient.Ex_airway = outputDataDic["IO_airway"]; if (outputDataDic.ContainsKey("IO_hemorrhage")) this.CurrentTargetPatient.Ex_hemorrhage = outputDataDic["IO_hemorrhage"]; if (outputDataDic.ContainsKey("IO_status_etc")) this.CurrentTargetPatient.Ex_status_etc = outputDataDic["IO_status_etc"]; } private static Dictionary DataXmlToDictionary(string dataXml) { Dictionary outputDataDic; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(dataXml); outputDataDic = outputDataDic = new Dictionary(); XmlNode rootNode = xmlDocument.SelectSingleNode("form-data"); foreach (XmlNode childNode in rootNode.ChildNodes) { string fieldName = string.Empty; string fieldValue = string.Empty; XmlElement outFieldElement = childNode as XmlElement; if (outFieldElement == null) { } else { fieldName = outFieldElement.Name; if (fieldName.Equals("state")) { foreach (XmlNode childNode2 in childNode.ChildNodes) { string fieldName2 = string.Empty; string fieldValue2 = string.Empty; XmlElement outFieldElement2 = childNode2 as XmlElement; fieldName2 = outFieldElement2.Name; if (outFieldElement2.ChildNodes.Count > 0 && outFieldElement2.ChildNodes[0] is XmlCDataSection) { fieldValue2 = ((XmlCDataSection)outFieldElement2.ChildNodes[0]).InnerText; } if (outputDataDic.ContainsKey(fieldName2)) { outputDataDic[fieldName2] = fieldValue2; } else { outputDataDic.Add(fieldName2, fieldValue2); } } } } } return outputDataDic; } /// /// 동의서 완료 데이터 저장 /// /// /// public override bool SaveCompleteConsentData(string eptXmlValue, string dataValue, out object saveResult) { ///////// //int state = this.consentWebService.CheckConsentState(int.Parse(this.CurrentPreviewConsent.ConsentMstRid), this.CurrentPreviewConsent.ConsentState); //if (state == 1) //{ // MessageBoxDlg.Show(this, "이미 저장된 서식 입니다." // , string.Format(Properties.Resources.msg_caption_confirm), // MessageBoxButtons.OK, MessageBoxIcon.Information); // saveResult = -1; // return false; //} //// int translateResult = -1; string sCertTarget = string.Empty; string sCertResult = string.Empty; try { translateResult = TranslateConsentToImageServer(exportedImageFiles, sCertResult); } catch (Exception ex) { string exMessage = ex.Message; if (ex.InnerException != null) { exMessage += Environment.NewLine + ex.InnerException.Message; } MessageBoxDlg.Show(true, string.Format(exMessage) , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail), MessageBoxButtons.OK, MessageBoxIcon.Error); saveResult = translateResult; return false; } string consentState = "ELECTR_CMP"; SignatureConfig sign = new SignatureConfig(); // 외래일 경우 공인인증 처리가 없음. if (!string.IsNullOrEmpty(CurrentTargetPatient.VisitType) && !CurrentTargetPatient.VisitType.Equals("O")) { try { // 공인인증 처리용 sCertTarget = sign.getSHA256ImageHash(exportedImageFiles, string.Empty); // 공인인증 처리 sCertResult = ConsentImageSignature(sCertTarget, CurrentEndUser.UserNo, CurrentEndUser.UserName); if (sCertResult == "-10") { // "로그인 사용자 정보를 통하여 공인인증서 정보가 정상적으로 조회되지 않았습니다." MessageBoxDlg.Show(true, Properties.Resources.msg_sign_user_info_fail , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail), MessageBoxButtons.OK, MessageBoxIcon.Error); saveResult = "-99"; return true; } else if (sCertResult == "-20") { // "공인인증 서버 접속에 실패하였을 하였습니다." MessageBoxDlg.Show(true, Properties.Resources.msg_sign_server_connection_fail , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail), MessageBoxButtons.OK, MessageBoxIcon.Error); saveResult = "-99"; return true; } else if (sCertResult == "-30") { // "공인인증 서버 접속에 실패하였을 하였습니다." MessageBoxDlg.Show(true, Properties.Resources.msg_sign_server_connection_fail , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail), MessageBoxButtons.OK, MessageBoxIcon.Error); saveResult = "-99"; return true; } else if (sCertResult == "-35") { // 공인인증 비밀번호 입력하지 않고 닫음 saveResult = "-99"; return true; } else if (sCertResult == "-40") { // "공인인증서 비밀번호가 틀렸습니다. MessageBoxDlg.Show(true, Properties.Resources.msg_sign_password_fail , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail), MessageBoxButtons.OK, MessageBoxIcon.Error); saveResult = "-99"; return true; } else if (sCertResult == "-50") { // "공인인증서명 처리를 실패하였을 하였습니다." MessageBoxDlg.Show(true, Properties.Resources.msg_sign_exec_fail , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail), MessageBoxButtons.OK, MessageBoxIcon.Error); saveResult = "-99"; return true; } else if (sCertResult == "-99") { // "공인인증서명 처리를 실패하였을 하였습니다." MessageBoxDlg.Show(true, Properties.Resources.msg_sign_exec_fail , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail), MessageBoxButtons.OK, MessageBoxIcon.Error); saveResult = "-99"; return true; } translateResult = 1; consentState = "CERTIFY_CMP"; } catch (Exception ex) { string exMessage = ex.Message; if (ex.InnerException != null) { exMessage += Environment.NewLine + ex.InnerException.Message; } MessageBoxDlg.Show(true, string.Format(exMessage) , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail), MessageBoxButtons.OK, MessageBoxIcon.Error); saveResult = translateResult; return false; } } // DB 저장용 sCertTarget = sign.getSHA256ImageHash(exportedImageFiles, "^"); string userId = CurrentEndUser.UserNo; string hosType = CurrentEndUser.HosType; string userName = CurrentEndUser.UserName; string patientCode = CurrentTargetPatient.PatientCode; string clnDeptCode = CurrentTargetPatient.clnDeptCode; string vistType = CurrentTargetPatient.VisitType; string clnDate = CurrentTargetPatient.clnDate.Replace("-", "").Replace("/", ""); string ward = CurrentTargetPatient.Ward; string roomcd = CurrentTargetPatient.RoomNo; string formRid = CurrentPreviewConsent.FormRid; string formCd = CurrentPreviewConsent.FormCd; string consentMstRid = CurrentPreviewConsent.ConsentMstRid; int rewriteConsentMstRid = CurrentPreviewConsent.RewriteConsentMstRid; int orderNo = CurrentTargetPatient.OrderNo; string orderCode = CurrentTargetPatient.clnDxCd; string orderName = CurrentTargetPatient.clnDxNm; string dschdd = CurrentTargetPatient.Dschdd; string mainDrId = this.CurrentTargetPatient.MainDrId; string ocrCode = CurrentPreviewConsent.Ocrcode; if (string.IsNullOrEmpty(ocrCode)) { ocrCode = CurrentPreviewConsent.Ocrcode = GetOcrCode(); } int cretno = 0; int.TryParse(CurrentTargetPatient.cretno, out cretno); int formRidInt; int consentMstRidInt; ConvertStringToInt(formRid, consentMstRid, out formRidInt, out consentMstRidInt); string deviceIdentNo = System.Environment.MachineName; Cursor currentCursor = this.Cursor; try { this.Cursor = Cursors.WaitCursor; #region consent_mst 데이터 저장 consentMstRidInt consentMstRidInt = this.consentWebService.SaveCompleteAll(userId, patientCode, clnDeptCode, formRidInt, formCd, consentMstRidInt, rewriteConsentMstRid, eptXmlValue, dataValue, "WIN", deviceIdentNo, vistType, hosType, clnDate, ward, roomcd, orderNo, orderName, orderCode, ocrCode, cretno, userName, userName, this.exportedImageFilesJson, sCertTarget, sCertResult, dschdd, consentState, mainDrId ); #endregion //#region 기왕력 데이터 저장 sPID SetNewMedicalHistory(dataValue); //string sPID = this.consentWebService.SaveMedicalHistory( // patientCode, // clnDate.Replace("-", ""), // this.CurrentTargetPatient.Ex_bp, // this.CurrentTargetPatient.Ex_dm, // this.CurrentTargetPatient.Ex_heart, // this.CurrentTargetPatient.Ex_kidney, // this.CurrentTargetPatient.Ex_respiration, // this.CurrentTargetPatient.Ex_hx, // this.CurrentTargetPatient.Ex_allergy, // this.CurrentTargetPatient.Ex_drug, // this.CurrentTargetPatient.Ex_smoking, // this.CurrentTargetPatient.Ex_idio, // this.CurrentTargetPatient.Ex_nacrotics, // this.CurrentTargetPatient.Ex_airway, // this.CurrentTargetPatient.Ex_hemorrhage, // this.CurrentTargetPatient.Ex_status_etc, // userId // ); //#endregion //이미지를 서버에 업로드 //int result = TranslateConsentToImageServer(exportedImageFiles, consentMstRidInt, sCertResult); //if (result == -10) //{ // throw new Exception("파일명 조회가 정상적으로 이루어지지 않았습니다."); //} //else if (result < 1) //{ // throw new Exception("이미지 서버 저장중 오류가 발생하였습니다."); //} //else //{ this.consentMain.ConsentListCtrl.InquiryConsentData(consentMstRidInt); MessageBoxDlg.Show(this, string.Format(Properties.Resources.msg_esign_N_comp_save_confirm) , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information); this.consentMain.ReInitializeViewer(); //} this.Cursor = currentCursor; } catch (Exception ex) { this.Cursor = currentCursor; throw ex; } finally { #region export 파일삭제 try { if (!string.IsNullOrEmpty(exportedImageFiles)) { string[] imgFile = exportedImageFiles.Split('^'); if (imgFile != null && imgFile.Length > 0) { FileInfo fileInfo; foreach (string sImgFileName in imgFile) { fileInfo = new FileInfo(sImgFileName); if (fileInfo != null) { // 이미지 파일 삭제 fileInfo.Delete(); } } fileInfo = new FileInfo(imgFile[0].Replace("_0.jpg", ".xml")); if (fileInfo != null) { // EPT 파일 삭제 fileInfo.Delete(); } } } } catch (System.IO.IOException e) { throw e; } #endregion } saveResult = 1; return true; } private string ConsentImageSignature(string sCertTarget, string userId, string userName) { string resultValue = string.Empty; try { if (!string.IsNullOrEmpty(sCertTarget)) { // 공인인증 서명 SignatureConfig sign = new SignatureConfig(); string rtn = ""; // 메모리에 본인 공인인증서가 아닐 경우 string sSignIp = consentMain.PluginExecuteInfo["signatureServerUrl"]; string sSignPort = consentMain.PluginExecuteInfo["signatureServerPort"]; int iPort = 0; int.TryParse(sSignPort, out iPort); // 공인인증 서버 접속 rtn = sign.SetSignServerInfo(sSignIp, iPort, userId); // 공인인증 서명 resultValue = sign.SignatureExec(sCertTarget, rtn, userName, userId, this.consentMain.saveClickPoint); if (string.IsNullOrEmpty(resultValue) || resultValue == "-1") { // 공인인증 서명에 실패하였을 경우 return "-50"; } } } catch (Exception ex) { MessageBoxDlg.Show(true, string.Format(ex.Message) , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information); resultValue = "-99"; } return resultValue; } private int TranslateConsentToImageServer(string exportedImageFiles, string sCertResult) { int resultValue = -1; if (!string.IsNullOrEmpty(exportedImageFilesJson) && !string.IsNullOrEmpty(exportedImageFiles)) { Dictionary jsonRoot = null; try { jsonRoot = fastJSON.JSON.Parse(exportedImageFilesJson) as Dictionary; if (jsonRoot != null && jsonRoot.Count > 0) { string sPath = string.Empty; string sFileName = string.Empty; string[] sFullPath = exportedImageFiles.Split('^'); int k = 0; foreach (KeyValuePair jr in jsonRoot) { if (jr.Value != null && !string.IsNullOrEmpty(jr.Value.ToString())) { sPath = string.Empty; sFileName = string.Empty; string[] filepath = jr.Value.ToString().Split('/'); for (int i = 0; i < filepath.Length; i++) { if (i == 0) { sPath = filepath[i]; } else if ((i + 1) == filepath.Length) { sFileName = filepath[i]; } else { sPath += "/" + filepath[i]; } } //이미지를 서버에 업로드(전자동의서 서버에 저장) System.Net.WebClient wcClient = new System.Net.WebClient(); string imageUploadServerUrl = this.consentMain.PluginExecuteInfo["imageUploadServerUrl"]; System.Collections.Specialized.NameValueCollection values = new System.Collections.Specialized.NameValueCollection(); values.Add("up_path", sPath + "/" + sFileName); wcClient.QueryString = values; wcClient.UploadFile(imageUploadServerUrl, "POST", sFullPath[k++]); } } } } catch( Exception ex) { return resultValue = -99; } resultValue = 1; } return resultValue; } //private int TranslateConsentToImageServer(string exportedImageFiles, int consentMstRidInt, string sCertResult) //{ // int resultValue = -1; // if (!string.IsNullOrEmpty(exportedImageFiles)) // { // string[] aryimgFile = exportedImageFiles.Split('^'); // if (aryimgFile != null && aryimgFile.Length > 0) // { // try // { // int consentImageRid_F = 0; // string sCertTarget = ""; // for (int i = 0; i < aryimgFile.Length; i++) // { // string imgFile = aryimgFile[i]; // //MessageBox.Show(CurrentTargetPatient.PatientCode + "," + CurrentTargetPatient.VisitType + "," + CurrentTargetPatient.clnDate + "," + "20150815" + "," + CurrentTargetPatient.cretno + "," + "500" + "," + CurrentPreviewConsent.FormCd + "," + i.ToString() + "," + CurrentPreviewConsent.Ocrcode + "," + CurrentEndUser.UserNo); // //LCTech 모듈을 위한 DB 작업을 하고 저장할 파일명을 얻는다. // string newFileFullName = this.hospitalWebService.GetFileName(CurrentTargetPatient.PatientCode, CurrentTargetPatient.VisitType, // CurrentTargetPatient.clnDate.Replace("-", ""), CurrentTargetPatient.Dschdd, CurrentTargetPatient.cretno, // "500", CurrentPreviewConsent.FormCd, i.ToString(), // CurrentPreviewConsent.Ocrcode, CurrentEndUser.UserNo); // //MessageBox.Show(newFileFullName); //O:\fnuImage\201607\19\100501967 // string uploadFileName = newFileFullName + ".jpg"; // if (string.IsNullOrEmpty(newFileFullName)) // { // return -10; // } // //이미지 정보 DB에 저장 // int consentImageRid = this.consentWebService.SaveImageUploadInfo("ELECTR_CMP", uploadFileName, // consentMstRidInt, CurrentEndUser.UserNo, int.Parse(CurrentPreviewConsent.FormRid)); // /* // //저장된 이미지에서 해쉬정보 추출 // string sCertTarget = GetImageCertification(imgFile); // //해쉬정보 DB에 저장 // this.consentWebService.SaveImageSignInfo("ELECTR_CMP", consentMstRidInt, consentImageRid, // CurrentEndUser.UserNo, sCertTarget); // */ // if (i == 0) consentImageRid_F = consentImageRid; //첫번째 consentImageRid 를 저장한다. // sCertTarget += GetImageCertification(imgFile) + "^"; // //이미지를 서버에 업로드(서버에서 나스에 저장) // System.Net.WebClient wcClient = new System.Net.WebClient(); // string imageUploadServerUrl = this.consentMain.PluginExecuteInfo["imageUploadServerUrl"]; // System.Collections.Specialized.NameValueCollection values = new System.Collections.Specialized.NameValueCollection(); // values.Add("up_path", uploadFileName); // wcClient.QueryString = values; // wcClient.UploadFile(imageUploadServerUrl, "POST", imgFile); // File.Delete(imgFile); // } // // 외래일 경우 공인인증 처리가 없음. // if (!string.IsNullOrEmpty(CurrentTargetPatient.VisitType) && !CurrentTargetPatient.VisitType.Equals("O")) // { // sCertTarget = sCertTarget.Substring(0, sCertTarget.Length - 1); // this.consentWebService.SaveImageSignInfo("ELECTR_CMP", consentMstRidInt, consentImageRid_F, // CurrentEndUser.UserNo, sCertTarget, sCertResult); // } // resultValue = 1; // } // catch (Exception err) // { // resultValue = -99; // throw err; // } // } // } // return resultValue; //} private string GetImageCertification(string exportedImageFile) { try { FileStream fileStream = null; fileStream = new FileStream(exportedImageFile, FileMode.Open); fileStream.Position = 0; SHA256 mySHA256 = SHA256Managed.Create(); byte[] hashValue = mySHA256.ComputeHash(fileStream); fileStream.Close(); return byteArrayToString(hashValue); } catch (Exception ex) { string exMessage = ex.Message; if (ex.InnerException != null) { exMessage += Environment.NewLine + ex.InnerException.Message; } return exMessage; } } private string byteArrayToString(byte[] bStr) { string hexOutput = string.Empty; foreach (char letter in bStr) { int value = Convert.ToInt32(letter); hexOutput += String.Format("{0:x}", value); } return hexOutput; } public override void WorkExtraWithSavedImageFiles(string savedImageFileDescription) { string[] aryImageInfo = savedImageFileDescription.Split(';'); Dictionary dicImageInfo = new Dictionary(); foreach (string imageInfo in aryImageInfo) { string[] aryInfo = imageInfo.Split('='); if (aryInfo.Length == 2) { dicImageInfo.Add(aryInfo[0], aryInfo[1]); } } int baseIndex = -1; int.TryParse(dicImageInfo["base-index"], out baseIndex); int totalFiles = -1; int.TryParse(dicImageInfo["total-files"], out totalFiles); if (baseIndex > -1 && totalFiles > 0) { this.exportedImageFiles = string.Empty; this.exportedImageFilesJson = "{ "; string sUploadPath = string.Empty; for (int i = baseIndex; i < baseIndex + totalFiles; i++) { string exportedImageFile = string.Format("{0}\\{1}_{2}.{3}", dicImageInfo["path"], dicImageInfo["key"], i, dicImageInfo["extention"]); exportedImageFiles += exportedImageFile; sUploadPath = string.Format("{0}/{1}", DateTime.Now.ToString("yyyyMM"), DateTime.Now.ToString("dd")); this.exportedImageFilesJson += string.Format("\"imageFile{0}\" : \"{1}/{2}_{3}.{4}\"", i, sUploadPath, dicImageInfo["key"], i, dicImageInfo["extention"]); if (i + 1 < (baseIndex + totalFiles)) { exportedImageFiles += "^"; this.exportedImageFilesJson += ", "; } } this.exportedImageFilesJson += " }"; System.Diagnostics.Debug.WriteLine("Debug=> exportedImageFiles: " + this.exportedImageFiles); System.Diagnostics.Debug.WriteLine("Debug=> exportedImageFilesJson: " + this.exportedImageFilesJson); } } private void ConvertStringToInt(string formRid, string consentMstRid, out int formRidInt, out int consentMstRidInt) { formRidInt = 0; int.TryParse(formRid, out formRidInt); consentMstRidInt = 0; int.TryParse(consentMstRid, out consentMstRidInt); } private void ChangeGlobalParametersToNew(Dictionary baseGlobalParams, Dictionary changingGlobalParams) { foreach (string dicKey in changingGlobalParams.Keys) { if (baseGlobalParams.ContainsKey(dicKey)) { baseGlobalParams[dicKey] = changingGlobalParams[dicKey]; } } } /// /// 사용자에 따른 버튼 활성화 /// private void SetEnableByUserType() { // 기록 테이블의 출력 유무에 따른 서명버튼 활성화 처리 SetSaveButtonDisabledWhenPrintYN(); } private void SetSaveButtonDisabledWhenPrintYN() { if (this.CurrentEndUser != null && this.CurrentPreviewConsent != null && !string.IsNullOrEmpty(this.CurrentPreviewConsent.PrintOnly) && this.CurrentPreviewConsent.PrintOnly.Equals("Y") ) { // 출력만 가능하게 설정 this.toolStripButtonPrint.Enabled = true; this.toolStripButtonSaveToServer.Enabled = false; this.toolStripButtonTempSaveToServer.Enabled = false; this.toolStripButtonExecute.Enabled = false; } // 출력 상태일 경우 재출력만 가능하도록 버튼 조정 else if (this.CurrentEndUser != null && this.CurrentPreviewConsent != null && !string.IsNullOrEmpty(this.CurrentPreviewConsent.ConsentState) && ( this.CurrentPreviewConsent.ConsentState.ToUpper().Equals("PAPER_OUT")) ) { // 재출력만 가능하게 설정 this.toolStripButtonPrint.Enabled = true; this.toolStripButtonSaveToServer.Enabled = false; this.toolStripButtonTempSaveToServer.Enabled = false; this.toolStripButtonExecute.Enabled = false; } else if (this.CurrentEndUser != null && this.CurrentPreviewConsent != null && !string.IsNullOrEmpty(this.CurrentPreviewConsent.ConsentState) && (!this.CurrentPreviewConsent.ConsentState.ToUpper().Equals("UNFINISHED")) ) { // 출력이 불가능하도록 설정 this.toolStripButtonPrint.Enabled = false; } //일반의사가 켤 경우 if (this.CurrentEndUser.UserNo.Substring(0, 4).Equals("5000") && this.CurrentPreviewConsent != null && !string.IsNullOrEmpty(this.CurrentPreviewConsent.PrintOnly) ) { // 출력만 가능하게 설정 this.toolStripButtonPrint.Enabled = true; this.toolStripButtonSaveToServer.Enabled = false; this.toolStripButtonTempSaveToServer.Enabled = false; this.toolStripButtonExecute.Enabled = false; } } private void PrintConsent() { // 환자정보가 없을 경우 출력이 되지 않도록 적용 if (this.CurrentTargetPatient == null || string.IsNullOrEmpty(this.CurrentTargetPatient.PatientCode) || string.IsNullOrEmpty(this.CurrentTargetPatient.PatientName)) { DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_error_user_data) , string.Format(Properties.Resources.msg_caption_fail), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } // 출력 : patientInfo 를 기반으로 출력하는 경우와 환자목록에서 멀티선택 출력의 경우로 나눠야 한다. List volist = consentMain.PatientListCtrl.GetSelectedPatientList; if (volist.Count == 1) { MessageBox.Show(string.Format("멀티출력은 두명이상 선택하여 주십시오.") , string.Format(Properties.Resources.msg_caption_fail), MessageBoxButtons.OK, MessageBoxIcon.Information); /*if(this.CurrentPreviewConsent.ConsentMstRid != null && !string.IsNullOrEmpty(this.CurrentPreviewConsent.ConsentMstRid) && !this.CurrentPreviewConsent.ConsentMstRid.Equals("-1") && !this.CurrentPreviewConsent.ConsentMstRid.Equals("0")) { DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_multi_print_fail) , string.Format(Properties.Resources.msg_caption_fail), MessageBoxButtons.OK, MessageBoxIcon.Information); } else { PrintConsentDocument(); }*/ } else if (volist.Count > 1) { if (this.CurrentPreviewConsent.ConsentMstRid != null && !string.IsNullOrEmpty(this.CurrentPreviewConsent.ConsentMstRid) && !this.CurrentPreviewConsent.ConsentMstRid.Equals("-1") && !this.CurrentPreviewConsent.ConsentMstRid.Equals("0")) { DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_multi_print_fail) , string.Format(Properties.Resources.msg_caption_fail), MessageBoxButtons.OK, MessageBoxIcon.Information); } else { //DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_multi_print_question) // , string.Format(Properties.Resources.msg_caption_fail), // MessageBoxButtons.OKCancel, MessageBoxIcon.Information); //if (result == DialogResult.OK) //{ this.CurrentPreviewConsent.OutputType = "MULTI"; MultiPrintConsentDocument(volist); //} //else //{ // PrintConsentDocument(); //} } } else { PrintConsentDocument(); } } //미리보기 데이터를 출력하는 경우 public void PrintConsentDocument() { //Dictionary globalParams = Common.CreateGlobalParamsDictionary(); //Dictionary changingGlobalParams = new Dictionary(); //SetPatientAndUser(globalParams, true); //changingGlobalParams["IO_device"] = "P"; //changingGlobalParams["IO_ocr_cd"] = this.CurrentPreviewConsent.Ocrcode = GetOcrCode(); // OCR 코드 //changingGlobalParams["IO_printtime"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //ChangeGlobalParametersToNew(globalParams, changingGlobalParams); //List formGuids = new List(); //formGuids.Add(this.CurrentPreviewConsent.FormGuid); //string fos = Common.GetFosString(formGuids // , this.consentMain.PluginExecuteInfo["formServiceUrl"] // , globalParams // , null); //this.consentMain.PrintConsentDocument(fos); Dictionary> formParamsList = new Dictionary>(); string[] formGuidList = new string[this.CurrentPreviewConsent.PrntCnt]; int prntCnt = 0; string sOcrCd = string.Empty; for (int i = 0; i < this.CurrentPreviewConsent.PrntCnt; i++) { Dictionary formParams = Common.CreateGlobalParamsDictionary(); Dictionary changingFormParams = new Dictionary(); SetPatientAndUser(formParams, true); changingFormParams["IO_device"] = "P"; changingFormParams["IO_printtime"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (i == 0) { changingFormParams["IO_ocr_cd"] = this.CurrentPreviewConsent.Ocrcode = GetOcrCode(); // OCR 코드 sOcrCd = this.CurrentPreviewConsent.Ocrcode; } else { changingFormParams["IO_ocr_cd"] = sOcrCd; //OCR코드 } if (i == 1) changingFormParams["IO_print_comment"] = Properties.Resources.msg_print_comment_2; else if (i == 2) changingFormParams["IO_print_comment"] = Properties.Resources.msg_print_comment_3; ChangeGlobalParametersToNew(formParams, changingFormParams); formGuidList[prntCnt] = this.CurrentPreviewConsent.FormGuid; formParamsList.Add((prntCnt + 1).ToString(), formParams); prntCnt++; } string fos = Common.GetMultiFosString(formGuidList , this.consentMain.PluginExecuteInfo["formServiceUrl"] , null , formParamsList); this.consentMain.PrintConsentDocument(fos); } public void PrintDirectConsentDocument() { if (this.currentPreviewConsent == null || this.CurrentTargetPatient == null || this.CurrentEndUser == null) { return; } //미리보기 데이터를 바로 출력하는 경우는 미작성상태인 경우로만 한다. (임시작성 이상의 경우는 바로 출력을 안하도록) if (!this.currentPreviewConsent.ConsentState.ToUpper().Equals("UNFINISHED")) { return; } //Dictionary globalParams = Common.CreateGlobalParamsDictionary(); //Dictionary changingGlobalParams = new Dictionary(); //SetPatientAndUser(globalParams, true); //changingGlobalParams["IO_device"] = "P"; //changingGlobalParams["IO_ocr_cd"] = this.CurrentPreviewConsent.Ocrcode = GetOcrCode(); // OCR 코드 ////changingGlobalParams["IO_signdate"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ////changingGlobalParams["IO_signtime"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //changingGlobalParams["IO_printtime"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //ChangeGlobalParametersToNew(globalParams, changingGlobalParams); //List formGuids = new List(); //formGuids.Add(this.CurrentPreviewConsent.FormGuid); //string fos = Common.GetFosString(formGuids // , this.consentMain.PluginExecuteInfo["formServiceUrl"] // , globalParams // , null); int prntCnt = 0; prntCnt = this.CurrentPreviewConsent.PrntCnt; int prntMsgCnt = 0; if (this.consentMain.ConsentExecuteInfo.ContainsKey("printList") && !string.IsNullOrEmpty(this.consentMain.ConsentExecuteInfo["printList"])) { if (this.consentMain.ConsentExecuteInfo.ContainsKey("prntCnt") && !string.IsNullOrEmpty(this.consentMain.ConsentExecuteInfo["prntCnt"]) && !this.consentMain.ConsentExecuteInfo["prntCnt"].ToString().Equals("-1")) { int.TryParse(this.consentMain.ConsentExecuteInfo["prntCnt"].ToString(), out prntCnt); prntMsgCnt++; } } Dictionary> formParamsList = new Dictionary>(); string[] formGuidList = new string[prntCnt]; string sOcrCd = string.Empty; for (int i = 0; i < prntCnt; i++) { Dictionary formParams = Common.CreateGlobalParamsDictionary(); Dictionary changingFormParams = new Dictionary(); SetPatientAndUser(formParams, true); changingFormParams["IO_device"] = "P"; changingFormParams["IO_printtime"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //MessageBox.Show(this.CurrentPreviewConsent.Ocrcode); if (i == 0) { changingFormParams["IO_ocr_cd"] = this.CurrentPreviewConsent.Ocrcode = GetOcrCode(); // OCR 코드 sOcrCd = this.CurrentPreviewConsent.Ocrcode; } else { changingFormParams["IO_ocr_cd"] = sOcrCd; //OCR코드 } //MessageBox.Show("this.CurrentPreviewConsent.Ocrcode[" + this.CurrentPreviewConsent.Ocrcode + "]sOcrCd[" + sOcrCd + "]changingFormParams[" + changingFormParams["IO_ocr_cd"] + "]"); if (prntMsgCnt == 1) changingFormParams["IO_print_comment"] = Properties.Resources.msg_print_comment_2; else if (prntMsgCnt == 2) changingFormParams["IO_print_comment"] = Properties.Resources.msg_print_comment_3; ChangeGlobalParametersToNew(formParams, changingFormParams); formGuidList[i] = this.CurrentPreviewConsent.FormGuid; formParamsList.Add((i + 1).ToString(), formParams); prntMsgCnt++; } string fos = Common.GetMultiFosString(formGuidList , this.consentMain.PluginExecuteInfo["formServiceUrl"] , null , formParamsList); this.consentMain.PrintDirect(fos); } //멀티출력일 경우 동의서 미리보기 private void MultiPrintConsentDocument(List voList) { Dictionary> formParamsList = new Dictionary>(); List formGuids = new List(); int guidCnt = 0; this.CurrentPreviewConsent.MultiOcrcode = ""; this.CurrentPreviewConsent.MultiMainDrIdCd = ""; this.CurrentPreviewConsent.Ocrcode = ""; if (voList.Count > 0 && this.CurrentPreviewConsent.PrntCnt > 0) { guidCnt = voList.Count * this.CurrentPreviewConsent.PrntCnt; } string[] formGuidList = new string[guidCnt]; int prntCnt = 0; string sOcrCd = string.Empty; for (int i=0; i formParams = Common.CreateGlobalParamsDictionary(); Dictionary changingFormParams = new Dictionary(); changingFormParams["UrlParam"] = this.consentMain.PluginExecuteInfo["imageUploadPath"] + "/"; changingFormParams["IO_device"] = "P"; changingFormParams["IO_Pt_ID"] = vo.IO_Pt_ID; changingFormParams["IO_sex_age_y_m"] = vo.IO_sex_age_y_m; changingFormParams["IO_Pt_name"] = vo.IO_Pt_Name; changingFormParams["IO_JuminNo"] = vo.IO_JuminNo; changingFormParams["IO_roomNo"] = vo.IO_Ward + "/" + vo.IO_RoomNo; changingFormParams["IO_ADdate"] = SetDateFormatting(vo.IO_ADdate); changingFormParams["IO_Dept"] = vo.IO_DeptNm; changingFormParams["IO_Dept2"] = vo.IO_Dept2; changingFormParams["IO_formname"] = this.CurrentPreviewConsent.FormName; changingFormParams["IO_maindr"] = vo.IO_MaindrNm; changingFormParams["IO_Pt_tel"] = vo.IO_Tel; changingFormParams["IO_Pt_address"] = vo.IO_Zipcdaddr; if (j == 0) { changingFormParams["IO_ocr_cd"] = vo.IO_OcrCd = hospitalWebService.GetOcrTag(); //OCR코드 this.CurrentPreviewConsent.MultiOcrcode += vo.IO_OcrCd + "^"; this.CurrentPreviewConsent.MultiMainDrIdCd += vo.IO_MaindrId + "^"; sOcrCd = vo.IO_OcrCd; } else { changingFormParams["IO_ocr_cd"] = sOcrCd; //OCR코드 } if (j == 1) changingFormParams["IO_print_comment"] = Properties.Resources.msg_print_comment_2; else if (j == 2) changingFormParams["IO_print_comment"] = Properties.Resources.msg_print_comment_3; changingFormParams["IO_printtime"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ChangeGlobalParametersToNew(formParams, changingFormParams); formGuidList[prntCnt] = this.CurrentPreviewConsent.FormGuid; //formGuids.Add(this.CurrentPreviewConsent.FormGuid); formParamsList.Add((prntCnt+1).ToString(), formParams); prntCnt++; } } if (this.CurrentPreviewConsent.MultiOcrcode.Length > 0) { this.CurrentPreviewConsent.MultiOcrcode = this.CurrentPreviewConsent.MultiOcrcode.Substring(0, this.CurrentPreviewConsent.MultiOcrcode.Length - 1); } if (this.CurrentPreviewConsent.MultiMainDrIdCd.Length > 0) { this.CurrentPreviewConsent.MultiMainDrIdCd = this.CurrentPreviewConsent.MultiMainDrIdCd.Substring(0, this.CurrentPreviewConsent.MultiMainDrIdCd.Length - 1); } string fos = Common.GetMultiFosString(formGuidList , this.consentMain.PluginExecuteInfo["formServiceUrl"] , null , formParamsList); //string fos = Common.GetMultiFosString(formGuids // , this.consentMain.PluginExecuteInfo["formServiceUrl"] // , null // , formParamsList); this.consentMain.PrintConsentDocument(fos); } private string SetDateFormatting(string adDate) { if (adDate.Length == 8) return string.Format("{0}/{1}/{2}", adDate.Substring(0, 4), adDate.Substring(4, 2), adDate.Substring(6, 2)); else return adDate; } public override void OnRequiredInputViolation(string value) { MessageBoxDlg.Show(true, value + " 항목이 누락되었습니다.", Properties.Resources.msg_caption_warn, MessageBoxButtons.OK, MessageBoxIcon.Warning); } public override void onEnableDrawing(bool enabled) { this.toolStripButtonPen.Checked = enabled; if (this.toolStripButtonPen.Checked) this.toolStripButtonPen.Image = global::CLIP.eForm.Consent.Dfh.UI.Properties.Resources.newDrawingClick; else this.toolStripButtonPen.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonPen.Image"))); } private void toolStripButtonDeleteAttach_Click(object sender, EventArgs e) { this.consentMain.DeleteAttach(); setViewerPageInit(); } private void toolStripButtonInsertAttach_Click(object sender, EventArgs e) { this.consentMain.InsertAttach(); setViewerPageInit(); } public override void setViewerPageInit() { this.toolStripLabelTotalPages.Text = this.consentMain.GetTotalPageCount().ToString(); this.toolStripTextBoxPageIndex.Text = this.consentMain.GetCurrentPageIndex().ToString(); } private void toolStripButtonConfig_Click(object sender, EventArgs e) { ShowConfigDialog(); } private void ShowConfigDialog() { ConfigForm configForm = new ConfigForm(); configForm.ShowDialog(this); } class ZoomRateDropdownItem { private string caption = string.Empty; public string Caption { get { return caption; } set { caption = value; } } private string itemValue = string.Empty; public string ItemValue { get { return itemValue; } set { itemValue = value; } } public ZoomRateDropdownItem() { } public ZoomRateDropdownItem(string caption, string itemValue) { this.caption = caption; this.itemValue = itemValue; } public override string ToString() { return caption; } } private void toolStripButtonConfig_Click_1(object sender, EventArgs e) { ShowConfigDialog(); } private void ConsentCommandCtrl_Click(object sender, EventArgs e) { MessageBoxDlg.MessageBoxParent = this; } } }